phasegate 0.44.0 → 0.63.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 (52) hide show
  1. package/README.ja.md +32 -0
  2. package/README.md +33 -0
  3. package/docs/guide/codex-integration.md +162 -0
  4. package/docs/guide/quick-vs-full-mode.md +141 -0
  5. package/package.json +1 -1
  6. package/scripts/harness/agent-integration/domain/services/bash-write-target-extractor.ts +60 -0
  7. package/scripts/harness/agent-integration/presentation/phasegate-status-context.ts +299 -0
  8. package/scripts/harness/agent-integration/presentation/session-start-hook.ts +54 -0
  9. package/scripts/harness/agent-integration/presentation/user-prompt-submit-hook.ts +70 -0
  10. package/scripts/harness/config-foundation/infrastructure/schemas/harness-config-v2.schema.json +15 -0
  11. package/scripts/harness/integrations/pre-commit.ts +128 -28
  12. package/scripts/harness/main.ts +87 -9
  13. package/scripts/harness/phase2-extensions/application/dto/check-initial-creation-expiration-input.ts +9 -0
  14. package/scripts/harness/phase2-extensions/application/dto/check-initial-creation-expiration-output.ts +17 -0
  15. package/scripts/harness/phase2-extensions/application/usecases/check-initial-creation-expiration-usecase.ts +103 -0
  16. package/scripts/harness/phase2-extensions/composition-root.ts +22 -0
  17. package/scripts/harness/phase2-extensions/domain/aggregates/initial-creation-expiration-rule.ts +103 -0
  18. package/scripts/harness/phase2-extensions/domain/ports/frontmatter-reader-port.ts +17 -0
  19. package/scripts/harness/phase2-extensions/domain/ports/initial-creation-age-port.ts +9 -0
  20. package/scripts/harness/phase2-extensions/domain/ports/initial-creation-expiration-config-port.ts +9 -0
  21. package/scripts/harness/phase2-extensions/domain/services/initial-creation-expiration-check-service.ts +54 -0
  22. package/scripts/harness/phase2-extensions/domain/value-objects/initial-creation-age.ts +54 -0
  23. package/scripts/harness/phase2-extensions/infrastructure/adapters/git-log-initial-creation-age-adapter.ts +77 -0
  24. package/scripts/harness/phase2-extensions/infrastructure/adapters/harness-config-initial-creation-expiration-adapter.ts +57 -0
  25. package/scripts/harness/phase2-extensions/infrastructure/adapters/markdown-frontmatter-reader-adapter.ts +56 -0
  26. package/scripts/harness/phase2-extensions/presentation/formatters/initial-creation-expiration-result-formatter.ts +23 -0
  27. package/scripts/harness/phase2-extensions/presentation/handlers/check-initial-creation-expiration-handler.ts +38 -0
  28. package/scripts/harness/quick-mode/application/dto/change-category-classification-contract.ts +20 -0
  29. package/scripts/harness/quick-mode/application/usecases/classify-change-category-usecase.ts +83 -0
  30. package/scripts/harness/quick-mode/composition-root.ts +12 -0
  31. package/scripts/harness/quick-mode/domain/services/quick-mode-judgment-engine.ts +38 -32
  32. package/scripts/harness/quick-mode/domain/value-objects/quick-mode-config.ts +36 -4
  33. package/scripts/harness/quick-mode/infrastructure/adapters/harness-config-quick-mode-config-adapter.ts +6 -0
  34. package/scripts/harness/quick-mode/presentation/formatters/change-category-formatter.ts +42 -0
  35. package/scripts/harness/quick-mode/presentation/handlers/check-change-category-handler.ts +50 -0
  36. package/scripts/harness/setup/skill-deployer.ts +30 -0
  37. package/scripts/harness/traceability-model/composition-root.ts +14 -0
  38. package/scripts/harness/traceability-model/domain/value-objects/project-relative-path.ts +3 -0
  39. package/scripts/harness/traceability-model/infrastructure/parsers/markdown-story-annotation-parser.ts +39 -4
  40. package/scripts/harness/traceability-model/presentation/cli/validate-metadata-command-handler.ts +103 -9
  41. package/skills/domain-designer/SKILL.md +34 -0
  42. package/skills/it-test-logic-designer/SKILL.md +16 -0
  43. package/skills/logical-designer/SKILL.md +34 -0
  44. package/skills/quick-implementor/SKILL.md +10 -1
  45. package/skills/scenario-test-logic-designer/SKILL.md +16 -0
  46. package/skills/story-implementor/SKILL.md +58 -0
  47. package/skills/unit-designer/SKILL.md +41 -0
  48. package/skills/unit-test-logic-designer/SKILL.md +18 -0
  49. package/templates/.codex/hooks.json +63 -0
  50. package/templates/logical_design.template.md +79 -0
  51. package/templates/source.template.ts +18 -0
  52. package/templates/test.template.ts +37 -0
