1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Shell command parsing and structural analysis.
//!
//! This module is **policy-free** — it decomposes shell commands into
//! structured representations but makes no allow/deny decisions.
//! Consumers (agent-jj, cc-toolgate) build policy on top.
//!
//! ## Entry points
//!
//! - [`parse_with_substitutions`] — decompose a compound shell command
//! into a recursive [`ParsedPipeline`] tree.
//! - [`parse_command`] — structurally parse a single command into
//! [`ParsedCommand`] with ordered [`CommandArg`]s (flags and positionals
//! in source order).
//! - [`resolve_command`] — strip transparent wrappers (env, sudo, etc.)
//! and classify unanalyzable patterns (eval, source, shell -c).
//!
//! ## Design principles
//!
//! - **Parser annotates, consumer decides.** The library classifies
//! commands; the consumer interprets classifications as policy.
//! - **Schema-free argument parsing.** `ParsedCommand` identifies flags
//! syntactically (`-` prefix). Flag-value association requires the
//! consumer's knowledge of the command's schema. Arguments are kept
//! in source order so consumers can walk them with schema awareness.
//! - **Fail-closed on ambiguity.** Parse errors and unresolvable
//! patterns (dynamic `$cmd`, eval) are surfaced, not hidden.
pub use ;
pub use ;
pub use ;
pub use ;