@boyingliu01/xp-gate 0.18.5 → 0.19.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/adapter-common.sh +27 -0
- package/adapters/gate-3.sh +0 -0
- package/adapters/gate-4.sh +0 -0
- package/adapters/gate-7.sh +0 -0
- package/adapters/gate-8.sh +0 -0
- package/adapters/gate-9.sh +0 -0
- package/adapters/powershell.sh +85 -33
- package/adapters/typescript.sh +8 -8
- package/build-integrity/__tests__/import-resolver.test.ts +22 -0
- package/build-integrity/__tests__/orchestrator.test.ts +1 -2
- package/build-integrity/gate-10.ts +7 -0
- package/gate-12-file-hygiene.sh +230 -0
- package/hooks/adapter-common.sh +27 -0
- package/hooks/gate-10.sh +105 -0
- package/hooks/gate-12-file-hygiene.sh +0 -0
- package/hooks/lib/validate-code-walkthrough.cjs +125 -0
- package/hooks/pre-commit +130 -33
- package/hooks/pre-push +15 -91
- package/lib/__tests__/check-version.test.js +67 -46
- package/lib/__tests__/doctor.test.js +7 -6
- package/lib/__tests__/gate-runner.test.js +267 -0
- package/lib/__tests__/init.test.js +32 -0
- package/lib/__tests__/npm-package.test.js +13 -0
- package/lib/__tests__/phase-transition.test.js +604 -12
- package/lib/__tests__/sprint-discovery.test.ts +0 -1
- package/lib/__tests__/sprint-status-rework.test.js +100 -1
- package/lib/__tests__/update-hooks.test.js +143 -10
- package/lib/__tests__/upgrade-exec.test.js +73 -45
- package/lib/__tests__/upgrade-skill-sync.test.js +1 -1
- package/lib/__tests__/upgrade.test.js +12 -11
- package/lib/doctor.js +2 -1
- package/lib/gate-runner.js +68 -23
- package/lib/init.js +34 -5
- package/lib/install-skill.js +1 -0
- package/lib/mattpocock-license-verdict.json +1 -1
- package/lib/phase-transition.js +203 -23
- package/lib/shared-paths.js +2 -0
- package/lib/sprint-status.js +15 -4
- package/lib/test-alignment.ts +3 -13
- package/lib/update-hooks.js +129 -15
- package/mock-policy/AGENTS.md +5 -5
- package/mock-policy/__tests__/gate-m3.test.ts +0 -5
- package/mock-policy/__tests__/scope-scanner.test.ts +8 -2
- package/mutation/AGENTS.md +4 -4
- package/mutation/__tests__/mutmut-runner.test.ts +443 -2
- package/mutation/__tests__/update-baseline.test.ts +0 -2
- package/mutation/runners/mutmut-runner.ts +67 -17
- package/package.json +9 -3
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +24 -27
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +13 -12
- package/plugins/claude-code/skills/delphi-review/INSTALL.md +15 -17
- package/plugins/claude-code/skills/delphi-review/SKILL.md +30 -29
- package/plugins/claude-code/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/claude-code/skills/delphi-review/references/requirements.md +66 -54
- package/plugins/claude-code/skills/delphi-review/references/round-templates.md +7 -7
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +5 -5
- package/plugins/claude-code/skills/sprint-flow/SKILL.md +4 -4
- package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +37 -35
- package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +4 -4
- package/plugins/dsh/README.md +25 -0
- package/plugins/dsh/cordis.patch.yml +7 -0
- package/plugins/dsh/package.json +70 -0
- package/plugins/dsh/scripts/prepack.cjs +82 -0
- package/plugins/dsh/skills/admin-template-guidelines/SKILL.md +113 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-1.md +91 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-2.md +155 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-3.md +70 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-4.md +154 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-5.md +126 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-6.md +180 -0
- package/plugins/dsh/skills/batch-grill-me/SKILL.md +15 -0
- package/plugins/dsh/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/dsh/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/dsh/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +70 -0
- package/plugins/dsh/skills/delphi-review/AGENTS.md +67 -0
- package/plugins/dsh/skills/delphi-review/INSTALL.md +150 -0
- package/plugins/dsh/skills/delphi-review/SKILL.md +559 -0
- package/plugins/dsh/skills/delphi-review/hooks.md +19 -0
- package/plugins/dsh/skills/delphi-review/opencode.json.delphi.example +52 -0
- package/plugins/dsh/skills/delphi-review/references/code-walkthrough.md +470 -0
- package/plugins/dsh/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
- package/plugins/dsh/skills/delphi-review/references/requirements.md +402 -0
- package/plugins/dsh/skills/delphi-review/references/round-templates.md +134 -0
- package/plugins/dsh/skills/delphi-review/scripts/verify-consensus.sh +43 -0
- package/plugins/dsh/skills/delphi-review/tools.md +29 -0
- package/plugins/dsh/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/plugins/dsh/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/plugins/dsh/skills/domain-modeling/SKILL.md +74 -0
- package/plugins/dsh/skills/grill-with-docs/SKILL.md +7 -0
- package/plugins/dsh/skills/grilling/SKILL.md +12 -0
- package/plugins/dsh/skills/improve-codebase-architecture/SKILL.md +156 -0
- package/plugins/dsh/skills/ralph-loop/SKILL.md +198 -0
- package/plugins/dsh/skills/ralph-loop/references/components.md +113 -0
- package/plugins/dsh/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
- package/plugins/dsh/skills/ralph-loop/references/workflow-details.md +99 -0
- package/plugins/dsh/skills/ralph-loop/templates/progress-log.md +36 -0
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +103 -0
- package/plugins/dsh/skills/sprint-flow/SKILL.md +411 -0
- package/plugins/dsh/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
- package/plugins/dsh/skills/sprint-flow/hooks.md +18 -0
- package/plugins/dsh/skills/sprint-flow/references/components/memory.md +87 -0
- package/plugins/dsh/skills/sprint-flow/references/components/middleware.md +75 -0
- package/plugins/dsh/skills/sprint-flow/references/components/skill-invocations.md +105 -0
- package/plugins/dsh/skills/sprint-flow/references/components/system-prompt.md +27 -0
- package/plugins/dsh/skills/sprint-flow/references/components/tool-descriptions.md +95 -0
- package/plugins/dsh/skills/sprint-flow/references/force-levels.md +204 -0
- package/plugins/dsh/skills/sprint-flow/references/orchestration-rules.md +236 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +273 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +348 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +225 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-5-ship.md +222 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +266 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-overview.md +486 -0
- package/plugins/dsh/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
- package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
- package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-output-template.md +110 -0
- package/plugins/dsh/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
- package/plugins/dsh/skills/sprint-flow/templates/pain-document-template.md +115 -0
- package/plugins/dsh/skills/sprint-flow/templates/sprint-progress-template.md +140 -0
- package/plugins/dsh/skills/sprint-flow/templates/sprint-summary-template.md +121 -0
- package/plugins/dsh/skills/sprint-flow/tools.md +29 -0
- package/plugins/dsh/skills/test-driven-development/SKILL.md +371 -0
- package/plugins/dsh/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +56 -0
- package/plugins/dsh/skills/test-specification-alignment/SKILL.md +205 -0
- package/plugins/dsh/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
- package/plugins/dsh/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
- package/plugins/dsh/skills/test-specification-alignment/references/specification-format.md +348 -0
- package/plugins/dsh/skills/to-issues/SKILL.md +277 -0
- package/plugins/dsh/src/command.test.ts +102 -0
- package/plugins/dsh/src/command.ts +75 -0
- package/plugins/dsh/src/contract.test.ts +62 -0
- package/plugins/dsh/src/gate-runner.test.ts +100 -0
- package/plugins/dsh/src/gate-runner.ts +58 -0
- package/plugins/dsh/src/index.test.ts +97 -0
- package/plugins/dsh/src/index.ts +94 -0
- package/plugins/dsh/src/skills.test.ts +58 -0
- package/plugins/dsh/tsconfig.build.json +13 -0
- package/plugins/dsh/tsconfig.json +19 -0
- package/plugins/dsh/vitest.config.ts +8 -0
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/scripts/prepack.cjs +1 -0
- package/plugins/opencode/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/opencode/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/opencode/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +24 -27
- package/plugins/opencode/skills/delphi-review/AGENTS.md +13 -12
- package/plugins/opencode/skills/delphi-review/INSTALL.md +15 -17
- package/plugins/opencode/skills/delphi-review/SKILL.md +30 -29
- package/plugins/opencode/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/opencode/skills/delphi-review/references/requirements.md +66 -54
- package/plugins/opencode/skills/delphi-review/references/round-templates.md +7 -7
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +5 -5
- package/plugins/opencode/skills/sprint-flow/SKILL.md +4 -4
- package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/plugins/opencode/skills/sprint-flow/references/force-levels.md +37 -35
- package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +4 -4
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/SKILL.md +47 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +3 -11
- package/plugins/qoder/skills/delphi-review/AGENTS.md +15 -17
- package/plugins/qoder/skills/delphi-review/INSTALL.md +12 -12
- package/plugins/qoder/skills/delphi-review/SKILL.md +58 -25
- package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +1 -1
- package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +5 -5
- package/plugins/qoder/skills/sprint-flow/SKILL.md +2 -2
- package/plugins/qoder/skills/sprint-flow/references/force-levels.md +38 -35
- package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +48 -6
- package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +5 -6
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +4 -4
- package/principles/AGENTS.md +4 -4
- package/scripts/__tests__/sync-package-content.test.js +30 -0
- package/scripts/delphi-external-review.cjs +194 -63
- package/scripts/sync-package-content.js +9 -2
- package/skills/clipboard-vision/SKILL.md +47 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/skills/delphi-review/.delphi-config.json.example +24 -27
- package/skills/delphi-review/AGENTS.md +13 -12
- package/skills/delphi-review/INSTALL.md +15 -17
- package/skills/delphi-review/SKILL.md +30 -29
- package/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/skills/delphi-review/references/requirements.md +66 -54
- package/skills/delphi-review/references/round-templates.md +7 -7
- package/skills/sprint-flow/AGENTS.md +5 -5
- package/skills/sprint-flow/SKILL.md +4 -4
- package/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/skills/sprint-flow/references/force-levels.md +37 -35
- package/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/skills/sprint-flow/references/phase-overview.md +2 -2
- package/skills/test-specification-alignment/AGENTS.md +4 -4
- package/sprint-gate.sh +291 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# SKILLS/TEST-SPECIFICATION-ALIGNMENT KNOWLEDGE BASE
|
|
2
|
+
|
|
3
|
+
**Generated:** 2026-08-24
|
|
4
|
+
**Commit:** a1a4683
|
|
5
|
+
**Branch:** dsh-plugin
|
|
6
|
+
**Version:** 0.19.0.0
|
|
7
|
+
|
|
8
|
+
## OVERVIEW
|
|
9
|
+
Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
|
|
10
|
+
|
|
11
|
+
## STRUCTURE
|
|
12
|
+
```
|
|
13
|
+
skills/test-specification-alignment/
|
|
14
|
+
├── SKILL.md # Core alignment workflow (2-phase)
|
|
15
|
+
├── AGENTS.md # This file
|
|
16
|
+
├── evals/ # Evaluation test cases
|
|
17
|
+
└── references/ # Supporting documentation
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## WHERE TO LOOK
|
|
21
|
+
| Task | Location | Notes |
|
|
22
|
+
|------|----------|-------|
|
|
23
|
+
| Core workflow | SKILL.md | Phase 1 (align) + Phase 2 (execute) |
|
|
24
|
+
| Freeze mechanism | SKILL.md | Prevents test modifications during Phase 2 |
|
|
25
|
+
|
|
26
|
+
## CONVENTIONS
|
|
27
|
+
- Phase 1 (Align): test modifications ALLOWED to align with specification
|
|
28
|
+
- Phase 2 (Execute): test modifications FORBIDDEN (freeze enforced)
|
|
29
|
+
- Minimum 80% alignment score required to pass
|
|
30
|
+
- All `@test`, `@intent`, `@covers` JSDoc tags mandatory in test files
|
|
31
|
+
- Test annotations trace to REQ-XXX and AC-XXX
|
|
32
|
+
|
|
33
|
+
## ANTI-PATTERNS (THIS PROJECT)
|
|
34
|
+
- Do NOT modify tests during Phase 2 execution
|
|
35
|
+
- Do NOT proceed with low alignment score (<80%)
|
|
36
|
+
- Do NOT skip specification validation if specification exists
|
|
37
|
+
- Do NOT delete test files in Phase 2 (freeze intercepts)
|
|
38
|
+
- Do NOT modify assertions when tests fail (modify business code instead)
|
|
39
|
+
- Missing @test tags → test rejected
|
|
40
|
+
|
|
41
|
+
## UNIQUE STYLES
|
|
42
|
+
- Two-phase separation (modify vs. execute)
|
|
43
|
+
- Freeze/unfreeze test protection mechanism
|
|
44
|
+
- YAML specification-driven validation (specification.yaml)
|
|
45
|
+
- Structured JSDoc tag requirements (@test, @intent, @covers)
|
|
46
|
+
|
|
47
|
+
## COMMANDS
|
|
48
|
+
```bash
|
|
49
|
+
/test-specification-alignment # Run alignment check
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## NOTES
|
|
53
|
+
- Runs during BUILD (Phase 2) after TDD
|
|
54
|
+
- Mandatory before gstack-ship release
|
|
55
|
+
- Integrates with test-driven-development skill
|
|
56
|
+
- Uses freeze skill to lock test directories during Phase 2
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-specification-alignment
|
|
3
|
+
description: "Use when asked to run tests, verify tests, align tests with specification.yaml, before BUILD verification, or before release/ship."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Specification Alignment Engine
|
|
7
|
+
|
|
8
|
+
## Workflow Steps
|
|
9
|
+
|
|
10
|
+
1. **Load Phase 0** — Verify `specification.yaml` and `tests/` directory exist; BLOCK if missing with guidance to complete brainstorming → delphi-review → specification-generator flow first
|
|
11
|
+
2. **Phase 1 Alignment (Modify Allowed)** — Parse specification.yaml + test files (AST); validate alignment rules; generate alignment report; optionally fix tests to align with requirements; require score ≥80% to proceed
|
|
12
|
+
3. **Coverage Mapping** — Map each REQ-* to at least one test with `@test` annotation; map each AC-* to at least one assertion; verify `@test`, `@intent`, `@covers` tags
|
|
13
|
+
4. **Pre-Phase 2 Freeze** — Lock test directories via read-only subagent convention (reviewer tools restricted to `[Read, Grep, Glob]`, no Write/Edit/Bash); return confirmation before proceeding
|
|
14
|
+
5. **Phase 2 Execution (Frozen)** — Run all tests; Agent BLOCKED from modifying/deleting/skipping tests; analyze failures into 4 categories
|
|
15
|
+
6. **Failure Classification** — For each failing test, output with Type, Test, Root Cause, Action fields; SPECIFICATION_ERROR requires ESCALATE_TO_HUMAN with user options (A: fix spec → re-Phase 1, B: confirm spec → modify code, C: clarify ambiguity)
|
|
16
|
+
7. **JSON Report Output** — Generate alignment report as valid JSON
|
|
17
|
+
|
|
18
|
+
## 核心原则
|
|
19
|
+
|
|
20
|
+
**测试是系统的防护网,也是系统的使用手册。测试必须准确反映原始需求和设计方案。**
|
|
21
|
+
|
|
22
|
+
| 特性 | 说明 |
|
|
23
|
+
|------|------|
|
|
24
|
+
| **两阶段分离** | Phase 1 可修改测试对齐,Phase 2 禁止修改测试执行 |
|
|
25
|
+
| **结构化验证** | YAML specification + AST 解析,确定性验证 |
|
|
26
|
+
| **freeze 约束** | Phase 2 调用 freeze skill 锁定测试目录 |
|
|
27
|
+
| **失败分类** | 业务代码/测试数据/Specification/环境 四类错误分流 |
|
|
28
|
+
| **零容忍** | Phase 2 绝对禁止修改/删除/跳过测试 |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Output Format (MANDATORY)
|
|
33
|
+
|
|
34
|
+
> **MANDATORY FILE OUTPUT**: When invoked, you MUST write this report as valid JSON to the file `.sprint-state/phase-outputs/test-alignment-report.json` in the project root. Stdout output alone is not sufficient — `xp-gate phase-transition 4 completed` validates the file, not the stdout.
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"alignment_status": "PASS|FAIL|BLOCKED",
|
|
39
|
+
"phase": "1|2",
|
|
40
|
+
"score": 85.5,
|
|
41
|
+
"head_commit": "<git rev-parse HEAD output>",
|
|
42
|
+
"spec_hash": "<SHA-256 of specification.yaml if exists, else null>",
|
|
43
|
+
"timestamp": "<ISO 8601>",
|
|
44
|
+
"misaligned_tests": [
|
|
45
|
+
{"test_name": "test_checkout", "spec_requirement": "REQ-003", "gap": "Missing @test annotation"}
|
|
46
|
+
],
|
|
47
|
+
"anti_pattern_detected": false,
|
|
48
|
+
"errors": []
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Eval assertions check for:** `alignment_status`, `phase`, `score`, `head_commit`, `spec_hash`, `anti_pattern_detected`.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Triggers
|
|
57
|
+
|
|
58
|
+
### Automatic
|
|
59
|
+
- BUILD (TDD + review) Round 1 after Driver outputs tests
|
|
60
|
+
- Gate 1 verification before proceeding
|
|
61
|
+
- Phase 5 SHIP release before deployment (native phase-5 steps)
|
|
62
|
+
|
|
63
|
+
### Manual
|
|
64
|
+
- `/test-specification-alignment`, `/verify-tests`, "run tests", "verify tests"
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Scope
|
|
69
|
+
|
|
70
|
+
### IN Scope
|
|
71
|
+
- Validation of test alignment against `specification.yaml`
|
|
72
|
+
- Phase 1: Test modification to improve alignment
|
|
73
|
+
- Phase 2: Test execution with frozen test files
|
|
74
|
+
- Failure classification (BUSINESS_CODE_ERROR, TEST_DATA_ERROR, SPECIFICATION_ERROR, ENVIRONMENT_ERROR)
|
|
75
|
+
- JSON report generation
|
|
76
|
+
|
|
77
|
+
### OUT Scope
|
|
78
|
+
- Modifying `specification.yaml` during Phase 2 (requires ESCALATE_TO_HUMAN)
|
|
79
|
+
- Skipping/deleting/skipping tests
|
|
80
|
+
- Modifying test assertions to force passes
|
|
81
|
+
- Business logic implementation (BUILD phase)
|
|
82
|
+
- Environment configuration
|
|
83
|
+
|
|
84
|
+
### Boundaries
|
|
85
|
+
- **Start**: After BUILD (TDD + review) Round 1 outputs tests
|
|
86
|
+
- **End**: Terminal State ✅ ALL_TESTS_PASS or ESCALATE_TO_HUMAN
|
|
87
|
+
- **Inputs**: `specification.yaml`, `tests/` directory
|
|
88
|
+
- **Outputs**: Alignment report (JSON), test execution report, failure classification
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 核心流程
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Phase 0: 准备
|
|
96
|
+
├─ 验证 specification.yaml 存在
|
|
97
|
+
├─ 验证 tests/ 目录存在
|
|
98
|
+
└─ ❌ 缺失 → BLOCK + 提示用户
|
|
99
|
+
|
|
100
|
+
Phase 1: 对齐验证 (可修改测试)
|
|
101
|
+
├─ 解析 specification.yaml (YAML parser)
|
|
102
|
+
├─ 解析测试文件 (AST parser)
|
|
103
|
+
├─ 验证对齐规则
|
|
104
|
+
└─ (可选) 修复测试
|
|
105
|
+
|
|
106
|
+
Checkpoint: Alignment Score >= 80%?
|
|
107
|
+
├─ NO → BLOCK
|
|
108
|
+
└─ YES → 继续
|
|
109
|
+
|
|
110
|
+
⭐ Pre-Phase 2: 调用 freeze skill 锁定测试目录
|
|
111
|
+
|
|
112
|
+
Phase 2: 执行测试 (禁止修改测试)
|
|
113
|
+
├─ 运行所有测试
|
|
114
|
+
├─ IF Agent 尝试修改测试 → freeze 拦截
|
|
115
|
+
├─ 失败分析: 业务代码/测试数据/Specification/环境
|
|
116
|
+
│ └─ Specification 错误 → ESCALATE_TO_HUMAN
|
|
117
|
+
└─ 全部通过 → 继续
|
|
118
|
+
|
|
119
|
+
⭐ Post-Phase 2: 调用 unfreeze skill
|
|
120
|
+
|
|
121
|
+
Terminal State: ✅ ALL_TESTS_PASS
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## 强制对齐规则
|
|
127
|
+
|
|
128
|
+
| 规则 | 说明 | 语言示例 |
|
|
129
|
+
|------|------|----------|
|
|
130
|
+
| **每个 REQ 必须有测试** | 每个 REQ-* 对应至少一个 test case | TS: `@test REQ-AUTH-001` / Py: `# @test REQ-AUTH-001` / Go: `// @test REQ-AUTH-001` |
|
|
131
|
+
| **每个 AC 必须有断言** | 每个 AC-* 必须有对应断言覆盖 | `// AC-AUTH-001-01: 返回 200` → `expect(response.status).toBe(200)` |
|
|
132
|
+
| **测试意图声明** | 每个 test case 必须有 `@test`, `@intent`, `@covers` 标签 | 详见 `references/specification-format.md` |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Failure Classification
|
|
137
|
+
|
|
138
|
+
| 类型 | 判断依据 | 处理方式 |
|
|
139
|
+
|------|----------|----------|
|
|
140
|
+
| **BUSINESS_CODE_ERROR** | 测试正确,业务代码有 bug | 修改业务代码 |
|
|
141
|
+
| **TEST_DATA_ERROR** | 测试数据不符合业务逻辑 | 回滚到 Phase 1 |
|
|
142
|
+
| **SPECIFICATION_ERROR** | 测试正确,但 specification 有误 | ESCALATE_TO_HUMAN |
|
|
143
|
+
| **ENVIRONMENT_ERROR** | 环境/依赖问题 | 修复环境配置 |
|
|
144
|
+
|
|
145
|
+
### Specification 错误处理选项
|
|
146
|
+
|
|
147
|
+
- **A**: 修正 Specification → 重新 Phase 1 (unfreeze tests)
|
|
148
|
+
- **B**: 确认 Specification 正确 → 修改业务代码 (用户明确授权)
|
|
149
|
+
- **C**: 补充 Specification 澄清歧义 (unfreeze tests)
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## State Machine
|
|
154
|
+
|
|
155
|
+
| State | Description |
|
|
156
|
+
|-------|------------|
|
|
157
|
+
| 0 IDLE | Initial |
|
|
158
|
+
| 1 PHASE0_PREPARING | Preparing |
|
|
159
|
+
| 3 PHASE1_ALIGNING | Aligning |
|
|
160
|
+
| 6 PHASE1_COMPLETE | Alignment done |
|
|
161
|
+
| 7 PRE_PHASE2_FREEZE | Freeze test dirs |
|
|
162
|
+
| 9 PHASE2_EXECUTING | Running tests |
|
|
163
|
+
| 12 PHASE2_FIXING_CODE | Fixing business code |
|
|
164
|
+
| 14 PHASE2_COMPLETE | Tests passed |
|
|
165
|
+
| 15 POST_PHASE2_UNFREEZE | Unfreeze test dirs |
|
|
166
|
+
| 16 ALL_TESTS_PASS | ✅ Done |
|
|
167
|
+
| 90 BLOCKED_MISSING_SPECIFICATION | Missing specification |
|
|
168
|
+
| 93 BLOCKED_SPECIFICATION_ISSUE | Spec issue needs user |
|
|
169
|
+
| 94 BLOCKED_MAX_RETRIES_EXCEEDED | Max retries hit |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Anti-Patterns
|
|
174
|
+
|
|
175
|
+
| ❌ Error | ✅ Correct |
|
|
176
|
+
|---------|-----------|
|
|
177
|
+
| Phase 2 修改/删除测试文件 | 只能修改业务代码 |
|
|
178
|
+
| Phase 2 跳过测试 (skip/xit) | 检测并拒绝 |
|
|
179
|
+
| 测试失败时修改断言 | 必须修改业务代码 |
|
|
180
|
+
| 缺少 @test 标签 | 强制标注 |
|
|
181
|
+
| Specification 错误时强行通过 | 必须 ESCALATE |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Terminal State Checklist
|
|
186
|
+
|
|
187
|
+
- [ ] specification.yaml 存在且可解析
|
|
188
|
+
- [ ] tests/ 目录存在且有测试文件
|
|
189
|
+
- [ ] Phase 1 对齐验证完成, score ≥ 80%
|
|
190
|
+
- [ ] Pre-Phase 2: freeze skill 已调用
|
|
191
|
+
- [ ] Phase 2: 所有测试已执行, 无修改违规
|
|
192
|
+
- [ ] Post-Phase 2: unfreeze skill 已调用
|
|
193
|
+
- [ ] 所有测试通过, 报告已生成
|
|
194
|
+
|
|
195
|
+
**IF Specification 问题 → CANNOT claim complete → MUST ESCALATE_TO_HUMAN**
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Details → see `references/`
|
|
200
|
+
|
|
201
|
+
| Topic | File |
|
|
202
|
+
|-------|------|
|
|
203
|
+
| 对齐验证算法 (AST parsing, score calc, legacy mode) | `references/alignment-verification-algorithm.md` |
|
|
204
|
+
| Specification YAML 格式规范 (完整示例) | `references/specification-format.md` |
|
|
205
|
+
| Phase 2 freeze 约束执行机制 (违规日志, 异常处理, 状态转换) | `references/phase2-constraint-enforcement.md` |
|