phasegate 0.15.0 → 0.31.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.
Files changed (229) hide show
  1. package/README.ja.md +103 -71
  2. package/README.md +73 -13
  3. package/bin/{harness → phasegate} +1 -1
  4. package/docs/ADR/ADR-013-story-reflection-gate.md +100 -0
  5. package/docs/guide/cli-reference.md +9 -9
  6. package/docs/guide/configuration.md +245 -8
  7. package/docs/guide/hooks-integration.md +1 -1
  8. package/docs/guide/installation.md +6 -6
  9. package/docs/guide/layer-model.md +5 -5
  10. package/docs/guide/skills-overview.md +1 -1
  11. package/package.json +12 -10
  12. package/scripts/harness/adr-foundation/domain/ports/adr-document-parser-port.ts +1 -0
  13. package/scripts/harness/adr-foundation/domain/ports/adr-frontmatter-parser-port.ts +1 -0
  14. package/scripts/harness/adr-foundation/domain/ports/adr-repository-port.ts +1 -0
  15. package/scripts/harness/adr-foundation/domain/value-objects/adr-status.ts +6 -6
  16. package/scripts/harness/agent-integration/application/dto/handle-pre-tool-use-dto.ts +3 -1
  17. package/scripts/harness/agent-integration/application/usecases/handle-pre-tool-use-usecase.ts +109 -3
  18. package/scripts/harness/agent-integration/application/usecases/handle-stop-usecase.ts +1 -1
  19. package/scripts/harness/agent-integration/domain/ports/config-query-port.ts +2 -0
  20. package/scripts/harness/agent-integration/domain/ports/phase-gate-query-port.ts +1 -1
  21. package/scripts/harness/agent-integration/domain/ports/story-reflection-query-port.ts +8 -0
  22. package/scripts/harness/agent-integration/domain/services/bash-write-target-extractor.ts +258 -0
  23. package/scripts/harness/agent-integration/domain/services/hook-to-cli-translator.ts +25 -8
  24. package/scripts/harness/agent-integration/domain/value-objects/protected-file-list.ts +20 -0
  25. package/scripts/harness/agent-integration/domain/value-objects/story-reflection-query-result.ts +63 -0
  26. package/scripts/harness/agent-integration/infrastructure/adapters/child-process-cli-executor-adapter.ts +2 -2
  27. package/scripts/harness/agent-integration/infrastructure/adapters/file-system-story-reflection-query-adapter.ts +122 -0
  28. package/scripts/harness/agent-integration/infrastructure/adapters/harness-api-cli-command-registry-adapter.ts +10 -10
  29. package/scripts/harness/agent-integration/infrastructure/adapters/harness-config-config-query-adapter.ts +20 -0
  30. package/scripts/harness/agent-integration/infrastructure/adapters/phase-gate-query-adapter.ts +17 -3
  31. package/scripts/harness/agent-integration/presentation/pre-tool-use-hook.ts +29 -2
  32. package/scripts/harness/biome-ast-engine/domain/services/lint-runner.ts +24 -0
  33. package/scripts/harness/biome-ast-engine/domain/services/rule-definition-registry.ts +1 -1
  34. package/scripts/harness/biome-ast-engine/domain/value-objects/source-module-snapshot.ts +5 -2
  35. package/scripts/harness/biome-ast-engine/infrastructure/adapters/node-workspace-file-adapter.ts +1 -1
  36. package/scripts/harness/biome-ast-engine/infrastructure/adapters/typescript-source-module-analyzer-adapter.ts +1 -1
  37. package/scripts/harness/biome-ast-engine/infrastructure/parsers/unit-comment-parser.ts +12 -7
  38. package/scripts/harness/ci-governance/composition-root.ts +1 -0
  39. package/scripts/harness/ci-governance/infrastructure/adapters/agents-md-file-adapter.ts +2 -2
  40. package/scripts/harness/ci-governance/infrastructure/adapters/yaml-template-renderer-adapter.ts +2 -2
  41. package/scripts/harness/config-foundation/application/mappers/phase-config-section-mapper.ts +44 -0
  42. package/scripts/harness/config-foundation/application/usecases/load-resolved-config-use-case.ts +20 -1
  43. package/scripts/harness/config-foundation/domain/harness-config.ts +2 -1
  44. package/scripts/harness/config-foundation/domain/value-objects/phase-dependencies-config.ts +18 -4
  45. package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json +185 -10
  46. package/scripts/harness/config-foundation/infrastructure/validators/ajv-config-schema-validator.ts +2 -1
  47. package/scripts/harness/harness-api/application/dto/command-dispatch-input.ts +1 -0
  48. package/scripts/harness/harness-api/application/dto/command-dispatch-output.ts +1 -0
  49. package/scripts/harness/harness-api/application/dto/exit-code-decision-input.ts +1 -0
  50. package/scripts/harness/harness-api/application/dto/exit-code-decision-output.ts +1 -0
  51. package/scripts/harness/harness-api/application/dto/harness-api-response-contract.ts +1 -0
  52. package/scripts/harness/harness-api/application/dto/initialize-registry-input.ts +1 -0
  53. package/scripts/harness/harness-api/application/dto/registry-summary-output.ts +1 -0
  54. package/scripts/harness/harness-api/application/dto/status-derivation-input.ts +1 -0
  55. package/scripts/harness/harness-api/application/mappers/harness-api-response-mapper.ts +1 -0
  56. package/scripts/harness/harness-api/application/usecases/decide-exit-code-usecase.ts +4 -3
  57. package/scripts/harness/harness-api/application/usecases/derive-harness-status-usecase.ts +1 -0
  58. package/scripts/harness/harness-api/application/usecases/dispatch-command-usecase.ts +1 -0
  59. package/scripts/harness/harness-api/application/usecases/initialize-command-registry-usecase.ts +1 -0
  60. package/scripts/harness/harness-api/composition-root.ts +1 -0
  61. package/scripts/harness/harness-api/domain/ports/artifact-scanner-port.ts +1 -0
  62. package/scripts/harness/harness-api/domain/ports/biome-lint-port.ts +1 -0
  63. package/scripts/harness/harness-api/domain/ports/config-query-port.ts +1 -0
  64. package/scripts/harness/harness-api/domain/ports/impact-analysis-port.ts +1 -0
  65. package/scripts/harness/harness-api/domain/ports/phase-gate-query-port.ts +1 -0
  66. package/scripts/harness/harness-api/domain/ports/validator-execution-port.ts +1 -0
  67. package/scripts/harness/harness-api/domain/services/command-dispatch-service.ts +17 -16
  68. package/scripts/harness/harness-api/domain/services/command-registry.ts +4 -3
  69. package/scripts/harness/harness-api/domain/services/status-derivation-service.ts +1 -0
  70. package/scripts/harness/harness-api/domain/value-objects/artifact-scan-result.ts +1 -0
  71. package/scripts/harness/harness-api/domain/value-objects/check-ready-result.ts +1 -0
  72. package/scripts/harness/harness-api/domain/value-objects/ci-check-result.ts +1 -0
  73. package/scripts/harness/harness-api/domain/value-objects/cli-command-definition.ts +11 -10
  74. package/scripts/harness/harness-api/domain/value-objects/command-input-spec.ts +1 -0
  75. package/scripts/harness/harness-api/domain/value-objects/drift-report-summary.ts +1 -0
  76. package/scripts/harness/harness-api/domain/value-objects/exit-code-spec.ts +1 -0
  77. package/scripts/harness/harness-api/domain/value-objects/harness-api-response.ts +1 -0
  78. package/scripts/harness/harness-api/domain/value-objects/harness-status-summary.ts +1 -0
  79. package/scripts/harness/harness-api/domain/value-objects/layer-health.ts +1 -0
  80. package/scripts/harness/harness-api/domain/value-objects/phase-info.ts +1 -0
  81. package/scripts/harness/harness-api/index.ts +1 -0
  82. package/scripts/harness/harness-api/infrastructure/adapters/biome-ast-engine-lint-adapter.ts +1 -0
  83. package/scripts/harness/harness-api/infrastructure/adapters/file-system-artifact-scanner-adapter.ts +1 -0
  84. package/scripts/harness/harness-api/infrastructure/adapters/harness-config-query-adapter.ts +1 -0
  85. package/scripts/harness/harness-api/infrastructure/adapters/nyquist-validation-impact-analysis-adapter.ts +1 -0
  86. package/scripts/harness/harness-api/infrastructure/adapters/phase-dependency-model-query-adapter.ts +1 -0
  87. package/scripts/harness/harness-api/infrastructure/adapters/validator-system-execution-adapter.ts +1 -0
  88. package/scripts/harness/harness-api/presentation/dto/cli-output-options.ts +1 -0
  89. package/scripts/harness/harness-api/presentation/formatters/harness-api-json-formatter.ts +1 -0
  90. package/scripts/harness/harness-api/presentation/handlers/check-phase-handler.ts +2 -1
  91. package/scripts/harness/harness-api/presentation/handlers/check-ready-handler.ts +2 -1
  92. package/scripts/harness/harness-api/presentation/handlers/ci-check-handler.ts +2 -1
  93. package/scripts/harness/harness-api/presentation/handlers/complete-check-handler.ts +2 -1
  94. package/scripts/harness/harness-api/presentation/handlers/detect-drift-handler.ts +2 -1
  95. package/scripts/harness/harness-api/presentation/handlers/impact-analysis-handler.ts +2 -1
  96. package/scripts/harness/harness-api/presentation/handlers/lint-handler.ts +2 -1
  97. package/scripts/harness/harness-api/presentation/handlers/status-handler.ts +4 -3
  98. package/scripts/harness/harness-error/infrastructure/adapters/legacy-error-reporter-adapter.ts +7 -1
  99. package/scripts/harness/integrations/pre-commit.ts +1 -0
  100. package/scripts/harness/main.ts +173 -53
  101. package/scripts/harness/phase-dependency-model/application/dto/resolve-gate-result-dto.ts +14 -0
  102. package/scripts/harness/phase-dependency-model/application/services/phase-gate-result-mapper.ts +20 -0
  103. package/scripts/harness/phase-dependency-model/application/usecases/check-story-reflection-usecase.ts +42 -0
  104. package/scripts/harness/phase-dependency-model/application/usecases/resolve-gate-usecase.ts +161 -0
  105. package/scripts/harness/phase-dependency-model/composition-root.ts +57 -1
  106. package/scripts/harness/phase-dependency-model/domain/definitions/{default-phase-dependencies.ts → full-phase-dependencies.ts} +3 -3
  107. package/scripts/harness/phase-dependency-model/domain/definitions/{default-phase-nodes.ts → full-phase-nodes.ts} +1 -1
  108. package/scripts/harness/phase-dependency-model/domain/definitions/full-story-reflection-defaults.ts +28 -0
  109. package/scripts/harness/phase-dependency-model/domain/definitions/minimal-phase-dependencies.ts +32 -0
  110. package/scripts/harness/phase-dependency-model/domain/definitions/minimal-phase-nodes.ts +50 -0
  111. package/scripts/harness/phase-dependency-model/domain/definitions/minimal-story-reflection-defaults.ts +8 -0
  112. package/scripts/harness/phase-dependency-model/domain/definitions/standard-phase-dependencies.ts +39 -0
  113. package/scripts/harness/phase-dependency-model/domain/definitions/standard-phase-nodes.ts +118 -0
  114. package/scripts/harness/phase-dependency-model/domain/definitions/standard-story-reflection-defaults.ts +23 -0
  115. package/scripts/harness/phase-dependency-model/domain/models/phase-structure.ts +95 -23
  116. package/scripts/harness/phase-dependency-model/domain/ports/glob-matcher-port.ts +8 -0
  117. package/scripts/harness/phase-dependency-model/domain/ports/phase-config-provider-port.ts +2 -0
  118. package/scripts/harness/phase-dependency-model/domain/ports/story-annotation-verifier-port.ts +14 -0
  119. package/scripts/harness/phase-dependency-model/domain/ports/story-reflection-file-system-port.ts +16 -0
  120. package/scripts/harness/phase-dependency-model/domain/services/gate-graph.ts +223 -0
  121. package/scripts/harness/phase-dependency-model/domain/services/story-reflection-checker.ts +66 -0
  122. package/scripts/harness/phase-dependency-model/domain/values/gate-definition.ts +127 -0
  123. package/scripts/harness/phase-dependency-model/domain/values/gate-name.ts +40 -0
  124. package/scripts/harness/phase-dependency-model/domain/values/gate-story-annotation.ts +39 -0
  125. package/scripts/harness/phase-dependency-model/domain/values/phase-customization-policy.ts +16 -4
  126. package/scripts/harness/phase-dependency-model/domain/values/story-reflection-config.ts +44 -0
  127. package/scripts/harness/phase-dependency-model/domain/values/story-reflection-mapping.ts +91 -0
  128. package/scripts/harness/phase-dependency-model/domain/values/story-reflection-result.ts +55 -0
  129. package/scripts/harness/phase-dependency-model/infrastructure/adapters/picomatch-glob-matcher.ts +17 -0
  130. package/scripts/harness/phase-dependency-model/infrastructure/adapters/story-annotation-verifier-adapter.ts +46 -0
  131. package/scripts/harness/phase-dependency-model/infrastructure/config/custom-gates-config-parser.ts +22 -0
  132. package/scripts/harness/phase-dependency-model/infrastructure/config/harness-config-phase-config-provider.ts +78 -2
  133. package/scripts/harness/phase-dependency-model/infrastructure/filesystem/file-system-story-reflection-adapter.ts +94 -0
  134. package/scripts/harness/phase-dependency-model/presentation/cli/check-phase-gate-command-handler.ts +12 -4
  135. package/scripts/harness/phase-dependency-model/presentation/cli/story-reflection-status-presenter.ts +87 -0
  136. package/scripts/harness/quick-mode/application/usecases/execute-quick-ci-check-usecase.ts +1 -1
  137. package/scripts/harness/quick-mode/presentation/handlers/ci-check-quick-mode-handler.ts +1 -1
  138. package/scripts/harness/regression-suite/application/dto/analyze-migration-input.ts +1 -0
  139. package/scripts/harness/regression-suite/application/dto/analyze-migration-output.ts +1 -0
  140. package/scripts/harness/regression-suite/application/dto/configure-ci-gate-input.ts +1 -0
  141. package/scripts/harness/regression-suite/application/dto/configure-ci-gate-output.ts +1 -0
  142. package/scripts/harness/regression-suite/application/dto/migrate-v0-tests-input.ts +1 -0
  143. package/scripts/harness/regression-suite/application/dto/migrate-v0-tests-output.ts +1 -0
  144. package/scripts/harness/regression-suite/application/dto/run-regression-suite-input.ts +1 -0
  145. package/scripts/harness/regression-suite/application/dto/run-regression-suite-output.ts +1 -0
  146. package/scripts/harness/regression-suite/application/mappers/migration-mapping-mapper.ts +1 -0
  147. package/scripts/harness/regression-suite/application/mappers/test-execution-summary-mapper.ts +1 -0
  148. package/scripts/harness/regression-suite/application/usecases/analyze-v0-migration-usecase.ts +1 -0
  149. package/scripts/harness/regression-suite/application/usecases/configure-ci-gate-usecase.ts +1 -0
  150. package/scripts/harness/regression-suite/application/usecases/migrate-v0-tests-usecase.ts +1 -0
  151. package/scripts/harness/regression-suite/application/usecases/run-agent-independence-guard-usecase.ts +1 -0
  152. package/scripts/harness/regression-suite/application/usecases/run-gng-gate-regression-usecase.ts +1 -0
  153. package/scripts/harness/regression-suite/application/usecases/run-k-requirements-regression-usecase.ts +1 -0
  154. package/scripts/harness/regression-suite/application/usecases/run-k14-k15-regression-usecase.ts +1 -0
  155. package/scripts/harness/regression-suite/composition-root.ts +1 -0
  156. package/scripts/harness/regression-suite/domain/aggregates/v0-test-migration.ts +1 -0
  157. package/scripts/harness/regression-suite/domain/ports/ci-gate-result-writer-port.ts +1 -0
  158. package/scripts/harness/regression-suite/domain/ports/config-query-port.ts +1 -0
  159. package/scripts/harness/regression-suite/domain/ports/import-analyzer-port.ts +1 -0
  160. package/scripts/harness/regression-suite/domain/ports/migration-mapping-repository-port.ts +1 -0
  161. package/scripts/harness/regression-suite/domain/ports/suite-registry-port.ts +1 -0
  162. package/scripts/harness/regression-suite/domain/ports/test-runner-port.ts +1 -0
  163. package/scripts/harness/regression-suite/domain/ports/v0-spec-reader-port.ts +1 -0
  164. package/scripts/harness/regression-suite/domain/services/import-guard-service.ts +1 -0
  165. package/scripts/harness/regression-suite/domain/services/migration-analyzer.ts +1 -0
  166. package/scripts/harness/regression-suite/domain/services/regression-runner.ts +1 -0
  167. package/scripts/harness/regression-suite/domain/value-objects/agent-independence-test.ts +1 -0
  168. package/scripts/harness/regression-suite/domain/value-objects/biome-modification-spec.ts +1 -0
  169. package/scripts/harness/regression-suite/domain/value-objects/ci-gate-config.ts +1 -0
  170. package/scripts/harness/regression-suite/domain/value-objects/coverage-rate.ts +1 -0
  171. package/scripts/harness/regression-suite/domain/value-objects/gng-condition-test.ts +1 -0
  172. package/scripts/harness/regression-suite/domain/value-objects/import-violation.ts +1 -0
  173. package/scripts/harness/regression-suite/domain/value-objects/k-requirement-test.ts +1 -0
  174. package/scripts/harness/regression-suite/domain/value-objects/migration-mapping.ts +1 -0
  175. package/scripts/harness/regression-suite/domain/value-objects/regression-suite-definition.ts +1 -0
  176. package/scripts/harness/regression-suite/domain/value-objects/suite-id.ts +1 -0
  177. package/scripts/harness/regression-suite/domain/value-objects/test-execution-summary.ts +1 -0
  178. package/scripts/harness/regression-suite/domain/value-objects/test-failure-detail.ts +1 -0
  179. package/scripts/harness/regression-suite/domain/value-objects/v0-test-id.ts +1 -0
  180. package/scripts/harness/regression-suite/domain/value-objects/v1-test-path.ts +1 -0
  181. package/scripts/harness/regression-suite/infrastructure/adapters/biome-ast-import-analyzer-adapter.ts +1 -0
  182. package/scripts/harness/regression-suite/infrastructure/adapters/file-system-v0-spec-reader-adapter.ts +1 -0
  183. package/scripts/harness/regression-suite/infrastructure/adapters/harness-config-query-adapter.ts +1 -0
  184. package/scripts/harness/regression-suite/infrastructure/adapters/json-ci-gate-result-writer-adapter.ts +1 -0
  185. package/scripts/harness/regression-suite/infrastructure/adapters/markdown-migration-mapping-repository-adapter.ts +1 -0
  186. package/scripts/harness/regression-suite/infrastructure/adapters/static-suite-registry-adapter.ts +1 -0
  187. package/scripts/harness/regression-suite/infrastructure/adapters/vitest-test-runner-adapter.ts +1 -0
  188. package/scripts/harness/regression-suite/infrastructure/registry/agent-independence-suite-definition.ts +1 -0
  189. package/scripts/harness/regression-suite/infrastructure/registry/gng-gate-suite-definition.ts +1 -0
  190. package/scripts/harness/regression-suite/infrastructure/registry/k-requirements-suite-definition.ts +1 -0
  191. package/scripts/harness/regression-suite/infrastructure/registry/v0-migration-suite-definition.ts +1 -0
  192. package/scripts/harness/setup/skill-deployer.ts +82 -5
  193. package/scripts/harness/shared-kernel/harness-api.ts +1 -0
  194. package/scripts/harness/skill-quality/composition-root.ts +1 -0
  195. package/scripts/harness/skill-quality/infrastructure/adapters/ajv-lesson-artifact-schema-adapter.ts +5 -4
  196. package/scripts/harness/traceability-model/domain/services/metadata-validator.ts +12 -10
  197. package/scripts/harness/traceability-model/infrastructure/parsers/source-metadata-parser.ts +16 -2
  198. package/scripts/harness/validator-system/composition-root.ts +3 -3
  199. package/skills/cascade-updater/SKILL.md +16 -3
  200. package/skills/codebase-mapper/SKILL.md +9 -9
  201. package/skills/codex-delegator/SKILL.md +5 -56
  202. package/skills/consistency-checker/SKILL.md +5 -9
  203. package/skills/consistency-checker/references//343/203/201/343/202/247/343/203/203/343/202/257/343/203/252/343/202/271/343/203/210.md +6 -3
  204. package/skills/doc-freshness-checker/SKILL.md +6 -6
  205. package/skills/engineering-perspective/SKILL.md +2 -58
  206. package/skills/engineering-perspective/references/domain-model.md +4 -135
  207. package/skills/implementation-readiness-checker/SKILL.md +18 -72
  208. package/skills/it-test-designer/SKILL.md +25 -161
  209. package/skills/it-test-designer/references/it-test-design-template.md +131 -0
  210. package/skills/it-test-logic-designer/SKILL.md +13 -388
  211. package/skills/it-test-logic-designer/references/controller-test-patterns.md +100 -0
  212. package/skills/it-test-logic-designer/references/repository-test-patterns.md +206 -0
  213. package/skills/it-test-logic-designer/references/usecase-test-patterns.md +87 -0
  214. package/skills/pointer-validator/SKILL.md +4 -4
  215. package/skills/scenario-test-designer/SKILL.md +4 -68
  216. package/skills/scenario-test-designer/references/scenario-test-design-template.md +41 -0
  217. package/skills/scenario-test-designer/references/scenario-test-plan-template.md +35 -0
  218. package/skills/scenario-test-logic-designer/SKILL.md +21 -304
  219. package/skills/scenario-test-logic-designer/references/msw-patterns.md +36 -0
  220. package/skills/scenario-test-logic-designer/references/playwright-patterns.md +237 -0
  221. package/skills/test-coverage-checker/SKILL.md +39 -121
  222. package/skills/test-coverage-checker/references/coverage-report-template.md +99 -0
  223. package/skills/uiux-designer/SKILL.md +27 -92
  224. package/skills/uiux-designer/references/data-testid-convention.md +38 -0
  225. package/skills/uiux-designer/references/uiux-design-template.md +105 -0
  226. package/skills/unit-test-designer/SKILL.md +5 -106
  227. package/skills/unit-test-designer/references/unit-test-design-template.md +127 -0
  228. package/skills/unit-test-logic-designer/SKILL.md +28 -250
  229. package/skills/unit-test-logic-designer/references/test-patterns.md +207 -0
