Skip to content

fix: use shellRun for non-git shell commands#35

Closed
TerminalGravity wants to merge 3 commits intomainfrom
fix/non-git-shell-commands
Closed

fix: use shellRun for non-git shell commands#35
TerminalGravity wants to merge 3 commits intomainfrom
fix/non-git-shell-commands

Conversation

@TerminalGravity
Copy link
Copy Markdown
Collaborator

Bug

clarify_intent and audit_workspace were passing shell pipelines to run(), which calls execFileSync('git', args). This means:

  • run("pnpm tsc --noEmit 2>&1 | grep -c 'error TS'") → actually runs git pnpm tsc --noEmit 2>&1 | grep ...
  • run("find tests -name '*.spec.ts' ...") → actually runs git find tests ...

These always failed silently, so type error detection and test file discovery in clarify_intent were completely broken, and test file counting in audit_workspace always returned 0.

Fix

  • Added shellRun() export to git.ts — uses execSync (with shell) for non-git commands that need pipes/redirects
  • Updated 3 call sites to use shellRun() instead of run()
  • Removed dead gitCmd() function

Testing

  • tsc --noEmit passes
  • All 43 existing tests pass

… and contracts

The README references .preflight/ config extensively but there were no
concrete example files to copy. This adds a ready-to-use examples/.preflight/
directory with annotated config.yml, triage.yml, and contracts/api.yml,
plus a README explaining how to use them.
Created examples/USAGE_EXAMPLES.md with 8 real-world scenarios showing
what each tool looks like in practice: preflight_check catching vague
prompts, scope_work creating execution plans, enrich_agent_task for
sub-agents, sharpen_followup resolving ambiguity, session health checks,
semantic history search, weekly scorecards, and prompt grading.

Added link to usage examples in README nav bar.
clarify-intent and audit-workspace were passing shell pipelines to
run(), which calls execFileSync('git', args). This means commands like
'pnpm tsc --noEmit 2>&1 | grep -c error' were actually running as
'git pnpm tsc --noEmit ...' — always failing silently.

Added shellRun() to git.ts for commands that need a shell (pipes,
redirects, non-git binaries). Fixed 3 call sites:
- clarify-intent: type error detection, test file discovery
- audit-workspace: test file counting

Also removed dead gitCmd() function.
Copy link
Copy Markdown
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.

Nice catch. run() shells out via execFileSync('git', ...) so piping find | wc through it was silently breaking. The shellRun helper is clean — good error handling with the timeout detection and fallback stderr output. One minor thought: might be worth exporting a shellRunSafe variant that returns {ok, stdout, stderr} instead of flattening errors into the return string, since callers like parseInt(shellRun(...)) could accidentally parse an error message. Not blocking though — this is solid as-is.

@TerminalGravity
Copy link
Copy Markdown
Collaborator Author

Superseded by newer PRs.

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