Bash Refactor State 2
Related plan: Bash Refactor Plan 2
- Task 1 — Implement Layer 1: Unix Execution
- Shell binary detection
- Command execution via execFile
- Railway env injection
- Error handling (timeout, execution failure)
- Task 2 — Implement Layer 2: LLM Presentation
- Binary guard
- Overflow truncation
- Stderr attachment
- Metadata footer
- Task 3 — Implement rm Blocking
- Chain parser (parseChain)
- rm detection with VAR=value stripping
- Task 4 — Implement Audit Logging
- auditLog function
- Call sites in rm-blocked and normal paths
- Task 5 — Build, Test, and Validate
- typecheck passes
- build produces dist/index.js
- smoke test: echo hello — output contains “hello” and
[exit:0 | - rm blocking test — blocked message with
[exit:-1 | 0ms] - non-zero exit test — stderr attached,
[exit:1 | - VAR=value rm blocking test — FOO=bar rm blocked correctly
- chain with rm test —
echo ok && rm badblocked - pipe test —
echo hello | grep helloworks - audit log file created with correct entries
- Commit
Evaluation — Plan 2
| # | Type | Description | Status | Disposition |
|---|---|---|---|---|
| E1 | Variance | Overflow truncation hint missing grep/tail navigation hints — only says Output truncated. Full output written to ... | 🟢 Resolved | Fix: added grep/tail hint line |
| E2 | Defect | Binary guard returns early, discarding stderr on non-zero exit | 🟢 Resolved | Fix: stderr now attached in binary guard path |
| E3 | Gap | Smoke test not verified with raw MCP request | 🟢 Resolved | Fix: ran echo/rm/binary smoke tests via `echo JSON |