forgedock 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -8
- package/bin/batch-runner.mjs +339 -0
- package/bin/demo.mjs +92 -7
- package/bin/engine/phases.mjs +24 -2
- package/bin/engine/state.mjs +8 -3
- package/bin/engine-cli.mjs +177 -5
- package/bin/forgedock.mjs +409 -26
- package/bin/hooks/interactive-engine.mjs +509 -0
- package/bin/hooks/pre-tool-use.mjs +498 -0
- package/bin/hooks/subagent-stop-enforce.mjs +197 -0
- package/bin/journey.mjs +72 -14
- package/bin/registry.mjs +139 -0
- package/bin/report.mjs +447 -0
- package/bin/runner.mjs +70 -20
- package/bin/settings-hook.mjs +235 -1
- package/commands/adopt.md +4 -1
- package/commands/analytics.md +4 -1
- package/commands/audit-agents.md +110 -27
- package/commands/audit.md +20 -1
- package/commands/autopilot.md +518 -361
- package/commands/changelog.md +2 -1
- package/commands/ci-audit.md +2 -1
- package/commands/cleanup.md +161 -1
- package/commands/compat-audit.md +2 -1
- package/commands/deploy-info.md +58 -1
- package/commands/deploy-pr.md +485 -0
- package/commands/design-bench.md +5 -1
- package/commands/design-render-critique-loop.md +1 -1
- package/commands/diagnose.md +2 -1
- package/commands/explain.md +2 -1
- package/commands/fix-ci.md +577 -0
- package/commands/forge-stats.md +121 -2
- package/commands/forgedock-init.md +1 -1
- package/commands/geo-audit.md +3 -0
- package/commands/incident-response.md +2 -1
- package/commands/issue.md +23 -2
- package/commands/milestone.md +77 -12
- package/commands/optimize.md +2 -1
- package/commands/orchestrate/config.md +67 -0
- package/commands/orchestrate/phase-1-resolve.md +159 -0
- package/commands/orchestrate/phase-2-triage.md +126 -0
- package/commands/orchestrate/phase-2.5-synthesis.md +156 -0
- package/commands/orchestrate/phase-3-dependency.md +591 -0
- package/commands/orchestrate/phase-4-execution.md +962 -0
- package/commands/orchestrate/phase-5-cleanup.md +47 -0
- package/commands/orchestrate/phase-6-report.md +198 -0
- package/commands/orchestrate/safety.md +62 -0
- package/commands/orchestrate.md +25 -2045
- package/commands/pipeline-health/config.md +34 -0
- package/commands/pipeline-health/phase-1-context.md +180 -0
- package/commands/pipeline-health/phase-2-metrics.md +1729 -0
- package/commands/pipeline-health/phase-3-analyze.md +204 -0
- package/commands/pipeline-health/phase-4-proposals.md +117 -0
- package/commands/pipeline-health/phase-5-report.md +284 -0
- package/commands/pipeline-health/phase-6-summary.md +52 -0
- package/commands/pipeline-health.md +25 -2401
- package/commands/pipeline-resume.md +24 -1
- package/commands/pipeline-status.md +65 -0
- package/commands/qa-sweep.md +4 -1
- package/commands/quality-gate.md +248 -10
- package/commands/recover-orphans.md +576 -0
- package/commands/replay.md +2 -1
- package/commands/review-pr-agents/api.md +135 -0
- package/commands/review-pr-agents/auth.md +137 -0
- package/commands/review-pr-agents/billing.md +101 -0
- package/commands/review-pr-agents/concurrency.md +145 -0
- package/commands/review-pr-agents/database.md +103 -0
- package/commands/review-pr-agents/frontend.md +89 -0
- package/commands/review-pr-agents/infra.md +385 -0
- package/commands/review-pr-agents/protocols.md +185 -0
- package/commands/review-pr-agents/scraper.md +185 -0
- package/commands/review-pr-agents/security.md +406 -0
- package/commands/review-pr-agents.md +45 -1722
- package/commands/review-pr-staging.md +196 -40
- package/commands/review-pr.md +591 -52
- package/commands/rollback.md +2 -1
- package/commands/scope.md +2 -1
- package/commands/security-audit.md +2 -1
- package/commands/signal-planner.md +623 -0
- package/commands/sync-ecosystem.md +1 -0
- package/commands/test-gate.md +17 -1
- package/commands/validate.md +2 -1
- package/commands/work-on/build/architect.md +28 -0
- package/commands/work-on/build/context.md +2 -0
- package/commands/work-on/build/implement.md +3 -1
- package/commands/work-on/build/validate.md +26 -7
- package/commands/work-on/build.md +163 -24
- package/commands/work-on/close.md +130 -3
- package/commands/work-on/decompose.md +19 -1
- package/commands/work-on/investigate.md +117 -2
- package/commands/work-on/review.md +24 -4
- package/commands/work-on-monolithic.md +7 -2
- package/commands/work-on.md +202 -4
- package/docs/BRAND.md +14 -7
- package/docs/CI.md +16 -2
- package/docs/CODEX.md +36 -1
- package/docs/CONFIG.md +5 -8
- package/docs/FORGE-PROTOCOL.md +15 -1064
- package/docs/anthropic-devrel-outreach.md +2 -2
- package/docs/articles/command-decomposition-token-savings.md +214 -0
- package/docs/articles/model-release-playbook.md +131 -0
- package/docs/articles/per-repo-adaptive-scripts-token-savings.md +27 -25
- package/docs/claude-breakpoints.json +75 -5
- package/docs/design/abc-benchmark.md +1 -1
- package/docs/design/design-spec-schema.md +1 -1
- package/docs/design/divergent-generation.md +1 -1
- package/docs/design/eval-gate-runbook.md +178 -0
- package/docs/design/show-hn-draft.md +26 -1
- package/docs/design/token-cost-baseline-1298.md +59 -0
- package/docs/eval/README.md +120 -0
- package/docs/eval/corpus/seed-v1.json +6 -0
- package/docs/eval/published/claude-sonnet-4-6-2026-07-04.json +33 -0
- package/docs/site/annotations-explained.md +24 -0
- package/docs/site/command-learning-path.md +51 -14
- package/docs/site/command-reference.md +386 -111
- package/docs/site/for-companies.md +95 -0
- package/docs/site/forge-annotation-protocol.md +12 -256
- package/docs/site/getting-started.md +43 -4
- package/docs/site/github-is-the-memory.md +113 -0
- package/docs/site/how-it-works.md +3 -13
- package/docs/site/index.md +9 -1
- package/docs/spec/eval-run-result.md +147 -0
- package/docs/spec/forge-protocol-v1.md +441 -18
- package/docs/spec/label-state-machine.md +55 -0
- package/docs/spec/review-protocol.md +158 -0
- package/docs/spec-graph-schema.md +28 -0
- package/docs/superpowers/specs/2026-07-04-economic-self-governance-design.md +181 -0
- package/docs/superpowers/specs/2026-07-04-provenance-trail-design.md +189 -0
- package/examples/forgedock-demo/README.md +41 -22
- package/examples/forgedock-demo/issues/06-bug-tags-type-validation.md +43 -0
- package/examples/forgedock-demo/issues/07-bug-negative-offset-pagination.md +42 -0
- package/examples/forgedock-demo/issues/08-bug-patch-mass-assignment.md +49 -0
- package/examples/forgedock-demo/issues/09-bug-count-injection.md +47 -0
- package/examples/forgedock-demo/issues/10-feature-sort-param.md +39 -0
- package/examples/forgedock-demo/issues/11-feature-patch-tags.md +37 -0
- package/examples/forgedock-demo/issues/12-feature-bulk-create.md +42 -0
- package/examples/forgedock-demo/issues/13-feature-archive-notes.md +46 -0
- package/examples/forgedock-demo/issues/14-refactor-extract-title-validation.md +41 -0
- package/examples/forgedock-demo/issues/15-refactor-protected-route-flag.md +43 -0
- package/examples/forgedock-demo/issues/16-refactor-extract-store.md +45 -0
- package/examples/forgedock-demo/issues/17-perf-tags-dedup-set.md +35 -0
- package/examples/forgedock-demo/issues/18-perf-remove-redundant-sort.md +37 -0
- package/examples/forgedock-demo/issues/19-docs-api-reference-full.md +53 -0
- package/examples/forgedock-demo/issues/20-docs-intentional-flaw-convention.md +46 -0
- package/examples/forgedock-demo/scripts/smoke.js +18 -1
- package/examples/forgedock-demo/src/db.js +36 -11
- package/examples/forgedock-demo/src/routes/notes.js +106 -9
- package/examples/forgedock-demo/src/server.js +4 -1
- package/package.json +3 -1
- package/packages/protocol/LICENSE +21 -0
- package/packages/protocol/src/cli.js +135 -0
- package/packages/protocol/src/emit.js +146 -0
- package/packages/protocol/src/index.js +43 -0
- package/packages/protocol/src/parse.js +254 -0
- package/packages/protocol/src/types.js +171 -0
- package/packages/protocol/src/validate.js +122 -0
- package/scripts/bench-topology-cost.mjs +372 -0
- package/scripts/check-command-docs-drift.sh +198 -0
- package/scripts/check-protocol-restatements.sh +176 -0
- package/scripts/check-registry/README.md +72 -0
- package/scripts/check-registry/manifest.json +6 -0
- package/scripts/code-index.sh +454 -0
- package/scripts/conformance-check.mjs +168 -0
- package/scripts/doctor-pipeline-state.sh +484 -0
- package/scripts/eval-gate-baseline.json +17 -0
- package/scripts/eval-gate-scorecard.mjs +242 -0
- package/scripts/eval-scorecard-aggregator.mjs +252 -0
- package/scripts/flaky-quarantine.sh +241 -0
- package/scripts/forge-annotation.sh +567 -0
- package/scripts/issue-dedup.sh +236 -0
- package/scripts/validate-annotation-node.mjs +233 -0
- package/scripts/worktree-lifecycle.sh +3 -3
- package/templates/devdocs/agent/using-forgedock.md +14 -0
- package/docs/site/.vitepress/config.mjs +0 -85
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios
|
|
3
|
+
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
#
|
|
5
|
+
# check-protocol-restatements.sh — Guard against future restatements of normative
|
|
6
|
+
# FORGE protocol content in commands/**/*.md.
|
|
7
|
+
#
|
|
8
|
+
# ForgeDock keeps three protocol definitions in designated normative source files:
|
|
9
|
+
#
|
|
10
|
+
# docs/FORGE-PROTOCOL.md — FORGE annotation format (annotation types,
|
|
11
|
+
# schemas, completion sentinels)
|
|
12
|
+
# docs/WORKFLOW.md — Label state machine (workflow:* transitions)
|
|
13
|
+
# commands/review-pr-agents.md — Evidence-Based Review Protocol (review agent
|
|
14
|
+
# behaviour, structured findings format)
|
|
15
|
+
#
|
|
16
|
+
# Once these are single-sourced, command specs should reference them via a
|
|
17
|
+
# one-line pointer, NOT restate the full content. This script detects
|
|
18
|
+
# heading-level signatures that indicate a full restatement has crept back in.
|
|
19
|
+
#
|
|
20
|
+
# Detected patterns (heading-level restatement signatures):
|
|
21
|
+
#
|
|
22
|
+
# FORGE_ANNOTATION_PROTOCOL — "# FORGE Annotation Protocol"
|
|
23
|
+
# "## FORGE Annotation Protocol"
|
|
24
|
+
# ANNOTATION_TYPES — "## Annotation Types"
|
|
25
|
+
# "### Annotation Types"
|
|
26
|
+
# WORKFLOW_STATE_MACHINE — "# Workflow State Machine"
|
|
27
|
+
# "## Workflow State Machine"
|
|
28
|
+
# LABEL_STATE_MACHINE — "# Label State Machine"
|
|
29
|
+
# "## Label State Machine"
|
|
30
|
+
# REVIEW_PROTOCOL — "## Evidence-Based Review Protocol"
|
|
31
|
+
# (outside its normative source)
|
|
32
|
+
#
|
|
33
|
+
# Each pattern is keyed to a NORMATIVE_SOURCE — the one file allowed to contain
|
|
34
|
+
# that heading. All other files in commands/ that match are flagged as
|
|
35
|
+
# restatements.
|
|
36
|
+
#
|
|
37
|
+
# Allowlist: to permit a heading in an additional file (e.g. a migration guide),
|
|
38
|
+
# add an HTML comment directly after the heading on the same line:
|
|
39
|
+
#
|
|
40
|
+
# ## Evidence-Based Review Protocol <!-- allowlist:check-protocol-restatements -->
|
|
41
|
+
#
|
|
42
|
+
# Usage:
|
|
43
|
+
# check-protocol-restatements.sh [<commands_dir> [<docs_dir>]]
|
|
44
|
+
# commands_dir: path to the commands/ directory (default: ./commands)
|
|
45
|
+
# docs_dir: path to the docs/ directory (default: ./docs)
|
|
46
|
+
#
|
|
47
|
+
# Exit codes:
|
|
48
|
+
# 0 no restatements found
|
|
49
|
+
# 1 one or more restatement headings found (listed to stderr)
|
|
50
|
+
# 2 usage / dependency error (directory not found)
|
|
51
|
+
#
|
|
52
|
+
# <!-- Added: forge#1270 -->
|
|
53
|
+
|
|
54
|
+
set -euo pipefail
|
|
55
|
+
|
|
56
|
+
COMMANDS_DIR="${1:-./commands}"
|
|
57
|
+
DOCS_DIR="${2:-./docs}"
|
|
58
|
+
|
|
59
|
+
if [ ! -d "$COMMANDS_DIR" ]; then
|
|
60
|
+
echo "ERROR: commands directory not found: $COMMANDS_DIR" >&2
|
|
61
|
+
echo "Usage: $0 [<commands_dir> [<docs_dir>]]" >&2
|
|
62
|
+
exit 2
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
if [ ! -d "$DOCS_DIR" ]; then
|
|
66
|
+
echo "ERROR: docs directory not found: $DOCS_DIR" >&2
|
|
67
|
+
echo "Usage: $0 [<commands_dir> [<docs_dir>]]" >&2
|
|
68
|
+
exit 2
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# Normalise paths so comparisons against normative sources work correctly.
|
|
72
|
+
COMMANDS_DIR="$(cd "$COMMANDS_DIR" && pwd)"
|
|
73
|
+
DOCS_DIR="$(cd "$DOCS_DIR" && pwd)"
|
|
74
|
+
REPO_ROOT="$(dirname "$COMMANDS_DIR")"
|
|
75
|
+
|
|
76
|
+
# ---------------------------------------------------------------------------
|
|
77
|
+
# Pattern table — parallel arrays (same index = one pattern rule)
|
|
78
|
+
#
|
|
79
|
+
# PATTERN_NAMES : human-readable pattern ID (for error messages)
|
|
80
|
+
# PATTERN_REGEXES : grep -E regex, anchored to line start (^)
|
|
81
|
+
# NORMATIVE_SOURCES: repo-root-relative path of the one file that MAY contain
|
|
82
|
+
# the heading; all other files in commands/ are violations
|
|
83
|
+
# ---------------------------------------------------------------------------
|
|
84
|
+
PATTERN_NAMES=(
|
|
85
|
+
"FORGE_ANNOTATION_PROTOCOL"
|
|
86
|
+
"ANNOTATION_TYPES"
|
|
87
|
+
"WORKFLOW_STATE_MACHINE"
|
|
88
|
+
"LABEL_STATE_MACHINE"
|
|
89
|
+
"REVIEW_PROTOCOL"
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
# Each regex matches one or more heading levels for the given protocol section.
|
|
93
|
+
# Anchored (^) so prose references mid-sentence are not false positives.
|
|
94
|
+
# Trailing content after the key phrase is permitted (e.g. parentheticals like
|
|
95
|
+
# "(ALL Agents Follow)") — the anchored key phrase is the restatement signal.
|
|
96
|
+
# The allowlist comment token exclusion is handled in a separate grep -v pass.
|
|
97
|
+
PATTERN_REGEXES=(
|
|
98
|
+
"^#{1,2} FORGE Annotation Protocol"
|
|
99
|
+
"^#{2,3} Annotation Types[[:space:]]*$"
|
|
100
|
+
"^#{1,2} Workflow State Machine"
|
|
101
|
+
"^#{1,2} Label State Machine"
|
|
102
|
+
"^#{1,2} Evidence-Based Review Protocol"
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
NORMATIVE_SOURCES=(
|
|
106
|
+
"docs/FORGE-PROTOCOL.md"
|
|
107
|
+
"docs/FORGE-PROTOCOL.md"
|
|
108
|
+
"docs/WORKFLOW.md"
|
|
109
|
+
"docs/WORKFLOW.md"
|
|
110
|
+
"commands/review-pr-agents.md"
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# ---------------------------------------------------------------------------
|
|
114
|
+
# Scan: for each pattern, grep all .md files in commands/, exclude the
|
|
115
|
+
# normative source and allowlisted lines, collect violations.
|
|
116
|
+
# ---------------------------------------------------------------------------
|
|
117
|
+
VIOLATIONS=()
|
|
118
|
+
|
|
119
|
+
for i in "${!PATTERN_NAMES[@]}"; do
|
|
120
|
+
pattern_name="${PATTERN_NAMES[$i]}"
|
|
121
|
+
regex="${PATTERN_REGEXES[$i]}"
|
|
122
|
+
normative_rel="${NORMATIVE_SOURCES[$i]}"
|
|
123
|
+
normative_abs="${REPO_ROOT}/${normative_rel}"
|
|
124
|
+
|
|
125
|
+
# grep -rn: recursive, print filename:lineno:content
|
|
126
|
+
# --include: only .md files
|
|
127
|
+
# We pipe through grep -v to:
|
|
128
|
+
# 1. Exclude the normative source file itself
|
|
129
|
+
# 2. Exclude lines carrying the allowlist token
|
|
130
|
+
while IFS= read -r hit; do
|
|
131
|
+
[ -n "$hit" ] || continue
|
|
132
|
+
# hit format: <filepath>:<lineno>:<line_content>
|
|
133
|
+
filepath="${hit%%:*}"
|
|
134
|
+
rest="${hit#*:}"
|
|
135
|
+
lineno="${rest%%:*}"
|
|
136
|
+
line_content="${rest#*:}"
|
|
137
|
+
|
|
138
|
+
# Display a repo-root-relative path for readability.
|
|
139
|
+
rel_path="${filepath#"${REPO_ROOT}/"}"
|
|
140
|
+
|
|
141
|
+
VIOLATIONS+=("${rel_path}:${lineno}: restatement of ${pattern_name}")
|
|
142
|
+
VIOLATIONS+=(" heading: '${line_content}'")
|
|
143
|
+
done < <(
|
|
144
|
+
grep -rnE "$regex" "$COMMANDS_DIR" --include="*.md" 2>/dev/null \
|
|
145
|
+
| grep -v "^${normative_abs}:" \
|
|
146
|
+
| grep -v '<!-- allowlist:check-protocol-restatements -->' \
|
|
147
|
+
|| true
|
|
148
|
+
)
|
|
149
|
+
done
|
|
150
|
+
|
|
151
|
+
# ---------------------------------------------------------------------------
|
|
152
|
+
# Report and exit.
|
|
153
|
+
# ---------------------------------------------------------------------------
|
|
154
|
+
if [ ${#VIOLATIONS[@]} -gt 0 ]; then
|
|
155
|
+
echo "ERROR: FORGE protocol restatement heading(s) found in commands/:" >&2
|
|
156
|
+
echo "" >&2
|
|
157
|
+
for v in "${VIOLATIONS[@]}"; do
|
|
158
|
+
echo " $v" >&2
|
|
159
|
+
done
|
|
160
|
+
echo "" >&2
|
|
161
|
+
echo "These headings indicate a full restatement of normative protocol content." >&2
|
|
162
|
+
echo "Replace the section with a one-line pointer to the normative source, e.g.:" >&2
|
|
163
|
+
echo " > Protocol reference: see docs/FORGE-PROTOCOL.md" >&2
|
|
164
|
+
echo "" >&2
|
|
165
|
+
echo "To permit a heading in this file intentionally, add the allowlist token:" >&2
|
|
166
|
+
echo " ## <Heading> <!-- allowlist:check-protocol-restatements -->" >&2
|
|
167
|
+
echo "" >&2
|
|
168
|
+
echo "Normative sources (these files may contain the headings):" >&2
|
|
169
|
+
echo " docs/FORGE-PROTOCOL.md — FORGE annotation format" >&2
|
|
170
|
+
echo " docs/WORKFLOW.md — Label state machine" >&2
|
|
171
|
+
echo " commands/review-pr-agents.md — Evidence-Based Review Protocol" >&2
|
|
172
|
+
exit 1
|
|
173
|
+
fi
|
|
174
|
+
|
|
175
|
+
echo "OK: No FORGE protocol restatement headings detected in $COMMANDS_DIR"
|
|
176
|
+
exit 0
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# ForgeDock Check Registry
|
|
2
|
+
|
|
3
|
+
The check registry is the feedback edge from review findings back into deterministic quality-gate enforcement. When the same defect class (identified by its `FORGE:PATTERN` tag) recurs 3+ times in a pipeline health window, `/pipeline-health` Phase 4 emits a check-promotion issue. Once the check is written and merged, it is registered here and runs automatically in Step 2 of `/quality-gate`.
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Review finding filed
|
|
9
|
+
→ FORGE:PATTERN tag added to issue body (review-pr.md Phase 6C)
|
|
10
|
+
→ pipeline-health Phase 4 counts pattern recurrences across issues
|
|
11
|
+
→ at threshold (3+): emits check-promotion issue referencing all source findings
|
|
12
|
+
→ check is written (LLM, once) and placed in scripts/check-registry/
|
|
13
|
+
→ check is registered in manifest.json
|
|
14
|
+
→ quality-gate.md Step 2 runs all registered checks — blocks commit on match
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## manifest.json schema
|
|
18
|
+
|
|
19
|
+
Each entry in the `checks` array:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"slug": "migration-number-collision",
|
|
24
|
+
"description": "Detects duplicate migration number prefixes (e.g. two 0220_*.sql files)",
|
|
25
|
+
"pattern_tag": "migration-number-collision",
|
|
26
|
+
"script": "scripts/check-registry/migration-number-collision.sh",
|
|
27
|
+
"source_findings": ["#1234", "#1298", "#1315"],
|
|
28
|
+
"promoted_at": "2026-07-04",
|
|
29
|
+
"severity": "HIGH",
|
|
30
|
+
"domains": ["DATABASE"]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Fields:
|
|
35
|
+
|
|
36
|
+
| Field | Required | Description |
|
|
37
|
+
|-------|----------|-------------|
|
|
38
|
+
| `slug` | yes | Unique identifier, matches the `FORGE:PATTERN` slug and the script filename |
|
|
39
|
+
| `description` | yes | One sentence: what the check detects |
|
|
40
|
+
| `pattern_tag` | yes | The slug used in `<!-- FORGE:PATTERN: {slug} -->` annotations on finding issues |
|
|
41
|
+
| `script` | yes | Relative path from repo root to the executable check script |
|
|
42
|
+
| `source_findings` | yes | Issue numbers of the review findings that triggered promotion (minimum 3) |
|
|
43
|
+
| `promoted_at` | yes | ISO date when the check was added to the registry |
|
|
44
|
+
| `severity` | yes | `HIGH` (blocks commit) or `MEDIUM` (warning) |
|
|
45
|
+
| `domains` | yes | Quality-gate domain(s) that trigger this check (used for domain-scoped runs) |
|
|
46
|
+
|
|
47
|
+
## Check script contract
|
|
48
|
+
|
|
49
|
+
Each check script:
|
|
50
|
+
|
|
51
|
+
- **Receives**: A space-separated list of changed files on `$1` (same format as `{CHANGED_FILES}` in quality-gate.md), and the worktree path on `$2`.
|
|
52
|
+
- **Exits 0**: No match — check passed.
|
|
53
|
+
- **Exits 1**: Match found — check failed. Print one line per finding to stdout in the format: `{SLUG} | {SEVERITY} | {file:line} | {description}`
|
|
54
|
+
- **Exits 2**: Check not applicable (no relevant files in changeset) — treated as pass.
|
|
55
|
+
- **Runtime**: Must complete in ≤5s for a typical change set. Registry checks add ≤5s total to gate runtime.
|
|
56
|
+
- **No side effects**: Must not write files, network calls, or modify git state.
|
|
57
|
+
|
|
58
|
+
Example output on exit 1:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
migration-number-collision | HIGH | migrations/0220_add_user_table.sql | Duplicate migration prefix 0220 — migrations/0220_existing.sql already uses this prefix
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Adding a new check
|
|
65
|
+
|
|
66
|
+
1. Write `scripts/check-registry/{slug}.sh` following the contract above.
|
|
67
|
+
2. Test it: `bash scripts/check-registry/{slug}.sh "path/to/changed/file" /path/to/repo`
|
|
68
|
+
3. Add an entry to `manifest.json`.
|
|
69
|
+
4. PR and merge — the check runs on all subsequent quality-gate invocations.
|
|
70
|
+
|
|
71
|
+
<!-- SPDX-FileCopyrightText: Copyright (c) RapierCraft Studios -->
|
|
72
|
+
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
|