Skip to content

fix(token-audit): replace shell syntax in run() calls with Node.js APIs#197

Closed
TerminalGravity wants to merge 3 commits intomainfrom
fix/token-audit-shell-syntax
Closed

fix(token-audit): replace shell syntax in run() calls with Node.js APIs#197
TerminalGravity wants to merge 3 commits intomainfrom
fix/token-audit-shell-syntax

Conversation

@TerminalGravity
Copy link
Collaborator

@TerminalGravity TerminalGravity commented Mar 10, 2026

Fixes broken shell syntax in run() calls across 4 tools (part of #172).

Tools fixed:

  • token-audit: wc, tail, 2>/dev/null → Node.js fs APIs (countLines, fileSize, readTail)
  • session-handoff: command -vwhich via execFileSync; gh pr list → direct execFileSync
  • sharpen-followup: string args with 2>/dev/null → array args
  • sequence-tasks: ls-files | head → array args + JS .slice()

All 43 tests pass. Clean build.

Partial fix for #172 — still need: verify-completion, audit-workspace, scope-work, enrich-agent-task.

…lates

The README documents .preflight/ config extensively but there were no
actual example files to copy. Adds:
- examples/.preflight/config.yml — profile, related projects, thresholds
- examples/.preflight/triage.yml — keyword rules and strictness
- examples/.preflight/contracts/api.yml — manual contract definitions
- examples/.preflight/README.md — setup instructions and tips
- README.md pointer to the examples directory
Part of #172. Fixes 4 broken patterns in token-audit.ts:
- run('git diff ... 2>/dev/null') → run(['diff', ...]) (array args)
- run('wc -l < file') → countLines() using fs.readFileSync
- run('wc -c < file') → fileSize() using fs.statSync
- run('tail -c N file') → readTail() using fs.openSync/readSync

These shell operators were passed as literal git args since run()
uses execFileSync without a shell.
…yntax in run() calls

- session-handoff: hasCommand() uses 'which' instead of 'command -v' via git;
  gh pr list uses execFileSync directly instead of run()
- sharpen-followup: diff commands use array args; status uses array args
- sequence-tasks: ls-files uses array args, pipe to head replaced with JS slice

Part of #172.
@TerminalGravity
Copy link
Collaborator Author

Closing — superseded by #204 which covers all remaining tools. Let's consolidate there.

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