vibeman 0.0.2 → 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 (198) hide show
  1. package/dist/index.js +3 -3
  2. package/dist/runtime/api/.tsbuildinfo +1 -1
  3. package/dist/runtime/api/agent/agent-service.d.ts +11 -6
  4. package/dist/runtime/api/agent/agent-service.js +97 -29
  5. package/dist/runtime/api/agent/ai-providers/amp-cli-provider.d.ts +38 -0
  6. package/dist/runtime/api/agent/ai-providers/amp-cli-provider.js +268 -0
  7. package/dist/runtime/api/agent/ai-providers/codex-cli-provider.d.ts +2 -0
  8. package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +92 -32
  9. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.d.ts +24 -0
  10. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.js +291 -0
  11. package/dist/runtime/api/agent/ai-providers/index.d.ts +3 -3
  12. package/dist/runtime/api/agent/ai-providers/index.js +3 -1
  13. package/dist/runtime/api/agent/ai-providers/types.d.ts +5 -2
  14. package/dist/runtime/api/agent/amp-cli-provider.test.js +99 -0
  15. package/dist/runtime/api/agent/codex-cli-provider.test.js +54 -7
  16. package/dist/runtime/api/agent/prompt-service.js +108 -105
  17. package/dist/runtime/api/agent/prompt-service.test.js +35 -0
  18. package/dist/runtime/api/agent/routing-policy.d.ts +13 -30
  19. package/dist/runtime/api/agent/routing-policy.js +82 -132
  20. package/dist/runtime/api/agent/routing-policy.test.js +63 -0
  21. package/dist/runtime/api/api/routers/ai.d.ts +15 -3
  22. package/dist/runtime/api/api/routers/ai.js +7 -6
  23. package/dist/runtime/api/api/routers/executions.d.ts +3 -8
  24. package/dist/runtime/api/api/routers/executions.js +2 -2
  25. package/dist/runtime/api/api/routers/provider-config.d.ts +34 -0
  26. package/dist/runtime/api/api/routers/settings.d.ts +19 -0
  27. package/dist/runtime/api/api/routers/settings.js +16 -0
  28. package/dist/runtime/api/api/routers/tasks.d.ts +10 -10
  29. package/dist/runtime/api/api/routers/workflows.d.ts +20 -12
  30. package/dist/runtime/api/api/routers/workflows.js +2 -1
  31. package/dist/runtime/api/api/routers/worktrees.d.ts +2 -2
  32. package/dist/runtime/api/api/trpc.d.ts +18 -18
  33. package/dist/runtime/api/lib/local-config.d.ts +94 -4
  34. package/dist/runtime/api/lib/local-config.js +16 -0
  35. package/dist/runtime/api/lib/provider-detection.d.ts +2 -0
  36. package/dist/runtime/api/lib/provider-detection.js +83 -1
  37. package/dist/runtime/api/lib/server/vibeman-info.d.ts +5 -0
  38. package/dist/runtime/api/lib/server/vibeman-info.js +85 -0
  39. package/dist/runtime/api/lib/trpc/server.d.ts +85 -35
  40. package/dist/runtime/api/persistence/execution-log-persistence.d.ts +1 -1
  41. package/dist/runtime/api/persistence/execution-log-persistence.js +19 -3
  42. package/dist/runtime/api/router.d.ts +85 -35
  43. package/dist/runtime/api/settings-service.js +70 -5
  44. package/dist/runtime/api/tasks/task-file-parser.d.ts +1 -0
  45. package/dist/runtime/api/tasks/task-file-parser.js +20 -1
  46. package/dist/runtime/api/tasks/task-updater.d.ts +62 -0
  47. package/dist/runtime/api/tasks/task-updater.js +260 -0
  48. package/dist/runtime/api/tasks/task-updater.test.d.ts +1 -0
  49. package/dist/runtime/api/tasks/task-updater.test.js +303 -0
  50. package/dist/runtime/api/types/index.d.ts +9 -2
  51. package/dist/runtime/api/types/settings.d.ts +29 -5
  52. package/dist/runtime/api/vcs/git-service.d.ts +9 -0
  53. package/dist/runtime/api/vcs/git-service.js +23 -0
  54. package/dist/runtime/api/vcs/worktree-service.d.ts +1 -1
  55. package/dist/runtime/api/vcs/worktree-service.js +22 -10
  56. package/dist/runtime/api/workflows/quality-pipeline.js +2 -1
  57. package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +93 -5
  58. package/dist/runtime/api/workflows/vibing-orchestrator.js +806 -204
  59. package/dist/runtime/api/workflows/workflow-effects.d.ts +45 -0
  60. package/dist/runtime/api/workflows/workflow-effects.js +49 -0
  61. package/dist/runtime/api/workflows/workflow-reconciler.d.ts +65 -0
  62. package/dist/runtime/api/workflows/workflow-reconciler.js +226 -0
  63. package/dist/runtime/api/workflows/workflow-reducer.d.ts +26 -0
  64. package/dist/runtime/api/workflows/workflow-reducer.js +288 -0
  65. package/dist/runtime/api/workflows/workflow-reducer.test.d.ts +1 -0
  66. package/dist/runtime/api/workflows/workflow-reducer.test.js +247 -0
  67. package/dist/runtime/api/workflows/workflow-schema.d.ts +546 -0
  68. package/dist/runtime/api/workflows/workflow-schema.js +256 -0
  69. package/dist/runtime/web/.next/BUILD_ID +1 -1
  70. package/dist/runtime/web/.next/app-build-manifest.json +51 -44
  71. package/dist/runtime/web/.next/app-path-routes-manifest.json +2 -1
  72. package/dist/runtime/web/.next/build-manifest.json +14 -14
  73. package/dist/runtime/web/.next/prerender-manifest.json +10 -10
  74. package/dist/runtime/web/.next/react-loadable-manifest.json +2 -33
  75. package/dist/runtime/web/.next/required-server-files.json +5 -5
  76. package/dist/runtime/web/.next/routes-manifest.json +8 -0
  77. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +1 -0
  78. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +1 -0
  79. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +1 -0
  80. package/dist/runtime/web/.next/server/app/_not-found/page.js +2 -2
  81. package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  82. package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  83. package/dist/runtime/web/.next/server/app/_not-found.html +2 -2
  84. package/dist/runtime/web/.next/server/app/_not-found.rsc +12 -12
  85. package/dist/runtime/web/.next/server/app/api/health/route.js +1 -1
  86. package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +1 -1
  87. package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  88. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +1 -1
  89. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +1 -1
  90. package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +1 -1
  91. package/dist/runtime/web/.next/server/app/api/upload/route.js +1 -1
  92. package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +1 -1
  93. package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +1 -1
  94. package/dist/runtime/web/.next/server/app/index.html +2 -2
  95. package/dist/runtime/web/.next/server/app/index.rsc +15 -15
  96. package/dist/runtime/web/.next/server/app/page.js +27 -62
  97. package/dist/runtime/web/.next/server/app/page.js.nft.json +1 -1
  98. package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +1 -1
  99. package/dist/runtime/web/.next/server/app-paths-manifest.json +2 -1
  100. package/dist/runtime/web/.next/server/chunks/210.js +1 -0
  101. package/dist/runtime/web/.next/server/chunks/291.js +18 -0
  102. package/dist/runtime/web/.next/server/chunks/552.js +22 -0
  103. package/dist/runtime/web/.next/server/chunks/780.js +1 -0
  104. package/dist/runtime/web/.next/server/chunks/905.js +6 -0
  105. package/dist/runtime/web/.next/server/chunks/98.js +1 -0
  106. package/dist/runtime/web/.next/server/middleware-build-manifest.js +1 -1
  107. package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  108. package/dist/runtime/web/.next/server/pages/404.html +2 -2
  109. package/dist/runtime/web/.next/server/pages/500.html +1 -1
  110. package/dist/runtime/web/.next/server/pages/_app.js +1 -1
  111. package/dist/runtime/web/.next/server/pages/_app.js.nft.json +1 -1
  112. package/dist/runtime/web/.next/server/pages/_document.js +1 -1
  113. package/dist/runtime/web/.next/server/pages/_document.js.nft.json +1 -1
  114. package/dist/runtime/web/.next/server/pages/_error.js +9 -9
  115. package/dist/runtime/web/.next/server/pages/_error.js.nft.json +1 -1
  116. package/dist/runtime/web/.next/server/pages-manifest.json +1 -1
  117. package/dist/runtime/web/.next/server/server-reference-manifest.json +1 -1
  118. package/dist/runtime/web/.next/server/webpack-runtime.js +1 -1
  119. package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_buildManifest.js +1 -0
  120. package/dist/runtime/web/.next/static/chunks/05c91ade-7d09b2b280adffd1.js +1 -0
  121. package/dist/runtime/web/.next/static/chunks/201-51bef3fa8c832e2e.js +1 -0
  122. package/dist/runtime/web/.next/static/chunks/524-89747ed9b0294f8a.js +1 -0
  123. package/dist/runtime/web/.next/static/chunks/554-8bec6e9cca6acc67.js +1 -0
  124. package/dist/runtime/web/.next/static/chunks/764.86e9503a69d45a85.js +1 -0
  125. package/dist/runtime/web/.next/static/chunks/{87c73c54-09e1ba5c70e60a51.js → 7ab4dc20-239138e0ae7af24a.js} +1 -1
  126. package/dist/runtime/web/.next/static/chunks/905-342391e3d3a3678f.js +20 -0
  127. package/dist/runtime/web/.next/static/chunks/a8a5ce16-4edea7df2d9b544a.js +79 -0
  128. package/dist/runtime/web/.next/static/chunks/{8bb4d8db-3e2aa02b0a2384b9.js → ad74d572-4c1b162e2c15acaa.js} +1 -1
  129. package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-7b752a8641f96c1f.js +1 -0
  130. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-34e66b251c2b5044.js +1 -0
  131. package/dist/runtime/web/.next/static/chunks/app/api/health/route-7b752a8641f96c1f.js +1 -0
  132. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-7b752a8641f96c1f.js +1 -0
  133. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-7b752a8641f96c1f.js +1 -0
  134. package/dist/runtime/web/.next/static/chunks/app/layout-df9ac93cb02b2385.js +1 -0
  135. package/dist/runtime/web/.next/static/chunks/app/page-6610743f7de5f92a.js +1 -0
  136. package/dist/runtime/web/.next/static/chunks/c25e0690-e9b798b8de667da1.js +1 -0
  137. package/dist/runtime/web/.next/static/chunks/framework-57157ec4d37f64aa.js +1 -0
  138. package/dist/runtime/web/.next/static/chunks/main-app-156cc0c60371bd78.js +1 -0
  139. package/dist/runtime/web/.next/static/chunks/main-df25d367c47b1fec.js +1 -0
  140. package/dist/runtime/web/.next/static/chunks/pages/_app-9f629a5e1131d19f.js +1 -0
  141. package/dist/runtime/web/.next/static/chunks/pages/_error-9238238274c7efcd.js +1 -0
  142. package/dist/runtime/web/.next/static/chunks/webpack-cd50e39b423d1808.js +1 -0
  143. package/dist/runtime/web/.next/static/css/4fbf378a264bd4ea.css +1 -0
  144. package/dist/runtime/web/package.json +8 -8
  145. package/dist/runtime/web/server.js +1 -1
  146. package/dist/tsconfig.tsbuildinfo +1 -1
  147. package/package.json +3 -37
  148. package/dist/runtime/api/lib/image-paste-drop-extension.d.ts +0 -26
  149. package/dist/runtime/api/lib/image-paste-drop-extension.js +0 -125
  150. package/dist/runtime/api/lib/markdown-utils.d.ts +0 -8
  151. package/dist/runtime/api/lib/markdown-utils.js +0 -282
  152. package/dist/runtime/api/lib/markdown-utils.test.js +0 -348
  153. package/dist/runtime/api/lib/tiptap-utils.clamp-selection.test.js +0 -27
  154. package/dist/runtime/api/lib/tiptap-utils.d.ts +0 -130
  155. package/dist/runtime/api/lib/tiptap-utils.js +0 -327
  156. package/dist/runtime/api/lib/trpc/client.d.ts +0 -1
  157. package/dist/runtime/api/lib/trpc/client.js +0 -5
  158. package/dist/runtime/web/.next/server/chunks/217.js +0 -1
  159. package/dist/runtime/web/.next/server/chunks/383.js +0 -6
  160. package/dist/runtime/web/.next/server/chunks/458.js +0 -1
  161. package/dist/runtime/web/.next/server/chunks/576.js +0 -18
  162. package/dist/runtime/web/.next/server/chunks/635.js +0 -22
  163. package/dist/runtime/web/.next/server/chunks/761.js +0 -1
  164. package/dist/runtime/web/.next/server/chunks/777.js +0 -3
  165. package/dist/runtime/web/.next/server/chunks/825.js +0 -1
  166. package/dist/runtime/web/.next/server/chunks/838.js +0 -1
  167. package/dist/runtime/web/.next/server/chunks/973.js +0 -15
  168. package/dist/runtime/web/.next/static/chunks/18-15c10d3288afef2e.js +0 -1
  169. package/dist/runtime/web/.next/static/chunks/1c0ca389.537bbe362e3ffbd9.js +0 -3
  170. package/dist/runtime/web/.next/static/chunks/22747d63-ad5da0c19f4cfe41.js +0 -71
  171. package/dist/runtime/web/.next/static/chunks/277-0142a939f08738c3.js +0 -63
  172. package/dist/runtime/web/.next/static/chunks/355.056c2645878a799a.js +0 -1
  173. package/dist/runtime/web/.next/static/chunks/420.a5ccf151c9e2b2f1.js +0 -1
  174. package/dist/runtime/web/.next/static/chunks/439.1be0c6242fd248d5.js +0 -15
  175. package/dist/runtime/web/.next/static/chunks/440.c52e7c0f797e22b2.js +0 -1
  176. package/dist/runtime/web/.next/static/chunks/575-e2478287c27da87b.js +0 -1
  177. package/dist/runtime/web/.next/static/chunks/691.920d88c115087314.js +0 -1
  178. package/dist/runtime/web/.next/static/chunks/765-e838910065b50c3d.js +0 -1
  179. package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +0 -1
  180. package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +0 -1
  181. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-1cb74d1cba27d0ab.js +0 -1
  182. package/dist/runtime/web/.next/static/chunks/app/api/health/route-105a61ae865ba536.js +0 -1
  183. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-105a61ae865ba536.js +0 -1
  184. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-105a61ae865ba536.js +0 -1
  185. package/dist/runtime/web/.next/static/chunks/app/layout-8435322f09fd0975.js +0 -1
  186. package/dist/runtime/web/.next/static/chunks/app/page-8c3ba579efc6f918.js +0 -1
  187. package/dist/runtime/web/.next/static/chunks/cac567b0-5b77dd12911823cd.js +0 -1
  188. package/dist/runtime/web/.next/static/chunks/framework-2518f1345b5b2806.js +0 -1
  189. package/dist/runtime/web/.next/static/chunks/main-17665e5e39de9a8a.js +0 -1
  190. package/dist/runtime/web/.next/static/chunks/main-app-c0b0f5ba4f7f9d75.js +0 -1
  191. package/dist/runtime/web/.next/static/chunks/pages/_app-d6f6b3bbc3d81ee1.js +0 -1
  192. package/dist/runtime/web/.next/static/chunks/pages/_error-75a96cf1997cc3b9.js +0 -1
  193. package/dist/runtime/web/.next/static/chunks/webpack-c8de37305b4635cf.js +0 -1
  194. package/dist/runtime/web/.next/static/css/08c950681f1a9a92.css +0 -1
  195. package/dist/runtime/web/.next/static/mRpNgPfbYR_0wrODzlg_4/_buildManifest.js +0 -1
  196. /package/dist/runtime/api/{lib/markdown-utils.test.d.ts → agent/amp-cli-provider.test.d.ts} +0 -0
  197. /package/dist/runtime/api/{lib/tiptap-utils.clamp-selection.test.d.ts → agent/routing-policy.test.d.ts} +0 -0
  198. /package/dist/runtime/web/.next/static/{mRpNgPfbYR_0wrODzlg_4 → LJFZk_8tvKFN_Ee4HqUuM}/_ssgManifest.js +0 -0
