fix: eliminate shell syntax in git.run() across 8 remaining tools#199
fix: eliminate shell syntax in git.run() across 8 remaining tools#199TerminalGravity wants to merge 1 commit intomainfrom
Conversation
Replace shell-piped commands passed to execFileSync('git', args) with:
- Array-arg run() calls for git commands
- New shell() helper (src/lib/shell.ts) for non-git commands needing pipes
- Native Node.js fs/path for file reads, stat, line counting
- In-JS filtering/slicing instead of grep/head/tail/wc pipes
Affected tools: verify-completion, token-audit, session-handoff,
audit-workspace, sharpen-followup, scope-work, enrich-agent-task,
sequence-tasks
Closes #172
TerminalGravity
left a comment
There was a problem hiding this comment.
This is the cleanest approach to #172 — the new shell() helper in lib/shell.ts is the right abstraction for commands that genuinely need shell interpretation (like gh pr list with fallback, or tail -c), while everything else correctly moves to array-arg run() or native Node APIs.
A few things I like:
hasCommand()usingwhichviaexecFileSyncinstead ofcommand -vthrough a shell — correct and portable- Reading
package.jsonand counting lines viafsinstead of shelling out tocat/wc— way more reliable - The
shell()helper has good timeout handling and captures both stdout+stderr on non-zero exits (important fortsc) - Slicing output in JS (
.slice(-20)) instead of piping throughtail
One minor note: enrich-agent-task.ts still references shellEscape in findRelatedTests (line ~53) but it's no longer needed there since you're building a RegExp, not a shell command. Won't break anything but it's dead logic — could clean it up.
This supersedes #195, #197, and #198 — let's close those once this lands. Ready to merge. 🚀
|
Closing — superseded by #204 which covers all remaining tools. Let's consolidate there. |
Fixes #172
Problem
run() uses execFileSync('git', args) — no shell. 8 tools passed shell operators that silently broke.
Fix
Tools: verify-completion, token-audit, session-handoff, audit-workspace, sharpen-followup, scope-work, enrich-agent-task, sequence-tasks
Build clean, 43/43 tests pass.