Expand description
Command classification patterns for identifying compilation commands.
Implements the 5-tier classification system:
- Tier 0: Instant reject (non-Bash, empty)
- Tier 1: Structure analysis (pipes, redirects, background)
- Tier 2: SIMD keyword filter
- Tier 3: Negative pattern check
- Tier 4: Full classification with confidence
Structs§
- Classification
- Result of command classification.
- Classification
Details - Detailed classification results with per-tier decisions.
- Classification
Tier - Detailed result for a single classification tier.
- GoBuild
Output - The one project-relative file promised by a supported
go build -o.
Enums§
- Compilation
Kind - Kind of compilation command detected.
- Tier
Decision - Decision outcome for a classification tier.
Statics§
- COMPILATION_
KEYWORDS - Keywords that indicate a potential compilation command. Used for SIMD-accelerated quick filtering (Tier 2).
- NEVER_
INTERCEPT - Commands that should NEVER be intercepted, even if they contain compilation keywords. These either modify local state or have dependencies on local execution.
Functions§
- cargo_
xwin_ compilation_ kind - Recognize explicit cargo-xwin build, check, and clippy entry points, without treating a mention in a Cargo option value as permission to relax the native MSVC gate. Requested Rust targets and toolchains still go through admission. Cache mutation, environment inspection, and other subcommands are deliberately outside this offload surface.
- classify_
command - Classify a shell command.
- classify_
command_ detailed - Classify a shell command with detailed tier decisions for diagnostics.
- compound_
local_ compilation_ segments - Segments of an
&&chain (all but the last) that look like a compilation command but were not classified as one, and therefore stay local when the chain is rewritten by the hook (issue #50). - declined_
compilation_ due_ to_ structure - Detect a command that would be a compilation command if it weren’t for an (unsafe / unhandled) pipe/redirect/background/subshell structure — i.e. one that the classifier declines purely because of its shell structure rather than because the underlying program is not a compiler (issue #24, item 3).
- go_
build_ output - Plan the explicit file output of a supported Go build.
- is_
cargo_ package_ verification - Whether Cargo will build and verify a package archive without publishing it.
- is_
cargo_ xwin_ build - Backward compatibility helper for cargo-xwin build commands.
- normalize_
command - Normalize a command by stripping common wrappers (sudo, time, env, etc.)
- split_
shell_ commands - Split a shell command string on unquoted
;,&&, and||operators.