takt 0.22.0 → 0.23.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 (101) hide show
  1. package/README.md +1 -0
  2. package/builtins/en/facets/instructions/implement-after-tests.md +52 -0
  3. package/builtins/en/facets/instructions/write-tests-first.md +55 -0
  4. package/builtins/en/facets/personas/architecture-reviewer.md +1 -0
  5. package/builtins/en/facets/policies/coding.md +30 -0
  6. package/builtins/en/piece-categories.yaml +4 -0
  7. package/builtins/en/pieces/default-test-first-mini.yaml +252 -0
  8. package/builtins/ja/facets/instructions/implement-after-tests.md +52 -0
  9. package/builtins/ja/facets/instructions/write-tests-first.md +55 -0
  10. package/builtins/ja/facets/personas/architecture-reviewer.md +1 -0
  11. package/builtins/ja/facets/policies/coding.md +30 -0
  12. package/builtins/ja/piece-categories.yaml +4 -0
  13. package/builtins/ja/pieces/default-test-first-mini.yaml +252 -0
  14. package/dist/agents/runner.d.ts +1 -8
  15. package/dist/agents/runner.d.ts.map +1 -1
  16. package/dist/agents/runner.js +30 -40
  17. package/dist/agents/runner.js.map +1 -1
  18. package/dist/app/cli/routing.d.ts.map +1 -1
  19. package/dist/app/cli/routing.js +2 -0
  20. package/dist/app/cli/routing.js.map +1 -1
  21. package/dist/commands/repertoire/add.d.ts.map +1 -1
  22. package/dist/commands/repertoire/add.js +3 -2
  23. package/dist/commands/repertoire/add.js.map +1 -1
  24. package/dist/core/models/persisted-global-config.d.ts +9 -0
  25. package/dist/core/models/persisted-global-config.d.ts.map +1 -1
  26. package/dist/core/models/schemas.d.ts +5 -0
  27. package/dist/core/models/schemas.d.ts.map +1 -1
  28. package/dist/core/models/schemas.js +9 -0
  29. package/dist/core/models/schemas.js.map +1 -1
  30. package/dist/core/piece/provider-resolution.d.ts +5 -0
  31. package/dist/core/piece/provider-resolution.d.ts.map +1 -1
  32. package/dist/core/piece/provider-resolution.js +27 -6
  33. package/dist/core/piece/provider-resolution.js.map +1 -1
  34. package/dist/features/pipeline/execute.d.ts +7 -5
  35. package/dist/features/pipeline/execute.d.ts.map +1 -1
  36. package/dist/features/pipeline/execute.js +90 -172
  37. package/dist/features/pipeline/execute.js.map +1 -1
  38. package/dist/features/pipeline/steps.d.ts +26 -0
  39. package/dist/features/pipeline/steps.d.ts.map +1 -0
  40. package/dist/features/pipeline/steps.js +159 -0
  41. package/dist/features/pipeline/steps.js.map +1 -0
  42. package/dist/features/tasks/execute/postExecution.d.ts +2 -0
  43. package/dist/features/tasks/execute/postExecution.d.ts.map +1 -1
  44. package/dist/features/tasks/execute/postExecution.js +7 -1
  45. package/dist/features/tasks/execute/postExecution.js.map +1 -1
  46. package/dist/features/tasks/execute/resolveTask.d.ts.map +1 -1
  47. package/dist/features/tasks/execute/resolveTask.js +2 -2
  48. package/dist/features/tasks/execute/resolveTask.js.map +1 -1
  49. package/dist/features/tasks/execute/selectAndExecute.d.ts.map +1 -1
  50. package/dist/features/tasks/execute/selectAndExecute.js +39 -27
  51. package/dist/features/tasks/execute/selectAndExecute.js.map +1 -1
  52. package/dist/features/tasks/execute/taskExecution.d.ts.map +1 -1
  53. package/dist/features/tasks/execute/taskExecution.js +6 -2
  54. package/dist/features/tasks/execute/taskExecution.js.map +1 -1
  55. package/dist/features/tasks/execute/types.d.ts +4 -0
  56. package/dist/features/tasks/execute/types.d.ts.map +1 -1
  57. package/dist/features/tasks/list/taskRetryActions.d.ts.map +1 -1
  58. package/dist/features/tasks/list/taskRetryActions.js +34 -6
  59. package/dist/features/tasks/list/taskRetryActions.js.map +1 -1
  60. package/dist/features/tasks/list/taskStatusLabel.d.ts.map +1 -1
  61. package/dist/features/tasks/list/taskStatusLabel.js +4 -1
  62. package/dist/features/tasks/list/taskStatusLabel.js.map +1 -1
  63. package/dist/infra/claude/session-reader.d.ts.map +1 -1
  64. package/dist/infra/claude/session-reader.js +68 -4
  65. package/dist/infra/claude/session-reader.js.map +1 -1
  66. package/dist/infra/config/env/config-env-overrides.d.ts.map +1 -1
  67. package/dist/infra/config/env/config-env-overrides.js +4 -0
  68. package/dist/infra/config/env/config-env-overrides.js.map +1 -1
  69. package/dist/infra/config/global/globalConfig.d.ts.map +1 -1
  70. package/dist/infra/config/global/globalConfig.js +8 -0
  71. package/dist/infra/config/global/globalConfig.js.map +1 -1
  72. package/dist/infra/config/project/projectConfig.d.ts.map +1 -1
  73. package/dist/infra/config/project/projectConfig.js +17 -6
  74. package/dist/infra/config/project/projectConfig.js.map +1 -1
  75. package/dist/infra/config/resolveConfigValue.d.ts.map +1 -1
  76. package/dist/infra/config/resolveConfigValue.js +3 -20
  77. package/dist/infra/config/resolveConfigValue.js.map +1 -1
  78. package/dist/infra/config/types.d.ts +6 -8
  79. package/dist/infra/config/types.d.ts.map +1 -1
  80. package/dist/infra/task/clone.d.ts +25 -1
  81. package/dist/infra/task/clone.d.ts.map +1 -1
  82. package/dist/infra/task/clone.js +62 -3
  83. package/dist/infra/task/clone.js.map +1 -1
  84. package/dist/infra/task/index.d.ts +1 -1
  85. package/dist/infra/task/index.d.ts.map +1 -1
  86. package/dist/infra/task/index.js +1 -1
  87. package/dist/infra/task/index.js.map +1 -1
  88. package/dist/infra/task/mapper.d.ts.map +1 -1
  89. package/dist/infra/task/mapper.js +1 -0
  90. package/dist/infra/task/mapper.js.map +1 -1
  91. package/dist/infra/task/summarize.d.ts.map +1 -1
  92. package/dist/infra/task/summarize.js +2 -3
  93. package/dist/infra/task/summarize.js.map +1 -1
  94. package/dist/infra/task/types.d.ts +1 -0
  95. package/dist/infra/task/types.d.ts.map +1 -1
  96. package/dist/shared/i18n/labels_en.yaml +3 -0
  97. package/dist/shared/i18n/labels_ja.yaml +3 -0
  98. package/dist/shared/prompt/confirm.d.ts.map +1 -1
  99. package/dist/shared/prompt/confirm.js +35 -19
  100. package/dist/shared/prompt/confirm.js.map +1 -1
  101. package/package.json +2 -2
