@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,183 @@
|
|
|
1
|
+
# --- validate-spec.sh -------------------------------------------------------
|
|
2
|
+
|
|
3
|
+
good="$tmp/devos/specs/2026-01-01-good"
|
|
4
|
+
mkdir -p "$good"
|
|
5
|
+
cat > "$good/spec.md" <<'MD'
|
|
6
|
+
# Good Feature
|
|
7
|
+
## 1. Goal
|
|
8
|
+
Users MUST be able to export their data.
|
|
9
|
+
## 3. Functionality
|
|
10
|
+
**Scenarios:**
|
|
11
|
+
- Scenario SC-1: happy export / WHEN the user clicks export THEN a CSV downloads
|
|
12
|
+
## 5. Out of Scope
|
|
13
|
+
- PDF export
|
|
14
|
+
MD
|
|
15
|
+
bash "$VSPEC" "$good" >/dev/null; check "vspec: well-formed spec passes" 0 $?
|
|
16
|
+
|
|
17
|
+
one="$tmp/devos/specs/2026-01-02-one-file"
|
|
18
|
+
mkdir -p "$one"
|
|
19
|
+
cat > "$one/spec.md" <<'MD'
|
|
20
|
+
# One file
|
|
21
|
+
## Goal
|
|
22
|
+
Users MUST be able to export their data.
|
|
23
|
+
## Scenarios
|
|
24
|
+
- Scenario SC-1: happy export / WHEN the user clicks export THEN a CSV downloads
|
|
25
|
+
- Scenario SC-2: empty / WHEN there is no data THEN the CSV has only a header
|
|
26
|
+
## Out of scope
|
|
27
|
+
- PDF export
|
|
28
|
+
## Technical requirements
|
|
29
|
+
The handler should stream rows.
|
|
30
|
+
MD
|
|
31
|
+
bash "$VSPEC" "$one" >/dev/null; check "vspec: contract-only spec.md passes before a plan" 0 $?
|
|
32
|
+
bash "$(dirname "$VSPEC")/../../../scripts/gates/spec-contract.sh" --has-plan "$one"; check "contract: no plan heading means no plan" 1 $?
|
|
33
|
+
cat >> "$one/spec.md" <<'MD'
|
|
34
|
+
## Local Craft
|
|
35
|
+
None
|
|
36
|
+
## Design Convergence
|
|
37
|
+
- **Direct MVP**: one handler
|
|
38
|
+
- **Failed Items**: None
|
|
39
|
+
- **Adopted Additions**: None
|
|
40
|
+
- **Rejected Additions**: None
|
|
41
|
+
## Implementation Plan
|
|
42
|
+
### Overview
|
|
43
|
+
Total: 1 task groups.
|
|
44
|
+
### Task Group 1: Export
|
|
45
|
+
**Files:** `src/export.ts`
|
|
46
|
+
**Scenarios covered:** SC-1
|
|
47
|
+
MD
|
|
48
|
+
out=$(bash "$VSPEC" "$one" 2>&1); rc=$?
|
|
49
|
+
grep -q "scenario SC-2 is declared but covered nowhere" <<<"$out" && [[ $rc -eq 1 ]] \
|
|
50
|
+
&& check "vspec: spec.md plan must cover every scenario it declares" 0 $? || { echo "FAIL vspec: spec.md scenario coverage not caught"; fail=1; }
|
|
51
|
+
sed -i.bak 's/SC-1$/SC-1, SC-2/' "$one/spec.md"; rm -f "$one/spec.md.bak"
|
|
52
|
+
bash "$VSPEC" "$one" >/dev/null; check "vspec: one-file spec with plan passes" 0 $?
|
|
53
|
+
|
|
54
|
+
historical="$tmp/devos/specs/archive/2026-01-01-historical"
|
|
55
|
+
mkdir -p "$historical"
|
|
56
|
+
cp "$good/spec.md" "$historical/spec.md"
|
|
57
|
+
printf '## Goal\nx\n## Scenarios\n- Scenario SC-1: a / WHEN a THEN b\n## Out of scope\n- y\n' > "$historical/spec.md"
|
|
58
|
+
bash "$VSPEC" "$historical" >/dev/null; check "vspec: archived plan skips current plan gates" 0 $?
|
|
59
|
+
|
|
60
|
+
bad="$tmp/devos/specs/2026-01-01-bad"
|
|
61
|
+
mkdir -p "$bad"
|
|
62
|
+
printf '# Bad\n## Goal\nx\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
63
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: no scenarios fails" 1 $?
|
|
64
|
+
|
|
65
|
+
printf '# Bad\n## Goal\nx\n- Scenario SC-1: broken, no when-then\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
66
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: malformed scenario fails" 1 $?
|
|
67
|
+
|
|
68
|
+
# SC-n IDs form the internal plan index. Source tests use behavior-facing
|
|
69
|
+
# names, and the output-boundary gate keeps the IDs out of implementation files.
|
|
70
|
+
printf '# Bad\n## Goal\nx\n- Scenario: unnumbered / WHEN a THEN b\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
71
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: scenario without SC-n ID fails" 1 $?
|
|
72
|
+
|
|
73
|
+
printf '# Bad\n## Goal\nx\n- Scenario SC-1: a / WHEN a THEN b\n- Scenario SC-1: b / WHEN c THEN d\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
74
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: duplicate SC-n IDs fail" 1 $?
|
|
75
|
+
|
|
76
|
+
printf '# Bad\n## Goal\nx\n- Scenario SC-1: a / WHEN a THEN b\n- Scenario SC-2: b / WHEN c THEN d\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
77
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: sequential SC-n IDs pass" 0 $?
|
|
78
|
+
|
|
79
|
+
cp "$good/spec.md" "$bad/spec.md"
|
|
80
|
+
seq 1 301 | sed 's/^/line /' > "$bad/spec.md"
|
|
81
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: oversized capsule fails" 1 $?
|
|
82
|
+
|
|
83
|
+
bash "$VSPEC" "$tmp/devos/specs/absent" >/dev/null 2>&1; check "vspec: missing folder exits 2" 2 $?
|
|
84
|
+
|
|
85
|
+
# Scenario traceability across artifacts: the plan's prose rule (every SC-n
|
|
86
|
+
# covered somewhere, every citation real) as a gate. Both directions matter:
|
|
87
|
+
# an uncovered scenario is a planning gap; a ghost citation verifies nothing.
|
|
88
|
+
mkdir -p "$bad"
|
|
89
|
+
cat > "$bad/spec.md" <<'MD'
|
|
90
|
+
## Goal
|
|
91
|
+
x
|
|
92
|
+
## Scenarios
|
|
93
|
+
- Scenario SC-1: a / WHEN a THEN b
|
|
94
|
+
## Out of scope
|
|
95
|
+
- y
|
|
96
|
+
## Local Craft
|
|
97
|
+
None
|
|
98
|
+
## Design Convergence
|
|
99
|
+
- **Direct MVP**: call it directly
|
|
100
|
+
## Implementation Plan
|
|
101
|
+
### Task Group 1
|
|
102
|
+
**Files:** `a.ts`
|
|
103
|
+
**Scenarios covered:** SC-1
|
|
104
|
+
MD
|
|
105
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: fully covered scenarios pass" 0 $?
|
|
106
|
+
|
|
107
|
+
cat > "$bad/spec.md" <<'MD'
|
|
108
|
+
## Goal
|
|
109
|
+
x
|
|
110
|
+
## Scenarios
|
|
111
|
+
- Scenario SC-1: a / WHEN a THEN b
|
|
112
|
+
## Out of scope
|
|
113
|
+
- y
|
|
114
|
+
## Implementation Plan
|
|
115
|
+
### Task Group 1
|
|
116
|
+
**Scenarios covered:** none
|
|
117
|
+
MD
|
|
118
|
+
out=$(bash "$VSPEC" "$bad" 2>&1); echo "$out" | grep -q "SC-1 is declared but covered nowhere" && check "vspec: uncovered scenario fails with the gap named" 0 $? || { echo "FAIL vspec: uncovered scenario not caught"; fail=1; }
|
|
119
|
+
|
|
120
|
+
cat > "$bad/spec.md" <<'MD'
|
|
121
|
+
## Goal
|
|
122
|
+
x
|
|
123
|
+
## Scenarios
|
|
124
|
+
- Scenario SC-1: a / WHEN a THEN b
|
|
125
|
+
## Out of scope
|
|
126
|
+
- y
|
|
127
|
+
## Implementation Plan
|
|
128
|
+
### Task Group 1
|
|
129
|
+
**Scenarios covered:** SC-9
|
|
130
|
+
MD
|
|
131
|
+
out=$(bash "$VSPEC" "$bad" 2>&1); rc=$?
|
|
132
|
+
grep -q "cites SC-9 which spec.md does not declare" <<<"$out" && [[ $rc -eq 1 ]] \
|
|
133
|
+
&& check "vspec: ghost citation fails" 0 $? || { echo "FAIL vspec: ghost citation not caught"; fail=1; }
|
|
134
|
+
|
|
135
|
+
# C route exemption: Invariant specs declare no scenarios, so nothing to trace
|
|
136
|
+
printf '# C\n## Goal\nx\n## Invariant\n`./run` -> exit 0\n**Surface:** none, internal only\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
137
|
+
cat >> "$bad/spec.md" <<'MD'
|
|
138
|
+
## Local Craft
|
|
139
|
+
None
|
|
140
|
+
## Design Convergence
|
|
141
|
+
- **Direct MVP**: call it directly
|
|
142
|
+
## Implementation Plan
|
|
143
|
+
### Task Group 1
|
|
144
|
+
**Files:** `a.ts`
|
|
145
|
+
MD
|
|
146
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: C route exempt from scenario tracing" 0 $?
|
|
147
|
+
|
|
148
|
+
# The oversized capsule above is still on disk and would fail every spec here
|
|
149
|
+
# for the wrong reason. These cases are about spec.md alone.
|
|
150
|
+
rm -f "$bad/spec.md"
|
|
151
|
+
|
|
152
|
+
# Normative wording. These moved out of write-spec.md's self-check, where they
|
|
153
|
+
# were prose asking the writer to grade itself. The negative cases matter most:
|
|
154
|
+
# an over-eager matcher that flags "shoulder" or a deliberately deferred item
|
|
155
|
+
# would make the gate unusable, and the word-boundary bug it guards against
|
|
156
|
+
# (gawk's \y, silent on darwin's awk) passes every positive test by matching
|
|
157
|
+
# nothing at all.
|
|
158
|
+
printf '# H\n## Goal\nx\n## 3. Functionality\n- The export should include archived rows\n- Scenario SC-1: s / WHEN a THEN b\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
159
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: hedge word in a requirement fails" 1 $?
|
|
160
|
+
|
|
161
|
+
printf '# H\n## Goal\nx\n## 3. Functionality\n- Scenario SC-1: s / WHEN a THEN it may download\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
162
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: hedge word inside a scenario fails" 1 $?
|
|
163
|
+
|
|
164
|
+
printf '# H\n## Goal\nx\n## 3. Functionality\n- The shoulder strap MUST be listed\n- Scenario SC-1: s / WHEN a THEN b\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
165
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: hedge substring in a word does not fail" 0 $?
|
|
166
|
+
|
|
167
|
+
printf '# H\n## Goal\nx\n## 3. Functionality\n- Scenario SC-1: s / WHEN a THEN b\n## Out of Scope\n- PDF export, may come later\n' > "$bad/spec.md"
|
|
168
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: hedge in Out of Scope is allowed" 0 $?
|
|
169
|
+
|
|
170
|
+
printf '# H\n## Goal\nx\n## 3. Functionality\n- Scenario SC-1: s / WHEN a THEN b\n## Behavior delta\n**Modified:** "users should wait" -> instant\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
171
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: hedge in a quoted Behavior delta is allowed" 0 $?
|
|
172
|
+
|
|
173
|
+
# A functional spec describes behavior; a fence is implementation leaking in.
|
|
174
|
+
printf '# C\n## Goal\nx\n## 3. Functionality\n- Scenario SC-1: s / WHEN a THEN b\n```ts\ninterface X {}\n```\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
175
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: code block in a functional spec fails" 1 $?
|
|
176
|
+
|
|
177
|
+
printf '# D\n## Goal\nx\n- Scenario SC-1: s / WHEN a THEN b\n## Behavior delta\n**Removed:** old login flow\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
178
|
+
rm -f "$bad/spec.md"
|
|
179
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: removal without reason fails" 1 $?
|
|
180
|
+
|
|
181
|
+
printf '# D\n## Goal\nx\n- Scenario SC-1: s / WHEN a THEN b\n## Behavior delta\n**Removed:** (none)\n## Out of Scope\n- y\n' > "$bad/spec.md"
|
|
182
|
+
bash "$VSPEC" "$bad" >/dev/null; check "vspec: empty removed marker passes" 0 $?
|
|
183
|
+
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
# --- check-requires.py ----------------------------------------
|
|
2
|
+
CREQ="$(cd "$(dirname "$DOD")/../.." && pwd)/skills/status/scripts/check-requires.py"
|
|
3
|
+
SDIFF="$(cd "$(dirname "$DOD")/../.." && pwd)/skills/status/scripts/spec-diff.sh"
|
|
4
|
+
|
|
5
|
+
# A comparison name is one directory name, not a path expression. Without
|
|
6
|
+
# this boundary, ../ can resolve a sibling directory and make status compare
|
|
7
|
+
# an artifact outside devos/specs.
|
|
8
|
+
escape_root="$tmp/spec-diff-escape"
|
|
9
|
+
mkdir -p "$escape_root/devos/specs" "$tmp/spec-diff-outside"
|
|
10
|
+
printf '# Outside plan\n' > "$tmp/spec-diff-outside/spec.md"
|
|
11
|
+
out=$(bash "$SDIFF" '../../../spec-diff-outside' '../../../spec-diff-outside' "$escape_root" 2>&1); rc=$?
|
|
12
|
+
grep -q "spec names must be single directory names without path separators" <<<"$out" \
|
|
13
|
+
&& [[ $rc -eq 2 ]] \
|
|
14
|
+
&& check "spec-diff: traversal spec names are rejected" 0 $? \
|
|
15
|
+
|| { echo "FAIL spec-diff: traversal spec name was not rejected"; echo "$out"; fail=1; }
|
|
16
|
+
|
|
17
|
+
# A same-named active folder is not interchangeable with an archived record.
|
|
18
|
+
# If the active plan is missing, comparing the historical plan silently hides
|
|
19
|
+
# the active artifact failure and reports a clean self-comparison instead.
|
|
20
|
+
sdf="$tmp/spec-diff-resolution/devos/specs"
|
|
21
|
+
mkdir -p "$sdf/active-only" "$sdf/archive/active-only"
|
|
22
|
+
printf '# Archived plan\n## Implementation Plan\n### Task Group 1: archived\n' \
|
|
23
|
+
> "$sdf/archive/active-only/spec.md"
|
|
24
|
+
out=$(bash "$SDIFF" active-only active-only "$tmp/spec-diff-resolution" 2>&1); rc=$?
|
|
25
|
+
grep -q "active spec 'active-only' exists but its spec.md is missing" <<<"$out" \
|
|
26
|
+
&& [[ $rc -eq 1 ]] \
|
|
27
|
+
&& check "spec-diff: an active folder without spec.md does not fall back to archive" 0 $? \
|
|
28
|
+
|| { echo "FAIL spec-diff: active missing-plan fallback not caught"; echo "$out"; fail=1; }
|
|
29
|
+
|
|
30
|
+
# The normal archived lookup remains available when no active folder exists.
|
|
31
|
+
mkdir -p "$sdf/archive/archive-only"
|
|
32
|
+
printf '# Archived plan\n## Implementation Plan\n### Task Group 1: archived\n' \
|
|
33
|
+
> "$sdf/archive/archive-only/spec.md"
|
|
34
|
+
bash "$SDIFF" archive-only archive-only "$tmp/spec-diff-resolution" >/dev/null
|
|
35
|
+
check "spec-diff: an archive-only spec still resolves" 0 $?
|
|
36
|
+
|
|
37
|
+
# When both records exist and both are complete, the active plan is the one
|
|
38
|
+
# being worked on and must win over the historical copy.
|
|
39
|
+
printf '# Active plan\n## Implementation Plan\n### Task Group 1: active\n' \
|
|
40
|
+
> "$sdf/active-only/spec.md"
|
|
41
|
+
out=$(bash "$SDIFF" active-only archive-only "$tmp/spec-diff-resolution" 2>&1)
|
|
42
|
+
grep -q "Task groups differ" <<<"$out" \
|
|
43
|
+
&& check "spec-diff: a complete active plan wins over an archived namesake" 0 $? \
|
|
44
|
+
|| { echo "FAIL spec-diff: active plan did not win over archive"; echo "$out"; fail=1; }
|
|
45
|
+
|
|
46
|
+
# Every other plan reader (validate-spec, check-converge,
|
|
47
|
+
# sizing-calibration) accepts any run of spaces around
|
|
48
|
+
# the words in a group header. spec-diff read the literal '### Task Group', so
|
|
49
|
+
# a plan written '### Task Group 2: gamma' had no groups at all and the
|
|
50
|
+
# comparison called two different plans identical.
|
|
51
|
+
sdg="$tmp/spec-diff-groups/devos/specs"
|
|
52
|
+
mkdir -p "$sdg/wide" "$sdg/loose"
|
|
53
|
+
printf '# Wide\n## Implementation Plan\n### Task Group 1: alpha\n### Task Group 2: beta\n' \
|
|
54
|
+
> "$sdg/wide/spec.md"
|
|
55
|
+
printf '# Loose\n## Implementation Plan\n### Task Group 1: alpha\n### Task Group 2: gamma\n' \
|
|
56
|
+
> "$sdg/loose/spec.md"
|
|
57
|
+
out=$(bash "$SDIFF" wide loose "$tmp/spec-diff-groups" 2>&1)
|
|
58
|
+
grep -qx "Task groups differ:" <<<"$out" \
|
|
59
|
+
&& grep -q "Task Group 2: gamma" <<<"$out" \
|
|
60
|
+
&& check "spec-diff: a group header with extra spacing is still compared" 0 $? \
|
|
61
|
+
|| { echo "FAIL spec-diff: extra spacing hid a group from the comparison"; echo "$out"; fail=1; }
|
|
62
|
+
|
|
63
|
+
# The other direction: widening the pattern must not promote a fourth-level
|
|
64
|
+
# heading to a task group, or any deeply nested note named like a group would
|
|
65
|
+
# start showing up in the structural diff.
|
|
66
|
+
sdg4="$tmp/spec-diff-level/devos/specs"
|
|
67
|
+
mkdir -p "$sdg4/deep" "$sdg4/single"
|
|
68
|
+
printf '# Deep\n## Implementation Plan\n#### Task Group 1: alpha\n### Task Group 2: beta\n' \
|
|
69
|
+
> "$sdg4/deep/spec.md"
|
|
70
|
+
printf '# Single\n## Implementation Plan\n### Task Group 2: beta\n' > "$sdg4/single/spec.md"
|
|
71
|
+
out=$(bash "$SDIFF" deep single "$tmp/spec-diff-level" 2>&1)
|
|
72
|
+
grep -qx "Task groups are identical." <<<"$out" \
|
|
73
|
+
&& check "spec-diff: a fourth-level heading is not counted as a task group" 0 $? \
|
|
74
|
+
|| { echo "FAIL spec-diff: a fourth-level heading was read as a task group"; echo "$out"; fail=1; }
|
|
75
|
+
|
|
76
|
+
# The colon separator is the other half of the same heading. check-converge
|
|
77
|
+
# reads it and the plan gates read it, so a plan written '### Task Group: alpha'
|
|
78
|
+
# had no groups here: both sides of the comparison came out empty and two plans
|
|
79
|
+
# with different groups were reported identical.
|
|
80
|
+
sdgc="$tmp/spec-diff-colon/devos/specs"
|
|
81
|
+
mkdir -p "$sdgc/colon-a" "$sdgc/colon-b" "$sdgc/numbered-a" "$sdgc/numbered-b"
|
|
82
|
+
printf '# Colon A\n## Implementation Plan\n### Task Group: alpha\n' > "$sdgc/colon-a/spec.md"
|
|
83
|
+
printf '# Colon B\n## Implementation Plan\n### Task Group: beta\n' > "$sdgc/colon-b/spec.md"
|
|
84
|
+
out=$(bash "$SDIFF" colon-a colon-b "$tmp/spec-diff-colon" 2>&1)
|
|
85
|
+
grep -qx "Task groups differ:" <<<"$out" \
|
|
86
|
+
&& grep -q "Task Group: beta" <<<"$out" \
|
|
87
|
+
&& check "spec-diff: a colon-form group header is still compared" 0 $? \
|
|
88
|
+
|| { echo "FAIL spec-diff: a colon-form group header was hidden from the comparison"; echo "$out"; fail=1; }
|
|
89
|
+
# The same two plans written in the numbered form have to keep reporting the
|
|
90
|
+
# same difference, so the fix cannot be a pattern that simply matches more.
|
|
91
|
+
printf '# Numbered A\n## Implementation Plan\n### Task Group 1: alpha\n' > "$sdgc/numbered-a/spec.md"
|
|
92
|
+
printf '# Numbered B\n## Implementation Plan\n### Task Group 2: beta\n' > "$sdgc/numbered-b/spec.md"
|
|
93
|
+
out=$(bash "$SDIFF" numbered-a numbered-b "$tmp/spec-diff-colon" 2>&1)
|
|
94
|
+
grep -qx "Task groups differ:" <<<"$out" \
|
|
95
|
+
&& grep -q "Task Group 2: beta" <<<"$out" \
|
|
96
|
+
&& check "spec-diff: a numbered group header still reports the same difference" 0 $? \
|
|
97
|
+
|| { echo "FAIL spec-diff: numbered group comparison changed"; echo "$out"; fail=1; }
|
|
98
|
+
# A heading that only starts like a group is still not one.
|
|
99
|
+
printf '# Deep colon\n## Implementation Plan\n#### Task Group: alpha\n### Task Group: beta\n' \
|
|
100
|
+
> "$sdgc/colon-a/spec.md"
|
|
101
|
+
out=$(bash "$SDIFF" colon-a colon-b "$tmp/spec-diff-colon" 2>&1)
|
|
102
|
+
grep -qx "Task groups are identical." <<<"$out" \
|
|
103
|
+
&& check "spec-diff: a fourth-level colon-form heading is not a task group" 0 $? \
|
|
104
|
+
|| { echo "FAIL spec-diff: a fourth-level colon-form heading was read as a task group"; echo "$out"; fail=1; }
|
|
105
|
+
|
|
106
|
+
reqfix="$tmp/reqproj"
|
|
107
|
+
mkdir -p "$reqfix/devos/specs/archive/2026-01-01-auth"
|
|
108
|
+
mkdir -p "$reqfix/devos/specs/2026-01-02-export"
|
|
109
|
+
mkdir -p "$reqfix/devos/specs/2026-01-03-billing"
|
|
110
|
+
mkdir -p "$reqfix/devos/specs/2026-01-04-broken"
|
|
111
|
+
mkdir -p "$reqfix/devos/specs/2026-01-05-a"
|
|
112
|
+
mkdir -p "$reqfix/devos/specs/2026-01-06-b"
|
|
113
|
+
printf '# Auth\n' > "$reqfix/devos/specs/archive/2026-01-01-auth/spec.md"
|
|
114
|
+
printf '# Export\nRequires: [2026-01-01-auth]\n' > "$reqfix/devos/specs/2026-01-02-export/spec.md"
|
|
115
|
+
printf '# Billing\nRequires: [export]\n' > "$reqfix/devos/specs/2026-01-03-billing/spec.md"
|
|
116
|
+
printf '# Broken\nRequires: [ghost-spec]\n' > "$reqfix/devos/specs/2026-01-04-broken/spec.md"
|
|
117
|
+
printf '# A\nRequires: [2026-01-06-b]\n' > "$reqfix/devos/specs/2026-01-05-a/spec.md"
|
|
118
|
+
printf '# B\nRequires: [2026-01-05-a]\n' > "$reqfix/devos/specs/2026-01-06-b/spec.md"
|
|
119
|
+
mkdir -p "$reqfix/devos/specs/2026-01-07-c" "$reqfix/devos/specs/2026-01-08-d"
|
|
120
|
+
printf '# C\nRequires: [2026-01-08-d]\n' > "$reqfix/devos/specs/2026-01-07-c/spec.md"
|
|
121
|
+
printf '# D\nRequires: [2026-01-07-c]\n' > "$reqfix/devos/specs/2026-01-08-d/spec.md"
|
|
122
|
+
|
|
123
|
+
out=$(python3 "$CREQ" "$reqfix")
|
|
124
|
+
[[ "$out" == *"2026-01-03-billing blocked-by: 2026-01-02-export"* ]]
|
|
125
|
+
check "creq: unmet dep shows blocked-by (suffix resolve)" 0 $?
|
|
126
|
+
[[ "$out" == *"2026-01-02-export blocks: 2026-01-03-billing"* ]]
|
|
127
|
+
check "creq: reverse blocks: annotation" 0 $?
|
|
128
|
+
echo "$out" | grep -E '^2026-01-02-export ' | grep -qv 'blocked-by'
|
|
129
|
+
check "creq: archived dep does not block" 0 $?
|
|
130
|
+
|
|
131
|
+
shadow="$tmp/active-archive-shadow"
|
|
132
|
+
mkdir -p "$shadow/devos/specs/a" "$shadow/devos/specs/archive/a" "$shadow/devos/specs/b"
|
|
133
|
+
printf '# A active\n' > "$shadow/devos/specs/a/spec.md"
|
|
134
|
+
printf '# A archived\n' > "$shadow/devos/specs/archive/a/spec.md"
|
|
135
|
+
printf '# B\nRequires: [a]\n' > "$shadow/devos/specs/b/spec.md"
|
|
136
|
+
out=$(python3 "$CREQ" "$shadow")
|
|
137
|
+
grep -Fqx 'b blocked-by: a' <<<"$out"; check "creq: active namesake shadows archived dependency" 0 $?
|
|
138
|
+
out=$(python3 "$CREQ" "$reqfix")
|
|
139
|
+
|
|
140
|
+
[[ "$out" == *"BROKEN"*"ghost-spec"* ]]
|
|
141
|
+
check "creq: unknown target is BROKEN" 0 $?
|
|
142
|
+
[[ "$out" == *"CYCLE"*"2026-01-05-a"*"2026-01-06-b"* ]]
|
|
143
|
+
check "creq: cycle detected" 0 $?
|
|
144
|
+
|
|
145
|
+
fout=$(python3 "$CREQ" --spec 2026-01-05-a "$reqfix")
|
|
146
|
+
grep -Fqx '2026-01-05-a blocked-by: 2026-01-06-b blocks: 2026-01-06-b' <<<"$fout" \
|
|
147
|
+
&& grep -Fqx 'CYCLE 2026-01-05-a -> 2026-01-06-b -> 2026-01-05-a' <<<"$fout" \
|
|
148
|
+
&& check "creq: --spec reports status and a cycle through another spec" 0 $? \
|
|
149
|
+
|| { echo "FAIL creq: --spec omitted its cross-spec cycle"; echo "$fout"; fail=1; }
|
|
150
|
+
[[ "$fout" != *"2026-01-07-c"* ]]
|
|
151
|
+
check "creq: --spec omits unrelated cycle nodes" 0 $?
|
|
152
|
+
|
|
153
|
+
# A short suffix matching two specs resolves to neither, and reporting that as
|
|
154
|
+
# a missing folder sends the reader looking for a typo instead of at the name
|
|
155
|
+
# they have to spell out. The candidates are the whole diagnosis.
|
|
156
|
+
amb="$tmp/req-ambiguous"
|
|
157
|
+
mkdir -p "$amb/devos/specs/archive/2026-01-01-a-export" \
|
|
158
|
+
"$amb/devos/specs/archive/2026-01-02-b-export" \
|
|
159
|
+
"$amb/devos/specs/2026-01-03-billing"
|
|
160
|
+
printf '# Billing\nRequires: [export]\n' \
|
|
161
|
+
> "$amb/devos/specs/2026-01-03-billing/spec.md"
|
|
162
|
+
aout=$(python3 "$CREQ" --spec 2026-01-03-billing "$amb" 2>&1)
|
|
163
|
+
grep -Fq 'AMBIGUOUS' <<<"$aout" && grep -Fq '2026-01-01-a-export' <<<"$aout" \
|
|
164
|
+
&& grep -Fq '2026-01-02-b-export' <<<"$aout" \
|
|
165
|
+
&& check "creq: an ambiguous short suffix names every candidate" 0 $? \
|
|
166
|
+
|| { echo "FAIL creq: ambiguous suffix not diagnosed"; echo "$aout"; fail=1; }
|
|
167
|
+
! grep -Fq 'no folder under specs/ or archive/' <<<"$aout"
|
|
168
|
+
check "creq: an ambiguous suffix is not reported as a missing folder" 0 $?
|
|
169
|
+
dout=$(python3 "$CREQ" --doctor "$amb" 2>&1)
|
|
170
|
+
grep -Fq 'AMBIGUOUS Requires: export in 2026-01-03-billing' <<<"$dout" \
|
|
171
|
+
&& check "creq: doctor reports the ambiguous suffix with its candidates" 0 $? \
|
|
172
|
+
|| { echo "FAIL creq: doctor did not report the ambiguous suffix"; echo "$dout"; fail=1; }
|
|
173
|
+
vamb=$(python3 "$CREQ" --verify "$amb/devos/specs/2026-01-03-billing" "$amb" 2>&1)
|
|
174
|
+
grep -Fq 'AMBIGUOUS short suffix' <<<"$vamb" \
|
|
175
|
+
&& grep -Fq '2026-01-01-a-export' <<<"$vamb" \
|
|
176
|
+
&& grep -Fq '2026-01-02-b-export' <<<"$vamb" \
|
|
177
|
+
&& ! grep -Fq 'unknown target' <<<"$vamb" \
|
|
178
|
+
&& check "creq: verify preserves the ambiguous classification and candidates" 0 $? \
|
|
179
|
+
|| { echo "FAIL creq: verify misdiagnosed an ambiguous suffix"; echo "$vamb"; fail=1; }
|
|
180
|
+
printf '# Billing\nRequires: [ghost]\n' > "$amb/devos/specs/2026-01-03-billing/spec.md"
|
|
181
|
+
gout=$(python3 "$CREQ" --spec 2026-01-03-billing "$amb" 2>&1)
|
|
182
|
+
grep -Fq 'no folder under specs/ or archive/' <<<"$gout" && ! grep -Fq 'AMBIGUOUS' <<<"$gout" \
|
|
183
|
+
&& check "creq: a genuinely missing target is still BROKEN" 0 $? \
|
|
184
|
+
|| { echo "FAIL creq: missing target misdiagnosed"; echo "$gout"; fail=1; }
|
|
185
|
+
printf '# Billing\nRequires: [2026-01-02-b-export]\n' \
|
|
186
|
+
> "$amb/devos/specs/2026-01-03-billing/spec.md"
|
|
187
|
+
sout=$(python3 "$CREQ" --spec 2026-01-03-billing "$amb" 2>&1)
|
|
188
|
+
! grep -Fq 'AMBIGUOUS' <<<"$sout" && ! grep -Fq 'BROKEN' <<<"$sout" \
|
|
189
|
+
&& check "creq: the full name of a shared suffix resolves" 0 $? \
|
|
190
|
+
|| { echo "FAIL creq: full name did not resolve"; echo "$sout"; fail=1; }
|
|
191
|
+
|
|
192
|
+
# A Requires heading followed by the numbered sections of the write-spec.md
|
|
193
|
+
# skeleton. The old terminator required a letter after the hashes, so
|
|
194
|
+
# `## 5. Out of Scope` never closed the list and `- none` became a
|
|
195
|
+
# dependency named "none".
|
|
196
|
+
reqsec="$tmp/req-section"
|
|
197
|
+
mkdir -p "$reqsec/devos/specs/2026-01-04-a" "$reqsec/devos/specs/2026-01-05-b" \
|
|
198
|
+
"$reqsec/devos/specs/2026-01-05-c" "$reqsec/devos/specs/2026-01-06-d"
|
|
199
|
+
printf '# A\n## 1. Goal\nx\n## 4. Functional Constraints\n### Requires:\n- 2026-01-05-b\n## 5. Out of Scope\n- none\n## Appendix\n' \
|
|
200
|
+
> "$reqsec/devos/specs/2026-01-04-a/spec.md"
|
|
201
|
+
printf '# B\n## 1. Goal\nx\n' > "$reqsec/devos/specs/2026-01-05-b/spec.md"
|
|
202
|
+
printf '# C\n## 1. Goal\nx\n### Requires:\n- 2026-01-06-d\n### Rationale\n- 2026-01-05-b\n' \
|
|
203
|
+
> "$reqsec/devos/specs/2026-01-05-c/spec.md"
|
|
204
|
+
printf '# D\n## 1. Goal\nx\n' > "$reqsec/devos/specs/2026-01-06-d/spec.md"
|
|
205
|
+
rsout=$(python3 "$CREQ" "$reqsec" 2>&1)
|
|
206
|
+
! grep -Fq 'BROKEN' <<<"$rsout" \
|
|
207
|
+
&& check "creq: a numbered section after Requires does not leak its bullets into the graph" 0 $? \
|
|
208
|
+
|| { echo "FAIL creq: a numbered section leaked a dependency"; echo "$rsout"; fail=1; }
|
|
209
|
+
grep -Fqx '2026-01-04-a blocked-by: 2026-01-05-b' <<<"$rsout" \
|
|
210
|
+
&& grep -Fqx '2026-01-05-b blocks: 2026-01-04-a' <<<"$rsout" \
|
|
211
|
+
&& check "creq: the declared dependency is still collected under a Requires heading" 0 $? \
|
|
212
|
+
|| { echo "FAIL creq: the Requires bullet was dropped"; echo "$rsout"; fail=1; }
|
|
213
|
+
grep -Fqx '2026-01-05-c blocked-by: 2026-01-06-d' <<<"$rsout" \
|
|
214
|
+
&& check "creq: a lettered heading after Requires still ends the section" 0 $? \
|
|
215
|
+
|| { echo "FAIL creq: a lettered heading no longer ends the Requires section"; echo "$rsout"; fail=1; }
|
|
216
|
+
|
|
217
|
+
# The reader finds the declaration with grep -i but used to strip the label
|
|
218
|
+
# with a case-sensitive `s/^[Rr]equires:/`, so `REQUIRES: [x]` was accepted as
|
|
219
|
+
# a declaration and then parsed as a dependency literally named
|
|
220
|
+
# "REQUIRES: [x" and reported BROKEN. The heading branch matched one spelling.
|
|
221
|
+
reqcase="$tmp/req-case"
|
|
222
|
+
mkdir -p "$reqcase/devos/specs/2026-01-05-a" "$reqcase/devos/specs/2026-01-06-b"
|
|
223
|
+
printf '# B\n' > "$reqcase/devos/specs/2026-01-06-b/spec.md"
|
|
224
|
+
reqcase_ok=1
|
|
225
|
+
for spelling in 'Requires:' 'requires:' 'REQUIRES:' 'ReQuIrEs:'; do
|
|
226
|
+
printf '# A\n\n%s [2026-01-06-b]\n' "$spelling" \
|
|
227
|
+
> "$reqcase/devos/specs/2026-01-05-a/spec.md"
|
|
228
|
+
cout=$(python3 "$CREQ" "$reqcase" 2>&1)
|
|
229
|
+
{ grep -Fqx '2026-01-05-a blocked-by: 2026-01-06-b' <<<"$cout" \
|
|
230
|
+
&& ! grep -Fq 'BROKEN' <<<"$cout"; } || { reqcase_ok=0; echo "--- inline '$spelling'"; echo "$cout"; }
|
|
231
|
+
done
|
|
232
|
+
for spelling in Requires REQUIRES; do
|
|
233
|
+
printf '# A\n\n### %s:\n- 2026-01-06-b\n## 5. Out of Scope\n- none\n' "$spelling" \
|
|
234
|
+
> "$reqcase/devos/specs/2026-01-05-a/spec.md"
|
|
235
|
+
cout=$(python3 "$CREQ" "$reqcase" 2>&1)
|
|
236
|
+
{ grep -Fqx '2026-01-05-a blocked-by: 2026-01-06-b' <<<"$cout" \
|
|
237
|
+
&& ! grep -Fq 'BROKEN' <<<"$cout"; } || { reqcase_ok=0; echo "--- heading '$spelling'"; echo "$cout"; }
|
|
238
|
+
done
|
|
239
|
+
[[ "$reqcase_ok" -eq 1 ]] \
|
|
240
|
+
&& check "creq: every accepted case of the Requires label resolves the dependency" 0 $? \
|
|
241
|
+
|| { echo "FAIL creq: a case-folded Requires label did not resolve"; fail=1; }
|
|
242
|
+
printf '# A\n\nREQUIRES: [2026-02-01-ghost]\n' \
|
|
243
|
+
> "$reqcase/devos/specs/2026-01-05-a/spec.md"
|
|
244
|
+
cout=$(python3 "$CREQ" "$reqcase" 2>&1)
|
|
245
|
+
grep -Fqx 'BROKEN 2026-01-05-a Requires: 2026-02-01-ghost (no folder under specs/ or archive/)' <<<"$cout" \
|
|
246
|
+
&& check "creq: a truly missing target is still BROKEN, naming the target alone" 0 $? \
|
|
247
|
+
|| { echo "FAIL creq: case folding turned a missing target into a resolved one"; echo "$cout"; fail=1; }
|
|
248
|
+
|
|
249
|
+
vout=$(python3 "$CREQ" --verify "$reqfix/devos/specs/2026-01-03-billing" "$reqfix")
|
|
250
|
+
[[ "$vout" == *"INFO depends on 2026-01-02-export, not yet shipped"* ]]
|
|
251
|
+
check "creq: --verify unmet is INFO" 0 $?
|
|
252
|
+
vout=$(python3 "$CREQ" --verify "$reqfix/devos/specs/2026-01-02-export" "$reqfix")
|
|
253
|
+
[[ -z "$vout" ]]
|
|
254
|
+
check "creq: --verify met dep is silent" 0 $?
|
|
255
|
+
|
|
256
|
+
dout=$(python3 "$CREQ" --doctor "$reqfix")
|
|
257
|
+
[[ "$dout" == *"BROKEN Requires: ghost-spec"* ]]
|
|
258
|
+
check "creq: --doctor flags broken edge" 0 $?
|
|
259
|
+
[[ "$dout" == *"CYCLE"* ]]
|
|
260
|
+
check "creq: --doctor flags cycle" 0 $?
|
|
261
|
+
[[ "$dout" != *"blocked-by"* ]]
|
|
262
|
+
check "creq: --doctor omits status blocked-by" 0 $?
|
|
263
|
+
|
|
264
|
+
# --transitive: the A->B->C chain.
|
|
265
|
+
tout=$(python3 "$CREQ" --transitive "$reqfix")
|
|
266
|
+
[[ "$tout" == *"2026-01-03-billing -> 2026-01-02-export"* ]]
|
|
267
|
+
check "creq: --transitive resolves a two-hop chain" 0 $?
|
|
268
|
+
|
|
269
|
+
# --timeline: the same T25 claimed verification "against a capability with 3 or
|
|
270
|
+
# more merges" — every behavior file in this repo has exactly one. It used
|
|
271
|
+
# `git log --diff-filter=M`, which excludes the A commit that CREATES the file,
|
|
272
|
+
# so a capability with only its creating commit printed a bare header. And
|
|
273
|
+
# `git log` exits 0 while printing nothing, so the `|| echo` fallback it carried
|
|
274
|
+
# never fired. Both pinned here: a real file must yield its diff, an
|
|
275
|
+
# empty-history file must say so.
|
|
276
|
+
tlfix="$tmp/timeline-fix"
|
|
277
|
+
mkdir -p "$tlfix/devos/product/behaviors"
|
|
278
|
+
(
|
|
279
|
+
cd "$tlfix" && git init -q . && git config user.email t@t && git config user.name t
|
|
280
|
+
printf '# Search\n\n## Added\n- filters by tag\n' > devos/product/behaviors/search.md
|
|
281
|
+
git add -A && git commit -qm 'chore(spec): complete 2026-01-01-search, merge behavior delta'
|
|
282
|
+
)
|
|
283
|
+
tout=$(cd "$tlfix" && python3 "$CREQ" --timeline search .)
|
|
284
|
+
[[ "$tout" == *"filters by tag"* ]]
|
|
285
|
+
check "creq: --timeline shows the creating commit's diff" 0 $?
|
|
286
|
+
|
|
287
|
+
# The explicit project root must control both capability lookup and git history.
|
|
288
|
+
# The caller may be outside the project, as the gate test process is.
|
|
289
|
+
tout=$(python3 "$CREQ" --timeline search "$tlfix")
|
|
290
|
+
[[ "$tout" == *"filters by tag"* ]]
|
|
291
|
+
check "creq: --timeline resolves project root from outside" 0 $?
|
|
292
|
+
[[ "$tout" == *"2026-01-01-search"* ]]
|
|
293
|
+
check "creq: --timeline carries the spec name from the commit subject" 0 $?
|
|
294
|
+
|
|
295
|
+
touch "$tlfix/devos/product/behaviors/untracked.md"
|
|
296
|
+
tout=$(cd "$tlfix" && python3 "$CREQ" --timeline untracked .)
|
|
297
|
+
[[ "$tout" == *"no git history"* ]]
|
|
298
|
+
check "creq: --timeline reports empty history instead of a bare header" 0 $?
|
|
299
|
+
|
|
300
|
+
python3 "$CREQ" --timeline no-such-capability "$tlfix" >/dev/null 2>&1
|
|
301
|
+
check "creq: --timeline missing capability exits 1" 1 $?
|
|
302
|
+
|
|
303
|
+
printf '# Outside behavior\n' > "$tlfix/devos/product/outside.md"
|
|
304
|
+
(cd "$tlfix" && git add -A && git commit -qm 'chore: outside behavior')
|
|
305
|
+
out=$(python3 "$CREQ" --timeline ../outside "$tlfix" 2>&1); rc=$?
|
|
306
|
+
grep -Fq 'capability must be a single name without path separators' <<<"$out" && [[ $rc -eq 2 ]] \
|
|
307
|
+
&& check "creq: --timeline rejects capability path traversal" 0 $? \
|
|
308
|
+
|| { echo "FAIL creq: --timeline accepted capability path traversal"; echo "$out"; fail=1; }
|
|
309
|
+
|
|
310
|
+
# --- render-rule.py ----------------------------------------------------------
|
|
311
|
+
RENDER="$(cd "$(dirname "$DOD")/../.." && pwd)/skills/init/scripts/render-rule.py"
|
|
312
|
+
|
|
313
|
+
rproj="$tmp/rule-project"
|
|
314
|
+
mkdir -p "$rproj/.github" "$rproj/devos/standards/rules/02-languages"
|
|
315
|
+
cat > "$rproj/devos/standards/rules/02-languages/ts-strict.md" <<'MD'
|
|
316
|
+
---
|
|
317
|
+
globs: src/**/*.ts, src/**/*.tsx
|
|
318
|
+
---
|
|
319
|
+
# TypeScript strict mode
|
|
320
|
+
- No `any` without a comment justifying it
|
|
321
|
+
MD
|
|
322
|
+
(cd "$rproj" && python3 "$RENDER" devos/standards/rules/02-languages/ts-strict.md >/dev/null)
|
|
323
|
+
check "render-rule: copilot instructions written" 0 $?
|
|
324
|
+
[[ -f "$rproj/.github/instructions/languages-ts-strict.instructions.md" ]]
|
|
325
|
+
check "render-rule: copilot output exists" 0 $?
|
|
326
|
+
grep -q 'applyTo: "src/\*\*/\*.ts,src/\*\*/\*.tsx"' "$rproj/.github/instructions/languages-ts-strict.instructions.md"
|
|
327
|
+
check "render-rule: copilot applyTo is comma-separated" 0 $?
|
|
328
|
+
|
|
329
|
+
mkdir -p "$rproj/devos/standards/rules/00-architecture"
|
|
330
|
+
cat > "$rproj/devos/standards/rules/00-architecture/layering.md" <<'MD'
|
|
331
|
+
---
|
|
332
|
+
---
|
|
333
|
+
# Layering
|
|
334
|
+
- Presentation never imports Infrastructure directly
|
|
335
|
+
MD
|
|
336
|
+
(cd "$rproj" && python3 "$RENDER" devos/standards/rules/00-architecture/layering.md >/dev/null)
|
|
337
|
+
grep -q 'applyTo: "\*\*"' "$rproj/.github/instructions/architecture-layering.instructions.md"
|
|
338
|
+
check "render-rule: all-files rule sets applyTo ** on copilot" 0 $?
|
|
339
|
+
|
|
340
|
+
noinstall="$tmp/no-install-project"
|
|
341
|
+
mkdir -p "$noinstall/devos/standards/rules/09-other"
|
|
342
|
+
cp "$rproj/devos/standards/rules/00-architecture/layering.md" "$noinstall/devos/standards/rules/09-other/layering.md"
|
|
343
|
+
out=$(cd "$noinstall" && python3 "$RENDER" devos/standards/rules/09-other/layering.md)
|
|
344
|
+
[[ "$out" == *"nothing to render"* ]]
|
|
345
|
+
check "render-rule: no Copilot install renders nothing, says so" 0 $?
|
|
346
|
+
|
|
347
|
+
python3 "$RENDER" /nonexistent/rule.md >/dev/null 2>&1
|
|
348
|
+
check "render-rule: missing file exits 2" 2 $?
|
|
349
|
+
|
|
350
|
+
# Frontmatter that opens but never closes: the old guard only checked the
|
|
351
|
+
# opener, so the rule text was swallowed as frontmatter and an applyTo-only
|
|
352
|
+
# instruction file was written and reported as a success.
|
|
353
|
+
printf '%s\n' '---' 'globs: src/**/*.ts' '' '# Truncated' '' '- Body that lost its fence.' \
|
|
354
|
+
> "$rproj/devos/standards/rules/02-languages/truncated.md"
|
|
355
|
+
out=$(cd "$rproj" && python3 "$RENDER" devos/standards/rules/02-languages/truncated.md 2>&1); rc=$?
|
|
356
|
+
grep -Fq 'unterminated frontmatter' <<<"$out" && [[ $rc -eq 1 ]]
|
|
357
|
+
check "render-rule: unterminated frontmatter is malformed input" 0 $?
|
|
358
|
+
[[ ! -e "$rproj/.github/instructions/languages-truncated.instructions.md" ]] && [[ "$out" != *"wrote "* ]]
|
|
359
|
+
check "render-rule: unterminated frontmatter writes no instruction file" 0 $?
|
|
360
|
+
|