@@ -24,16 +24,18 @@ describe('CodexCliProvider (mocked)', () => {
24
24
  setTimeout(() => proc.emit('exit', 0, null), 20);
25
25
  return proc;
26
26
  },
27
+ exec: vi.fn(),
28
+ execFile: vi.fn(),
27
29
  };
28
30
  });
29
31
  const { CodexCliProvider } = await import('./ai-providers/codex-cli-provider.js');
30
- const provider = new CodexCliProvider({ defaultTimeoutMs: 1000 });
32
+ const provider = new CodexCliProvider({ defaultTimeoutMs: 1000, codexBinPath: 'codex' });
31
33
  const messages = [];
32
34
  const iter = provider.execute('What is this project about?', {
33
35
  workingDirectory: process.cwd(),
34
36
  images: ['a.png', 'b.jpg'],
35
37
  effort: 'minimal',
36
- model: 'gpt-5',
38
+ model: 'gpt-5.2',
37
39
  });
38
40
  for await (const m of iter)
39
41
  messages.push(m);
@@ -53,7 +55,48 @@ describe('CodexCliProvider (mocked)', () => {
53
55
  expect(captured[1]).toContain('a.png,b.jpg');
54
56
  const modelIdx = captured[1].indexOf('--model');
55
57
  expect(modelIdx).toBeGreaterThan(-1);
56
- expect(captured[1][modelIdx + 1]).toBe('gpt-5');
58
+ expect(captured[1][modelIdx + 1]).toBe('gpt-5.2');
59
+ const configIdx = captured[1].indexOf('-c');
60
+ expect(configIdx).toBeGreaterThan(-1);
61
+ expect(captured[1][configIdx + 1]).toBe('model_reasoning_effort=low');
62
+ });
63
+ it('maps reasoning level encoded in model name to CLI flags', async () => {
64
+ vi.resetModules();
65
+ vi.doMock('child_process', () => {
66
+ let captured = [];
67
+ return {
68
+ __captured: () => captured,
69
+ spawn: (cmd, args, opts) => {
70
+ captured = [cmd, args, opts];
71
+ const { EventEmitter } = require('events');
72
+ const stdout = new EventEmitter();
73
+ const proc = new EventEmitter();
74
+ proc.stdout = stdout;
75
+ setTimeout(() => stdout.emit('data', Buffer.from('Reasoned\n')), 10);
76
+ setTimeout(() => proc.emit('exit', 0, null), 20);
77
+ return proc;
78
+ },
79
+ exec: vi.fn(),
80
+ execFile: vi.fn(),
81
+ };
82
+ });
83
+ const { CodexCliProvider } = await import('./ai-providers/codex-cli-provider.js');
84
+ const provider = new CodexCliProvider({ codexBinPath: 'codex' });
85
+ const messages = [];
86
+ const iter = provider.execute('Solve with depth', {
87
+ workingDirectory: process.cwd(),
88
+ model: 'gpt-5.1-codex-max-extra-high',
89
+ });
90
+ for await (const m of iter)
91
+ messages.push(m);
92
+ const mockSpawn = await import('child_process');
93
+ const captured = mockSpawn.__captured();
94
+ const modelIdx = captured[1].indexOf('--model');
95
+ expect(modelIdx).toBeGreaterThan(-1);
96
+ expect(captured[1][modelIdx + 1]).toBe('gpt-5.1-codex-max');
97
+ const configIdx = captured[1].indexOf('-c');
98
+ expect(configIdx).toBeGreaterThan(-1);
99
+ expect(captured[1][configIdx + 1]).toBe('model_reasoning_effort=extra_high');
57
100
  });
