takt 0.2.2 → 0.3.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 (210) hide show
  1. package/README.md +223 -166
  2. package/dist/agents/runner.d.ts +2 -4
  3. package/dist/agents/runner.d.ts.map +1 -1
  4. package/dist/agents/runner.js +6 -35
  5. package/dist/agents/runner.js.map +1 -1
  6. package/dist/claude/client.d.ts +31 -6
  7. package/dist/claude/client.d.ts.map +1 -1
  8. package/dist/claude/client.js +78 -30
  9. package/dist/claude/client.js.map +1 -1
  10. package/dist/claude/index.d.ts +1 -1
  11. package/dist/claude/index.d.ts.map +1 -1
  12. package/dist/claude/index.js +1 -1
  13. package/dist/claude/index.js.map +1 -1
  14. package/dist/cli.d.ts +4 -3
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +41 -20
  17. package/dist/cli.js.map +1 -1
  18. package/dist/codex/client.d.ts +0 -1
  19. package/dist/codex/client.d.ts.map +1 -1
  20. package/dist/codex/client.js +3 -6
  21. package/dist/codex/client.js.map +1 -1
  22. package/dist/commands/addTask.d.ts.map +1 -1
  23. package/dist/commands/addTask.js +23 -7
  24. package/dist/commands/addTask.js.map +1 -1
  25. package/dist/commands/eject.d.ts +13 -0
  26. package/dist/commands/eject.d.ts.map +1 -0
  27. package/dist/commands/eject.js +105 -0
  28. package/dist/commands/eject.js.map +1 -0
  29. package/dist/commands/help.d.ts.map +1 -1
  30. package/dist/commands/help.js +12 -5
  31. package/dist/commands/help.js.map +1 -1
  32. package/dist/commands/index.d.ts +2 -1
  33. package/dist/commands/index.d.ts.map +1 -1
  34. package/dist/commands/index.js +2 -1
  35. package/dist/commands/index.js.map +1 -1
  36. package/dist/commands/listTasks.d.ts +45 -0
  37. package/dist/commands/listTasks.d.ts.map +1 -0
  38. package/dist/commands/{reviewTasks.js → listTasks.js} +93 -73
  39. package/dist/commands/listTasks.js.map +1 -0
  40. package/dist/commands/refreshBuiltin.d.ts +4 -4
  41. package/dist/commands/refreshBuiltin.d.ts.map +1 -1
  42. package/dist/commands/refreshBuiltin.js +13 -29
  43. package/dist/commands/refreshBuiltin.js.map +1 -1
  44. package/dist/commands/taskExecution.d.ts +7 -5
  45. package/dist/commands/taskExecution.d.ts.map +1 -1
  46. package/dist/commands/taskExecution.js +21 -14
  47. package/dist/commands/taskExecution.js.map +1 -1
  48. package/dist/commands/workflowExecution.d.ts.map +1 -1
  49. package/dist/commands/workflowExecution.js +88 -21
  50. package/dist/commands/workflowExecution.js.map +1 -1
  51. package/dist/config/agentLoader.d.ts +3 -1
  52. package/dist/config/agentLoader.d.ts.map +1 -1
  53. package/dist/config/agentLoader.js +17 -24
  54. package/dist/config/agentLoader.js.map +1 -1
  55. package/dist/config/globalConfig.d.ts +2 -0
  56. package/dist/config/globalConfig.d.ts.map +1 -1
  57. package/dist/config/globalConfig.js +18 -0
  58. package/dist/config/globalConfig.js.map +1 -1
  59. package/dist/config/initialization.d.ts +7 -5
  60. package/dist/config/initialization.d.ts.map +1 -1
  61. package/dist/config/initialization.js +23 -21
  62. package/dist/config/initialization.js.map +1 -1
  63. package/dist/config/paths.d.ts +5 -0
  64. package/dist/config/paths.d.ts.map +1 -1
  65. package/dist/config/paths.js +9 -0
  66. package/dist/config/paths.js.map +1 -1
  67. package/dist/config/workflowLoader.d.ts +6 -4
  68. package/dist/config/workflowLoader.d.ts.map +1 -1
  69. package/dist/config/workflowLoader.js +190 -35
  70. package/dist/config/workflowLoader.js.map +1 -1
  71. package/dist/github/issue.d.ts +72 -0
  72. package/dist/github/issue.d.ts.map +1 -0
  73. package/dist/github/issue.js +143 -0
  74. package/dist/github/issue.js.map +1 -0
  75. package/dist/models/index.d.ts +1 -1
  76. package/dist/models/index.d.ts.map +1 -1
  77. package/dist/models/index.js.map +1 -1
  78. package/dist/models/schemas.d.ts +165 -90
  79. package/dist/models/schemas.d.ts.map +1 -1
  80. package/dist/models/schemas.js +79 -51
  81. package/dist/models/schemas.js.map +1 -1
  82. package/dist/models/types.d.ts +53 -20
  83. package/dist/models/types.d.ts.map +1 -1
  84. package/dist/providers/claude.js +2 -2
  85. package/dist/providers/claude.js.map +1 -1
  86. package/dist/providers/codex.d.ts.map +1 -1
  87. package/dist/providers/codex.js +0 -2
  88. package/dist/providers/codex.js.map +1 -1
  89. package/dist/providers/index.d.ts +2 -1
  90. package/dist/providers/index.d.ts.map +1 -1
  91. package/dist/providers/index.js.map +1 -1
  92. package/dist/resources/index.d.ts +3 -22
  93. package/dist/resources/index.d.ts.map +1 -1
  94. package/dist/resources/index.js +9 -76
  95. package/dist/resources/index.js.map +1 -1
  96. package/dist/task/autoCommit.d.ts +9 -6
  97. package/dist/task/autoCommit.d.ts.map +1 -1
  98. package/dist/task/autoCommit.js +21 -12
  99. package/dist/task/autoCommit.js.map +1 -1
  100. package/dist/task/branchList.d.ts +55 -0
  101. package/dist/task/branchList.d.ts.map +1 -0
  102. package/dist/task/branchList.js +131 -0
  103. package/dist/task/branchList.js.map +1 -0
  104. package/dist/task/clone.d.ts +53 -0
  105. package/dist/task/clone.d.ts.map +1 -0
  106. package/dist/task/clone.js +181 -0
  107. package/dist/task/clone.js.map +1 -0
  108. package/dist/task/index.d.ts +3 -2
  109. package/dist/task/index.d.ts.map +1 -1
  110. package/dist/task/index.js +3 -2
  111. package/dist/task/index.js.map +1 -1
  112. package/dist/task/schema.d.ts +4 -4
  113. package/dist/task/schema.js +4 -4
  114. package/dist/task/summarize.d.ts +7 -5
  115. package/dist/task/summarize.d.ts.map +1 -1
  116. package/dist/task/summarize.js +62 -29
  117. package/dist/task/summarize.js.map +1 -1
  118. package/dist/utils/session.d.ts +74 -10
  119. package/dist/utils/session.d.ts.map +1 -1
  120. package/dist/utils/session.js +101 -51
  121. package/dist/utils/session.js.map +1 -1
  122. package/dist/utils/updateNotifier.d.ts +6 -0
  123. package/dist/utils/updateNotifier.d.ts.map +1 -0
  124. package/dist/utils/updateNotifier.js +17 -0
  125. package/dist/utils/updateNotifier.js.map +1 -0
  126. package/dist/workflow/engine.d.ts +35 -2
  127. package/dist/workflow/engine.d.ts.map +1 -1
  128. package/dist/workflow/engine.js +238 -38
  129. package/dist/workflow/engine.js.map +1 -1
  130. package/dist/workflow/index.d.ts +1 -1
  131. package/dist/workflow/index.d.ts.map +1 -1
  132. package/dist/workflow/index.js +1 -1
  133. package/dist/workflow/index.js.map +1 -1
  134. package/dist/workflow/instruction-builder.d.ts +89 -20
  135. package/dist/workflow/instruction-builder.d.ts.map +1 -1
  136. package/dist/workflow/instruction-builder.js +404 -61
  137. package/dist/workflow/instruction-builder.js.map +1 -1
  138. package/dist/workflow/parallel-logger.d.ts +76 -0
  139. package/dist/workflow/parallel-logger.d.ts.map +1 -0
  140. package/dist/workflow/parallel-logger.js +173 -0
  141. package/dist/workflow/parallel-logger.js.map +1 -0
  142. package/dist/workflow/phase-runner.d.ts +40 -0
  143. package/dist/workflow/phase-runner.d.ts.map +1 -0
  144. package/dist/workflow/phase-runner.js +69 -0
  145. package/dist/workflow/phase-runner.js.map +1 -0
  146. package/dist/workflow/rule-evaluator.d.ts +64 -0
  147. package/dist/workflow/rule-evaluator.d.ts.map +1 -0
  148. package/dist/workflow/rule-evaluator.js +178 -0
  149. package/dist/workflow/rule-evaluator.js.map +1 -0
  150. package/dist/workflow/rule-utils.d.ts +13 -0
  151. package/dist/workflow/rule-utils.d.ts.map +1 -0
  152. package/dist/workflow/rule-utils.js +17 -0
  153. package/dist/workflow/rule-utils.js.map +1 -0
  154. package/dist/workflow/transitions.d.ts +5 -13
  155. package/dist/workflow/transitions.d.ts.map +1 -1
  156. package/dist/workflow/transitions.js +8 -78
  157. package/dist/workflow/transitions.js.map +1 -1
  158. package/dist/workflow/types.d.ts +2 -1
  159. package/dist/workflow/types.d.ts.map +1 -1
  160. package/package.json +4 -1
  161. package/resources/global/en/agents/default/ai-antipattern-reviewer.md +193 -0
  162. package/resources/global/en/agents/default/{architect.md → architecture-reviewer.md} +144 -44
  163. package/resources/global/en/agents/default/coder.md +7 -7
  164. package/resources/global/en/agents/default/planner.md +29 -9
  165. package/resources/global/en/agents/default/{security.md → security-reviewer.md} +23 -5
  166. package/resources/global/en/agents/default/supervisor.md +13 -2
  167. package/resources/global/en/agents/expert/frontend-reviewer.md +0 -17
  168. package/resources/global/en/agents/expert/qa-reviewer.md +0 -16
  169. package/resources/global/en/agents/expert/security-reviewer.md +0 -16
  170. package/resources/global/en/agents/expert-cqrs/cqrs-es-reviewer.md +0 -17
  171. package/resources/global/en/agents/templates/coder.md +128 -0
  172. package/resources/global/en/agents/templates/planner.md +44 -0
  173. package/resources/global/en/agents/templates/reviewer.md +57 -0
  174. package/resources/global/en/agents/templates/supervisor.md +64 -0
  175. package/resources/global/en/workflows/default.yaml +235 -770
  176. package/resources/global/en/workflows/expert-cqrs.yaml +325 -697
  177. package/resources/global/en/workflows/expert.yaml +354 -722
  178. package/resources/global/en/workflows/magi.yaml +45 -52
  179. package/resources/global/en/workflows/research.yaml +18 -99
  180. package/resources/global/en/workflows/simple.yaml +156 -421
  181. package/resources/global/ja/agents/default/{ai-reviewer.md → ai-antipattern-reviewer.md} +92 -15
  182. package/resources/global/ja/agents/default/{architect.md → architecture-reviewer.md} +148 -48
  183. package/resources/global/ja/agents/default/coder.md +7 -7
  184. package/resources/global/ja/agents/default/planner.md +29 -9
  185. package/resources/global/ja/agents/default/{security.md → security-reviewer.md} +23 -5
  186. package/resources/global/ja/agents/default/supervisor.md +13 -2
  187. package/resources/global/ja/agents/expert/frontend-reviewer.md +0 -18
  188. package/resources/global/ja/agents/expert/qa-reviewer.md +0 -16
  189. package/resources/global/ja/agents/expert/security-reviewer.md +0 -16
  190. package/resources/global/ja/agents/expert-cqrs/cqrs-es-reviewer.md +0 -18
  191. package/resources/global/ja/agents/templates/coder.md +128 -0
  192. package/resources/global/ja/agents/templates/planner.md +44 -0
  193. package/resources/global/ja/agents/templates/reviewer.md +57 -0
  194. package/resources/global/ja/agents/templates/supervisor.md +64 -0
  195. package/resources/global/ja/workflows/default.yaml +230 -771
  196. package/resources/global/ja/workflows/expert-cqrs.yaml +316 -832
  197. package/resources/global/ja/workflows/expert.yaml +331 -711
  198. package/resources/global/ja/workflows/magi.yaml +45 -52
  199. package/resources/global/ja/workflows/research.yaml +18 -99
  200. package/resources/global/ja/workflows/simple.yaml +149 -415
  201. package/resources/project/dotgitignore +10 -0
  202. package/resources/project/tasks/TASK-FORMAT +37 -0
  203. package/dist/commands/reviewTasks.d.ts +0 -43
  204. package/dist/commands/reviewTasks.d.ts.map +0 -1
  205. package/dist/commands/reviewTasks.js.map +0 -1
  206. package/dist/task/worktree.d.ts +0 -70
  207. package/dist/task/worktree.d.ts.map +0 -1
  208. package/dist/task/worktree.js +0 -221
  209. package/dist/task/worktree.js.map +0 -1
  210. package/resources/global/en/agents/default/ai-reviewer.md +0 -116
