Skip to content

fix: run() misuse across 9 remaining tools - #229

Open
TerminalGravity wants to merge 2 commits into
mainfrom
fix/run-misuse-remaining-tools
Open

fix: run() misuse across 9 remaining tools#229
TerminalGravity wants to merge 2 commits into
mainfrom
fix/run-misuse-remaining-tools

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Fixes all remaining tools from #215 where run() was misused with shell syntax.

The bug: run() uses execFileSync('git', args) — no shell, always prepends git. Calls like run('cat package.json') become git cat package.json, run('find tests ...') becomes git find tests ..., and pipes/redirects silently fail.

The fix:

  • Added shell() helper to src/lib/git.ts (uses execSync with shell support) for commands that genuinely need pipes/redirects/non-git binaries
  • Converted git commands to use run() with proper array args (no git prefix, no redirects)
  • Replaced run('cat ...') / run('head ...') with Node fs APIs

Files fixed: audit-workspace, checkpoint, clarify-intent, enrich-agent-task, scope-work, sequence-tasks, session-handoff, sharpen-followup, verify-completion

Builds clean (tsc --noEmit passes).

Closes #215

…tools

Fixes the remaining tools listed in #215 where run() was being called
with shell syntax (pipes, redirects, non-git commands). run() uses
execFileSync('git', args) — no shell, always prepends 'git'.

Changes:
- Add shell() helper to src/lib/git.ts (execSync with shell support)
- verify-completion: use shell() for tsc/build, readFileSync for package.json, array args for git diff
- clarify-intent: use shell() for tsc and find commands
- session-handoff: use shell() for command -v and gh pr list
- audit-workspace: use run() with array args for git diff, shell() for find
- sharpen-followup: use run() with array args for git diff/status
- enrich-agent-task: use shell() for piped git ls-files, readFileSync for head
- sequence-tasks: use shell() for piped git ls-files
- checkpoint: use run() with array args for git add/reset, shell() for compound command
- scope-work: use run() with array args for git status/diff, shell() for piped ls-files

Closes #215

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — this is the cleanest version of the #215 fix. The shell() helper is well-scoped and the readFileSync replacements are more portable.

Minor notes:

  • Double-check shellEscape handles single quotes in area names
  • Silent error swallowing in shell()"" is fine for now, but might want an opt-in throw path later

This supersedes #220 and #225 — recommend merging this and closing those two.

Shows real input/output examples for preflight_check, prompt_score,
scope_work, estimate_cost, log_correction, and search_history.
Includes workflow tip for automatic preflight via CLAUDE.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: run() misuse across 8+ tools — shell commands silently failing

1 participant