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.
- package/README.ja.md +103 -71
- package/README.md +73 -13
- package/bin/{harness → phasegate} +1 -1
- package/docs/ADR/ADR-013-story-reflection-gate.md +100 -0
- package/docs/guide/cli-reference.md +9 -9
- package/docs/guide/configuration.md +245 -8
- package/docs/guide/hooks-integration.md +1 -1
- package/docs/guide/installation.md +6 -6
- package/docs/guide/layer-model.md +5 -5
- package/docs/guide/skills-overview.md +1 -1
- package/package.json +12 -10
- package/scripts/harness/adr-foundation/domain/ports/adr-document-parser-port.ts +1 -0
- package/scripts/harness/adr-foundation/domain/ports/adr-frontmatter-parser-port.ts +1 -0
- package/scripts/harness/adr-foundation/domain/ports/adr-repository-port.ts +1 -0
- package/scripts/harness/adr-foundation/domain/value-objects/adr-status.ts +6 -6
- package/scripts/harness/agent-integration/application/dto/handle-pre-tool-use-dto.ts +3 -1
- package/scripts/harness/agent-integration/application/usecases/handle-pre-tool-use-usecase.ts +109 -3
- package/scripts/harness/agent-integration/application/usecases/handle-stop-usecase.ts +1 -1
- package/scripts/harness/agent-integration/domain/ports/config-query-port.ts +2 -0
- package/scripts/harness/agent-integration/domain/ports/phase-gate-query-port.ts +1 -1
- package/scripts/harness/agent-integration/domain/ports/story-reflection-query-port.ts +8 -0
- package/scripts/harness/agent-integration/domain/services/bash-write-target-extractor.ts +258 -0
- package/scripts/harness/agent-integration/domain/services/hook-to-cli-translator.ts +25 -8
- package/scripts/harness/agent-integration/domain/value-objects/protected-file-list.ts +20 -0
- package/scripts/harness/agent-integration/domain/value-objects/story-reflection-query-result.ts +63 -0
- package/scripts/harness/agent-integration/infrastructure/adapters/child-process-cli-executor-adapter.ts +2 -2
- package/scripts/harness/agent-integration/infrastructure/adapters/file-system-story-reflection-query-adapter.ts +122 -0
- package/scripts/harness/agent-integration/infrastructure/adapters/harness-api-cli-command-registry-adapter.ts +10 -10
- package/scripts/harness/agent-integration/infrastructure/adapters/harness-config-config-query-adapter.ts +20 -0
- package/scripts/harness/agent-integration/infrastructure/adapters/phase-gate-query-adapter.ts +17 -3
- package/scripts/harness/agent-integration/presentation/pre-tool-use-hook.ts +29 -2
- package/scripts/harness/biome-ast-engine/domain/services/lint-runner.ts +24 -0
- package/scripts/harness/biome-ast-engine/domain/services/rule-definition-registry.ts +1 -1
- package/scripts/harness/biome-ast-engine/domain/value-objects/source-module-snapshot.ts +5 -2
- package/scripts/harness/biome-ast-engine/infrastructure/adapters/node-workspace-file-adapter.ts +1 -1
- package/scripts/harness/biome-ast-engine/infrastructure/adapters/typescript-source-module-analyzer-adapter.ts +1 -1
- package/scripts/harness/biome-ast-engine/infrastructure/parsers/unit-comment-parser.ts +12 -7
- package/scripts/harness/ci-governance/composition-root.ts +1 -0
- package/scripts/harness/ci-governance/infrastructure/adapters/agents-md-file-adapter.ts +2 -2
- package/scripts/harness/ci-governance/infrastructure/adapters/yaml-template-renderer-adapter.ts +2 -2
- package/scripts/harness/config-foundation/application/mappers/phase-config-section-mapper.ts +44 -0
- package/scripts/harness/config-foundation/application/usecases/load-resolved-config-use-case.ts +20 -1
- package/scripts/harness/config-foundation/domain/harness-config.ts +2 -1
- package/scripts/harness/config-foundation/domain/value-objects/phase-dependencies-config.ts +18 -4
- package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json +185 -10
- package/scripts/harness/config-foundation/infrastructure/validators/ajv-config-schema-validator.ts +2 -1
- package/scripts/harness/harness-api/application/dto/command-dispatch-input.ts +1 -0
- package/scripts/harness/harness-api/application/dto/command-dispatch-output.ts +1 -0
- package/scripts/harness/harness-api/application/dto/exit-code-decision-input.ts +1 -0
- package/scripts/harness/harness-api/application/dto/exit-code-decision-output.ts +1 -0
- package/scripts/harness/harness-api/application/dto/harness-api-response-contract.ts +1 -0
- package/scripts/harness/harness-api/application/dto/initialize-registry-input.ts +1 -0
- package/scripts/harness/harness-api/application/dto/registry-summary-output.ts +1 -0
- package/scripts/harness/harness-api/application/dto/status-derivation-input.ts +1 -0
- package/scripts/harness/harness-api/application/mappers/harness-api-response-mapper.ts +1 -0
- package/scripts/harness/harness-api/application/usecases/decide-exit-code-usecase.ts +4 -3
- package/scripts/harness/harness-api/application/usecases/derive-harness-status-usecase.ts +1 -0
- package/scripts/harness/harness-api/application/usecases/dispatch-command-usecase.ts +1 -0
- package/scripts/harness/harness-api/application/usecases/initialize-command-registry-usecase.ts +1 -0
- package/scripts/harness/harness-api/composition-root.ts +1 -0
- package/scripts/harness/harness-api/domain/ports/artifact-scanner-port.ts +1 -0
- package/scripts/harness/harness-api/domain/ports/biome-lint-port.ts +1 -0
- package/scripts/harness/harness-api/domain/ports/config-query-port.ts +1 -0
- package/scripts/harness/harness-api/domain/ports/impact-analysis-port.ts +1 -0
- package/scripts/harness/harness-api/domain/ports/phase-gate-query-port.ts +1 -0
- package/scripts/harness/harness-api/domain/ports/validator-execution-port.ts +1 -0
- package/scripts/harness/harness-api/domain/services/command-dispatch-service.ts +17 -16
- package/scripts/harness/harness-api/domain/services/command-registry.ts +4 -3
- package/scripts/harness/harness-api/domain/services/status-derivation-service.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/artifact-scan-result.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/check-ready-result.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/ci-check-result.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/cli-command-definition.ts +11 -10
- package/scripts/harness/harness-api/domain/value-objects/command-input-spec.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/drift-report-summary.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/exit-code-spec.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/harness-api-response.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/harness-status-summary.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/layer-health.ts +1 -0
- package/scripts/harness/harness-api/domain/value-objects/phase-info.ts +1 -0
- package/scripts/harness/harness-api/index.ts +1 -0
- package/scripts/harness/harness-api/infrastructure/adapters/biome-ast-engine-lint-adapter.ts +1 -0
- package/scripts/harness/harness-api/infrastructure/adapters/file-system-artifact-scanner-adapter.ts +1 -0
- package/scripts/harness/harness-api/infrastructure/adapters/harness-config-query-adapter.ts +1 -0
- package/scripts/harness/harness-api/infrastructure/adapters/nyquist-validation-impact-analysis-adapter.ts +1 -0
- package/scripts/harness/harness-api/infrastructure/adapters/phase-dependency-model-query-adapter.ts +1 -0
- package/scripts/harness/harness-api/infrastructure/adapters/validator-system-execution-adapter.ts +1 -0
- package/scripts/harness/harness-api/presentation/dto/cli-output-options.ts +1 -0
- package/scripts/harness/harness-api/presentation/formatters/harness-api-json-formatter.ts +1 -0
- package/scripts/harness/harness-api/presentation/handlers/check-phase-handler.ts +2 -1
- package/scripts/harness/harness-api/presentation/handlers/check-ready-handler.ts +2 -1
- package/scripts/harness/harness-api/presentation/handlers/ci-check-handler.ts +2 -1
- package/scripts/harness/harness-api/presentation/handlers/complete-check-handler.ts +2 -1
- package/scripts/harness/harness-api/presentation/handlers/detect-drift-handler.ts +2 -1
- package/scripts/harness/harness-api/presentation/handlers/impact-analysis-handler.ts +2 -1
- package/scripts/harness/harness-api/presentation/handlers/lint-handler.ts +2 -1
- package/scripts/harness/harness-api/presentation/handlers/status-handler.ts +4 -3
- package/scripts/harness/harness-error/infrastructure/adapters/legacy-error-reporter-adapter.ts +7 -1
- package/scripts/harness/integrations/pre-commit.ts +1 -0
- package/scripts/harness/main.ts +173 -53
- package/scripts/harness/phase-dependency-model/application/dto/resolve-gate-result-dto.ts +14 -0
- package/scripts/harness/phase-dependency-model/application/services/phase-gate-result-mapper.ts +20 -0
- package/scripts/harness/phase-dependency-model/application/usecases/check-story-reflection-usecase.ts +42 -0
- package/scripts/harness/phase-dependency-model/application/usecases/resolve-gate-usecase.ts +161 -0
- package/scripts/harness/phase-dependency-model/composition-root.ts +57 -1
- package/scripts/harness/phase-dependency-model/domain/definitions/{default-phase-dependencies.ts → full-phase-dependencies.ts} +3 -3
- package/scripts/harness/phase-dependency-model/domain/definitions/{default-phase-nodes.ts → full-phase-nodes.ts} +1 -1
- package/scripts/harness/phase-dependency-model/domain/definitions/full-story-reflection-defaults.ts +28 -0
- package/scripts/harness/phase-dependency-model/domain/definitions/minimal-phase-dependencies.ts +32 -0
- package/scripts/harness/phase-dependency-model/domain/definitions/minimal-phase-nodes.ts +50 -0
- package/scripts/harness/phase-dependency-model/domain/definitions/minimal-story-reflection-defaults.ts +8 -0
- package/scripts/harness/phase-dependency-model/domain/definitions/standard-phase-dependencies.ts +39 -0
- package/scripts/harness/phase-dependency-model/domain/definitions/standard-phase-nodes.ts +118 -0
- package/scripts/harness/phase-dependency-model/domain/definitions/standard-story-reflection-defaults.ts +23 -0
- package/scripts/harness/phase-dependency-model/domain/models/phase-structure.ts +95 -23
- package/scripts/harness/phase-dependency-model/domain/ports/glob-matcher-port.ts +8 -0
- package/scripts/harness/phase-dependency-model/domain/ports/phase-config-provider-port.ts +2 -0
- package/scripts/harness/phase-dependency-model/domain/ports/story-annotation-verifier-port.ts +14 -0
- package/scripts/harness/phase-dependency-model/domain/ports/story-reflection-file-system-port.ts +16 -0
- package/scripts/harness/phase-dependency-model/domain/services/gate-graph.ts +223 -0
- package/scripts/harness/phase-dependency-model/domain/services/story-reflection-checker.ts +66 -0
- package/scripts/harness/phase-dependency-model/domain/values/gate-definition.ts +127 -0
- package/scripts/harness/phase-dependency-model/domain/values/gate-name.ts +40 -0
- package/scripts/harness/phase-dependency-model/domain/values/gate-story-annotation.ts +39 -0
- package/scripts/harness/phase-dependency-model/domain/values/phase-customization-policy.ts +16 -4
- package/scripts/harness/phase-dependency-model/domain/values/story-reflection-config.ts +44 -0
- package/scripts/harness/phase-dependency-model/domain/values/story-reflection-mapping.ts +91 -0
- package/scripts/harness/phase-dependency-model/domain/values/story-reflection-result.ts +55 -0
- package/scripts/harness/phase-dependency-model/infrastructure/adapters/picomatch-glob-matcher.ts +17 -0
- package/scripts/harness/phase-dependency-model/infrastructure/adapters/story-annotation-verifier-adapter.ts +46 -0
- package/scripts/harness/phase-dependency-model/infrastructure/config/custom-gates-config-parser.ts +22 -0
- package/scripts/harness/phase-dependency-model/infrastructure/config/harness-config-phase-config-provider.ts +78 -2
- package/scripts/harness/phase-dependency-model/infrastructure/filesystem/file-system-story-reflection-adapter.ts +94 -0
- package/scripts/harness/phase-dependency-model/presentation/cli/check-phase-gate-command-handler.ts +12 -4
- package/scripts/harness/phase-dependency-model/presentation/cli/story-reflection-status-presenter.ts +87 -0
- package/scripts/harness/quick-mode/application/usecases/execute-quick-ci-check-usecase.ts +1 -1
- package/scripts/harness/quick-mode/presentation/handlers/ci-check-quick-mode-handler.ts +1 -1
- package/scripts/harness/regression-suite/application/dto/analyze-migration-input.ts +1 -0
- package/scripts/harness/regression-suite/application/dto/analyze-migration-output.ts +1 -0
- package/scripts/harness/regression-suite/application/dto/configure-ci-gate-input.ts +1 -0
- package/scripts/harness/regression-suite/application/dto/configure-ci-gate-output.ts +1 -0
- package/scripts/harness/regression-suite/application/dto/migrate-v0-tests-input.ts +1 -0
- package/scripts/harness/regression-suite/application/dto/migrate-v0-tests-output.ts +1 -0
- package/scripts/harness/regression-suite/application/dto/run-regression-suite-input.ts +1 -0
- package/scripts/harness/regression-suite/application/dto/run-regression-suite-output.ts +1 -0
- package/scripts/harness/regression-suite/application/mappers/migration-mapping-mapper.ts +1 -0
- package/scripts/harness/regression-suite/application/mappers/test-execution-summary-mapper.ts +1 -0
- package/scripts/harness/regression-suite/application/usecases/analyze-v0-migration-usecase.ts +1 -0
- package/scripts/harness/regression-suite/application/usecases/configure-ci-gate-usecase.ts +1 -0
- package/scripts/harness/regression-suite/application/usecases/migrate-v0-tests-usecase.ts +1 -0
- package/scripts/harness/regression-suite/application/usecases/run-agent-independence-guard-usecase.ts +1 -0
- package/scripts/harness/regression-suite/application/usecases/run-gng-gate-regression-usecase.ts +1 -0
- package/scripts/harness/regression-suite/application/usecases/run-k-requirements-regression-usecase.ts +1 -0
- package/scripts/harness/regression-suite/application/usecases/run-k14-k15-regression-usecase.ts +1 -0
- package/scripts/harness/regression-suite/composition-root.ts +1 -0
- package/scripts/harness/regression-suite/domain/aggregates/v0-test-migration.ts +1 -0
- package/scripts/harness/regression-suite/domain/ports/ci-gate-result-writer-port.ts +1 -0
- package/scripts/harness/regression-suite/domain/ports/config-query-port.ts +1 -0
- package/scripts/harness/regression-suite/domain/ports/import-analyzer-port.ts +1 -0
- package/scripts/harness/regression-suite/domain/ports/migration-mapping-repository-port.ts +1 -0
- package/scripts/harness/regression-suite/domain/ports/suite-registry-port.ts +1 -0
- package/scripts/harness/regression-suite/domain/ports/test-runner-port.ts +1 -0
- package/scripts/harness/regression-suite/domain/ports/v0-spec-reader-port.ts +1 -0
- package/scripts/harness/regression-suite/domain/services/import-guard-service.ts +1 -0
- package/scripts/harness/regression-suite/domain/services/migration-analyzer.ts +1 -0
- package/scripts/harness/regression-suite/domain/services/regression-runner.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/agent-independence-test.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/biome-modification-spec.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/ci-gate-config.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/coverage-rate.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/gng-condition-test.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/import-violation.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/k-requirement-test.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/migration-mapping.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/regression-suite-definition.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/suite-id.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/test-execution-summary.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/test-failure-detail.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/v0-test-id.ts +1 -0
- package/scripts/harness/regression-suite/domain/value-objects/v1-test-path.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/adapters/biome-ast-import-analyzer-adapter.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/adapters/file-system-v0-spec-reader-adapter.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/adapters/harness-config-query-adapter.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/adapters/json-ci-gate-result-writer-adapter.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/adapters/markdown-migration-mapping-repository-adapter.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/adapters/static-suite-registry-adapter.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/adapters/vitest-test-runner-adapter.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/registry/agent-independence-suite-definition.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/registry/gng-gate-suite-definition.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/registry/k-requirements-suite-definition.ts +1 -0
- package/scripts/harness/regression-suite/infrastructure/registry/v0-migration-suite-definition.ts +1 -0
- package/scripts/harness/setup/skill-deployer.ts +82 -5
- package/scripts/harness/shared-kernel/harness-api.ts +1 -0
- package/scripts/harness/skill-quality/composition-root.ts +1 -0
- package/scripts/harness/skill-quality/infrastructure/adapters/ajv-lesson-artifact-schema-adapter.ts +5 -4
- package/scripts/harness/traceability-model/domain/services/metadata-validator.ts +12 -10
- package/scripts/harness/traceability-model/infrastructure/parsers/source-metadata-parser.ts +16 -2
- package/scripts/harness/validator-system/composition-root.ts +3 -3
- package/skills/cascade-updater/SKILL.md +16 -3
- package/skills/codebase-mapper/SKILL.md +9 -9
- package/skills/codex-delegator/SKILL.md +5 -56
- package/skills/consistency-checker/SKILL.md +5 -9
- 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
- package/skills/doc-freshness-checker/SKILL.md +6 -6
- package/skills/engineering-perspective/SKILL.md +2 -58
- package/skills/engineering-perspective/references/domain-model.md +4 -135
- package/skills/implementation-readiness-checker/SKILL.md +18 -72
- package/skills/it-test-designer/SKILL.md +25 -161
- package/skills/it-test-designer/references/it-test-design-template.md +131 -0
- package/skills/it-test-logic-designer/SKILL.md +13 -388
- package/skills/it-test-logic-designer/references/controller-test-patterns.md +100 -0
- package/skills/it-test-logic-designer/references/repository-test-patterns.md +206 -0
- package/skills/it-test-logic-designer/references/usecase-test-patterns.md +87 -0
- package/skills/pointer-validator/SKILL.md +4 -4
- package/skills/scenario-test-designer/SKILL.md +4 -68
- package/skills/scenario-test-designer/references/scenario-test-design-template.md +41 -0
- package/skills/scenario-test-designer/references/scenario-test-plan-template.md +35 -0
- package/skills/scenario-test-logic-designer/SKILL.md +21 -304
- package/skills/scenario-test-logic-designer/references/msw-patterns.md +36 -0
- package/skills/scenario-test-logic-designer/references/playwright-patterns.md +237 -0
- package/skills/test-coverage-checker/SKILL.md +39 -121
- package/skills/test-coverage-checker/references/coverage-report-template.md +99 -0
- package/skills/uiux-designer/SKILL.md +27 -92
- package/skills/uiux-designer/references/data-testid-convention.md +38 -0
- package/skills/uiux-designer/references/uiux-design-template.md +105 -0
- package/skills/unit-test-designer/SKILL.md +5 -106
- package/skills/unit-test-designer/references/unit-test-design-template.md +127 -0
- package/skills/unit-test-logic-designer/SKILL.md +28 -250
- package/skills/unit-test-logic-designer/references/test-patterns.md +207 -0
package/README.ja.md
CHANGED
|
@@ -48,6 +48,9 @@ AIエージェント(Claude Code, Codex, Cursor, その他)が生成する
|
|
|
48
48
|
| **Nyquist Validation** | 要件→テストの双方向トレーサビリティを`requirement-test-matrix.json`で保証 |
|
|
49
49
|
| **Cascade Updater** | 下位フェーズの発見を上位設計文書に自動フィードバック |
|
|
50
50
|
| **Regression Suite** | K1-K15非交渉要件・GnGゲート・エージェント非依存性を回帰テストで継続検証 |
|
|
51
|
+
| **カスタムフェーズゲート** | `phasegate.config.json` の `gates[]` で独自のフェーズゲートを定義可能。デフォルトはAIDLCフェーズ依存 |
|
|
52
|
+
| **保護ファイル制御** | `protectedFiles.exclude` でAI書き込みから保護するファイルを設定 |
|
|
53
|
+
| **Bash書き込み検出** | シェル経由のファイル書き込み(`sed -i`, `tee`, `cp`, `mv`, リダイレクト等)を検出してブロック |
|
|
51
54
|
|
|
52
55
|
---
|
|
53
56
|
|
|
@@ -60,7 +63,7 @@ AIエージェント(Claude Code, Codex, Cursor, その他)が生成する
|
|
|
60
63
|
║ hook-config .harness-hooks.yml設定検証 ║
|
|
61
64
|
║ gate-check 完了ゲートチェック ║
|
|
62
65
|
║ ║
|
|
63
|
-
║ 実行: npx
|
|
66
|
+
║ 実行: npx phasegate validate --layer L0 ║
|
|
64
67
|
╠══════════════════════════════════════════════════════════════╣
|
|
65
68
|
║ L1 EDITOR TIME: Biome AST Rules ║
|
|
66
69
|
║ ───────────────────────────────────────────────────────── ║
|
|
@@ -70,7 +73,7 @@ AIエージェント(Claude Code, Codex, Cursor, その他)が生成する
|
|
|
70
73
|
║ no-comment-flood no-code-duplication ║
|
|
71
74
|
║ + it-test-mock-detection + stub-comment-detection ║
|
|
72
75
|
║ ║
|
|
73
|
-
║ 実行: npx
|
|
76
|
+
║ 実行: npx phasegate lint ║
|
|
74
77
|
╠══════════════════════════════════════════════════════════════╣
|
|
75
78
|
║ L2 PRE-COMMIT: Validators ║
|
|
76
79
|
║ ───────────────────────────────────────────────────────── ║
|
|
@@ -78,7 +81,7 @@ AIエージェント(Claude Code, Codex, Cursor, その他)が生成する
|
|
|
78
81
|
║ metadata @unit/@layer/@US-XXX/@story の完全性検証 ║
|
|
79
82
|
║ test-quality AAA / actual / single-act / no-domain-mock ║
|
|
80
83
|
║ ║
|
|
81
|
-
║ 実行: npx
|
|
84
|
+
║ 実行: npx phasegate validate --layer L2 ║
|
|
82
85
|
╠══════════════════════════════════════════════════════════════╣
|
|
83
86
|
║ L3 CI/CD: Validators ║
|
|
84
87
|
║ ───────────────────────────────────────────────────────── ║
|
|
@@ -87,7 +90,7 @@ AIエージェント(Claude Code, Codex, Cursor, その他)が生成する
|
|
|
87
90
|
║ coverage カバレッジ閾値 (standard: 90% / strict: 95%) ║
|
|
88
91
|
║ nyquist 要件→テスト双方向トレーサビリティ検証 ║
|
|
89
92
|
║ ║
|
|
90
|
-
║ 実行: npx
|
|
93
|
+
║ 実行: npx phasegate validate --layer L3 ║
|
|
91
94
|
╠══════════════════════════════════════════════════════════════╣
|
|
92
95
|
║ L4 SCHEDULED: Validators ║
|
|
93
96
|
║ ───────────────────────────────────────────────────────── ║
|
|
@@ -95,7 +98,7 @@ AIエージェント(Claude Code, Codex, Cursor, その他)が生成する
|
|
|
95
98
|
║ consistency-check 文書間レイヤー整合性チェック ║
|
|
96
99
|
║ dead-code 未使用エクスポート・到達不能コード検出 ║
|
|
97
100
|
║ ║
|
|
98
|
-
║ 実行: npx
|
|
101
|
+
║ 実行: npx phasegate validate --layer L4 ║
|
|
99
102
|
╚══════════════════════════════════════════════════════════════╝
|
|
100
103
|
```
|
|
101
104
|
|
|
@@ -135,7 +138,7 @@ npm install --save-dev phasegate
|
|
|
135
138
|
```json
|
|
136
139
|
{
|
|
137
140
|
"devDependencies": {
|
|
138
|
-
"phasegate": "^0.
|
|
141
|
+
"phasegate": "^0.31.0"
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
144
|
```
|
|
@@ -147,7 +150,7 @@ npm install --save-dev phasegate
|
|
|
147
150
|
### 1. プロジェクト初期化
|
|
148
151
|
|
|
149
152
|
```bash
|
|
150
|
-
npx
|
|
153
|
+
npx phasegate init --name <プロジェクト名>
|
|
151
154
|
```
|
|
152
155
|
|
|
153
156
|
実行されること:
|
|
@@ -183,7 +186,7 @@ claude # プロジェクトルートで起動
|
|
|
183
186
|
```bash
|
|
184
187
|
# ハーネスを更新後、スキルを最新版に同期
|
|
185
188
|
npm update phasegate
|
|
186
|
-
npx
|
|
189
|
+
npx phasegate update-skills
|
|
187
190
|
```
|
|
188
191
|
|
|
189
192
|
---
|
|
@@ -194,25 +197,13 @@ npx harness update-skills
|
|
|
194
197
|
|
|
195
198
|
```jsonc
|
|
196
199
|
{
|
|
197
|
-
"
|
|
198
|
-
"preset": "standard", // "minimal" | "standard" | "strict"
|
|
199
|
-
"project": {
|
|
200
|
-
"name": "my-project",
|
|
201
|
-
"architecture": "clean-architecture",
|
|
202
|
-
"paths": {
|
|
203
|
-
"source": ["src"],
|
|
204
|
-
"docs": {
|
|
205
|
-
"units": "docs/product/units",
|
|
206
|
-
"inception": "docs/inception",
|
|
207
|
-
"construction": "docs/product/construction"
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
},
|
|
200
|
+
"project": { "name": "my-project", "preset": "standard" },
|
|
211
201
|
"layers": {
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
202
|
+
"L0": { "enabled": false },
|
|
203
|
+
"L1": { "enabled": true },
|
|
204
|
+
"L2": { "enabled": true },
|
|
205
|
+
"L3": { "enabled": true },
|
|
206
|
+
"L4": { "enabled": false }
|
|
216
207
|
},
|
|
217
208
|
"quickMode": {
|
|
218
209
|
"allowedCategories": ["bugfix", "docs", "test", "config"],
|
|
@@ -220,27 +211,16 @@ npx harness update-skills
|
|
|
220
211
|
"relaxedGates": ["phase-gate", "2-phase-execution"]
|
|
221
212
|
},
|
|
222
213
|
"phaseDependencies": {
|
|
223
|
-
"preset": "
|
|
224
|
-
"override": false,
|
|
225
|
-
"
|
|
214
|
+
"preset": "standard",
|
|
215
|
+
"override": false,
|
|
216
|
+
"storyReflection": { "enabled": true }
|
|
226
217
|
},
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"perPhase": {}
|
|
230
|
-
},
|
|
231
|
-
"harnesses": {
|
|
232
|
-
"agentLessonCollection": false,
|
|
233
|
-
"cascadeUpdate": false,
|
|
234
|
-
"bundleSizeLimit": 0,
|
|
235
|
-
"deadCodeGC": false
|
|
218
|
+
"protectedFiles": {
|
|
219
|
+
"exclude": ["tsconfig.json", "package.json"]
|
|
236
220
|
},
|
|
237
221
|
"paths": {
|
|
238
222
|
"designDocs": "docs/product/construction",
|
|
239
223
|
"inceptionDocs": "docs/inception"
|
|
240
|
-
},
|
|
241
|
-
"reporting": {
|
|
242
|
-
"format": "json",
|
|
243
|
-
"outputDir": "reports"
|
|
244
224
|
}
|
|
245
225
|
}
|
|
246
226
|
```
|
|
@@ -250,7 +230,7 @@ npx harness update-skills
|
|
|
250
230
|
## CLIコマンドリファレンス
|
|
251
231
|
|
|
252
232
|
```bash
|
|
253
|
-
npx
|
|
233
|
+
npx phasegate <command> [options]
|
|
254
234
|
```
|
|
255
235
|
|
|
256
236
|
### セットアップ
|
|
@@ -277,14 +257,14 @@ npx harness <command> [options]
|
|
|
277
257
|
|
|
278
258
|
| コマンド | 説明 | オプション |
|
|
279
259
|
|---|---|---|
|
|
280
|
-
| `
|
|
281
|
-
| `
|
|
282
|
-
| `
|
|
283
|
-
| `
|
|
284
|
-
| `
|
|
285
|
-
| `
|
|
286
|
-
| `
|
|
287
|
-
| `
|
|
260
|
+
| `phasegate:status` | ハーネス全体の健全性サマリ | `--json` |
|
|
261
|
+
| `phasegate:check-ready` | 全storyのPhase Gate通過状態 | `--json` |
|
|
262
|
+
| `phasegate:check-phase` | 指定Unitの現在フェーズ | `--unit <unitId>` `--json` |
|
|
263
|
+
| `phasegate:ci-check` | 全L3バリデータ実行結果 | `--json` |
|
|
264
|
+
| `phasegate:detect-drift` | 設計-コード乖離レポート | `--json` |
|
|
265
|
+
| `phasegate:lint` | harness-api経由のlint | `--target <path>` `--json` |
|
|
266
|
+
| `phasegate:complete-check` | L2-L4全チェック | `--json` |
|
|
267
|
+
| `phasegate:impact-analysis` | ストーリー影響範囲分析 | `<storyId>` `--json` |
|
|
288
268
|
|
|
289
269
|
### ADR管理
|
|
290
270
|
|
|
@@ -507,7 +487,7 @@ describe('ConfigSchema', () => {
|
|
|
507
487
|
"hooks": {
|
|
508
488
|
"PreToolUse": [
|
|
509
489
|
{
|
|
510
|
-
"matcher": "Write|Edit",
|
|
490
|
+
"matcher": "Write|Edit|Bash",
|
|
511
491
|
"hooks": [{
|
|
512
492
|
"type": "command",
|
|
513
493
|
"command": "npx tsx scripts/harness/agent-integration/presentation/pre-tool-use-hook.ts"
|
|
@@ -538,9 +518,9 @@ describe('ConfigSchema', () => {
|
|
|
538
518
|
|
|
539
519
|
| Hook | タイミング | 動作 |
|
|
540
520
|
|---|---|---|
|
|
541
|
-
| **PreToolUse** | ファイル書き込み前 | Phase Gate
|
|
521
|
+
| **PreToolUse** | ファイル書き込み前 | Phase Gate強制・保護ファイルへの変更をブロック・**Bash経由の書き込み検出(`sed -i`, `tee`, `cp`, `mv`, リダイレクト)**。ブロック時はアクショナブルなエラーメッセージ(違反理由・不足成果物・次に使うべきスキル)を返却 |
|
|
542
522
|
| **PostToolUse** | ファイル書き込み後 | Biome ASTルールを自動実行、違反があれば即時フィードバック |
|
|
543
|
-
| **Stop** | セッション終了前 | `
|
|
523
|
+
| **Stop** | セッション終了前 | `phasegate:complete-check` (L2-L4全チェック) を実行、全グリーンでないとセッション終了を保留 |
|
|
544
524
|
|
|
545
525
|
### PreToolUse エラーメッセージ (v0.9.0)
|
|
546
526
|
|
|
@@ -641,7 +621,7 @@ PreToolUse Hook がブロックした際、AIエージェントが自律的に
|
|
|
641
621
|
軽微な変更(バグ修正、ドキュメント修正、テスト追加、設定変更)に対してハーネスの一部を緩和するモード。
|
|
642
622
|
|
|
643
623
|
```bash
|
|
644
|
-
npx
|
|
624
|
+
npx phasegate ci-check --quick
|
|
645
625
|
```
|
|
646
626
|
|
|
647
627
|
| レイヤー | 通常モード | Quick Mode |
|
|
@@ -674,7 +654,9 @@ npx harness ci-check --quick
|
|
|
674
654
|
|
|
675
655
|
## プリセット
|
|
676
656
|
|
|
677
|
-
`phasegate.config.json`
|
|
657
|
+
`phasegate.config.json` のプリセットは **2 系統** あります。
|
|
658
|
+
|
|
659
|
+
### `project.preset` — レイヤー厳密度(L1-L4 有効化とカバレッジ閾値)
|
|
678
660
|
|
|
679
661
|
| プリセット | 用途 | 有効レイヤー | カバレッジ閾値 |
|
|
680
662
|
|---|---|---|---|
|
|
@@ -688,15 +670,65 @@ npx harness ci-check --quick
|
|
|
688
670
|
- `bundleSizeLimit: 500 KB`
|
|
689
671
|
- `deadCodeGC: true`
|
|
690
672
|
|
|
673
|
+
### `phaseDependencies.preset` — フェーズゲート構成と storyReflection デフォルト
|
|
674
|
+
|
|
675
|
+
`project.preset` とは独立。`"default"` は後方互換のため `"full"` にフォールバックされます。
|
|
676
|
+
|
|
677
|
+
| プリセット | Phase 3 ゲート | storyReflection デフォルト | 用途 |
|
|
678
|
+
|---|---|---|---|
|
|
679
|
+
| **full** | 全 AIDLC ゲート | 有効 — `logical_design` + `domain_model` required、`uiux` optional | AIDLC フルセレモニー(旧 `default`) |
|
|
680
|
+
| **standard** | コアゲート | 有効 — `logical_design` required、`domain_model` optional | 通常開発・中庸な厳密度 |
|
|
681
|
+
| **minimal** | なし | 無効 — inception → product 反映強制なし | プロトタイプ・試行錯誤段階 |
|
|
682
|
+
| **custom** | ユーザー定義 | `storyReflection.mappings` で定義 | 完全カスタマイズ(`override: true` 必須) |
|
|
683
|
+
|
|
684
|
+
`storyReflection` は inception の US/issue 設計が `docs/product/construction/{unit}/` に反映されていない場合に `src/{unit}/*` への Write/Edit をブロックします。config で省略した場合はプリセットのデフォルト mappings がゼロコンフィグで自動適用されます。`cascade-updater` スキルがこのゲートを通過する標準手段です。詳細は [ADR-013](docs/ADR/ADR-013-story-reflection-gate.md) と [Configuration guide](docs/guide/configuration.md#storyreflection-inception--product-gate) を参照してください。
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
## カスタムフェーズゲート
|
|
689
|
+
|
|
690
|
+
デフォルトでは **AIDLCフェーズ依存モデル** が適用され、設計文書なしでの実装ファイル書き込みがブロックされます。`standard` または `full` プリセットでゼロコンフィグで動作します。
|
|
691
|
+
|
|
692
|
+
AIDLCを使わないプロジェクトでは、`phasegate.config.json` の `gates[]` 配列で **独自のゲート** を定義できます:
|
|
693
|
+
|
|
694
|
+
```jsonc
|
|
695
|
+
{
|
|
696
|
+
"phaseDependencies": {
|
|
697
|
+
"preset": "custom",
|
|
698
|
+
"override": true,
|
|
699
|
+
"gates": [
|
|
700
|
+
{
|
|
701
|
+
"name": "schema-first",
|
|
702
|
+
"level": 3,
|
|
703
|
+
"blocks": ["src/api/**/*.ts"],
|
|
704
|
+
"requires": ["docs/api/openapi.yaml"],
|
|
705
|
+
"description": "API実装にはOpenAPIスキーマが必要"
|
|
706
|
+
}
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
| フィールド | 型 | 説明 |
|
|
713
|
+
|---|---|---|
|
|
714
|
+
| `name` | string | ゲートの一意識別子 |
|
|
715
|
+
| `level` | 1 \| 2 \| 3 | フェーズレベル(上位レベルは下位レベルのゲート通過が前提) |
|
|
716
|
+
| `blocks` | string[] | このゲートが保護するファイルのglobパターン |
|
|
717
|
+
| `requires` | string[] | ブロック対象パスへの書き込み前に存在が必要なファイル |
|
|
718
|
+
| `dependsOn` | string[] | 事前に通過が必要な他のゲート名 |
|
|
719
|
+
| `description` | string | ゲートの説明 |
|
|
720
|
+
|
|
721
|
+
ゲートは **DAG**(有向非巡回グラフ)を形成します。循環依存は設定読み込み時に拒否されます。
|
|
722
|
+
|
|
691
723
|
---
|
|
692
724
|
|
|
693
725
|
## CI/CD テンプレート
|
|
694
726
|
|
|
695
727
|
```bash
|
|
696
728
|
# 3種のテンプレートを生成
|
|
697
|
-
npx
|
|
698
|
-
npx
|
|
699
|
-
npx
|
|
729
|
+
npx phasegate ci:generate-template --type github-actions
|
|
730
|
+
npx phasegate ci:generate-template --type pre-commit
|
|
731
|
+
npx phasegate ci:generate-template --type weekly-check
|
|
700
732
|
```
|
|
701
733
|
|
|
702
734
|
| テンプレート | 用途 | 配置先 |
|
|
@@ -709,10 +741,10 @@ npx harness ci:generate-template --type weekly-check
|
|
|
709
741
|
|
|
710
742
|
```bash
|
|
711
743
|
# aidlc-gate.yml を .github/workflows/ にコピー
|
|
712
|
-
npx
|
|
744
|
+
npx phasegate ci:generate-template --type github-actions --render > .github/workflows/aidlc-gate.yml
|
|
713
745
|
|
|
714
746
|
# pre-commit フックを設定
|
|
715
|
-
npx
|
|
747
|
+
npx phasegate ci:generate-template --type pre-commit --render > .husky/pre-commit
|
|
716
748
|
chmod +x .husky/pre-commit
|
|
717
749
|
```
|
|
718
750
|
|
|
@@ -724,22 +756,22 @@ chmod +x .husky/pre-commit
|
|
|
724
756
|
|
|
725
757
|
```bash
|
|
726
758
|
# K1-K13 非交渉要件の回帰テスト(16件)
|
|
727
|
-
npx
|
|
759
|
+
npx phasegate regression:run-k-requirements
|
|
728
760
|
|
|
729
761
|
# Go/No-Go Gate 品質側3条件(3件)
|
|
730
|
-
npx
|
|
762
|
+
npx phasegate regression:run-gng-gate
|
|
731
763
|
|
|
732
764
|
# K14(Phase Dependency Model)/ K15(Plan文書必須)(2件)
|
|
733
|
-
npx
|
|
765
|
+
npx phasegate regression:run-k14-k15
|
|
734
766
|
|
|
735
767
|
# エージェント非依存性ガード(3件)
|
|
736
|
-
npx
|
|
768
|
+
npx phasegate regression:run-agent-guard
|
|
737
769
|
```
|
|
738
770
|
|
|
739
771
|
JSON出力:
|
|
740
772
|
|
|
741
773
|
```bash
|
|
742
|
-
npx
|
|
774
|
+
npx phasegate regression:run-k-requirements --format json
|
|
743
775
|
```
|
|
744
776
|
|
|
745
777
|
**非交渉要件 (K1-K15) 概要:**
|
|
@@ -789,7 +821,7 @@ phasegate/
|
|
|
789
821
|
│ ├── regression-suite/ # K1-K15回帰テストスイート
|
|
790
822
|
│ ├── fuse-hooks-engine/ # Hooks Engine (.harness-hooks.yml・完了ゲート)
|
|
791
823
|
│ └── phase2-extensions/ # freshness/pointer/e2e-template (v2)
|
|
792
|
-
├── skills/ # 28スキル (npx
|
|
824
|
+
├── skills/ # 28スキル (npx phasegate init で .claude/skills/ に展開)
|
|
793
825
|
├── templates/
|
|
794
826
|
│ └── phasegate.config.json # 設定テンプレート
|
|
795
827
|
└── docs/
|
|
@@ -830,14 +862,14 @@ your-project/
|
|
|
830
862
|
└── .claude/
|
|
831
863
|
├── CLAUDE.md
|
|
832
864
|
├── settings.json # Hooks設定
|
|
833
|
-
└── skills/ # npx
|
|
865
|
+
└── skills/ # npx phasegate init で展開(gitignore推奨)
|
|
834
866
|
```
|
|
835
867
|
|
|
836
868
|
### .gitignore 推奨設定
|
|
837
869
|
|
|
838
870
|
```
|
|
839
871
|
node_modules/
|
|
840
|
-
.claude/skills/ # npx
|
|
872
|
+
.claude/skills/ # npx phasegate init で再生成可能
|
|
841
873
|
dist/
|
|
842
874
|
reports/
|
|
843
875
|
.harness/
|
|
@@ -869,7 +901,7 @@ git push origin main --tags
|
|
|
869
901
|
npm update phasegate
|
|
870
902
|
|
|
871
903
|
# スキルを最新版に同期
|
|
872
|
-
npx
|
|
904
|
+
npx phasegate update-skills
|
|
873
905
|
```
|
|
874
906
|
|
|
875
907
|
> メジャーバージョンアップ時のみ `package.json` の `semver:^X.Y.Z` を手動で更新してください。
|
|
@@ -885,4 +917,4 @@ npx harness update-skills
|
|
|
885
917
|
|
|
886
918
|
---
|
|
887
919
|
|
|
888
|
-
*Last updated: 2026-04-
|
|
920
|
+
*Last updated: 2026-04-06 — v0.31.0*
|
package/README.md
CHANGED
|
@@ -27,6 +27,9 @@ Works with **Claude Code, Codex, Cursor, Copilot**, or any other AI agent.
|
|
|
27
27
|
| **Quick Mode** | Lightweight gate for bugfixes, docs, tests, and config changes |
|
|
28
28
|
| **Claude Code Hooks** | Native PreToolUse / PostToolUse / Stop hook integration |
|
|
29
29
|
| **HarnessError Format** | Every error includes ADR references and fix examples for AI self-correction |
|
|
30
|
+
| **Configurable Phase Gates** | Define custom gates with `gates[]` in config. Default uses AIDLC phase dependencies |
|
|
31
|
+
| **Protected File Control** | Configure which files are protected from AI writes via `protectedFiles.exclude` |
|
|
32
|
+
| **Bash Write Detection** | Detects and blocks shell-based file writes (`sed -i`, `tee`, `cp`, `mv`, redirects) |
|
|
30
33
|
| **Presets** | minimal, standard, and strict -- choose your quality level |
|
|
31
34
|
|
|
32
35
|
---
|
|
@@ -42,7 +45,7 @@ npm install --save-dev phasegate
|
|
|
42
45
|
### 2. Initialize
|
|
43
46
|
|
|
44
47
|
```bash
|
|
45
|
-
npx
|
|
48
|
+
npx phasegate init --name my-project
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
This deploys 28 skills to `.claude/skills/` and generates `phasegate.config.json`.
|
|
@@ -157,41 +160,98 @@ Skills cover the full **AIDLC (AI-Driven Development Life Cycle)**, enforcing ph
|
|
|
157
160
|
|
|
158
161
|
### Presets
|
|
159
162
|
|
|
163
|
+
`project.preset` -- overall layer strictness:
|
|
164
|
+
|
|
160
165
|
| Preset | Layers | Coverage | Use Case |
|
|
161
166
|
|---|---|---|---|
|
|
162
167
|
| `minimal` | L1 + L2 | -- | Prototyping, early exploration |
|
|
163
168
|
| `standard` | L1 - L3 | 90% | Production development (default) |
|
|
164
169
|
| `strict` | L1 - L4 | 95% | Mission-critical systems |
|
|
165
170
|
|
|
171
|
+
`phaseDependencies.preset` -- phase-gate shape and storyReflection defaults (independent of `project.preset`):
|
|
172
|
+
|
|
173
|
+
| Preset | Phase 3 gates | storyReflection default | Use Case |
|
|
174
|
+
|---|---|---|---|
|
|
175
|
+
| `full` | All AIDLC gates | Enabled -- `logical_design` + `domain_model` required, `uiux` optional | AIDLC full ceremony (alias for legacy `default`) |
|
|
176
|
+
| `standard` | Core gates | Enabled -- `logical_design` required, `domain_model` optional | Production development with moderate rigor |
|
|
177
|
+
| `minimal` | None | Disabled -- no inception -> product enforcement | Prototyping / exploration |
|
|
178
|
+
| `custom` | User-defined via `gates[]` array | User-defined via `storyReflection.mappings` | Full control (requires `override: true`) |
|
|
179
|
+
|
|
180
|
+
`storyReflection` blocks writes to `src/{unit}/*` when an inception US/issue design exists but has not been cascaded into `docs/product/construction/{unit}/`. See [ADR-013](docs/ADR/ADR-013-story-reflection-gate.md) and the [Configuration guide](docs/guide/configuration.md#storyreflection-inception--product-gate).
|
|
181
|
+
|
|
166
182
|
### Key Configuration Sections
|
|
167
183
|
|
|
168
184
|
```jsonc
|
|
169
185
|
{
|
|
170
|
-
"preset": "standard",
|
|
171
|
-
"project": { "name": "my-project", "architecture": "clean-architecture" },
|
|
186
|
+
"project": { "name": "my-project", "preset": "standard" },
|
|
172
187
|
"layers": {
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"
|
|
188
|
+
"L0": { "enabled": false },
|
|
189
|
+
"L1": { "enabled": true },
|
|
190
|
+
"L2": { "enabled": true },
|
|
191
|
+
"L3": { "enabled": true },
|
|
192
|
+
"L4": { "enabled": false }
|
|
177
193
|
},
|
|
178
194
|
"quickMode": {
|
|
179
195
|
"allowedCategories": ["bugfix", "docs", "test", "config"],
|
|
180
|
-
"maintainedLayers": ["L1", "L2"]
|
|
196
|
+
"maintainedLayers": ["L1", "L2"],
|
|
197
|
+
"relaxedGates": ["phase-gate", "2-phase-execution"]
|
|
181
198
|
},
|
|
182
|
-
"phaseDependencies": {
|
|
199
|
+
"phaseDependencies": {
|
|
200
|
+
"preset": "standard",
|
|
201
|
+
"storyReflection": { "enabled": true }
|
|
202
|
+
},
|
|
203
|
+
"protectedFiles": {
|
|
204
|
+
"exclude": ["tsconfig.json", "package.json"]
|
|
205
|
+
}
|
|
183
206
|
}
|
|
184
207
|
```
|
|
185
208
|
|
|
186
209
|
---
|
|
187
210
|
|
|
211
|
+
## Configurable Phase Gates
|
|
212
|
+
|
|
213
|
+
By default, Phasegate enforces the **AIDLC phase dependency model** -- implementation files cannot be written without prerequisite design documents. This works out of the box with the `standard` or `full` preset.
|
|
214
|
+
|
|
215
|
+
For projects that don't follow AIDLC, you can define **custom gates** using the `gates[]` array in `phasegate.config.json`:
|
|
216
|
+
|
|
217
|
+
```jsonc
|
|
218
|
+
{
|
|
219
|
+
"phaseDependencies": {
|
|
220
|
+
"preset": "custom",
|
|
221
|
+
"override": true,
|
|
222
|
+
"gates": [
|
|
223
|
+
{
|
|
224
|
+
"name": "schema-first",
|
|
225
|
+
"level": 3,
|
|
226
|
+
"blocks": ["src/api/**/*.ts"],
|
|
227
|
+
"requires": ["docs/api/openapi.yaml"],
|
|
228
|
+
"description": "API implementation requires OpenAPI schema"
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
| Field | Type | Description |
|
|
236
|
+
|---|---|---|
|
|
237
|
+
| `name` | string | Unique gate identifier |
|
|
238
|
+
| `level` | 1 \| 2 \| 3 | Phase level (higher levels require lower-level gates to pass first) |
|
|
239
|
+
| `blocks` | string[] | Glob patterns for files this gate protects |
|
|
240
|
+
| `requires` | string[] | Files that must exist before writing to blocked paths |
|
|
241
|
+
| `dependsOn` | string[] | Other gate names that must pass first |
|
|
242
|
+
| `description` | string | Human-readable gate description |
|
|
243
|
+
|
|
244
|
+
Gates form a **DAG** (Directed Acyclic Graph). Circular dependencies are rejected at config load time.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
188
248
|
## Claude Code Hooks Integration
|
|
189
249
|
|
|
190
250
|
Phasegate integrates natively with Claude Code via hooks in `.claude/settings.json`:
|
|
191
251
|
|
|
192
252
|
| Hook | Trigger | Behavior |
|
|
193
253
|
|---|---|---|
|
|
194
|
-
| `PreToolUse` | `Write` or `
|
|
254
|
+
| `PreToolUse` | `Write`, `Edit`, or `Bash` (write operations detected) | Blocks writes to source files without design docs; protects configured files; detects Bash write operations (`sed -i`, `tee`, `cp`, etc.) |
|
|
195
255
|
| `PostToolUse` | `Write` or `Edit` | Auto-formats and validates metadata |
|
|
196
256
|
| `Stop` | Session end | Runs full test suite to ensure all tests pass |
|
|
197
257
|
|
|
@@ -202,7 +262,7 @@ All hook errors use the `HarnessError` format with ADR references and fix exampl
|
|
|
202
262
|
## CLI Reference
|
|
203
263
|
|
|
204
264
|
```bash
|
|
205
|
-
npx
|
|
265
|
+
npx phasegate <command> [options]
|
|
206
266
|
```
|
|
207
267
|
|
|
208
268
|
| Command | Description |
|
|
@@ -212,8 +272,8 @@ npx harness <command> [options]
|
|
|
212
272
|
| `validate --layer <L1-L4\|all>` | Run validators for specified layer |
|
|
213
273
|
| `ci-check` | Full CI check (L2-L4) |
|
|
214
274
|
| `update-skills` | Update skills to latest version |
|
|
215
|
-
| `
|
|
216
|
-
| `
|
|
275
|
+
| `phasegate:status` | Display overall harness health summary |
|
|
276
|
+
| `phasegate:check-phase --unit <id>` | Check current phase for a Unit |
|
|
217
277
|
| `list-errors --layer <L0-L4>` | List error definitions with fix examples |
|
|
218
278
|
|
|
219
279
|
See the [Japanese README](README.ja.md) for the complete CLI reference.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ADR-013: storyReflection ゲート(inception → product 反映の機械強制)
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
Accepted
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
AIDLC では US/issue ごとの設計文書が `docs/inception/{unit}/{storyId}/` 配下に作成され、Unit ごとに累積される設計文書が `docs/product/construction/{unit}/` に反映される。従来この反映は cascade-updater スキルに委ねられていたが、**手動運用のため抜け落ちが発生**し、以下の問題が顕在化した。
|
|
10
|
+
|
|
11
|
+
- inception の US-XXX 設計が存在するのに product 文書へ反映されず、Unit 全体の設計整合性が崩れる
|
|
12
|
+
- 実装ファイルの `@unit` → `docs/product/construction/{unit}/` のトレーサビリティが未反映 US に対して欠落する
|
|
13
|
+
- cascade-updater の実行有無をレビュー時に目視確認する必要があり、ヒューマンエラーが避けられない
|
|
14
|
+
|
|
15
|
+
Phase Gate(L2-001)は設計文書の**存在**を検証するが、inception と product の**整合性**(「inception にあるものが product にも反映されているか」)は検証範囲外だった。実装段階でこの欠落がブロックされなければ、設計の単一源としての product 文書が信頼できなくなる。
|
|
16
|
+
|
|
17
|
+
## Decision
|
|
18
|
+
|
|
19
|
+
`phaseDependencies.storyReflection` を導入し、**実装着手時(`src/` / `scripts/harness/` への Write/Edit)に inception → product 反映を機械的に検証**する。
|
|
20
|
+
|
|
21
|
+
### 設計原則
|
|
22
|
+
|
|
23
|
+
configurable_phase_gate_plan.md §4 から引用:
|
|
24
|
+
|
|
25
|
+
- **ハードコードされたデフォルトはプリセットとして残す(後方互換)**
|
|
26
|
+
- **Phase Gate / L2-002 / storyReflection / cascade-updater の 4 系統がプリセット単位で連動**
|
|
27
|
+
- storyReflection の対象は **product に累積更新される設計文書のみ**(テスト設計は US 単位で inception に閉じるため対象外)
|
|
28
|
+
- config 省略時はプリセットのデフォルト mappings が自動適用(**ゼロコンフィグ**)
|
|
29
|
+
- cascade-updater は storyReflection ゲート通過の**唯一の標準手段**
|
|
30
|
+
|
|
31
|
+
### プリセット別デフォルト
|
|
32
|
+
|
|
33
|
+
| プリセット | storyReflection | デフォルト mappings |
|
|
34
|
+
|-----------|-----------------|--------------------|
|
|
35
|
+
| `full` | 必須 | `logical_design.md` + `domain_model.md` required、`uiux_design.md` optional |
|
|
36
|
+
| `standard` | 必須 | `logical_design.md` required、`domain_model.md` optional |
|
|
37
|
+
| `minimal` | 無効 | — |
|
|
38
|
+
| `custom` | 任意 | config で明示指定 |
|
|
39
|
+
|
|
40
|
+
`minimal` で storyReflection を無効にする理由: Phase 3 ゲートなしの状態で story 反映を強制するのは矛盾するため。
|
|
41
|
+
|
|
42
|
+
### チェックロジック
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
発火条件: src/{unit}/* または scripts/harness/{unit}/* への Write/Edit
|
|
46
|
+
1. WriteTargetScope から unitId を解決(@unit 複数ユニット対応)
|
|
47
|
+
2. docs/inception/{unit}/ 配下の storyId ディレクトリを列挙
|
|
48
|
+
3. 各 storyId × 各 mapping について:
|
|
49
|
+
- inception ファイルが存在する AND mapping.required == true
|
|
50
|
+
- → product ファイル内に @story-id {storyId} が含まれているか検証
|
|
51
|
+
- 含まれていない → ブロック
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### エラーメッセージフォーマット
|
|
55
|
+
|
|
56
|
+
`HandlePreToolUseUseCase.blockReason: 'STORY_REFLECTION'` で返されるブロックメッセージは以下の形式とする(configurable_phase_gate_plan.md §4.3 より):
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
[L2-STORY-REFLECTION] docs/product/construction/order/logical_design.md に
|
|
60
|
+
@story-id US-002 が反映されていません。
|
|
61
|
+
|
|
62
|
+
inception/order/US-002/logical_design.md は存在しますが、
|
|
63
|
+
対応する product 文書に US-002 の設計が含まれていません。
|
|
64
|
+
|
|
65
|
+
修正方法:
|
|
66
|
+
1. cascade-updater を実行して product 文書を更新
|
|
67
|
+
2. または手動で logical_design.md に @story-id US-002 を追加
|
|
68
|
+
|
|
69
|
+
参照: ADR-013
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 関連コンポーネント
|
|
73
|
+
|
|
74
|
+
- `PhaseConfigProviderPort.getStoryReflectionConfig()` — プリセット + config から有効な mappings を解決
|
|
75
|
+
- `FileSystemStoryReflectionAdapter` — inception ディレクトリ列挙と product 文書内 `@story-id` 検索
|
|
76
|
+
- `HandlePreToolUseUseCase` — src/ への Write 発火時に storyReflection チェックを呼び出し、未反映ならブロック
|
|
77
|
+
- Quick Mode (`relaxedGates: ["phase-gate"]`) 時は storyReflection も緩和される(§4.6)
|
|
78
|
+
|
|
79
|
+
## Consequences
|
|
80
|
+
|
|
81
|
+
### Positive
|
|
82
|
+
|
|
83
|
+
- inception → product 反映の欠落が実装着手時点で機械的にブロックされる
|
|
84
|
+
- cascade-updater の実行が事実上必須化され、手動運用の抜け漏れが排除される
|
|
85
|
+
- config 省略時もプリセットデフォルトで動作するため、既存ユーザーはゼロコンフィグで恩恵を受ける
|
|
86
|
+
- `@unit` 複数ユニット対応と組み合わせ、共有インフラファイルでも全 Unit の反映状態が検証される
|
|
87
|
+
|
|
88
|
+
### Negative / Trade-off
|
|
89
|
+
|
|
90
|
+
- 実装着手時に反映漏れがあると Write/Edit がブロックされるため、cascade-updater 実行の手間が増える
|
|
91
|
+
- `full` プリセットでは `domain_model.md` も required のため、軽微な変更でも反映が必要になる場合がある → `standard` または `custom` で緩和可能
|
|
92
|
+
- `minimal` ではこの保証が得られない(プロトタイプ段階の試行錯誤を優先するトレードオフ)
|
|
93
|
+
|
|
94
|
+
## 関連要件・文書
|
|
95
|
+
|
|
96
|
+
- configurable_phase_gate_plan.md §4(Phase A: プリセット拡充 + storyReflection)
|
|
97
|
+
- ADR-007(phasegate.config.json — Single Source of Truth)
|
|
98
|
+
- ADR-008(Quick Mode)— storyReflection も `relaxedGates` で緩和される
|
|
99
|
+
- ADR-012(2-Phase Execution)— storyReflection は Phase 2 完了の事後条件に相当
|
|
100
|
+
- `docs/folder_management_rules.md` — inception / product の累積更新フロー
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Entry point:
|
|
4
4
|
|
|
5
5
|
```
|
|
6
|
-
npx
|
|
6
|
+
npx phasegate <command> [options]
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
---
|
|
@@ -38,14 +38,14 @@ Commands exposed as npm scripts (`npm run <command>`).
|
|
|
38
38
|
|
|
39
39
|
| Command | Options | Description |
|
|
40
40
|
|---|---|---|
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
41
|
+
| `phasegate:status` | `--json` | Health summary |
|
|
42
|
+
| `phasegate:check-ready` | `--json` | Phase Gate pass status for all stories |
|
|
43
|
+
| `phasegate:check-phase` | `--unit <unitId>` `--json` | Current phase for a unit |
|
|
44
|
+
| `phasegate:ci-check` | `--json` | All L3 validators |
|
|
45
|
+
| `phasegate:detect-drift` | `--json` | Design-code drift report |
|
|
46
|
+
| `phasegate:lint` | `--target <path>` `--json` | Lint via harness-api |
|
|
47
|
+
| `phasegate:complete-check` | `--json` | L2-L4 full check |
|
|
48
|
+
| `phasegate:impact-analysis` | `<storyId>` `--json` | Story impact analysis |
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|