58
101
  it('prepends system prompts and toggles sandbox bypass flag', async () => {
59
102
  vi.resetModules();
@@ -71,10 +114,12 @@ describe('CodexCliProvider (mocked)', () => {
71
114
  setTimeout(() => proc.emit('exit', 0, null), 10);
72
115
  return proc;
73
116
  },
117
+ exec: vi.fn(),
118
+ execFile: vi.fn(),
74
119
  };
75
120
  });
76
121
  const { CodexCliProvider } = await import('./ai-providers/codex-cli-provider.js');
77
- const provider = new CodexCliProvider();
122
+ const provider = new CodexCliProvider({ codexBinPath: 'codex' });
78
123
  const iter = provider.execute('Implement feature', {
79
124
  workingDirectory: '/tmp/project',
80
125
  systemPrompt: 'Base system prompt',
@@ -88,9 +133,11 @@ describe('CodexCliProvider (mocked)', () => {
88
133
  const captured = mockSpawn.__captured();
89
134
  expect(captured[1][1]).toContain('Base system prompt');
90
135
  expect(captured[1][1]).toContain('Additional guidance');
91
- const bypassIdx = captured[1].indexOf('--dangerously-bypass-approvals-and-sandbox');
92
- expect(bypassIdx).toBeGreaterThan(-1);
93
- expect(captured[1][bypassIdx + 1]).toBeUndefined();
136
+ const fullAutoIdx = captured[1].indexOf('--full-auto');
137
+ expect(fullAutoIdx).toBeGreaterThan(-1);
138
+ const sandboxIdx = captured[1].indexOf('--sandbox');
139
+ expect(sandboxIdx).toBeGreaterThan(-1);
140
+ expect(captured[1][sandboxIdx + 1]).toBe('danger-full-access');
94
141
  });
95
142
  });
