phasegate 0.16.0 → 0.32.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 (215) hide show
  1. package/README.ja.md +74 -42
  2. package/README.md +69 -9
  3. package/docs/ADR/ADR-013-story-reflection-gate.md +100 -0
  4. package/docs/guide/configuration.md +244 -7
  5. package/package.json +7 -5
  6. package/scripts/harness/adr-foundation/domain/ports/adr-document-parser-port.ts +1 -0
  7. package/scripts/harness/adr-foundation/domain/ports/adr-frontmatter-parser-port.ts +1 -0
  8. package/scripts/harness/adr-foundation/domain/ports/adr-repository-port.ts +1 -0
  9. package/scripts/harness/adr-foundation/domain/value-objects/adr-status.ts +6 -6
  10. package/scripts/harness/agent-integration/application/dto/handle-pre-tool-use-dto.ts +3 -1
  11. package/scripts/harness/agent-integration/application/usecases/handle-pre-tool-use-usecase.ts +108 -2
  12. package/scripts/harness/agent-integration/domain/ports/config-query-port.ts +2 -0
  13. package/scripts/harness/agent-integration/domain/ports/phase-gate-query-port.ts +1 -1
  14. package/scripts/harness/agent-integration/domain/ports/story-reflection-query-port.ts +8 -0
  15. package/scripts/harness/agent-integration/domain/services/bash-write-target-extractor.ts +258 -0
  16. package/scripts/harness/agent-integration/domain/services/hook-to-cli-translator.ts +21 -4
  17. package/scripts/harness/agent-integration/domain/value-objects/protected-file-list.ts +20 -0
  18. package/scripts/harness/agent-integration/domain/value-objects/story-reflection-query-result.ts +63 -0
  19. package/scripts/harness/agent-integration/infrastructure/adapters/file-system-story-reflection-query-adapter.ts +122 -0
  20. package/scripts/harness/agent-integration/infrastructure/adapters/harness-config-config-query-adapter.ts +20 -0
  21. package/scripts/harness/agent-integration/infrastructure/adapters/phase-gate-query-adapter.ts +17 -3
  22. package/scripts/harness/agent-integration/presentation/pre-tool-use-hook.ts +29 -2
  23. package/scripts/harness/biome-ast-engine/domain/services/lint-runner.ts +24 -0
  24. package/scripts/harness/biome-ast-engine/domain/services/rule-definition-registry.ts +1 -1
  25. package/scripts/harness/biome-ast-engine/domain/value-objects/source-module-snapshot.ts +5 -2
  26. package/scripts/harness/biome-ast-engine/infrastructure/adapters/node-workspace-file-adapter.ts +1 -1
  27. package/scripts/harness/biome-ast-engine/infrastructure/adapters/typescript-source-module-analyzer-adapter.ts +1 -1
  28. package/scripts/harness/biome-ast-engine/infrastructure/parsers/unit-comment-parser.ts +12 -7
  29. package/scripts/harness/ci-governance/composition-root.ts +1 -0
  30. package/scripts/harness/config-foundation/application/mappers/phase-config-section-mapper.ts +44 -0
  31. package/scripts/harness/config-foundation/application/usecases/load-resolved-config-use-case.ts +20 -1
  32. package/scripts/harness/config-foundation/domain/harness-config.ts +2 -1
  33. package/scripts/harness/config-foundation/domain/value-objects/phase-dependencies-config.ts +18 -4
  34. package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json +185 -10
  35. package/scripts/harness/config-foundation/infrastructure/validators/ajv-config-schema-validator.ts +2 -1
  36. package/scripts/harness/harness-api/application/dto/command-dispatch-input.ts +1 -0
  37. package/scripts/harness/harness-api/application/dto/command-dispatch-output.ts +1 -0
  38. package/scripts/harness/harness-api/application/dto/exit-code-decision-input.ts +1 -0
  39. package/scripts/harness/harness-api/application/dto/exit-code-decision-output.ts +1 -0
  40. package/scripts/harness/harness-api/application/dto/harness-api-response-contract.ts +1 -0
  41. package/scripts/harness/harness-api/application/dto/initialize-registry-input.ts +1 -0
  42. package/scripts/harness/harness-api/application/dto/registry-summary-output.ts +1 -0
  43. package/scripts/harness/harness-api/application/dto/status-derivation-input.ts +1 -0
  44. package/scripts/harness/harness-api/application/mappers/harness-api-response-mapper.ts +1 -0
  45. package/scripts/harness/harness-api/application/usecases/decide-exit-code-usecase.ts +1 -0
  46. package/scripts/harness/harness-api/application/usecases/derive-harness-status-usecase.ts +1 -0
  47. package/scripts/harness/harness-api/application/usecases/dispatch-command-usecase.ts +1 -0
  48. package/scripts/harness/harness-api/application/usecases/initialize-command-registry-usecase.ts +1 -0
  49. package/scripts/harness/harness-api/composition-root.ts +1 -0
  50. package/scripts/harness/harness-api/domain/ports/artifact-scanner-port.ts +1 -0
  51. package/scripts/harness/harness-api/domain/ports/biome-lint-port.ts +1 -0
  52. package/scripts/harness/harness-api/domain/ports/config-query-port.ts +1 -0
  53. package/scripts/harness/harness-api/domain/ports/impact-analysis-port.ts +1 -0
  54. package/scripts/harness/harness-api/domain/ports/phase-gate-query-port.ts +1 -0
  55. package/scripts/harness/harness-api/domain/ports/validator-execution-port.ts +1 -0
  56. package/scripts/harness/harness-api/domain/services/command-dispatch-service.ts +1 -0
  57. package/scripts/harness/harness-api/domain/services/command-registry.ts +1 -0
  58. package/scripts/harness/harness-api/domain/services/status-derivation-service.ts +1 -0
  59. package/scripts/harness/harness-api/domain/value-objects/artifact-scan-result.ts +1 -0
  60. package/scripts/harness/harness-api/domain/value-objects/check-ready-result.ts +1 -0
  61. package/scripts/harness/harness-api/domain/value-objects/ci-check-result.ts +1 -0
  62. package/scripts/harness/harness-api/domain/value-objects/cli-command-definition.ts +1 -0
  63. package/scripts/harness/harness-api/domain/value-objects/command-input-spec.ts +1 -0
  64. package/scripts/harness/harness-api/domain/value-objects/drift-report-summary.ts +1 -0
  65. package/scripts/harness/harness-api/domain/value-objects/exit-code-spec.ts +1 -0
  66. package/scripts/harness/harness-api/domain/value-objects/harness-api-response.ts +1 -0
  67. package/scripts/harness/harness-api/domain/value-objects/harness-status-summary.ts +1 -0
  68. package/scripts/harness/harness-api/domain/value-objects/layer-health.ts +1 -0
  69. package/scripts/harness/harness-api/domain/value-objects/phase-info.ts +1 -0
  70. package/scripts/harness/harness-api/index.ts +1 -0
  71. package/scripts/harness/harness-api/infrastructure/adapters/biome-ast-engine-lint-adapter.ts +1 -0
  72. package/scripts/harness/harness-api/infrastructure/adapters/file-system-artifact-scanner-adapter.ts +1 -0
  73. package/scripts/harness/harness-api/infrastructure/adapters/harness-config-query-adapter.ts +1 -0
  74. package/scripts/harness/harness-api/infrastructure/adapters/nyquist-validation-impact-analysis-adapter.ts +1 -0
  75. package/scripts/harness/harness-api/infrastructure/adapters/phase-dependency-model-query-adapter.ts +1 -0
  76. package/scripts/harness/harness-api/infrastructure/adapters/validator-system-execution-adapter.ts +1 -0
  77. package/scripts/harness/harness-api/presentation/dto/cli-output-options.ts +1 -0
  78. package/scripts/harness/harness-api/presentation/formatters/harness-api-json-formatter.ts +1 -0
  79. package/scripts/harness/harness-api/presentation/handlers/check-phase-handler.ts +1 -0
  80. package/scripts/harness/harness-api/presentation/handlers/check-ready-handler.ts +1 -0
  81. package/scripts/harness/harness-api/presentation/handlers/ci-check-handler.ts +1 -0
  82. package/scripts/harness/harness-api/presentation/handlers/complete-check-handler.ts +1 -0
  83. package/scripts/harness/harness-api/presentation/handlers/detect-drift-handler.ts +1 -0
  84. package/scripts/harness/harness-api/presentation/handlers/impact-analysis-handler.ts +1 -0
  85. package/scripts/harness/harness-api/presentation/handlers/lint-handler.ts +1 -0
  86. package/scripts/harness/harness-api/presentation/handlers/status-handler.ts +1 -0
  87. package/scripts/harness/harness-error/infrastructure/adapters/legacy-error-reporter-adapter.ts +7 -1
  88. package/scripts/harness/integrations/pre-commit.ts +1 -0
  89. package/scripts/harness/main.ts +154 -34
  90. package/scripts/harness/phase-dependency-model/application/dto/resolve-gate-result-dto.ts +14 -0
  91. package/scripts/harness/phase-dependency-model/application/services/phase-gate-result-mapper.ts +20 -0
  92. package/scripts/harness/phase-dependency-model/application/usecases/check-story-reflection-usecase.ts +42 -0
  93. package/scripts/harness/phase-dependency-model/application/usecases/resolve-gate-usecase.ts +161 -0
  94. package/scripts/harness/phase-dependency-model/composition-root.ts +57 -1
  95. package/scripts/harness/phase-dependency-model/domain/definitions/{default-phase-dependencies.ts → full-phase-dependencies.ts} +3 -3
  96. package/scripts/harness/phase-dependency-model/domain/definitions/{default-phase-nodes.ts → full-phase-nodes.ts} +1 -1
  97. package/scripts/harness/phase-dependency-model/domain/definitions/full-story-reflection-defaults.ts +28 -0
  98. package/scripts/harness/phase-dependency-model/domain/definitions/minimal-phase-dependencies.ts +32 -0
  99. package/scripts/harness/phase-dependency-model/domain/definitions/minimal-phase-nodes.ts +50 -0
  100. package/scripts/harness/phase-dependency-model/domain/definitions/minimal-story-reflection-defaults.ts +8 -0
  101. package/scripts/harness/phase-dependency-model/domain/definitions/standard-phase-dependencies.ts +39 -0
  102. package/scripts/harness/phase-dependency-model/domain/definitions/standard-phase-nodes.ts +118 -0
  103. package/scripts/harness/phase-dependency-model/domain/definitions/standard-story-reflection-defaults.ts +23 -0
  104. package/scripts/harness/phase-dependency-model/domain/models/phase-structure.ts +95 -23
  105. package/scripts/harness/phase-dependency-model/domain/ports/glob-matcher-port.ts +8 -0
  106. package/scripts/harness/phase-dependency-model/domain/ports/phase-config-provider-port.ts +2 -0
  107. package/scripts/harness/phase-dependency-model/domain/ports/story-annotation-verifier-port.ts +14 -0
  108. package/scripts/harness/phase-dependency-model/domain/ports/story-reflection-file-system-port.ts +16 -0
  109. package/scripts/harness/phase-dependency-model/domain/services/gate-graph.ts +223 -0
  110. package/scripts/harness/phase-dependency-model/domain/services/story-reflection-checker.ts +66 -0
  111. package/scripts/harness/phase-dependency-model/domain/values/gate-definition.ts +127 -0
  112. package/scripts/harness/phase-dependency-model/domain/values/gate-name.ts +40 -0
  113. package/scripts/harness/phase-dependency-model/domain/values/gate-story-annotation.ts +39 -0
  114. package/scripts/harness/phase-dependency-model/domain/values/phase-customization-policy.ts +16 -4
  115. package/scripts/harness/phase-dependency-model/domain/values/story-reflection-config.ts +44 -0
  116. package/scripts/harness/phase-dependency-model/domain/values/story-reflection-mapping.ts +91 -0
  117. package/scripts/harness/phase-dependency-model/domain/values/story-reflection-result.ts +55 -0
  118. package/scripts/harness/phase-dependency-model/infrastructure/adapters/picomatch-glob-matcher.ts +17 -0
  119. package/scripts/harness/phase-dependency-model/infrastructure/adapters/story-annotation-verifier-adapter.ts +46 -0
  120. package/scripts/harness/phase-dependency-model/infrastructure/config/custom-gates-config-parser.ts +22 -0
  121. package/scripts/harness/phase-dependency-model/infrastructure/config/harness-config-phase-config-provider.ts +78 -2
  122. package/scripts/harness/phase-dependency-model/infrastructure/filesystem/file-system-story-reflection-adapter.ts +94 -0
  123. package/scripts/harness/phase-dependency-model/presentation/cli/check-phase-gate-command-handler.ts +12 -4
  124. package/scripts/harness/phase-dependency-model/presentation/cli/story-reflection-status-presenter.ts +87 -0
  125. package/scripts/harness/regression-suite/application/dto/analyze-migration-input.ts +1 -0
  126. package/scripts/harness/regression-suite/application/dto/analyze-migration-output.ts +1 -0
  127. package/scripts/harness/regression-suite/application/dto/configure-ci-gate-input.ts +1 -0
  128. package/scripts/harness/regression-suite/application/dto/configure-ci-gate-output.ts +1 -0
  129. package/scripts/harness/regression-suite/application/dto/migrate-v0-tests-input.ts +1 -0
  130. package/scripts/harness/regression-suite/application/dto/migrate-v0-tests-output.ts +1 -0
  131. package/scripts/harness/regression-suite/application/dto/run-regression-suite-input.ts +1 -0
  132. package/scripts/harness/regression-suite/application/dto/run-regression-suite-output.ts +1 -0
  133. package/scripts/harness/regression-suite/application/mappers/migration-mapping-mapper.ts +1 -0
  134. package/scripts/harness/regression-suite/application/mappers/test-execution-summary-mapper.ts +1 -0
  135. package/scripts/harness/regression-suite/application/usecases/analyze-v0-migration-usecase.ts +1 -0
  136. package/scripts/harness/regression-suite/application/usecases/configure-ci-gate-usecase.ts +1 -0
  137. package/scripts/harness/regression-suite/application/usecases/migrate-v0-tests-usecase.ts +1 -0
  138. package/scripts/harness/regression-suite/application/usecases/run-agent-independence-guard-usecase.ts +1 -0
  139. package/scripts/harness/regression-suite/application/usecases/run-gng-gate-regression-usecase.ts +1 -0
  140. package/scripts/harness/regression-suite/application/usecases/run-k-requirements-regression-usecase.ts +1 -0
  141. package/scripts/harness/regression-suite/application/usecases/run-k14-k15-regression-usecase.ts +1 -0
  142. package/scripts/harness/regression-suite/composition-root.ts +1 -0
  143. package/scripts/harness/regression-suite/domain/aggregates/v0-test-migration.ts +1 -0
  144. package/scripts/harness/regression-suite/domain/ports/ci-gate-result-writer-port.ts +1 -0
  145. package/scripts/harness/regression-suite/domain/ports/config-query-port.ts +1 -0
  146. package/scripts/harness/regression-suite/domain/ports/import-analyzer-port.ts +1 -0
  147. package/scripts/harness/regression-suite/domain/ports/migration-mapping-repository-port.ts +1 -0
  148. package/scripts/harness/regression-suite/domain/ports/suite-registry-port.ts +1 -0
  149. package/scripts/harness/regression-suite/domain/ports/test-runner-port.ts +1 -0
  150. package/scripts/harness/regression-suite/domain/ports/v0-spec-reader-port.ts +1 -0
  151. package/scripts/harness/regression-suite/domain/services/import-guard-service.ts +1 -0
  152. package/scripts/harness/regression-suite/domain/services/migration-analyzer.ts +1 -0
  153. package/scripts/harness/regression-suite/domain/services/regression-runner.ts +1 -0
  154. package/scripts/harness/regression-suite/domain/value-objects/agent-independence-test.ts +1 -0
  155. package/scripts/harness/regression-suite/domain/value-objects/biome-modification-spec.ts +1 -0
  156. package/scripts/harness/regression-suite/domain/value-objects/ci-gate-config.ts +1 -0
  157. package/scripts/harness/regression-suite/domain/value-objects/coverage-rate.ts +1 -0
  158. package/scripts/harness/regression-suite/domain/value-objects/gng-condition-test.ts +1 -0
  159. package/scripts/harness/regression-suite/domain/value-objects/import-violation.ts +1 -0
  160. package/scripts/harness/regression-suite/domain/value-objects/k-requirement-test.ts +1 -0
  161. package/scripts/harness/regression-suite/domain/value-objects/migration-mapping.ts +1 -0
  162. package/scripts/harness/regression-suite/domain/value-objects/regression-suite-definition.ts +1 -0
  163. package/scripts/harness/regression-suite/domain/value-objects/suite-id.ts +1 -0
  164. package/scripts/harness/regression-suite/domain/value-objects/test-execution-summary.ts +1 -0
  165. package/scripts/harness/regression-suite/domain/value-objects/test-failure-detail.ts +1 -0
  166. package/scripts/harness/regression-suite/domain/value-objects/v0-test-id.ts +1 -0
  167. package/scripts/harness/regression-suite/domain/value-objects/v1-test-path.ts +1 -0
  168. package/scripts/harness/regression-suite/infrastructure/adapters/biome-ast-import-analyzer-adapter.ts +1 -0
  169. package/scripts/harness/regression-suite/infrastructure/adapters/file-system-v0-spec-reader-adapter.ts +1 -0
  170. package/scripts/harness/regression-suite/infrastructure/adapters/harness-config-query-adapter.ts +1 -0
  171. package/scripts/harness/regression-suite/infrastructure/adapters/json-ci-gate-result-writer-adapter.ts +1 -0
  172. package/scripts/harness/regression-suite/infrastructure/adapters/markdown-migration-mapping-repository-adapter.ts +1 -0
  173. package/scripts/harness/regression-suite/infrastructure/adapters/static-suite-registry-adapter.ts +1 -0
  174. package/scripts/harness/regression-suite/infrastructure/adapters/vitest-test-runner-adapter.ts +1 -0
  175. package/scripts/harness/regression-suite/infrastructure/registry/agent-independence-suite-definition.ts +1 -0
  176. package/scripts/harness/regression-suite/infrastructure/registry/gng-gate-suite-definition.ts +1 -0
  177. package/scripts/harness/regression-suite/infrastructure/registry/k-requirements-suite-definition.ts +1 -0
  178. package/scripts/harness/regression-suite/infrastructure/registry/v0-migration-suite-definition.ts +1 -0
  179. package/scripts/harness/setup/skill-deployer.ts +82 -5
  180. package/scripts/harness/shared-kernel/harness-api.ts +1 -0
  181. package/scripts/harness/skill-quality/composition-root.ts +1 -0
  182. package/scripts/harness/skill-quality/infrastructure/adapters/ajv-lesson-artifact-schema-adapter.ts +5 -4
  183. package/scripts/harness/traceability-model/domain/services/metadata-validator.ts +12 -10
  184. package/scripts/harness/traceability-model/infrastructure/parsers/source-metadata-parser.ts +16 -2
  185. package/skills/cascade-updater/SKILL.md +16 -3
  186. package/skills/codebase-mapper/SKILL.md +9 -9
  187. package/skills/codex-delegator/SKILL.md +5 -56
  188. package/skills/consistency-checker/SKILL.md +5 -9
  189. 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
  190. package/skills/doc-freshness-checker/SKILL.md +6 -6
  191. package/skills/engineering-perspective/SKILL.md +2 -58
  192. package/skills/engineering-perspective/references/domain-model.md +4 -135
  193. package/skills/implementation-readiness-checker/SKILL.md +18 -72
  194. package/skills/it-test-designer/SKILL.md +25 -161
  195. package/skills/it-test-designer/references/it-test-design-template.md +131 -0
  196. package/skills/it-test-logic-designer/SKILL.md +13 -388
  197. package/skills/it-test-logic-designer/references/controller-test-patterns.md +100 -0
  198. package/skills/it-test-logic-designer/references/repository-test-patterns.md +206 -0
  199. package/skills/it-test-logic-designer/references/usecase-test-patterns.md +87 -0
  200. package/skills/pointer-validator/SKILL.md +4 -4
  201. package/skills/scenario-test-designer/SKILL.md +4 -68
  202. package/skills/scenario-test-designer/references/scenario-test-design-template.md +41 -0
  203. package/skills/scenario-test-designer/references/scenario-test-plan-template.md +35 -0
  204. package/skills/scenario-test-logic-designer/SKILL.md +21 -304
  205. package/skills/scenario-test-logic-designer/references/msw-patterns.md +36 -0
  206. package/skills/scenario-test-logic-designer/references/playwright-patterns.md +237 -0
  207. package/skills/test-coverage-checker/SKILL.md +39 -121
  208. package/skills/test-coverage-checker/references/coverage-report-template.md +99 -0
  209. package/skills/uiux-designer/SKILL.md +27 -92
  210. package/skills/uiux-designer/references/data-testid-convention.md +38 -0
  211. package/skills/uiux-designer/references/uiux-design-template.md +105 -0
  212. package/skills/unit-test-designer/SKILL.md +5 -106
  213. package/skills/unit-test-designer/references/unit-test-design-template.md +127 -0
  214. package/skills/unit-test-logic-designer/SKILL.md +28 -250
  215. package/skills/unit-test-logic-designer/references/test-patterns.md +207 -0