package/README.md CHANGED
@@ -128,6 +128,7 @@ Rules determine the next movement. `COMPLETE` ends the piece successfully, `ABOR
128
128
  | Piece | Use Case |
129
129
  |-------|----------|
130
130
  | `default-mini` | Quick fixes. Lightweight plan → implement → parallel review → fix loop. |
131
+ | `default-test-first-mini` | Test-first development. Write tests first, then implement to pass them. |
131
132
  | `frontend-mini` | Frontend-focused mini configuration. |
132
133
  | `backend-mini` | Backend-focused mini configuration. |
133
134
  | `expert-mini` | Expert-level mini configuration. |
@@ -0,0 +1,52 @@
1
+ Implement according to the plan, making existing tests pass.
2
+ Refer only to files within the Report Directory shown in the Piece Context. Do not search or reference other report directories.
3
+ Use reports in the Report Directory as the primary source of truth. If additional context is needed, you may consult Previous Response and conversation history as secondary sources (Previous Response may be unavailable). If information conflicts, prioritize reports in the Report Directory and actual file contents.
4
+
5
+ **Important**: Tests have already been written. Implement production code to make existing tests pass.
6
+ - Review existing test files and understand the expected behavior
7
+ - Implement production code to make tests pass
8
+ - Tests are already written so additional tests are generally unnecessary, but may be added if needed
9
+ - If test modifications are needed, document the reasons in the Decisions output contract before modifying
10
+ - Build verification is mandatory. After completing implementation, run the build (type check) and verify there are no type errors
11
+ - Running tests is mandatory. After build succeeds, always run tests and verify all tests pass
12
+ - When introducing new contract strings (file names, config key names, etc.), define them as constants in one place
13
+
14
+ **Scope output contract (create at the start of implementation):**
15
+ ```markdown
16
+ # Change Scope Declaration
17
+
18
+ ## Task
19
+ {One-line task summary}
20
+
21
+ ## Planned changes
22
+ | Type | File |
23
+ |------|------|
24
+ | Create | `src/example.ts` |
25
+ | Modify | `src/routes.ts` |
26
+
27
+ ## Estimated size
28
+ Small / Medium / Large
29
+
30
+ ## Impact area
31
+ - {Affected modules or features}
32
+ ```
33
+
34
+ **Decisions output contract (at implementation completion, only if decisions were made):**
35
+ ```markdown
36
+ # Decision Log
37
+
38
+ ## 1. {Decision}
39
+ - **Context**: {Why the decision was needed}
40
+ - **Options considered**: {List of options}
41
+ - **Rationale**: {Reason for the choice}
42
+ ```
43
+
44
+ **Required output (include headings)**
45
+ ## Work results
46
+ - {Summary of actions taken}
47
+ ## Changes made
48
+ - {Summary of changes}
49
+ ## Build results
50
+ - {Build execution results}
51
+ ## Test results
52
+ - {Test command executed and results}
@@ -0,0 +1,55 @@
1
+ Write tests based on the plan before implementing production code.
2
+ Refer only to files within the Report Directory shown in the Piece Context. Do not search or reference other report directories.
3
+
4
+ **Important: Do NOT create or modify production code. Only test files may be created.**
5
+
6
+ **Actions:**
7
+ 1. Review the plan report and understand the planned behavior and interfaces
8
+ 2. Examine existing code and tests to learn the project's test patterns
9
+ 3. Write unit tests for the planned features
10
+ 4. Write E2E tests if appropriate
11
+ 5. Run the build (type check) to verify test code has no syntax errors
12
+
13
+ **Test writing guidelines:**
14
+ - Follow the project's existing test patterns (naming conventions, directory structure, helpers)
15
+ - Write tests in Given-When-Then structure
16
+ - One concept per test. Do not mix multiple concerns in a single test
17
+ - Cover happy path, error cases, boundary values, and edge cases
18
+ - Write tests that are expected to pass after implementation is complete
19
+
20
+ **Scope output contract (create at the start):**
21
+ ```markdown
22
+ # Change Scope Declaration
23
+
24
+ ## Task
25
+ {One-line task summary}
26
+
27
+ ## Planned changes
28
+ | Type | File |
29
+ |------|------|
30
+ | Create | `src/__tests__/example.test.ts` |
31
+
32
+ ## Estimated size
33
+ Small / Medium / Large
34
+
35
+ ## Impact area
36
+ - {Affected modules or features}
37
+ ```
38
+
39
+ **Decisions output contract (at completion, only if decisions were made):**
40
+ ```markdown
41
+ # Decision Log
42
+
43
+ ## 1. {Decision}
44
+ - **Context**: {Why the decision was needed}
45
+ - **Options considered**: {List of options}
46
+ - **Rationale**: {Reason for the choice}
47
+ ```
48
+
49
+ **Required output (include headings)**
50
+ ## Work results
51
+ - {Summary of actions taken}
52
+ ## Changes made
53
+ - {List of test files created}
54
+ ## Build results
55
+ - {Build execution results}
@@ -17,6 +17,7 @@ Code is read far more often than it is written. Poorly structured code destroys
17
17
  - No "conditional approval". If there are issues, reject
18
18
  - If you find in-scope fixable issues, flag them without exception
19
19
  - Existing issues (unrelated to current change) are non-blocking, but issues introduced or fixable in this change must be flagged
20
+ - Do not overlook branches that operate below a function's responsibility level
20
21
 
21
22
  ## Areas of Expertise
22
23
 
@@ -115,6 +115,36 @@ function processOrder(order) {
115
115
  }
116
116
  ```
