Add shell command explainer#75004
Conversation
|
Codex review: passed. Summary Reproducibility: not applicable. this is a feature PR rather than a bug report. For the prior PR blocker, source inspection shows byte-to-string span conversion and focused Unicode span coverage on the exact head. Next step before merge Security Review detailsBest possible solution: Land the internal explainer after the exact-head CI gate completes, leaving approval UI and allowlist integration for a later intentional PR. Do we have a high-confidence way to reproduce the issue? Not applicable; this is a feature PR rather than a bug report. For the prior PR blocker, source inspection shows byte-to-string span conversion and focused Unicode span coverage on the exact head. Is this the best way to solve the issue? Yes. The submitted approach keeps the parser isolated under What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e27b7c2d7446. |
0b309e4 to
f4b4e1b
Compare
f4b4e1b to
d50b21c
Compare
d50b21c to
5d15fed
Compare
23da7d7 to
d4b623d
Compare
96befae to
f523be0
Compare
14948e3 to
2a05b5b
Compare
There was a problem hiding this comment.
Pull request overview
Adds an internal shell command explainer module (tree-sitter-backed) to parse Bash-like command strings and extract command steps, structural “shapes”, and risk markers for future approval/command-review surfaces.
Changes:
- Introduce
src/infra/command-explainerwith types, parser runtime (web-tree-sitter + tree-sitter-bash), and extraction/walk logic. - Add a comprehensive Vitest suite covering pipelines, substitutions, wrappers, carriers, dynamic tokens, redirects, and syntax errors.
- Add dependencies (
web-tree-sitter,tree-sitter-bash), pnpm build ignore config, and a changelog entry.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/infra/command-explainer/types.ts | Defines public explanation output types (steps, shapes, risks, spans). |
| src/infra/command-explainer/tree-sitter-runtime.ts | Loads/initializes the tree-sitter parser + wasm language and exposes parse helpers. |
| src/infra/command-explainer/index.ts | Exports the explainer API and types as a module entry point. |
| src/infra/command-explainer/extract.ts | Implements AST walk, argv extraction, span translation, and risk detection. |
| src/infra/command-explainer/extract.test.ts | Adds functional coverage for parsing and risk/shape extraction, plus a perf-style test. |
| package.json | Adds dependencies + pnpm ignoredBuiltDependencies entry for tree-sitter-bash. |
| pnpm-workspace.yaml | Adds tree-sitter-bash to ignoredBuiltDependencies. |
| pnpm-lock.yaml | Locks new dependencies and their transitive additions. |
| CHANGELOG.md | Documents the new internal shell command explainer. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
|
/clawsweeper automerge |
|
🦞🦞
Draft PRs stay fix-only until GitHub marks them ready for review. Pause with Automerge progress:
|
2a05b5b to
63831a5
Compare
63831a5 to
a5c9a34
Compare
|
/clawsweeper automerge |
a5c9a34 to
940aa21
Compare
940aa21 to
4757757
Compare
Summary: - The PR adds an internal Tree-sitter-backed shell command explainer under `src/infra`, parser runtime/tests, dependency/build-policy updates, an index export, and a changelog entry. - Reproducibility: not applicable. this is a feature PR rather than a bug report. For the prior PR blocker, source inspection shows byte-to-string span conversion and focused Unicode span coverage on the exact head. Automerge notes: - Ran the ClawSweeper repair loop before final review. - Included post-review commit in the final squash: Repair shell command explainer automerge blockers - Included post-review commit in the final squash: fix(clawsweeper): address review for automerge-openclaw-openclaw-7500… Validation: - ClawSweeper review passed for head 4757757. - Required merge gates passed before the squash merge. Prepared head SHA: 4757757 Review: openclaw#75004 (comment) Co-authored-by: Jesse Merhi <jessejmerhi@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Summary: - The PR adds an internal Tree-sitter-backed shell command explainer under `src/infra`, parser runtime/tests, dependency/build-policy updates, an index export, and a changelog entry. - Reproducibility: not applicable. this is a feature PR rather than a bug report. For the prior PR blocker, source inspection shows byte-to-string span conversion and focused Unicode span coverage on the exact head. Automerge notes: - Ran the ClawSweeper repair loop before final review. - Included post-review commit in the final squash: Repair shell command explainer automerge blockers - Included post-review commit in the final squash: fix(clawsweeper): address review for automerge-openclaw-openclaw-7500… Validation: - ClawSweeper review passed for head 4757757. - Required merge gates passed before the squash merge. Prepared head SHA: 4757757 Review: openclaw#75004 (comment) Co-authored-by: Jesse Merhi <jessejmerhi@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Summary
Adds an internal shell command explainer backed by
web-tree-sitterandtree-sitter-bash.The explainer can report:
This PR intentionally does not hook the explainer into approval UI, allowlist, or allow-always decisions yet.
Testing
pnpm test src/infra/command-explainer/extract.test.tspnpm check:changed