fix: replace broken shell syntax in run() calls with array args#136
Open
TerminalGravity wants to merge 1 commit intomainfrom
Open
fix: replace broken shell syntax in run() calls with array args#136TerminalGravity wants to merge 1 commit intomainfrom
TerminalGravity wants to merge 1 commit intomainfrom
Conversation
run() uses execFileSync (no shell) but several tools passed shell operators (2>/dev/null, ||, |, &&) as string args that got split into literal git arguments, silently breaking fallback logic. Fixed in: what-changed, session-health, audit-workspace, sharpen-followup, checkpoint
TerminalGravity
commented
Mar 6, 2026
Collaborator
Author
TerminalGravity
left a comment
There was a problem hiding this comment.
Clean fix. The startsWith("[") check for error detection is a bit fragile though — if run() ever returns JSON or a file starting with [, it would false-positive. Worth adding a typed error return or throwing from run() so callers don't need to sniff output strings. But that's a follow-up, not a blocker. Ship it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
run()inlib/git.tsusesexecFileSync(no shell), but 5 tools were passing shell operators (2>/dev/null,||,|,&&) as string args. These got split on whitespace and passed as literal git arguments, silently breaking fallback/pipe logic.For example,
what-changed.tshad:This became
execFileSync('git', ['diff', ref, '--name-only', '2>/dev/null', '||', 'git', 'diff', 'HEAD~3', '--name-only'])— git would error or silently ignore the junk args.Fix
Replaced all broken calls with proper array args and explicit JS fallback logic:
diff --stat | tail -1→ array + JS.pop()find | wcwithgit ls-filesAll 43 tests pass. Build clean.