vibeman 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) 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 +4 -0
  4. package/dist/runtime/api/agent/agent-service.js +62 -3
  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.js +40 -12
  8. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.d.ts +24 -0
  9. package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.js +291 -0
  10. package/dist/runtime/api/agent/ai-providers/index.d.ts +3 -3
  11. package/dist/runtime/api/agent/ai-providers/index.js +3 -1
  12. package/dist/runtime/api/agent/ai-providers/types.d.ts +5 -2
  13. package/dist/runtime/api/agent/amp-cli-provider.test.d.ts +1 -0
  14. package/dist/runtime/api/agent/amp-cli-provider.test.js +99 -0
  15. package/dist/runtime/api/agent/codex-cli-provider.test.js +10 -8
  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 +2 -2
  19. package/dist/runtime/api/agent/routing-policy.test.js +4 -4
  20. package/dist/runtime/api/api/routers/ai.d.ts +3 -3
  21. package/dist/runtime/api/api/routers/executions.d.ts +2 -7
  22. package/dist/runtime/api/api/routers/executions.js +2 -2
  23. package/dist/runtime/api/api/routers/provider-config.d.ts +34 -0
  24. package/dist/runtime/api/api/routers/settings.d.ts +19 -0
  25. package/dist/runtime/api/api/routers/settings.js +16 -0
  26. package/dist/runtime/api/api/routers/tasks.d.ts +9 -9
  27. package/dist/runtime/api/api/routers/workflows.d.ts +12 -12
  28. package/dist/runtime/api/api/routers/worktrees.d.ts +2 -2
  29. package/dist/runtime/api/api/trpc.d.ts +16 -16
  30. package/dist/runtime/api/lib/local-config.d.ts +94 -4
  31. package/dist/runtime/api/lib/local-config.js +16 -0
  32. package/dist/runtime/api/lib/provider-detection.d.ts +2 -0
  33. package/dist/runtime/api/lib/provider-detection.js +83 -1
  34. package/dist/runtime/api/lib/server/vibeman-info.d.ts +5 -0
  35. package/dist/runtime/api/lib/server/vibeman-info.js +85 -0
  36. package/dist/runtime/api/lib/trpc/server.d.ts +63 -33
  37. package/dist/runtime/api/persistence/execution-log-persistence.d.ts +1 -1
  38. package/dist/runtime/api/persistence/execution-log-persistence.js +19 -3
  39. package/dist/runtime/api/router.d.ts +63 -33
  40. package/dist/runtime/api/settings-service.js +31 -14
  41. package/dist/runtime/api/tasks/task-file-parser.d.ts +1 -0
  42. package/dist/runtime/api/tasks/task-file-parser.js +20 -1
  43. package/dist/runtime/api/tasks/task-updater.d.ts +62 -0
  44. package/dist/runtime/api/tasks/task-updater.js +260 -0
  45. package/dist/runtime/api/tasks/task-updater.test.d.ts +1 -0
  46. package/dist/runtime/api/tasks/task-updater.test.js +303 -0
  47. package/dist/runtime/api/types/index.d.ts +1 -1
  48. package/dist/runtime/api/types/settings.d.ts +17 -6
  49. package/dist/runtime/api/vcs/git-service.d.ts +9 -0
  50. package/dist/runtime/api/vcs/git-service.js +23 -0
  51. package/dist/runtime/api/vcs/worktree-service.d.ts +1 -1
  52. package/dist/runtime/api/vcs/worktree-service.js +22 -10
  53. package/dist/runtime/api/workflows/quality-pipeline.js +2 -1
  54. package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +93 -5
  55. package/dist/runtime/api/workflows/vibing-orchestrator.js +774 -203
  56. package/dist/runtime/api/workflows/workflow-effects.d.ts +45 -0
  57. package/dist/runtime/api/workflows/workflow-effects.js +49 -0
  58. package/dist/runtime/api/workflows/workflow-reconciler.d.ts +65 -0
  59. package/dist/runtime/api/workflows/workflow-reconciler.js +226 -0
  60. package/dist/runtime/api/workflows/workflow-reducer.d.ts +26 -0
  61. package/dist/runtime/api/workflows/workflow-reducer.js +288 -0
  62. package/dist/runtime/api/workflows/workflow-reducer.test.d.ts +1 -0
  63. package/dist/runtime/api/workflows/workflow-reducer.test.js +247 -0
  64. package/dist/runtime/api/workflows/workflow-schema.d.ts +546 -0
  65. package/dist/runtime/api/workflows/workflow-schema.js +256 -0
  66. package/dist/runtime/web/.next/BUILD_ID +1 -1
  67. package/dist/runtime/web/.next/app-build-manifest.json +50 -50
  68. package/dist/runtime/web/.next/app-path-routes-manifest.json +1 -1
  69. package/dist/runtime/web/.next/build-manifest.json +14 -14
  70. package/dist/runtime/web/.next/prerender-manifest.json +3 -3
  71. package/dist/runtime/web/.next/react-loadable-manifest.json +2 -33
  72. package/dist/runtime/web/.next/required-server-files.json +5 -5
  73. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +1 -1
  74. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +1 -1
  75. package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +1 -1
  76. package/dist/runtime/web/.next/server/app/_not-found/page.js +2 -2
  77. package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  78. package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  79. package/dist/runtime/web/.next/server/app/_not-found.html +2 -2
  80. package/dist/runtime/web/.next/server/app/_not-found.rsc +12 -12
  81. package/dist/runtime/web/.next/server/app/api/health/route.js +1 -1
  82. package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +1 -1
  83. package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
  84. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +1 -1
  85. package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +1 -1
  86. package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +1 -1
  87. package/dist/runtime/web/.next/server/app/api/upload/route.js +1 -1
  88. package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +1 -1
  89. package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +1 -1
  90. package/dist/runtime/web/.next/server/app/index.html +2 -2
  91. package/dist/runtime/web/.next/server/app/index.rsc +15 -15
  92. package/dist/runtime/web/.next/server/app/page.js +27 -62
  93. package/dist/runtime/web/.next/server/app/page.js.nft.json +1 -1
  94. package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +1 -1
  95. package/dist/runtime/web/.next/server/app-paths-manifest.json +1 -1
  96. package/dist/runtime/web/.next/server/chunks/210.js +1 -0
  97. package/dist/runtime/web/.next/server/chunks/291.js +18 -0
  98. package/dist/runtime/web/.next/server/chunks/552.js +22 -0
  99. package/dist/runtime/web/.next/server/chunks/780.js +1 -0
  100. package/dist/runtime/web/.next/server/chunks/905.js +6 -0
  101. package/dist/runtime/web/.next/server/chunks/98.js +1 -0
  102. package/dist/runtime/web/.next/server/middleware-build-manifest.js +1 -1
  103. package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  104. package/dist/runtime/web/.next/server/pages/404.html +2 -2
  105. package/dist/runtime/web/.next/server/pages/500.html +1 -1
  106. package/dist/runtime/web/.next/server/pages/_app.js +1 -1
  107. package/dist/runtime/web/.next/server/pages/_app.js.nft.json +1 -1
  108. package/dist/runtime/web/.next/server/pages/_document.js +1 -1
  109. package/dist/runtime/web/.next/server/pages/_document.js.nft.json +1 -1
  110. package/dist/runtime/web/.next/server/pages/_error.js +9 -9
  111. package/dist/runtime/web/.next/server/pages/_error.js.nft.json +1 -1
  112. package/dist/runtime/web/.next/server/pages-manifest.json +1 -1
  113. package/dist/runtime/web/.next/server/server-reference-manifest.json +1 -1
  114. package/dist/runtime/web/.next/server/webpack-runtime.js +1 -1
  115. package/dist/runtime/web/.next/static/{5_15u1WQCxN1_eHZpldCv → LJFZk_8tvKFN_Ee4HqUuM}/_buildManifest.js +1 -1
  116. package/dist/runtime/web/.next/static/chunks/05c91ade-7d09b2b280adffd1.js +1 -0
  117. package/dist/runtime/web/.next/static/chunks/201-51bef3fa8c832e2e.js +1 -0
  118. package/dist/runtime/web/.next/static/chunks/524-89747ed9b0294f8a.js +1 -0
  119. package/dist/runtime/web/.next/static/chunks/554-8bec6e9cca6acc67.js +1 -0
  120. package/dist/runtime/web/.next/static/chunks/764.86e9503a69d45a85.js +1 -0
  121. package/dist/runtime/web/.next/static/chunks/{87c73c54-09e1ba5c70e60a51.js → 7ab4dc20-239138e0ae7af24a.js} +1 -1
  122. package/dist/runtime/web/.next/static/chunks/905-342391e3d3a3678f.js +20 -0
  123. package/dist/runtime/web/.next/static/chunks/a8a5ce16-4edea7df2d9b544a.js +79 -0
  124. package/dist/runtime/web/.next/static/chunks/{8bb4d8db-3e2aa02b0a2384b9.js → ad74d572-4c1b162e2c15acaa.js} +1 -1
  125. package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-7b752a8641f96c1f.js +1 -0
  126. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-34e66b251c2b5044.js +1 -0
  127. package/dist/runtime/web/.next/static/chunks/app/api/health/route-7b752a8641f96c1f.js +1 -0
  128. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-7b752a8641f96c1f.js +1 -0
  129. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-7b752a8641f96c1f.js +1 -0
  130. package/dist/runtime/web/.next/static/chunks/app/layout-df9ac93cb02b2385.js +1 -0
  131. package/dist/runtime/web/.next/static/chunks/app/page-6610743f7de5f92a.js +1 -0
  132. package/dist/runtime/web/.next/static/chunks/c25e0690-e9b798b8de667da1.js +1 -0
  133. package/dist/runtime/web/.next/static/chunks/framework-57157ec4d37f64aa.js +1 -0
  134. package/dist/runtime/web/.next/static/chunks/main-app-156cc0c60371bd78.js +1 -0
  135. package/dist/runtime/web/.next/static/chunks/main-df25d367c47b1fec.js +1 -0
  136. package/dist/runtime/web/.next/static/chunks/pages/_app-9f629a5e1131d19f.js +1 -0
  137. package/dist/runtime/web/.next/static/chunks/pages/_error-9238238274c7efcd.js +1 -0
  138. package/dist/runtime/web/.next/static/chunks/webpack-cd50e39b423d1808.js +1 -0
  139. package/dist/runtime/web/.next/static/css/4fbf378a264bd4ea.css +1 -0
  140. package/dist/runtime/web/package.json +8 -8
  141. package/dist/runtime/web/server.js +1 -1
  142. package/dist/tsconfig.tsbuildinfo +1 -1
  143. package/package.json +3 -37
  144. package/dist/runtime/api/lib/trpc/client.d.ts +0 -1
  145. package/dist/runtime/api/lib/trpc/client.js +0 -5
  146. package/dist/runtime/web/.next/server/chunks/217.js +0 -1
  147. package/dist/runtime/web/.next/server/chunks/383.js +0 -6
  148. package/dist/runtime/web/.next/server/chunks/458.js +0 -1
  149. package/dist/runtime/web/.next/server/chunks/576.js +0 -18
  150. package/dist/runtime/web/.next/server/chunks/635.js +0 -22
  151. package/dist/runtime/web/.next/server/chunks/761.js +0 -1
  152. package/dist/runtime/web/.next/server/chunks/777.js +0 -3
  153. package/dist/runtime/web/.next/server/chunks/825.js +0 -1
  154. package/dist/runtime/web/.next/server/chunks/838.js +0 -1
  155. package/dist/runtime/web/.next/server/chunks/973.js +0 -15
  156. package/dist/runtime/web/.next/static/chunks/18-15c10d3288afef2e.js +0 -1
  157. package/dist/runtime/web/.next/static/chunks/1c0ca389.537bbe362e3ffbd9.js +0 -3
  158. package/dist/runtime/web/.next/static/chunks/22747d63-ad5da0c19f4cfe41.js +0 -71
  159. package/dist/runtime/web/.next/static/chunks/355.056c2645878a799a.js +0 -1
  160. package/dist/runtime/web/.next/static/chunks/420.a5ccf151c9e2b2f1.js +0 -1
  161. package/dist/runtime/web/.next/static/chunks/439.1be0c6242fd248d5.js +0 -15
  162. package/dist/runtime/web/.next/static/chunks/440.c52e7c0f797e22b2.js +0 -1
  163. package/dist/runtime/web/.next/static/chunks/575-e2478287c27da87b.js +0 -1
  164. package/dist/runtime/web/.next/static/chunks/691.920d88c115087314.js +0 -1
  165. package/dist/runtime/web/.next/static/chunks/765-e838910065b50c3d.js +0 -1
  166. package/dist/runtime/web/.next/static/chunks/823-6f371a6e829adbba.js +0 -63
  167. package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +0 -1
  168. package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +0 -1
  169. package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-751c9265a65409e5.js +0 -1
  170. package/dist/runtime/web/.next/static/chunks/app/_not-found/page-1cb74d1cba27d0ab.js +0 -1
  171. package/dist/runtime/web/.next/static/chunks/app/api/health/route-751c9265a65409e5.js +0 -1
  172. package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-751c9265a65409e5.js +0 -1
  173. package/dist/runtime/web/.next/static/chunks/app/api/upload/route-751c9265a65409e5.js +0 -1
  174. package/dist/runtime/web/.next/static/chunks/app/layout-8435322f09fd0975.js +0 -1
  175. package/dist/runtime/web/.next/static/chunks/app/page-9fe7d75095b4ccec.js +0 -1
  176. package/dist/runtime/web/.next/static/chunks/cac567b0-5b77dd12911823cd.js +0 -1
  177. package/dist/runtime/web/.next/static/chunks/framework-2518f1345b5b2806.js +0 -1
  178. package/dist/runtime/web/.next/static/chunks/main-17665e5e39de9a8a.js +0 -1
  179. package/dist/runtime/web/.next/static/chunks/main-app-c0b0f5ba4f7f9d75.js +0 -1
  180. package/dist/runtime/web/.next/static/chunks/pages/_app-d6f6b3bbc3d81ee1.js +0 -1
  181. package/dist/runtime/web/.next/static/chunks/pages/_error-75a96cf1997cc3b9.js +0 -1
  182. package/dist/runtime/web/.next/static/chunks/webpack-c8de37305b4635cf.js +0 -1
  183. package/dist/runtime/web/.next/static/css/08c950681f1a9a92.css +0 -1
  184. /package/dist/runtime/web/.next/static/{5_15u1WQCxN1_eHZpldCv → LJFZk_8tvKFN_Ee4HqUuM}/_ssgManifest.js +0 -0
