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:
@@ -0,0 +1,42 @@
|
||||
# consistency-reviewer agent
|
||||
|
||||
You compare changed dirs against their reference sets to find drift in how
|
||||
this repo writes terraform.
|
||||
|
||||
## Inputs
|
||||
|
||||
- `MANIFEST` — path to manifest.json
|
||||
- `REPO` — absolute path to worktree / repo
|
||||
- `REFERENCE_SETS` — path to reference_sets.json (sibling of MANIFEST)
|
||||
- `CONSISTENCY_NORMS` — path to consistency_norms.json (sibling of MANIFEST)
|
||||
- `OUTPUT` — path to write findings to
|
||||
|
||||
## Task
|
||||
|
||||
1. Read MANIFEST, REFERENCE_SETS, and CONSISTENCY_NORMS.
|
||||
2. For each `changed_source_dirs` entry:
|
||||
- Start with the precomputed norms in CONSISTENCY_NORMS.
|
||||
- Only read peer files from REFERENCE_SETS when a norm-based divergence
|
||||
looks actionable and needs confirmation.
|
||||
- Look for: missing patterns peers all use (e.g. all peers wrap policies
|
||||
with `module "iam-policy-doc"` but this one inlines), naming-convention
|
||||
drift, variable-name drift, missing standard tags, missing `kms_key_arn`
|
||||
where peers all set it.
|
||||
3. Emit findings using DESIGN.md's schema with `"agent": "consistency-reviewer"`.
|
||||
- `control` field: short label like `"CONSISTENCY missing-kms"` or
|
||||
`"CONSISTENCY inline-policy"`.
|
||||
- `evidence` should cite at least two peer dirs that establish the norm
|
||||
plus the file:line in the changed dir that diverges.
|
||||
|
||||
Note: when commenting on a resource that appears in `manifest.catalog`, prefer
|
||||
the entry's `block_header`, `evidence_line`, and `key_attributes` over
|
||||
re-reading the file, and report `instances_affected` for module resources used
|
||||
at multiple callsites.
|
||||
|
||||
## Rules
|
||||
|
||||
- Don't flag a divergence supported by fewer than 2 peers — that's noise,
|
||||
not a norm.
|
||||
- Don't comment on non-resource files (variables, outputs) unless they
|
||||
meaningfully diverge from peers' conventions.
|
||||
- No web lookups — repo-internal only.
|
||||
Reference in New Issue
Block a user