You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(command-risk): parse commands with a real shell AST #286
Follow-up to the embedded-shell spike (#280). crates/command-risk classifies shell commands with its own tokenizer (tokenize.rs) and path rules (paths.rs). A parser-grade front-end would judge what actually runs.
What a real AST gains
Compound commands and lists with exact precedence (a && b || c; d), subshells and groups.
Quoting resolved exactly (single, double, ANSI-C, escapes) instead of heuristics.
Typed redirects (2>&1, >|, &>, <<<), heredoc bodies treated as data, not commands.
Assignment propagation (DIR=/ ; rm -rf $DIR).
Plan
Optional feature parser in whycodes-command-risk pulling a Rust POSIX shell parser crate; on ParseError fall back to the tokenizer so nothing gets less strict.
Lower the AST to the existing Segment shape so paths.rs stays the parser-independent catastrophic tier.
Corpus tests: the four cases above plus the existing assess.rs suite must keep every verdict (no regressions to Safe).
Benchmark before/after (scripts/check_bench_ceilings.py has no entry for this yet; add one if the parser costs more than ~1 ms per command).
Activity
feat(command-risk): parse commands with an in-crate shell parser (#294)