Files
ruflo/v3/@claude-flow
ruv 8009a152f8 fix(init,doctor): #2448 — migrate stale npx @latest statusLine + hooks
CRITICAL — affected user reported load average 49 / jetsam / kernel
watchdog panic on macOS 26.1 / 48 GB. Pre-#2337 init wrote
`npx @claude-flow/cli@latest hooks <sub>` into ~/.claude/settings.json
for both the statusLine and the per-action hooks. Each invocation cold-
spawns a Node process (~130 MB) plus an npm registry round-trip to
re-resolve @latest. The statusLine refires every few hundred ms; hooks
fire per tool use. They stack faster than they exit.

The current source already emits the local-helper form
(`sh -c '… exec node "$D/.claude/helpers/<helper>" <sub>'`), but
executor.ts:362 preserved the user's existing `statusLine.command`
verbatim on re-init — so anyone who installed pre-#2337 and upgraded
to 3.13.2 still has the runaway commands.

Two changes:

  1. v3/@claude-flow/cli/src/init/executor.ts
     - Detect the broken `npx @claude-flow/cli@latest hooks …` pattern
       in `existing.statusLine.command` AND walk every hooks.<event>[]
       hooks[].command — regenerate to the local-helper form when
       matched. Idempotent on already-correct settings.
     - Captures the subcommand from the broken string (pre-bash,
       post-edit, route, etc.) so the regenerated command preserves
       the user's intent.

  2. v3/@claude-flow/cli/src/commands/doctor.ts
     - New `checkStaleSettingsNpx` health check. Scans both
       project-local AND $HOME/.claude/settings.json for the broken
       pattern in statusLine + hooks. Reports `fail` with file path
       + offending sections when found, with fix instruction
       (`npx ruflo init` to migrate). Reports `pass` otherwise.
     - Registered as `stale-settings` in the component map so users
       can run `ruflo doctor --component stale-settings` directly.

Smoke-verified against a synthetic fixture containing all three
offender shapes (statusLine, PreToolUse hook, UserPromptSubmit hook
with --prefer-offline prefix). Doctor correctly flagged all three.

Release: 3.13.2 → 3.13.3 (PATCH per semver — pure bug fix).
Published with all three dist-tags (latest/alpha/v3alpha) for
@claude-flow/cli, claude-flow, and ruflo.

Closes #2448.

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-06-22 14:00:19 -04:00
..