96
143
  // Real integration (opt-in)
@@ -1,79 +1,60 @@
1
1
  import path from 'path';
2
2
  import fs from 'fs/promises';
3
3
  import { log } from '../lib/logger.js';
4
- import { getVibeDir } from '../lib/server/project-root.js';
4
+ import { getProjectRoot, getVibeDir } from '../lib/server/project-root.js';
5
5
  // -----------------------------
6
6
  // Prompt templates (hard-coded)
7
7
  // -----------------------------
8
- const IMPROVEMENT_TEMPLATE = `The current content might be a brief description or incomplete specification. Transform it into a comprehensive, well-structured task specification using advanced reasoning.
8
+ const IMPROVEMENT_TEMPLATE = `Streamline the task spec below so it is easy to execute and maintain.
9
9
 
10
- ## Analysis Framework
10
+ ## Guidance
11
11
 
12
- First, conduct a thorough analysis:
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.
13
16
 
14
- 1. **Current State Assessment**: Analyze the existing task content for clarity, completeness, and specificity
15
- 2. **Type Classification**: Evaluate if the current type ({{taskType}}) aligns with the actual work required:
16
- - **feature**: New functionality or capabilities
17
- - **bug**: Fixing defects or issues
18
- - **chore**: Maintenance, dependencies, tooling
19
- - **refactor**: Code improvement without behavior change
20
- - **test**: Adding or improving tests
21
- - **doc**: Documentation updates
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]
22
20
 