117
117
 
118
+ In orchestration functions (Step 1 → Step 2 → Step 3), pay special attention. If an individual step's internals expand with conditional branches, extract that step into a function. The criterion is not the number of branches, but **whether the branch belongs at the function's abstraction level**.
119
+
120
+ ```typescript
121
+ // ❌ Low-level branching exposed in orchestration function
122
+ async function executePipeline(options) {
123
+ const task = resolveTask(options); // Step 1: high level ✅
124
+
125
+ // Step 2: low-level details exposed ❌
126
+ let execCwd = cwd;
127
+ if (options.createWorktree) {
128
+ const result = await confirmAndCreateWorktree(cwd, task, true);
129
+ execCwd = result.execCwd;
130
+ branch = result.branch;
131
+ } else if (!options.skipGit) {
132
+ baseBranch = getCurrentBranch(cwd);
133
+ branch = generateBranchName(config, options.issueNumber);
134
+ createBranch(cwd, branch);
135
+ }
136
+
137
+ await executeTask({ cwd: execCwd, ... }); // Step 3: high level ✅
138
+ }
139
+
140
+ // ✅ Extract details, keep abstraction levels consistent
141
+ async function executePipeline(options) {
142
+ const task = resolveTask(options);
143
+ const ctx = await resolveExecutionContext(options);
144
+ await executeTask({ cwd: ctx.execCwd, ... });
145
+ }
146
+ ```
147
+
118
148
  ### Follow Language and Framework Conventions
