vibeman 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/dist/api.js +43 -0
  2. package/dist/index.js +227 -104
  3. package/dist/ui/assets/index-C_kQPI1m.js +9 -0
  4. package/dist/ui/index.html +12 -0
  5. package/package.json +13 -46
  6. package/README.md +0 -12
  7. package/dist/runtime/api/.tsbuildinfo +0 -1
  8. package/dist/runtime/api/agent/agent-service.d.ts +0 -229
  9. package/dist/runtime/api/agent/agent-service.js +0 -963
  10. package/dist/runtime/api/agent/ai-providers/amp-cli-provider.d.ts +0 -38
  11. package/dist/runtime/api/agent/ai-providers/amp-cli-provider.js +0 -268
  12. package/dist/runtime/api/agent/ai-providers/claude-code-adapter.d.ts +0 -61
  13. package/dist/runtime/api/agent/ai-providers/claude-code-adapter.js +0 -362
  14. package/dist/runtime/api/agent/ai-providers/codex-cli-provider.d.ts +0 -36
  15. package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +0 -375
  16. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.d.ts +0 -24
  17. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.js +0 -291
  18. package/dist/runtime/api/agent/ai-providers/index.d.ts +0 -9
  19. package/dist/runtime/api/agent/ai-providers/index.js +0 -9
  20. package/dist/runtime/api/agent/ai-providers/types.d.ts +0 -185
  21. package/dist/runtime/api/agent/ai-providers/types.js +0 -5
  22. package/dist/runtime/api/agent/amp-cli-provider.test.d.ts +0 -1
  23. package/dist/runtime/api/agent/amp-cli-provider.test.js +0 -99
  24. package/dist/runtime/api/agent/codex-cli-provider.test.d.ts +0 -1
  25. package/dist/runtime/api/agent/codex-cli-provider.test.js +0 -172
  26. package/dist/runtime/api/agent/core-agent-service.d.ts +0 -119
  27. package/dist/runtime/api/agent/core-agent-service.js +0 -267
  28. package/dist/runtime/api/agent/parsers.d.ts +0 -16
  29. package/dist/runtime/api/agent/parsers.js +0 -308
  30. package/dist/runtime/api/agent/prompt-service.d.ts +0 -30
  31. package/dist/runtime/api/agent/prompt-service.js +0 -452
  32. package/dist/runtime/api/agent/prompt-service.test.d.ts +0 -1
  33. package/dist/runtime/api/agent/prompt-service.test.js +0 -265
  34. package/dist/runtime/api/agent/routing-policy.d.ts +0 -171
  35. package/dist/runtime/api/agent/routing-policy.js +0 -196
  36. package/dist/runtime/api/agent/routing-policy.test.d.ts +0 -1
  37. package/dist/runtime/api/agent/routing-policy.test.js +0 -63
  38. package/dist/runtime/api/api/router-helpers.d.ts +0 -32
  39. package/dist/runtime/api/api/router-helpers.js +0 -31
  40. package/dist/runtime/api/api/routers/ai.d.ts +0 -200
  41. package/dist/runtime/api/api/routers/ai.js +0 -396
  42. package/dist/runtime/api/api/routers/executions.d.ts +0 -93
  43. package/dist/runtime/api/api/routers/executions.js +0 -94
  44. package/dist/runtime/api/api/routers/git.d.ts +0 -45
  45. package/dist/runtime/api/api/routers/git.js +0 -35
  46. package/dist/runtime/api/api/routers/provider-config.d.ts +0 -199
  47. package/dist/runtime/api/api/routers/provider-config.js +0 -252
  48. package/dist/runtime/api/api/routers/settings.d.ts +0 -158
  49. package/dist/runtime/api/api/routers/settings.js +0 -129
  50. package/dist/runtime/api/api/routers/tasks.d.ts +0 -141
  51. package/dist/runtime/api/api/routers/tasks.js +0 -238
  52. package/dist/runtime/api/api/routers/workflows.d.ts +0 -275
  53. package/dist/runtime/api/api/routers/workflows.js +0 -311
  54. package/dist/runtime/api/api/routers/worktrees.d.ts +0 -101
  55. package/dist/runtime/api/api/routers/worktrees.js +0 -80
  56. package/dist/runtime/api/api/trpc.d.ts +0 -118
  57. package/dist/runtime/api/api/trpc.js +0 -34
  58. package/dist/runtime/api/index.d.ts +0 -9
  59. package/dist/runtime/api/index.js +0 -117
  60. package/dist/runtime/api/lib/id-generator.d.ts +0 -70
  61. package/dist/runtime/api/lib/id-generator.js +0 -123
  62. package/dist/runtime/api/lib/local-config.d.ts +0 -335
  63. package/dist/runtime/api/lib/local-config.js +0 -304
  64. package/dist/runtime/api/lib/logger.d.ts +0 -11
  65. package/dist/runtime/api/lib/logger.js +0 -188
  66. package/dist/runtime/api/lib/provider-detection.d.ts +0 -61
  67. package/dist/runtime/api/lib/provider-detection.js +0 -326
  68. package/dist/runtime/api/lib/server/agent-service-singleton.d.ts +0 -6
  69. package/dist/runtime/api/lib/server/agent-service-singleton.js +0 -27
  70. package/dist/runtime/api/lib/server/bootstrap.d.ts +0 -38
  71. package/dist/runtime/api/lib/server/bootstrap.js +0 -197
  72. package/dist/runtime/api/lib/server/git-service-singleton.d.ts +0 -6
  73. package/dist/runtime/api/lib/server/git-service-singleton.js +0 -47
  74. package/dist/runtime/api/lib/server/project-root.d.ts +0 -2
  75. package/dist/runtime/api/lib/server/project-root.js +0 -61
  76. package/dist/runtime/api/lib/server/task-service-singleton.d.ts +0 -7
  77. package/dist/runtime/api/lib/server/task-service-singleton.js +0 -58
  78. package/dist/runtime/api/lib/server/vibeman-info.d.ts +0 -5
  79. package/dist/runtime/api/lib/server/vibeman-info.js +0 -85
  80. package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.d.ts +0 -7
  81. package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.js +0 -57
  82. package/dist/runtime/api/lib/trpc/server.d.ts +0 -965
  83. package/dist/runtime/api/lib/trpc/server.js +0 -11
  84. package/dist/runtime/api/lib/trpc/ws-server.d.ts +0 -8
  85. package/dist/runtime/api/lib/trpc/ws-server.js +0 -33
  86. package/dist/runtime/api/persistence/database-service.d.ts +0 -14
  87. package/dist/runtime/api/persistence/database-service.js +0 -74
  88. package/dist/runtime/api/persistence/execution-log-persistence.d.ts +0 -90
  89. package/dist/runtime/api/persistence/execution-log-persistence.js +0 -426
  90. package/dist/runtime/api/persistence/execution-log-persistence.test.d.ts +0 -1
  91. package/dist/runtime/api/persistence/execution-log-persistence.test.js +0 -170
  92. package/dist/runtime/api/router.d.ts +0 -968
  93. package/dist/runtime/api/router.js +0 -34
  94. package/dist/runtime/api/settings-service.d.ts +0 -110
  95. package/dist/runtime/api/settings-service.js +0 -678
  96. package/dist/runtime/api/tasks/file-watcher.d.ts +0 -23
  97. package/dist/runtime/api/tasks/file-watcher.js +0 -88
  98. package/dist/runtime/api/tasks/task-file-parser.d.ts +0 -14
  99. package/dist/runtime/api/tasks/task-file-parser.js +0 -180
  100. package/dist/runtime/api/tasks/task-service.d.ts +0 -36
  101. package/dist/runtime/api/tasks/task-service.js +0 -173
  102. package/dist/runtime/api/tasks/task-updater.d.ts +0 -62
  103. package/dist/runtime/api/tasks/task-updater.js +0 -260
  104. package/dist/runtime/api/tasks/task-updater.test.d.ts +0 -1
  105. package/dist/runtime/api/tasks/task-updater.test.js +0 -303
  106. package/dist/runtime/api/types/index.d.ts +0 -186
  107. package/dist/runtime/api/types/index.js +0 -1
  108. package/dist/runtime/api/types/settings.d.ts +0 -105
  109. package/dist/runtime/api/types/settings.js +0 -2
  110. package/dist/runtime/api/types.d.ts +0 -2
  111. package/dist/runtime/api/types.js +0 -1
  112. package/dist/runtime/api/utils/env.d.ts +0 -6
  113. package/dist/runtime/api/utils/env.js +0 -12
  114. package/dist/runtime/api/utils/stripNextEnv.d.ts +0 -7
  115. package/dist/runtime/api/utils/stripNextEnv.js +0 -22
  116. package/dist/runtime/api/utils/title-slug.d.ts +0 -6
  117. package/dist/runtime/api/utils/title-slug.js +0 -77
  118. package/dist/runtime/api/utils/url.d.ts +0 -2
  119. package/dist/runtime/api/utils/url.js +0 -19
  120. package/dist/runtime/api/vcs/git-history-service.d.ts +0 -57
  121. package/dist/runtime/api/vcs/git-history-service.js +0 -228
  122. package/dist/runtime/api/vcs/git-service.d.ts +0 -136
  123. package/dist/runtime/api/vcs/git-service.js +0 -307
  124. package/dist/runtime/api/vcs/worktree-service.d.ts +0 -93
  125. package/dist/runtime/api/vcs/worktree-service.js +0 -518
  126. package/dist/runtime/api/vcs/worktree-service.test.d.ts +0 -1
  127. package/dist/runtime/api/vcs/worktree-service.test.js +0 -20
  128. package/dist/runtime/api/workflows/quality-pipeline.d.ts +0 -58
  129. package/dist/runtime/api/workflows/quality-pipeline.js +0 -401
  130. package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +0 -406
  131. package/dist/runtime/api/workflows/vibing-orchestrator.js +0 -2462
  132. package/dist/runtime/api/workflows/workflow-effects.d.ts +0 -45
  133. package/dist/runtime/api/workflows/workflow-effects.js +0 -49
  134. package/dist/runtime/api/workflows/workflow-reconciler.d.ts +0 -65
  135. package/dist/runtime/api/workflows/workflow-reconciler.js +0 -226
  136. package/dist/runtime/api/workflows/workflow-reducer.d.ts +0 -26
  137. package/dist/runtime/api/workflows/workflow-reducer.js +0 -288
  138. package/dist/runtime/api/workflows/workflow-reducer.test.d.ts +0 -1
  139. package/dist/runtime/api/workflows/workflow-reducer.test.js +0 -247
  140. package/dist/runtime/api/workflows/workflow-schema.d.ts +0 -546
  141. package/dist/runtime/api/workflows/workflow-schema.js +0 -256
  142. package/dist/runtime/web/.next/BUILD_ID +0 -1
  143. package/dist/runtime/web/.next/app-build-manifest.json +0 -66
  144. package/dist/runtime/web/.next/app-path-routes-manifest.json +0 -8
  145. package/dist/runtime/web/.next/build-manifest.json +0 -33
  146. package/dist/runtime/web/.next/package.json +0 -1
  147. package/dist/runtime/web/.next/prerender-manifest.json +0 -61
  148. package/dist/runtime/web/.next/react-loadable-manifest.json +0 -8
  149. package/dist/runtime/web/.next/required-server-files.json +0 -334
  150. package/dist/runtime/web/.next/routes-manifest.json +0 -70
  151. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +0 -1
  152. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +0 -1
  153. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +0 -1
  154. package/dist/runtime/web/.next/server/app/_not-found/page.js +0 -2
  155. package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +0 -1
  156. package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
  157. package/dist/runtime/web/.next/server/app/_not-found.html +0 -7
  158. package/dist/runtime/web/.next/server/app/_not-found.meta +0 -8
  159. package/dist/runtime/web/.next/server/app/_not-found.rsc +0 -22
  160. package/dist/runtime/web/.next/server/app/api/health/route.js +0 -1
  161. package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +0 -1
  162. package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +0 -1
  163. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +0 -1
  164. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +0 -1
  165. package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +0 -1
  166. package/dist/runtime/web/.next/server/app/api/upload/route.js +0 -1
  167. package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +0 -1
  168. package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +0 -1
  169. package/dist/runtime/web/.next/server/app/index.html +0 -7
  170. package/dist/runtime/web/.next/server/app/index.meta +0 -7
  171. package/dist/runtime/web/.next/server/app/index.rsc +0 -27
  172. package/dist/runtime/web/.next/server/app/page.js +0 -112
  173. package/dist/runtime/web/.next/server/app/page.js.nft.json +0 -1
  174. package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +0 -1
  175. package/dist/runtime/web/.next/server/app-paths-manifest.json +0 -8
  176. package/dist/runtime/web/.next/server/chunks/210.js +0 -1
  177. package/dist/runtime/web/.next/server/chunks/291.js +0 -18
  178. package/dist/runtime/web/.next/server/chunks/552.js +0 -22
  179. package/dist/runtime/web/.next/server/chunks/780.js +0 -1
  180. package/dist/runtime/web/.next/server/chunks/905.js +0 -6
  181. package/dist/runtime/web/.next/server/chunks/98.js +0 -1
  182. package/dist/runtime/web/.next/server/functions-config-manifest.json +0 -4
  183. package/dist/runtime/web/.next/server/middleware-build-manifest.js +0 -1
  184. package/dist/runtime/web/.next/server/middleware-manifest.json +0 -6
  185. package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +0 -1
  186. package/dist/runtime/web/.next/server/next-font-manifest.js +0 -1
  187. package/dist/runtime/web/.next/server/next-font-manifest.json +0 -1
  188. package/dist/runtime/web/.next/server/pages/404.html +0 -7
  189. package/dist/runtime/web/.next/server/pages/500.html +0 -1
  190. package/dist/runtime/web/.next/server/pages/_app.js +0 -1
  191. package/dist/runtime/web/.next/server/pages/_app.js.nft.json +0 -1
  192. package/dist/runtime/web/.next/server/pages/_document.js +0 -1
  193. package/dist/runtime/web/.next/server/pages/_document.js.nft.json +0 -1
  194. package/dist/runtime/web/.next/server/pages/_error.js +0 -19
  195. package/dist/runtime/web/.next/server/pages/_error.js.nft.json +0 -1
  196. package/dist/runtime/web/.next/server/pages-manifest.json +0 -6
  197. package/dist/runtime/web/.next/server/server-reference-manifest.js +0 -1
  198. package/dist/runtime/web/.next/server/server-reference-manifest.json +0 -1
  199. package/dist/runtime/web/.next/server/webpack-runtime.js +0 -1
  200. package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_buildManifest.js +0 -1
  201. package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_ssgManifest.js +0 -1
  202. package/dist/runtime/web/.next/static/chunks/05c91ade-7d09b2b280adffd1.js +0 -1
  203. package/dist/runtime/web/.next/static/chunks/201-51bef3fa8c832e2e.js +0 -1
  204. package/dist/runtime/web/.next/static/chunks/524-89747ed9b0294f8a.js +0 -1
  205. package/dist/runtime/web/.next/static/chunks/554-8bec6e9cca6acc67.js +0 -1
  206. package/dist/runtime/web/.next/static/chunks/764.86e9503a69d45a85.js +0 -1
  207. package/dist/runtime/web/.next/static/chunks/7ab4dc20-239138e0ae7af24a.js +0 -1
  208. package/dist/runtime/web/.next/static/chunks/905-342391e3d3a3678f.js +0 -20
  209. package/dist/runtime/web/.next/static/chunks/a8a5ce16-4edea7df2d9b544a.js +0 -79
  210. package/dist/runtime/web/.next/static/chunks/ad74d572-4c1b162e2c15acaa.js +0 -1
  211. package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-7b752a8641f96c1f.js +0 -1
  212. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-34e66b251c2b5044.js +0 -1
  213. package/dist/runtime/web/.next/static/chunks/app/api/health/route-7b752a8641f96c1f.js +0 -1
  214. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-7b752a8641f96c1f.js +0 -1
  215. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-7b752a8641f96c1f.js +0 -1
  216. package/dist/runtime/web/.next/static/chunks/app/layout-df9ac93cb02b2385.js +0 -1
  217. package/dist/runtime/web/.next/static/chunks/app/page-6610743f7de5f92a.js +0 -1
  218. package/dist/runtime/web/.next/static/chunks/c25e0690-e9b798b8de667da1.js +0 -1
  219. package/dist/runtime/web/.next/static/chunks/framework-57157ec4d37f64aa.js +0 -1
  220. package/dist/runtime/web/.next/static/chunks/main-app-156cc0c60371bd78.js +0 -1
  221. package/dist/runtime/web/.next/static/chunks/main-df25d367c47b1fec.js +0 -1
  222. package/dist/runtime/web/.next/static/chunks/pages/_app-9f629a5e1131d19f.js +0 -1
  223. package/dist/runtime/web/.next/static/chunks/pages/_error-9238238274c7efcd.js +0 -1
  224. package/dist/runtime/web/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
  225. package/dist/runtime/web/.next/static/chunks/webpack-cd50e39b423d1808.js +0 -1
  226. package/dist/runtime/web/.next/static/css/2728291c68f99cb1.css +0 -3
  227. package/dist/runtime/web/.next/static/css/4fbf378a264bd4ea.css +0 -1
  228. package/dist/runtime/web/.next/static/css/521bd69cc298cd1a.css +0 -1
  229. package/dist/runtime/web/.next/static/css/537e22821e101b87.css +0 -1
  230. package/dist/runtime/web/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
  231. package/dist/runtime/web/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
  232. package/dist/runtime/web/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
  233. package/dist/runtime/web/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
  234. package/dist/runtime/web/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
  235. package/dist/runtime/web/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
  236. package/dist/runtime/web/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
  237. package/dist/runtime/web/package.json +0 -65
  238. package/dist/runtime/web/server.js +0 -44
  239. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,452 +0,0 @@
