How vivo75/bash-digest works
bash-digest is a static analyzer for Gentoo ebuild/eclass Bash and Portage configuration. Its principal workflow discovers input files, parses them with GNU Bash without executing them, then extracts environment assignments and external executable names into one deterministic JSON digest. Optional expansion resolves supported variable and arithmetic expressions. The graph preserves the documented crate responsibilities and expansion submodules; some orchestration calls are established by the README rather than complete source excerpts.
Main entry points: main.rs CLI orchestration · src/lib.rs Variable expansion · param.rs Parameter operations · src/lib.rs Input discovery
Components 13
Analysis workflow
- CLI orchestration
src/main.rs - Input discovery
crates/scanner/src/lib.rs - Overlay and Portage files
- Aggregated JSON
Bash parsing
- Bash parser binding
crates/bash-ffi/src/lib.rs
Extraction and expansion
- Environment extraction
crates/extract-env/src/lib.rs - Executable extraction
crates/extract-exec/src/lib.rs - Variable expansion
crates/expand/src/lib.rs - Parameter operations
crates/expand/src/param.rs - Arithmetic evaluation
crates/expand/src/arith.rs - Glob matching
crates/expand/src/glob.rs
Shared data
- Owned AST and records
crates/ast-core/src/lib.rs
Other components
- CLI user
Connections 14
- CLI user → CLI orchestration: provides options
README.md - CLI orchestration → Input discovery: discovers files
src/main.rs - Input discovery → Overlay and Portage files: reads paths
crates/scanner/src/lib.rs - CLI orchestration → Bash parser binding: parses files
README.md - Bash parser binding → Owned AST and records: returns AST
crates/bash-ffi/src/lib.rs - CLI orchestration → Environment extraction: extracts variables
README.md - CLI orchestration → Executable extraction: extracts executables
README.md - Environment extraction → Variable expansion: expands values
- Executable extraction → Variable expansion: expands names
- Variable expansion → Parameter operations: resolves parameters
crates/expand/src/lib.rs - Variable expansion → Arithmetic evaluation: evaluates arithmetic
crates/expand/src/lib.rs - Parameter operations → Arithmetic evaluation: evaluates arithmetic
crates/expand/src/param.rs - Parameter operations → Glob matching: matches patterns
crates/expand/src/param.rs - CLI orchestration → Aggregated JSON: writes JSON
README.md