@@ -0,0 +1,63 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "startup|resume",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "npx phasegate hook session-start",
10
+ "statusMessage": "phasegate: loading session context"
11
+ }
12
+ ]
13
+ }
14
+ ],
15
+ "UserPromptSubmit": [
16
+ {
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "npx phasegate hook user-prompt-submit",
21
+ "statusMessage": "phasegate: refreshing status"
22
+ }
23
+ ]
24
+ }
25
+ ],
26
+ "PreToolUse": [
27
+ {
28
+ "matcher": "Bash",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "npx phasegate hook pre-tool-use",
33
+ "statusMessage": "phasegate: pre-tool-use check"
34
+ }
35
+ ]
36
+ }
37
+ ],
38
+ "PostToolUse": [
39
+ {
40
+ "matcher": "Bash",
41
+ "hooks": [
42
+ {
43
+ "type": "command",
44
+ "command": "npx phasegate hook post-tool-use",
45
+ "statusMessage": "phasegate: post-tool-use lint"
46
+ }
47
+ ]
48
+ }
49
+ ],
50
+ "Stop": [
51
+ {
52
+ "hooks": [
53
+ {
54
+ "type": "command",
55
+ "command": "npx phasegate hook stop",
56
+ "statusMessage": "phasegate: completion check",
57
+ "timeout": 30
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ }
63
+ }
@@ -0,0 +1,79 @@
1
+ ---
2
+ traceability:
3
+ initial_creation: true
4
+ ---
5
+
6
+ # 論理設計: <Unit名>
7
+
8
+ > **対応ストーリー**: <HXX-XX, HYY-YY>
9
+ > **作成日**: <YYYY-MM-DD>
10
+ > **Unit**: <UNIT_NAME>
11
+
12
+ ---
13
+
14
+ ## 概要
15
+
16
+ <このUnitが解決するビジネス課題を 2〜3 行で記述>
17
+
18
+ ---
19
+
20
+ ## ドメインモデル
21
+
22
+ @story-id <HXX-XX>
23
+ ### <集約 / エンティティ / 値オブジェクト名>
24
+
25
+ <不変条件・責務・関連の説明>
26
+
27
+ ---
28
+
29
+ ## ユースケース
30
+
31
+ @story-id <HXX-XX>
32
+ ### UC-001: <ユースケース名>
33
+
34
+ **As a** <役割>
35
+ **I want to** <達成したいこと>
36
+ **So that** <得られる価値>
37
+
38
+ #### 事前条件
39
+ - <前提>
40
+
41
+ #### 基本フロー
42
+ 1. <ステップ>
43
+
44
+ #### 例外フロー
45
+ - <エラーケース>
46
+
47
+ ---
48
+
49
+ ## 層構成(Clean Architecture)
50
+
51
+ ```
52
+ domain/ : Entity / ValueObject / Port / Domain Service
53
+ application/ : UseCase / DTO
54
+ infrastructure/ : Gateway / Adapter
55
+ presentation/ : CLI Handler / Controller
56
+ ```
57
+
58
+ ---
59
+
60
+ ## トレーサビリティメタデータの使い方
61
+
62
+ このテンプレートが emit する 2 種類のメタデータ:
63
+
64
+ ### 1. YAML frontmatter (`initial_creation: true`)
65
+ - 文書の**新規作成時のみ**付与する
66
+ - `@story-id` インライン注釈が必須であることを示すフラグ
67
+ - 2 回目以降の改訂では frontmatter を削除(または `false` に変更)して構わない
68
+
69
+ ### 2. `@story-id` インライン注釈
70
+ - ユーザーストーリーに紐づく設計要素の**直前に独立行で記述**
71
+ - 形式: `@story-id HXX-XX`
72
+ - ルール:
73
+ - 独立行(他のテキストと混在させない)
74
+ - 直後に設計要素(空行を挟まない)
75
+ - `HXX-XX` は `docs/product/user_stories.md` に存在する ID
76
+ - 複数ストーリー時は連続並列で並べ、最後の直後に設計要素
77
+
78
+ これらは `MetadataValidator.validateDesignDocument` で検証され、
79
+ ISSUE-008 Phase B-2 / B-3 以降は `npx phasegate validate-metadata` / pre-commit で自動チェックされる。
@@ -0,0 +1,18 @@
1
+ // @unit <UNIT_NAME>
2
+ // @layer <LAYER>
3
+
4
+ /**
5
+ * phasegate ソースファイルテンプレート
6
+ *
7
+ * 使い方:
8
+ * 1. `<UNIT_NAME>` を `docs/product/construction/` 配下の Unit ID に置換
9
+ * (例: traceability-model, harness-api)
10
+ * 2. `<LAYER>` を以下のいずれかに置換
11
+ * - domain : Entity / ValueObject / Port / Domain Service
12
+ * - application : UseCase / DTO / Application Service
13
+ * - infrastructure : Gateway / Adapter(外部 I/O 接続)
14
+ * - presentation : CLI Handler / Controller / Formatter
15
+ * 3. 配置ディレクトリと `@layer` 値を一致させる(L1-004 ルール)
16
+ *
17
+ * このメタデータは L1 Biome ルール(L1-001 / L1-002)で検証される。
18
+ */
@@ -0,0 +1,37 @@
1
+ // @unit <UNIT_NAME>
2
+ // @layer test
3
+ // @story <STORY_ID>
4
+
5
+ /**
6
+ * phasegate テストファイルテンプレート
7
+ *
8
+ * 使い方:
9
+ * 1. `<UNIT_NAME>` を被テスト実装と同じ Unit ID に置換
10
+ * 2. `<STORY_ID>` を本テストがカバーする User Story ID に置換
11
+ * (例: H03-02。複数カバーする場合は `H03-01, H03-02` のようにカンマ区切り)
12
+ * 3. `<TestSubject>` を対象のクラス / 関数名に置換
13
+ * 4. `target` / `context` は project の test-helpers から import される describe エイリアス
14
+ *
15
+ * このメタデータは `MetadataValidator.validateTest` で検証される:
16
+ * - `@story` が存在すること
17
+ * - `HXX-XX` 形式であること
18
+ * - `docs/product/user_stories.md`(StoryCatalog)に存在する ID であること
19
+ *
20
+ * pre-commit 経路で自動チェックされる(ISSUE-008 Phase C-3)。
21
+ */
22
+
23
+ import { describe, expect, it } from 'vitest';
24
+ import { target, context } from '../helpers/test-helpers.js';
25
+
26
+ target('<TestSubject>', () => {
27
+ context('<前提条件・シナリオ>', () => {
28
+ it('<期待される挙動を日本語で記述>', () => {
29
+ // Arrange
30
+ const input = 'TODO';
31
+ // Act
32
+ const actual = input;
33
+ // Assert
34
+ expect(actual).toBe('TODO');
35
+ });
36
+ });
37
+ });