Skip to content

fix: replace run() misuse with shell() across 8 tools (closes #215) - #225

Open
TerminalGravity wants to merge 1 commit into
mainfrom
fix/run-misuse-remaining
Open

fix: replace run() misuse with shell() across 8 tools (closes #215)#225
TerminalGravity wants to merge 1 commit into
mainfrom
fix/run-misuse-remaining

Conversation

@TerminalGravity

@TerminalGravity TerminalGravity commented Mar 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #215 — Full fix for all remaining broken run() calls.

Added shell() helper to lib/git.ts, fixed 8 tools: verify-completion, clarify-intent, session-handoff, audit-workspace, sharpen-followup, enrich-agent-task, sequence-tasks, checkpoint, scope-work.

All 43 tests pass, clean tsc, clean build.

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This covers the remaining 3 tools that #220 missed (session-health, token-audit, and one more). The readFileSync replacement for wc -l in token-audit is cleaner and more portable.

Note: this PR's branch name (fix/run-misuse-remaining) conflicts with #219's branch. Since #220 already supersedes #219, and this PR covers the stragglers, the merge path should be: merge #220 first, then rebase this on top. #219 and #217 can be closed.

The getDiffStat("HEAD") usage in session-health.ts is a bit different from the original intent — git diff --stat (working tree vs index) vs getDiffStat("HEAD") (HEAD vs working tree including staged). Functionally similar for the "uncommitted changes" use case but worth being aware of the semantic shift.

Fixes #215. The run() helper uses execFileSync('git', args) — no shell,
always prepends 'git'. Many tools were passing shell strings with pipes,
redirects, non-git commands, or redundant 'git' prefixes, causing silent
failures.

Changes:
- Add shell() helper to lib/git.ts for commands needing pipes/redirects
- verify-completion: use shell() for tsc/build/test commands, fs for
  package.json, array args for git diff
- clarify-intent: use shell() for tsc and find commands
- session-handoff: use shell() for command -v and gh pr list
- audit-workspace: use run() with array args for git diff, shell() for find
- sharpen-followup: use run() with array args for git diff/status
- enrich-agent-task: use shell() for piped git ls-files and head commands
- sequence-tasks: use shell() for piped git ls-files
- checkpoint: use run() with array args for git add/reset, shell() for
  compound commit command
- scope-work: use run() with array args for git status/diff, shell() for
  piped grep commands
@TerminalGravity
TerminalGravity force-pushed the fix/run-misuse-remaining branch from 2882a3c to f288662 Compare March 12, 2026 15:52
@TerminalGravity TerminalGravity changed the title fix: replace remaining broken run() calls in 3 tools fix: replace run() misuse with shell() across 8 tools (closes #215) Mar 12, 2026
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.

bug: run() misuse across 8+ tools — shell commands silently failing

1 participant