@@ -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';
@@ -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';
@@ -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';
@@ -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
 
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // file-system-artifact-scanner-adapter.ts — FileSystemArtifactScannerAdapter
2
3
 
3
4
  import * as fs from 'node:fs/promises';
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // harness-config-query-adapter.ts — HarnessConfigQueryAdapter
2
3
 
3
4
  import * as fs from 'node:fs/promises';
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // nyquist-validation-impact-analysis-adapter.ts — NyquistValidationImpactAnalysisAdapter
2
3
  // Wave 2完了後にリアル実装へ差し替え(旧: @stub: wave2-pending)
3
4
 
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // phase-dependency-model-query-adapter.ts — PhaseDependencyModelQueryAdapter
2
3
  // Wave 2完了後にリアル実装へ差し替え(旧: @stub: wave2-pending)
3
4
 
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  // validator-system-execution-adapter.ts — ValidatorSystemExecutionAdapter
2
3
  // Wave 2完了後にリアル実装へ差し替え(旧: @stub: wave2-pending)
3
4
 
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // cli-output-options.ts — CLIOutputOptions DTO
2
3
 
3
4
  export interface CLIOutputOptions {
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // harness-api-json-formatter.ts — HarnessApiJsonFormatter
2
3
 
3
4
  import type { HarnessApiResponseContract } from '../../application/dto/harness-api-response-contract.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // check-phase-handler.ts — CheckPhaseHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // check-ready-handler.ts — CheckReadyHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // ci-check-handler.ts — CiCheckHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // complete-check-handler.ts — CompleteCheckHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // detect-drift-handler.ts — DetectDriftHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // impact-analysis-handler.ts — ImpactAnalysisHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // lint-handler.ts — LintHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -1,3 +1,4 @@
1
+ // @layer presentation
1
2
  // status-handler.ts — StatusHandler
2
3
 
3
4
  import type { DispatchCommandUseCase } from '../../application/usecases/dispatch-command-usecase.js';
@@ -2,7 +2,13 @@
2
2
  * @layer infrastructure
3
3
  * @unit harness-error
4
4
  */
5
- import type { HarnessError } from '../../../core/error-reporter.js';
5
+ interface HarnessError {
6
+ code: string;
7
+ severity: string;
8
+ message: { short: string; detailed: string; agentInstruction: string };
9
+ resolution: { fixSuggestion: string; docLinks: string[]; relatedFiles: string[] };
10
+ metadata: { timestamp: string; validator: string; layer: string };
11
+ }
6
12
  import type { ValidatorIssueDraft } from '../../application/dto/validator-issue-draft.js';
7
13
 
8
14
  function compressSuggestion(error: HarnessError): string {
@@ -1,3 +1,4 @@
1
+ // @layer infrastructure
1
2
  /**
2
3
  * Harness Engineering - Pre-commit Integration
3
4
  *
@@ -8,10 +8,18 @@
8
8
  */
9
9
 
10
10
  import { dirname, join, resolve } from 'node:path';
11
+ import { readFile as fsReadFile } from 'node:fs/promises';
11
12
  import { createConfigFoundationModule } from './config-foundation/composition-root.js';
13
+ import { toPhaseConfigSection } from './config-foundation/application/mappers/phase-config-section-mapper.js';
12
14
  import { createHarnessErrorModule } from './harness-error/composition-root.js';
13
15
  import { createTraceabilityModelModule } from './traceability-model/composition-root.js';
14
16
  import { createPhaseDependencyModelModule } from './phase-dependency-model/composition-root.js';
17
+ import { HarnessConfigPhaseConfigProvider, type PhaseConfigSection as PhaseDepConfigSection } from './phase-dependency-model/infrastructure/config/harness-config-phase-config-provider.js';
18
+ import { StoryReflectionChecker } from './phase-dependency-model/domain/services/story-reflection-checker.js';
19
+ import { CheckStoryReflectionUseCase } from './phase-dependency-model/application/usecases/check-story-reflection-usecase.js';
20
+ import { FileSystemStoryReflectionAdapter } from './phase-dependency-model/infrastructure/filesystem/file-system-story-reflection-adapter.js';
21
+ import { StoryReflectionStatusPresenter } from './phase-dependency-model/presentation/cli/story-reflection-status-presenter.js';
22
+ import { StoryReflectionResult } from './phase-dependency-model/domain/values/story-reflection-result.js';
15
23
  import { createAdrFoundationModule } from './adr-foundation/composition-root.js';
16
24
  import { createBiomeAstEngineModule } from './biome-ast-engine/composition-root.js';
17
25
  import { createValidatorSystemModule } from './validator-system/composition-root.js';
@@ -21,8 +29,10 @@ import { buildCiGovernance } from './ci-governance/composition-root.js';
21
29
  import { createSkillQualityHandlers } from './skill-quality/composition-root.js';
22
30
  import { buildRegressionSuite } from './regression-suite/composition-root.js';
23
31
  import { buildPhase2Extensions } from './phase2-extensions/composition-root.js';
24
- import { deploySkills, deployHookScripts, getDeployedVersion, getHarnessVersion, initHarnessConfig } from './setup/skill-deployer.js';
32
+ import { deploySkills, deployHookScripts, getDeployedVersion, getHarnessVersion, initHarnessConfig, SKILL_CATEGORIES, getCategoryForSkill } from './setup/skill-deployer.js';
33
+ import type { SkillSet } from './setup/skill-deployer.js';
25
34
  import type { HarnessConfigV2 } from './config-foundation/domain/harness-config.js';
35
+ import { ConfigValidationError } from './config-foundation/domain/errors/config-validation-error.js';
26
36
 
27
37
  /**
28
38
  * main.ts (scripts/harness/main.ts) から2階層上がパッケージルート。
@@ -42,7 +52,7 @@ Usage: phasegate <command> [options]
42
52
 
43
53
  Setup:
44
54
  init Initialize project: deploy skills + create phasegate.config.json
45
- (--name <project-name>)
55
+ (--name <project-name>, --preset <full|standard|minimal|custom>)
46
56
  update-skills Re-deploy skills from current harness version
47
57
 
48
58
  Commands:
@@ -199,11 +209,14 @@ function parseCoverageThreshold(raw: string | undefined): number {
199
209
  return n;
200
210
  }
201
211
 
202
- type PhasePreset = 'default' | 'custom';
212
+ type InitPhasePreset = 'full' | 'standard' | 'minimal' | 'custom';
203
213
 
204
- function toPhasePreset(value: string): PhasePreset {
205
- if (value === 'default' || value === 'custom') return value;
206
- return 'default';
214
+ function parseInitPhasePreset(value: string | undefined): InitPhasePreset | undefined {
215
+ if (value === undefined) return undefined;
216
+ if (value === 'full' || value === 'standard' || value === 'minimal' || value === 'custom') {
217
+ return value;
218
+ }
219
+ return undefined;
207
220
  }
208
221
 
209
222
  type RuleSeverity = 'error' | 'warning' | 'off';
@@ -224,32 +237,82 @@ function toRuleSeverityMap(
224
237
  }
225
238
 
226
239
  /**
227
- * HarnessConfigV2 (resolved) から phase-dependency-model が期待する PhaseConfigSection を抽出する。
240
+ * HarnessConfigV2 (resolved) から biome-ast-engine が期待する L1 Config を抽出する。
228
241
  */
229
- function toPhaseConfigSection(resolvedConfig: HarnessConfigV2) {
242
+ function toL1Config(resolvedConfig: HarnessConfigV2) {
230
243
  return {
231
- planningMode: resolvedConfig.planningMode,
232
- customization: {
233
- preset: toPhasePreset(resolvedConfig.phaseDependencies.preset),
234
- overrideEnabled: resolvedConfig.phaseDependencies.override,
235
- rules: resolvedConfig.phaseDependencies.customRules.map((r) => ({
236
- targetPhase: r.phase,
237
- condition: 'requires',
238
- action: r.requires,
239
- })),
240
- },
241
- reportingOutputDir: resolvedConfig.reporting.outputDir,
244
+ enabled: resolvedConfig.layers.L1.enabled,
245
+ rules: toRuleSeverityMap(resolvedConfig.layers.L1.rules),
242
246
  };
243
247
  }
244
248
 
245
249
  /**
246
- * HarnessConfigV2 (resolved) から biome-ast-engine が期待する L1 Config を抽出する。
250
+ * phasegate.config.json を直接読み、storyReflection 設定解決用の provider を返す。
251
+ * config-foundation の HarnessConfigV2 は storyReflection 未サポートのため raw JSON 経由。
247
252
  */
248
- function toL1Config(resolvedConfig: HarnessConfigV2) {
249
- return {
250
- enabled: resolvedConfig.layers.L1.enabled,
251
- rules: toRuleSeverityMap(resolvedConfig.layers.L1.rules),
253
+ async function loadStoryReflectionProvider(
254
+ rootDir: string,
255
+ ): Promise<HarnessConfigPhaseConfigProvider | null> {
256
+ const configPath = join(rootDir, 'phasegate.config.json');
257
+ let raw: {
258
+ phaseDependencies?: {
259
+ preset?: 'default' | 'full' | 'standard' | 'minimal' | 'custom';
260
+ override?: boolean;
261
+ storyReflection?: {
262
+ enabled?: boolean;
263
+ mappings?: ReadonlyArray<{ inception: string; product: string; required: boolean }>;
264
+ };
265
+ };
266
+ reporting?: { outputDir?: string };
267
+ };
268
+ try {
269
+ const content = await fsReadFile(configPath, 'utf8');
270
+ raw = JSON.parse(content);
271
+ } catch {
272
+ return null;
273
+ }
274
+ const section: PhaseDepConfigSection = {
275
+ customization: {
276
+ preset: raw.phaseDependencies?.preset,
277
+ overrideEnabled: raw.phaseDependencies?.override ?? false,
278
+ },
279
+ storyReflection: raw.phaseDependencies?.storyReflection,
280
+ reportingOutputDir: raw.reporting?.outputDir,
252
281
  };
282
+ return new HarnessConfigPhaseConfigProvider({
283
+ config: section,
284
+ defaultOutputDir: raw.reporting?.outputDir ?? '.harness/reports',
285
+ });
286
+ }
287
+
288
+ async function printStoryReflectionValidationSummary(
289
+ rootDir: string,
290
+ unit: string | undefined,
291
+ ): Promise<void> {
292
+ const provider = await loadStoryReflectionProvider(rootDir);
293
+ if (provider === null) return;
294
+ const config = await provider.getStoryReflectionConfig();
295
+ const policy = await provider.getCustomizationPolicy();
296
+ const presenter = new StoryReflectionStatusPresenter();
297
+ let result = StoryReflectionResult.pass();
298
+ if (config.enabled && unit) {
299
+ const fsAdapter = new FileSystemStoryReflectionAdapter({ rootDir });
300
+ const checker = new StoryReflectionChecker(fsAdapter);
301
+ const useCase = new CheckStoryReflectionUseCase({ checker });
302
+ result = await useCase.execute({ unitId: unit, config });
303
+ }
304
+ console.log(
305
+ presenter.formatValidationSummary({ config, preset: policy.preset, result }),
306
+ );
307
+ }
308
+
309
+ async function printStoryReflectionStatusLine(rootDir: string): Promise<void> {
310
+ const provider = await loadStoryReflectionProvider(rootDir);
311
+ if (provider === null) return;
312
+ const config = await provider.getStoryReflectionConfig();
313
+ const policy = await provider.getCustomizationPolicy();
314
+ const presenter = new StoryReflectionStatusPresenter();
315
+ console.log(presenter.formatStatusLine({ config, preset: policy.preset }));
253
316
  }
254
317
 
255
318
  async function loadResolvedConfig(): Promise<HarnessConfigV2 | undefined> {
@@ -257,7 +320,12 @@ async function loadResolvedConfig(): Promise<HarnessConfigV2 | undefined> {
257
320
  const configModule = createConfigFoundationModule();
258
321
  const result = await configModule.usecases.loadResolvedConfigUseCase.execute();
259
322
  return result.config;
260
- } catch {
323
+ } catch (error) {
324
+ if (error instanceof ConfigValidationError) {
325
+ process.stderr.write(`Invalid phasegate.config.json: ${error.message}\n`);
326
+ process.exit(2);
327
+ }
328
+
261
329
  return undefined;
262
330
  }
263
331
  }
@@ -290,10 +358,28 @@ async function main(): Promise<void> {
290
358
  // ── harness setup ──
291
359
  case 'init': {
292
360
  const projectName = parseFlag(args, '--name') ?? 'my-project';
293
- const result = await deploySkills(harnessRoot, rootDir);
294
- const configResult = await initHarnessConfig(rootDir, projectName);
361
+ const rawPhasePreset = parseFlag(args, '--preset');
362
+ if (
363
+ rawPhasePreset !== undefined
364
+ && rawPhasePreset !== 'full'
365
+ && rawPhasePreset !== 'standard'
366
+ && rawPhasePreset !== 'minimal'
367
+ && rawPhasePreset !== 'custom'
368
+ ) {
369
+ console.error(`Invalid --preset value: "${rawPhasePreset}". Use "full", "standard", "minimal", or "custom".`);
370
+ process.exit(2);
371
+ }
372
+ const phasePreset = parseInitPhasePreset(rawPhasePreset);
373
+ const skillSetRaw = parseFlag(args, '--skills') ?? 'all';
374
+ if (skillSetRaw !== 'core' && skillSetRaw !== 'all') {
375
+ console.error(`Invalid --skills value: "${skillSetRaw}". Use "core" or "all".`);
376
+ process.exit(2);
377
+ }
378
+ const skillSet: SkillSet = skillSetRaw;
379
+ const result = await deploySkills(harnessRoot, rootDir, skillSet);
380
+ const configResult = await initHarnessConfig(rootDir, projectName, phasePreset);
295
381
  const hooksResult = await deployHookScripts(harnessRoot, rootDir);
296
- console.log(`✓ Skills deployed to ${result.targetDir} (${result.deployedSkills.length} skills)`);
382
+ console.log(`✓ Skills deployed to ${result.targetDir} (${result.deployedSkills.length} skills, set: ${skillSet})`);
297
383
  if (configResult.created) {
298
384
  console.log(`✓ phasegate.config.json created`);
299
385
  } else {
@@ -310,7 +396,11 @@ async function main(): Promise<void> {
310
396
  console.log(`✓ Harness v${result.version} initialized`);
311
397
  console.log('');
312
398
  console.log('Next steps:');
313
- console.log(' 1. Run the product-architect skill to start AIDLC');
399
+ if (skillSet === 'core') {
400
+ console.log(' 1. Core skills only — quality defense tools are ready');
401
+ } else {
402
+ console.log(' 1. Run the product-architect skill to start AIDLC');
403
+ }
314
404
  console.log(' 2. Customize phasegate.config.json if needed');
315
405
  console.log(' 3. Edit .claude/scripts/hook-config.json to set target directories');
316
406
  process.exit(0);
@@ -320,14 +410,19 @@ async function main(): Promise<void> {
320
410
  case 'update-skills': {
321
411
  const deployed = await getDeployedVersion(rootDir);
322
412
  const current = await getHarnessVersion(harnessRoot);
413
+ const previousSkillSet: SkillSet = deployed?.skillSet ?? 'all';
414
+ const overrideSkillSet = parseFlag(args, '--skills');
415
+ const updateSkillSet: SkillSet = overrideSkillSet === 'core' || overrideSkillSet === 'all'
416
+ ? overrideSkillSet
417
+ : previousSkillSet;
323
418
  if (deployed) {
324
- console.log(`Previously deployed: v${deployed.version} (${deployed.deployedAt})`);
419
+ console.log(`Previously deployed: v${deployed.version} (${deployed.deployedAt}, set: ${previousSkillSet})`);
325
420
  } else {
326
421
  console.log('No previously deployed skills found');
327
422
  }
328
423
  console.log(`Current harness version: v${current}`);
329
- const result = await deploySkills(harnessRoot, rootDir);
330
- console.log(`✓ Skills updated (${result.deployedSkills.length} skills redeployed)`);
424
+ const result = await deploySkills(harnessRoot, rootDir, updateSkillSet);
425
+ console.log(`✓ Skills updated (${result.deployedSkills.length} skills redeployed, set: ${updateSkillSet})`);
331
426
  process.exit(0);
332
427
  break;
333
428
  }
@@ -443,11 +538,13 @@ async function main(): Promise<void> {
443
538
  const level = Number(parseFlag(args, '--level') ?? '1');
444
539
  const unitId = parseFlag(args, '--unit');
445
540
  const storyId = parseFlag(args, '--story');
541
+ const targetFilePath = parseFlag(args, '--target-file');
446
542
  const result =
447
543
  await mod.checkPhaseGateCommandHandler.execute({
448
544
  targetLevel: level,
449
545
  unitId,
450
546
  storyId,
547
+ targetFilePath,
451
548
  json,
452
549
  });
453
550
  console.log(result.text);
@@ -523,6 +620,9 @@ async function main(): Promise<void> {
523
620
  targetPaths,
524
621
  });
525
622
  console.log(result.output);
623
+ if (layer === 'L2' || layer === 'all') {
624
+ await printStoryReflectionValidationSummary(rootDir, unit);
625
+ }
526
626
  process.exit(result.exitCode);
527
627
  break;
528
628
  }
@@ -585,6 +685,7 @@ async function main(): Promise<void> {
585
685
  const flags: Record<string, boolean | string> = {};
586
686
  if (json) flags.json = true;
587
687
  await mod.handlers.status.handle({}, flags);
688
+ await printStoryReflectionStatusLine(rootDir);
588
689
  break;
589
690
  }
590
691
 
@@ -833,9 +934,28 @@ async function main(): Promise<void> {
833
934
  }
834
935
  }
835
936
  skills.sort();
836
- console.log(`Available skills (${skills.length}):\n`);
937
+
938
+ const grouped: Record<string, string[]> = { core: [], aidlc: [], utility: [], unknown: [] };
837
939
  for (const name of skills) {
838
- console.log(` /${name}`);
940
+ const cat = getCategoryForSkill(name) ?? 'unknown';
941
+ grouped[cat].push(name);
942
+ }
943
+
944
+ console.log(`Available skills (${skills.length}):\n`);
945
+
946
+ const labels: Record<string, string> = {
947
+ core: 'Core — Quality Defense',
948
+ aidlc: 'AIDLC — Development Workflow',
949
+ utility: 'Utility',
950
+ };
951
+ for (const cat of ['core', 'aidlc', 'utility', 'unknown'] as const) {
952
+ if (grouped[cat].length === 0) continue;
953
+ const label = labels[cat] ?? 'Other';
954
+ console.log(` [${label}] (${grouped[cat].length})`);
955
+ for (const name of grouped[cat]) {
956
+ console.log(` /${name}`);
957
+ }
958
+ console.log('');
839
959
  }
840
960
  process.exit(0);
841
961
  }
@@ -0,0 +1,14 @@
1
+ // @unit phase-dependency-model
2
+ // @layer application
3
+
4
+ export interface ResolveGateFindingDto {
5
+ readonly gateName: string;
6
+ readonly path: string;
7
+ readonly reason: string;
8
+ }
9
+
10
+ export interface ResolveGateResultDto {
11
+ readonly matchedGates: readonly string[];
12
+ readonly blockers: readonly ResolveGateFindingDto[];
13
+ readonly warnings: readonly ResolveGateFindingDto[];
14
+ }
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { PhaseGateResultDto } from '../dto/phase-gate-result-dto.js';
7
+ import type { ResolveGateResultDto } from '../dto/resolve-gate-result-dto.js';
7
8
  import type { PhaseGateResult } from '../../domain/values/phase-gate-result.js';
8
9
 
9
10
  export class PhaseGateResultMapper {
@@ -22,4 +23,23 @@ export class PhaseGateResultMapper {
22
23
  auditRecorded: context.auditRecorded,
23
24
  });
24
25
  }
26
+
27
+ mapFromResolve(
28
+ result: ResolveGateResultDto,
29
+ context: {
30
+ readonly targetLevel: 1 | 2 | 3;
31
+ },
32
+ ): PhaseGateResultDto {
33
+ return Object.freeze({
34
+ passed: result.blockers.length === 0,
35
+ targetLevel: context.targetLevel,
36
+ blockers: Object.freeze(
37
+ result.blockers.map((blocker) => `${blocker.gateName}: ${blocker.reason} (${blocker.path})`),
38
+ ),
39
+ warnings: Object.freeze(
40
+ result.warnings.map((warning) => `${warning.gateName}: ${warning.reason} (${warning.path})`),
41
+ ),
42
+ auditRecorded: false,
43
+ });
44
+ }
25
45
  }