一键导入
一键导入
Check backend code coverage and flag packages below 80%
Scaffold a new Architecture Decision Record
Regenerate docs from code (rules, API, README)
Split working tree changes into logical git commits and push
| name | new-rule |
| description | Scaffold a new rule (static, live, or catalog) with tests and registration |
| disable-model-invocation | true |
cat backend/internal/rules/types.gocat backend/internal/rules/static/all.gocat backend/internal/rules/live/all.gocat backend/internal/rules/catalog/all.goCreate a new rule based on the user's description: $ARGUMENTS
Determine the rule type from the user's description:
static — inspects config.CollectorConfig onlylive — also needs metrics.Store (implements LiveRule)catalog — also needs tap catalog + filter analyses (implements CatalogRule)Create the rule file at backend/internal/rules/<type>/<rule_id>.go:
ID() returning kebab-case identifier (prefixed with live- or catalog- for non-static rules)Description() returning a concise one-linerDefaultSeverity() returning the appropriate severityEvaluate() (and EvaluateWithMetrics/EvaluateWithCatalog for live/catalog)\nHowever, pattern, Recommendation, Snippet, Scope)Register the rule by adding &StructName{} to all.go in the appropriate package.
Add tests to the existing test file in the package:
backend/internal/rules/static/extended_test.gobackend/internal/rules/live/live_test.gobackend/internal/rules/catalog/catalog_test.goTest<RuleName>_<Condition> (static/catalog) or Test<RuleName><Condition> (live)mustParse, findByRule, makeSnapshot, etc.)Update the TestAllRules count in the test file to reflect the new total.
Run tests: go test ./internal/rules/<type>/... — fix any failures.
Regenerate docs: go generate ./... from the backend directory.
Verify coverage: go test ./internal/rules/<type>/... -coverprofile=cover.out && go tool cover -func=cover.out | tail -1 — must stay above 80%.
Report the rule ID, test results, and coverage when done.