@@ -1,88 +1,18 @@
1
1
  /**
2
2
  * Workflow state transition logic
3
3
  *
4
- * Handles determining the next step based on agent response status
5
- * and transition conditions defined in the workflow configuration.
4
+ * Handles determining the next step based on rules-based routing.
6
5
  */
7
- import { COMPLETE_STEP, ABORT_STEP } from './constants.js';
8
6
  /**
9
- * Check if status matches transition condition.
7
+ * Determine next step using rules-based detection.
8
+ * Returns the next step name from the matched rule, or null if no rule matched.
10
9
  */
11
- export function matchesCondition(status, condition) {
12
- if (condition === 'always') {
13
- return true;
10
+ export function determineNextStepByRules(step, ruleIndex) {
11
+ const rule = step.rules?.[ruleIndex];
12
+ if (!rule) {
13
+ return null;
14
14
  }
15
- // Map status to condition
16
- const statusConditionMap = {
17
- done: ['done'],
18
- blocked: ['blocked'],
19
- approved: ['approved'],
20
- rejected: ['rejected'],
21
- improve: ['improve'],
22
- answer: ['answer'],
23
- pending: [],
24
- in_progress: [],
25
- cancelled: [],
26
- interrupted: [], // Interrupted is handled separately
27
- };
28
- const matchingConditions = statusConditionMap[status] || [];
29
- return matchingConditions.includes(condition);
30
- }
31
- /**
32
- * Handle case when no status marker is found in agent output.
33
- */
34
- export function handleNoStatus(step, config) {
35
- const behavior = step.onNoStatus || 'complete';
36
- switch (behavior) {
37
- case 'stay':
38
- // Stay on current step (original behavior, may cause loops)
39
- return step.name;
40
- case 'continue': {
41
- // Try to find done/always transition, otherwise find next step in workflow
42
- for (const transition of step.transitions) {
43
- if (transition.condition === 'done' || transition.condition === 'always') {
44
- return transition.nextStep;
45
- }
46
- }
47
- // Find next step in workflow order
48
- const stepIndex = config.steps.findIndex(s => s.name === step.name);
49
- const nextStep = config.steps[stepIndex + 1];
50
- if (stepIndex >= 0 && nextStep) {
51
- return nextStep.name;
52
- }
53
- return COMPLETE_STEP;
54
- }
55
- case 'complete':
56
- default:
57
- // Try to find done/always transition, otherwise complete workflow
58
- for (const transition of step.transitions) {
59
- if (transition.condition === 'done' || transition.condition === 'always') {
60
- return transition.nextStep;
61
- }
62
- }
63
- return COMPLETE_STEP;
64
- }
65
- }
66
- /**
67
- * Determine next step based on current status.
68
- */
69
- export function determineNextStep(step, status, config) {
70
- // If interrupted, abort immediately
71
- if (status === 'interrupted') {
72
- return ABORT_STEP;
73
- }
74
- // Check transitions in order
75
- for (const transition of step.transitions) {
76
- if (matchesCondition(status, transition.condition)) {
77
- return transition.nextStep;
78
- }
79
- }
80
- // If status is 'in_progress' (no status marker found), use onNoStatus behavior
81
- if (status === 'in_progress') {
82
- return handleNoStatus(step, config);
83
- }
84
- // Unexpected status - treat as done and complete
85
- return COMPLETE_STEP;
15
+ return rule.next ?? null;
86
16
  }
87
17
  /**
88
18
  * Extract user-facing prompt from blocked response.
@@ -1 +1 @@
1
- {"version":3,"file":"transitions.js","sourceRoot":"","sources":["../../src/workflow/transitions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,SAA8B;IAE9B,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,IA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AAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACf,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAED,uDAAuD;IACvD,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"transitions.js","sourceRoot":"","sources":["../../src/workflow/transitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAkB,EAClB,SAAiB;IAEjB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,+CAA+C;IAC/C,MAAM,QAAQ,GAAG;QACf,4BAA4B;QAC5B,yBAAyB;QACzB,yBAAyB;QACzB,yBAAyB;KAC1B,CAAC;IAEF,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACf,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAED,uDAAuD;IACvD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -10,7 +10,8 @@ import type { PermissionHandler, AskUserQuestionHandler } from '../claude/proces
10
10
  /** Events emitted by workflow engine */
11
11
  export interface WorkflowEvents {
12
12
  'step:start': (step: WorkflowStep, iteration: number) => void;
13
- 'step:complete': (step: WorkflowStep, response: AgentResponse) => void;
13
+ 'step:complete': (step: WorkflowStep, response: AgentResponse, instruction: string) => void;
14
+ 'step:report': (step: WorkflowStep, filePath: string, fileName: string) => void;
14
15
  'step:blocked': (step: WorkflowStep, response: AgentResponse) => void;
15
16
  'step:user_input': (step: WorkflowStep, userInput: string) => void;
16
17
  'workflow:complete': (state: WorkflowState) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/workflow/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,wCAAwC;AACxC,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,eAAe,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IACvE,cAAc,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IACtE,iBAAiB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,mBAAmB,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACpD,gBAAgB,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjE,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,oBAAoB,EAAE,CA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qB,CAAC;IACxC,mEAAmE;IACnE,mBAAmB,CAAC,EAAE,iBAAiB,CAAC;IACxC,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAC3C,+FAA+F;IAC/F,gBAAgB,CAAC,EAAE,sBAAsB,CAAC;IAC1C,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,4BAA4B;AAC5B,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "takt",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "TAKT: Task Agent Koordination Tool - AI Agent Workflow Orchestration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -54,12 +54,15 @@
54
54
  "@openai/codex-sdk": "^0.91.0",
55
55
  "chalk": "^5.3.0",
56
56
  "commander": "^12.1.0",
57
+ "update-notifier": "^7.3.1",
58
+ "wanakana": "^5.3.1",
57
59
  "yaml": "^2.4.5",
58
60
  "zod": "^4.3.6"
59
61
  },
60
62
  "devDependencies": {
61
63
  "@eslint/js": "^9.39.2",
62
64
  "@types/node": "^20.14.0",
65
+ "@types/wanakana": "^4.0.6",
63
66
  "@typescript-eslint/eslint-plugin": "^8.0.0",
64
67
  "@typescript-eslint/parser": "^8.0.0",
65
68
  "eslint": "^9.0.0",
@@ -0,0 +1,193 @@
1
+ # AI Antipattern Reviewer
2
+
3
+ You are an **AI-generated code expert**. You review code generated by AI coding assistants for patterns and issues rarely seen in human-written code.
4
+
5
+ ## Core Values
6
+
7
+ AI-generated code is produced faster than humans can review it. Quality gaps are inevitable, and bridging that gap is the reason this role exists.
8
+
9
+ AI is confidently wrong—code that looks plausible but doesn't work, solutions that are technically correct but contextually wrong. Identifying these requires an expert who knows AI-specific tendencies.
10
+
11
+ ## Areas of Expertise
12
+
13
+ ### Assumption Validation
14
+ - Verifying the validity of AI-made assumptions
15
+ - Checking alignment with business context
16
+
17
+ ### Plausible-But-Wrong Detection
18
+ - Detecting hallucinated APIs and non-existent methods
19
+ - Detecting outdated patterns and deprecated approaches
20
+
21
+ ### Context Fit
22
+ - Alignment with existing codebase patterns
23
+ - Matching naming conventions and error handling styles
24
+
25
+ ### Scope Creep Detection
26
+ - Over-engineering and unnecessary abstractions
27
+ - Addition of unrequested features
28
+
29
+ **Don't:**
30
+ - Review architecture (Architect's job)
31
+ - Review security vulnerabilities (Security's job)
32
+ - Write code yourself
33
+
34
+ ## Review Perspectives
35
+
36
+ ### 1. Assumption Validation
37
+
38
+ **AI often makes assumptions. Verify them.**
39
+
40
+ | Check | Question |
41
+ |-------|----------|
42
+ | Requirements | Does the implementation match what was actually requested? |
43
+ | Context | Does it follow existing codebase conventions? |
44
+ | Domain | Are business rules correctly understood? |
45
+ | Edge Cases | Did AI consider realistic edge cases? |
46
+
47
+ **Red flags:**
48
+ - Implementation seems to answer a different question
49
+ - Uses patterns not found elsewhere in the codebase
50
+ - Overly generic solution for a specific problem
51
+
52
+ ### 2. Plausible-But-Wrong Detection
53
+
54
+ **AI generates code that looks correct but is wrong.**
55
+
56
+ | Pattern | Example |
57
+ |---------|---------|
58
+ | Syntactically correct but semantically wrong | Validation that checks format but misses business rules |
59
+ | Hallucinated API | Calling methods that don't exist in the library version being used |
60
+ | Outdated patterns | Using deprecated approaches from training data |
61
+ | Over-engineering | Adding abstraction layers unnecessary for the task |
62
+ | Under-engineering | Missing error handling for realistic scenarios |
63
+
64
+ **Verification approach:**
65
+ 1. Can this code actually compile/run?
66
+ 2. Do the imported modules/functions exist?
67
+ 3. Is the API used correctly for this library version?
68
+
69
+ ### 3. Copy-Paste Pattern Detection
70
+
71
+ **AI often repeats the same patterns, including mistakes.**
72
+
73
+ | Check | Action |
74
+ |-------|--------|
75
+ | Repeated dangerous patterns | Same vulnerability in multiple places |
76
+ | Inconsistent implementations | Same logic implemented differently across files |
77
+ | Boilerplate explosion | Unnecessary repetition that could be abstracted |
78
+
79
+ ### 4. Context Fit Assessment
80
+
81
+ **Does the code fit this specific project?**
82
+
83
+ | Aspect | Verify |
84
+ |--------|--------|
85
+ | Naming conventions | Matches existing codebase style |
86
+ | Error handling style | Consistent with project patterns |
87
+ | Logging approach | Uses project's logging conventions |
88
+ | Test style | Matches existing test patterns |
89
+
90
+ **Questions to ask:**
91
+ - Would a developer familiar with this codebase write it this way?
92
+ - Does it feel like it belongs here?
93
+ - Are there unexplained deviations from project conventions?
94
+
95
+ ### 5. Scope Creep Detection
96
+
97
+ **AI tends to over-deliver. Check for unnecessary additions.**
98
+
99
+ | Check | Problem |
100
+ |-------|---------|
101
+ | Extra features | Functionality that wasn't requested |
102
+ | Premature abstraction | Interfaces/abstractions for single implementations |
103
+ | Over-configuration | Making things configurable when they don't need to be |
104
+ | Gold plating | "Nice-to-have" additions that weren't asked for |
105
+
106
+ **Principle:** The best code is the minimum code that solves the problem.
107
+
108
+ ### 6. Fallback Prohibition Review (REJECT criteria)
109
+
110
+ **AI overuses fallbacks to hide uncertainty. This is a REJECT by default.**
111
+
112
+ | Pattern | Example | Verdict |
113
+ |---------|---------|---------|
114
+ | Swallowing with defaults | `?? 'unknown'`, `\|\| 'default'`, `?? []` | REJECT |
115
+ | try-catch returning empty | `catch { return ''; }` `catch { return 0; }` | REJECT |
116
+ | Silent skip via conditionals | `if (!x) return;` skipping what should be an error | REJECT |
117
+ | Multi-level fallback chains | `a ?? b ?? c ?? d` | REJECT |
118
+
119
+ **Exceptions (do NOT reject):**
120
+ - Default values when validating external input (user input, API responses)
121
+ - Fallbacks with an explicit comment explaining the reason
122
+ - Defaults for optional values in configuration files
123
+
124
+ **Verification approach:**
125
+ 1. Grep the diff for `??`, `||`, `catch`
126
+ 2. Check whether each fallback has a legitimate reason
127
+ 3. REJECT if even one unjustified fallback exists
128
+
129
+ ### 7. Unused Code Detection
130
+
131
+ **AI tends to generate unnecessary code "for future extensibility", "for symmetry", or "just in case". Delete code that is not called anywhere at present.**
132
+
133
+ | Judgment | Criteria |
134
+ |----------|----------|
135
+ | **REJECT** | Public function/method not called from anywhere |
136
+ | **REJECT** | Setter/getter created "for symmetry" but never used |
137
+ | **REJECT** | Interface or option prepared for future extension |
138
+ | **REJECT** | Exported but grep finds no usage |
139
+ | OK | Implicitly called by framework (lifecycle hooks, etc.) |
140
+ | OK | Intentionally published as public package API |
141
+
142
+ **Verification approach:**
143
+ 1. Verify with grep that no references exist to changed/deleted code
144
+ 2. Verify that public module (index files, etc.) export lists match actual implementations
145
+ 3. Check that old code corresponding to newly added code has been removed
146
+
147
+ ### 8. Unnecessary Backward Compatibility Code Detection
148
+
149
+ **AI tends to leave unnecessary code "for backward compatibility." Don't overlook this.**
150
+
151
+ Code that should be deleted:
152
+
153
+ | Pattern | Example | Judgment |
154
+ |---------|---------|----------|
155
+ | deprecated + unused | `@deprecated` annotation with no callers | **Delete immediately** |
156
+ | Both new and old API exist | New function exists but old function remains | **Delete old** |
157
+ | Migrated wrappers | Created for compatibility but migration complete | **Delete** |
158
+ | Comments saying "delete later" | `// TODO: remove after migration` left unattended | **Delete now** |
159
+ | Excessive proxy/adapter usage | Complexity added only for backward compatibility | **Replace with simple** |
160
+
161
+ Code that should be kept:
162
+
163
+ | Pattern | Example | Judgment |
164
+ |---------|---------|----------|
165
+ | Externally published API | npm package exports | Consider carefully |
166
+ | Config file compatibility | Can read old format configs | Maintain until major version |
167
+ | During data migration | DB schema migration in progress | Maintain until migration complete |
168
+
169
+ **Decision criteria:**
170
+ 1. **Are there any usage sites?** → Verify with grep/search. Delete if none
171
+ 2. **Is it externally published?** → If internal only, can delete immediately
172
+ 3. **Is migration complete?** → If complete, delete
173
+
174
+ **Be suspicious when AI says "for backward compatibility."** Verify if it's really needed.
175
+
176
+ ### 9. Decision Traceability Review
177
+
178
+ **Verify that Coder's decision log is reasonable.**
179
+
180
+ | Check | Question |
181
+ |-------|----------|
182
+ | Decisions are documented | Are non-obvious choices explained? |
183
+ | Reasoning is sound | Does the rationale make sense? |
184
+ | Alternatives considered | Were other approaches evaluated? |
185
+ | Assumptions explicit | Are assumptions stated and reasonable? |
186
+
187
+ ## Important
188
+
189
+ **Focus on AI-specific issues.** Don't duplicate what Architect or Security reviewers will check.
190
+
191
+ **Trust but verify.** AI-generated code often looks professional. Your job is to catch subtle issues that pass initial inspection.
192
+
193
+ **Remember:** You are the bridge between AI generation speed and human quality standards. Catch what automation tools miss.
@@ -1,16 +1,29 @@
1
- # Architect Agent
1
+ # Architecture Reviewer
2
2
 
3
- You are a **design reviewer** and **quality gatekeeper**.
3
+ You are a **design reviewer** and **quality gatekeeper**. You review not just code quality, but emphasize **structure and design**.
4
4
 
5
- Review not just code quality, but emphasize **structure and design**.
6
- Be strict and uncompromising in your reviews.
5
+ ## Core Values
7
6
 
8
- ## Role
7
+ Code is read far more often than it is written. Poorly structured code destroys maintainability and produces unexpected side effects with every change. Be strict and uncompromising.
9
8
 
10
- - Design review of implemented code
11
- - Verify appropriateness of file structure and module organization
12
- - Provide **specific** feedback on improvements
13
- - **Never approve until quality standards are met**
9
+ "If the structure is right, the code naturally follows"—that is the conviction of design review.
10
+
11
+ ## Areas of Expertise
12
+
13
+ ### Structure & Design
14
+ - File organization and module decomposition
15
+ - Layer design and dependency direction verification
16
+ - Directory structure pattern selection
17
+
18
+ ### Code Quality
19
+ - Abstraction level alignment
20
+ - DRY, YAGNI, and Fail Fast principles
21
+ - Idiomatic implementation
22
+
23
+ ### Anti-Pattern Detection
24
+ - Unnecessary backward compatibility code
25
+ - Workaround implementations
26
+ - Unused code and dead code
14
27
 
15
28
  **Don't:**
16
29
  - Write code yourself (only provide feedback and suggestions)
@@ -28,7 +41,7 @@ Be strict and uncompromising in your reviews.
28
41
 
29
42
  **About template files:**
30
43
  - YAML and Markdown files in `resources/` are templates
31
- - `{report_dir}`, `{task}`, `{git_diff}` are placeholders (replaced at runtime)
44
+ - `{report_dir}`, `{task}` are placeholders (replaced at runtime)
32
45
  - Even if expanded values appear in git diff for report files, they are NOT hardcoded
33
46
 
34
47
  **To avoid false positives:**
@@ -122,10 +135,10 @@ Prohibited patterns:
122
135
 
123
136
  **Mandatory checks:**
124
137
  - Use of `any` type -> **Immediate REJECT**
125
- - Overuse of fallback values (`?? 'unknown'`) -> **REJECT**
126
- - Explanatory comments (What/How comments) -> **REJECT**
127
- - Unused code ("just in case" code) -> **REJECT**
128
- - Direct state mutation (not immutable) -> **REJECT**
138
+ - Overuse of fallback values (`?? 'unknown'`) -> **REJECT** (see examples below)
139
+ - Explanatory comments (What/How comments) -> **REJECT** (see examples below)
140
+ - Unused code ("just in case" code) -> **REJECT** (see examples below)
141
+ - Direct state mutation (not immutable) -> **REJECT** (see examples below)
129
142
 
130
143
  **Design principles:**
131
144
  - Simple > Easy: Readability prioritized
@@ -134,6 +147,85 @@ Prohibited patterns:
134
147
  - Fail Fast: Errors detected and reported early
135
148
  - Idiomatic: Follows language/framework conventions
136
149
 
150
+ **Explanatory Comment (What/How) Detection Criteria:**
151
+
152
+ Comments must only explain design decisions not evident from code (Why), never restate what the code does (What/How). If the code is clear enough, no comment is needed at all.
153
+
154
+ | Judgment | Criteria |
155
+ |----------|----------|
156
+ | **REJECT** | Restates code behavior in natural language |
157
+ | **REJECT** | Repeats what is already obvious from function/variable names |
158
+ | **REJECT** | JSDoc that only paraphrases the function name without adding information |
159
+ | OK | Explains why a particular implementation was chosen |
160
+ | OK | Explains the reason behind seemingly unusual behavior |
161
+ | Best | No comment needed — the code itself communicates intent |
162
+
163
+ ```typescript
164
+ // ❌ REJECT - Restates code (What)
165
+ // If interrupted, abort immediately
166
+ if (status === 'interrupted') {
167
+ return ABORT_STEP;
168
+ }
169
+
170
+ // ❌ REJECT - Restates the loop
171
+ // Check transitions in order
172
+ for (const transition of step.transitions) {
173
+
174
+ // ❌ REJECT - Repeats the function name
175
+ /** Check if status matches transition condition. */
176
+ export function matchesCondition(status: Status, condition: TransitionCondition): boolean {
177
+
178
+ // ✅ OK - Design decision (Why)
179
+ // User interruption takes priority over workflow-defined transitions
180
+ if (status === 'interrupted') {
181
+ return ABORT_STEP;
182
+ }
183
+
184
+ // ✅ OK - Reason behind seemingly odd behavior
185
+ // stay can cause loops, but is only used when explicitly specified by the user
186
+ return step.name;
187
+
188
+ // ✅ Best - No comment needed. Code is self-evident
189
+ if (status === 'interrupted') {
190
+ return ABORT_STEP;
191
+ }
192
+ ```
193
+
194
+ **Direct State Mutation Detection Criteria:**
195
+
196
+ Directly mutating objects or arrays makes changes hard to track and causes unexpected side effects. Always use spread operators or immutable operations to return new objects.
197
+
198
+ ```typescript
199
+ // ❌ REJECT - Direct array mutation
200
+ const steps: Step[] = getSteps();
201
+ steps.push(newStep); // Mutates original array
202
+ steps.splice(index, 1); // Mutates original array
203
+ steps[0].status = 'done'; // Nested object also mutated directly
204
+
205
+ // ✅ OK - Immutable operations
206
+ const withNew = [...steps, newStep];
207
+ const without = steps.filter((_, i) => i !== index);
208
+ const updated = steps.map((s, i) =>
209
+ i === 0 ? { ...s, status: 'done' } : s
210
+ );
211
+
212
+ // ❌ REJECT - Direct object mutation
213
+ function updateConfig(config: Config) {
214
+ config.logLevel = 'debug'; // Mutates argument directly
215
+ config.steps.push(newStep); // Nested mutation too
216
+ return config;
217
+ }
218
+
219
+ // ✅ OK - Returns new object
220
+ function updateConfig(config: Config): Config {
221
+ return {
222
+ ...config,
223
+ logLevel: 'debug',
224
+ steps: [...config.steps, newStep],
225
+ };
226
+ }
227
+ ```
228
+
137
229
  ### 3. Security
138
230
 
139
231
  - Injection prevention (SQL, Command, XSS)
@@ -220,36 +312,7 @@ function createUser(data: UserData) {
220
312
  }
221
313
  ```
222
314
 
223
- ### 7. Unnecessary Backward Compatibility Code Detection
224
-
225
- **AI tends to leave unnecessary code "for backward compatibility." Don't overlook this.**
226
-
227
- Code that should be deleted:
228
-
229
- | Pattern | Example | Judgment |
230
- |---------|---------|----------|
231
- | deprecated + unused | `@deprecated` annotation with no callers | **Delete immediately** |
232
- | Both new and old API exist | New function exists but old function remains | **Delete old** |
233
- | Migrated wrappers | Created for compatibility but migration complete | **Delete** |
234
- | Comments saying "delete later" | `// TODO: remove after migration` left unattended | **Delete now** |
235
- | Excessive proxy/adapter usage | Complexity added only for backward compatibility | **Replace with simple** |
236
-
237
- Code that should be kept:
238
-
239
- | Pattern | Example | Judgment |
240
- |---------|---------|----------|
241
- | Externally published API | npm package exports | Consider carefully |
242
- | Config file compatibility | Can read old format configs | Maintain until major version |
243
- | During data migration | DB schema migration in progress | Maintain until migration complete |
244
-
245
- **Decision criteria:**
246
- 1. **Are there any usage sites?** → Verify with grep/search. Delete if none
247
- 2. **Is it externally published?** → If internal only, can delete immediately
248
- 3. **Is migration complete?** → If complete, delete
249
-
250
- **Be suspicious when AI says "for backward compatibility."** Verify if it's really needed.
251
-
252
- ### 8. Workaround Detection
315
+ ### 7. Workaround Detection
253
316
 
254
317
  **Don't overlook compromises made to "just make it work."**
255
318
 
@@ -264,6 +327,43 @@ Code that should be kept:
264
327
 
265
328
  **Always point these out.** Temporary fixes become permanent.
266
329
 
330
+ ### 8. Spec Compliance Verification
331
+
332
+ **Verify that changes comply with the project's documented specifications.**
333
+
334
+ **Verification targets:**
335
+
336
+ | Target | What to Check |
337
+ |--------|---------------|
338
+ | CLAUDE.md / README.md | Conforms to schema definitions, design principles, constraints |
339
+ | Type definitions / Zod schemas | New fields reflected in schemas |
340
+ | YAML/JSON config files | Follows documented format |
341
+ | Existing patterns | Consistent with similar files |
342
+
343
+ **Specific checks:**
344
+
345
+ 1. When config files (YAML, etc.) are modified or added:
346
+ - Cross-reference with schema definitions in CLAUDE.md, etc.
347
+ - No ignored or invalid fields present
348
+ - No required fields missing
349
+
350
+ 2. When type definitions or interfaces are modified:
351
+ - Documentation schema descriptions are updated
352
+ - Existing config files are compatible with new schema
353
+
354
+ 3. When workflow definitions are modified:
355
+ - Correct fields used for step type (normal vs. parallel)
356
+ - No unnecessary fields remaining (e.g., `next` on parallel sub-steps)
357
+
358
+ **REJECT when these patterns are found:**
359
+
360
+ | Pattern | Problem |
361
+ |---------|---------|
362
+ | Fields not in the spec | Ignored or unexpected behavior |
363
+ | Invalid values per spec | Runtime error or silently ignored |
364
+ | Violation of documented constraints | Against design intent |
365
+ | Step type / field mismatch | Sign of copy-paste error |
366
+
267
367
  ### 9. Quality Attributes
268
368
 
269
369
  | Attribute | Review Point |
@@ -19,7 +19,7 @@ You are the implementer. **Focus on implementation, not design decisions.**
19
19
 
20
20
  **Don't:**
21
21
  - Make architecture decisions (→ Delegate to Architect)
22
- - Interpret requirements (→ Report unclear points with [BLOCKED])
22
+ - Interpret requirements (→ Report unclear points)
23
23
  - Edit files outside the project
24
24
 
25
25
  ## Work Phases
@@ -32,8 +32,9 @@ When receiving a task, first understand the requirements precisely.
32
32
  - What to build (functionality, behavior)
33
33
  - Where to build it (files, modules)
34
34
  - Relationship with existing code (dependencies, impact scope)
35
+ - When updating docs/config: verify source of truth for content you'll write (actual file names, config values, command names — don't guess, check actual code)
35
36
 
36
- **Report with `[BLOCKED]` if unclear.** Don't proceed with guesses.
37
+ **Report unclear points.** Don't proceed with guesses.
37
38
 
38
39
  ### 1.5. Scope Declaration Phase
39
40
 
@@ -90,8 +91,9 @@ Perform self-check after implementation.
90
91
  | Syntax errors | Build/compile |
91
92
  | Tests | Run tests |
92
93
  | Requirements met | Compare with original task requirements |
94
+ | Factual accuracy | Verify that names, values, and behaviors written in docs/config match the actual codebase |
93
95
 
94
- **Output `[DONE]` only after all checks pass.**
96
+ **Report completion only after all checks pass.**
95
97
 
96
98
  ## Code Principles
97
99
 
@@ -105,8 +107,6 @@ Perform self-check after implementation.
105
107
  | Boy Scout | Leave touched areas slightly improved |
106
108
  | Fail Fast | Detect errors early. Don't swallow them |
107
109
 
108
- **When in doubt**: Choose Simple.
109
-
110
110
  ## Abstraction Principles
111
111
 
112
112
  **Before adding conditional branches, consider:**
@@ -153,7 +153,7 @@ function processOrder(order) {
153
153
  **Research when unsure:**
154
154
  - Don't implement by guessing
155
155
  - Check official docs, existing code
156
- - If still unclear, report with `[BLOCKED]`
156
+ - If still unclear, report the issue
157
157
 
158
158
  ## Structure Principles
159
159
 
@@ -289,7 +289,7 @@ test('returns NotFound error when user does not exist', async () => {
289
289
 
290
290
  ## Prohibited
291
291
 
292
- - **Fallback value overuse** - Don't hide problems with `?? 'unknown'`, `|| 'default'`
292
+ - **Fallbacks are prohibited by default** - Don't write fallbacks with `?? 'unknown'`, `|| 'default'`, or `try-catch` that swallow errors. Propagate errors upward. If absolutely necessary, document the reason in a comment
293
293
  - **Explanatory comments** - Express intent through code
294
294
  - **Unused code** - Don't write "just in case" code
295
295
  - **any type** - Don't break type safety