@@ -16,7 +16,10 @@
16
16
  "project": {
17
17
  "type": "object",
18
18
  "additionalProperties": false,
19
- "required": ["name", "preset"],
19
+ "required": [
20
+ "name",
21
+ "preset"
22
+ ],
20
23
  "properties": {
21
24
  "name": {
22
25
  "type": "string",
@@ -24,7 +27,11 @@
24
27
  },
25
28
  "preset": {
26
29
  "type": "string",
27
- "enum": ["minimal", "standard", "strict"]
30
+ "enum": [
31
+ "minimal",
32
+ "standard",
33
+ "strict"
34
+ ]
28
35
  }
29
36
  }
30
37
  },
@@ -152,11 +159,19 @@
152
159
  "phaseDependencies": {
153
160
  "type": "object",
154
161
  "additionalProperties": false,
155
- "required": ["preset", "override", "customRules"],
162
+ "required": [
163
+ "preset"
164
+ ],
156
165
  "properties": {
157
166
  "preset": {
158
167
  "type": "string",
159
- "enum": ["default", "custom"]
168
+ "enum": [
169
+ "default",
170
+ "full",
171
+ "standard",
172
+ "minimal",
173
+ "custom"
174
+ ]
160
175
  },
161
176
  "override": {
162
177
  "type": "boolean"
@@ -166,7 +181,10 @@
166
181
  "items": {
167
182
  "type": "object",
168
183
  "additionalProperties": false,
169
- "required": ["phase", "requires"],
184
+ "required": [
185
+ "phase",
186
+ "requires"
187
+ ],
170
188
  "properties": {
171
189
  "phase": {
172
190
  "type": "string",
@@ -180,23 +198,160 @@
180
198
  }
181
199
  }
182
200
  }
201
+ },
202
+ "gates": {
203
+ "type": "array",
204
+ "items": {
205
+ "type": "object",
206
+ "additionalProperties": false,
207
+ "required": [
208
+ "name",
209
+ "level",
210
+ "requires",
211
+ "blocks",
212
+ "dependsOn"
213
+ ],
214
+ "properties": {
215
+ "name": {
216
+ "type": "string",
217
+ "pattern": "^[a-z][a-z0-9-]*$"
218
+ },
219
+ "level": {
220
+ "type": "integer",
221
+ "enum": [
222
+ 1,
223
+ 2,
224
+ 3
225
+ ]
226
+ },
227
+ "requires": {
228
+ "type": "array",
229
+ "items": {
230
+ "type": "object",
231
+ "additionalProperties": false,
232
+ "required": [
233
+ "path",
234
+ "required"
235
+ ],
236
+ "properties": {
237
+ "path": {
238
+ "type": "string",
239
+ "minLength": 1
240
+ },
241
+ "required": {
242
+ "type": "boolean"
243
+ }
244
+ }
245
+ }
246
+ },
247
+ "blocks": {
248
+ "type": "array",
249
+ "items": {
250
+ "type": "string",
251
+ "minLength": 1
252
+ }
253
+ },
254
+ "dependsOn": {
255
+ "type": "array",
256
+ "items": {
257
+ "type": "string",
258
+ "pattern": "^[a-z][a-z0-9-]*$"
259
+ }
260
+ },
261
+ "storyAnnotation": {
262
+ "type": "object",
263
+ "additionalProperties": false,
264
+ "required": [
265
+ "required",
266
+ "tag"
267
+ ],
268
+ "properties": {
269
+ "required": {
270
+ "type": "boolean"
271
+ },
272
+ "tag": {
273
+ "type": "string",
274
+ "minLength": 1
275
+ }
276
+ }
277
+ }
278
+ },
279
+ "allOf": [
280
+ {
281
+ "if": {
282
+ "required": [
283
+ "storyAnnotation"
284
+ ]
285
+ },
286
+ "then": {
287
+ "properties": {
288
+ "level": {
289
+ "const": 3
290
+ }
291
+ }
292
+ }
293
+ }
294
+ ]
295
+ }
296
+ },
297
+ "storyReflection": {
298
+ "type": "object",
299
+ "additionalProperties": false,
300
+ "properties": {
301
+ "enabled": {
302
+ "type": "boolean"
303
+ },
304
+ "mappings": {
305
+ "type": "array",
306
+ "items": {
307
+ "type": "object",
308
+ "additionalProperties": false,
309
+ "required": [
310
+ "unitId",
311
+ "artifacts"
312
+ ],
313
+ "properties": {
314
+ "unitId": {
315
+ "type": "string",
316
+ "minLength": 1
317
+ },
318
+ "artifacts": {
319
+ "type": "array",
320
+ "items": {
321
+ "type": "string",
322
+ "minLength": 1
323
+ }
324
+ }
325
+ }
326
+ }
327
+ }
328
+ }
183
329
  }
184
330
  }
185
331
  },