1
- import path from 'path';
2
- import fs from 'fs/promises';
3
- import { log } from '../lib/logger.js';
4
- import { getProjectRoot, getVibeDir } from '../lib/server/project-root.js';
5
- // -----------------------------
6
- // Prompt templates (hard-coded)
7
- // -----------------------------
8
- const IMPROVEMENT_TEMPLATE = `Streamline the task spec below so it is easy to execute and maintain.
9
-
10
- ## Guidance
11
-
12
- - **IMPORTANT: Detect the language of the task content provided and respond in that SAME language for all markdown sections.** Keep enum fields (type, priority) in English, but write all descriptive content (Description, Technical Details, Implementation Notes, etc.) in the detected language.
13
- - Judge complexity first: keep the spec compact when the work is straightforward; elaborate only when multiple systems or risks require extra direction.
14
- - Drop low-value detail (exact file names, functions, or boilerplate such as "run tests").
15
- - Keep every section action-focused and only include information that will change how the work is done.
16
-
17
- If type or priority should change, surface the recommendation before the content:
18
- **Type**: [new type with a brief reason, omit if unchanged]
19
- **Priority**: [new priority with a brief reason, omit if unchanged]
20
-
21
- ## Response Format
22
-
23
- Return JSON with:
24
- - "type": feature | bug | chore | refactor | test | doc
25
- - "priority": high | medium | low
26
- - "title": optional concise title
27
- - "content": markdown that follows the layout below (omit a leading H1 when a title is provided)
28
-
29
- ## Markdown Layout
30
-
31
- Use clear, economical language in this order.
32
-
33
- <TaskContentTemplate>
34
-
35
- ## Description
36
- [Outcome in plain language. Keep it short when the task is simple.]
37
- ## Technical Details
38
- [Only the essential constraints, integrations, or dependencies.]
39
-
40
- ## Implementation Notes
41
- [Key tactics, risks, or decisions to highlight.]
42
-
43
- ## Recommended Steps
44
- - Step 1
45
- - [ ] TODO
46
- - [ ] TODO
47
- - Step 2
48
- - [ ] TODO
49
- (Provide 2-5 steps total, each with 1-3 TODO checkboxes.)
50
-
51
- ## Acceptance Criteria
52
- - [ ] Concise, verifiable results. Keep the list short but complete.
53
-
54
- ## Implementation Summary
55
- [Brief, auto-generated summary of changes.]
56
-
57
- </TaskContentTemplate>
58
-
59
- ## Project Context
60
-
61
- <ProjectContext>
62
- {{projectContext}}
63
- </ProjectContext>
64
-
65
- ## Current Task
66
-
67
- - **ID:** {{taskId}}
68
- - **Title:** {{taskTitle}}
69
- - **Type:** {{taskType}}
70
- - **Priority:** {{taskPriority}}
71
- - **Status:** {{taskStatus}}
72
-
73
- ## Content to Improve
74
-
75
- <CurrentTaskContent>
76
- {{taskContent}}
77
- </CurrentTaskContent>
78
- `;
79
- const TASK_TEMPLATE = `## Task Brief
80
-
81
- Deliver the task by following the specification exactly as written.
82
-
83
- ## Workflow Instructions
84
-
85
- {{workflowInstructions}}
86
-
87
- ## How to Work
88
-
89
- - Start with the **Description** to internalize the expected outcome.
90
- - Apply every constraint under **Technical Details**.
91
- - Review **Implementation Notes** for callouts, risks, or decisions you must honor.
92
- - Work through each group in **Recommended Steps**, checking off the TODO boxes inside the task file as you complete them.
93
- - Do not mark the task complete until every **Acceptance Criterion** is satisfied and verified.
94
- - Think independently and do not just rely on the task file to guide your work. You can update the task file as you work.
95
-
96
- ## Task Reference
97
-
98
- - **ID:** {{taskId}}
99
- - **Title:** {{taskTitle}}
100
- - **Type:** {{taskType}}
101
- - **Priority:** {{taskPriority}}
102
- - **Status:** {{taskStatus}}
103
- - **Tags:** {{tagsList}}
104
- {{taskFilePathInfo}}
105
-
106
- ## Task Specification
107
-
108
- {{taskContent}}
109
-
110
- `;
111
- const MERGE_TEMPLATE = `Goal: Merge feature branch into base branch in the main repo. Do NOT push to remote.
112
-
113
- ## Context
114
-
115
- - Main Repo: {{repoPath}}
116
- - Worktree: {{worktreePath}}
117
- - Feature branch: {{featureBranch}}
118
- - Base branch: {{baseBranch}}
119
-
120
- ## CRITICAL INSTRUCTIONS
121
-
122
- 1. **Do NOT run formatters, linters, or builds**
123
- 2. **Always use \`--no-verify\` flag** to skip pre-commit hooks
124
- 3. **Handle any uncommitted changes in main repo first**
125
-
126
- ## Steps
127
-
128
- \`\`\`bash
129
- cd {{repoPath}}
130
-
131
- # Step 1: Stash any uncommitted changes in main repo
132
- git stash --include-untracked || true
133
-
134
- # Step 2: Checkout base branch and update
135
- git checkout {{baseBranch}}
136
- git fetch origin {{baseBranch}}
137
- git reset --hard origin/{{baseBranch}}
138
-
139
- # Step 3: Merge feature branch into base
140
- git merge {{featureBranch}} --no-ff --no-verify -m "Merge branch '{{featureBranch}}' into {{baseBranch}}"
141
-
142
- # Step 4: Restore stashed changes if any
143
- git stash pop || true
144
- \`\`\`
145
-
146
- If conflicts occur during merge:
147
- - Prefer {{featureBranch}} when changes are clearly additive
148
- - Keep {{baseBranch}} when it contains newer logic
149
- - After resolving: \`git add <file>\` then \`git commit --no-verify\`
150
-
151
- ## Output Format
152
-
153
- At the end, output exactly one of:
154
- - MERGE_STATUS: SUCCESS
155
- - MERGE_STATUS: FAILED
156
- `;
157
- const REVIEW_TEMPLATE = `## Code Review Task
158
-
159
- Review the changes made for this task comprehensively. Return a JSON string with Fenced JSON.
160
-
161
- 1. **Analyze the implemented changes** by examining the modified files, some of them might be committed in the recent commits
162
- 2. **Evaluate code quality** including:
163
- - Code structure and organization
164
- - Adherence to coding standards and conventions
165
- - Error handling and edge cases
166
- - Performance considerations
167
- - Security implications
168
- - Test coverage and quality
169
-
170
- 3. **Verify task completion** by checking that:
171
- - All acceptance criteria are met
172
- - Implementation matches the task requirements
173
- - No unrelated changes were introduced
174
-
175
- 4. **Provide structured feedback** using this JSON structure with following fields:
176
-
177
-
178
- "reviewSummary": "Brief overview of the implementation and overall assessment",
179
- "recommendations": [
180
- "Specific recommendation 1",
181
- "Specific recommendation 2",
182
- "Specific recommendation 3"
183
- ],
184
- "qualityScore": 85
185
-
186
-
187
- ## Review Guidelines
188
-
189
- - Quality Score: Provide a score from 0-100 (higher is better), below 70 will trigger a re-implementation with your advice.
190
- - Recommendations: Provide actionable, specific improvements
191
- - Focus Areas: Security, performance, maintainability, testing, documentation
192
- - Scoring Rubric (0-100):
193
- - Correctness & completeness: 0-35
194
- - Code quality & maintainability: 0-30
195
- - Testing & coverage: 0-20
196
- - Security & performance considerations: 0-15
197
-
198
- If you identify any critical bugs or potential improvements, provide detailed notes, acceptance criteria, implementation details, todo list, etc. in the Recommendations section and return a score below 70. This will trigger a reimplementation based on your feedback.
199
-
200
- ---
201
-
202
- ## Task Context
203
-
204
- - **ID:** {{taskId}}
205
- - **Title:** {{taskTitle}}
206
- - **Type:** {{taskType}}
207
- - **Priority:** {{taskPriority}}
208
-
209
- ## Task Description
210
-
211
- {{taskContent}}
212
-
213
- ## Review Context
214
-
215
- - **Worktree Path:** {{worktreePath}}
216
- - **Branch:** {{worktreeBranch}}
217
- - **Status:** active
218
-
219
- {{additionalContext}}
220
- `;
221
- // Quality checks detection prompt (AI-only, JSON strict)
222
- const DETECT_QUALITY_CHECKS_TEMPLATE = `You are analyzing a code repository to determine fast, local quality checks.
223
-
224
- Constraints:
225
- - Prefer fast checks suitable for local iteration.
226
- - Only output valid JSON. No prose. No markdown. Do not include comments.
227
- - Schema: { "checks": [ { "name": string, "command": string, "args": string[], "timeout": number, "enabled": boolean } ] }
228
- - The unit of timeout is milliseconds.
229
- - Defaults: enable tests/lint/typecheck if present; set build enabled=false unless explicitly required.
230
- - Use the working directory tools (glob/grep/read) to discover project configuration.
231
-
232
- Examples by ecosystem:
233
- - Node: scripts in package.json (test, lint, typecheck). Use package manager scripts (npm run, pnpm, yarn) if detectable.
234
- - Python: pytest, ruff, mypy if config present.
235
- - Rust: cargo check/test/fmt/clippy if available.
236
- - Go: go test, go vet, golangci-lint if configured.
237
- - Others: propose similar fast checks when clear; otherwise return an empty list.
238
-
239
- Return strictly the JSON with the schema above.`;
240
- // -----------------------------
241
- // Simple string template engine
242
- // -----------------------------
243
- function escapeRegExp(s) {
244
- return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
245
- }
246
- function render(template, vars) {
247
- let out = template;
248
- for (const [key, value] of Object.entries(vars)) {
249
- const re = new RegExp(`{{\\s*${escapeRegExp(key)}\\s*}}`, 'g');
250
- out = out.replace(re, value ?? '');
251
- }
252
- // Remove any unreplaced placeholders
253
- return out.replace(/{{\s*[^}]+\s*}}/g, '');
254
- }
255
- // PromptService centralizes prompt generation logic used by AgentService.
256
- // Prompts are hard-coded templates for now, with light project context reads.
257
- export class PromptService {
258
- constructor(projectRoot, taskService) {
259
- this.projectRoot = projectRoot;
260
- this.taskService = taskService;
261
- }
262
- /**
263
- * Generate absolute path to task file
264
- */
265
- generateTaskFilePath(taskId) {
266
- try {
267
- const vibeDir = getVibeDir();
268
- const taskFilePath = path.resolve(vibeDir, 'tasks', `${taskId}.md`);
269
- return taskFilePath;
270
- }
271
- catch (error) {
272
- log.error(`Failed to generate task file path for ${taskId}`, error, 'prompt-service');
273
- return null;
274
- }
275
- }
276
- /**
277
- * Validate that task file exists at the given path
278
- */
279
- async validateTaskFile(filePath) {
280
- try {
281
- await fs.access(filePath, fs.constants.F_OK);
282
- return true;
283
- }
284
- catch {
285
- return false;
286
- }
287
- }
288
- async generateImprovementPrompt(task, taskData) {
289
- // Read project context
290
- const contextSections = [];
291
- const vibeDir = getVibeDir();
292
- const productOverviewPath = path.join(vibeDir, 'product_overview.md');
293
- try {
294
- await fs.access(productOverviewPath, fs.constants.F_OK);
295
- contextSections.push(`**Product overview file:** ${productOverviewPath}\nReference this for additional product context.`);
296
- }
297
- catch {
298
- log.warn('Could not read product_overview.md for improvement prompt, something went wrong with initialization', undefined, 'prompt-service');
299
- }
300
- const readmePath = path.join(getProjectRoot(), 'README.md');
301
- try {
302
- await fs.access(readmePath, fs.constants.F_OK);
303
- contextSections.push(`**Repository README:** ${readmePath}\nReview this if you need additional project context.`);
304
- }
305
- catch {
306
- log.info('README.md not found when building improvement prompt context', { readmePath }, 'prompt-service');
307
- }
308
- // Add task file path to project context for improvement prompts
309
- const taskFilePath = this.generateTaskFilePath(task.id);
310
- if (taskFilePath && (await this.validateTaskFile(taskFilePath))) {
311
- contextSections.push(`**Current task file location:** ${taskFilePath}`);
312
- log.info(`Task file path included in improvement prompt`, { taskId: task.id, path: taskFilePath }, 'prompt-service');
313
- }
314
- const productContext = contextSections.join('\n\n');
315
- return render(IMPROVEMENT_TEMPLATE, {
316
- projectContext: productContext,
317
- taskId: task.id,
318
- taskTitle: taskData.title,
319
- taskType: taskData.type,
320
- taskPriority: taskData.priority,
321
- taskStatus: task.status,
322
- taskContent: taskData.content,
323
- });
324
- }
325
- async generateTaskPrompt(task, workflowConfig) {
326
- const tagsList = task.tags.join(', ');
327
- // Generate and validate task file path
328
- const taskFilePath = this.generateTaskFilePath(task.id);
329
- let taskFilePathInfo = '';
330
- if (taskFilePath) {
331
- const isValid = await this.validateTaskFile(taskFilePath);
332
- if (isValid) {
333
- taskFilePathInfo = `- **Current task file:** ${taskFilePath}`;
334
- log.info(`Task file path included in prompt`, { taskId: task.id, path: taskFilePath }, 'prompt-service');
335
- }
336
- else {
337
- taskFilePathInfo = `- **Task file:** (not accessible at expected path: ${taskFilePath})`;
338
- log.warn(`Task file not accessible`, { taskId: task.id, path: taskFilePath }, 'prompt-service');
339
- }
340
- }
341
- else {
342
- taskFilePathInfo = `- **Task file:** (path could not be resolved)`;
343
- log.error(`Could not generate task file path`, { taskId: task.id }, 'prompt-service');
344
- }
345
- // Build workflow instruction prompts based on workflow configuration
346
- const workflowInstructions = this.buildWorkflowInstructions(workflowConfig);
347
- return render(TASK_TEMPLATE, {
348
- taskId: task.id,
349
- taskTitle: task.title,
350
- taskType: task.type,
351
- taskPriority: task.priority,
352
- taskStatus: task.status,
353
- taskContent: task.content,
354
- tagsList,
355
- taskFilePathInfo,
356
- workflowInstructions,
357
- });
358
- }
359
- /**
360
- * Build a prominent, clearly formatted instruction section derived from workflow options.
361
- * If no options are provided or none apply, returns a minimal guidance line.
362
- */
363
- buildWorkflowInstructions(cfg) {
364
- const lines = [];
365
- if (!cfg) {
366
- // Default lightweight guidance when workflow config is unavailable
367
- return '- Follow project conventions and ask before destructive actions.';
368
- }
369
- // Auto Commit disabled prompt
370
- if (cfg.autoCommit === false) {
371
- lines.push('IMPORTANT: AUTO COMMIT IS DISABLED');
372
- lines.push('- DO NOT commit any changes');
373
- lines.push('- DO NOT run git commit commands');
374
- lines.push('- Leave all changes staged for manual review');
375
- lines.push('');
376
- }
377
- // PR creation disabled prompt
378
- if (cfg.createPR === false) {
379
- lines.push('IMPORTANT: PR CREATION IS DISABLED');
380
- lines.push('- DO NOT create pull requests');
381
- lines.push('- DO NOT run gh pr create commands');
382
- lines.push('- Prepare changes for manual PR creation');
383
- lines.push('');
384
- }
385
- // Auto merge disabled prompt
386
- if (cfg.autoMerge === false) {
387
- lines.push('IMPORTANT: AUTO MERGE IS DISABLED');
388
- lines.push('- DO NOT merge pull requests automatically');
389
- lines.push('- DO NOT run git merge commands');
390
- lines.push('- Prepare changes for manual merge approval');
391
- lines.push('');
392
- }
393
- // If nothing matched, provide a simple fallback
394
- if (lines.length === 0) {
395
- return '- No special workflow constraints. Proceed with standard process.';
396
- }
397
- return lines.join('\n');
398
- }
399
- async generateAIMergePrompt(task, worktree, baseBranch) {
400
- const repoPath = this.projectRoot;
401
- const featureBr = worktree.branchName;
402
- // Determine base branch: prefer provided, otherwise current branch in repo root, fallback to 'main'
403
- let baseBr = baseBranch?.trim();
404
- if (!baseBr) {
405
- try {
406
- const { spawn } = await import('child_process');
407
- baseBr = await new Promise((resolve, reject) => {
408
- const child = spawn('git', ['branch', '--show-current'], {
409
- cwd: repoPath,
410
- stdio: ['ignore', 'pipe', 'pipe'],
411
- });
412
- let out = '';
413
- child.stdout?.on('data', (d) => (out += d.toString()));
414
- child.on('close', () => resolve(out.trim() || 'main'));
415
- child.on('error', reject);
416
- });
417
- }
418
- catch {
419
- baseBr = 'main';
420
- }
421
- }
422
- return render(MERGE_TEMPLATE, {
423
- repoPath,
424
- worktreePath: worktree.path,
425
- featureBranch: featureBr,
426
- baseBranch: baseBr,
427
- });
428
- }
429
- async generateReviewPrompt(task, worktree, reviewContext) {
430
- let additionalContext = reviewContext ? `\n**Additional Context:** ${reviewContext}` : '';
431
- // Add task file path to additional context
432
- const taskFilePath = this.generateTaskFilePath(task.id);
433
- if (taskFilePath && (await this.validateTaskFile(taskFilePath))) {
434
- additionalContext += `\n**Current task file:** ${taskFilePath}`;
435
- log.info(`Task file path included in review prompt`, { taskId: task.id, path: taskFilePath }, 'prompt-service');
436
- }
437
- return render(REVIEW_TEMPLATE, {
438
- taskId: task.id,
439
- taskTitle: task.title,
440
- taskType: task.type,
441
- taskPriority: task.priority,
442
- taskContent: task.content,
443
- worktreePath: worktree.path,
444
- worktreeBranch: worktree.branchName,
445
- additionalContext,
446
- });
447
- }
448
- }
449
- // Utility export for building the quality checks detection prompt
450
- export function getQualityChecksDetectionPrompt() {
451
- return DETECT_QUALITY_CHECKS_TEMPLATE;
452
- }
@@ -1 +0,0 @@
1
- export {};