@codemieai/code 0.0.3 → 0.0.5

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 (257) hide show
  1. package/README.md +375 -325
  2. package/bin/codemie-claude.js +23 -0
  3. package/bin/codemie-code.js +49 -11
  4. package/bin/codemie-codex.js +12 -13
  5. package/dist/agents/adapters/claude-code.d.ts +5 -0
  6. package/dist/agents/adapters/claude-code.d.ts.map +1 -1
  7. package/dist/agents/adapters/claude-code.js +76 -18
  8. package/dist/agents/adapters/claude-code.js.map +1 -1
  9. package/dist/agents/adapters/codex.d.ts +5 -0
  10. package/dist/agents/adapters/codex.d.ts.map +1 -1
  11. package/dist/agents/adapters/codex.js +75 -17
  12. package/dist/agents/adapters/codex.js.map +1 -1
  13. package/dist/agents/codemie-code/agent.d.ts.map +1 -1
  14. package/dist/agents/codemie-code/agent.js +187 -21
  15. package/dist/agents/codemie-code/agent.js.map +1 -1
  16. package/dist/agents/codemie-code/config.d.ts.map +1 -1
  17. package/dist/agents/codemie-code/config.js +29 -27
  18. package/dist/agents/codemie-code/config.js.map +1 -1
  19. package/dist/agents/codemie-code/index.d.ts +16 -2
  20. package/dist/agents/codemie-code/index.d.ts.map +1 -1
  21. package/dist/agents/codemie-code/index.js +74 -6
  22. package/dist/agents/codemie-code/index.js.map +1 -1
  23. package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts +87 -0
  24. package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts.map +1 -0
  25. package/dist/agents/codemie-code/modes/contextAwarePlanning.js +957 -0
  26. package/dist/agents/codemie-code/modes/contextAwarePlanning.js.map +1 -0
  27. package/dist/agents/codemie-code/modes/planMode.d.ts +116 -0
  28. package/dist/agents/codemie-code/modes/planMode.d.ts.map +1 -0
  29. package/dist/agents/codemie-code/modes/planMode.js +537 -0
  30. package/dist/agents/codemie-code/modes/planMode.js.map +1 -0
  31. package/dist/agents/codemie-code/prompts.d.ts +29 -0
  32. package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
  33. package/dist/agents/codemie-code/prompts.js +129 -0
  34. package/dist/agents/codemie-code/prompts.js.map +1 -1
  35. package/dist/agents/codemie-code/storage/todoStorage.d.ts +78 -0
  36. package/dist/agents/codemie-code/storage/todoStorage.d.ts.map +1 -0
  37. package/dist/agents/codemie-code/storage/todoStorage.js +225 -0
  38. package/dist/agents/codemie-code/storage/todoStorage.js.map +1 -0
  39. package/dist/agents/codemie-code/tokenUtils.js +1 -1
  40. package/dist/agents/codemie-code/tokenUtils.js.map +1 -1
  41. package/dist/agents/codemie-code/tools/index.d.ts +26 -0
  42. package/dist/agents/codemie-code/tools/index.d.ts.map +1 -1
  43. package/dist/agents/codemie-code/tools/index.js +182 -14
  44. package/dist/agents/codemie-code/tools/index.js.map +1 -1
  45. package/dist/agents/codemie-code/tools/planning.d.ts +53 -0
  46. package/dist/agents/codemie-code/tools/planning.d.ts.map +1 -0
  47. package/dist/agents/codemie-code/tools/planning.js +224 -0
  48. package/dist/agents/codemie-code/tools/planning.js.map +1 -0
  49. package/dist/agents/codemie-code/types.d.ts +170 -6
  50. package/dist/agents/codemie-code/types.d.ts.map +1 -1
  51. package/dist/agents/codemie-code/types.js.map +1 -1
  52. package/dist/agents/codemie-code/ui/progressTracker.d.ts +125 -0
  53. package/dist/agents/codemie-code/ui/progressTracker.d.ts.map +1 -0
  54. package/dist/agents/codemie-code/ui/progressTracker.js +343 -0
  55. package/dist/agents/codemie-code/ui/progressTracker.js.map +1 -0
  56. package/dist/agents/codemie-code/ui/todoPanel.d.ts +112 -0
  57. package/dist/agents/codemie-code/ui/todoPanel.d.ts.map +1 -0
  58. package/dist/agents/codemie-code/ui/todoPanel.js +318 -0
  59. package/dist/agents/codemie-code/ui/todoPanel.js.map +1 -0
  60. package/dist/agents/codemie-code/ui.d.ts +106 -10
  61. package/dist/agents/codemie-code/ui.d.ts.map +1 -1
  62. package/dist/agents/codemie-code/ui.js +913 -129
  63. package/dist/agents/codemie-code/ui.js.map +1 -1
  64. package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts +87 -0
  65. package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts.map +1 -0
  66. package/dist/agents/codemie-code/utils/progressionEnforcer.js +293 -0
  67. package/dist/agents/codemie-code/utils/progressionEnforcer.js.map +1 -0
  68. package/dist/agents/codemie-code/utils/todoParser.d.ts +41 -0
  69. package/dist/agents/codemie-code/utils/todoParser.d.ts.map +1 -0
  70. package/dist/agents/codemie-code/utils/todoParser.js +305 -0
  71. package/dist/agents/codemie-code/utils/todoParser.js.map +1 -0
  72. package/dist/agents/codemie-code/utils/todoValidator.d.ts +65 -0
  73. package/dist/agents/codemie-code/utils/todoValidator.d.ts.map +1 -0
  74. package/dist/agents/codemie-code/utils/todoValidator.js +249 -0
  75. package/dist/agents/codemie-code/utils/todoValidator.js.map +1 -0
  76. package/dist/agents/codemie-code/validators/planValidator.d.ts +94 -0
  77. package/dist/agents/codemie-code/validators/planValidator.d.ts.map +1 -0
  78. package/dist/agents/codemie-code/validators/planValidator.js +281 -0
  79. package/dist/agents/codemie-code/validators/planValidator.js.map +1 -0
  80. package/dist/agents/registry.d.ts.map +1 -1
  81. package/dist/agents/registry.js +7 -5
  82. package/dist/agents/registry.js.map +1 -1
  83. package/dist/cli/commands/auth.d.ts +3 -0
  84. package/dist/cli/commands/auth.d.ts.map +1 -0
  85. package/dist/cli/commands/auth.js +170 -0
  86. package/dist/cli/commands/auth.js.map +1 -0
  87. package/dist/cli/commands/config.d.ts.map +1 -1
  88. package/dist/cli/commands/config.js +40 -13
  89. package/dist/cli/commands/config.js.map +1 -1
  90. package/dist/cli/commands/doctor.d.ts.map +1 -1
  91. package/dist/cli/commands/doctor.js +209 -16
  92. package/dist/cli/commands/doctor.js.map +1 -1
  93. package/dist/cli/commands/env.js +3 -3
  94. package/dist/cli/commands/env.js.map +1 -1
  95. package/dist/cli/commands/install.d.ts.map +1 -1
  96. package/dist/cli/commands/install.js +2 -1
  97. package/dist/cli/commands/install.js.map +1 -1
  98. package/dist/cli/commands/run.d.ts.map +1 -1
  99. package/dist/cli/commands/run.js +15 -9
  100. package/dist/cli/commands/run.js.map +1 -1
  101. package/dist/cli/commands/setup.d.ts.map +1 -1
  102. package/dist/cli/commands/setup.js +177 -11
  103. package/dist/cli/commands/setup.js.map +1 -1
  104. package/dist/cli/commands/tools.d.ts +6 -0
  105. package/dist/cli/commands/tools.d.ts.map +1 -0
  106. package/dist/cli/commands/tools.js +244 -0
  107. package/dist/cli/commands/tools.js.map +1 -0
  108. package/dist/cli/commands/version.js +1 -1
  109. package/dist/cli/commands/version.js.map +1 -1
  110. package/dist/cli/commands/workflow.d.ts +6 -0
  111. package/dist/cli/commands/workflow.d.ts.map +1 -0
  112. package/dist/cli/commands/workflow.js +424 -0
  113. package/dist/cli/commands/workflow.js.map +1 -0
  114. package/dist/cli/index.js +39 -5
  115. package/dist/cli/index.js.map +1 -1
  116. package/dist/clients/adapters/github.d.ts +17 -0
  117. package/dist/clients/adapters/github.d.ts.map +1 -0
  118. package/dist/clients/adapters/github.js +150 -0
  119. package/dist/clients/adapters/github.js.map +1 -0
  120. package/dist/clients/adapters/gitlab.d.ts +17 -0
  121. package/dist/clients/adapters/gitlab.d.ts.map +1 -0
  122. package/dist/clients/adapters/gitlab.js +147 -0
  123. package/dist/clients/adapters/gitlab.js.map +1 -0
  124. package/dist/clients/registry.d.ts +20 -0
  125. package/dist/clients/registry.d.ts.map +1 -0
  126. package/dist/clients/registry.js +27 -0
  127. package/dist/clients/registry.js.map +1 -0
  128. package/dist/tools/detector.d.ts +33 -0
  129. package/dist/tools/detector.d.ts.map +1 -0
  130. package/dist/tools/detector.js +145 -0
  131. package/dist/tools/detector.js.map +1 -0
  132. package/dist/tools/index.d.ts +8 -0
  133. package/dist/tools/index.d.ts.map +1 -0
  134. package/dist/tools/index.js +8 -0
  135. package/dist/tools/index.js.map +1 -0
  136. package/dist/tools/manager.d.ts +21 -0
  137. package/dist/tools/manager.d.ts.map +1 -0
  138. package/dist/tools/manager.js +104 -0
  139. package/dist/tools/manager.js.map +1 -0
  140. package/dist/tools/registry.d.ts +8 -0
  141. package/dist/tools/registry.d.ts.map +1 -0
  142. package/dist/tools/registry.js +36 -0
  143. package/dist/tools/registry.js.map +1 -0
  144. package/dist/tools/types.d.ts +41 -0
  145. package/dist/tools/types.d.ts.map +1 -0
  146. package/dist/tools/types.js +5 -0
  147. package/dist/tools/types.js.map +1 -0
  148. package/dist/types/sso.d.ts +42 -0
  149. package/dist/types/sso.d.ts.map +1 -0
  150. package/dist/types/sso.js +2 -0
  151. package/dist/types/sso.js.map +1 -0
  152. package/dist/utils/agent-compatibility.d.ts +32 -0
  153. package/dist/utils/agent-compatibility.d.ts.map +1 -0
  154. package/dist/utils/agent-compatibility.js +140 -0
  155. package/dist/utils/agent-compatibility.js.map +1 -0
  156. package/dist/utils/codemie-integration-validator.d.ts +17 -0
  157. package/dist/utils/codemie-integration-validator.d.ts.map +1 -0
  158. package/dist/utils/codemie-integration-validator.js +105 -0
  159. package/dist/utils/codemie-integration-validator.js.map +1 -0
  160. package/dist/utils/codemie-model-fetcher.d.ts +11 -0
  161. package/dist/utils/codemie-model-fetcher.d.ts.map +1 -0
  162. package/dist/utils/codemie-model-fetcher.js +242 -0
  163. package/dist/utils/codemie-model-fetcher.js.map +1 -0
  164. package/dist/utils/config-loader.d.ts +23 -1
  165. package/dist/utils/config-loader.d.ts.map +1 -1
  166. package/dist/utils/config-loader.js +73 -27
  167. package/dist/utils/config-loader.js.map +1 -1
  168. package/dist/utils/credential-store.d.ts +16 -0
  169. package/dist/utils/credential-store.d.ts.map +1 -0
  170. package/dist/utils/credential-store.js +109 -0
  171. package/dist/utils/credential-store.js.map +1 -0
  172. package/dist/utils/first-time.d.ts +1 -1
  173. package/dist/utils/first-time.d.ts.map +1 -1
  174. package/dist/utils/first-time.js +52 -71
  175. package/dist/utils/first-time.js.map +1 -1
  176. package/dist/utils/health-checker.d.ts.map +1 -1
  177. package/dist/utils/health-checker.js +5 -1
  178. package/dist/utils/health-checker.js.map +1 -1
  179. package/dist/utils/model-fetcher.d.ts.map +1 -1
  180. package/dist/utils/model-fetcher.js +15 -2
  181. package/dist/utils/model-fetcher.js.map +1 -1
  182. package/dist/utils/sso-auth.d.ts +15 -0
  183. package/dist/utils/sso-auth.d.ts.map +1 -0
  184. package/dist/utils/sso-auth.js +207 -0
  185. package/dist/utils/sso-auth.js.map +1 -0
  186. package/dist/utils/sso-gateway.d.ts +47 -0
  187. package/dist/utils/sso-gateway.d.ts.map +1 -0
  188. package/dist/utils/sso-gateway.js +298 -0
  189. package/dist/utils/sso-gateway.js.map +1 -0
  190. package/dist/workflows/detector.d.ts +37 -0
  191. package/dist/workflows/detector.d.ts.map +1 -0
  192. package/dist/workflows/detector.js +160 -0
  193. package/dist/workflows/detector.js.map +1 -0
  194. package/dist/workflows/index.d.ts +8 -0
  195. package/dist/workflows/index.d.ts.map +1 -0
  196. package/dist/workflows/index.js +8 -0
  197. package/dist/workflows/index.js.map +1 -0
  198. package/dist/workflows/installer.d.ts +24 -0
  199. package/dist/workflows/installer.d.ts.map +1 -0
  200. package/dist/workflows/installer.js +105 -0
  201. package/dist/workflows/installer.js.map +1 -0
  202. package/dist/workflows/registry.d.ts +29 -0
  203. package/dist/workflows/registry.d.ts.map +1 -0
  204. package/dist/workflows/registry.js +54 -0
  205. package/dist/workflows/registry.js.map +1 -0
  206. package/dist/workflows/templates/github/metadata.d.ts +6 -0
  207. package/dist/workflows/templates/github/metadata.d.ts.map +1 -0
  208. package/dist/workflows/templates/github/metadata.js +111 -0
  209. package/dist/workflows/templates/github/metadata.js.map +1 -0
  210. package/dist/workflows/templates/gitlab/metadata.d.ts +6 -0
  211. package/dist/workflows/templates/gitlab/metadata.d.ts.map +1 -0
  212. package/dist/workflows/templates/gitlab/metadata.js +14 -0
  213. package/dist/workflows/templates/gitlab/metadata.js.map +1 -0
  214. package/dist/workflows/types.d.ts +71 -0
  215. package/dist/workflows/types.d.ts.map +1 -0
  216. package/dist/workflows/types.js +5 -0
  217. package/dist/workflows/types.js.map +1 -0
  218. package/package.json +19 -6
  219. package/src/workflows/templates/github/code-ci.yml +529 -0
  220. package/src/workflows/templates/github/inline-fix.yml +665 -0
  221. package/src/workflows/templates/github/pr-review.yml +677 -0
  222. package/.claude/agents/README.md +0 -298
  223. package/.claude/agents/release-manager.md +0 -857
  224. package/.codemie/guides/git-workflow.md +0 -493
  225. package/CLAUDE.md +0 -225
  226. package/config.example.json +0 -10
  227. package/dist/agents/codemie-code/streaming/events.d.ts +0 -7
  228. package/dist/agents/codemie-code/streaming/events.d.ts.map +0 -1
  229. package/dist/agents/codemie-code/streaming/events.js +0 -7
  230. package/dist/agents/codemie-code/streaming/events.js.map +0 -1
  231. package/dist/agents/codemie-code/streaming/formatter.d.ts +0 -2
  232. package/dist/agents/codemie-code/streaming/formatter.d.ts.map +0 -1
  233. package/dist/agents/codemie-code/streaming/formatter.js +0 -2
  234. package/dist/agents/codemie-code/streaming/formatter.js.map +0 -1
  235. package/dist/agents/codemie-code/streaming/ui.d.ts +0 -2
  236. package/dist/agents/codemie-code/streaming/ui.d.ts.map +0 -1
  237. package/dist/agents/codemie-code/streaming/ui.js +0 -2
  238. package/dist/agents/codemie-code/streaming/ui.js.map +0 -1
  239. package/dist/agents/codemie-code/tools/command.d.ts +0 -2
  240. package/dist/agents/codemie-code/tools/command.d.ts.map +0 -1
  241. package/dist/agents/codemie-code/tools/command.js +0 -2
  242. package/dist/agents/codemie-code/tools/command.js.map +0 -1
  243. package/dist/agents/codemie-code/tools/filesystem.d.ts +0 -2
  244. package/dist/agents/codemie-code/tools/filesystem.d.ts.map +0 -1
  245. package/dist/agents/codemie-code/tools/filesystem.js +0 -2
  246. package/dist/agents/codemie-code/tools/filesystem.js.map +0 -1
  247. package/dist/agents/codemie-code/tools/git.d.ts +0 -2
  248. package/dist/agents/codemie-code/tools/git.d.ts.map +0 -1
  249. package/dist/agents/codemie-code/tools/git.js +0 -2
  250. package/dist/agents/codemie-code/tools/git.js.map +0 -1
  251. package/dist/agents/codemie-code/tools/security.d.ts +0 -2
  252. package/dist/agents/codemie-code/tools/security.d.ts.map +0 -1
  253. package/dist/agents/codemie-code/tools/security.js +0 -2
  254. package/dist/agents/codemie-code/tools/security.js.map +0 -1
  255. package/eslint.config.mjs +0 -43
  256. package/scripts/README.md +0 -80
  257. package/scripts/release.sh +0 -156
