phasegate 0.133.0 → 0.135.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.ja.md +1 -4
- package/README.md +1 -5
- package/bin/phasegate +2 -0
- package/docs/contracts/lesson-artifact.schema.json +62 -0
- package/docs/contracts/requirement-test-matrix.schema.json +62 -0
- package/docs/guide/configuration.md +0 -1
- package/docs/guide/layer-model.md +9 -9
- package/docs/principles/architecture-philosophy.md +26 -55
- package/docs/principles/model-routing.md +30 -165
- package/docs/principles/testing-rules.md +66 -648
- package/package.json +4 -3
- package/scripts/harness/config-foundation/application/mappers/validator-system-config-mapper.ts +2 -2
- package/scripts/harness/config-foundation/infrastructure/presets/minimal.json +1 -1
- package/scripts/harness/config-foundation/infrastructure/presets/standard.json +1 -1
- package/scripts/harness/config-foundation/infrastructure/presets/strict.json +1 -1
- package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json +0 -16
- package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v3.schema.json +0 -16
- package/scripts/harness/harness-error/infrastructure/adapters/validator-registry-bridge-adapter.ts +2 -0
- package/scripts/harness/harness-error/infrastructure/registry/l4-error-definitions.ts +14 -0
- package/scripts/harness/main.ts +3 -3
- package/scripts/harness/phase2-extensions/composition-root.ts +7 -1
- package/scripts/harness/phase2-extensions/infrastructure/adapters/file-system-document-scanner-adapter.ts +16 -2
- package/scripts/harness/phase2-extensions/infrastructure/adapters/harness-config-freshness-adapter.ts +13 -2
- package/scripts/harness/phase2-extensions/infrastructure/adapters/regex-pointer-extractor-adapter.ts +35 -4
- package/scripts/harness/quick-mode/infrastructure/adapters/validator-system-validator-id-registry-adapter.ts +1 -1
- package/scripts/harness/skill-quality/infrastructure/adapters/validator-id-registry-bridge-adapter.ts +1 -1
- package/scripts/harness/validator-system/application/dto/run-l4-validators-input.ts +1 -0
- package/scripts/harness/validator-system/application/use-cases/run-full-validation-usecase.ts +1 -0
- package/scripts/harness/validator-system/application/use-cases/run-l4-validators-usecase.ts +133 -3
- package/scripts/harness/validator-system/composition-root.ts +9 -16
- package/scripts/harness/validator-system/domain/ports/validator-config-port.ts +1 -1
- package/scripts/harness/validator-system/domain/services/validator-execution-service.ts +2 -2
- package/scripts/harness/validator-system/domain/services/validator-registry.ts +2 -2
- package/scripts/harness/validator-system/domain/value-objects/layer-config.ts +2 -2
- package/scripts/harness/validator-system/domain/value-objects/validator-definition.ts +5 -6
- package/scripts/harness/validator-system/domain/value-objects/validator-id.ts +11 -6
- package/scripts/harness/validator-system/infrastructure/adapters/biome-ast-source-code-analyzer-adapter.ts +29 -10
- package/scripts/harness/validator-system/infrastructure/adapters/harness-config-validator-config-adapter.ts +12 -5
- package/scripts/harness/validator-system/presentation/handlers/run-validators-handler.ts +6 -35
- package/scripts/harness/validator-system/application/dto/run-l0-validators-input.ts +0 -9
- package/scripts/harness/validator-system/application/use-cases/run-l0-validators-usecase.ts +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -7,15 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.135.0] - 2026-05-09
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **WI-033 — `doc-freshness` / `pointer-validation` を L4 validators に昇格** — 既存の `p2:check-freshness` / `p2:validate-pointers` CLI を維持しつつ、`validate --layer L4` で L4-004 / L4-005 として実行されるようにした。
|
|
15
|
+
- `validator-system` に `L4-004 doc-freshness` / `L4-005 pointer-validation` を登録し、preset ごとの enable / disable 判定に対応。
|
|
16
|
+
- default の検査対象は `phasegate.config.json` の `paths.designDocs` から導出し、`paths.inceptionDocs` と archive 配下の計画・履歴文書は pointer validation の対象外にした。
|
|
17
|
+
- Markdown pointer 抽出を改善し、相対リンク・アンカー・行番号 suffix を正規化しつつ、placeholder / template / glob 表現の false positive を抑制。
|
|
18
|
+
- `docs/contracts/lesson-artifact.schema.json` を追加し、ci-governance / skill-quality 間の lesson artifact 契約参照を実在化。
|
|
19
|
+
- 旧ディレクトリ構成を指していた設計文書内の test path 参照を現行構成へ整理し、`p2:validate-pointers` は `broken=0` を確認済み。
|
|
20
|
+
|
|
21
|
+
## [0.134.0] - 2026-05-08
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **WI-034: L0 legacy validator (`L0-001` / `L0-002`) の撤去** — `validator-system` から FUSE 時代の未実装 validator 定義と `RunL0ValidatorsUseCase` を削除し、config schema / `phasegate.config.json` から `layers.L0` を撤去。`list-errors --layer L0` は空のままになり、`validate --layer L0` は runtime L0 が agent-integration hooks と Husky hooks で提供される旨の案内を表示して exit 0 で終了する。
|
|
26
|
+
- **Migration guide**: CI で `phasegate validate --layer L0` を実行していた場合、そのジョブは削除してください。L0 相当の防御は `.claude/settings.json` / `.codex/hooks.json` の runtime hook と `.husky/pre-commit` / `.husky/commit-msg` で有効化し、CI 側は `phasegate validate --layer L2` / `--layer L3` / `--layer L4` または `--layer all` に移行します。
|
|
27
|
+
|
|
10
28
|
## [0.133.0] - 2026-05-08
|
|
11
29
|
|
|
12
30
|
### Added
|
|
13
31
|
|
|
14
32
|
- **WI-095 — L4-001 drift-detect の design pointers 対応** — 設計見出し直下の `<!-- pointers: ... -->` / `<pointers>` block で実装ファイルpathを明示できるようにし、設計名とcode export名が異なる移行中ケースのfalse positiveを抑制。ADR-018でsyntaxとORセマンティクスを定義。
|
|
33
|
+
- **post-publish dogfood**: `/private/tmp/phasegate-dogfood-0.133.0` で `npx phasegate@0.133.0 phasegate:detect-drift --json` を実行。設計見出し `UserProfile` に `<!-- pointers: scripts/harness/sample-unit/domain/user-profile.ts -->` を付け、コード側は `export class UserProfileV2 {}` とした状態で `drifts: [] / totalCount: 0` を確認。
|
|
15
34
|
|
|
16
35
|
### Fixed
|
|
17
36
|
|
|
18
37
|
- **WI-096 — `phasegate:status` が `layers.L?.enabled` user override を表示に反映しない問題を修正** — status表示用のenabledLayersをpreset値と明示overrideから合成し、`strict + L4.enabled:false` / `minimal + L4.enabled:true` の双方に対応。
|
|
38
|
+
- **post-publish dogfood**: `npx phasegate@0.133.0 phasegate:status --json` で `project.preset: "minimal" + layers.L4.enabled: true` の L4 `enabled: true`、および `project.preset: "strict" + layers.L4.enabled: false` の L4 `enabled: false` を確認。
|
|
19
39
|
|
|
20
40
|
## [0.132.0] - 2026-05-08
|
|
21
41
|
|
package/README.ja.md
CHANGED
|
@@ -161,8 +161,6 @@ npx phasegate update-skills # スキルを最新版に再デプロイ
|
|
|
161
161
|
|
|
162
162
|
エラーは `HarnessError` 形式(理由 / ADR 参照 / 修正例)で返されるため、AI agent が自己修正できます。
|
|
163
163
|
|
|
164
|
-
> `--layer L0` の `L0-001` / `L0-002` は legacy validator で `enabled: false`。実体の L0 は agent-integration の hook と Husky です。
|
|
165
|
-
|
|
166
164
|
詳細: [5-Layer Defense Model](docs/guide/layer-model.md)
|
|
167
165
|
|
|
168
166
|
---
|
|
@@ -238,7 +236,7 @@ L2-STORY-REFLECTION バリデータがこのアノテーションを検出し、
|
|
|
238
236
|
"project": { "name": "my-project", "preset": "standard" },
|
|
239
237
|
"architecture": { "preset": "clean" },
|
|
240
238
|
"layers": {
|
|
241
|
-
"
|
|
239
|
+
"L1": { "enabled": true },
|
|
242
240
|
"L2": { "enabled": true }, "L3": { "enabled": true },
|
|
243
241
|
"L4": { "enabled": false }
|
|
244
242
|
},
|
|
@@ -456,7 +454,6 @@ reports/
|
|
|
456
454
|
| **[WI-031](docs/inception/_cross/WI-031/description.md)** | CI template の二系統統一 + `phasegate init --with-ci` |
|
|
457
455
|
| **[WI-032](docs/inception/_cross/WI-032/description.md)** | AGENTS.md / CLAUDE.md auto-refresh パイプライン |
|
|
458
456
|
| **[WI-033](docs/inception/_cross/WI-033/description.md)** | `doc-freshness` / `pointer-validation` を L4 validator に昇格 |
|
|
459
|
-
| **[WI-034](docs/inception/_cross/WI-034/description.md)** | L0 legacy validator (`L0-001` / `L0-002`) の撤去 |
|
|
460
457
|
|
|
461
458
|
L3 Nyquist Validation の `requirement-test-matrix.json` 自動生成はまだ未自動化です。現時点では手動セットアップで利用できます。
|
|
462
459
|
|
package/README.md
CHANGED
|
@@ -157,8 +157,6 @@ npx phasegate update-skills
|
|
|
157
157
|
| L3 | CI/CD pipeline | Security, performance, coverage (90%/95%), requirements traceability |
|
|
158
158
|
| L4 | Scheduled (weekly). Currently `layers.L4.enabled: false` by default — opt-in per project | Design-code drift, cross-document consistency, dead code, doc freshness, pointer validation |
|
|
159
159
|
|
|
160
|
-
> The `L0-001` / `L0-002` validators that appear in `list-errors --layer L0` output are legacy definitions from an earlier design and are disabled by default (`layers.L0.enabled: false`). The runtime L0 enforcement happens via the agent-integration hook scripts and Husky git hooks listed above, not via those validators.
|
|
161
|
-
|
|
162
160
|
---
|
|
163
161
|
|
|
164
162
|
## 28 Skills
|
|
@@ -339,7 +337,6 @@ For selection guidance and config examples see [Preset Selection Guide](docs/gui
|
|
|
339
337
|
{
|
|
340
338
|
"project": { "name": "my-project", "preset": "standard" },
|
|
341
339
|
"layers": {
|
|
342
|
-
"L0": { "enabled": false },
|
|
343
340
|
"L1": { "enabled": true },
|
|
344
341
|
"L2": { "enabled": true },
|
|
345
342
|
"L3": { "enabled": true },
|
|
@@ -468,7 +465,7 @@ npx phasegate <command> [options]
|
|
|
468
465
|
|---|---|
|
|
469
466
|
| `init --name <name>` | Initialize project, deploy skills, generate config |
|
|
470
467
|
| `lint` | Run L1 Biome AST checks |
|
|
471
|
-
| `validate --layer <
|
|
468
|
+
| `validate --layer <L2-L4\|all>` | Run validators for specified layer (`--layer L0` prints runtime hook guidance) |
|
|
472
469
|
| `ci-check` | Full CI check (L2-L4) |
|
|
473
470
|
| `update-skills` | Update skills to latest version |
|
|
474
471
|
| `phasegate:status` | Display overall harness health summary |
|
|
@@ -518,7 +515,6 @@ The main path is ready for project use, but a few documented behaviors still req
|
|
|
518
515
|
| **[WI-031](docs/inception/_cross/WI-031/description.md)** | CI template unification + `phasegate init --with-ci` | Today the bundled YAML and the `ci:generate-template` output diverge (different cron schedule, only the bundled one creates GitHub Issues). `phasegate init` does not deploy the workflow, so L4 only runs after the user manually copies the file. WI-031 unifies the two paths and adds an opt-in deploy flag. |
|
|
519
516
|
| **[WI-032](docs/inception/_cross/WI-032/description.md)** | AGENTS.md / CLAUDE.md auto-refresh pipeline | `ci:migrate-agents-md` exists as a one-shot CLI but there is no scheduled job, and CLAUDE.md is fully hand-maintained. WI-032 adds an `auto-refresh-agent-context` workflow plus a template-driven CLAUDE.md regenerator that preserves user-owned sections. |
|
|
520
517
|
| **[WI-033](docs/inception/_cross/WI-033/description.md)** | Promote `doc-freshness` / `pointer-validation` to L4 validators | Both capabilities exist as `p2:check-freshness` / `p2:validate-pointers` CLI commands but are not registered as L4 validators, so `validate --layer L4` skips them. WI-033 plumbs them through `validator-system` so they run via the standard L4 path and presets. |
|
|
521
|
-
| **[WI-034](docs/inception/_cross/WI-034/description.md)** | Retire legacy L0 validators (`L0-001` / `L0-002`) | The `fuse-hook-config` / `fuse-mount-status` validator IDs are leftovers from an earlier FUSE-based design. They are disabled by default and have no actual implementation behind them. WI-034 removes them and lets the agent-integration runtime hooks be the sole L0 surface. |
|
|
522
518
|
|
|
523
519
|
`requirement-test-matrix.json` auto-generation for L3 Nyquist Validation is not automated yet; see the L3 guide for the current manual setup.
|
|
524
520
|
|
package/bin/phasegate
CHANGED
|
@@ -12,6 +12,8 @@ if command -v tsx >/dev/null 2>&1; then
|
|
|
12
12
|
exec tsx "$MAIN_TS" "$@"
|
|
13
13
|
elif [ -f "$PACKAGE_DIR/node_modules/.bin/tsx" ]; then
|
|
14
14
|
exec "$PACKAGE_DIR/node_modules/.bin/tsx" "$MAIN_TS" "$@"
|
|
15
|
+
elif [ -f "$PACKAGE_DIR/../.bin/tsx" ]; then
|
|
16
|
+
exec "$PACKAGE_DIR/../.bin/tsx" "$MAIN_TS" "$@"
|
|
15
17
|
else
|
|
16
18
|
echo "Error: tsx not found. Run: npm install" >&2
|
|
17
19
|
exit 1
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://phasegate.dev/schemas/lesson-artifact.schema.json",
|
|
4
|
+
"title": "Lesson Artifact Contract",
|
|
5
|
+
"description": "Cross-unit contract for Agent-Lesson artifacts exchanged by ci-governance and skill-quality.",
|
|
6
|
+
"oneOf": [
|
|
7
|
+
{
|
|
8
|
+
"$ref": "#/definitions/lessonArtifact"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"$ref": "#/definitions/storyLessonArtifact"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"definitions": {
|
|
15
|
+
"lessonArtifact": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": ["lessonId", "source", "content", "tags", "timestamp"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"lessonId": {
|
|
21
|
+
"type": "string",
|
|
22
|
+
"minLength": 1
|
|
23
|
+
},
|
|
24
|
+
"source": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"minLength": 1
|
|
27
|
+
},
|
|
28
|
+
"content": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"minLength": 1
|
|
31
|
+
},
|
|
32
|
+
"tags": {
|
|
33
|
+
"type": "array",
|
|
34
|
+
"items": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"timestamp": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"format": "date-time"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"storyLessonArtifact": {
|
|
45
|
+
"type": "object",
|
|
46
|
+
"additionalProperties": false,
|
|
47
|
+
"required": ["storyId", "lessons"],
|
|
48
|
+
"properties": {
|
|
49
|
+
"storyId": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"pattern": "^H[0-9]+-[0-9]+$"
|
|
52
|
+
},
|
|
53
|
+
"lessons": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": {
|
|
56
|
+
"$ref": "#/definitions/lessonArtifact"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"additionalProperties": false,
|
|
4
|
+
"required": ["version", "generatedAt", "stories"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"version": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"generatedAt": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"stories": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"items": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"required": ["storyId", "storyMappings"],
|
|
18
|
+
"properties": {
|
|
19
|
+
"storyId": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"pattern": "^H\\d{2}-\\d{2}$"
|
|
22
|
+
},
|
|
23
|
+
"storyMappings": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["acId", "testReferences"],
|
|
29
|
+
"properties": {
|
|
30
|
+
"acId": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"pattern": "^AC-[1-9][0-9]*$"
|
|
33
|
+
},
|
|
34
|
+
"testReferences": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"additionalProperties": false,
|
|
39
|
+
"required": ["filePath", "testType"],
|
|
40
|
+
"properties": {
|
|
41
|
+
"filePath": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"minLength": 1
|
|
44
|
+
},
|
|
45
|
+
"testType": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"enum": ["unit", "it", "scenario"]
|
|
48
|
+
},
|
|
49
|
+
"testName": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -15,7 +15,6 @@ This file is the **Single Source of Truth** for all quality configuration in a P
|
|
|
15
15
|
"preset": "standard" // "minimal" | "standard" | "strict"
|
|
16
16
|
},
|
|
17
17
|
"layers": {
|
|
18
|
-
"L0": { "enabled": false },
|
|
19
18
|
"L1": { "enabled": true },
|
|
20
19
|
"L2": { "enabled": true },
|
|
21
20
|
"L3": { "enabled": true },
|
|
@@ -52,13 +52,13 @@ Deployed by `phasegate init --with-husky` into `.husky/`.
|
|
|
52
52
|
| **.husky/pre-commit** | `npx phasegate pre-commit` | Runs L2 validators (phase-gate / metadata / story-reflection / test-quality) on staged files. Fails the commit on violation. |
|
|
53
53
|
| **.husky/commit-msg** | `npx phasegate commit-msg $1` | Enforces the `Work-Item: WI-XXX` trailer when WI directories or their contents are staged. Ensures every commit is traceable to a work item. |
|
|
54
54
|
|
|
55
|
-
### About
|
|
55
|
+
### About `validate --layer L0`
|
|
56
56
|
|
|
57
57
|
```bash
|
|
58
58
|
npx phasegate validate --layer L0
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
`
|
|
61
|
+
`validate --layer L0` is kept as a compatibility alias that prints guidance and exits successfully. Runtime L0 enforcement happens via the agent-runtime hooks and Husky git hooks above. `list-errors --layer L0` returns no validator definitions.
|
|
62
62
|
|
|
63
63
|
---
|
|
64
64
|
|
|
@@ -147,8 +147,8 @@ L4 validators are designed to run on a weekly schedule and detect slow-moving dr
|
|
|
147
147
|
| **drift-detect** | L4-001 | Bidirectional design-code drift detection. Compares design documents against the actual codebase to find divergence in either direction. |
|
|
148
148
|
| **consistency-check** | L4-002 | Cross-document layer consistency. Ensures that references between design documents, ADRs, and code remain coherent. |
|
|
149
149
|
| **dead-code** | L4-003 | Detects unused exports and unreachable code that should be removed. |
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
| **doc-freshness** | L4-004 | Checks whether design documents exceed the configured freshness threshold. The standalone `p2:check-freshness` CLI remains available. |
|
|
151
|
+
| **pointer-validation** | L4-005 | Validates file-path pointers embedded in design documents. The standalone `p2:validate-pointers` CLI remains available. |
|
|
152
152
|
|
|
153
153
|
### Drift-detect design pointers
|
|
154
154
|
|
|
@@ -227,14 +227,14 @@ History: prior to v0.131.0, the aggregator's `failOnWarning` flag was effectivel
|
|
|
227
227
|
|
|
228
228
|
Presets control which layers are active. Choose based on project maturity and team discipline.
|
|
229
229
|
|
|
230
|
-
| Preset | L0
|
|
230
|
+
| Preset | L0 hooks | L1 | L2 | L3 | L4 |
|
|
231
231
|
|------------|-----|-----|-----|-----|-----|
|
|
232
|
-
| `minimal` |
|
|
233
|
-
| `standard` |
|
|
234
|
-
| `strict` |
|
|
232
|
+
| `minimal` | installed separately | on | on | off | off |
|
|
233
|
+
| `standard` | installed separately | on | on | on | off |
|
|
234
|
+
| `strict` | installed separately | on | on | on | on |
|
|
235
235
|
|
|
236
236
|
- **minimal** — Suitable for early prototyping. Editor-time rules and pre-commit checks only.
|
|
237
237
|
- **standard** — Recommended for active development. Adds CI/CD validators for security, performance, coverage, and traceability.
|
|
238
|
-
- **strict** — Full defense. Enables
|
|
238
|
+
- **strict** — Full defense. Enables scheduled drift detection (L4). Runtime L0 hooks are configured through the agent and Husky hook files, not through validator presets.
|
|
239
239
|
|
|
240
240
|
Presets are configured in `phasegate.config.json`, the single source of truth for all quality settings.
|
|
@@ -1,64 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# アーキテクチャ原則
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
各Unitの固有ルールは対応する `unitN-developer.md` に記述されている。
|
|
3
|
+
この文書を設計・実装判断の共通原則とする。Unit 固有の詳細は `docs/product/` と `docs/inception/` の該当文書に従う。
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## 基本方針
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- **設計書駆動**: 実装前に該当 WI、inception、product docs を読み、仕様を確認する。推測で実装しない。
|
|
8
|
+
- **PhaseGate 優先**: `docs/folder_management_rules.md` の AIDLC フェーズ順序を守る。実装前に必要な inception 成果物と product 反映を確認する。
|
|
9
|
+
- **既存設計尊重**: 変更対象と周辺コードを読み、既存の責務分割、命名、テスト粒度に合わせる。
|
|
10
|
+
- **最小変更**: 依頼された目的に必要な範囲だけを変更する。無関係なリファクタリングや先回りの抽象化をしない。
|
|
11
|
+
- **テストで証明**: 重要なふるまいは自動テストで確認する。手動確認だけで完了扱いにしない。
|
|
9
12
|
|
|
10
|
-
##
|
|
13
|
+
## アーキテクチャ境界
|
|
11
14
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
- **ドメインモデルの豊かさ:** ビジネスロジックは値オブジェクト・エンティティ・集約に配置することを最優先とする。Usecaseは集約の取得・永続化・ドメインイベント発行などの調整役に徹する。ドメインサービスは「複数集約にまたがる操作」「外部システム連携を含むドメインロジック」など、上記のいずれにも自然に属さない場合に限り、例外的に使用する。安易にドメインサービスを作ることで集約が貧血モデル(Anemic Domain Model)に陥ることを防ぐ。
|
|
15
|
+
- ヘキサゴナルアーキテクチャと DDD の方針に従う。
|
|
16
|
+
- ドメイン層は外側の infrastructure / presentation に依存しない。
|
|
17
|
+
- UseCase は調整役とし、ビジネスルールは可能な限り Entity / Value Object / Aggregate に置く。
|
|
18
|
+
- Domain Service は、Entity / Value Object / Aggregate に自然に属さない複数概念のルールに限って使う。
|
|
19
|
+
- Port はアプリケーション境界を表し、外部 I/O の詳細は Adapter に閉じ込める。
|
|
18
20
|
|
|
19
|
-
##
|
|
21
|
+
## 変更スコープ
|
|
20
22
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
23
|
+
- 原則として対象 Unit と、その変更に必要な共有契約だけを触る。
|
|
24
|
+
- cross-cutting WI では `description.md` の `affects` を確認し、影響 Unit の product 反映を揃える。
|
|
25
|
+
- プロジェクトルート外のファイルは触らない。
|
|
26
|
+
- ユーザーや他作業者の未関連変更を戻さない。
|
|
24
27
|
|
|
25
|
-
##
|
|
28
|
+
## 作業順序
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
> ※ バックエンド設計書・フロントエンド設計書・ユニット要件のパスは各Unitファイルを参照。
|
|
35
|
-
|
|
36
|
-
## 禁止事項(共通・絶対厳守)
|
|
37
|
-
|
|
38
|
-
- **NEVER:** 担当UnitとShared Kernal以外のUnitに関するコードを変更する(依存関係がある場合や、全体最適のために必要な場合を除く)
|
|
39
|
-
- **NEVER:** 担当UnitとShared Kernal以外のUnitの設計書を参照・変更する(依存関係がある場合や、ドメイン用語集を除く)
|
|
40
|
-
- **NEVER:** プロジェクトルート外でのファイル操作
|
|
41
|
-
- **NEVER:** 設計書を確認せずに実装を開始する
|
|
42
|
-
- **NEVER:** 既存コードを読まずに変更する
|
|
43
|
-
|
|
44
|
-
## 必須事項(共通)
|
|
45
|
-
|
|
46
|
-
- **YOU MUST:** 実装開始前に担当Unitの設計書を確認する(バックエンド設計書・フロントエンド設計書の両方)
|
|
47
|
-
- **YOU MUST:** ドメイン用語は `atomica_ubiquitous_word.md` に従う(コード内の命名も含む)
|
|
48
|
-
- **YOU MUST:** 既存の実装コードを確認してから変更を行う
|
|
49
|
-
|
|
50
|
-
## ワークフロー(共通)
|
|
51
|
-
|
|
52
|
-
タスクを受け取ったら、以下の順序で作業する。
|
|
53
|
-
|
|
54
|
-
1. **設計書の確認** — 該当する設計書を読み、仕様・制約・ドメインルールを把握する
|
|
55
|
-
2. **既存コードの確認** — 変更対象と周辺のコードを読み、設計意図とパターンを理解する
|
|
56
|
-
3. **テストの作成(TDD)** — 実装に先立ち、仕様を満たすために必要最小限のテストを書く。E2Eテスト・インテグレーションテスト・ユニットテストを適切な粒度で用意し、まず失敗する状態(Red)を確認する
|
|
57
|
-
4. **実装** — テストを通過させることを目標に、設計書に忠実かつ既存パターンに従って最小限の変更を行う(Green)
|
|
58
|
-
5. **リファクタリング** — テストが通る状態を維持しながら、コードの可読性・設計品質を改善する(Refactor)
|
|
59
|
-
6. **シナリオ確認** — 各Unitファイルに定義された確認フローを実行する
|
|
60
|
-
7. **レポート出力** — 完了報告を出力する
|
|
61
|
-
|
|
62
|
-
## スコープ境界(共通原則)
|
|
63
|
-
|
|
64
|
-
担当Unitの範囲内でのみ作業する。他のUnitのコード・設計書には関与しない。自分の担当領域を完璧に仕上げることが、プロジェクト全体の品質につながるという信念を持つ。
|
|
30
|
+
1. 関連する inception / product docs を確認する。
|
|
31
|
+
2. 変更対象と周辺コードを読む。
|
|
32
|
+
3. 必要なら先にテストを追加・更新する。
|
|
33
|
+
4. 最小実装でテストを通す。
|
|
34
|
+
5. 必要な検証コマンドを実行する。
|
|
35
|
+
6. 変更内容、検証結果、未検証事項を報告する。
|
|
@@ -1,176 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# モデルルーティング原則
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
**Opus = 決める、Sonnet = 広げる、Codex = 作る。**
|
|
6
|
-
|
|
7
|
-
| 役割 | モデル | 得意領域 |
|
|
8
|
-
|------|--------|---------|
|
|
9
|
-
| Architect | Opus 4.6 | 発明・判断・骨格設計・品質レビュー |
|
|
10
|
-
| Expander | Sonnet 4.6 | 展開・量産・構造化・列挙 |
|
|
11
|
-
| Implementor | Codex GPT-5.4 | TDD実装・repo整合・コード生成 |
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## モデル割り当て表
|
|
16
|
-
|
|
17
|
-
### 骨格設計(Opus 4.6 — メインセッション内実行)
|
|
18
|
-
|
|
19
|
-
| Skill | AIDLC Step | 理由 |
|
|
20
|
-
|-------|-----------|------|
|
|
21
|
-
| `product-architect` | 0 | プロダクト全体像の発明・制約統合 |
|
|
22
|
-
| `domain-designer` | 2.1 | 集約境界・不変条件の発明 |
|
|
23
|
-
| `logical-designer` | 2.2 | 横断設計の骨格判断 |
|
|
24
|
-
| `uiux-designer` | 7 | 体験設計・導線の発明 |
|
|
25
|
-
| `kimunii-perspective` | Any | 多角的な品質判断 |
|
|
26
|
-
| `skill-creator` | Tooling | スキル設計・構造化 |
|
|
27
|
-
|
|
28
|
-
### 展開・量産(Sonnet 4.6 — 委任実行 → Opusレビュー)
|
|
29
|
-
|
|
30
|
-
| Skill | AIDLC Step | 理由 |
|
|
31
|
-
|-------|-----------|------|
|
|
32
|
-
| `story-writer` | 1.1 | US一覧の粒度統一・量産 |
|
|
33
|
-
| `unit-designer` | 1.2 | Unit-USマッピング表の量産 |
|
|
34
|
-
| `story-mapper` | 1.5 | MVP整理・優先順位表化 |
|
|
35
|
-
| `mock-designer` | 2 | 画面一覧・状態展開 |
|
|
36
|
-
| `environment-designer` | 2.2並行 | 環境構成の列挙・整理 |
|
|
37
|
-
| `scenario-test-designer` | 6 | E2Eテストケース列挙 |
|
|
38
|
-
| `unit-test-designer` | 8前段 | ユニットテストケース列挙 |
|
|
39
|
-
| `it-test-designer` | 8前段 | ITテストケース列挙 |
|
|
40
|
-
| `unit-test-logic-designer` | 8前段 | テスト疑似コード展開 |
|
|
41
|
-
| `it-test-logic-designer` | 8前段 | IT疑似コード展開 |
|
|
42
|
-
| `scenario-test-logic-designer` | 8前段 | E2E疑似コード展開 |
|
|
43
|
-
| `implementation-planner` | 実装前 | 実装計画の構造化展開 |
|
|
44
|
-
| `cascade-updater` | 全工程 | 上位文書への変更波及 |
|
|
45
|
-
| `consistency-checker` | 全工程 | 文書間整合チェック |
|
|
46
|
-
| `test-coverage-checker` | 6以降 | カバレッジ網羅性検証 |
|
|
47
|
-
| `implementation-readiness-checker` | 実装前 | 準備状況チェック |
|
|
48
|
-
|
|
49
|
-
### 接地・実装(Codex GPT-5.4 — codex-delegator経由)
|
|
50
|
-
|
|
51
|
-
| Skill | AIDLC Step | 理由 |
|
|
52
|
-
|-------|-----------|------|
|
|
53
|
-
| `story-implementor` | 2.3-2.7 | TDD実装(コード生成) |
|
|
54
|
-
| `codex-delegator` | Any | 並列タスク委任 |
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Sonnet委任プロトコル
|
|
59
|
-
|
|
60
|
-
### 実行フロー
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
┌─────────────────────────────────────────────────┐
|
|
64
|
-
│ Phase 1: 計画(Opus in-session) │
|
|
65
|
-
│ - Skillのプロンプトに従い計画を立案 │
|
|
66
|
-
│ - 出力: Sonnetへの委任プロンプト + レビュー観点 │
|
|
67
|
-
│ → 人間承認待ち │
|
|
68
|
-
├─────────────────────────────────────────────────┤
|
|
69
|
-
│ Phase 2: 実行(Sonnet委任) │
|
|
70
|
-
│ - delegate-sonnet.sh 経由で Sonnet 4.6 に委任 │
|
|
71
|
-
│ - Sonnetはファイル読み取り + 文書生成のみ │
|
|
72
|
-
│ - 出力: 設計文書(mdファイル) │
|
|
73
|
-
├─────────────────────────────────────────────────┤
|
|
74
|
-
│ Phase 3: レビュー(Opus in-session) │
|
|
75
|
-
│ - Sonnet出力を品質基準で検証 │
|
|
76
|
-
│ - PASS → 完了 │
|
|
77
|
-
│ - FAIL → Opusが直接修正 │
|
|
78
|
-
└─────────────────────────────────────────────────┘
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Phase 2: Sonnet委任
|
|
3
|
+
この文書は、複数モデルやサブエージェントを使う場合の判断基準を定義する。固定のモデル名やバージョンではなく、役割で判断する。
|
|
82
4
|
|
|
83
|
-
|
|
5
|
+
## 役割
|
|
84
6
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
--context "読み込みファイル1,読み込みファイル2"
|
|
91
|
-
```
|
|
7
|
+
| 役割 | 主な責務 |
|
|
8
|
+
|------|----------|
|
|
9
|
+
| Architect | 判断、骨格設計、品質レビュー、トレードオフ整理 |
|
|
10
|
+
| Expander | 既存方針に沿った列挙、表作成、章展開、整合チェック |
|
|
11
|
+
| Implementor | TDD 実装、リポジトリ整合、検証、修正 |
|
|
92
12
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
[コンテキスト層] 読むべきファイルパス + 上位設計文書の引用
|
|
97
|
-
[タスク層] 作業内容、入力ファイル、出力ファイルパスと期待フォーマット
|
|
98
|
-
[制約層] 変更許可ファイル、スコープ制限、フォーマット規約
|
|
99
|
-
[禁止層] 判断を含む作業の禁止(判断はOpusが行う)
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
#### Sonnetに委任してよい作業
|
|
103
|
-
|
|
104
|
-
- 一覧表・マトリクスの作成
|
|
105
|
-
- テストケースの列挙
|
|
106
|
-
- 既存骨格に沿った章展開
|
|
107
|
-
- 用語表・制約表の整理
|
|
108
|
-
- 設計文書間のマッピング表作成
|
|
109
|
-
- チェックリストの実行
|
|
110
|
-
|
|
111
|
-
#### Sonnetに委任してはいけない作業
|
|
112
|
-
|
|
113
|
-
- 集約境界の決定
|
|
114
|
-
- アーキテクチャ選択の判断
|
|
115
|
-
- 優先順位の最終決定
|
|
116
|
-
- トレードオフを伴う設計判断
|
|
117
|
-
- レビュー結果に基づく修正方針の決定
|
|
118
|
-
|
|
119
|
-
### Phase 3: Opusレビュープロトコル
|
|
120
|
-
|
|
121
|
-
#### レビュー観点(全Sonnet委任共通)
|
|
122
|
-
|
|
123
|
-
| ID | 観点 | 検証内容 | 重大度 |
|
|
124
|
-
|----|------|---------|--------|
|
|
125
|
-
| R1 | 上位文書整合 | 上位設計文書(product_overview, domain設計等)との矛盾がないか | BLOCK |
|
|
126
|
-
| R2 | 粒度一貫性 | 成果物内で抽象度・粒度が統一されているか | BLOCK |
|
|
127
|
-
| R3 | 網羅性 | 入力に含まれる要素が漏れなく展開されているか | BLOCK |
|
|
128
|
-
| R4 | 配置ルール | `folder_management_rules.md` に準拠しているか | BLOCK |
|
|
129
|
-
| R5 | 判断混入 | Sonnetが独自判断を行っていないか(骨格逸脱) | BLOCK |
|
|
130
|
-
| R6 | 表現品質 | 用語・文体がプロジェクト規約と統一されているか | WARN |
|
|
131
|
-
| R7 | YAGNI | スコープ外の「改善」「将来への備え」がないか | WARN |
|
|
132
|
-
|
|
133
|
-
#### 判定ロジック
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
BLOCK に 1つでも FAIL → Opus が直接修正
|
|
137
|
-
WARN のみ FAIL → Opus が直接修正(軽微)
|
|
138
|
-
全 PASS → 完了
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**重要: Sonnetへの再委任は行わない。** 修正はすべてOpusが直接行う。
|
|
142
|
-
理由: 修正は「何が問題か」の判断を含むため、Opus の責務である。
|
|
143
|
-
|
|
144
|
-
#### レビュー出力フォーマット
|
|
145
|
-
|
|
146
|
-
```markdown
|
|
147
|
-
## Opus Review
|
|
148
|
-
|
|
149
|
-
### 判定: PASS / FAIL
|
|
13
|
+
## 原則
|
|
150
14
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
15
|
+
- 判断を伴う設計・優先順位・境界決定は Architect が行う。
|
|
16
|
+
- 大量展開や一覧化は Expander に委任してよい。ただし、入力方針と出力ファイルを明確にする。
|
|
17
|
+
- 実装、テスト、リポジトリ内の整合修正は Implementor が担当する。
|
|
18
|
+
- 委任結果は必ず親エージェントがレビューし、配置ルール、上位文書整合、スコープ逸脱を確認する。
|
|
19
|
+
- ユーザーまたは実行環境の指示でサブエージェント利用が制限されている場合は、その指示を優先する。
|
|
154
20
|
|
|
155
|
-
|
|
156
|
-
- [R1] {ファイル}: {修正内容}
|
|
157
|
-
- ...
|
|
158
|
-
```
|
|
21
|
+
## 委任してよい作業
|
|
159
22
|
|
|
160
|
-
|
|
23
|
+
- 既存設計に沿ったテストケース列挙
|
|
24
|
+
- マトリクス、対応表、チェックリスト作成
|
|
25
|
+
- 用語や参照関係の整理
|
|
26
|
+
- 明確な入力に基づく文書章の展開
|
|
161
27
|
|
|
162
|
-
##
|
|
28
|
+
## 委任しない作業
|
|
163
29
|
|
|
164
|
-
|
|
30
|
+
- 集約境界やアーキテクチャ方針の決定
|
|
31
|
+
- 優先順位やスコープの最終判断
|
|
32
|
+
- 仕様の曖昧さを解釈して確定する作業
|
|
33
|
+
- レビュー指摘に対する修正方針の決定
|
|
165
34
|
|
|
166
|
-
|
|
167
|
-
|-------|-----------------|-------------------|
|
|
168
|
-
| `story-writer` | US粒度の判断基準、分割方針 | US一覧の列挙、受け入れ基準の標準化 |
|
|
169
|
-
| `logical-designer` | 横断設計の骨格、レイヤー方針 | 章展開、DTO/UseCase一覧、ケース表 |
|
|
170
|
-
| `unit-test-designer` | テスト戦略、重点観点 | テストケース一覧、境界値列挙 |
|
|
35
|
+
## レビュー観点
|
|
171
36
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
37
|
+
- `docs/folder_management_rules.md` に沿った配置か。
|
|
38
|
+
- 上位文書と矛盾していないか。
|
|
39
|
+
- 入力に含まれる要求が漏れていないか。
|
|
40
|
+
- 独自判断やスコープ外の提案が混ざっていないか。
|
|
41
|
+
- 用語、粒度、文体が既存文書と揃っているか。
|