Skip to content

fix: broken shell syntax in git.run() calls (checkpoint, what-changed, session-health)#171

Closed
TerminalGravity wants to merge 1 commit intomainfrom
fix/shell-syntax-in-git-run
Closed

fix: broken shell syntax in git.run() calls (checkpoint, what-changed, session-health)#171
TerminalGravity wants to merge 1 commit intomainfrom
fix/shell-syntax-in-git-run

Conversation

@TerminalGravity
Copy link
Collaborator

Problem

run() in lib/git.ts uses execFileSync which does not interpret shell operators (|, ||, &&, 2>/dev/null). Multiple tools were passing shell pipelines and redirects as if they were shell commands, causing silent failures.

Same bug class as #170 (clarify-intent).

Fixed in this PR

  • what-changed.ts: Used getDiffFiles() helper + array args for git log
  • checkpoint.ts: Array args for add/commit/reset instead of shell chains
  • session-health.ts: Array args for diff --stat, split output in JS instead of piping to tail -1

Still affected (tracked in separate issue)

verify-completion, token-audit, session-handoff, audit-workspace, sharpen-followup, scope-work, enrich-agent-task, sequence-tasks — all have the same pattern.

Testing

  • pnpm tsc --noEmit clean
  • All 43 tests pass

…, session-health)

run() uses execFileSync which doesn't interpret shell operators (|, ||, &&,
2>/dev/null). These tools were passing shell pipelines/redirects as git args,
causing silent failures or incorrect results.

Fixed:
- what-changed: use getDiffFiles() helper and array args for log
- checkpoint: use array args for add/commit/reset instead of shell chains
- session-health: use array args for diff --stat, split output in JS

Same bug class as PR #170 (clarify-intent). Many more tools still affected —
see forthcoming issue for tracking.
@TerminalGravity
Copy link
Collaborator Author

Superseded by #175 which covers all the shell syntax fixes in one PR. Closing in favor of that.

TerminalGravity added a commit that referenced this pull request Mar 10, 2026
Fixes #172 — remaining tools after #170 and #171.

Tools fixed:
- verify-completion: replaced shell-piped tsc/test/build commands with
  execFileSync, read package.json via fs instead of cat
- token-audit: replaced wc/tail shell commands with fs.readFileSync,
  fs.statSync, and Buffer reads
- session-handoff: replaced 'command -v' with 'which' via execFileSync,
  replaced gh shell pipe with direct execFileSync call
- audit-workspace: replaced shell-piped find|wc with git ls-files + JS filter
- sharpen-followup: replaced shell-string run() calls with array args
- scope-work: replaced git ls-files|head|grep pipe with JS array ops,
  fixed 'git git' double-prefix on status/diff calls
- enrich-agent-task: replaced all shell-piped git/head/grep with
  JS fs.readFileSync and array filtering
- sequence-tasks: replaced git ls-files pipe with array args + JS slice

All changes use Node.js fs/child_process directly or pass proper
array args to run(), eliminating silent failures from shell operators
being passed as literal git arguments.
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.

1 participant