Copy the standalone code-review and terraform-review skills into
plugins/reviews as audit-code and audit-terraform. The rename separates the
automated, linter-driven audits from the guided review-pr walkthrough that
already lived here.
Resolve bundled script paths through ${SKILL_DIR}, exported in a new step 0.
CLAUDE_PLUGIN_ROOT is not set in the Bash tool environment, so the obvious
substitution would have expanded to nothing and broken every collection
script invocation.
Replace the PLAN and DESIGN docs with READMEs written from the current
SKILL.md and scripts. The old docs had drifted badly: they named semgrep
where the code calls opengrep, scoped five review agents where there are
now eight, and predated Lua, PowerShell, and GitHub Actions support.
Add CONSISTENCY_NORMS to the audit-terraform agent inputs. The collection
script writes consistency_norms.json and the agent prompt declares it, but
SKILL.md never listed it, leaving the variable unsubstituted.
Drop the --ingest-verdicts instruction from both skills. review_stats.py
parses no arguments, so the ref-mode verdict template it told users to feed
back could never be read.
Point audit-terraform's smoke test at README.md and resolve its fixture
paths relative to the test file rather than an absolute home directory.
Tests: 197 passing (audit-code), 106 passing (audit-terraform).
53 lines
1.8 KiB
Python
53 lines
1.8 KiB
Python
from scripts.slicing import _slice_for_agent
|
|
|
|
|
|
def _sample_manifest():
|
|
return {
|
|
"base_ref": "main", "head_ref": "HEAD", "mode": "local",
|
|
"default_branch": "main", "errors": [], "changed_source_dirs": [],
|
|
"catalog": [{"type": "aws_s3_bucket"}],
|
|
"plan_units": [],
|
|
"module_graph": {},
|
|
"trivy_findings": [{"rule": "AVD-1"}],
|
|
"tflint_findings": [{"rule": "terraform_required_version"}],
|
|
}
|
|
|
|
|
|
def test_aws_bp_slice_includes_tflint():
|
|
sliced = _slice_for_agent(_sample_manifest(), "aws-bp")
|
|
assert sliced["tflint_findings"][0]["rule"] == "terraform_required_version"
|
|
|
|
|
|
def test_fsbp_slice_includes_tflint():
|
|
sliced = _slice_for_agent(_sample_manifest(), "fsbp")
|
|
assert sliced["tflint_findings"][0]["rule"] == "terraform_required_version"
|
|
|
|
|
|
def test_cis_slice_includes_tflint():
|
|
sliced = _slice_for_agent(_sample_manifest(), "cis")
|
|
assert sliced["tflint_findings"][0]["rule"] == "terraform_required_version"
|
|
|
|
|
|
def test_aws_bp_slice_still_includes_trivy():
|
|
sliced = _slice_for_agent(_sample_manifest(), "aws-bp")
|
|
assert sliced["trivy_findings"][0]["rule"] == "AVD-1"
|
|
|
|
|
|
def test_consistency_slice_includes_tflint():
|
|
sliced = _slice_for_agent(_sample_manifest(), "consistency")
|
|
assert sliced["tflint_findings"][0]["rule"] == "terraform_required_version"
|
|
|
|
|
|
def test_hygiene_slice_includes_tflint_and_omits_trivy():
|
|
sliced = _slice_for_agent(_sample_manifest(), "tf-hygiene")
|
|
assert sliced["tflint_findings"][0]["rule"] == "terraform_required_version"
|
|
assert "trivy_findings" not in sliced
|
|
assert "plan_units" in sliced
|
|
assert "catalog" in sliced
|
|
assert "changed_source_dirs" in sliced
|
|
|
|
|
|
def test_unknown_agent_returns_full_manifest():
|
|
sliced = _slice_for_agent(_sample_manifest(), "unknown-agent")
|
|
assert sliced == _sample_manifest()
|