119
149
 
120
150
  - Write Pythonic Python, idiomatic Kotlin, etc.
@@ -9,6 +9,7 @@ piece_categories:
9
9
  ⚡ Mini:
10
10
  pieces:
11
11
  - default-mini
12
+ - default-test-first-mini
12
13
  - frontend-mini
13
14
  - backend-mini
14
15
  - backend-cqrs-mini
@@ -41,6 +42,9 @@ piece_categories:
41
42
  pieces:
42
43
  - unit-test
43
44
  - e2e-test
45
+ ✅ Test First:
46
+ pieces:
47
+ - default-test-first-mini
44
48
  Others:
45
49
  pieces:
46
50
  - research
@@ -0,0 +1,252 @@
1
+ name: default-test-first-mini
2
+ description: Test-first development piece (plan -> write tests -> implement -> parallel review -> fix if needed -> complete)
3
+ piece_config:
4
+ provider_options:
5
+ codex:
6
+ network_access: true
7
+ opencode:
8
+ network_access: true
9
+ max_movements: 25
10
+ initial_movement: plan
11
+ movements:
12
+ - name: plan
13
+ edit: false
14
+ persona: planner
15
+ knowledge: architecture
16
+ allowed_tools:
17
+ - Read
18
+ - Glob
19
+ - Grep
20
+ - Bash
21
+ - WebSearch
22
+ - WebFetch
23
+ rules:
24
+ - condition: Requirements are clear and implementation is possible
25
+ next: write_tests
26
+ - condition: User is asking a question (not an implementation task)
27
+ next: COMPLETE
28
+ - condition: Requirements are unclear, insufficient information
29
+ next: ABORT
30
+ instruction: plan
31
+ output_contracts:
32
+ report:
33
+ - name: 00-plan.md
34
+ format: plan
35
+ - name: write_tests
36
+ edit: true
37
+ persona: coder
38
+ policy:
39
+ - coding
40
+ - testing
41
+ knowledge: architecture
42
+ allowed_tools:
43
+ - Read
44
+ - Glob
45
+ - Grep
46
+ - Edit
47
+ - Write
48
+ - Bash
49
+ - WebSearch
50
+ - WebFetch
51
+ required_permission_mode: edit
52
+ instruction: write-tests-first
53
+ rules:
54
+ - condition: Tests written successfully
55
+ next: implement
56
+ - condition: Cannot proceed with test creation
57
+ next: ABORT
58
+ - condition: User input required because there are items to confirm with the user
59
+ next: write_tests
60
+ requires_user_input: true
61
+ interactive_only: true
62
+ output_contracts:
63
+ report:
64
+ - name: 01-test-scope.md
65
+ format: coder-scope
66
+ - name: 01-test-decisions.md
67
+ format: coder-decisions
68
+ - name: implement
69
+ edit: true
70
+ persona: coder
71
+ policy:
72
+ - coding
73
+ - testing
74
+ knowledge: architecture
75
+ allowed_tools:
76
+ - Read
77
+ - Glob
78
+ - Grep
79
+ - Edit
80
+ - Write
81
+ - Bash
82
+ - WebSearch
83
+ - WebFetch
84
+ required_permission_mode: edit
85
+ instruction: implement-after-tests
86
+ rules:
87
+ - condition: Implementation complete
88
+ next: reviewers
89
+ - condition: Cannot proceed, insufficient info
90
+ next: ABORT
91
+ - condition: User input required because there are items to confirm with the user
92
+ next: implement
93
+ requires_user_input: true
94
+ interactive_only: true
95
+ output_contracts:
96
+ report:
97
+ - name: coder-scope.md
98
+ format: coder-scope
99
+ - name: coder-decisions.md
100
+ format: coder-decisions
101
+ - name: reviewers
102
+ parallel:
103
+ - name: ai_review
104
+ edit: false
105
+ persona: ai-antipattern-reviewer
106
+ policy:
107
+ - review
108
+ - ai-antipattern
109
+ allowed_tools:
110
+ - Read
111
+ - Glob
112
+ - Grep
113
+ - WebSearch
114
+ - WebFetch
115
+ instruction: review-ai
116
+ rules:
117
+ - condition: No AI-specific issues
118
+ - condition: AI-specific issues found
119
+ output_contracts:
120
+ report:
121
+ - name: 03-ai-review.md
122
+ format: ai-review
123
+ - name: supervise
124
+ edit: false
125
+ persona: supervisor
126
+ policy: review
127
+ knowledge: architecture
128
+ allowed_tools:
129
+ - Read
130
+ - Glob
131
+ - Grep
132
+ - Bash
133
+ - WebSearch
134
+ - WebFetch
135
+ instruction: supervise
136
+ rules:
137
+ - condition: All checks passed
138
+ - condition: Requirements unmet, tests failing
139
+ output_contracts:
140
+ report:
141
+ - name: supervisor-validation.md
142
+ format: supervisor-validation
143
+ - name: summary.md
144
+ format: summary
145
+ use_judge: false
146
+ rules:
147
+ - condition: all("No AI-specific issues", "All checks passed")
148
+ next: COMPLETE
149
+ - condition: all("AI-specific issues found", "Requirements unmet, tests failing")
150
+ next: fix_both
151
+ - condition: any("AI-specific issues found")
152
+ next: ai_fix
153
+ - condition: any("Requirements unmet, tests failing")
154
+ next: supervise_fix
155
+ - name: fix_both
156
+ parallel:
157
+ - name: ai_fix_parallel
158
+ edit: true
159
+ persona: coder
160
+ policy:
161
+ - coding
162
+ - testing
163
+ knowledge: architecture
164
+ allowed_tools:
165
+ - Read
166
+ - Glob
167
+ - Grep
168
+ - Edit
169
+ - Bash
170
+ - WebSearch
171
+ - WebFetch
172
+ required_permission_mode: edit
173
+ rules:
174
+ - condition: AI Reviewer's issues fixed
175
+ - condition: No fix needed (verified target files/spec)
176
+ - condition: Cannot proceed, insufficient info
177
+ instruction: ai-fix
178
+ - name: supervise_fix_parallel
179
+ edit: true
180
+ persona: coder
181
+ policy:
182
+ - coding
183
+ - testing
184
+ knowledge: architecture
185
+ allowed_tools:
186
+ - Read
187
+ - Glob
188
+ - Grep
189
+ - Edit
190
+ - Bash
191
+ - WebSearch
192
+ - WebFetch
193
+ required_permission_mode: edit
194
+ rules:
195
+ - condition: Supervisor's issues fixed
196
+ - condition: Cannot proceed, insufficient info
197
+ instruction: fix-supervisor
198
+ rules:
199
+ - condition: all("AI Reviewer's issues fixed", "Supervisor's issues fixed")
200
+ next: reviewers
201
+ - condition: any("No fix needed (verified target files/spec)", "Cannot proceed, insufficient info")
202
+ next: implement
203
+ - name: ai_fix
204
+ edit: true
205
+ persona: coder
206
+ policy:
207
+ - coding
208
+ - testing
209
+ knowledge: architecture
210
+ allowed_tools:
211
+ - Read
212
+ - Glob
213
+ - Grep
214
+ - Edit
215
+ - Write
216
+ - Bash
217
+ - WebSearch
218
+ - WebFetch
219
+ required_permission_mode: edit
220
+ pass_previous_response: false
221
+ rules:
222
+ - condition: AI Reviewer's issues fixed
223
+ next: reviewers
224
+ - condition: No fix needed (verified target files/spec)
225
+ next: implement
226
+ - condition: Cannot proceed, insufficient info
227
+ next: implement
228
+ instruction: ai-fix
229
+ - name: supervise_fix
230
+ edit: true
231
+ persona: coder
232
+ policy:
233
+ - coding
234
+ - testing
235
+ knowledge: architecture
236
+ allowed_tools:
237
+ - Read
238
+ - Glob
239
+ - Grep
240
+ - Edit
241
+ - Write
242
+ - Bash
243
+ - WebSearch
244
+ - WebFetch
245
+ required_permission_mode: edit
246
+ pass_previous_response: false
247
+ rules:
248
+ - condition: Supervisor's issues fixed
249
+ next: reviewers
250
+ - condition: Cannot proceed, insufficient info
251
+ next: implement
252
+ instruction: fix-supervisor
@@ -0,0 +1,52 @@
1
+ 計画に従って、テストがパスするように実装してください。
2
+ Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
3
+ Report Directory内のレポートを一次情報として参照してください。不足情報の補完が必要な場合に限り、Previous Responseや会話履歴を補助的に参照して構いません(Previous Responseは提供されない場合があります)。情報が競合する場合は、Report Directory内のレポートと実際のファイル内容を優先してください。
4
+
5
+ **重要**: テストは既に作成済みです。既存テストがパスするように実装してください。
6
+ - 既存のテストファイルを確認し、期待される振る舞いを理解する
7
+ - テストがパスするようにプロダクションコードを実装する
8
+ - テストは作成済みのため基本的に追加不要だが、必要なら追加してよい
9
+ - テストの修正が必要な場合は、修正理由をDecisions出力契約に記録した上で修正可
10
+ - ビルド確認は必須。実装完了後、ビルド(型チェック)を実行し、型エラーがないことを確認
11
+ - テスト実行は必須。ビルド成功後、必ずテストを実行して全テストがパスすることを確認
12
+ - ファイル名・設定キー名などの契約文字列を新規導入する場合は、定数として1箇所で定義すること
13
+
14
+ **Scope出力契約(実装開始時に作成):**
15
+ ```markdown
16
+ # 変更スコープ宣言
17
+
18
+ ## タスク
19
+ {タスクの1行要約}
20
+
21
+ ## 変更予定
22
+ | 種別 | ファイル |
23
+ |------|---------|
24
+ | 作成 | `src/example.ts` |
25
+ | 変更 | `src/routes.ts` |
26
+
27
+ ## 推定規模
28
+ Small / Medium / Large
29
+
30
+ ## 影響範囲
31
+ - {影響するモジュールや機能}
32
+ ```
33
+
34
+ **Decisions出力契約(実装完了時、決定がある場合のみ):**
35
+ ```markdown
36
+ # 決定ログ
37
+
38
+ ## 1. {決定内容}
39
+ - **背景**: {なぜ決定が必要だったか}
40
+ - **検討した選択肢**: {選択肢リスト}
41
+ - **理由**: {選んだ理由}
42
+ ```
43
+
44
+ **必須出力(見出しを含める)**
45
+ ## 作業結果
46
+ - {実施内容の要約}
47
+ ## 変更内容
48
+ - {変更内容の要約}
49
+ ## ビルド結果
50
+ - {ビルド実行結果}
51
+ ## テスト結果
52
+ - {テスト実行コマンドと結果}
@@ -0,0 +1,55 @@
1
+ 計画に基づいて、プロダクションコードの実装前にテストを作成してください。
2
+ Piece Contextに示されたReport Directory内のファイルのみ参照してください。他のレポートディレクトリは検索/参照しないでください。
3
+
4
+ **重要: プロダクションコードは作成・変更しないでください。テストファイルのみ作成可能です。**
5
+
6
+ **やること:**
7
+ 1. 計画レポートを確認し、実装予定の振る舞いとインターフェースを理解する
8
+ 2. 対象モジュールの既存コードと既存テストを確認し、テストパターンを把握する
9
+ 3. 計画された機能に対する単体テストを作成する
10
+ 4. 必要に応じてE2Eテストも作成する
11
+ 5. ビルド(型チェック)を実行し、テストコードに構文エラーがないことを確認する
12
+
13
+ **テスト作成の方針:**
14
+ - プロジェクトの既存テストパターン(命名規約、ディレクトリ構成、ヘルパー)に従う
15
+ - Given-When-Then 構造で記述する
16
+ - 1テスト1概念。複数の関心事を1テストに混ぜない
17
+ - 正常系・異常系・境界値・エッジケースを網羅する
18
+ - テストは実装完了後にパスすることを前提に書く
19
+
20
+ **Scope出力契約(作成開始時に作成):**
21
+ ```markdown
22
+ # 変更スコープ宣言
23
+
24
+ ## タスク
25
+ {タスクの1行要約}
26
+
27
+ ## 変更予定
28
+ | 種別 | ファイル |
29
+ |------|---------|
30
+ | 作成 | `src/__tests__/example.test.ts` |
31
+
32
+ ## 推定規模
33
+ Small / Medium / Large
34
+
35
+ ## 影響範囲
36
+ - {影響するモジュールや機能}
37
+ ```
38
+
39
+ **Decisions出力契約(完了時、決定がある場合のみ):**
40
+ ```markdown
41
+ # 決定ログ
42
+
43
+ ## 1. {決定内容}
44
+ - **背景**: {なぜ決定が必要だったか}
45
+ - **検討した選択肢**: {選択肢リスト}
46
+ - **理由**: {選んだ理由}
47
+ ```
48
+
49
+ **必須出力(見出しを含める)**
50
+ ## 作業結果
51
+ - {実施内容の要約}
52
+ ## 変更内容
53
+ - {作成したテストファイル一覧}
54
+ ## ビルド結果
55
+ - {ビルド実行結果}
@@ -24,3 +24,4 @@
24
24
  - 軽微な問題でも後に持ち越さない。今修正できる問題は今修正させる
