Skip to content

fix: resolve remaining shell syntax in run() calls (closes #110)#119

Open
TerminalGravity wants to merge 1 commit intomainfrom
fix/shell-syntax-issue-110
Open

fix: resolve remaining shell syntax in run() calls (closes #110)#119
TerminalGravity wants to merge 1 commit intomainfrom
fix/shell-syntax-issue-110

Conversation

@TerminalGravity
Copy link
Collaborator

@TerminalGravity TerminalGravity commented Mar 5, 2026

Problem

After the execFileSync migration, 8 tool files still passed shell syntax (pipes, redirects, non-git binaries like wc, find, cat, head, tail, command -v, gh) to run(), which wraps execFileSync('git', args). These commands silently fail because shell operators become literal git arguments.

Solution

Option 3 from #110: both approaches.

  1. Added shell() helper in git.ts — uses execSync for commands that genuinely need shell features (pipes, redirects, non-git binaries)
  2. Converted simple git commands to proper array args where no shell features are needed

Files fixed (all 8 from the issue)

  • verify-completion.tscat, tsc | tail, build | tail
  • token-audit.tswc -l, wc -c, tail -c, git diff → array args
  • clarify-intent.tstsc | grep, find | head
  • session-handoff.tscommand -v, gh pr list || echo
  • audit-workspace.ts — git diff → array args, find | wc -l
  • enrich-agent-task.tsgit ls-files | grep, head -30
  • scope-work.tsgit ls-files | head | grep
  • sequence-tasks.tsgit ls-files | head

Build clean, all 43 tests pass.

Closes #110

@TerminalGravity TerminalGravity force-pushed the fix/shell-syntax-issue-110 branch from d57447c to 5594e3d Compare March 5, 2026 17:48
@TerminalGravity TerminalGravity changed the title fix: shell syntax bugs in remaining 8 tool files (#110) fix: resolve remaining shell syntax in run() calls (closes #110) Mar 5, 2026
@TerminalGravity
Copy link
Collaborator Author

CI is green on this one ✅. However, looking at #120, it covers 4 additional files that this PR misses (checkpoint.ts, session-health.ts, sharpen-followup.ts, what-changed.ts). If we go with #119 we'd still have shell syntax lurking in those files.

Recommendation: either expand this PR to cover those 4 files too, or let #120 be the canonical fix once its CI passes. As-is, #120 is the more complete solution.

…files

Fixes #110. The run() function uses execFileSync (no shell), but many
tool files were passing shell syntax (pipes, redirects, ||, &&) that
silently broke after the execFileSync migration.

Added a shell() helper to git.ts that uses execSync for commands that
genuinely need shell features. Migrated all affected tool files:

- verify-completion.ts: tsc pipes, build pipes, cat → readFileSync
- checkpoint.ts: git add/commit chains, git reset
- clarify-intent.ts: tsc | grep, find | head
- enrich-agent-task.ts: git ls-files | grep/head, head -30
- audit-workspace.ts: git diff || echo, find | wc -l
- session-handoff.ts: command -v, gh pr list || echo
- scope-work.ts: git ls-files | head | grep
- sequence-tasks.ts: git ls-files | head
- token-audit.ts: wc -l, wc -c, tail -c, git diff (converted to array args where no shell needed)
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.

Widespread shell syntax in run() calls after execFileSync migration

1 participant