23
- 3. **Priority Assessment**: Evaluate if the current priority ({{taskPriority}}) reflects the business impact and urgency:
24
- - **high**: Critical, blocking, or high business value
25
- - **medium**: Important but not urgent, moderate impact
26
- - **low**: Nice to have, minor improvements
21
+ ## Response Format
27
22
 
28
- 4. **Scope and Complexity Analysis**: Determine if the task is appropriately sized and scoped
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)
29
28
 
30
- If you recommend changes to type or priority, include them at the top of your response:
31
- **Type**: [recommended type with brief reasoning]
32
- **Priority**: [recommended priority with brief reasoning]
29
+ ## Markdown Layout
33
30
 
34
- ### Expected Content Format:
31
+ Use clear, economical language in this order.
35
32
 
36
- #### Description
37
- [Provide a clear, detailed description of what needs to be accomplished]
33
+ <TaskContentTemplate>
38
34
 
39
- #### Acceptance Criteria
40
- - [ ] [Specific, testable criterion 1]
41
- - [ ] [Specific, testable criterion 2]
42
- - [ ] [Specific, testable criterion 3]
43
- [Add more as needed]
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.]
44
39
 
45
- #### Technical Details
46
- [Include implementation considerations, architecture notes, dependencies, etc.]
40
+ ## Implementation Notes
41
+ [Key tactics, risks, or decisions to highlight.]
47
42
 
48
- #### Implementation Notes
49
- [Any specific guidance, patterns to follow, potential challenges, etc.]
50
- [Split into smaller tasks and todo items if needed]
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.)
51
50
 
52
- ## Advanced Improvement Guidelines:
51
+ ## Acceptance Criteria
52
+ - [ ] Concise, verifiable results. Keep the list short but complete.
53
53
 