@@ -1,14 +1,18 @@
1
+ type ClaudeModel = 'claude-sonnet-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-3-5-haiku-20241022';
2
+ type CodexModel = 'gpt-5.1-codex-max' | 'gpt-5.1-codex-max-low' | 'gpt-5.1-codex-max-medium' | 'gpt-5.1-codex-max-high' | 'gpt-5.1-codex-max-extra-high' | 'gpt-5.1-codex' | 'gpt-5.1-codex-low' | 'gpt-5.1-codex-medium' | 'gpt-5.1-codex-high' | 'gpt-5.1-codex-extra-high' | 'gpt-5.1-codex-mini' | 'gpt-5.1-codex-mini-low' | 'gpt-5.1-codex-mini-medium' | 'gpt-5.1-codex-mini-high' | 'gpt-5.1-codex-mini-extra-high' | 'gpt-5.2' | 'gpt-5.2-low' | 'gpt-5.2-medium' | 'gpt-5.2-high' | 'gpt-5.2-extra-high' | 'gpt-5.1' | 'gpt-5.1-low' | 'gpt-5.1-medium' | 'gpt-5.1-high' | 'gpt-5.1-extra-high';
3
+ type GeminiModel = 'gemini-3-pro-preview' | 'gemini-3-flash-preview' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite';
4
+ type AllowedModel = ClaudeModel | CodexModel | GeminiModel | 'auto';
1
5
  export interface VibemanSettings {
2
6
  agents: {
3
- defaultProvider: 'claude-code' | 'codex';
7
+ defaultProvider: 'claude-code' | 'codex' | 'gemini' | 'amp';
4
8
  codingAgent: {
5
- provider: 'claude-code' | 'codex';
6
- model: 'claude-sonnet-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-3-5-haiku-20241022' | 'gpt-5' | 'gpt-5-low' | 'gpt-5-medium' | 'gpt-5-high' | 'gpt-5-codex' | 'gpt-5-codex-low' | 'gpt-5-codex-medium' | 'gpt-5-codex-high';
9
+ provider: 'claude-code' | 'codex' | 'gemini' | 'amp';
10
+ model: AllowedModel;
7
11
  maxTokens?: number;
8
12
  };
9
13
  judgeAgent: {
10
- provider: 'claude-code' | 'codex';
11
- model: 'claude-sonnet-4-20250514' | 'claude-opus-4-1-20250805' | 'claude-3-5-haiku-20241022' | 'gpt-5' | 'gpt-5-low' | 'gpt-5-medium' | 'gpt-5-high' | 'gpt-5-codex' | 'gpt-5-codex-low' | 'gpt-5-codex-medium' | 'gpt-5-codex-high';
14
+ provider: 'claude-code' | 'codex' | 'gemini' | 'amp';
15
+ model: AllowedModel;
12
16
  maxTokens?: number;
13
17
  reviewThresholdScore: number;
14
18
  };
@@ -23,9 +27,15 @@ export interface VibemanSettings {
23
27
  codex?: {
24
28
  binPath?: string;
25
29
  };
30
+ gemini?: {
31
+ binPath?: string;
32
+ };
33
+ amp?: {
34
+ binPath?: string;
35
+ };
26
36
  };
27
37
  routingPolicy?: {
28
- defaultProvider?: 'claude-code' | 'codex';
38
+ defaultProvider?: 'claude-code' | 'codex' | 'gemini' | 'amp';
29
39
  operations?: Partial<Record<'execute_task' | 'quality_checks' | 'ai_codereview' | 'ai_merge' | 'improve_task', {
30
40
  provider: string;
31
41
  model?: string;
@@ -92,3 +102,4 @@ export interface SettingsValidationError {
92
102
  expected?: string;
93
103
  received?: string;
94
104
  }
105
+ export {};
@@ -25,6 +25,7 @@ export declare class GitService {
25
25
  private config;
26
26
  private projectRoot;
27
27
  constructor(projectRoot?: string, config?: GitConfig);
28
+ getProjectRoot(): string;
28
29
  /**
29
30
  * Validate Git repository exists and is properly configured
30
31
  */
@@ -64,6 +65,14 @@ export declare class GitService {
64
65
  * Get Git version information
65
66
  */
66
67
  getGitVersion(): Promise<VersionResult>;
68
+ /**
69
+ * Check whether a path is ignored by git.
70
+ */
71
+ isIgnored(relativePath: string): Promise<boolean>;
72
+ /**
73
+ * Get the current HEAD commit hash
74
+ */
75
+ getHeadCommitHash(short?: boolean): Promise<string>;
67
76
  /**
68
77
  * List all worktrees in the repository
69
78
  */
@@ -7,6 +7,9 @@ export class GitService {
7
7
  this.config = config;
8
8
  this.git = simpleGit(projectRoot);
9
9
  }
10
+ getProjectRoot() {
11
+ return this.projectRoot;
12
+ }
10
13
  /**
11
14
  * Validate Git repository exists and is properly configured
12
15
  */
@@ -145,6 +148,26 @@ export class GitService {
145
148
  async getGitVersion() {
146
149
  return await this.git.version();
147
150
  }
151
+ /**
152
+ * Check whether a path is ignored by git.
153
+ */
154
+ async isIgnored(relativePath) {
155
+ try {
156
+ await this.git.raw(['check-ignore', '-q', relativePath]);
157
+ return true;
158
+ }
159
+ catch (error) {
160
+ return false;
161
+ }
162
+ }
163
+ /**
164
+ * Get the current HEAD commit hash
165
+ */
166
+ async getHeadCommitHash(short = true) {
167
+ const args = short ? ['--short', 'HEAD'] : ['HEAD'];
168
+ const hash = await this.git.revparse(args);
169
+ return hash.trim();
170
+ }
148
171
  /**
149
172
  * List all worktrees in the repository
150
173
  */
@@ -45,7 +45,7 @@ export declare class WorktreeService extends EventEmitter {
45
45
  isConnectedToTask: boolean;
46
46
  }>>;
47
47
  /**
48
- * Unified cleanup: remove branch first, then worktree
48
+ * Unified cleanup: remove worktree first, then branch
49
49
  * For connected worktrees, use taskId; for unconnected, use worktreePath and branchName
50
50
  */
51
51
  cleanupWorktree(params: {
@@ -252,6 +252,11 @@ export class WorktreeService extends EventEmitter {
252
252
  entries = [];
253
253
  }
254
254
  for (const name of entries) {
255
+ const isIgnored = await this.gitService.isIgnored(name);
256
+ if (!isIgnored) {
257
+ log.debug('Skipped non-ignored env file', { name }, 'worktree-service');
258
+ continue;
259
+ }
255
260
  const sourcePath = path.join(this.projectRoot, name);
256
261
  const targetPath = path.join(worktreePath, name);
257
262
  try {
@@ -269,8 +274,11 @@ export class WorktreeService extends EventEmitter {
269
274
  }
270
275
  }
271
276
  }
272
- catch {
273
- // target missing, proceed
277
+ catch (error) {
278
+ const err = error;
279
+ if (err?.code !== 'ENOENT') {
280
+ log.debug('Failed to inspect existing worktree env link', { name, error }, 'worktree-service');
281
+ }
274
282
  }
275
283
  if (shouldCreate) {
276
284
  // Remove any existing file/dir and create a symlink
@@ -280,8 +288,8 @@ export class WorktreeService extends EventEmitter {
280
288
  log.debug('Symlinked to worktree', { name }, 'worktree-service');
281
289
  }
282
290
  }
283
- catch {
284
- // Ignore missing source or failures
291
+ catch (error) {
292
+ log.debug('Failed to symlink env file', { name, error }, 'worktree-service');
285
293
  }
286
294
  }
287
295
  }
@@ -323,7 +331,7 @@ export class WorktreeService extends EventEmitter {
323
331
  }
324
332
  }
325
333
  /**
326
- * Unified cleanup: remove branch first, then worktree
334
+ * Unified cleanup: remove worktree first, then branch
327
335
  * For connected worktrees, use taskId; for unconnected, use worktreePath and branchName
328
336
  */
329
337
  async cleanupWorktree(params) {
@@ -355,7 +363,11 @@ export class WorktreeService extends EventEmitter {
355
363
  actualWorktreePath = worktreePath;
356
364
  actualBranchName = branchName;
357
365
  }
358
- // Step 1: Try to remove the branch first (if it's not main/master)
366
+ // Step 1: Remove the worktree
367
+ await this.gitService.removeWorktree(actualWorktreePath, force);
368
+ // Step 2: Prune worktrees to ensure git state is clean before branch deletion
369
+ await this.gitService.pruneWorktrees();
370
+ // Step 3: Try to remove the branch (if it's not main/master)
359
371
  if (actualBranchName !== 'main' && actualBranchName !== 'master') {
360
372
  try {
361
373
  await this.gitService.deleteLocalBranch(actualBranchName, true);
@@ -363,15 +375,13 @@ export class WorktreeService extends EventEmitter {
363
375
  }
364
376
  catch (error) {
365
377
  // Log but continue - branch might not exist or already deleted
366
- log.warn('Could not delete branch, continuing with worktree removal', {
378
+ log.warn('Could not delete branch after worktree removal', {
367
379
  branchName: actualBranchName,
368
380
  error: error instanceof Error ? error.message : String(error),
369
381
  }, 'worktree-service');
370
382
  }
371
383
  }
372
- // Step 2: Remove the worktree
373
- await this.gitService.removeWorktree(actualWorktreePath, force);
374
- // Step 3: Clean up tracking if it was a connected worktree
384
+ // Step 4: Clean up tracking if it was a connected worktree
375
385
  if (isConnectedToTask && taskId) {
376
386
  this.worktrees.delete(taskId);
377
387
  this.emit('worktreeDeleted', taskId);
@@ -406,6 +416,8 @@ export class WorktreeService extends EventEmitter {
406
416
  }
407
417
  // Remove worktree using git service
408
418
  await this.gitService.removeWorktree(worktree.path, force);
419
+ // Prune worktrees to ensure git state is clean before branch deletion
420
+ await this.gitService.pruneWorktrees();
409
421
  // Delete local branch if it exists and is not merged
410
422
  try {
411
423
  await this.gitService.deleteLocalBranch(worktree.branchName, force);
@@ -3,7 +3,7 @@ import { stripNextInjectedEnv } from '../utils/stripNextEnv.js';
3
3
  import { log } from '../lib/logger.js';
4
4
  import { getSettingsService } from '../settings-service.js';
5
5
  import { CoreAgentService } from '../agent/core-agent-service.js';
6
- import { ClaudeCodeAdapter, CodexCliProvider } from '../agent/ai-providers/index.js';
6
+ import { ClaudeCodeAdapter, CodexCliProvider, GeminiCliProvider, } from '../agent/ai-providers/index.js';
7
7
  import { getQualityChecksDetectionPrompt } from '../agent/prompt-service.js';
8
8
  export class QualityPipeline {
9
9
  // Expose configured checks for external orchestration/streaming
@@ -48,6 +48,7 @@ export class QualityPipeline {
48
48
  defaultModel: 'claude-sonnet-4-20250514',
49
49
  }));
50
50
  core.registerProvider('codex', new CodexCliProvider({ defaultWorkingDirectory: cwd }));
51
+ core.registerProvider('gemini', new GeminiCliProvider({ defaultWorkingDirectory: cwd }));
51
52
  const tools = ['Read', 'Grep', 'Glob'];
52
53
  const result = await core.execute({
53
54
  prompt,
@@ -5,6 +5,9 @@ import { AgentService } from '../agent/agent-service.js';
5
5
  import { WorktreeService } from '../vcs/worktree-service.js';
6
6
  import { GitService } from '../vcs/git-service.js';
7
7
  import type { ResolvedProvider } from '../agent/routing-policy.js';
8
+ import type { WorkflowEvent } from './workflow-schema.js';
9
+ import { computeNextAction } from './workflow-reducer.js';
10
+ import { type ReconcileAction } from './workflow-reconciler.js';
8
11
  export declare class VibingOrchestrator extends EventEmitter {
9
12
  private taskService;
10
13
  private agentService;
@@ -14,7 +17,13 @@ export declare class VibingOrchestrator extends EventEmitter {
14
17
  private workflows;
15
18
  private qualityPipeline;
16
19
  private workflowDB;
20
+ private taskUpdater;
17
21
  private initialized;
22
+ private activeImprovements;
23
+ private taskImprovementExecutions;
24
+ private reconciler;
25
+ private heartbeatTracker;
26
+ private idempotencyGuard;
18
27
  private computeVisibleTimeline;
19
28
  private buildTimeline;
20
29
  constructor(taskService: TaskService, agentService: AgentService, worktreeService: WorktreeService, config: VibingConfig, gitService?: GitService | undefined, persistenceDataDir?: string);
@@ -23,7 +32,53 @@ export declare class VibingOrchestrator extends EventEmitter {
23
32
  * Call this after construction to load persisted workflows
24
33
  */
25
34
  initialize(): Promise<void>;
35
+ /**
36
+ * Shutdown the orchestrator and cleanup resources
37
+ */
38
+ shutdown(): Promise<void>;
39
+ /**
40
+ * Get workflow snapshots for reconciler
41
+ */
42
+ private getWorkflowSnapshots;
43
+ /**
44
+ * Handle stuck workflow detected by reconciler
45
+ */
46
+ private handleStuckWorkflow;
47
+ /**
48
+ * Record heartbeat for active workflow execution
49
+ */
50
+ recordHeartbeat(workflowId: string): void;
51
+ /**
52
+ * Check if reconciler is running
53
+ */
54
+ isReconcilerRunning(): boolean;
55
+ /**
56
+ * Get reconcile history for debugging
57
+ */
58
+ getReconcileHistory(): ReconcileAction[];
26
59
  private normalizeWorkflow;
60
+ /**
61
+ * Convert VibingExecution to WorkflowState for the reducer
62
+ */
63
+ private toWorkflowState;
64
+ /**
65
+ * Apply WorkflowState changes back to VibingExecution (for backward compatibility)
66
+ */
67
+ private applyStateToExecution;
68
+ /**
69
+ * Create an EffectContext that binds orchestrator methods
70
+ */
71
+ private createEffectContext;
72
+ /**
73
+ * Dispatch an event to the workflow state machine (NEW API)
74
+ * This is the new way to trigger state transitions.
75
+ * Uses idempotency guard to prevent duplicate event processing.
76
+ */
77
+ dispatch(workflowId: string, event: WorkflowEvent): Promise<void>;
78
+ /**
79
+ * Get the next recommended action for a workflow (uses new state machine)
80
+ */
81
+ getNextAction(workflowId: string): ReturnType<typeof computeNextAction> | null;
27
82
  /**
28
83
  * Execute a task once (no phase management). Optionally associates with a workflow.
29
84
  */
@@ -52,6 +107,16 @@ export declare class VibingOrchestrator extends EventEmitter {
52
107
  };
53
108
  };
54
109
  listAllExecutions(): Promise<any[]>;
110
+ startTaskImprovement(taskId: string, data: {
111
+ title: string;
112
+ type: string;
113
+ priority: string;
114
+ content: string;
115
+ }, options?: {
116
+ executionId?: string;
117
+ }): Promise<{
118
+ readonly executionId: string;
119
+ }>;
55
120
  improveTaskContent(taskId: string, data: {
56
121
  title: string;
57
122
  type: string;
@@ -68,6 +133,7 @@ export declare class VibingOrchestrator extends EventEmitter {
68
133
  executionId: string;
69
134
  selectedModel?: string;
70
135
  }>;
136
+ private runTaskImprovementPipeline;
71
137
  aiReviewCode(taskId: string, reviewContext?: string, options?: {
72
138
  workflowId?: string;
73
139
  overrides?: Partial<ResolvedProvider>;
@@ -147,6 +213,10 @@ export declare class VibingOrchestrator extends EventEmitter {
147
213
  * Reject workflow and request changes
148
214
  */
149
215
  rejectWorkflow(workflowId: string, feedback: string): Promise<void>;
216
+ /**
217
+ * Helper to close a timeline item by phase
218
+ */
219
+ private closeTimelineItem;
150
220
  /**
151
221
  * Get workflow status
152
222
  */
@@ -161,9 +231,18 @@ export declare class VibingOrchestrator extends EventEmitter {
161
231
  */
162
232
  getLatestWorkflowByTask(taskId: string): VibingExecution | null;
163
233
  /**
164
- * Transition workflow to new phase
234
+ * Update UI phase with proper tracking of lastPhase, phaseHistory, and metrics.
235
+ * This is for UI-only phases that don't correspond to FSM states.
236
+ */
237
+ private updateUIPhase;
238
+ /**
239
+ * Update task file when workflow becomes ready for review
165
240
  */
166
- private transitionToPhase;
241
+ private updateTaskForReviewReadiness;
242
+ /**
243
+ * Extract context information for task updates
244
+ */
245
+ private extractTaskUpdateContext;
167
246
  /**
168
247
  * Save workflow to persistence layer
169
248
  */
@@ -174,7 +253,7 @@ export declare class VibingOrchestrator extends EventEmitter {
174
253
  private executeImplementation;
175
254
  /**
176
255
  * Public: re-run implementation phase on demand
177
- * Forces phase to 'implementing' and executes implementation again.
256
+ * Uses dispatch(RETRY) to transition FSM and trigger implementation via effect.
178
257
  */
179
258
  rerunImplementation(workflowId: string, feedback?: string, providerOverride?: {
180
259
  provider?: string;
@@ -204,11 +283,14 @@ export declare class VibingOrchestrator extends EventEmitter {
204
283
  private performAICodeReview;
205
284
  /**
206
285
  * Execute AI review as a dedicated phase
286
+ * Note: 'ai-reviewing' is a UI-only phase for timeline display, not an FSM phase.
287
+ * FSM remains in 'approved' during AI review.
207
288
  */
208
289
  private executeAiReviewPhase;
209
290
  private executeAwaitingReview;
210
291
  /**
211
292
  * Execute validation phase with quality checks
293
+ * Note: FSM has already transitioned to 'validating' via IMPL_SUCCESS event
212
294
  */
213
295
  private executeValidation;
214
296
  /**
@@ -217,9 +299,13 @@ export declare class VibingOrchestrator extends EventEmitter {
217
299
  runValidation(workflowId: string): Promise<void>;
218
300
  /**
219
301
  * Execute merge phase
302
+ * Note: FSM has already transitioned to 'merging' via APPROVE event
220
303
  */
221
304
  private executeMerge;
222
- private updateCleanupStatus;
305
+ /**
306
+ * Verify that a merge actually succeeded by checking git state
307
+ */
308
+ private verifyMergeSuccess;
223
309
  /**
224
310
  * Public: run merge phase on demand
225
311
  * This will attempt merge regardless of current phase.
@@ -230,6 +316,7 @@ export declare class VibingOrchestrator extends EventEmitter {
230
316
  }): Promise<void>;
231
317
  /**
232
318
  * Execute cleanup phase: remove worktree/branch and finalize workflow
319
+ * Note: FSM has already transitioned to 'done' via MERGE_SUCCESS event
233
320
  */
234
321
  private executeCleanup;
235
322
  /**
@@ -302,15 +389,16 @@ export declare class VibingOrchestrator extends EventEmitter {
302
389
  updateWorkflowOptions(workflowId: string, config: Partial<VibingConfig>): Promise<void>;
303
390
  /**
304
391
  * Continue workflow execution from current state
392
+ * Uses the new state machine to determine the next action
305
393
  */
306
394
  continueWorkflow(workflowId: string): Promise<void>;
307
- private computeNextActionPhase;
308
395
  private requireWorkflow;
309
396
  private getAIReviewThreshold;
310
397
  private assertPhase;
311
398
  private createNewWorkflow;
312
399
  private maybeRetryImplementation;
313
400
  private handlePhaseFailure;
401
+ private getFailEventForPhase;
314
402
  /**
315
403
  * Get the agent service instance
316
404
  */