186
332
  "planningMode": {
187
333
  "type": "object",
188
334
  "additionalProperties": false,
189
- "required": ["default", "perPhase"],
335
+ "required": [
336
+ "default",
337
+ "perPhase"
338
+ ],
190
339
  "properties": {
191
340
  "default": {
192
341
  "type": "string",
193
- "enum": ["interactive", "embedded-qa"]
342
+ "enum": [
343
+ "interactive",
344
+ "embedded-qa"
345
+ ]
194
346
  },
195
347
  "perPhase": {
196
348
  "type": "object",
197
349
  "additionalProperties": {
198
350
  "type": "string",
199
- "enum": ["interactive", "embedded-qa"]
351
+ "enum": [
352
+ "interactive",
353
+ "embedded-qa"
354
+ ]
200
355
  }
201
356
  }
202
357
  }
@@ -223,7 +378,10 @@
223
378
  "paths": {
224
379
  "type": "object",
225
380
  "additionalProperties": false,
226
- "required": ["designDocs", "inceptionDocs"],
381
+ "required": [
382
+ "designDocs",
383
+ "inceptionDocs"
384
+ ],
227
385
  "properties": {
228
386
  "designDocs": {
229
387
  "type": "string",
@@ -238,7 +396,10 @@
238
396
  "reporting": {
239
397
  "type": "object",
240
398
  "additionalProperties": false,
241
- "required": ["format", "outputDir"],
399
+ "required": [
400
+ "format",
401
+ "outputDir"
402
+ ],
242
403
  "properties": {
243
404
  "format": {
244
405
  "type": "string",
@@ -249,6 +410,20 @@
249
410
  "minLength": 1
250
411
  }
251
412
  }
413
+ },
414
+ "protectedFiles": {
415
+ "type": "object",
416
+ "additionalProperties": false,
417
+ "properties": {
418
+ "exclude": {
419
+ "type": "array",
420
+ "items": {
421
+ "type": "string",
422
+ "minLength": 1
423
+ },
424
+ "uniqueItems": true
425
+ }
426
+ }
252
427
  }
253
428
  }
254
429
  }
@@ -5,7 +5,8 @@
5
5
  import fs from 'node:fs';
6
6
  import path from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
- import Ajv, { type ErrorObject, type ValidateFunction } from 'ajv';
8
+ import AjvModule, { type ErrorObject, type ValidateFunction } from 'ajv';
9
+ const Ajv = AjvModule.default ?? AjvModule;
9
10
  import { HarnessError } from '../../../harness-error/domain/value-objects/harness-error.js';
10
11
  import { ErrorCode } from '../../../harness-error/domain/value-objects/error-code.js';
11
12
  import { Severity } from '../../../harness-error/domain/value-objects/severity.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // command-dispatch-input.ts — CommandDispatchInput DTO
2
3
 
3
4
  export interface CommandDispatchInput {
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // command-dispatch-output.ts — CommandDispatchOutput DTO
2
3
 
3
4
  import type { ExitCode } from '../../domain/value-objects/harness-api-response.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // exit-code-decision-input.ts — ExitCodeDecisionInput DTO
2
3
 
3
4
  import type { ResponseStatus } from '../../domain/value-objects/harness-api-response.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // exit-code-decision-output.ts — ExitCodeDecisionOutput DTO
2
3
 
3
4
  import type { ExitCode } from '../../domain/value-objects/harness-api-response.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // harness-api-response-contract.ts — Cross-Unit Contract DTO
2
3
 
3
4
  import type { ResponseStatus, HarnessError, ResponseSummary } from '../../domain/value-objects/harness-api-response.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // initialize-registry-input.ts — InitializeRegistryInput DTO
2
3
 
3
4
  export interface CliCommandDefinitionInput {
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // registry-summary-output.ts — RegistrySummaryOutput DTO
2
3
 
3
4
  import type { CommandName } from '../../domain/value-objects/cli-command-definition.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // status-derivation-input.ts — StatusDerivationInput DTO
2
3
 
3
4
  // Currently no parameters — extensible for future filter conditions
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // harness-api-response-mapper.ts — HarnessApiResponseMapper
2
3
 
3
4
  import type { HarnessApiResponse } from '../../domain/value-objects/harness-api-response.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // decide-exit-code-usecase.ts — DecideExitCodeUseCase
2
3
 
3
4
  import type { ExitCodeDecisionInput } from '../dto/exit-code-decision-input.js';
@@ -8,11 +9,11 @@ export class DecideExitCodeUseCase {
8
9
  execute(input: ExitCodeDecisionInput): ExitCodeDecisionOutput {
9
10
  const { status, commandName } = input;
10
11
 
11
- // D5ルール: harness:status は fail でも exitCode=0 を返す
12
- if (commandName === 'harness:status' && status === 'fail') {
12
+ // D5ルール: phasegate:status は fail でも exitCode=0 を返す
13
+ if (commandName === 'phasegate:status' && status === 'fail') {
13
14
  return {
14
15
  exitCode: 0 as ExitCode,
15
- reason: 'D5ルール適用: harness:statusコマンドはfailでもexitCode=0を返す(情報提供コマンドのため)',
16
+ reason: 'D5ルール適用: phasegate:statusコマンドはfailでもexitCode=0を返す(情報提供コマンドのため)',
16
17
  };
17
18
  }
18
19
 
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // derive-harness-status-usecase.ts — DeriveHarnessStatusUseCase
2
3
 
3
4
  import type { ArtifactScannerPort } from '../../domain/ports/artifact-scanner-port.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // dispatch-command-usecase.ts — DispatchCommandUseCase
2
3
 
3
4
  import { CommandRegistry } from '../../domain/services/command-registry.js';
@@ -1,3 +1,4 @@
1
+ // @layer application
1
2
  // initialize-command-registry-usecase.ts — InitializeCommandRegistryUseCase
2
3
 
3
4
  import { CliCommandDefinition } from '../../domain/value-objects/cli-command-definition.js';
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // composition-root.ts — harness-api Composition Root
2
3
 
3
4
  import { CommandRegistry } from './domain/services/command-registry.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // artifact-scanner-port.ts
2
3
 
3
4
  import type { ArtifactScanResult } from '../value-objects/artifact-scan-result.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // biome-lint-port.ts
2
3
 
3
4
  import type { HarnessError } from '../value-objects/harness-api-response.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // config-query-port.ts
2
3
 
3
4
  import type { PresetInfo, ConfigSummary, PhaseGateSummary } from '../value-objects/harness-status-summary.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // impact-analysis-port.ts
2
3
 
3
4
  export interface ImpactAnalysisResult {
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // phase-gate-query-port.ts
2
3
 
3
4
  import type { PhaseGateStoryResult } from '../value-objects/check-ready-result.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // validator-execution-port.ts
2
3
 
3
4
  import type { ValidatorCheckItem } from '../value-objects/ci-check-result.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // command-dispatch-service.ts — CommandDispatchService Domain Service
2
3
 
3
4
  import { CommandRegistry } from './command-registry.js';
@@ -35,14 +36,14 @@ function makeError(message: string): HarnessError {
35
36
  }
36
37
 
37
38
  const KNOWN_COMMANDS = new Set([
38
- 'harness:check-ready',
39
- 'harness:check-phase',
40
- 'harness:ci-check',
41
- 'harness:detect-drift',
42
- 'harness:status',
43
- 'harness:lint',
44
- 'harness:complete-check',
45
- 'harness:impact-analysis',
39
+ 'phasegate:check-ready',
40
+ 'phasegate:check-phase',
41
+ 'phasegate:ci-check',
42
+ 'phasegate:detect-drift',
43
+ 'phasegate:status',
44
+ 'phasegate:lint',
45
+ 'phasegate:complete-check',
46
+ 'phasegate:impact-analysis',
46
47
  ]);
47
48
 
48
49
  export class CommandDispatchService {
@@ -104,7 +105,7 @@ export class CommandDispatchService {
104
105
  summary: { totalChecks: number; passed: number; failed: number; warnings: number }
105
106
  ): Promise<DispatchResult<T>> {
106
107
  switch (commandName) {
107
- case 'harness:check-ready': {
108
+ case 'phasegate:check-ready': {
108
109
  const stories = await this.ports.phaseGateQueryPort.queryAllStories();
109
110
  const result = CheckReadyResult.fromStories(stories);
110
111
  if (result.allPassed) {
@@ -117,7 +118,7 @@ export class CommandDispatchService {
117
118
  return { status: 'fail', errors: r.errors, summary: r.summary, data: result as unknown as T, exitCode: 1 };
118
119
  }
119
120
 
120
- case 'harness:check-phase': {
121
+ case 'phasegate:check-phase': {
121
122
  const unitId = args.unit ?? '';
122
123
  const phaseInfo = await this.ports.phaseGateQueryPort.queryUnit(unitId);
123
124
  if (phaseInfo === null) {
@@ -129,7 +130,7 @@ export class CommandDispatchService {
129
130
  return { status: 'pass', errors: [], summary: r.summary, data: phaseInfo as unknown as T, exitCode: 0 };
130
131
  }
131
132
 
132
- case 'harness:ci-check': {
133
+ case 'phasegate:ci-check': {
133
134
  const validatorResults = await this.ports.validatorExecutionPort.runL3Validators();
134
135
  const result = CiCheckResult.fromResults(validatorResults);
135
136
  if (result.allPassed) {
@@ -144,7 +145,7 @@ export class CommandDispatchService {
144
145
  return { status: 'fail', errors: r.errors, summary: r.summary, data: result as unknown as T, exitCode: 1 };
145
146
  }
146
147
 
147
- case 'harness:detect-drift': {
148
+ case 'phasegate:detect-drift': {
148
149
  const drifts = await this.ports.validatorExecutionPort.runDriftDetection();
149
150
  const result = DriftReportSummary.fromDrifts(drifts);
150
151
  if (!result.hasDrift()) {
@@ -156,7 +157,7 @@ export class CommandDispatchService {
156
157
  return { status: 'fail', errors: r.errors, summary: r.summary, data: result as unknown as T, exitCode: 1 };
157
158
  }
158
159
 
159
- case 'harness:status': {
160
+ case 'phasegate:status': {
160
161
  const scanResult = await this.ports.artifactScannerPort.scan();
161
162
  let presetInfo = { name: 'standard' as const, enabledLayers: ['L1', 'L2', 'L3'] as ('L1' | 'L2' | 'L3' | 'L4')[] };
162
163
  const configPort = this.ports.configQueryPort;
@@ -176,7 +177,7 @@ export class CommandDispatchService {
176
177
  return { status: 'pass', errors: [], summary: r.summary, data: statusSummary as unknown as T, exitCode: 0 };
177
178
  }
178
179
 
179
- case 'harness:lint': {
180
+ case 'phasegate:lint': {
180
181
  const lintResult = await this.ports.biomeLintPort.runLint();
181
182
  if (lintResult.passed) {
182
183
  const r = HarnessApiResponse.pass({ ...summary, passed: 1 });
@@ -187,7 +188,7 @@ export class CommandDispatchService {
187
188
  return { status: 'fail', errors: r.errors, summary: r.summary, data: undefined, exitCode: 1 };
188
189
  }
189
190
 
190
- case 'harness:complete-check': {
191
+ case 'phasegate:complete-check': {
191
192
  const [validatorResults, lintResult] = await Promise.all([
192
193
  this.ports.validatorExecutionPort.runAllValidators(),
193
194
  this.ports.biomeLintPort.runLint(),
@@ -211,7 +212,7 @@ export class CommandDispatchService {
211
212
  return { status: 'fail', errors: r.errors, summary: r.summary, data: undefined, exitCode: 1 };
212
213
  }
213
214
 
214
- case 'harness:impact-analysis': {
215
+ case 'phasegate:impact-analysis': {
215
216
  const storyId = args.storyId ?? '';
216
217
  const result = await this.ports.impactAnalysisPort.analyze(storyId);
217
218
  if (result === null) {
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // command-registry.ts — CommandRegistry Domain Service
2
3
 
3
4
  import { CliCommandDefinition, type CommandName } from '../value-objects/cli-command-definition.js';
@@ -6,12 +7,12 @@ export class CommandRegistry {
6
7
  private readonly commands: Map<string, CliCommandDefinition> = new Map();
7
8
 
8
9
  registerCommand(definition: CliCommandDefinition): void {
9
- // INV-2: harness: プレフィックス必須
10
+ // INV-2: phasegate: プレフィックス必須
10
11
  if (!definition.commandName || definition.commandName.trim() === '') {
11
12
  throw new Error('HarnessApiDomainError: commandName must not be empty');
12
13
  }
13
- if (!definition.commandName.startsWith('harness:')) {
14
- throw new Error(`DuplicateCommandNameError: commandName must start with 'harness:': ${definition.commandName}`);
14
+ if (!definition.commandName.startsWith('phasegate:')) {
15
+ throw new Error(`DuplicateCommandNameError: commandName must start with 'phasegate:': ${definition.commandName}`);
15
16
  }
16
17
  // INV-1: 同一コマンド名の重複禁止
17
18
  if (this.commands.has(definition.commandName)) {
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // status-derivation-service.ts — StatusDerivationService Domain Service
2
3
 
3
4
  import { LayerHealth, type LayerId } from '../value-objects/layer-health.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // artifact-scan-result.ts — ArtifactScanResult Value Object
2
3
 
3
4
  import type { LayerHealth, LayerId } from './layer-health.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // check-ready-result.ts — CheckReadyResult Value Object
2
3
 
3
4
  export interface PhaseGateStoryResult {
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // ci-check-result.ts — CiCheckResult Value Object
2
3
 
3
4
  import type { HarnessError } from './harness-api-response.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // cli-command-definition.ts — CliCommandDefinition Value Object
2
3
 
3
4
  import { CommandInputSpec } from './command-input-spec.js';
@@ -15,17 +16,17 @@ export type CommandOutputType =
15
16
  | 'complete-check'
16
17
  | 'impact-analysis';
17
18
 
18
- const COMMAND_NAME_REGEX = /^harness:[a-z][a-z0-9-]*$/;
19
+ const COMMAND_NAME_REGEX = /^phasegate:[a-z][a-z0-9-]*$/;
19
20
 
20
21
  const OUTPUT_TYPE_MAP: Record<string, CommandOutputType> = {
21
- 'harness:check-ready': 'check-ready',
22
- 'harness:check-phase': 'check-phase',
23
- 'harness:ci-check': 'ci-check',
24
- 'harness:detect-drift': 'detect-drift',
25
- 'harness:status': 'status',
26
- 'harness:lint': 'lint',
27
- 'harness:complete-check': 'complete-check',
28
- 'harness:impact-analysis': 'impact-analysis',
22
+ 'phasegate:check-ready': 'check-ready',
23
+ 'phasegate:check-phase': 'check-phase',
24
+ 'phasegate:ci-check': 'ci-check',
25
+ 'phasegate:detect-drift': 'detect-drift',
26
+ 'phasegate:status': 'status',
27
+ 'phasegate:lint': 'lint',
28
+ 'phasegate:complete-check': 'complete-check',
29
+ 'phasegate:impact-analysis': 'impact-analysis',
29
30
  };
30
31
 
31
32
  export interface CliCommandDefinitionProps {
@@ -68,7 +69,7 @@ export class CliCommandDefinition {
68
69
  }
69
70
  ): CliCommandDefinition {
70
71
  if (!commandName || !COMMAND_NAME_REGEX.test(commandName)) {
71
- throw new Error(`InvalidCommandNameError: invalid command name '${commandName}'. Must match ^harness:[a-z][a-z0-9-]*$`);
72
+ throw new Error(`InvalidCommandNameError: invalid command name '${commandName}'. Must match ^phasegate:[a-z][a-z0-9-]*$`);
72
73
  }
73
74
 
74
75
  const outputType =
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // command-input-spec.ts — CommandInputSpec Value Object
2
3
 
3
4
  export interface ArgDef {
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // drift-report-summary.ts — DriftReportSummary Value Object
2
3
 
3
4
  export interface DriftItem {
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // exit-code-spec.ts — ExitCodeSpec Value Object
2
3
 
3
4
  export class ExitCodeSpec {
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // harness-api-response.ts — HarnessApiResponse<T> Value Object
2
3
 
3
4
  export type ResponseStatus = 'pass' | 'fail' | 'error';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // harness-status-summary.ts — HarnessStatusSummary Value Object
2
3
 
3
4
  import type { LayerHealth, LayerId } from './layer-health.js';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // layer-health.ts — LayerHealth Value Object
2
3
 
3
4
  export type LayerId = 'L1' | 'L2' | 'L3' | 'L4';
@@ -1,3 +1,4 @@
1
+ // @layer domain
1
2
  // phase-info.ts — PhaseInfo Value Object
2
3
 
3
4
  export interface PhaseInfoProps {
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // index.ts — harness-api public barrel export
2
3
 
3
4
  // Composition Root
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // biome-ast-engine-lint-adapter.ts — BiomeAstEngineLintAdapter
2
3
  // Wave 2完了後にリアル実装へ差し替え(旧: @stub: wave2-pending)
3
4