How ijaydevpatel/terraguard works
TerraGuard-AI is a local-first Terraform security CLI. Its main user workflow is to collect sanitized Terraform evidence or scan a repository, deterministically identify drift and control violations, rank findings, and render a report or enforce a severity gate. Separate commands train and evaluate ranking models, while documented AWS drift experiments inject and restore changes. The graph preserves these product branches; source excerpts and the index substantiate the core analysis links, while some command-specific internals were not sampled.
Main entry points: cli.py CLI commands · model_predictor.py Model predictor · severity_rules.py Severity rules · run_experiment.py Scenario runner
Components 20
CLI and collection
- CLI commands
terraguard/cli.py - Evidence collector
terraguard/evidence_collector.py - Evidence redaction
terraguard/redactor.py
Security detection
- Plan parser
terraguard/plan_parser.py - Drift extraction
terraguard/drift_extractor.py - Drift normalisation
terraguard/drift_normaliser.py - Repository scanner
terraguard/repository_scanner.py - Workflow scanner
terraguard/workflow_scanner.py - Backend scanner
terraguard/backend_scanner.py - Shared finding records
terraguard/models.py
Assessment and ranking
- Policy assessment
terraguard/policy_engine.py - Severity rules
terraguard/severity_rules.py - Feature builder
terraguard/feature_builder.py - Model predictor
terraguard/model_predictor.py - Model trainer
terraguard/model_trainer.py - Report generator
terraguard/report_generator.py
Experiments and data
- Scenario runner
scenarios/run_experiment.py - Injection safeguards
scenarios/_common.py - Corpus generator
scenarios/generate_corpus.py
Other components
- Engineer or CI
Connections 25
- Engineer or CI → CLI commands: invokes
README.md - CLI commands → Evidence collector: runs collection
terraguard/cli.py - Evidence collector → Evidence redaction: sanitizes on write
terraguard/evidence_collector.py - CLI commands → Plan parser: parses plans
terraguard/cli.py - Plan parser → Drift extraction: provides plan data
terraguard/drift_extractor.py - Drift extraction → Drift normalisation: normalizes drift
terraguard/drift_extractor.py - CLI commands → Repository scanner: scans repositories
terraguard/cli.py - CLI commands → Workflow scanner: scans workflows
terraguard/cli.py - CLI commands → Backend scanner: checks backend
terraguard/cli.py - CLI commands → Policy assessment: assesses controls
terraguard/cli.py - CLI commands → Severity rules: classifies findings
terraguard/cli.py - CLI commands → Model predictor: ranks findings
terraguard/cli.py - CLI commands → Model trainer: trains or evaluates
terraguard/cli.py - CLI commands → Report generator: renders output
terraguard/cli.py - Model predictor → Feature builder: builds features
terraguard/model_predictor.py - Model predictor → Severity rules: uses baseline
terraguard/model_predictor.py - Model trainer → Feature builder: builds training data
terraguard/model_trainer.py - Model trainer → Severity rules: labels findings
terraguard/model_trainer.py - Report generator → Model predictor: renders model output
terraguard/report_generator.py - Report generator → Severity rules: renders rule labels
terraguard/report_generator.py - Scenario runner → Injection safeguards: uses safeguards
- Scenario runner → Repository scanner: scans fixtures
scenarios/run_experiment.py - Scenario runner → Policy assessment: assesses controls
scenarios/run_experiment.py - Corpus generator → Backend scanner: scans corpus
scenarios/generate_corpus.py - Shared finding records → Drift normalisation: defines records
terraguard/drift_normaliser.py