takt 0.1.5 → 0.1.7

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 (59) hide show
  1. package/dist/agents/runner.d.ts +1 -1
  2. package/dist/agents/runner.d.ts.map +1 -1
  3. package/dist/agents/runner.js +13 -34
  4. package/dist/agents/runner.js.map +1 -1
  5. package/dist/cli.d.ts +2 -3
  6. package/dist/cli.d.ts.map +1 -1
  7. package/dist/cli.js +5 -8
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/help.d.ts.map +1 -1
  10. package/dist/commands/help.js +4 -8
  11. package/dist/commands/help.js.map +1 -1
  12. package/dist/commands/index.d.ts +1 -1
  13. package/dist/commands/index.d.ts.map +1 -1
  14. package/dist/commands/index.js.map +1 -1
  15. package/dist/commands/taskExecution.d.ts +1 -6
  16. package/dist/commands/taskExecution.d.ts.map +1 -1
  17. package/dist/commands/taskExecution.js +2 -6
  18. package/dist/commands/taskExecution.js.map +1 -1
  19. package/dist/commands/workflowExecution.d.ts +0 -2
  20. package/dist/commands/workflowExecution.d.ts.map +1 -1
  21. package/dist/commands/workflowExecution.js +9 -11
  22. package/dist/commands/workflowExecution.js.map +1 -1
  23. package/dist/mock/client.d.ts +27 -0
  24. package/dist/mock/client.d.ts.map +1 -0
  25. package/dist/mock/client.js +56 -0
  26. package/dist/mock/client.js.map +1 -0
  27. package/dist/models/schemas.d.ts +6 -0
  28. package/dist/models/schemas.d.ts.map +1 -1
  29. package/dist/models/schemas.js +9 -9
  30. package/dist/models/schemas.js.map +1 -1
  31. package/dist/models/types.d.ts +4 -4
  32. package/dist/models/types.d.ts.map +1 -1
  33. package/dist/providers/claude.d.ts +11 -0
  34. package/dist/providers/claude.d.ts.map +1 -0
  35. package/dist/providers/claude.js +37 -0
  36. package/dist/providers/claude.js.map +1 -0
  37. package/dist/providers/codex.d.ts +11 -0
  38. package/dist/providers/codex.d.ts.map +1 -0
  39. package/dist/providers/codex.js +29 -0
  40. package/dist/providers/codex.js.map +1 -0
  41. package/dist/providers/index.d.ts +39 -0
  42. package/dist/providers/index.d.ts.map +1 -0
  43. package/dist/providers/index.js +32 -0
  44. package/dist/providers/index.js.map +1 -0
  45. package/dist/providers/mock.d.ts +11 -0
  46. package/dist/providers/mock.d.ts.map +1 -0
  47. package/dist/providers/mock.js +24 -0
  48. package/dist/providers/mock.js.map +1 -0
  49. package/package.json +1 -1
  50. package/resources/global/en/agents/default/architect.md +67 -6
  51. package/resources/global/en/agents/default/coder.md +155 -1
  52. package/resources/global/en/workflows/expert-review.yaml +1 -1
  53. package/resources/global/en/workflows/simple.yaml +594 -0
  54. package/resources/global/ja/agents/default/architect.md +62 -1
  55. package/resources/global/ja/agents/default/coder.md +156 -2
  56. package/resources/global/ja/agents/expert-review/cqrs-es-reviewer.md +328 -8
  57. package/resources/global/ja/agents/expert-review/frontend-reviewer.md +303 -33
  58. package/resources/global/ja/workflows/expert-review.yaml +1 -1
  59. package/resources/global/ja/workflows/simple.yaml +594 -0
@@ -105,7 +105,45 @@ Perform self-check after implementation.
105
105
  | Boy Scout | Leave touched areas slightly improved |
106
106
  | Fail Fast | Detect errors early. Don't swallow them |
107
107
 
108
- **When in doubt**: Choose Simple. Abstraction can come later.
108
+ **When in doubt**: Choose Simple.
109
+
110
+ ## Abstraction Principles
111
+
112
+ **Before adding conditional branches, consider:**
113
+ - Does this condition exist elsewhere? → Abstract with a pattern
114
+ - Will more branches be added? → Use Strategy/Map pattern
115
+ - Branching on type? → Replace with polymorphism
116
+
117
+ ```typescript
118
+ // ❌ Adding more conditionals
119
+ if (type === 'A') { ... }
120
+ else if (type === 'B') { ... }
121
+ else if (type === 'C') { ... } // Yet another one
122
+
123
+ // ✅ Abstract with Map
124
+ const handlers = { A: handleA, B: handleB, C: handleC };
125
+ handlers[type]?.();
126
+ ```
127
+
128
+ **Align abstraction levels:**
129
+ - Keep same granularity of operations within one function
130
+ - Extract detailed processing to separate functions
131
+ - Don't mix "what to do" with "how to do it"
132
+
133
+ ```typescript
134
+ // ❌ Mixed abstraction levels
135
+ function processOrder(order) {
136
+ validateOrder(order); // High level
137
+ const conn = pool.getConnection(); // Low level detail
138
+ conn.query('INSERT...'); // Low level detail
139
+ }
140
+
141
+ // ✅ Aligned abstraction levels
142
+ function processOrder(order) {
143
+ validateOrder(order);
144
+ saveOrder(order); // Details hidden
145
+ }
146
+ ```
109
147
 