@@ -0,0 +1,537 @@
1
+ /**
2
+ * Plan Mode Implementation
3
+ *
4
+ * Provides structured planning phase before task execution
5
+ * Inspired by LangChain-Code's Deep Agent planning workflow
6
+ */
7
+ import { getSystemPromptWithPlanning, getTaskPlanningPrompt, detectTaskType } from '../prompts.js';
8
+ import { validateTodoList, generateQualityReport } from '../utils/todoValidator.js';
9
+ import { calculateProgress } from '../utils/todoParser.js';
10
+ import { ContextAwarePlanner } from './contextAwarePlanning.js';
11
+ /**
12
+ * Plan Mode orchestrator for structured task execution
13
+ */
14
+ export class PlanMode {
15
+ agent;
16
+ config;
17
+ state;
18
+ contextAwarePlanner;
19
+ constructor(agent, config = {}) {
20
+ this.agent = agent;
21
+ this.config = {
22
+ requirePlanning: true,
23
+ maxTodos: 10,
24
+ enforceSequential: true,
25
+ minQualityScore: 40, // Lower threshold for context-aware planning
26
+ showPlanningFeedback: true,
27
+ planningTimeout: 60,
28
+ useContextAwarePlanning: true,
29
+ contextConfig: {
30
+ maxFilesToRead: 10,
31
+ maxDirectoryDepth: 3,
32
+ includeTests: true,
33
+ includeConfig: true,
34
+ analyzeDependencies: true,
35
+ debug: false
36
+ },
37
+ ...config
38
+ };
39
+ // Initialize context-aware planner
40
+ this.contextAwarePlanner = new ContextAwarePlanner(this.agent, this.config.contextConfig);
41
+ // Initialize state
42
+ this.state = {
43
+ todos: [],
44
+ files: {},
45
+ planningComplete: false,
46
+ planMode: {
47
+ enabled: true,
48
+ requirePlanning: this.config.requirePlanning,
49
+ maxTodos: this.config.maxTodos,
50
+ enforceSequential: this.config.enforceSequential
51
+ }
52
+ };
53
+ }
54
+ /**
55
+ * Execute a task with mandatory planning phase
56
+ */
57
+ async executePlannedTask(task, eventCallback) {
58
+ try {
59
+ // Emit planning start event
60
+ eventCallback?.({
61
+ type: 'planning_start',
62
+ planningInfo: {
63
+ phase: 'starting',
64
+ message: 'Starting planning phase...'
65
+ }
66
+ });
67
+ // Phase 1: Planning
68
+ const planningResult = await this.planningPhase(task, eventCallback);
69
+ if (!planningResult.success) {
70
+ throw new Error(`Planning failed: ${planningResult.error}`);
71
+ }
72
+ // Emit planning complete event
73
+ eventCallback?.({
74
+ type: 'planning_complete',
75
+ planningInfo: {
76
+ phase: 'completed',
77
+ totalSteps: planningResult.todos.length,
78
+ message: `Plan created with ${planningResult.todos.length} steps`
79
+ }
80
+ });
81
+ // Phase 2: Validation
82
+ await this.validatePlan(planningResult, eventCallback);
83
+ // Phase 3: Execution with progress tracking
84
+ const result = await this.executeWithProgress(task, eventCallback);
85
+ // Phase 4: Completion verification
86
+ await this.verifyCompletion(eventCallback);
87
+ return result;
88
+ }
89
+ catch (error) {
90
+ const errorMessage = error instanceof Error ? error.message : String(error);
91
+ eventCallback?.({
92
+ type: 'error',
93
+ error: `Plan mode execution failed: ${errorMessage}`
94
+ });
95
+ throw error;
96
+ }
97
+ }
98
+ /**
99
+ * Planning phase - force agent to create structured plan
100
+ */
101
+ async planningPhase(task, eventCallback) {
102
+ const startTime = Date.now();
103
+ try {
104
+ // Use context-aware planning if enabled
105
+ if (this.config.useContextAwarePlanning) {
106
+ return await this.contextAwarePlanningPhase(task, startTime, eventCallback);
107
+ }
108
+ // Fallback to original abstract planning
109
+ return await this.abstractPlanningPhase(task, startTime, eventCallback);
110
+ }
111
+ catch (error) {
112
+ const errorMessage = error instanceof Error ? error.message : String(error);
113
+ return {
114
+ success: false,
115
+ todos: [],
116
+ qualityScore: 0,
117
+ duration: Date.now() - startTime,
118
+ error: errorMessage,
119
+ warnings: [],
120
+ suggestions: []
121
+ };
122
+ }
123
+ }
124
+ /**
125
+ * Context-aware planning phase that explores codebase first
126
+ */
127
+ async contextAwarePlanningPhase(task, startTime, eventCallback) {
128
+ try {
129
+ // Create a wrapper callback that forwards all planning events
130
+ const planningEventCallback = (event) => {
131
+ // Forward the event to the original callback
132
+ eventCallback?.(event);
133
+ // Capture todo updates from the planning process
134
+ if (event.type === 'todo_update' && event.todoUpdate) {
135
+ this.state.todos = [...event.todoUpdate.todos];
136
+ this.state.planningComplete = true;
137
+ }
138
+ };
139
+ // Use the ContextAwarePlanner to create an informed plan
140
+ const { plan: _plan, context: _context } = await this.contextAwarePlanner.createContextAwarePlan(task, planningEventCallback);
141
+ // Emit final planning progress completion
142
+ eventCallback?.({
143
+ type: 'planning_progress',
144
+ planningProgress: {
145
+ phase: 'plan_validation',
146
+ message: 'Plan completed successfully',
147
+ phaseProgress: 100,
148
+ overallProgress: 100,
149
+ details: 'Context-aware plan created and validated'
150
+ }
151
+ });
152
+ // Parse the plan to extract todos (the ContextAwarePlanner should have called write_todos)
153
+ // Get the latest todos directly from TodoStateManager instead of relying on event timing
154
+ const { TodoStateManager } = await import('../tools/planning.js');
155
+ const latestTodos = TodoStateManager.getCurrentTodos();
156
+ // Sync the todos to our state
157
+ if (latestTodos.length > 0) {
158
+ this.state.todos = [...latestTodos];
159
+ this.state.planningComplete = true;
160
+ }
161
+ // Assess plan quality using the latest todos
162
+ const qualityReport = generateQualityReport(this.state.todos);
163
+ const result = {
164
+ success: qualityReport.qualityScore >= this.config.minQualityScore,
165
+ todos: [...this.state.todos],
166
+ qualityScore: qualityReport.qualityScore,
167
+ duration: Date.now() - startTime,
168
+ warnings: [],
169
+ suggestions: qualityReport.recommendations
170
+ };
171
+ if (!result.success) {
172
+ result.error = `Plan quality too low (${qualityReport.qualityScore}/${this.config.minQualityScore} required)`;
173
+ result.warnings.push('Consider asking for more specific, actionable steps');
174
+ // Emit planning failure event
175
+ eventCallback?.({
176
+ type: 'planning_progress',
177
+ planningProgress: {
178
+ phase: 'plan_validation',
179
+ message: 'Plan validation failed',
180
+ phaseProgress: 100,
181
+ overallProgress: 100,
182
+ details: `Quality score ${qualityReport.qualityScore}/${this.config.minQualityScore} too low`
183
+ }
184
+ });
185
+ }
186
+ else {
187
+ // Emit planning success event
188
+ eventCallback?.({
189
+ type: 'planning_discovery',
190
+ planningDiscovery: {
191
+ type: 'project_structure',
192
+ summary: `Plan validated successfully with ${this.state.todos.length} steps`,
193
+ data: {
194
+ todoCount: this.state.todos.length,
195
+ qualityScore: qualityReport.qualityScore,
196
+ planningDuration: Date.now() - startTime
197
+ },
198
+ impact: 'Ready for execution with high-quality, context-aware plan'
199
+ }
200
+ });
201
+ }
202
+ // Check todo count limits
203
+ if (this.state.todos.length > this.config.maxTodos) {
204
+ result.warnings.push(`Plan has ${this.state.todos.length} steps (max ${this.config.maxTodos}). Consider breaking into smaller tasks.`);
205
+ }
206
+ return result;
207
+ }
208
+ catch (error) {
209
+ const errorMessage = error instanceof Error ? error.message : String(error);
210
+ // Emit error event
211
+ eventCallback?.({
212
+ type: 'planning_progress',
213
+ planningProgress: {
214
+ phase: 'plan_validation',
215
+ message: 'Planning failed with error',
216
+ phaseProgress: 100,
217
+ overallProgress: 100,
218
+ details: errorMessage
219
+ }
220
+ });
221
+ return {
222
+ success: false,
223
+ todos: [],
224
+ qualityScore: 0,
225
+ duration: Date.now() - startTime,
226
+ error: `Context-aware planning failed: ${errorMessage}`,
227
+ warnings: [],
228
+ suggestions: ['Try with simpler task description', 'Check codebase accessibility']
229
+ };
230
+ }
231
+ }
232
+ /**
233
+ * Original abstract planning phase (fallback)
234
+ */
235
+ async abstractPlanningPhase(task, startTime, eventCallback) {
236
+ // Detect task type and get appropriate planning prompt
237
+ const taskType = detectTaskType(task);
238
+ const taskPrompt = getTaskPlanningPrompt(taskType);
239
+ const _systemPrompt = getSystemPromptWithPlanning(this.agent.getConfig()?.workingDirectory || process.cwd());
240
+ // Create planning request
241
+ const planningRequest = `${taskPrompt}
242
+
243
+ TASK: ${task}
244
+
245
+ INSTRUCTIONS:
246
+ 1. Start by calling write_todos([...]) with a structured plan of 3-8 specific steps
247
+ 2. Each step should be actionable and have clear completion criteria
248
+ 3. Use verb-first language and be specific about files/components
249
+ 4. Do NOT start executing yet - only create the plan
250
+
251
+ Create your plan now using the write_todos tool.`;
252
+ // Emit planning in progress
253
+ eventCallback?.({
254
+ type: 'planning_start',
255
+ planningInfo: {
256
+ phase: 'in_progress',
257
+ message: `Creating ${taskType} plan...`
258
+ }
259
+ });
260
+ // Execute planning with timeout
261
+ const planningPromise = this.executePlanningRequest(planningRequest, eventCallback);
262
+ const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('Planning timeout')), this.config.planningTimeout * 1000));
263
+ const planningResponse = await Promise.race([planningPromise, timeoutPromise]);
264
+ // Validate that planning was successful
265
+ // Check if todos were created via tool OR if planning content looks structured
266
+ const responseContent = typeof planningResponse === 'string' ? planningResponse : '';
267
+ const hasStructuredPlan = this.validatePlanningContent(responseContent);
268
+ if (this.state.todos.length === 0 && !hasStructuredPlan) {
269
+ return {
270
+ success: false,
271
+ todos: [],
272
+ qualityScore: 0,
273
+ duration: Date.now() - startTime,
274
+ error: 'Agent failed to create any todos during planning phase',
275
+ warnings: [],
276
+ suggestions: ['Try rephrasing the task to be more specific']
277
+ };
278
+ }
279
+ // If no explicit todos but we have structured planning content, create basic todos
280
+ if (this.state.todos.length === 0 && hasStructuredPlan) {
281
+ this.state.todos = this.extractTodosFromContent(responseContent);
282
+ }
283
+ // Get the latest todos from TodoStateManager to ensure we have the most recent state
284
+ const { TodoStateManager } = await import('../tools/planning.js');
285
+ const latestTodos = TodoStateManager.getCurrentTodos();
286
+ if (latestTodos.length > 0) {
287
+ this.state.todos = [...latestTodos];
288
+ this.state.planningComplete = true;
289
+ }
290
+ // Assess plan quality
291
+ const qualityReport = generateQualityReport(this.state.todos);
292
+ const result = {
293
+ success: qualityReport.qualityScore >= this.config.minQualityScore,
294
+ todos: [...this.state.todos],
295
+ qualityScore: qualityReport.qualityScore,
296
+ duration: Date.now() - startTime,
297
+ warnings: [],
298
+ suggestions: qualityReport.recommendations
299
+ };
300
+ if (!result.success) {
301
+ result.error = `Plan quality too low (${qualityReport.qualityScore}/${this.config.minQualityScore} required)`;
302
+ result.warnings.push('Consider asking for more specific, actionable steps');
303
+ }
304
+ // Check todo count limits
305
+ if (this.state.todos.length > this.config.maxTodos) {
306
+ result.warnings.push(`Plan has ${this.state.todos.length} steps (max ${this.config.maxTodos}). Consider breaking into smaller tasks.`);
307
+ }
308
+ return result;
309
+ }
310
+ /**
311
+ * Execute the planning request and capture todos
312
+ */
313
+ async executePlanningRequest(planningRequest, eventCallback) {
314
+ let todos = [];
315
+ // Create a wrapper callback that captures todo creation
316
+ const planningCallback = (event) => {
317
+ // Forward the event to the original callback
318
+ eventCallback?.(event);
319
+ // Capture todo updates
320
+ if (event.type === 'todo_update' && event.todoUpdate) {
321
+ todos = event.todoUpdate.todos;
322
+ this.state.todos = [...todos];
323
+ this.state.planningComplete = true;
324
+ }
325
+ };
326
+ // Execute the planning request
327
+ let result = '';
328
+ await this.agent.chatStream(planningRequest, (event) => {
329
+ planningCallback(event);
330
+ if (event.type === 'content_chunk') {
331
+ result += event.content || '';
332
+ }
333
+ });
334
+ // Ensure we captured the todos
335
+ if (todos.length > 0) {
336
+ this.state.todos = todos;
337
+ this.state.planningComplete = true;
338
+ }
339
+ return result;
340
+ }
341
+ /**
342
+ * Validate the generated plan
343
+ */
344
+ async validatePlan(planningResult, eventCallback) {
345
+ const validation = validateTodoList(planningResult.todos);
346
+ if (validation.errors.length > 0) {
347
+ throw new Error(`Plan validation failed: ${validation.errors.join(', ')}`);
348
+ }
349
+ if (this.config.showPlanningFeedback && eventCallback) {
350
+ // Show planning feedback
351
+ if (validation.warnings.length > 0) {
352
+ eventCallback({
353
+ type: 'content_chunk',
354
+ content: `⚠️ Planning warnings: ${validation.warnings.join(', ')}\n`
355
+ });
356
+ }
357
+ if (validation.suggestions.length > 0) {
358
+ eventCallback({
359
+ type: 'content_chunk',
360
+ content: `💡 Suggestions: ${validation.suggestions.slice(0, 2).join(', ')}\n`
361
+ });
362
+ }
363
+ }
364
+ }
365
+ /**
366
+ * Execute the task with progress tracking
367
+ */
368
+ async executeWithProgress(task, eventCallback) {
369
+ // Create execution request that references the plan
370
+ const executionRequest = `Now execute the plan you created. For each step:
371
+
372
+ 1. Call update_todo_status(index, "in_progress") when starting a step
373
+ 2. Perform the work for that step
374
+ 3. Call update_todo_status(index, "completed") when finishing the step
375
+ 4. Move to the next step
376
+
377
+ Remember:
378
+ - Only work on ONE step at a time (only one "in_progress")
379
+ - Complete steps in order when possible
380
+ - Update status as you work through the plan
381
+ - Use the tools you have available to complete each step
382
+
383
+ Begin executing your plan now, starting with step 0.`;
384
+ let result = '';
385
+ await this.agent.chatStream(executionRequest, (event) => {
386
+ eventCallback?.(event);
387
+ if (event.type === 'content_chunk') {
388
+ result += event.content || '';
389
+ }
390
+ // Update internal state when todos change
391
+ if (event.type === 'todo_update' && event.todoUpdate) {
392
+ this.state.todos = event.todoUpdate.todos;
393
+ }
394
+ });
395
+ return result;
396
+ }
397
+ /**
398
+ * Verify that execution completed successfully
399
+ */
400
+ async verifyCompletion(eventCallback) {
401
+ const progress = calculateProgress(this.state.todos);
402
+ if (progress.total === 0) {
403
+ eventCallback?.({
404
+ type: 'content_chunk',
405
+ content: '\n⚠️ No todos were tracked during execution.\n'
406
+ });
407
+ return;
408
+ }
409
+ const completionRate = (progress.completed / progress.total) * 100;
410
+ if (completionRate === 100) {
411
+ eventCallback?.({
412
+ type: 'content_chunk',
413
+ content: `\n🎉 All ${progress.total} planned steps completed successfully!\n`
414
+ });
415
+ }
416
+ else if (completionRate >= 80) {
417
+ eventCallback?.({
418
+ type: 'content_chunk',
419
+ content: `\n✅ Most steps completed (${progress.completed}/${progress.total}). Great progress!\n`
420
+ });
421
+ }
422
+ else {
423
+ eventCallback?.({
424
+ type: 'content_chunk',
425
+ content: `\n📊 Completed ${progress.completed}/${progress.total} steps (${Math.round(completionRate)}%).\n`
426
+ });
427
+ if (progress.currentTodo) {
428
+ eventCallback?.({
429
+ type: 'content_chunk',
430
+ content: `🔄 Last active step: ${progress.currentTodo.content}\n`
431
+ });
432
+ }
433
+ }
434
+ }
435
+ /**
436
+ * Get current plan state
437
+ */
438
+ getPlanState() {
439
+ return { ...this.state };
440
+ }
441
+ /**
442
+ * Get plan mode configuration
443
+ */
444
+ getConfig() {
445
+ return { ...this.config };
446
+ }
447
+ /**
448
+ * Update configuration
449
+ */
450
+ updateConfig(newConfig) {
451
+ this.config = { ...this.config, ...newConfig };
452
+ if (this.state.planMode) {
453
+ this.state.planMode = {
454
+ ...this.state.planMode,
455
+ requirePlanning: this.config.requirePlanning,
456
+ maxTodos: this.config.maxTodos,
457
+ enforceSequential: this.config.enforceSequential
458
+ };
459
+ }
460
+ }
461
+ /**
462
+ * Validate if planning content has structured plan elements
463
+ */
464
+ validatePlanningContent(content) {
465
+ // Look for common planning indicators
466
+ const indicators = [
467
+ /\d+\.\s+/g, // Numbered lists like "1. "
468
+ /[-*]\s+/g, // Bullet points
469
+ /step\s+\d+/gi, // "Step 1", "Step 2"
470
+ /phase\s+\d+/gi, // "Phase 1", "Phase 2"
471
+ /\b(plan|todo|task|step)s?\b/gi // Planning keywords
472
+ ];
473
+ return indicators.some(pattern => pattern.test(content));
474
+ }
475
+ /**
476
+ * Extract basic todos from planning content
477
+ */
478
+ extractTodosFromContent(content) {
479
+ const todos = [];
480
+ const lines = content.split('\n');
481
+ for (const line of lines) {
482
+ const trimmed = line.trim();
483
+ // Look for numbered or bulleted items
484
+ const numberedMatch = trimmed.match(/^\d+\.\s+(.+)$/);
485
+ const bulletMatch = trimmed.match(/^[-*]\s+(.+)$/);
486
+ if (numberedMatch) {
487
+ todos.push({
488
+ content: numberedMatch[1].trim(),
489
+ status: 'pending',
490
+ index: todos.length
491
+ });
492
+ }
493
+ else if (bulletMatch) {
494
+ todos.push({
495
+ content: bulletMatch[1].trim(),
496
+ status: 'pending',
497
+ index: todos.length
498
+ });
499
+ }
500
+ }
501
+ // If we found some todos, ensure we have at least a few basic ones
502
+ if (todos.length === 0) {
503
+ // Create basic fallback todos
504
+ todos.push({
505
+ content: 'Research and analyze requirements',
506
+ status: 'pending',
507
+ index: 0
508
+ }, {
509
+ content: 'Implement core functionality',
510
+ status: 'pending',
511
+ index: 1
512
+ }, {
513
+ content: 'Test and validate results',
514
+ status: 'pending',
515
+ index: 2
516
+ });
517
+ }
518
+ return todos.slice(0, this.config.maxTodos); // Respect max todos limit
519
+ }
520
+ /**
521
+ * Reset plan state
522
+ */
523
+ reset() {
524
+ this.state = {
525
+ todos: [],
526
+ files: {},
527
+ planningComplete: false,
528
+ planMode: {
529
+ enabled: true,
530
+ requirePlanning: this.config.requirePlanning,
531
+ maxTodos: this.config.maxTodos,
532
+ enforceSequential: this.config.enforceSequential
533
+ }
534
+ };
535
+ }
536
+ }
537
+ //# sourceMappingURL=planMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"planMode.js","sourceRoot":"","sources":["../../../../src/agents/codemie-code/modes/planMode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAA+B,MAAM,2BAA2B,CAAC;AAyD7F;;GAEG;AACH,MAAM,OAAO,QAAQ;IACX,KAAK,CAAe;IACpB,MAAM,CAAiB;IACvB,KAAK,CAAoB;IACzB,mBAAmB,CAAsB;IAEjD,YAAY,KAAmB,EAAE,SAAkC,EAAE;QACnE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG;YACZ,eAAe,EAAE,IAAI;YACrB,Q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AAC,CAAC,0BAA0B;IACzE,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,GAAG;YACX,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;YACT,gBAAgB,EAAE,KAAK;YACvB,QAAQ,EAAE;gBACR,OAAO,EAAE,IAAI;gBACb,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe;gBAC5C,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;gBAC9B,iBAAiB,EAAE,IAAI,CAAC,MAAM,CAAC,iBAAiB;aACjD;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -4,8 +4,37 @@
4
4
  * Contains the system prompt and instructions for the LangGraph ReAct agent
