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,56 @@
from pathlib import Path
from scripts.adapters.zizmor import parse_zizmor_output
_FIXTURES = Path(__file__).parent / "fixtures"
def test_parses_two_results():
payload = (_FIXTURES / "zizmor_sample.json").read_text()
findings = parse_zizmor_output(payload)
assert len(findings) == 2
def test_warning_maps_to_medium():
payload = (_FIXTURES / "zizmor_sample.json").read_text()
findings = parse_zizmor_output(payload)
unpinned = next(f for f in findings if f.rule_id == "unpinned-uses")
assert unpinned.tool == "zizmor"
assert unpinned.severity == "medium"
assert unpinned.file == ".github/workflows/ci.yml"
assert unpinned.line == 12
assert unpinned.end_line == 12
assert "actions/checkout" in unpinned.message
def test_error_maps_to_high():
payload = (_FIXTURES / "zizmor_sample.json").read_text()
findings = parse_zizmor_output(payload)
perms = next(f for f in findings if f.rule_id == "excessive-permissions")
assert perms.severity == "high"
assert perms.line == 5
def test_cwe_extracted_from_rule_tags():
payload = (_FIXTURES / "zizmor_sample.json").read_text()
findings = parse_zizmor_output(payload)
unpinned = next(f for f in findings if f.rule_id == "unpinned-uses")
assert unpinned.cwe == "CWE-829"
def test_no_cwe_when_tags_empty():
payload = (_FIXTURES / "zizmor_sample.json").read_text()
findings = parse_zizmor_output(payload)
perms = next(f for f in findings if f.rule_id == "excessive-permissions")
assert perms.cwe is None
def test_handles_empty_runs():
findings = parse_zizmor_output('{"version": "2.1.0", "runs": []}')
assert findings == []
def test_handles_invalid_json():
findings = parse_zizmor_output("not json")
assert findings == []