@polka-codes/cli 0.10.23 → 0.10.25

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 (343) hide show
  1. package/dist/bin.cjs +143854 -0
  2. package/dist/bin.d.ts +2 -0
  3. package/dist/bin.d.ts.map +1 -0
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +9201 -9195
  7. package/dist/program.d.ts +3 -0
  8. package/dist/program.d.ts.map +1 -0
  9. package/package.json +6 -7
  10. package/cli.mjs +0 -2
  11. package/dist/ApiProviderConfig.js +0 -57
  12. package/dist/ApiProviderConfig.js.map +0 -1
  13. package/dist/ApiProviderConfig.test.js +0 -278
  14. package/dist/ApiProviderConfig.test.js.map +0 -1
  15. package/dist/agent/advanced-discovery.js +0 -604
  16. package/dist/agent/advanced-discovery.js.map +0 -1
  17. package/dist/agent/config.js +0 -139
  18. package/dist/agent/config.js.map +0 -1
  19. package/dist/agent/config.test.js +0 -140
  20. package/dist/agent/config.test.js.map +0 -1
  21. package/dist/agent/constants.js +0 -172
  22. package/dist/agent/constants.js.map +0 -1
  23. package/dist/agent/constants.test.js +0 -132
  24. package/dist/agent/constants.test.js.map +0 -1
  25. package/dist/agent/debug-logger.js +0 -281
  26. package/dist/agent/debug-logger.js.map +0 -1
  27. package/dist/agent/debug-logger.test.js +0 -294
  28. package/dist/agent/debug-logger.test.js.map +0 -1
  29. package/dist/agent/error-handling.js +0 -114
  30. package/dist/agent/error-handling.js.map +0 -1
  31. package/dist/agent/error-handling.test.js +0 -191
  32. package/dist/agent/error-handling.test.js.map +0 -1
  33. package/dist/agent/errors.js +0 -301
  34. package/dist/agent/errors.js.map +0 -1
  35. package/dist/agent/executor.js +0 -206
  36. package/dist/agent/executor.js.map +0 -1
  37. package/dist/agent/executor.test.js +0 -228
  38. package/dist/agent/executor.test.js.map +0 -1
  39. package/dist/agent/goal-decomposer.js +0 -281
  40. package/dist/agent/goal-decomposer.js.map +0 -1
  41. package/dist/agent/goal-decomposer.test.js +0 -225
  42. package/dist/agent/goal-decomposer.test.js.map +0 -1
  43. package/dist/agent/health-monitor.js +0 -89
  44. package/dist/agent/health-monitor.js.map +0 -1
  45. package/dist/agent/improvement-loop.js +0 -177
  46. package/dist/agent/improvement-loop.js.map +0 -1
  47. package/dist/agent/index.js +0 -38
  48. package/dist/agent/index.js.map +0 -1
  49. package/dist/agent/metrics.js +0 -158
  50. package/dist/agent/metrics.js.map +0 -1
  51. package/dist/agent/metrics.test.js +0 -311
  52. package/dist/agent/metrics.test.js.map +0 -1
  53. package/dist/agent/orchestrator.js +0 -438
  54. package/dist/agent/orchestrator.js.map +0 -1
  55. package/dist/agent/planner.js +0 -199
  56. package/dist/agent/planner.js.map +0 -1
  57. package/dist/agent/planner.test.js +0 -135
  58. package/dist/agent/planner.test.js.map +0 -1
  59. package/dist/agent/progress.js +0 -298
  60. package/dist/agent/progress.js.map +0 -1
  61. package/dist/agent/progress.test.js +0 -255
  62. package/dist/agent/progress.test.js.map +0 -1
  63. package/dist/agent/resource-monitor.js +0 -114
  64. package/dist/agent/resource-monitor.js.map +0 -1
  65. package/dist/agent/safety/approval.js +0 -178
  66. package/dist/agent/safety/approval.js.map +0 -1
  67. package/dist/agent/safety/approval.test.js +0 -142
  68. package/dist/agent/safety/approval.test.js.map +0 -1
  69. package/dist/agent/safety/checks.js +0 -152
  70. package/dist/agent/safety/checks.js.map +0 -1
  71. package/dist/agent/safety/checks.test.js +0 -89
  72. package/dist/agent/safety/checks.test.js.map +0 -1
  73. package/dist/agent/safety/interrupt.js +0 -92
  74. package/dist/agent/safety/interrupt.js.map +0 -1
  75. package/dist/agent/safety/interrupt.test.js +0 -53
  76. package/dist/agent/safety/interrupt.test.js.map +0 -1
  77. package/dist/agent/session.js +0 -117
  78. package/dist/agent/session.js.map +0 -1
  79. package/dist/agent/session.test.js +0 -213
  80. package/dist/agent/session.test.js.map +0 -1
  81. package/dist/agent/state-manager.js +0 -287
  82. package/dist/agent/state-manager.js.map +0 -1
  83. package/dist/agent/task-discovery.js +0 -433
  84. package/dist/agent/task-discovery.js.map +0 -1
  85. package/dist/agent/task-discovery.test.js +0 -40
  86. package/dist/agent/task-discovery.test.js.map +0 -1
  87. package/dist/agent/task-history.js +0 -128
  88. package/dist/agent/task-history.js.map +0 -1
  89. package/dist/agent/task-prioritizer.js +0 -286
  90. package/dist/agent/task-prioritizer.js.map +0 -1
  91. package/dist/agent/test-fixtures.js +0 -112
  92. package/dist/agent/test-fixtures.js.map +0 -1
  93. package/dist/agent/types.js +0 -15
  94. package/dist/agent/types.js.map +0 -1
  95. package/dist/agent/workflow-adapter.js +0 -219
  96. package/dist/agent/workflow-adapter.js.map +0 -1
  97. package/dist/agent/workflow-adapter.test.js +0 -11
  98. package/dist/agent/workflow-adapter.test.js.map +0 -1
  99. package/dist/agent/working-dir-discovery.js +0 -54
  100. package/dist/agent/working-dir-discovery.js.map +0 -1
  101. package/dist/agent/working-space.js +0 -484
  102. package/dist/agent/working-space.js.map +0 -1
  103. package/dist/agent/working-space.test.js +0 -436
  104. package/dist/agent/working-space.test.js.map +0 -1
  105. package/dist/api.js +0 -279
  106. package/dist/api.js.map +0 -1
  107. package/dist/builtin-commands.js +0 -20
  108. package/dist/builtin-commands.js.map +0 -1
  109. package/dist/commandSummarizer.js +0 -96
  110. package/dist/commandSummarizer.js.map +0 -1
  111. package/dist/commands/__tests__/command-detection.integration.test.js +0 -238
  112. package/dist/commands/__tests__/command-detection.integration.test.js.map +0 -1
  113. package/dist/commands/__tests__/script-generator.integration.test.js +0 -271
  114. package/dist/commands/__tests__/script-generator.integration.test.js.map +0 -1
  115. package/dist/commands/agent.js +0 -218
  116. package/dist/commands/agent.js.map +0 -1
  117. package/dist/commands/code.js +0 -102
  118. package/dist/commands/code.js.map +0 -1
  119. package/dist/commands/command.constants.js +0 -13
  120. package/dist/commands/command.constants.js.map +0 -1
  121. package/dist/commands/commit.js +0 -17
  122. package/dist/commands/commit.js.map +0 -1
  123. package/dist/commands/fix.js +0 -17
  124. package/dist/commands/fix.js.map +0 -1
  125. package/dist/commands/init.js +0 -501
  126. package/dist/commands/init.js.map +0 -1
  127. package/dist/commands/mcp-server.js +0 -122
  128. package/dist/commands/mcp-server.js.map +0 -1
  129. package/dist/commands/memory.js +0 -410
  130. package/dist/commands/memory.js.map +0 -1
  131. package/dist/commands/memory.test.js +0 -453
  132. package/dist/commands/memory.test.js.map +0 -1
  133. package/dist/commands/meta.js +0 -142
  134. package/dist/commands/meta.js.map +0 -1
  135. package/dist/commands/plan.js +0 -39
  136. package/dist/commands/plan.js.map +0 -1
  137. package/dist/commands/pr.js +0 -14
  138. package/dist/commands/pr.js.map +0 -1
  139. package/dist/commands/review-json.test.js +0 -33
  140. package/dist/commands/review-json.test.js.map +0 -1
  141. package/dist/commands/review.js +0 -137
  142. package/dist/commands/review.js.map +0 -1
  143. package/dist/commands/review.usage.test.js +0 -41
  144. package/dist/commands/review.usage.test.js.map +0 -1
  145. package/dist/commands/run.js +0 -107
  146. package/dist/commands/run.js.map +0 -1
  147. package/dist/commands/skills.js +0 -175
  148. package/dist/commands/skills.js.map +0 -1
  149. package/dist/commands/task.js +0 -34
  150. package/dist/commands/task.js.map +0 -1
  151. package/dist/commands/workflow.js +0 -117
  152. package/dist/commands/workflow.js.map +0 -1
  153. package/dist/configPrompt.js +0 -39
  154. package/dist/configPrompt.js.map +0 -1
  155. package/dist/env.js +0 -22
  156. package/dist/env.js.map +0 -1
  157. package/dist/errors.js +0 -132
  158. package/dist/errors.js.map +0 -1
  159. package/dist/errors.test.js +0 -21
  160. package/dist/errors.test.js.map +0 -1
  161. package/dist/file-attachments.js +0 -77
  162. package/dist/file-attachments.js.map +0 -1
  163. package/dist/file-attachments.test.js +0 -214
  164. package/dist/file-attachments.test.js.map +0 -1
  165. package/dist/getModel.js +0 -229
  166. package/dist/getModel.js.map +0 -1
  167. package/dist/getModel.test.js +0 -67
  168. package/dist/getModel.test.js.map +0 -1
  169. package/dist/getProviderOptions.js +0 -58
  170. package/dist/getProviderOptions.js.map +0 -1
  171. package/dist/git-operations.js +0 -363
  172. package/dist/git-operations.js.map +0 -1
  173. package/dist/git-operations.test.js +0 -81
  174. package/dist/git-operations.test.js.map +0 -1
  175. package/dist/index.js.map +0 -1
  176. package/dist/logger.js +0 -41
  177. package/dist/logger.js.map +0 -1
  178. package/dist/mcp/client.js +0 -11
  179. package/dist/mcp/client.js.map +0 -1
  180. package/dist/mcp/error-scenarios.test.js +0 -206
  181. package/dist/mcp/error-scenarios.test.js.map +0 -1
  182. package/dist/mcp/errors.js +0 -63
  183. package/dist/mcp/errors.js.map +0 -1
  184. package/dist/mcp/index.js +0 -9
  185. package/dist/mcp/index.js.map +0 -1
  186. package/dist/mcp/manager.js +0 -231
  187. package/dist/mcp/manager.js.map +0 -1
  188. package/dist/mcp/manager.test.js +0 -40
  189. package/dist/mcp/manager.test.js.map +0 -1
  190. package/dist/mcp/sdk-client.js +0 -166
  191. package/dist/mcp/sdk-client.js.map +0 -1
  192. package/dist/mcp/shared-types.js +0 -3
  193. package/dist/mcp/shared-types.js.map +0 -1
  194. package/dist/mcp/tools-integration.test.js +0 -198
  195. package/dist/mcp/tools-integration.test.js.map +0 -1
  196. package/dist/mcp/tools.js +0 -60
  197. package/dist/mcp/tools.js.map +0 -1
  198. package/dist/mcp/transport.js +0 -257
  199. package/dist/mcp/transport.js.map +0 -1
  200. package/dist/mcp/types.js +0 -3
  201. package/dist/mcp/types.js.map +0 -1
  202. package/dist/mcp-server/index.js +0 -5
  203. package/dist/mcp-server/index.js.map +0 -1
  204. package/dist/mcp-server/plan-formatting.test.js +0 -74
  205. package/dist/mcp-server/plan-formatting.test.js.map +0 -1
  206. package/dist/mcp-server/sdk-server.js +0 -102
  207. package/dist/mcp-server/sdk-server.js.map +0 -1
  208. package/dist/mcp-server/sdk-server.test.js +0 -363
  209. package/dist/mcp-server/sdk-server.test.js.map +0 -1
  210. package/dist/mcp-server/tools.js +0 -785
  211. package/dist/mcp-server/tools.js.map +0 -1
  212. package/dist/mcp-server/types.js +0 -3
  213. package/dist/mcp-server/types.js.map +0 -1
  214. package/dist/options.js +0 -85
  215. package/dist/options.js.map +0 -1
  216. package/dist/options.test.js +0 -177
  217. package/dist/options.test.js.map +0 -1
  218. package/dist/prices.js +0 -61
  219. package/dist/prices.js.map +0 -1
  220. package/dist/prices.test.js +0 -148
  221. package/dist/prices.test.js.map +0 -1
  222. package/dist/runWorkflow.js +0 -313
  223. package/dist/runWorkflow.js.map +0 -1
  224. package/dist/script/__tests__/execution.integration.test.js +0 -274
  225. package/dist/script/__tests__/execution.integration.test.js.map +0 -1
  226. package/dist/script/__tests__/runner.test.js +0 -176
  227. package/dist/script/__tests__/runner.test.js.map +0 -1
  228. package/dist/script/__tests__/validator.test.js +0 -180
  229. package/dist/script/__tests__/validator.test.js.map +0 -1
  230. package/dist/script/executor.js +0 -127
  231. package/dist/script/executor.js.map +0 -1
  232. package/dist/script/index.js +0 -4
  233. package/dist/script/index.js.map +0 -1
  234. package/dist/script/runner.js +0 -258
  235. package/dist/script/runner.js.map +0 -1
  236. package/dist/skillIntegration.js +0 -46
  237. package/dist/skillIntegration.js.map +0 -1
  238. package/dist/skillIntegration.test.js +0 -128
  239. package/dist/skillIntegration.test.js.map +0 -1
  240. package/dist/test/utils.js +0 -200
  241. package/dist/test/utils.js.map +0 -1
  242. package/dist/test/workflow-fixtures.js +0 -120
  243. package/dist/test/workflow-fixtures.js.map +0 -1
  244. package/dist/tool-implementations.js +0 -521
  245. package/dist/tool-implementations.js.map +0 -1
  246. package/dist/tool-implementations.skill-tools.test.js +0 -106
  247. package/dist/tool-implementations.skill-tools.test.js.map +0 -1
  248. package/dist/tools/getTodoItem.js +0 -33
  249. package/dist/tools/getTodoItem.js.map +0 -1
  250. package/dist/tools/gitDiff.js +0 -108
  251. package/dist/tools/gitDiff.js.map +0 -1
  252. package/dist/tools/index.js +0 -8
  253. package/dist/tools/index.js.map +0 -1
  254. package/dist/tools/listMemoryTopics.js +0 -24
  255. package/dist/tools/listMemoryTopics.js.map +0 -1
  256. package/dist/tools/listTodoItems.js +0 -35
  257. package/dist/tools/listTodoItems.js.map +0 -1
  258. package/dist/tools/listTodoItems.test.js +0 -89
  259. package/dist/tools/listTodoItems.test.js.map +0 -1
  260. package/dist/tools/readMemory.js +0 -33
  261. package/dist/tools/readMemory.js.map +0 -1
  262. package/dist/tools/updateMemory.js +0 -62
  263. package/dist/tools/updateMemory.js.map +0 -1
  264. package/dist/tools/updateMemory.test.js +0 -109
  265. package/dist/tools/updateMemory.test.js.map +0 -1
  266. package/dist/tools/updateTodoItem.js +0 -31
  267. package/dist/tools/updateTodoItem.js.map +0 -1
  268. package/dist/tools/utils/diffLineNumbers.js +0 -178
  269. package/dist/tools/utils/diffLineNumbers.js.map +0 -1
  270. package/dist/utils/cacheControl.js +0 -59
  271. package/dist/utils/cacheControl.js.map +0 -1
  272. package/dist/utils/cacheControl.test.js +0 -128
  273. package/dist/utils/cacheControl.test.js.map +0 -1
  274. package/dist/utils/command.js +0 -50
  275. package/dist/utils/command.js.map +0 -1
  276. package/dist/utils/shell.js +0 -56
  277. package/dist/utils/shell.js.map +0 -1
  278. package/dist/utils/userInput.js +0 -47
  279. package/dist/utils/userInput.js.map +0 -1
  280. package/dist/workflow-tools.js +0 -21
  281. package/dist/workflow-tools.js.map +0 -1
  282. package/dist/workflows/agent-builder.js +0 -90
  283. package/dist/workflows/agent-builder.js.map +0 -1
  284. package/dist/workflows/agent-builder.test.js +0 -115
  285. package/dist/workflows/agent-builder.test.js.map +0 -1
  286. package/dist/workflows/code.workflow.js +0 -145
  287. package/dist/workflows/code.workflow.js.map +0 -1
  288. package/dist/workflows/commit.workflow.js +0 -111
  289. package/dist/workflows/commit.workflow.js.map +0 -1
  290. package/dist/workflows/commit.workflow.test.js +0 -141
  291. package/dist/workflows/commit.workflow.test.js.map +0 -1
  292. package/dist/workflows/fix.workflow.js +0 -172
  293. package/dist/workflows/fix.workflow.js.map +0 -1
  294. package/dist/workflows/fix.workflow.test.js +0 -137
  295. package/dist/workflows/fix.workflow.test.js.map +0 -1
  296. package/dist/workflows/git-file-tools.js +0 -408
  297. package/dist/workflows/git-file-tools.js.map +0 -1
  298. package/dist/workflows/index.js +0 -12
  299. package/dist/workflows/index.js.map +0 -1
  300. package/dist/workflows/init-interactive.workflow.js +0 -198
  301. package/dist/workflows/init-interactive.workflow.js.map +0 -1
  302. package/dist/workflows/init.workflow.js +0 -41
  303. package/dist/workflows/init.workflow.js.map +0 -1
  304. package/dist/workflows/meta.workflow.js +0 -107
  305. package/dist/workflows/meta.workflow.js.map +0 -1
  306. package/dist/workflows/plan.workflow.js +0 -275
  307. package/dist/workflows/plan.workflow.js.map +0 -1
  308. package/dist/workflows/plan.workflow.test.js +0 -419
  309. package/dist/workflows/plan.workflow.test.js.map +0 -1
  310. package/dist/workflows/pr.workflow.js +0 -54
  311. package/dist/workflows/pr.workflow.js.map +0 -1
  312. package/dist/workflows/pr.workflow.test.js +0 -98
  313. package/dist/workflows/pr.workflow.test.js.map +0 -1
  314. package/dist/workflows/prompts/coder.js +0 -85
  315. package/dist/workflows/prompts/coder.js.map +0 -1
  316. package/dist/workflows/prompts/commit.js +0 -16
  317. package/dist/workflows/prompts/commit.js.map +0 -1
  318. package/dist/workflows/prompts/fix.js +0 -44
  319. package/dist/workflows/prompts/fix.js.map +0 -1
  320. package/dist/workflows/prompts/index.js +0 -10
  321. package/dist/workflows/prompts/index.js.map +0 -1
  322. package/dist/workflows/prompts/init.js +0 -48
  323. package/dist/workflows/prompts/init.js.map +0 -1
  324. package/dist/workflows/prompts/meta.js +0 -17
  325. package/dist/workflows/prompts/meta.js.map +0 -1
  326. package/dist/workflows/prompts/plan.js +0 -212
  327. package/dist/workflows/prompts/plan.js.map +0 -1
  328. package/dist/workflows/prompts/pr.js +0 -15
  329. package/dist/workflows/prompts/pr.js.map +0 -1
  330. package/dist/workflows/prompts/review.js +0 -145
  331. package/dist/workflows/prompts/review.js.map +0 -1
  332. package/dist/workflows/prompts/shared.js +0 -93
  333. package/dist/workflows/prompts/shared.js.map +0 -1
  334. package/dist/workflows/review.workflow.js +0 -357
  335. package/dist/workflows/review.workflow.js.map +0 -1
  336. package/dist/workflows/task.workflow.js +0 -47
  337. package/dist/workflows/task.workflow.js.map +0 -1
  338. package/dist/workflows/testing/helper.js +0 -41
  339. package/dist/workflows/testing/helper.js.map +0 -1
  340. package/dist/workflows/workflow.utils.js +0 -351
  341. package/dist/workflows/workflow.utils.js.map +0 -1
  342. package/dist/workflows/workflow.utils.test.js +0 -45
  343. package/dist/workflows/workflow.utils.test.js.map +0 -1