5
5
  */
6
6
  export declare const SYSTEM_PROMPT = "You are CodeMie, an advanced AI coding assistant designed to help developers with various programming tasks.\n\nCAPABILITIES:\n- Read, write, and modify files in the project directory\n- Execute shell commands for building, testing, and development tasks\n- Perform Git operations (status, diff, add, commit, log)\n- Analyze code structure and provide recommendations\n- Help with debugging, refactoring, and code optimization\n\nGUIDELINES:\n- Always explain what you're doing before taking actions\n- Ask for confirmation before making significant changes\n- Provide clear, concise explanations of your reasoning\n- Follow best practices for the programming language being used\n- Be security-conscious when executing commands or modifying files\n\nCURRENT WORKING DIRECTORY: {workingDirectory}\n\nYou have access to the following tools:";
7
+ /**
8
+ * Planning mode suffix for structured todo-based execution
9
+ * Inspired by LangChain-Code's Deep Agent planning approach
10
+ */
11
+ export declare const PLANNING_SUFFIX = "\n## Planning & TODOs\n- In your FIRST 1-2 tool calls, call `write_todos([...])` with 3-8 concrete steps\n- Before working a step, call `update_todo_status(index, \"in_progress\")`\n- After finishing it, call `update_todo_status(index, \"completed\")`\n- Keep only one item \"in_progress\" at a time and keep todos verb-first and specific\n- Use specific, actionable language: \"Read config.ts file\" not \"Understand configuration\"\n\n## Todo Guidelines\n- pending: Task not yet started\n- in_progress: Currently working on (ONLY ONE allowed)\n- completed: Task finished successfully\n\n## Best Practices for Todos\n- Start with action verbs (Read, Write, Create, Update, Fix, Test, etc.)\n- Be specific about files, functions, or components\n- Break complex tasks into 3-8 manageable steps\n- Each step should have clear completion criteria\n- Avoid vague language like \"handle\", \"deal with\", \"work on\"\n\nExample good todos:\n- \"Read package.json to understand dependencies\"\n- \"Create new React component in src/components/TodoList.tsx\"\n- \"Update API endpoint to handle authentication\"\n- \"Run tests to verify functionality\"\n- \"Commit changes with descriptive message\"\n\nExample poor todos:\n- \"Handle configuration\" (too vague)\n- \"Work on the authentication system\" (too broad)\n- \"Fix stuff\" (unclear what needs fixing)\n";
12
+ /**
13
+ * Task-focused planning prompt for feature implementation
14
+ */
15
+ export declare const FEATURE_PLANNING_PROMPT = "You are implementing a feature end-to-end with structured planning.\n\nYour process:\n1. **Planning Phase**: Create a detailed plan using write_todos with specific steps\n2. **Discovery Phase**: Use tools to understand the current codebase structure\n3. **Implementation Phase**: Make targeted changes with progress tracking\n4. **Verification Phase**: Test and validate your changes\n5. **Completion Phase**: Summarize what was accomplished\n\nPlanning guidelines:\n- Break the feature into logical, sequential steps\n- Include discovery, implementation, testing, and documentation steps\n- Be specific about files and components to modify\n- Consider dependencies between steps\n- Plan for error handling and edge cases";
16
+ /**
17
+ * Bug fix planning prompt
18
+ */
19
+ export declare const BUGFIX_PLANNING_PROMPT = "You are fixing a bug with a systematic approach.\n\nYour process:\n1. **Analysis Phase**: Understand the problem and create a plan using write_todos\n2. **Investigation Phase**: Use tools to locate the root cause\n3. **Fix Phase**: Implement a minimal, targeted fix\n4. **Testing Phase**: Verify the fix works and doesn't break anything else\n5. **Documentation Phase**: Document the fix and any lessons learned\n\nPlanning guidelines:\n- Start by reproducing and understanding the issue\n- Plan investigation steps to narrow down the root cause\n- Design a minimal fix that addresses the core problem\n- Include regression testing in your plan\n- Consider edge cases and potential side effects";
20
+ /**
21
+ * Analysis planning prompt for code exploration
22
+ */
23
+ export declare const ANALYSIS_PLANNING_PROMPT = "You are analyzing a codebase with a structured approach.\n\nYour process:\n1. **Planning Phase**: Create a plan using write_todos for systematic analysis\n2. **Overview Phase**: Get high-level understanding of project structure\n3. **Deep Dive Phase**: Examine specific components, patterns, and relationships\n4. **Assessment Phase**: Identify strengths, weaknesses, and opportunities\n5. **Reporting Phase**: Summarize findings with actionable recommendations\n\nPlanning guidelines:\n- Plan to explore from general to specific\n- Include architecture, patterns, code quality, and dependencies\n- Look for potential issues, security concerns, and improvement opportunities\n- Structure findings in a clear, actionable format";
7
24
  /**
8
25
  * Get the system prompt with working directory substitution
9
26
  */
10
27
  export declare function getSystemPrompt(workingDirectory: string): string;
28
+ /**
29
+ * Get system prompt with planning mode enabled
30
+ */
31
+ export declare function getSystemPromptWithPlanning(workingDirectory: string): string;
32
+ /**
33
+ * Get task-specific planning prompt
34
+ */
35
+ export declare function getTaskPlanningPrompt(taskType: 'feature' | 'bugfix' | 'analysis'): string;
36
+ /**
37
+ * Detect task type from user input
38
+ */
39
+ export declare function detectTaskType(task: string): 'feature' | 'bugfix' | 'analysis';
11
40
  //# sourceMappingURL=prompts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/agents/codemie-code/prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,aAAa,40BAkBc,CAAC;AAEzC;;GAEG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEhE"}
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/agents/codemie-code/prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,aAAa,40BAkBc,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,eAAe,+0CA+B3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,stBAcK,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,sBAAsB,2rBAcc,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,wBAAwB,2tBAac,CAAC;AAEpD;;GAEG;AACH,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAWzF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAkB9E"}