54
- 1. **Precision & Clarity**: Transform vague requirements into concrete, measurable, actionable items with clear success criteria
55
- 2. **Technical Depth**: Consider implementation complexity, architecture implications, and technical dependencies
56
- 3. **Project Alignment**: Ensure the task fits within the existing codebase architecture and follows established patterns
57
- 4. **Quality Assurance**: Include comprehensive testing strategies, edge cases, and validation approaches
58
- 5. **Risk Assessment**: Identify potential challenges, blockers, and mitigation strategies
59
- 6. **Cross-functional Impact**: Consider effects on other systems, teams, or user experiences
60
- 7. **Scalability & Performance**: Include considerations for performance, scalability, and maintainability
61
- 8. **Documentation**: Ensure adequate documentation and knowledge transfer requirements
62
- 9. **Scope Optimization**: Balance completeness with manageable task size for effective execution
63
- 10. **Context Preservation**: Maintain original intent while significantly enhancing detail and clarity
64
- 11. **Standards Compliance**: Follow GitHub Flavored Markdown specification and project conventions
65
- 12. **Asset Preservation**: Retain any images, diagrams, or other media from the original content
66
- 13. **Simple and focus**: Keep the task simple, don't make it too complex and over design, focus on the core functionality and core business logic
54
+ ## Implementation Summary
55
+ [Brief, auto-generated summary of changes.]
67
56
 
68
- ## Expected Output Structure
69
-
70
- Return a JSON object with:
71
- - "type": one of [feature, bug, chore, refactor, test, doc]
72
- - "priority": one of [high, medium, low]
73
- - "title": a concise, descriptive title for the task (optional, but preferred)
74
- - "content": the improved task specification in markdown format with proper JSON escaping
75
-
76
- If you include a title in the JSON response, do NOT include an H1 heading at the beginning of the content field to avoid duplication.
57
+ </TaskContentTemplate>
77
58
 
78
59
  ## Project Context
79
60
 
@@ -81,12 +62,13 @@ If you include a title in the JSON response, do NOT include an H1 heading at the
81
62
  {{projectContext}}
82
63
  </ProjectContext>
83
64
 
84
- ## Current Task Details
65
+ ## Current Task
66
+
85
67
  - **ID:** {{taskId}}
86
- - **Title:** {{taskTitle}}
87
- - **Type:** {{taskType}}
88
- - **Priority:** {{taskPriority}}
89
- - **Status:** {{taskStatus}}
68
+ - **Title:** {{taskTitle}}
69
+ - **Type:** {{taskType}}
70
+ - **Priority:** {{taskPriority}}
71
+ - **Status:** {{taskStatus}}
90
72
 
91
73
  ## Content to Improve
92
74
 
@@ -94,43 +76,24 @@ If you include a title in the JSON response, do NOT include an H1 heading at the
94
76
  {{taskContent}}
95
77
  </CurrentTaskContent>
96
78
  `;
97
- const TASK_TEMPLATE = `## Task Assignment
79
+ const TASK_TEMPLATE = `## Task Brief
98
80
 
99
- Deliver the following task.
81
+ Deliver the task by following the specification exactly as written.
100
82
 
101
83
  ## Workflow Instructions
102
84
 
103
85
  {{workflowInstructions}}
104
86
 
105
- ## Responsibilities
87
+ ## How to Work
106
88
 
107
- 1. **Analyze requirements** — study the acceptance criteria to clarify what must be delivered.
108
- 2. **Review the codebase** understand the current implementation, architecture, and coding patterns.
109
- 3. **Implement changes** add or modify code according to project conventions.
110
- 4. **Test thoroughly** write/run tests and verify that all builds succeed.
111
- 5. **Update the task file** tick off each acceptance criterion that you have completed.
112
-
113
- ## Development Guidelines
114
-
115
- - Respect existing architecture and style conventions.
116
- - Add robust error handling.
117
- - Update documentation when necessary.
118
- - Ensure all tests pass and the project builds cleanly.
119
- - Commit with a clear, descriptive message.
120
- - Create todo list to track the progress.
121
-
122
- ## Expected Deliverables
123
-
124
- - A working implementation that satisfies every requirement.
125
- - An updated task file showing completed acceptance criteria.
126
- - Clean, well-documented code.
127
- - Passing build and test results.
128
-
129
- Begin by examining the codebase; then proceed with the implementation.
130
-
131
- ---
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.
132
95
 
133
- ### Task Snapshot
96
+ ## Task Reference
134
97
 
135
98
  - **ID:** {{taskId}}
136
99
  - **Title:** {{taskTitle}}
@@ -138,29 +101,58 @@ Begin by examining the codebase; then proceed with the implementation.
138
101
  - **Priority:** {{taskPriority}}
139
102
  - **Status:** {{taskStatus}}
140
103
  - **Tags:** {{tagsList}}
141
-
142
104
  {{taskFilePathInfo}}
143
105
 
144
- #### Description
106
+ ## Task Specification
145
107
 
146
108
  {{taskContent}}
147
109
 
148
110
  `;
149
- const MERGE_TEMPLATE = `Goal: Merge feature branch into base without pushing to remote. Resolve conflicts safely.
111
+ const MERGE_TEMPLATE = `Goal: Merge feature branch into base branch in the main repo. Do NOT push to remote.
150
112
 
