fix: broken shell commands — run() passed args as 'git git ...', shell ops as literal args - #243
Open
TerminalGravity wants to merge 2 commits into
Open
fix: broken shell commands — run() passed args as 'git git ...', shell ops as literal args#243TerminalGravity wants to merge 2 commits into
TerminalGravity wants to merge 2 commits into
Conversation
- Remove unused imports across 13 source files - Remove dead `gitCmd` function from lib/git.ts - Remove dead `toMarkdown` function from generate-scorecard.ts (superseded by toMarkdownWithBaseline) - Remove dead `CORRECTION_PATTERNS` constant from generate-scorecard.ts - Lint warnings reduced from 74 to 47 (0 errors) - All 43 tests pass, build clean
…tors, add shell() helper
run() uses execFileSync('git', args) but many callers passed:
- 'git diff ...' (doubled to 'git git diff ...')
- '2>/dev/null' (passed as literal git arg)
- '|| fallback' (pipe/or treated as git args)
- Non-git commands like 'find', 'cat', 'wc' (executed as 'git find ...')
All of these silently failed and returned error strings.
Fix:
- run() now strips leading 'git' from string args
- run() strips shell operators (2>/dev/null, ||, |, &&)
- New shell() function for commands needing real shell features
- Migrated 13 tool files to use proper array args or shell()
- Added 8 tests covering the new behavior
Affects: audit-workspace, checkpoint, clarify-intent, enrich-agent-task,
scope-work, sequence-tasks, session-handoff, session-health,
sharpen-followup, token-audit, verify-completion, what-changed
TerminalGravity
commented
Mar 13, 2026
TerminalGravity
left a comment
Collaborator
Author
There was a problem hiding this comment.
Reviewed — this is a critical fix. run() was double-prefixing 'git' and passing shell operators as literal args to execFileSync. The cleanShellArgs helper is clean, and adding shell() as an escape hatch for when you actually need pipes/redirects is the right design. Node engine bump to 20+ makes sense here too. ✅ Ship it.
TerminalGravity
commented
Mar 16, 2026
TerminalGravity
left a comment
Collaborator
Author
There was a problem hiding this comment.
Reviewed — this is the most critical fix in the batch. The double-git bug (run('git diff ...') → execFileSync('git', ['git', 'diff', ...])) was silently breaking commands. The cleanShellArgs helper and new shell() export are clean. Ready to merge.
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()insrc/lib/git.tsusesexecFileSync('git', args)— but 19 call sites across 13 tool files passed strings with agitprefix, shell operators, or non-git commands that all silently failed.Fix
run()now strips leadinggitprefix and shell operators from string argsshell()function for commands needing real shell featuresBuild passes, all 51 tests pass.