25
25
  - 「条件付き承認」はしない。問題があれば差し戻す
26
26
  - 既存コードの踏襲を理由にした問題の放置は認めない
27
+ - 関数の責務より低い粒度の分岐が混入していたら見逃さない
@@ -115,6 +115,36 @@ function processOrder(order) {
115
115
  }
116
116
  ```
117
117
 
118
+ オーケストレーション関数(Step 1 → Step 2 → Step 3 と処理を並べる関数)では特に注意する。あるStepの内部に条件分岐が膨らんでいたら、そのStepを関数に抽出する。判定基準は分岐の数ではなく、**その分岐がその関数の抽象レベルに合っているか**。
119
+
120
+ ```typescript
121
+ // ❌ オーケストレーション関数に詳細な分岐が露出
122
+ async function executePipeline(options) {
123
+ const task = resolveTask(options); // Step 1: 高レベル ✅
124
+
125
+ // Step 2: 低レベル詳細が露出 ❌
126
+ let execCwd = cwd;
127
+ if (options.createWorktree) {
128
+ const result = await confirmAndCreateWorktree(cwd, task, true);
129
+ execCwd = result.execCwd;
130
+ branch = result.branch;
131
+ } else if (!options.skipGit) {
132
+ baseBranch = getCurrentBranch(cwd);
133
+ branch = generateBranchName(config, options.issueNumber);
134
+ createBranch(cwd, branch);
135
+ }
136
+
137
+ await executeTask({ cwd: execCwd, ... }); // Step 3: 高レベル ✅
138
+ }
139
+
140
+ // ✅ 詳細を関数に抽出し、抽象度を揃える
141
+ async function executePipeline(options) {
142
+ const task = resolveTask(options);
143
+ const ctx = await resolveExecutionContext(options);
144
+ await executeTask({ cwd: ctx.execCwd, ... });
145
+ }
146
+ ```
147
+
118
148
  ### 言語・フレームワークの作法に従う
119
149
 
120
150
  - Pythonなら Pythonic に、KotlinならKotlinらしく
@@ -9,6 +9,7 @@ piece_categories:
9
9
  ⚡ Mini:
10
10
  pieces:
11
11
  - default-mini
12
+ - default-test-first-mini
12
13
  - frontend-mini
13
14
  - backend-mini
14
15
  - backend-cqrs-mini
@@ -41,6 +42,9 @@ piece_categories:
41
42
  pieces:
42
43
  - unit-test
43
44
  - e2e-test
45
+ ✅ テストファースト:
46
+ pieces:
47
+ - default-test-first-mini
44
48
  その他:
45
49
  pieces:
46
50
  - research