@tduyng/pi-devos 0.13.6 → 0.14.0
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/CHANGELOG.md +23 -0
- package/README.md +26 -33
- package/package.json +1 -2
- package/plugins/devos/agents/verifier.md +4 -30
- package/plugins/devos/pi/extension/devos.ts +16 -26
- package/plugins/devos/scripts/check-evidence-router.sh +7 -1
- package/plugins/devos/scripts/evidence-router.py +5 -3
- package/plugins/devos/scripts/gates/check-dod-core.sh +5 -3
- package/plugins/devos/scripts/gates/check-port-source.sh +1 -1
- package/plugins/devos/scripts/gates/check-scenario-coverage.sh +10 -8
- package/plugins/devos/scripts/gates/phase-gate.sh +6 -6
- package/plugins/devos/scripts/gates/plan-template-check.py +6 -12
- package/plugins/devos/scripts/gates/spec-contract.sh +19 -0
- package/plugins/devos/scripts/gates/spec-template-check.py +8 -21
- package/plugins/devos/scripts/gates/suite/01-dod.sh +485 -0
- package/plugins/devos/scripts/gates/suite/02-integrity.sh +310 -0
- package/plugins/devos/scripts/gates/suite/03-archetype.sh +255 -0
- package/plugins/devos/scripts/gates/suite/04-spec-validator.sh +183 -0
- package/plugins/devos/scripts/gates/suite/05-requires.sh +360 -0
- package/plugins/devos/scripts/gates/suite/06-clarify-adapters.sh +435 -0
- package/plugins/devos/scripts/gates/suite/07-lint-evals.sh +350 -0
- package/plugins/devos/scripts/gates/suite/08-converge.sh +591 -0
- package/plugins/devos/scripts/gates/suite/09-quality.sh +516 -0
- package/plugins/devos/scripts/gates/suite/10-eval-harness.sh +679 -0
- package/plugins/devos/scripts/gates/test-gates.sh +23 -4253
- package/plugins/devos/scripts/gates/test-integrity-rubric.sh +1 -1
- package/plugins/devos/scripts/gates/test-phase-gate.sh +5 -5
- package/plugins/devos/skills/build/SKILL.md +3 -3
- package/plugins/devos/skills/build/references/refactor.md +1 -1
- package/plugins/devos/skills/build/references/routes.md +4 -4
- package/plugins/devos/skills/frame/SKILL.md +22 -39
- package/plugins/devos/skills/frame/references/template.md +115 -0
- package/plugins/devos/skills/implement/SKILL.md +4 -4
- package/plugins/devos/skills/implement/references/dod.md +6 -1
- package/plugins/devos/skills/implement/references/implement.md +3 -1
- package/plugins/devos/skills/implement/references/plan.md +9 -27
- package/plugins/devos/skills/implement/references/resume.md +1 -1
- package/plugins/devos/skills/implement/references/verify-close.md +4 -3
- package/plugins/devos/skills/implement/scripts/ops-log.sh +2 -2
- package/plugins/devos/skills/implement/scripts/validate-spec.sh +17 -65
- package/plugins/devos/skills/init/references/context.md +1 -1
- package/plugins/devos/skills/review/SKILL.md +24 -47
- package/plugins/devos/skills/review/references/comments.md +13 -0
- package/plugins/devos/skills/review/references/reviewer.md +124 -0
- package/plugins/devos/skills/review/references/routing.md +35 -0
- package/plugins/devos/skills/review/scripts/__pycache__/prepare.cpython-313.pyc +0 -0
- package/plugins/devos/skills/review/scripts/prepare.py +763 -0
- package/plugins/devos/skills/spec/SKILL.md +5 -6
- package/plugins/devos/skills/spec/references/write-spec.md +36 -51
- package/plugins/devos/skills/spec/scripts/clarify.sh +4 -4
- package/plugins/devos/skills/status/SKILL.md +4 -4
- package/plugins/devos/skills/status/scripts/check-requires.py +4 -4
- package/plugins/devos/skills/status/scripts/convention-usage.sh +1 -1
- package/plugins/devos/skills/status/scripts/quality-correlation.sh +2 -25
- package/plugins/devos/scripts/gates/check-handoff.sh +0 -215
- package/plugins/devos/skills/design-taste/SKILL.md +0 -55
- package/plugins/devos/skills/design-taste/references/tells.md +0 -85
- package/plugins/devos/skills/design-taste/scripts/slop-scan.py +0 -305
- package/plugins/devos/skills/docs/SKILL.md +0 -22
- package/plugins/devos/skills/docs/references/backfill.md +0 -54
- package/plugins/devos/skills/docs/references/init.md +0 -43
- package/plugins/devos/skills/docs/references/status.md +0 -71
- package/plugins/devos/skills/docs/references/update.md +0 -80
- package/plugins/devos/skills/explain/SKILL.md +0 -45
- package/plugins/devos/skills/explain/references/quiz.md +0 -21
- package/plugins/devos/skills/frame/references/boundaries.md +0 -53
- package/plugins/devos/skills/frame/references/decompose.md +0 -96
- package/plugins/devos/skills/frame/references/impact.md +0 -43
- package/plugins/devos/skills/frame/references/interrogate.md +0 -68
- package/plugins/devos/skills/product/SKILL.md +0 -40
- package/plugins/devos/skills/product/references/planner.md +0 -54
- package/plugins/devos/skills/surgical-diff/SKILL.md +0 -23
- package/plugins/devos/skills/test-integrity/SKILL.md +0 -26
- package/plugins/devos/skills/verification-evidence/SKILL.md +0 -17
- package/plugins/devos/workflows/common/backlog-file-structure.md +0 -44
- package/plugins/devos/workflows/common/category-file-structure.md +0 -41
- package/plugins/devos/workflows/common/feature-line-format.md +0 -10
- package/plugins/devos/workflows/common/roadmap-file-structure.md +0 -51
- package/plugins/devos/workflows/common/suggest-categories.md +0 -76
- package/plugins/devos/workflows/common/suggest-milestones.md +0 -92
- package/plugins/devos/workflows/doc/doc-health.md +0 -137
- package/plugins/devos/workflows/doc/doc-writer.md +0 -44
- package/plugins/devos/workflows/doc/init-documentation.md +0 -196
- package/plugins/devos/workflows/doc/retro-documentation.md +0 -304
- package/plugins/devos/workflows/doc/templates/library.md +0 -58
- package/plugins/devos/workflows/doc/templates/service.md +0 -61
- package/plugins/devos/workflows/doc/update-documentation.md +0 -194
- package/plugins/devos/workflows/doc/write-documentation.md +0 -137
- package/plugins/devos/workflows/product/create-product-mission.md +0 -45
- package/plugins/devos/workflows/product/create-product-roadmap.md +0 -106
- package/plugins/devos/workflows/product/create-product-tech-stack.md +0 -19
- package/plugins/devos/workflows/product/gather-product-info.md +0 -25
- package/plugins/devos/workflows/product/resume-detection.md +0 -70
- package/plugins/devos/workflows/product/reverse-backlog.md +0 -118
- package/plugins/devos/workflows/product/reverse-domain-model.md +0 -86
- package/plugins/devos/workflows/product/reverse-product-plan.md +0 -81
- package/plugins/devos/workflows/product/reverse-tech-stack.md +0 -73
- package/plugins/devos/workflows/product/scan-deep.md +0 -113
- package/plugins/devos/workflows/product/scan-git.md +0 -122
- package/plugins/devos/workflows/product/scan-light.md +0 -154
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# --- test-integrity-rubric.sh ---------------------------------------------
|
|
2
|
+
|
|
3
|
+
printf 'expect(a).toBe(1)\n' > "$old"
|
|
4
|
+
printf 'const x = 2\n' > "$new"
|
|
5
|
+
out=$(bash "$RUBRIC" --format copilot --file src/main.ts --old "$old" --new "$new")
|
|
6
|
+
[[ "$out" == '{"permissionDecision":"allow"}' ]]; check "rubric: non-test file allows" 0 $?
|
|
7
|
+
|
|
8
|
+
printf 'it("works", () => { expect(a).toBe(1) })\n' > "$old"
|
|
9
|
+
printf 'it.skip("works", () => { expect(a).toBe(1) })\n' > "$new"
|
|
10
|
+
out=$(bash "$RUBRIC" --format copilot --file src/main.test.ts --old "$old" --new "$new")
|
|
11
|
+
[[ "$out" == *'"deny"'* ]]; check "rubric: added .skip denies" 0 $?
|
|
12
|
+
|
|
13
|
+
printf 'expect(a).toBe(1)\nexpect(b).toBe(2)\n' > "$old"
|
|
14
|
+
printf 'expect(a).toBe(1)\n' > "$new"
|
|
15
|
+
out=$(bash "$RUBRIC" --format copilot --file src/main.test.ts --old "$old" --new "$new")
|
|
16
|
+
[[ "$out" == *'"deny"'* ]]; check "rubric: removed assertion denies" 0 $?
|
|
17
|
+
|
|
18
|
+
printf 'expect(a).toBe(1)\n' > "$old"
|
|
19
|
+
printf 'expect(a).toBe(1)\nexpect(b).toBe(2)\n' > "$new"
|
|
20
|
+
out=$(bash "$RUBRIC" --format copilot --file src/main.test.ts --old "$old" --new "$new")
|
|
21
|
+
[[ "$out" == '{"permissionDecision":"allow"}' ]]; check "rubric: added assertion allows" 0 $?
|
|
22
|
+
|
|
23
|
+
printf 'expect(a).toBe(1)\n' > "$new"
|
|
24
|
+
out=$(bash "$RUBRIC" --format copilot --file src/new.test.ts --old "$tmp/absent.txt" --new "$new")
|
|
25
|
+
[[ "$out" == '{"permissionDecision":"allow"}' ]]; check "rubric: brand-new test file allows" 0 $?
|
|
26
|
+
|
|
27
|
+
# Regression: bare "spec" substring in a path (DevOS's own devos/specs/*.md
|
|
28
|
+
# artifacts) must never be treated as a test file, even if the prose content
|
|
29
|
+
# happens to contain words like "expect"/"assert".
|
|
30
|
+
printf 'Expect the API to return 200.\n' > "$old"
|
|
31
|
+
printf 'A change to what we expect from the API.\n' > "$new"
|
|
32
|
+
out=$(bash "$RUBRIC" --format copilot --file devos/specs/2026-01-01-foo/spec.md --old "$old" --new "$new")
|
|
33
|
+
[[ "$out" == '{"permissionDecision":"allow"}' ]]; check "rubric: devos/specs/*.md is never a test file" 0 $?
|
|
34
|
+
|
|
35
|
+
printf 'assert.strictEqual(a, 1)\n' > "$old"
|
|
36
|
+
printf 'assert.strictEqual(a, 1)\nassert.strictEqual(b, 2)\n' > "$new"
|
|
37
|
+
out=$(bash "$RUBRIC" --format copilot --file devos/specs/2026-01-01-foo/decisions.md --old "$old" --new "$new")
|
|
38
|
+
[[ "$out" == '{"permissionDecision":"allow"}' ]]; check "rubric: decisions.md is never a test file" 0 $?
|
|
39
|
+
|
|
40
|
+
# Bare "test.js" (no dot-test-dot, this project's own eval fixtures' shape) still counts as a test file.
|
|
41
|
+
printf 'assert.strictEqual(a, 1)\nassert.strictEqual(b, 2)\n' > "$old"
|
|
42
|
+
printf 'assert.strictEqual(a, 1)\n' > "$new"
|
|
43
|
+
out=$(bash "$RUBRIC" --format copilot --file test.js --old "$old" --new "$new")
|
|
44
|
+
[[ "$out" == *'"deny"'* ]]; check "rubric: bare test.js still detects removed assertion" 0 $?
|
|
45
|
+
|
|
46
|
+
# Work-tree-relative test directories: what every hook actually passes. A
|
|
47
|
+
# leading-slash-only pattern waved all three of these straight through.
|
|
48
|
+
for relpath in tests/login.js test/helpers.js __tests__/setup.js; do
|
|
49
|
+
out=$(bash "$RUBRIC" --format copilot --file "$relpath" --old "$old" --new "$new")
|
|
50
|
+
[[ "$out" == *'"deny"'* ]]; check "rubric: relative $relpath is gated" 0 $?
|
|
51
|
+
done
|
|
52
|
+
|
|
53
|
+
# The neighbouring word that must stay allowed: DevOS's own devos/specs/ tree.
|
|
54
|
+
out=$(bash "$RUBRIC" --format copilot --file specs/login.md --old "$old" --new "$new")
|
|
55
|
+
[[ "$out" == '{"permissionDecision":"allow"}' ]]; check "rubric: relative specs/ is not a test dir" 0 $?
|
|
56
|
+
|
|
57
|
+
# No --format: the default exit-code contract, used by Claude Code's own
|
|
58
|
+
# wrapper (test-integrity-hook-claude.sh) and by any future adapter with a
|
|
59
|
+
# plain allow/deny hook.
|
|
60
|
+
printf 'it("works", () => { expect(a).toBe(1) })\n' > "$old"
|
|
61
|
+
printf 'it.skip("works", () => { expect(a).toBe(1) })\n' > "$new"
|
|
62
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
63
|
+
check "rubric: no --format, added .skip denies (exit 2)" 2 $?
|
|
64
|
+
|
|
65
|
+
# A value-bearing option with nothing after it is a malformed invocation, not a
|
|
66
|
+
# policy decision. Reading $2 anyway died under `set -u` with exit 1, which
|
|
67
|
+
# run-gate.sh forwards to the harness as a block carrying a shell error instead
|
|
68
|
+
# of a reason, so a typo in a hook's arguments bricked every edit.
|
|
69
|
+
for opt in --format --file --old --new; do
|
|
70
|
+
bash "$RUBRIC" "$opt" >/dev/null 2>&1 </dev/null
|
|
71
|
+
check "rubric: valueless $opt allows rather than dying" 0 $?
|
|
72
|
+
done
|
|
73
|
+
[[ "$(bash "$RUBRIC" --format copilot 2>/dev/null)" == '{"permissionDecision":"allow"}' ]]
|
|
74
|
+
check "rubric: a valueless option still emits the adapter's allow decision" 0 $?
|
|
75
|
+
bash "$RUBRIC" --write --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
76
|
+
check "rubric: a well-formed --write invocation still denies (exit 2)" 2 $?
|
|
77
|
+
|
|
78
|
+
printf 'expect(a).toBe(1)\n' > "$old"
|
|
79
|
+
printf 'expect(a).toBe(1)\nexpect(b).toBe(2)\n' > "$new"
|
|
80
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new"
|
|
81
|
+
check "rubric: no --format, added assertion allows (exit 0)" 0 $?
|
|
82
|
+
|
|
83
|
+
# --- implementation output boundary -----------------------------------------
|
|
84
|
+
# SC IDs and framework metadata belong in devos/ artifacts. Project code and
|
|
85
|
+
# tests use behavior-facing names and carry no trace of the process that wrote
|
|
86
|
+
# them. The edit gate applies this to source as well as tests.
|
|
87
|
+
printf "it('SC-3: rejects an expired token', () => {})\n" > "$new"
|
|
88
|
+
bash "$RUBRIC" --file src/auth.test.ts --old "$tmp/absent.txt" --new "$new" 2>/dev/null
|
|
89
|
+
check "boundary: SC ID in a new test name denies" 2 $?
|
|
90
|
+
|
|
91
|
+
printf 'def test_sc_3_rejects_expired_token():\n pass\n' > "$new"
|
|
92
|
+
bash "$RUBRIC" --file tests/auth_test.py --old "$tmp/absent.txt" --new "$new" 2>/dev/null
|
|
93
|
+
check "boundary: SC ID in a snake-case test name denies" 2 $?
|
|
94
|
+
|
|
95
|
+
printf 'it("returns 401 for an expired token", () => {})\n' > "$new"
|
|
96
|
+
bash "$RUBRIC" --file src/auth.test.ts --old "$tmp/absent.txt" --new "$new" 2>/dev/null
|
|
97
|
+
check "boundary: natural behavior test name allows" 0 $?
|
|
98
|
+
|
|
99
|
+
printf '// Implemented by DevOS\n' > "$new"
|
|
100
|
+
bash "$RUBRIC" --file src/auth.ts --old "$tmp/absent.txt" --new "$new" 2>/dev/null
|
|
101
|
+
check "boundary: framework attribution in source denies" 2 $?
|
|
102
|
+
|
|
103
|
+
printf 'The contract is devos-contract: 1\n' > "$new"
|
|
104
|
+
bash "$RUBRIC" --file src/contract.ts --old "$tmp/absent.txt" --new "$new" 2>/dev/null
|
|
105
|
+
check "boundary: framework contract marker in a string denies" 2 $?
|
|
106
|
+
|
|
107
|
+
printf 'Scenario SC-3: rejects an expired token\n' > "$new"
|
|
108
|
+
bash "$RUBRIC" --file devos/specs/auth/spec.md --old "$tmp/absent.txt" --new "$new" 2>/dev/null
|
|
109
|
+
check "boundary: devos artifact keeps internal trace metadata" 0 $?
|
|
110
|
+
|
|
111
|
+
mkdir -p "$tmp/devos/src"
|
|
112
|
+
printf '// Implemented by DevOS\n' > "$tmp/devos/src/trace.ts"
|
|
113
|
+
bash "$BOUNDARY" --scan --file devos/src/trace.ts 2>/dev/null
|
|
114
|
+
check "boundary: code under devos keeps internal trace metadata" 0 $?
|
|
115
|
+
|
|
116
|
+
mkdir -p "$tmp/plugins/devos"
|
|
117
|
+
printf '// Implemented by DevOS\n' > "$tmp/plugins/devos/trace.ts"
|
|
118
|
+
bash "$BOUNDARY" --scan --file plugins/devos/trace.ts 2>/dev/null
|
|
119
|
+
check "boundary: a project plugins/devos directory is still project code" 2 $?
|
|
120
|
+
|
|
121
|
+
mkdir -p "$tmp/src"
|
|
122
|
+
printf 'const value = 1\n' > "$old"
|
|
123
|
+
printf '// Implemented by DevOS\nconst value = 1\n' > "$new"
|
|
124
|
+
bash "$BOUNDARY" --file devos/../src/traversal.ts --old "$old" --new "$new" 2>/dev/null
|
|
125
|
+
check "boundary: traversal cannot disguise project code as a devos artifact" 2 $?
|
|
126
|
+
|
|
127
|
+
printf 'Project tools may mention DevOS in onboarding docs.\n' > "$new"
|
|
128
|
+
bash "$RUBRIC" --file AGENTS.md --old "$tmp/absent.txt" --new "$new" 2>/dev/null
|
|
129
|
+
check "boundary: non-code onboarding file is outside this gate" 0 $?
|
|
130
|
+
|
|
131
|
+
printf '// Implemented by DevOS\nconst status = 401\n' > "$old"
|
|
132
|
+
printf '// Implemented by DevOS\nconst status = 401\nconst role = "user"\n' > "$new"
|
|
133
|
+
bash "$RUBRIC" --file src/auth.ts --old "$old" --new "$new" 2>/dev/null
|
|
134
|
+
check "boundary: unrelated edit around pre-existing metadata allows" 0 $?
|
|
135
|
+
|
|
136
|
+
mkdir -p "$tmp/src"
|
|
137
|
+
printf '// Implemented by DevOS\nconst status = 401\n' > "$tmp/src/auth.ts"
|
|
138
|
+
bash "$BOUNDARY" --scan --file src/auth.ts 2>/dev/null
|
|
139
|
+
check "boundary: scan mode rejects framework metadata already in source" 2 $?
|
|
140
|
+
|
|
141
|
+
# --- run-gate.sh (claude test-integrity) -----------------------------------
|
|
142
|
+
# Claude's test-integrity gate is now the single dispatcher: run-gate.sh
|
|
143
|
+
# --agent claude test-integrity. The old per-tool shim is gone, so a
|
|
144
|
+
# behavioral regression here surfaces as a changed decision below.
|
|
145
|
+
claude_ti() { bash "$(dirname "$DOD")/run-gate.sh" --agent claude test-integrity; }
|
|
146
|
+
CLAUDE_HOOK="$(dirname "$DOD")/run-gate.sh"
|
|
147
|
+
|
|
148
|
+
payload=$(jq -n --arg f src/main.test.ts --arg c 'it("works", () => { expect(a).toBe(1) })' '{tool_input:{file_path:$f,content:$c}}')
|
|
149
|
+
echo "$payload" | claude_ti
|
|
150
|
+
check "claude hook: Write adding an assertion allows" 0 $?
|
|
151
|
+
|
|
152
|
+
payload=$(jq -n --arg f src/main.test.ts --arg c 'it.skip("works", () => { expect(a).toBe(1) })' '{tool_input:{file_path:$f,content:$c}}')
|
|
153
|
+
echo "$payload" | claude_ti 2>/dev/null
|
|
154
|
+
check "claude hook: Write adding .skip denies" 2 $?
|
|
155
|
+
|
|
156
|
+
mkdir -p "$tmp/src"
|
|
157
|
+
printf 'it("works", () => { expect(a).toBe(1) })\n' > "$tmp/src/write.test.ts"
|
|
158
|
+
payload=$(jq -n --arg f "$tmp/src/write.test.ts" --arg c 'it.skip("works", () => { expect(a).toBe(1) })' '{tool_input:{file_path:$f,content:$c}}')
|
|
159
|
+
echo "$payload" | claude_ti 2>/dev/null
|
|
160
|
+
check "claude hook: Write to an existing test file adding .skip denies" 2 $?
|
|
161
|
+
|
|
162
|
+
payload=$(jq -n --arg f src/main.ts --arg c 'const x = 2' '{tool_input:{file_path:$f,content:$c}}')
|
|
163
|
+
echo "$payload" | claude_ti
|
|
164
|
+
check "claude hook: non-test file allows" 0 $?
|
|
165
|
+
|
|
166
|
+
payload=$(jq -n --arg f src/auth.ts --arg c '// Implemented by DevOS' '{tool_input:{file_path:$f,content:$c}}')
|
|
167
|
+
echo "$payload" | claude_ti 2>/dev/null
|
|
168
|
+
check "claude hook: process metadata in source denies" 2 $?
|
|
169
|
+
|
|
170
|
+
for tool in copilot codex; do
|
|
171
|
+
if [[ "$tool" == "copilot" ]]; then
|
|
172
|
+
payload=$(jq -n --arg f src/auth.ts --arg c '// Implemented by DevOS' '{toolArgs:{path:$f,content:$c}}')
|
|
173
|
+
else
|
|
174
|
+
payload=$(jq -n --arg f src/auth.ts --arg c '// Implemented by DevOS' '{tool_input:{path:$f,content:$c}}')
|
|
175
|
+
fi
|
|
176
|
+
out=$(printf '%s' "$payload" | bash "$CLAUDE_HOOK" --agent "$tool" test-integrity)
|
|
177
|
+
[[ "$out" == *'"permissionDecision":"deny"'* ]]
|
|
178
|
+
check "$tool hook: process metadata in source denies through the adapter contract" 0 $?
|
|
179
|
+
done
|
|
180
|
+
|
|
181
|
+
payload=$(jq -n --arg f src/auth.ts --arg c '// Implemented by DevOS' '{tool_input:{path:$f,content:$c}}')
|
|
182
|
+
out=$(printf '%s' "$payload" | bash "$CLAUDE_HOOK" --agent cursor test-integrity)
|
|
183
|
+
[[ "$out" == '{"permission":"deny"'* ]]
|
|
184
|
+
check "cursor hook: process metadata in source denies through the adapter contract" 0 $?
|
|
185
|
+
|
|
186
|
+
# --- payload-field contract -------------------------------------------------
|
|
187
|
+
# Every case above builds its payload from the same field names the hook reads,
|
|
188
|
+
# so the pair agrees with itself whichever names it uses. Rename a field on
|
|
189
|
+
# both sides and all of them still pass while the live gate reads `empty` from
|
|
190
|
+
# a real payload and exits 0: enforcement gone, suite green. Two checks break
|
|
191
|
+
# that circle.
|
|
192
|
+
#
|
|
193
|
+
# 1. Pin the exact jq paths the hook may read, against the published PreToolUse
|
|
194
|
+
# schema (code.claude.com/docs/en/hooks: tool_input carries the tool's own
|
|
195
|
+
# arguments, so Edit gives file_path/old_string/new_string and Write gives
|
|
196
|
+
# file_path/content). Editing the hook's field names now fails here until
|
|
197
|
+
# someone re-reads the doc and updates this list deliberately.
|
|
198
|
+
pinned=$(printf '%s\n' \
|
|
199
|
+
'.tool_input.content' \
|
|
200
|
+
'.tool_input.file_path' \
|
|
201
|
+
'.tool_input.new_string' \
|
|
202
|
+
'.tool_input.old_string' | sort | tr '\n' ' ')
|
|
203
|
+
actual=$(sed -n '/^claude)/,/;;/p' "$CLAUDE_HOOK" | grep -oE "TI_(FILE|CONTENT|NEW|OLD)='\.tool_input\.[a-z_]+" | sed -E "s/^TI_[A-Z]+='//" | sort -u | tr '\n' ' ')
|
|
204
|
+
[[ "$actual" == "$pinned" ]]
|
|
205
|
+
check "claude hook reads exactly the pinned PreToolUse fields (got: $actual)" 0 $?
|
|
206
|
+
|
|
207
|
+
# 2. A full payload as the harness actually sends it, every documented
|
|
208
|
+
# top-level field present, not the four-key stub the cases above use. Catches
|
|
209
|
+
# a hook that only works on the shape its own tests hand it.
|
|
210
|
+
payload='{"session_id":"abc123","prompt_id":"550e8400-e29b-41d4-a716-446655440000","transcript_path":"/tmp/devos-nonexistent.jsonl","cwd":"/repo","permission_mode":"default","hook_event_name":"PreToolUse","tool_name":"Edit","tool_use_id":"toolu_01ABC","tool_input":{"file_path":"src/main.test.ts","old_string":"expect(a).toBe(1)\nexpect(b).toBe(2)","new_string":"expect(a).toBe(1)"}}'
|
|
211
|
+
printf '%s' "$payload" | bash "$CLAUDE_HOOK" --agent claude test-integrity 2>/dev/null
|
|
212
|
+
check "claude hook: full documented PreToolUse payload still denies" 2 $?
|
|
213
|
+
|
|
214
|
+
# --- false-positive regressions: the gate must not block legitimate work ----
|
|
215
|
+
# The rubric used to set-difference assertion LINES, so any edit that changed
|
|
216
|
+
# the text of a line without removing an assertion was denied: renames,
|
|
217
|
+
# expected-value fixes, and every edit to a file that already had a .skip.
|
|
218
|
+
# 69 tests passed while that was true, because none of them covered it. A gate
|
|
219
|
+
# that blocks legitimate work trains the engineer to bypass it, which is worse
|
|
220
|
+
# than no gate. These pin the counting contract.
|
|
221
|
+
|
|
222
|
+
printf 'const foo = calc(1)\nexpect(foo).toBe(2)\n' > "$old"
|
|
223
|
+
printf 'const result = calc(1)\nexpect(result).toBe(2)\n' > "$new"
|
|
224
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
225
|
+
check "rubric: rename inside an assertion allows" 0 $?
|
|
226
|
+
|
|
227
|
+
printf 'expect(foo).toBe(2)\n' > "$old"
|
|
228
|
+
printf 'expect(foo).toBe(3)\n' > "$new"
|
|
229
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
230
|
+
check "rubric: expected-value fix allows" 0 $?
|
|
231
|
+
|
|
232
|
+
printf 'describe.skip("legacy", () => {})\nexpect(a).toBe(1)\n' > "$old"
|
|
233
|
+
printf 'describe.skip("legacy", () => {})\nexpect(b).toBe(1)\n' > "$new"
|
|
234
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
235
|
+
check "rubric: pre-existing .skip, unrelated edit allows" 0 $?
|
|
236
|
+
|
|
237
|
+
printf 'expect(o.a).toBe(1)\nexpect(o.b).toBe(2)\nexpect(o.c).toBe(3)\n' > "$old"
|
|
238
|
+
printf 'expect(o).toMatchObject({a:1,b:2,c:3})\n' > "$new"
|
|
239
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
240
|
+
check "rubric: genuine consolidation allows" 0 $?
|
|
241
|
+
|
|
242
|
+
# Table-driven consolidation: N copy-pasted `it` blocks collapsed into one
|
|
243
|
+
# it.each table legitimately drops the raw match count (the expect line is
|
|
244
|
+
# now written once, not once per case).
|
|
245
|
+
printf 'it("f(1)", () => { expect(f(1)).toBe(2) })\nit("f(2)", () => { expect(f(2)).toBe(4) })\n' > "$old"
|
|
246
|
+
printf 'it.each([[1,2],[2,4]])("f(%%d)", (a, b) => { expect(f(a)).toBe(b) })\n' > "$new"
|
|
247
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
248
|
+
check "rubric: consolidation into it.each allows" 0 $?
|
|
249
|
+
|
|
250
|
+
# ...but a pre-existing it.each is not a licence to delete a case from it,
|
|
251
|
+
# same rule as pre-existing toMatchObject above.
|
|
252
|
+
printf 'it.each([[1,2]])("f(%%d)", (a, b) => { expect(f(a)).toBe(b) })\nexpect(g()).toBe(3)\n' > "$old"
|
|
253
|
+
printf 'it.each([[1,2]])("f(%%d)", (a, b) => { expect(f(a)).toBe(b) })\n' > "$new"
|
|
254
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
255
|
+
check "rubric: pre-existing it.each does not excuse deletion" 2 $?
|
|
256
|
+
|
|
257
|
+
# ...but consolidation markers already present in the OLD content are not a
|
|
258
|
+
# licence to delete assertions in the new one.
|
|
259
|
+
printf 'expect(o).toMatchObject({a:1})\nexpect(p).toBe(2)\nexpect(q).toBe(3)\n' > "$old"
|
|
260
|
+
printf 'expect(o).toMatchObject({a:1})\n' > "$new"
|
|
261
|
+
bash "$RUBRIC" --file src/main.test.ts --old "$old" --new "$new" 2>/dev/null
|
|
262
|
+
check "rubric: pre-existing toMatchObject does not excuse deletion" 2 $?
|
|
263
|
+
|
|
264
|
+
payload=$(printf '{"tool_input":{"file_path":"src/main.test.ts","old_string":"expect(foo).toBe(2)","new_string":"expect(renamed).toBe(2)"}}')
|
|
265
|
+
echo "$payload" | bash "$CLAUDE_HOOK" --agent claude test-integrity 2>/dev/null
|
|
266
|
+
check "claude hook: Edit renaming inside an assertion allows" 0 $?
|
|
267
|
+
|
|
268
|
+
# --- hooks fail open on their own errors, never on policy -------------------
|
|
269
|
+
# A hook may exit non-zero only for a deliberate policy decision. Its own
|
|
270
|
+
# internal failure (garbage stdin, unreachable rubric, missing transcript)
|
|
271
|
+
# must allow: a broken gate must not brick every edit in the session.
|
|
272
|
+
#
|
|
273
|
+
# Discovered, not enumerated. Listing hooks by name meant a newly added one
|
|
274
|
+
# silently had no fail-open coverage until someone remembered to add it — and
|
|
275
|
+
# the one hook that got it wrong fell THROUGH to blocking on its own
|
|
276
|
+
# arithmetic error and was exactly the one nobody had listed.
|
|
277
|
+
# Every stdin-reading hook under the plugin and the adapters is swept here, so
|
|
278
|
+
# the next one inherits the check for free. The name pattern is deliberately
|
|
279
|
+
# wide (any check-*.sh or *hook*.sh); membership is decided by whether the
|
|
280
|
+
# script reads a payload from stdin, not by what it is called.
|
|
281
|
+
repo_for_hooks="$(cd "$(dirname "$DOD")/../../../.." && pwd)"
|
|
282
|
+
hook_count=0
|
|
283
|
+
while IFS= read -r hook; do
|
|
284
|
+
[[ -f "$hook" ]] || continue
|
|
285
|
+
# Only hooks that read a payload from stdin; check-dod-core.sh and the
|
|
286
|
+
# rubric take argv and are covered by their own cases above.
|
|
287
|
+
grep -q 'input=$(cat' "$hook" || continue
|
|
288
|
+
hook_count=$((hook_count + 1))
|
|
289
|
+
hname=$(basename "$hook")
|
|
290
|
+
for bad_input in 'garbage not json' '' '{}' '{"tool_input":{}}'; do
|
|
291
|
+
printf '%s' "$bad_input" | bash "$hook" >/dev/null 2>&1
|
|
292
|
+
check "$hname: fails open on [${bad_input:-<empty>}]" 0 $?
|
|
293
|
+
done
|
|
294
|
+
done < <(find "$repo_for_hooks/plugins" \
|
|
295
|
+
\( -name '*hook*.sh' -o -name 'check-*.sh' -o -name 'run-gate.sh' \) 2>/dev/null | sort)
|
|
296
|
+
|
|
297
|
+
# The sweep is only meaningful if it actually found hooks. A find that matches
|
|
298
|
+
# nothing would otherwise report a silent pass.
|
|
299
|
+
(( hook_count >= 2 ))
|
|
300
|
+
check "fail-open sweep discovered the hooks (found $hook_count, expect >=2)" 0 $?
|
|
301
|
+
|
|
302
|
+
# An unreachable rubric (moved clone, broken adapter symlink) must allow.
|
|
303
|
+
# The DoD shim always guarded this; the test-integrity shim did not and
|
|
304
|
+
# exited 127 with no decision emitted.
|
|
305
|
+
repo_root="$(cd "$(dirname "$DOD")/../../../.." && pwd)"
|
|
306
|
+
cp "$CLAUDE_HOOK" "$tmp/broken-shim.sh"
|
|
307
|
+
sed -i.bak 's#^GATES=.*#GATES="/nonexistent/gates"#' "$tmp/broken-shim.sh"
|
|
308
|
+
out=$(echo '{"tool_input":{"path":"a.test.js","content":"x"}}' | bash "$tmp/broken-shim.sh" --agent copilot test-integrity 2>/dev/null)
|
|
309
|
+
[[ "$out" == '{"permissionDecision":"allow"}' ]]; check "shim: unreachable rubric allows, emits a decision" 0 $?
|
|
310
|
+
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# --- detect-archetype.py ------------------------------
|
|
2
|
+
# Success criterion 15 named three repos: React/Tailwind/Storybook, Terraform,
|
|
3
|
+
# and a Go CLI that must gain NO frontend sections. The first version detected
|
|
4
|
+
# none of the Terraform signals and none of the @scoped packages, because
|
|
5
|
+
# quoted globs never expand and `p.deps.@storybook/react` is a JS syntax error.
|
|
6
|
+
# Both classes are pinned here so they cannot silently die again.
|
|
7
|
+
ARCH="$(cd "$(dirname "$DOD")/../.." && pwd)/skills/init/scripts/detect-archetype.py"
|
|
8
|
+
af="$tmp/arch"
|
|
9
|
+
|
|
10
|
+
mkdir -p "$af/react/src" "$af/react/.storybook"
|
|
11
|
+
cat > "$af/react/package.json" <<'J'
|
|
12
|
+
{"name":"web","dependencies":{"react":"^19","next":"^15","@radix-ui/react-dialog":"^1","@reduxjs/toolkit":"^2"},
|
|
13
|
+
"devDependencies":{"tailwindcss":"^4","@storybook/react":"^8"}}
|
|
14
|
+
J
|
|
15
|
+
touch "$af/react/src/Button.module.css"
|
|
16
|
+
out=$(python3 "$ARCH" "$af/react")
|
|
17
|
+
for tag in ui:react ui:next design:storybook design:radix style:tailwind style:css-modules state:redux; do
|
|
18
|
+
[[ "$out" == *"\"$tag\""* ]]; check "archetype: React repo detects $tag" 0 $?
|
|
19
|
+
done
|
|
20
|
+
|
|
21
|
+
# Terraform: glob-only detection, entirely dead before 0.8.4.
|
|
22
|
+
mkdir -p "$af/tf/modules/vpc"
|
|
23
|
+
printf 'resource "aws_s3_bucket" "b" {}\n' > "$af/tf/modules/vpc/main.tf"
|
|
24
|
+
out=$(python3 "$ARCH" "$af/tf")
|
|
25
|
+
[[ "$out" == *'"infra:terraform"'* ]]; check "archetype: Terraform repo detects infra:terraform" 0 $?
|
|
26
|
+
|
|
27
|
+
# Go CLI: the zero-cost half of criterion 15. No ui:/design:/style:/state: tag.
|
|
28
|
+
mkdir -p "$af/gocli"
|
|
29
|
+
printf 'module example.com/cli\n\ngo 1.23\n' > "$af/gocli/go.mod"
|
|
30
|
+
printf 'all:\n\tgo build ./...\n' > "$af/gocli/Makefile"
|
|
31
|
+
out=$(python3 "$ARCH" "$af/gocli")
|
|
32
|
+
[[ "$out" == *'"cli:go"'* ]]; check "archetype: Go CLI detects cli:go" 0 $?
|
|
33
|
+
|
|
34
|
+
# The only table row whose glob names a directory is the GitHub Actions one,
|
|
35
|
+
# and the glob reader used `find -name`, which matches a basename: the pattern
|
|
36
|
+
# `.github/workflows/*.y*ml` could not match any repository, so a repo with
|
|
37
|
+
# real workflows was never detected as ci:github-actions.
|
|
38
|
+
mkdir -p "$af/gha/.github/workflows" "$af/gha/elsewhere/workflows"
|
|
39
|
+
printf 'name: ci\n' > "$af/gha/.github/workflows/build.yml"
|
|
40
|
+
out=$(python3 "$ARCH" "$af/gha")
|
|
41
|
+
[[ "$out" == *'"ci:github-actions"'* ]]; check "archetype: a GitHub Actions workflow is detected" 0 $?
|
|
42
|
+
# Widening the match must not turn every workflow-shaped file into the signal.
|
|
43
|
+
printf 'name: ci\n' > "$af/gha/elsewhere/workflows/build.yml"
|
|
44
|
+
out=$(python3 "$ARCH" "$af/gha/elsewhere")
|
|
45
|
+
[[ "$out" != *'"ci:github-actions"'* && "$out" == *'"detected":false'* ]] \
|
|
46
|
+
&& check "archetype: the same file outside .github is not the CI signal" 0 $? \
|
|
47
|
+
|| { echo "FAIL archetype: a workflow outside .github was read as GitHub Actions: $out"; fail=1; }
|
|
48
|
+
mkdir -p "$af/gha-root"
|
|
49
|
+
printf 'name: ci\n' > "$af/gha-root/ci.yml"
|
|
50
|
+
out=$(python3 "$ARCH" "$af/gha-root")
|
|
51
|
+
[[ "$out" != *'"ci:github-actions"'* && "$out" == *'"detected":false'* ]] \
|
|
52
|
+
&& check "archetype: a root-level workflow file is not the CI signal" 0 $? \
|
|
53
|
+
|| { echo "FAIL archetype: a root-level ci.yml was read as GitHub Actions: $out"; fail=1; }
|
|
54
|
+
|
|
55
|
+
# The TABLE reader is `IFS='|' read -r tag kind arg arg2`, so a row with five
|
|
56
|
+
# fields silently folds the fifth into arg2 and the rule tests a filename that
|
|
57
|
+
# cannot exist. One row per library keeps every field count at four.
|
|
58
|
+
for lib in click typer; do
|
|
59
|
+
mkdir -p "$af/py-$lib"
|
|
60
|
+
printf 'dependencies = ["%s"]\n' "$lib" > "$af/py-$lib/pyproject.toml"
|
|
61
|
+
out=$(python3 "$ARCH" "$af/py-$lib")
|
|
62
|
+
[[ "$out" == *'"cli:python"'* ]]; check "archetype: Python $lib CLI detects cli:python" 0 $?
|
|
63
|
+
done
|
|
64
|
+
[[ "$out" != *'"ui:'* && "$out" != *'"design:'* && "$out" != *'"style:'* && "$out" != *'"state:'* ]]
|
|
65
|
+
check "archetype: Go CLI gains no frontend sections" 0 $?
|
|
66
|
+
|
|
67
|
+
mkdir -p "$af/bare"
|
|
68
|
+
out=$(python3 "$ARCH" "$af/bare")
|
|
69
|
+
[[ "$out" == '{"archetypes":[],"detected":false}' ]]; check "archetype: bare dir reports undetected" 0 $?
|
|
70
|
+
|
|
71
|
+
python3 "$ARCH" "$af/no-such-dir" >/dev/null 2>&1
|
|
72
|
+
check "archetype: missing dir exits 1, does not hang" 1 $?
|
|
73
|
+
|
|
74
|
+
# No node on PATH must not change the answer: detection is pure POSIX tools.
|
|
75
|
+
out=$(PATH="/usr/bin:/bin" python3 "$ARCH" "$af/react" 2>/dev/null)
|
|
76
|
+
[[ "$out" == *'"design:storybook"'* ]]; check "archetype: works without node on PATH" 0 $?
|
|
77
|
+
|
|
78
|
+
# --- detect-archetype.py --facts -------------
|
|
79
|
+
# The same stack at two different majors must produce two different fact
|
|
80
|
+
# blocks: that difference is the entire value of the mode, so it is the test.
|
|
81
|
+
# Both bugs pinned below were found by running these fixtures before the
|
|
82
|
+
# roadmap box was ticked, not after.
|
|
83
|
+
mkdir -p "$af/v18/node_modules/react" "$af/v18/node_modules/next"
|
|
84
|
+
cat > "$af/v18/package.json" <<'J'
|
|
85
|
+
{
|
|
86
|
+
"dependencies": { "react": "^18.2.0", "next": "^14.1.0" },
|
|
87
|
+
"devDependencies": { "tailwindcss": "^3.4.1", "storybook": "^8.0.0" },
|
|
88
|
+
"scripts": {
|
|
89
|
+
"dev": "next dev",
|
|
90
|
+
"build": "next build",
|
|
91
|
+
"typecheck": "tsc --noEmit",
|
|
92
|
+
"test:a11y": "axe ./dist"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
J
|
|
96
|
+
echo '{"name":"react","version":"18.3.1"}' > "$af/v18/node_modules/react/package.json"
|
|
97
|
+
echo '{"name":"next","version":"14.2.5"}' > "$af/v18/node_modules/next/package.json"
|
|
98
|
+
out=$(python3 "$ARCH" --facts "$af/v18")
|
|
99
|
+
[[ "$out" == *"| react | 18.3.1 | node_modules (installed) |"* ]]
|
|
100
|
+
check "facts: installed version wins over the declared range" 0 $?
|
|
101
|
+
[[ "$out" == *"| tailwindcss | ^3.4.1 |"* ]]
|
|
102
|
+
check "facts: range read from a one-line object is the right key's value" 0 $?
|
|
103
|
+
[[ "$out" == *"range, NOT resolved"* ]]
|
|
104
|
+
check "facts: an unresolved range is labelled, never passed off as installed" 0 $?
|
|
105
|
+
|
|
106
|
+
# Same stack, next major, nothing installed. Single-line manifest, and a
|
|
107
|
+
# `storybook` script whose value must never be reported as a version.
|
|
108
|
+
mkdir -p "$af/v19"
|
|
109
|
+
cat > "$af/v19/package.json" <<'J'
|
|
110
|
+
{"dependencies":{"react":"^19.0.0","next":"^15.3.0","@mui/material":"^6.1.0"},
|
|
111
|
+
"devDependencies":{"tailwindcss":"^4.0.9"},
|
|
112
|
+
"scripts":{"build":"next build","storybook":"storybook dev"}}
|
|
113
|
+
J
|
|
114
|
+
out19=$(python3 "$ARCH" --facts "$af/v19")
|
|
115
|
+
[[ "$out19" == *"| react | ^19.0.0 |"* && "$out19" == *"| tailwindcss | ^4.0.9 |"* ]]
|
|
116
|
+
check "facts: second major reports its own versions" 0 $?
|
|
117
|
+
[[ "$out19" == *"| @mui/material | ^6.1.0 |"* ]]
|
|
118
|
+
check "facts: a scoped package resolves" 0 $?
|
|
119
|
+
# Assert on the version table alone: `storybook` is a legitimate row in the
|
|
120
|
+
# checks table below it, so a whole-output grep would pass no matter what.
|
|
121
|
+
vtable19=${out19%%Declared checks*}
|
|
122
|
+
[[ "$vtable19" != *"| storybook |"* ]]
|
|
123
|
+
check "facts: a script named like a package is not reported as its version" 0 $?
|
|
124
|
+
[[ "$out" != "$out19" ]]
|
|
125
|
+
check "facts: two majors of one stack produce different blocks" 0 $?
|
|
126
|
+
|
|
127
|
+
# Declared checks: only the keys that prove something, `dev` excluded.
|
|
128
|
+
[[ "$out" == *"npm run typecheck\` | tsc --noEmit |"* && "$out" == *"npm run test:a11y\` | axe ./dist |"* ]]
|
|
129
|
+
check "facts: suffixed check scripts are declared" 0 $?
|
|
130
|
+
[[ "$out" != *"run dev\` | next dev |"* ]]
|
|
131
|
+
check "facts: a server-starting script is not a check" 0 $?
|
|
132
|
+
|
|
133
|
+
# Tier 41: exactly the keys that prove something, no triage. Eight scripts in,
|
|
134
|
+
# six out: `dev` starts a server and `clean` deletes a directory; neither can
|
|
135
|
+
# fail in a way that means the code is wrong.
|
|
136
|
+
mkdir -p "$af/checks"
|
|
137
|
+
cat > "$af/checks/package.json" <<'J'
|
|
138
|
+
{"dependencies":{"react":"^19"},
|
|
139
|
+
"scripts":{"dev":"vite","clean":"rm -rf dist","build":"vite build","lint":"eslint .",
|
|
140
|
+
"typecheck":"tsc --noEmit","test":"vitest run","test:e2e":"playwright test",
|
|
141
|
+
"test:a11y":"axe ./dist"}}
|
|
142
|
+
J
|
|
143
|
+
outc=$(python3 "$ARCH" --facts "$af/checks")
|
|
144
|
+
n=$(printf '%s\n' "$outc" | sed -n '/| Source | Command | Runs |/,$p' | grep -c '^| package.json |')
|
|
145
|
+
[[ "$n" == 6 ]]
|
|
146
|
+
check "checks: six qualifying scripts of eight are declared" 0 $?
|
|
147
|
+
for k in build lint typecheck test test:e2e test:a11y; do
|
|
148
|
+
[[ "$outc" == *"run $k\` |"* ]]; check "checks: $k is declared" 0 $?
|
|
149
|
+
done
|
|
150
|
+
[[ "$outc" != *"run dev\` |"* && "$outc" != *"run clean\` |"* ]]
|
|
151
|
+
check "checks: dev and clean are not proof of anything" 0 $?
|
|
152
|
+
|
|
153
|
+
# The check table decides what the verifier runs, so a name filter narrow
|
|
154
|
+
# enough to drop a functional suite silently decides that suite never runs.
|
|
155
|
+
# The lockfile names the runner: `npm run` on a pnpm repo is a command the
|
|
156
|
+
# project does not use.
|
|
157
|
+
mkdir -p "$af/wide"
|
|
158
|
+
touch "$af/wide/pnpm-lock.yaml"
|
|
159
|
+
cat > "$af/wide/package.json" <<'J'
|
|
160
|
+
{"dependencies":{"react":"^19"},
|
|
161
|
+
"scripts":{"test-func":"node ./scripts/test.mjs func","coverage-unit":"c8 mocha",
|
|
162
|
+
"format:check":"prettier --check .","lint:check":"eslint .",
|
|
163
|
+
"test:watch":"vitest","deploy-prod":"./k8s.mjs deploy"}}
|
|
164
|
+
J
|
|
165
|
+
outw=$(python3 "$ARCH" --facts "$af/wide")
|
|
166
|
+
for k in test-func coverage-unit format:check lint:check; do
|
|
167
|
+
[[ "$outw" == *"pnpm $k\` |"* ]]; check "checks: $k survives the name filter" 0 $?
|
|
168
|
+
done
|
|
169
|
+
[[ "$outw" != *"npm run "* ]]
|
|
170
|
+
check "checks: the lockfile picks the package manager" 0 $?
|
|
171
|
+
[[ "$outw" != *"test:watch"* ]]
|
|
172
|
+
check "checks: a watch script is not a check (it never exits)" 0 $?
|
|
173
|
+
[[ "$outw" != *"deploy-prod"* ]]
|
|
174
|
+
check "checks: an operational script is still excluded" 0 $?
|
|
175
|
+
|
|
176
|
+
# Bun writes bun.lock, the text lockfile that has been its default since
|
|
177
|
+
# v1.2. A repo carrying only that file was reported as npm, and the table is
|
|
178
|
+
# what the verifier runs.
|
|
179
|
+
mkdir -p "$af/bun-text" "$af/bun-binary"
|
|
180
|
+
cat > "$af/bun-text/package.json" <<'J'
|
|
181
|
+
{"scripts":{"test":"bun test","lint":"eslint ."}}
|
|
182
|
+
J
|
|
183
|
+
printf '{}\n' > "$af/bun-text/bun.lock"
|
|
184
|
+
outbt=$(python3 "$ARCH" --facts "$af/bun-text")
|
|
185
|
+
[[ "$outbt" == *'| `bun run test` |'* && "$outbt" != *"npm run"* ]]
|
|
186
|
+
check "checks: the bun text lockfile picks bun run" 0 $?
|
|
187
|
+
cp "$af/bun-text/package.json" "$af/bun-binary/package.json"
|
|
188
|
+
printf 'binary\n' > "$af/bun-binary/bun.lockb"
|
|
189
|
+
outbb=$(python3 "$ARCH" --facts "$af/bun-binary")
|
|
190
|
+
[[ "$outbb" == *'| `bun run test` |'* ]]
|
|
191
|
+
check "checks: the legacy bun binary lockfile still picks bun run" 0 $?
|
|
192
|
+
|
|
193
|
+
# A task runner is a manifest too. Reading package.json alone reported "no
|
|
194
|
+
# declared checks" for every Make/just project, DevOS's own repo included.
|
|
195
|
+
mkdir -p "$af/runner"
|
|
196
|
+
cat > "$af/runner/justfile" <<'J'
|
|
197
|
+
PLUGIN_JSONS := "a b"
|
|
198
|
+
|
|
199
|
+
default:
|
|
200
|
+
@just --list
|
|
201
|
+
|
|
202
|
+
verify:
|
|
203
|
+
./run-checks.sh
|
|
204
|
+
|
|
205
|
+
lint target="all":
|
|
206
|
+
eslint {{target}}
|
|
207
|
+
|
|
208
|
+
deploy:
|
|
209
|
+
./ship.sh
|
|
210
|
+
J
|
|
211
|
+
outr=$(python3 "$ARCH" --facts "$af/runner")
|
|
212
|
+
[[ "$outr" == *'`just verify`'* && "$outr" == *'`just lint`'* ]]
|
|
213
|
+
check "checks: justfile recipes are declared checks" 0 $?
|
|
214
|
+
[[ "$outr" != *"just deploy"* && "$outr" != *"just default"* && "$outr" != *"PLUGIN_JSONS"* ]]
|
|
215
|
+
check "checks: recipes that prove nothing, and assignments, stay out" 0 $?
|
|
216
|
+
|
|
217
|
+
mkdir -p "$af/mk"
|
|
218
|
+
printf '.PHONY: test\ntest:\n\tgo test ./...\n\nrelease:\n\t./ship.sh\n' > "$af/mk/Makefile"
|
|
219
|
+
outm=$(python3 "$ARCH" --facts "$af/mk")
|
|
220
|
+
[[ "$outm" == *'`make test`'* && "$outm" != *"make release"* ]]
|
|
221
|
+
check "checks: Makefile targets are declared checks" 0 $?
|
|
222
|
+
|
|
223
|
+
# Where a command runs is part of the command: a suite that only passes inside
|
|
224
|
+
# the app container fails on the host for reasons the diff did not cause.
|
|
225
|
+
mkdir -p "$af/ctx"
|
|
226
|
+
printf 'services:\n app:\n build: .\n redis:\n image: redis\nvolumes:\n data:\n' > "$af/ctx/docker-compose.yml"
|
|
227
|
+
outx=$(python3 "$ARCH" --facts "$af/ctx")
|
|
228
|
+
[[ "$outx" == *"Execution context:"* && "$outx" == *"app, redis"* ]]
|
|
229
|
+
check "checks: compose services are reported as the execution context" 0 $?
|
|
230
|
+
[[ "$outx" != *"app, redis, data"* ]]
|
|
231
|
+
check "checks: a sibling top-level key is not read as a service" 0 $?
|
|
232
|
+
[[ "$(python3 "$ARCH" --facts "$af/mk")" != *"Execution context:"* ]]
|
|
233
|
+
check "checks: no compose file means no context line" 0 $?
|
|
234
|
+
|
|
235
|
+
# Tier 42: the same `dev` script that cannot be a check is exactly what a
|
|
236
|
+
# browser needs, so it surfaces as a preview candidate instead of vanishing.
|
|
237
|
+
[[ "$outc" == *'Preview candidates: `dev` (`vite`)'* ]]
|
|
238
|
+
check "preview: the dev script surfaces as a preview candidate" 0 $?
|
|
239
|
+
out=$(python3 "$ARCH" --facts "$af/gocli")
|
|
240
|
+
[[ "$out" == *"Preview candidates: none found"* ]]
|
|
241
|
+
check "preview: a repo with nothing to serve says so" 0 $?
|
|
242
|
+
|
|
243
|
+
# Non-JS and empty repos degrade to an honest answer, never a guessed one.
|
|
244
|
+
out=$(python3 "$ARCH" --facts "$af/gocli")
|
|
245
|
+
[[ "$out" == *"| go (toolchain) | 1.23 | go.mod |"* ]]
|
|
246
|
+
check "facts: go toolchain pin is read" 0 $?
|
|
247
|
+
out=$(python3 "$ARCH" --facts "$af/bare")
|
|
248
|
+
[[ "$out" == *"No resolvable versions found"* ]]
|
|
249
|
+
check "facts: bare dir says so instead of inventing versions" 0 $?
|
|
250
|
+
|
|
251
|
+
# The default mode is untouched: every existing caller still gets JSON.
|
|
252
|
+
out=$(python3 "$ARCH" "$af/v18")
|
|
253
|
+
[[ "$out" == '{"archetypes":['* ]]
|
|
254
|
+
check "facts: default mode still prints JSON" 0 $?
|
|
255
|
+
|