110
148
  **Follow language/framework conventions:**
111
149
  - Be Pythonic in Python, Kotlin-like in Kotlin
@@ -134,6 +172,121 @@ Perform self-check after implementation.
134
172
  - Children don't modify state directly (notify parent via events)
135
173
  - State flows in one direction
136
174
 
175
+ ## Error Handling
176
+
177
+ **Principle: Centralize error handling. Don't scatter try-catch everywhere.**
178
+
179
+ ```typescript
180
+ // ❌ Try-catch everywhere
181
+ async function createUser(data) {
182
+ try {
183
+ const user = await userService.create(data)
184
+ return user
185
+ } catch (e) {
186
+ console.error(e)
187
+ throw new Error('Failed to create user')
188
+ }
189
+ }
190
+
191
+ // ✅ Centralized handling at upper layer
192
+ // Catch at Controller/Handler layer
193
+ // Or use @ControllerAdvice / ErrorBoundary
194
+ async function createUser(data) {
195
+ return await userService.create(data) // Let exceptions propagate
196
+ }
197
+ ```
198
+
199
+ **Error handling placement:**
200
+
201
+ | Layer | Responsibility |
202
+ |-------|----------------|
203
+ | Domain/Service layer | Throw exceptions on business rule violations |
204
+ | Controller/Handler layer | Catch exceptions and convert to response |
205
+ | Global handler | Handle common exceptions (NotFound, auth errors, etc.) |
206
+
207
+ ## Transformation Placement
208
+
209
+ **Principle: Put conversion methods on DTOs.**
210
+
211
+ ```typescript
212
+ // ✅ Request/Response DTOs have conversion methods
213
+ interface CreateUserRequest {
214
+ name: string
215
+ email: string
216
+ }
217
+
218
+ function toUseCaseInput(req: CreateUserRequest): CreateUserInput {
219
+ return { name: req.name, email: req.email }
220
+ }
221
+
222
+ // Controller
223
+ const input = toUseCaseInput(request)
224
+ const output = await useCase.execute(input)
225
+ return UserResponse.from(output)
226
+ ```
227
+
228
+ **Conversion direction:**
229
+ ```
230
+ Request → toInput() → UseCase/Service → Output → Response.from()
231
+ ```
232
+
233
+ ## Extraction Decisions
234
+
235
+ **Rule of Three:**
236
+ - 1st time: Write it inline
237
+ - 2nd time: Don't extract yet (wait and see)
238
+ - 3rd time: Consider extraction
239
+
240
+ **Should extract:**
241
+ - Same logic in 3+ places
242
+ - Same style/UI pattern
243
+ - Same validation logic
244
+ - Same formatting logic
245
+
246
+ **Should NOT extract:**
247
+ - Similar but slightly different (forced generalization adds complexity)
248
+ - Used in only 1-2 places
249
+ - Based on "might use later" predictions
250
+
251
+ ```typescript
252
+ // ❌ Over-generalization
253
+ function formatValue(value, type, options) {
254
+ if (type === 'currency') { ... }
255
+ else if (type === 'date') { ... }
256
+ else if (type === 'percentage') { ... }
257
+ }
258
+
259
+ // ✅ Separate functions by purpose
260
+ function formatCurrency(amount: number): string { ... }
261
+ function formatDate(date: Date): string { ... }
262
+ function formatPercentage(value: number): string { ... }
263
+ ```
264
+
265
+ ## Writing Tests
266
+
267
+ **Principle: Structure tests with "Given-When-Then".**
268
+
269
+ ```typescript
270
+ test('returns NotFound error when user does not exist', async () => {
271
+ // Given: non-existent user ID
272
+ const nonExistentId = 'non-existent-id'
273
+
274
+ // When: attempt to get user
275
+ const result = await getUser(nonExistentId)
276
+
277
+ // Then: NotFound error is returned
278
+ expect(result.error).toBe('NOT_FOUND')
279
+ })
280
+ ```
281
+
282
+ **Test priority:**
283
+
284
+ | Priority | Target |
285
+ |----------|--------|
286
+ | High | Business logic, state transitions |
287
+ | Medium | Edge cases, error handling |
288
+ | Low | Simple CRUD, UI appearance |
289
+
137
290
  ## Prohibited
138
291
 
139
292
  - **Fallback value overuse** - Don't hide problems with `?? 'unknown'`, `|| 'default'`
@@ -143,4 +296,5 @@ Perform self-check after implementation.
143
296
  - **Direct object/array mutation** - Create new with spread operator
144
297
  - **console.log** - Don't leave in production code
145
298
  - **Hardcoded secrets**
299
+ - **Scattered try-catch** - Centralize error handling at upper layer
146
300
 
@@ -631,7 +631,7 @@ steps:
631
631
  pass_previous_response: true
632
632
  transitions:
633
633
  - condition: done
634
- next_step: cqrs_es_review
634
+ next_step: ai_review
635
635
  - condition: blocked
636
636
  next_step: plan
637
637