Move the code and terraform audits into the reviews plugin

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).
This commit is contained in:
2026-07-21 11:11:05 -05:00
parent 600c1fef86
commit f5934181ec
179 changed files with 20779 additions and 3 deletions
@@ -0,0 +1,39 @@
from pathlib import Path
from scripts.plan_output import parse_plan_resources
FIXTURE = Path(__file__).parent / "fixtures" / "plan_output_tofu.txt"
def test_parses_create_update_destroy_replace():
txt = FIXTURE.read_text()
resources = parse_plan_resources(txt)
by_addr = {r.address: r for r in resources}
assert by_addr["aws_s3_bucket.audit_logs"].action == "create"
assert by_addr["aws_s3_bucket.audit_logs"].type == "aws_s3_bucket"
assert by_addr["module.app_role.aws_iam_role.this"].action == "update"
assert by_addr["module.app_role.aws_iam_role.this"].type == "aws_iam_role"
assert by_addr["aws_security_group.legacy"].action == "delete"
assert by_addr["aws_iam_user.svc"].action == "replace"
def test_empty_when_no_changes():
txt = "No changes. Your infrastructure matches the configuration.\n"
assert parse_plan_resources(txt) == []
def test_type_for_data_source():
txt = """\
# data.aws_caller_identity.current will be read during apply
<= data "aws_caller_identity" "current" {
}
"""
out = parse_plan_resources(txt)
assert len(out) == 1
assert out[0].action == "read"
assert out[0].type == "aws_caller_identity"
assert out[0].address == "data.aws_caller_identity.current"