Skip to content

fix: replace shell syntax in run() calls across all 8 remaining tools#195

Closed
TerminalGravity wants to merge 1 commit intomainfrom
fix/shell-syntax-remaining-tools
Closed

fix: replace shell syntax in run() calls across all 8 remaining tools#195
TerminalGravity wants to merge 1 commit intomainfrom
fix/shell-syntax-remaining-tools

Conversation

@TerminalGravity
Copy link
Collaborator

@TerminalGravity TerminalGravity commented Mar 10, 2026

Closes #172

Systematic fix for the shell-in-run() bug class across all 8 remaining tools.

Problem: git.run() uses execFileSync('git', args) — no shell. But tools passed pipes, redirects, and non-git commands that silently failed.

Fix: Convert git args to arrays, use execFileSync/fs for non-git ops, replace shell pipes with JS filtering, remove dead shellEscape helpers.

Tools fixed: verify-completion, token-audit, session-handoff, audit-workspace, sharpen-followup, scope-work, enrich-agent-task, sequence-tasks

All 43 tests pass, clean build.

Copy link
Collaborator Author

@TerminalGravity TerminalGravity left a comment

Choose a reason for hiding this comment

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

This looks like a cleaner take on the same fix from #192 — both close #172. I'd go with this one since it removes the dead shellEscape functions too. The approach is solid: shell pipes → JS filtering, non-git CLIs → direct execFileSync, dropping 2>/dev/null since run() handles errors already.

One thing to double-check: in verify-completion, the npx tsc --noEmit call — make sure you're handling the exit code properly since execFileSync throws on non-zero. If tsc finds type errors, that throw is the expected signal, but worth a try/catch with a meaningful message rather than an unhandled exception.

If this supersedes #192, let's close that one to keep things tidy.

@TerminalGravity TerminalGravity force-pushed the fix/shell-syntax-remaining-tools branch from 51ca8cf to 07f4064 Compare March 10, 2026 17:30
@TerminalGravity TerminalGravity changed the title fix: replace shell syntax in run() calls across 8 tools fix: replace shell syntax in run() calls across all 8 remaining tools 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.
@TerminalGravity TerminalGravity force-pushed the fix/shell-syntax-remaining-tools branch from 07f4064 to 95c1752 Compare March 10, 2026 19:49
@TerminalGravity
Copy link
Collaborator Author

Closing — superseded by #204 which covers all remaining tools. Let's consolidate there.

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.

Systematic: shell syntax in git.run() calls across 8+ tools

1 participant