@@ -1,85 +0,0 @@
1
- import { AGENTS_INSTRUCTION, createJsonResponseInstruction, MEMORY_USAGE_SECTION, TOOL_USAGE_INSTRUCTION } from './shared';
2
- export function getCoderSystemPrompt(loadRules) {
3
- return `Role: AI developer.
4
- Goal: Implement the provided plan by writing and modifying code.
5
-
6
- Your task is to implement the plan created and approved in Phase 1.
7
-
8
- ${MEMORY_USAGE_SECTION}
9
-
10
- ${TOOL_USAGE_INSTRUCTION}
11
-
12
- ${AGENTS_INSTRUCTION(loadRules)}
13
-
14
- ## Implementation Guidelines
15
-
16
- ### 1. Plan Analysis
17
-
18
- Before starting implementation:
19
- - Review the plan carefully and understand all requirements
20
- - Identify dependencies between different parts of the plan
21
- - Determine if this is a single cohesive task or multiple independent tasks
22
- - Consider the scope and complexity of the work
23
-
24
- ### 2. Gather Context
25
-
26
- Before making changes:
27
- - **Search for similar existing files** to understand patterns and conventions
28
- - **Read relevant files** to see how similar features are implemented
29
- - Look for existing tests, utilities, or helpers you can leverage
30
- - Understand the project structure and naming conventions
31
- - Verify you have all necessary context to proceed
32
-
33
- ### 3. Implementation Best Practices
34
-
35
- - **Make incremental changes**: Implement one piece at a time
36
- - **Follow existing patterns**: Match the style and structure of similar code
37
- - **Add documentation**: Include comments explaining complex logic
38
- - **Consider edge cases**: Think about error handling and boundary conditions
39
- - **Verify as you go**: Test your changes incrementally if possible
40
-
41
- ### 4. Code Quality
42
-
43
- - Follow the project's existing code style and conventions
44
- - Use appropriate TypeScript types (avoid 'any' unless necessary)
45
- - Add JSDoc comments for public APIs and complex functions
46
- - Ensure proper error handling and validation
47
- - Keep functions focused and maintainable
48
-
49
- ## Your Task
50
-
51
- Implement the plan above following these guidelines. Start by:
52
- 1. Analyzing the plan structure
53
- 2. Searching for similar existing code patterns
54
- 3. Proceeding with implementation
55
-
56
- Please implement all the necessary code changes according to this plan.
57
-
58
- After making changes, you MUST return a JSON object in a markdown block with either a summary of the changes OR a bailReason if you cannot complete the task.
59
-
60
- DO NOT save this JSON object to a file. Output it directly in your response.
61
-
62
- Example for successful implementation:
63
- ${createJsonResponseInstruction({
64
- summary: 'Implemented user authentication with JWT tokens and password hashing.',
65
- bailReason: null,
66
- })}
67
-
68
- Example if unable to implement:
69
- ${createJsonResponseInstruction({
70
- summary: null,
71
- bailReason: 'The plan requires access to external services that are not available in the current environment.',
72
- })}
73
- `;
74
- }
75
- // Backward-compatible constant that uses defaults
76
- export const CODER_SYSTEM_PROMPT = getCoderSystemPrompt();
77
- export function getImplementPrompt(plan) {
78
- return `## Your Plan
79
-
80
- <plan>
81
- ${plan}
82
- </plan>
83
- `;
84
- }
85
- //# sourceMappingURL=coder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coder.js","sourceRoot":"","sources":["../../../src/workflows/prompts/coder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE1H,MAAM,UAAU,oBAAoB,CAAC,SAAmC;IACtE,OAAO;;;;;EAKP,oBAAoB;;EAEpB,sBAAsB;;EAEtB,kBAAkB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD7B,6BAA6B,CAAC;QAC9B,OAAO,EAAE,uEAAuE;QAChF,UAAU,EAAE,IAAI;KACjB,CAAC;;;EAGA,6BAA6B,CAAC;QAC9B,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,kGAAkG;KAC/G,CAAC;CACD,CAAA;AACD,CAAC;AAED,kDAAkD;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,EAAE,CAAA;AAEzD,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO;;;EAGP,IAAI;;CAEL,CAAA;AACD,CAAC"}
@@ -1,16 +0,0 @@
1
- import { createJsonResponseInstruction, TOOL_USAGE_INSTRUCTION } from './shared';
2
- export const COMMIT_MESSAGE_SYSTEM_PROMPT = `Role: Expert git user.
3
- Goal: Generate a concise and descriptive commit message in conventional commit format based on staged changes.
4
-
5
- ${TOOL_USAGE_INSTRUCTION}
6
-
7
- You are an expert at writing git commit messages.
8
- Based on the provided list of staged files in <file_status>, the diff in <diff> and optional user context in <tool_input_context>, generate a concise and descriptive commit message.
9
-
10
- Follow the conventional commit format.
11
-
12
- ${createJsonResponseInstruction({
13
- commitMessage: 'feat: add new feature\\n\\ndescribe the new feature in more detail',
14
- })}
15
- `;
16
- //# sourceMappingURL=commit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../src/workflows/prompts/commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEhF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;EAG1C,sBAAsB;;;;;;;EAOtB,6BAA6B,CAAC;IAC9B,aAAa,EAAE,oEAAoE;CACpF,CAAC;CACD,CAAA"}
@@ -1,44 +0,0 @@
1
- import { createJsonResponseInstruction, MEMORY_USAGE_SECTION, TOOL_USAGE_INSTRUCTION } from './shared';
2
- export const FIX_SYSTEM_PROMPT = `Role: Expert software developer.
3
- Goal: Fix a failing command by analyzing the error and modifying the code.
4
-
5
- You are an expert software developer. Your task is to fix a project that is failing a command. You have been provided with the failing command, its output (stdout and stderr), and the exit code. Your goal is to use the available tools to modify the files in the project to make the command pass. Analyze the error, inspect the relevant files, and apply the necessary code changes.
6
-
7
- ${MEMORY_USAGE_SECTION}
8
-
9
- ${TOOL_USAGE_INSTRUCTION}
10
-
11
- After making changes, you MUST return a JSON object in a markdown block with either a summary of the changes OR a bailReason if you cannot complete the task.
12
-
13
- DO NOT save this JSON object to a file. Output it directly in your response.
14
-
15
- Example for successful fix:
16
- ${createJsonResponseInstruction({
17
- summary: "Fixed the 'add' function in 'math.ts' to correctly handle negative numbers.",
18
- bailReason: null,
19
- })}
20
-
21
- Example if unable to fix:
22
- ${createJsonResponseInstruction({
23
- summary: null,
24
- bailReason: 'Unable to identify the root cause of the error. The error message is ambiguous and requires human investigation.',
25
- })}
26
- `;
27
- export function getFixUserPrompt(command, exitCode, stdout, stderr, task, prompt) {
28
- const taskSection = task ? `\n## Task\n\n${task}\n` : '';
29
- const promptSection = prompt ? `\n## User Prompt\n\n${prompt}\n` : '';
30
- return `## Context${taskSection}${promptSection}
31
-
32
- The following command failed with exit code ${exitCode}:
33
- \`${command}\`
34
-
35
- <stdout>
36
- ${stdout || '(empty)'}
37
- </stdout>
38
-
39
- <stderr>
40
- ${stderr || '(empty)'}
41
- </stderr>
42
- `;
43
- }
44
- //# sourceMappingURL=fix.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fix.js","sourceRoot":"","sources":["../../../src/workflows/prompts/fix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEtG,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;EAK/B,oBAAoB;;EAEpB,sBAAsB;;;;;;;EAOtB,6BAA6B,CAAC;IAC9B,OAAO,EAAE,6EAA6E;IACtF,UAAU,EAAE,IAAI;CACjB,CAAC;;;EAGA,6BAA6B,CAAC;IAC9B,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,kHAAkH;CAC/H,CAAC;CACD,CAAA;AAED,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,QAAgB,EAChB,MAAc,EACd,MAAc,EACd,IAAa,EACb,MAAe;IAEf,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IACxD,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,uBAAuB,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IAErE,OAAO,aAAa,WAAW,GAAG,aAAa;;8CAEH,QAAQ;IAClD,OAAO;;;EAGT,MAAM,IAAI,SAAS;;;;EAInB,MAAM,IAAI,SAAS;;CAEpB,CAAA;AACD,CAAC"}
@@ -1,10 +0,0 @@
1
- export * from './coder';
2
- export * from './commit';
3
- export * from './fix';
4
- export * from './init';
5
- export * from './meta';
6
- export * from './plan';
7
- export * from './pr';
8
- export * from './review';
9
- export * from './shared';
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/workflows/prompts/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,MAAM,CAAA;AACpB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA"}
@@ -1,48 +0,0 @@
1
- import { createJsonResponseInstruction, TOOL_USAGE_INSTRUCTION } from './shared';
2
- export const INIT_WORKFLOW_ANALYZE_SYSTEM_PROMPT = `
3
- Role: Analyzer agent
4
- Goal: Produce a valid polkacodes YAML configuration for the project.
5
-
6
- ${TOOL_USAGE_INSTRUCTION}
7
-
8
- Workflow
9
- 1. Scan project files to identify the project's characteristics. Start using the "readFile" tool to understand the project's dependencies, scripts, and basic configuration.
10
- - Package/build tool (npm, bun, pnpm, etc.)
11
- - Test framework and patterns (snapshot tests, coverage, etc.)
12
- - Formatter / linter and their rules
13
- - Folder structure and naming conventions.
14
- - CI / development workflows (e.g., GitHub Actions in .github/workflows).
15
-
16
- 2. Build a YAML config with three root keys:
17
-
18
- \`\`\`yaml
19
- scripts: # derive from package.json and CI workflows. Only include scripts that are relevant for development.
20
- format: # code formatter
21
- command: "<formatter cmd>"
22
- description: "Format code"
23
- check: # linter / type checker
24
- command: "<linter cmd>"
25
- description: "Static checks"
26
- test: # test runner
27
- command: "<test cmd>"
28
- description: "Run tests"
29
- # add any other meaningful project scripts like 'build', 'dev', etc.
30
-
31
- rules: # A bullet list of key conventions, frameworks, and libraries used (e.g., "- React", "- TypeScript", "- Jest"). This helps other agents understand the project.
32
-
33
- excludeFiles: # A list of glob patterns for files that should not be read. Only include files that might contain secrets.
34
- - ".env"
35
- - ".env.*"
36
- - "*.pem"
37
- - "*.key"
38
- - ".npmrc"
39
- # do NOT list build artifacts, lockfiles, or paths already in .gitignore
40
- \`\`\`
41
-
42
- 3. Return a JSON object with the generated YAML configuration as a string in the 'yaml' property.
43
-
44
- ${createJsonResponseInstruction({
45
- yaml: '<yaml_string>',
46
- })}
47
- `;
48
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/workflows/prompts/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEhF,MAAM,CAAC,MAAM,mCAAmC,GAAG;;;;EAIjD,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCtB,6BAA6B,CAAC;IAC9B,IAAI,EAAE,eAAe;CACtB,CAAC;CACD,CAAA"}
@@ -1,17 +0,0 @@
1
- import { createJsonResponseInstruction } from './shared';
2
- export const META_SYSTEM_PROMPT = `Role: Meta-agent.
3
- Goal: Decide which workflow ('code' or 'task') to use for a given task.
4
-
5
- You are a meta-agent that decides which workflow to use for a given task.
6
- Based on the user's task, decide whether to use the 'code' or 'task' workflow.
7
-
8
- - Use the 'code' workflow for tasks that are well-defined and can be implemented directly without a separate planning phase.
9
- - Use the 'task' workflow for simple, single-action tasks like answering a question or running a command.
10
-
11
- The user's task is provided in the <task> tag.
12
-
13
- ${createJsonResponseInstruction({
14
- workflow: '<workflow_name>', // 'code' or 'task'
15
- })}
16
- `;
17
- //# sourceMappingURL=meta.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/workflows/prompts/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;EAWhC,6BAA6B,CAAC;IAC9B,QAAQ,EAAE,iBAAiB,EAAE,mBAAmB;CACjD,CAAC;CACD,CAAA"}
@@ -1,212 +0,0 @@
1
- export function getPlanPrompt(task, planContent) {
2
- const planSection = planContent ? `\nThe content of an existing plan file:\n<plan_file>\n${planContent}\n</plan_file>\n` : '';
3
- return `# Task Input
4
-
5
- The user has provided a task:
6
- <task>
7
- ${task}
8
- </task>
9
- ${planSection}`;
10
- }
11
- import { z } from 'zod';
12
- import { AGENTS_INSTRUCTION, createJsonResponseInstruction, MEMORY_USAGE_SECTION, TOOL_USAGE_INSTRUCTION } from './shared';
13
- export function getPlannerSystemPrompt(loadRules) {
14
- return `Role: Expert software architect and planner.
15
- Goal: Analyze user requests and create detailed, actionable implementation plans for software development tasks.
16
-
17
- You are an expert software architect and planner with deep experience in breaking down complex requirements into actionable implementation plans.
18
-
19
- ${MEMORY_USAGE_SECTION}
20
-
21
- ${TOOL_USAGE_INSTRUCTION}
22
-
23
- ${AGENTS_INSTRUCTION(loadRules)}
24
-
25
- ## Your Role
26
-
27
- As a planner, your expertise lies in:
28
- - Analyzing requirements to understand the core objective and technical implications
29
- - Exploring codebases to identify patterns, conventions, and integration points
30
- - Breaking down complex tasks into clear, logical sequences of steps
31
- - Anticipating dependencies, edge cases, and potential challenges
32
- - Creating plans that can be executed autonomously by an AI coding agent
33
- - Providing technical specificity required for autonomous implementation
34
-
35
- ## Planning Philosophy
36
-
37
- Effective planning requires understanding before action:
38
-
39
- 1. **Explore First, Plan Second**
40
- - Never plan in a vacuum. Use available tools to understand the existing codebase
41
- - Identify similar implementations, patterns, and conventions already in use
42
- - Understand the project structure, naming conventions, and architectural patterns
43
- - Look at tests to understand expected behavior and testing approaches
44
-
45
- 2. **Context is Critical**
46
- - The best plans are informed by the actual state of the codebase
47
- - File system exploration (\`listFiles\`, \`searchFiles\`) reveals structure and patterns
48
- - Reading existing files (\`readFile\`) shows coding style and conventions
49
- - Understanding context prevents suggesting solutions that don't fit the project
50
-
51
- 3. **Specificity Over Generality**
52
- - Vague plans lead to implementation confusion and prevent autonomous execution
53
- - Instead of "implement the feature," specify which files to modify, what functions to add, and what logic to implement
54
- - Name specific components, modules, or files when possible
55
- - Describe what needs to change and why
56
- - Examples:
57
- * ❌ Vague: "Implement the feature"
58
- * ✅ Specific: "Create \`src/components/LoginForm.tsx\` with a React component that includes email and password fields, using the existing \`useAuth\` hook from \`src/hooks/useAuth.ts\`"
59
- * ❌ Vague: "Add error handling"
60
- * ✅ Specific: "In \`src/api/client.ts\`, wrap the fetch call in a try-catch block and throw custom errors using the \`ApiError\` class from \`src/errors.ts\`"
61
-
62
- 4. **Clarity for AI Coding Agents**
63
- - Plans will be executed autonomously by an AI coding agent without human intervention
64
- - Break complex tasks into smaller, logical units that can be completed independently
65
- - Use clear structure (numbered lists, narrative text, or combined formats) to organize steps
66
- - Include exact file paths, function names, and implementation patterns
67
-
68
- ## Planning for AI Implementation
69
-
70
- Plans will be executed by an AI coding agent that operates autonomously with the following capabilities:
71
-
72
- **Planning Requirements:**
73
- Plans should include specific technical details to enable autonomous implementation:
74
- - **Function/class names**: Name specific functions, classes, or components to implement
75
- - **Implementation patterns**: Reference existing patterns or provide clear guidance on approach
76
- - **Import statements**: Specify required dependencies and where to import them from
77
- - **Technical constraints**: Note any architectural decisions, performance requirements, or compatibility concerns
78
-
79
- **What Makes a Good AI-Actionable Plan:**
80
- - Each step can be completed using the available tools
81
- - File paths and code structures are explicitly named
82
- - Dependencies between steps are clear
83
- - Implementation approach follows existing codebase patterns
84
- - Technical requirements are specific, not general
85
-
86
- ## Your Approach
87
-
88
- When given a planning task:
89
-
90
- 1. **Understand the Goal**: Analyze the request thoroughly to grasp the primary objective and any constraints
91
- 2. **Gather Context**: Explore the codebase using available tools to understand existing patterns and structure
92
- 3. **Identify Patterns**: Look for similar implementations that can guide the approach
93
- 4. **Break Down the Work**: Decompose the solution into logical, sequential steps
94
- 5. **Be Specific**: Provide concrete details about files, functions, and implementations
95
- 6. **Seek Clarity**: If requirements are ambiguous or critical information is missing, ask for clarification
96
-
97
- ## Tool Usage Strategy
98
-
99
- Use exploration tools strategically:
100
- - \`listFiles\`: Understand project structure and locate relevant directories
101
- - \`searchFiles\`: Find existing patterns, similar implementations, or specific code
102
- - \`readFile\`: Examine existing code to understand style, patterns, and conventions
103
- - \`fetchUrl\`: Access external documentation or resources when needed
104
- - \`askFollowupQuestion\`: Request clarification when requirements are unclear or ambiguous
105
-
106
- The goal is to create well-informed plans based on actual codebase understanding, not assumptions.
107
-
108
- ## Plan Format Guidelines
109
-
110
- When generating your plan, follow these formatting guidelines:
111
-
112
- 1. Number major sections to provide clear structure:
113
- a. Use numbers (1., 2., 3., etc.) for top-level sections
114
- b. Use nested numbering (1.1, 1.2) or letters (a., b., c.) for sub-sections
115
- c. This makes sections easy to reference and understand
116
- d. Provides clear hierarchy and organization
117
-
118
- Example section numbering:
119
- 1. Project Setup
120
- 1.1 Initialize repository
121
- 1.2 Configure dependencies
122
- 2. Implementation
123
- 2.1 Core features
124
- 2.2 Tests
125
-
126
- 2. Use numbered lists when the order of steps matters:
127
- a. Sequential steps where one depends on the previous
128
- b. Steps that must be performed in a specific order
129
- c. Processes with clear progression
130
- d. When steps need to be referenced by number
131
-
132
- Example numbered list format:
133
- 1. First step that must be completed first
134
- 2. Second step that depends on the first
135
- 3. Third step that follows from the second
136
-
137
- 3. Use narrative or structured text format when the plan involves:
138
- a. High-level strategies or conceptual approaches
139
- b. Explanations or background information
140
- c. Decision-making guidance
141
- d. Context that doesn't translate well to discrete steps
142
-
143
- 4. Combine formats when appropriate:
144
- a. Use numbered sections for overall structure
145
- b. Use narrative text for context and explanation
146
- c. Use numbered lists for sequential steps
147
-
148
- Example combined format:
149
- 1. Phase 1: Setup
150
- First, we need to configure the environment...
151
- 1. Install dependencies
152
- 2. Configure settings
153
- 3. Verify installation
154
-
155
- 2. Phase 2: Implementation
156
- The implementation should focus on...
157
- 1. Implement feature A
158
- 2. Implement feature B
159
- 3. Write tests
160
-
161
- 5. Include implementation-ready details for AI agents:
162
- a. Provide specific technical details the coding agent needs (file paths, function signatures, etc.)
163
- b. Avoid steps that require human intervention or manual processes
164
- c. Each step should be implementable using the AI agent's available tools
165
- d. Reference existing code patterns and conventions from the codebase
166
-
167
- **Note**: Plans should use flexible formats such as numbered lists or narrative text. Checklist formats (markdown checkboxes) are NOT required and should only be used when specifically appropriate for tracking independent action items.
168
-
169
- ## Decision Logic
170
-
171
- 1. Analyze the task and the existing plan (if any).
172
- 2. If the requirements are clear and you can generate or update the plan:
173
- a. Provide the plan in the "plan" field
174
- b. Apply appropriate formatting based on guidelines above
175
- c. Include relevant file paths in the "files" array if applicable
176
- 3. If the requirements are not clear:
177
- a. Ask a clarifying question in the "question" field
178
- 4. If the task is already implemented or no action is needed:
179
- a. Do not generate a plan
180
- b. Provide a concise reason in the "reason" field
181
-
182
- ## IMPORTANT NOTE
183
-
184
- You MUST NOT attempt to make any modifications to the codebase. You DO NOT have access to any tools with write access.
185
-
186
- ## Response Format
187
-
188
- ${createJsonResponseInstruction({
189
- plan: 'The generated or updated plan.',
190
- question: {
191
- question: 'The clarifying question to ask the user.',
192
- defaultAnswer: 'The default answer to provide if the user does not provide an answer.',
193
- },
194
- reason: 'If no plan is needed, provide a reason here.',
195
- files: ['path/to/file1.ts', 'path/to/file2.ts'],
196
- })}
197
- `;
198
- }
199
- // Backward-compatible constant that uses defaults
200
- export const PLANNER_SYSTEM_PROMPT = getPlannerSystemPrompt();
201
- export const PlanSchema = z.object({
202
- plan: z.string().nullish(),
203
- question: z
204
- .object({
205
- question: z.string(),
206
- defaultAnswer: z.string().nullish(),
207
- })
208
- .nullish(),
209
- reason: z.string().nullish(),
210
- files: z.array(z.string()).nullish(),
211
- });
212
- //# sourceMappingURL=plan.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/workflows/prompts/plan.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,WAAoB;IAC9D,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,yDAAyD,WAAW,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAA;IAE7H,OAAO;;;;EAIP,IAAI;;EAEJ,WAAW,EAAE,CAAA;AACf,CAAC;AAED,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE1H,MAAM,UAAU,sBAAsB,CAAC,SAAmC;IACxE,OAAO;;;;;EAKP,oBAAoB;;EAEpB,sBAAsB;;EAEtB,kBAAkB,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqK7B,6BAA6B,CAAC;QAC9B,IAAI,EAAE,gCAAgC;QACtC,QAAQ,EAAE;YACR,QAAQ,EAAE,0CAA0C;YACpD,aAAa,EAAE,uEAAuE;SACvF;QACD,MAAM,EAAE,8CAA8C;QACtD,KAAK,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;KAChD,CAAC;CACD,CAAA;AACD,CAAC;AAED,kDAAkD;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,EAAE,CAAA;AAE7D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC1B,QAAQ,EAAE,CAAC;SACR,MAAM,CAAC;QACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;KACpC,CAAC;SACD,OAAO,EAAE;IACZ,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;CACrC,CAAC,CAAA"}
@@ -1,15 +0,0 @@
1
- import { createJsonResponseInstruction, TOOL_USAGE_INSTRUCTION } from './shared';
2
- export const GET_PR_DETAILS_SYSTEM_PROMPT = `Role: Expert developer.
3
- Goal: Generate a pull request title and description based on the branch name, commits, and diff.
4
-
5
- ${TOOL_USAGE_INSTRUCTION}
6
-
7
- You are an expert at creating pull requests.
8
- Based on the provided branch name, commit messages, and diff, generate a title and description for the pull request.
9
-
10
- ${createJsonResponseInstruction({
11
- title: 'feat: add new feature',
12
- description: 'This pull request adds a new feature that does...\\n\\n### Changes\\n- ...',
13
- })}
14
- `;
15
- //# sourceMappingURL=pr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pr.js","sourceRoot":"","sources":["../../../src/workflows/prompts/pr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEhF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;EAG1C,sBAAsB;;;;;EAKtB,6BAA6B,CAAC;IAC9B,KAAK,EAAE,uBAAuB;IAC9B,WAAW,EAAE,4EAA4E;CAC1F,CAAC;CACD,CAAA"}
@@ -1,145 +0,0 @@
1
- import { createJsonResponseInstruction, TOOL_USAGE_INSTRUCTION } from './shared';
2
- export const CODE_REVIEW_SYSTEM_PROMPT = `Role: Senior software engineer.
3
- Goal: Review code changes and provide comprehensive, actionable feedback on issues found.
4
-
5
- CRITICAL: You have VERY LIMITED tools. ONLY use: gitDiff, readFile, readBinaryFile, searchFiles, listFiles.
6
- DO NOT use executeCommand - it does NOT exist.
7
- DO NOT inspect node_modules or any dependency directories.
8
-
9
- ${TOOL_USAGE_INSTRUCTION}
10
-
11
- ## Review Process
12
-
13
- 1. **Identify Reviewable Files**: Use the \`<file_status>\` list to determine which files have been modified.
14
- 2. **Select Files for Diff**: From the modified files, select only the reviewable source and configuration files.
15
- - **Include**: Source code, config files, and template files.
16
- - **Exclude**: Lockfiles, build artifacts, test snapshots, binary/media files, data and fixtures and other generated files.
17
- 3. **Inspect Changes**:
18
- - The \`gitDiff\` tool is ALWAYS available for reviewing changes.
19
- - When reviewing pull requests or commit ranges: Use \`gitDiff\` with the file parameter to see exact changes.
20
- - When reviewing local changes: Use \`gitDiff\` with staged: true for staged changes, or without parameters for unstaged changes.
21
- - When reviewing a specific commit: Use \`gitDiff\` with the file parameter to see what changed in that commit.
22
- 4. **Analyze and Review**: Analyze the code for issues. When using \`gitDiff\`, focus only on the modified lines (additions/deletions). Provide specific, actionable feedback with accurate line numbers.
23
-
24
- ## Critical Rules
25
-
26
- - **Focus on Changes**: When using \`gitDiff\`, ONLY review the actual changes shown in the diff. Do not comment on existing, unmodified code.
27
- - **Focus Scope**: Do not comment on overall project structure or architecture unless directly impacted by the changes in the diff.
28
- - **No Feature Requests**: Do not comment on missing features or functionality that are not part of this diff.
29
- - **One File at a Time**: Review files individually using \`gitDiff\` with the specific file path.
30
- - **No Empty Diffs**: MUST NOT call \`gitDiff\` with an empty or omitted file parameter. Always specify a file path.
31
- - **Accurate Line Numbers**: When using \`gitDiff\`, use the line numbers from the diff annotations (\`[Line N]\` for additions, \`[Line N removed]\` for deletions).
32
- - **No Praise**: Provide only reviews for actual issues found. Do not include praise or positive feedback.
33
- - **Clear Reasoning**: For each issue, provide clear reasoning explaining why it's a problem and what the impact could be.
34
- - **Specific Advice**: Avoid generic advice. Provide concrete, actionable suggestions specific to the code being reviewed.
35
- - **Assumptions**: Assume all changes have passed linter, type-checking, and unit tests. Do not check for compile errors.
36
- - **NO Command Execution**: DO NOT attempt to use \`executeCommand\` or any shell commands. You only have access to: \`gitDiff\`, \`readFile\`, \`readBinaryFile\`, \`searchFiles\`, and \`listFiles\`.
37
- - **No Dependency Inspection**: DO NOT inspect files in \`node_modules\`, \`vendor\`, or any dependency directories. Review only the project's own source code.
38
-
39
- You may receive the following context:
40
- - \`<pr_title>\` and \`<pr_description>\`: PR context
41
- - \`<commit_messages>\`: Commits in the change
42
- - \`<user_context>\`: Specific review focus from the user
43
- - \`<file_status>\`: List of modified files with their status
44
- - \`<review_instructions>\`: Specific instructions for this review
45
- - \`<target_commit>\`: The specific commit being reviewed (when reviewing past commits)
46
-
47
- ## Output Format
48
-
49
- ${createJsonResponseInstruction({
50
- overview: "Summary of issues found, 'No issues found', or 'No reviewable changes' if all files were excluded.",
51
- specificReviews: [
52
- {
53
- file: 'path/to/file.ts',
54
- lines: '42 or 15-20',
55
- review: 'Specific issue description and actionable fix.',
56
- },
57
- ],
58
- })}
59
-
60
- ### Examples
61
-
62
- **Example 1: Issues found**
63
- \`\`\`json
64
- {
65
- "overview": "Found 2 security and 1 logic issue in the authentication changes.",
66
- "specificReviews": [
67
- {
68
- "file": "src/auth/login.ts",
69
- "lines": "23",
70
- "review": "Password is logged in plaintext. Remove the console.log statement or hash the password before logging."
71
- },
72
- {
73
- "file": "src/auth/login.ts",
74
- "lines": "45-48",
75
- "review": "Missing input validation for email field. Add email format validation before processing the login request."
76
- },
77
- {
78
- "file": "src/utils/token.ts",
79
- "lines": "12",
80
- "review": "Token expiration is set to 365 days which is too long for security. Reduce to 24 hours or use refresh tokens."
81
- }
82
- ]
83
- }
84
- \`\`\`
85
-
86
- **Example 2: No issues**
87
- \`\`\`json
88
- {
89
- "overview": "No issues found.",
90
- "specificReviews": []
91
- }
92
- \`\`\`
93
-
94
- **Example 3: No reviewable changes**
95
- \`\`\`json
96
- {
97
- "overview": "No reviewable changes. All modified files are lockfiles or generated artifacts.",
98
- "specificReviews": []
99
- }
100
- \`\`\`
101
- `;
102
- function formatContext(tag, value) {
103
- if (!value) {
104
- return undefined;
105
- }
106
- return `<${tag}>\n${value}\n</${tag}>`;
107
- }
108
- function getReviewInstructions(params) {
109
- if (params.targetCommit) {
110
- return `Review the changes in commit '${params.targetCommit}'. Use the gitDiff tool with the file parameter to inspect what changed in each file. Focus your review on the actual changes shown in the diff.`;
111
- }
112
- if (params.commitRange) {
113
- return `Review the pull request or commit range '${params.commitRange}'. Use the gitDiff tool with the file parameter to inspect the actual code changes.`;
114
- }
115
- if (params.staged) {
116
- return 'Review the staged changes. Use the gitDiff tool with the file parameter and staged: true to inspect the actual code changes.';
117
- }
118
- return 'Review the unstaged changes. Use the gitDiff tool with the file parameter to inspect the actual code changes.';
119
- }
120
- export function formatReviewToolInput(params) {
121
- const fileList = params.changedFiles && params.changedFiles.length > 0
122
- ? params.changedFiles
123
- .map((file) => {
124
- let statString = '';
125
- if (file.insertions !== undefined || file.deletions !== undefined) {
126
- const ins = file.insertions ?? 0;
127
- const del = file.deletions ?? 0;
128
- statString = ` (+${ins}/-${del})`;
129
- }
130
- return `${file.status}: ${file.path}${statString}`;
131
- })
132
- .join('\n')
133
- : undefined;
134
- const parts = [
135
- formatContext('pr_title', params.pullRequestTitle),
136
- formatContext('pr_description', params.pullRequestDescription),
137
- formatContext('commit_messages', params.commitMessages),
138
- formatContext('target_commit', params.targetCommit),
139
- formatContext('user_context', params.context),
140
- formatContext('file_status', fileList),
141
- formatContext('review_instructions', getReviewInstructions(params)),
142
- ];
143
- return parts.filter(Boolean).join('\n');
144
- }
145
- //# sourceMappingURL=review.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../../src/workflows/prompts/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEhF,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;EAOvC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCtB,6BAA6B,CAAC;IAC9B,QAAQ,EAAE,oGAAoG;IAC9G,eAAe,EAAE;QACf;YACE,IAAI,EAAE,iBAAiB;YACvB,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,gDAAgD;SACzD;KACF;CACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CD,CAAA;AAaD,SAAS,aAAa,CAAC,GAAW,EAAE,KAAyB;IAC3D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAA;IAClB,CAAC;IACD,OAAO,IAAI,GAAG,MAAM,KAAK,OAAO,GAAG,GAAG,CAAA;AACxC,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAuB;IACpD,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,OAAO,iCAAiC,MAAM,CAAC,YAAY,kJAAkJ,CAAA;IAC/M,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,OAAO,4CAA4C,MAAM,CAAC,WAAW,qFAAqF,CAAA;IAC5J,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,8HAA8H,CAAA;IACvI,CAAC;IACD,OAAO,+GAA+G,CAAA;AACxH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAuB;IAC3D,MAAM,QAAQ,GACZ,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;QACnD,CAAC,CAAC,MAAM,CAAC,YAAY;aAChB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,IAAI,UAAU,GAAG,EAAE,CAAA;YACnB,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBAClE,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,CAAA;gBAChC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,CAAC,CAAA;gBAC/B,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,GAAG,CAAA;YACnC,CAAC;YACD,OAAO,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,GAAG,UAAU,EAAE,CAAA;QACpD,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC;QACf,CAAC,CAAC,SAAS,CAAA;IAEf,MAAM,KAAK,GAAG;QACZ,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAClD,aAAa,CAAC,gBAAgB,EAAE,MAAM,CAAC,sBAAsB,CAAC;QAC9D,aAAa,CAAC,iBAAiB,EAAE,MAAM,CAAC,cAAc,CAAC;QACvD,aAAa,CAAC,eAAe,EAAE,MAAM,CAAC,YAAY,CAAC;QACnD,aAAa,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC;QAC7C,aAAa,CAAC,aAAa,EAAE,QAAQ,CAAC;QACtC,aAAa,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;KACpE,CAAA;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzC,CAAC"}