151
- Context:
113
+ ## Context
152
114
 
153
- - Repo: {{repoPath}}
115
+ - Main Repo: {{repoPath}}
154
116
  - Worktree: {{worktreePath}}
155
117
  - Feature branch: {{featureBranch}}
156
118
  - Base branch: {{baseBranch}}
157
119
 
158
- If conflicts:
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}}"
159
141
 
160
- - Prefer {{featureBranch}} when changes are clearly additive or isolated.
161
- - Keep {{baseBranch}} when it contains newer logic that would be overwritten.
162
- - Integrate both sides when needed.
163
- - After each file: git add <file>
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
164
156
  `;
165
157
  const REVIEW_TEMPLATE = `## Code Review Task
166
158
 
@@ -295,20 +287,31 @@ export class PromptService {
295
287
  }
296
288
  async generateImprovementPrompt(task, taskData) {
297
289
  // Read project context
298
- const productOverviewPath = path.join(getVibeDir(), 'product_overview.md');
299
- let productContext = '';
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');
300
301
  try {
301
- productContext = await fs.readFile(productOverviewPath, 'utf-8');
302
+ await fs.access(readmePath, fs.constants.F_OK);
303
+ contextSections.push(`**Repository README:** ${readmePath}\nReview this if you need additional project context.`);
302
304
  }
303
305
  catch {
304
- log.warn('Could not read product_overview.md for improvement prompt', undefined, 'prompt-service');
306
+ log.info('README.md not found when building improvement prompt context', { readmePath }, 'prompt-service');
305
307
  }
306
308
  // Add task file path to project context for improvement prompts
307
309
  const taskFilePath = this.generateTaskFilePath(task.id);
308
310
  if (taskFilePath && (await this.validateTaskFile(taskFilePath))) {
309
- productContext += `\n\n**Current task file location:** ${taskFilePath}`;
311
+ contextSections.push(`**Current task file location:** ${taskFilePath}`);
310
312
  log.info(`Task file path included in improvement prompt`, { taskId: task.id, path: taskFilePath }, 'prompt-service');
311
313
  }
314
+ const productContext = contextSections.join('\n\n');
312
315
  return render(IMPROVEMENT_TEMPLATE, {
313
316
  projectContext: productContext,
314
317
  taskId: task.id,
@@ -131,14 +131,49 @@ Test task content`;
131
131
  priority: 'high',
132
132
  content: 'Improved content',
133
133
  };
134
+ const productOverviewPath = path.join(TEST_DATA_DIR, 'product_overview.md');
135
+ const readmePath = path.join(TEST_DATA_DIR, 'README.md');
136
+ await fs.writeFile(productOverviewPath, 'Existing product overview content for context.', 'utf-8');
137
+ await fs.writeFile(readmePath, '# Workspace README\n', 'utf-8');
134
138
  // Create task file
135
139
  const taskFilePath = path.join(TEST_TASKS_DIR, 'IMPROVE-TASK-001.md');
136
140
  await fs.writeFile(taskFilePath, 'Task file content', 'utf-8');
137
141
  const prompt = await promptService.generateImprovementPrompt(mockTask, taskData);
142
+ expect(prompt).not.toContain('Existing product overview content for context.');
143
+ expect(prompt).toContain(`**Product overview file:** ${productOverviewPath}`);
144
+ expect(prompt).toContain('Reference this for additional product context.');
145
+ expect(prompt).toContain(`**Repository README:** ${readmePath}`);
146
+ expect(prompt).toContain('Review this if you need additional project context.');
138
147
  expect(prompt).toContain('Current task file location:');
139
148
  expect(prompt).toContain(taskFilePath);
140
149
  expect(prompt).toContain('IMPROVE-TASK-001');
141
150
  });
151
+ it('should include language preservation instructions in the prompt', async () => {
152
+ const mockTask = {
153
+ id: 'LANG-TEST-001',
154
+ title: 'Language Test Task',
155
+ type: 'feature',
156
+ status: 'backlog',
157
+ priority: 'medium',
158
+ tags: [],
159
+ content: 'Test content in any language',
160
+ created_at: '2024-09-04T12:00:00.000Z',
161
+ updated_at: '2024-09-04T12:00:00.000Z',
162
+ assignee: [],
163
+ comments: [],
164
+ };
165
+ const taskData = {
166
+ title: 'Tarea de prueba de idioma',
167
+ type: 'feature',
168
+ priority: 'high',
169
+ content: 'Contenido de prueba en español',
170
+ };
171
+ const prompt = await promptService.generateImprovementPrompt(mockTask, taskData);
172
+ // Verify the prompt contains language preservation instructions
173
+ expect(prompt).toContain('Detect the language of the task content');
174
+ expect(prompt).toContain('respond in that SAME language');
175
+ expect(prompt).toContain('Keep enum fields (type, priority) in English');
176
+ });
142
177
  });
143
178
  describe('generateReviewPrompt', () => {
144
179
  it('should include task file path in additional context', async () => {
@@ -6,7 +6,8 @@ import { z } from 'zod';
6
6
  /**
7
7
  * Operation types that support AI routing
8
8
  */
9
- export type RoutableOperation = 'execute_task' | 'improve_task' | 'ai_codereview' | 'ai_merge';
9
+ declare const ROUTABLE_OPERATIONS: readonly ["execute_task", "quality_checks", "ai_codereview", "ai_merge", "improve_task"];
10
+ export type RoutableOperation = (typeof ROUTABLE_OPERATIONS)[number];
10
11
  /**
11
12
  * Generation options for AI execution
12
13
  */
@@ -69,7 +70,7 @@ export type OperationConfig = z.infer<typeof OperationConfigSchema>;
69
70
  */
70
71
  export declare const RoutingPolicySchema: z.ZodObject<{
71
72
  defaultProvider: z.ZodString;
72
- operations: z.ZodOptional<z.ZodRecord<z.ZodEnum<["execute_task", "improve_task", "ai_codereview", "ai_merge"]>, z.ZodObject<{
73
+ operations: z.ZodOptional<z.ZodRecord<z.ZodEnum<["execute_task", "quality_checks", "ai_codereview", "ai_merge", "improve_task"]>, z.ZodObject<{
73
74
  provider: z.ZodString;
74
75
  model: z.ZodOptional<z.ZodString>;
75
76
  options: z.ZodOptional<z.ZodObject<{
@@ -107,7 +108,7 @@ export declare const RoutingPolicySchema: z.ZodObject<{
107
108
  }>>>;
108
109
  }, "strip", z.ZodTypeAny, {
109
110
  defaultProvider: string;
110
- operations?: Partial<Record<"execute_task" | "improve_task" | "ai_merge" | "ai_codereview", {
111
+ operations?: Partial<Record<"execute_task" | "quality_checks" | "ai_codereview" | "ai_merge" | "improve_task", {
111
112
  provider: string;
112
113
  options?: {
113
114
  temperature?: number | undefined;
@@ -119,7 +120,7 @@ export declare const RoutingPolicySchema: z.ZodObject<{
119
120
  }>> | undefined;
120
121
  }, {
121
122
  defaultProvider: string;
122
- operations?: Partial<Record<"execute_task" | "improve_task" | "ai_merge" | "ai_codereview", {
123
+ operations?: Partial<Record<"execute_task" | "quality_checks" | "ai_codereview" | "ai_merge" | "improve_task", {
123
124
  provider: string;
124
125
  options?: {
125
126
  temperature?: number | undefined;
@@ -131,6 +132,7 @@ export declare const RoutingPolicySchema: z.ZodObject<{
131
132
  }>> | undefined;
132
133
  }>;
133
134
  export type RoutingPolicy = z.infer<typeof RoutingPolicySchema>;
135
+ export declare const ROUTABLE_OPERATION_LIST: readonly ["execute_task", "quality_checks", "ai_codereview", "ai_merge", "improve_task"];
134
136
  /**
135
137
  * Resolved provider configuration for execution
136
138
  */
@@ -142,47 +144,28 @@ export interface ResolvedProvider {
142
144
  }
143
145
  /**
144
146
  * Routing Policy Manager
145
- * Manages AI provider routing policies with hot-reload capability
147
+ * Manages AI provider routing policies stored inside settings.json
146
148
  */
147
149
  export declare class RoutingPolicyManager {
148
150
  private policy;
149
- private policyFilePath;
150
- private lastModified;
151
+ private readonly settingsService;
151
152
  constructor();
152
153
  /**
153
- * Get current effective policy with hot-reload
154
+ * Get current effective policy (lazy loads from settings)
154
155
  */
155
156
  getPolicy(): Promise<RoutingPolicy>;
156
157
  /**
157
- * Update routing policy and persist to disk
158
+ * Update routing policy and persist via settings service
158
159
  */
159
160
  updatePolicy(updates: Partial<RoutingPolicy>): Promise<void>;
160
161
  /**
161
162
  * Resolve provider for a specific operation
162
163
  */
164
+ getEffectivePolicy(): Promise<RoutingPolicy>;
163
165
  resolveProviderForOperation(operation: RoutableOperation, overrides?: Partial<ResolvedProvider>): Promise<ResolvedProvider>;
164
- /**
165
- * Set default provider
166
- */
167
166
  setDefaultProvider(provider: string): Promise<void>;
168
- /**
169
- * Set operation-specific routing
170
- */
171
167
  setOperationConfig(operation: RoutableOperation, config: OperationConfig): Promise<void>;
172
- /**
173
- * Validate policy against available providers
174
- */
175
168
  validatePolicy(policy: RoutingPolicy, availableProviders: Set<string>): string[];
176
- /**
177
- * Load policy from file if it has changed
178
- */
179
- private loadPolicyIfChanged;
180
- /**
181
- * Create example policy file if it doesn't exist
182
- */
183
- createExamplePolicy(): Promise<void>;
184
- /**
185
- * Get policy file path for external access
186
- */
187
- getPolicyFilePath(): string;
169
+ private buildPolicyFromSettings;
188
170
  }
171
+ export {};