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.
- package/dist/index.js +3 -3
- package/dist/runtime/api/.tsbuildinfo +1 -1
- package/dist/runtime/api/agent/agent-service.d.ts +11 -6
- package/dist/runtime/api/agent/agent-service.js +97 -29
- package/dist/runtime/api/agent/ai-providers/amp-cli-provider.d.ts +38 -0
- package/dist/runtime/api/agent/ai-providers/amp-cli-provider.js +268 -0
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.d.ts +2 -0
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +92 -32
- package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.d.ts +24 -0
- package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.js +291 -0
- package/dist/runtime/api/agent/ai-providers/index.d.ts +3 -3
- package/dist/runtime/api/agent/ai-providers/index.js +3 -1
- package/dist/runtime/api/agent/ai-providers/types.d.ts +5 -2
- package/dist/runtime/api/agent/amp-cli-provider.test.js +99 -0
- package/dist/runtime/api/agent/codex-cli-provider.test.js +54 -7
- package/dist/runtime/api/agent/prompt-service.js +108 -105
- package/dist/runtime/api/agent/prompt-service.test.js +35 -0
- package/dist/runtime/api/agent/routing-policy.d.ts +13 -30
- package/dist/runtime/api/agent/routing-policy.js +82 -132
- package/dist/runtime/api/agent/routing-policy.test.js +63 -0
- package/dist/runtime/api/api/routers/ai.d.ts +15 -3
- package/dist/runtime/api/api/routers/ai.js +7 -6
- package/dist/runtime/api/api/routers/executions.d.ts +3 -8
- package/dist/runtime/api/api/routers/executions.js +2 -2
- package/dist/runtime/api/api/routers/provider-config.d.ts +34 -0
- package/dist/runtime/api/api/routers/settings.d.ts +19 -0
- package/dist/runtime/api/api/routers/settings.js +16 -0
- package/dist/runtime/api/api/routers/tasks.d.ts +10 -10
- package/dist/runtime/api/api/routers/workflows.d.ts +20 -12
- package/dist/runtime/api/api/routers/workflows.js +2 -1
- package/dist/runtime/api/api/routers/worktrees.d.ts +2 -2
- package/dist/runtime/api/api/trpc.d.ts +18 -18
- package/dist/runtime/api/lib/local-config.d.ts +94 -4
- package/dist/runtime/api/lib/local-config.js +16 -0
- package/dist/runtime/api/lib/provider-detection.d.ts +2 -0
- package/dist/runtime/api/lib/provider-detection.js +83 -1
- package/dist/runtime/api/lib/server/vibeman-info.d.ts +5 -0
- package/dist/runtime/api/lib/server/vibeman-info.js +85 -0
- package/dist/runtime/api/lib/trpc/server.d.ts +85 -35
- package/dist/runtime/api/persistence/execution-log-persistence.d.ts +1 -1
- package/dist/runtime/api/persistence/execution-log-persistence.js +19 -3
- package/dist/runtime/api/router.d.ts +85 -35
- package/dist/runtime/api/settings-service.js +70 -5
- package/dist/runtime/api/tasks/task-file-parser.d.ts +1 -0
- package/dist/runtime/api/tasks/task-file-parser.js +20 -1
- package/dist/runtime/api/tasks/task-updater.d.ts +62 -0
- package/dist/runtime/api/tasks/task-updater.js +260 -0
- package/dist/runtime/api/tasks/task-updater.test.d.ts +1 -0
- package/dist/runtime/api/tasks/task-updater.test.js +303 -0
- package/dist/runtime/api/types/index.d.ts +9 -2
- package/dist/runtime/api/types/settings.d.ts +29 -5
- package/dist/runtime/api/vcs/git-service.d.ts +9 -0
- package/dist/runtime/api/vcs/git-service.js +23 -0
- package/dist/runtime/api/vcs/worktree-service.d.ts +1 -1
- package/dist/runtime/api/vcs/worktree-service.js +22 -10
- package/dist/runtime/api/workflows/quality-pipeline.js +2 -1
- package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +93 -5
- package/dist/runtime/api/workflows/vibing-orchestrator.js +806 -204
- package/dist/runtime/api/workflows/workflow-effects.d.ts +45 -0
- package/dist/runtime/api/workflows/workflow-effects.js +49 -0
- package/dist/runtime/api/workflows/workflow-reconciler.d.ts +65 -0
- package/dist/runtime/api/workflows/workflow-reconciler.js +226 -0
- package/dist/runtime/api/workflows/workflow-reducer.d.ts +26 -0
- package/dist/runtime/api/workflows/workflow-reducer.js +288 -0
- package/dist/runtime/api/workflows/workflow-reducer.test.d.ts +1 -0
- package/dist/runtime/api/workflows/workflow-reducer.test.js +247 -0
- package/dist/runtime/api/workflows/workflow-schema.d.ts +546 -0
- package/dist/runtime/api/workflows/workflow-schema.js +256 -0
- package/dist/runtime/web/.next/BUILD_ID +1 -1
- package/dist/runtime/web/.next/app-build-manifest.json +51 -44
- package/dist/runtime/web/.next/app-path-routes-manifest.json +2 -1
- package/dist/runtime/web/.next/build-manifest.json +14 -14
- package/dist/runtime/web/.next/prerender-manifest.json +10 -10
- package/dist/runtime/web/.next/react-loadable-manifest.json +2 -33
- package/dist/runtime/web/.next/required-server-files.json +5 -5
- package/dist/runtime/web/.next/routes-manifest.json +8 -0
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +1 -0
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +1 -0
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +1 -0
- package/dist/runtime/web/.next/server/app/_not-found/page.js +2 -2
- package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/runtime/web/.next/server/app/_not-found.html +2 -2
- package/dist/runtime/web/.next/server/app/_not-found.rsc +12 -12
- package/dist/runtime/web/.next/server/app/api/health/route.js +1 -1
- package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +1 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +1 -1
- package/dist/runtime/web/.next/server/app/api/upload/route.js +1 -1
- package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +1 -1
- package/dist/runtime/web/.next/server/app/index.html +2 -2
- package/dist/runtime/web/.next/server/app/index.rsc +15 -15
- package/dist/runtime/web/.next/server/app/page.js +27 -62
- package/dist/runtime/web/.next/server/app/page.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/runtime/web/.next/server/app-paths-manifest.json +2 -1
- package/dist/runtime/web/.next/server/chunks/210.js +1 -0
- package/dist/runtime/web/.next/server/chunks/291.js +18 -0
- package/dist/runtime/web/.next/server/chunks/552.js +22 -0
- package/dist/runtime/web/.next/server/chunks/780.js +1 -0
- package/dist/runtime/web/.next/server/chunks/905.js +6 -0
- package/dist/runtime/web/.next/server/chunks/98.js +1 -0
- package/dist/runtime/web/.next/server/middleware-build-manifest.js +1 -1
- package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/runtime/web/.next/server/pages/404.html +2 -2
- package/dist/runtime/web/.next/server/pages/500.html +1 -1
- package/dist/runtime/web/.next/server/pages/_app.js +1 -1
- package/dist/runtime/web/.next/server/pages/_app.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/pages/_document.js +1 -1
- package/dist/runtime/web/.next/server/pages/_document.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/pages/_error.js +9 -9
- package/dist/runtime/web/.next/server/pages/_error.js.nft.json +1 -1
- package/dist/runtime/web/.next/server/pages-manifest.json +1 -1
- package/dist/runtime/web/.next/server/server-reference-manifest.json +1 -1
- package/dist/runtime/web/.next/server/webpack-runtime.js +1 -1
- package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_buildManifest.js +1 -0
- package/dist/runtime/web/.next/static/chunks/05c91ade-7d09b2b280adffd1.js +1 -0
- package/dist/runtime/web/.next/static/chunks/201-51bef3fa8c832e2e.js +1 -0
- package/dist/runtime/web/.next/static/chunks/524-89747ed9b0294f8a.js +1 -0
- package/dist/runtime/web/.next/static/chunks/554-8bec6e9cca6acc67.js +1 -0
- package/dist/runtime/web/.next/static/chunks/764.86e9503a69d45a85.js +1 -0
- package/dist/runtime/web/.next/static/chunks/{87c73c54-09e1ba5c70e60a51.js → 7ab4dc20-239138e0ae7af24a.js} +1 -1
- package/dist/runtime/web/.next/static/chunks/905-342391e3d3a3678f.js +20 -0
- package/dist/runtime/web/.next/static/chunks/a8a5ce16-4edea7df2d9b544a.js +79 -0
- package/dist/runtime/web/.next/static/chunks/{8bb4d8db-3e2aa02b0a2384b9.js → ad74d572-4c1b162e2c15acaa.js} +1 -1
- package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-7b752a8641f96c1f.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/_not-found/page-34e66b251c2b5044.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/api/health/route-7b752a8641f96c1f.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-7b752a8641f96c1f.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/api/upload/route-7b752a8641f96c1f.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/layout-df9ac93cb02b2385.js +1 -0
- package/dist/runtime/web/.next/static/chunks/app/page-6610743f7de5f92a.js +1 -0
- package/dist/runtime/web/.next/static/chunks/c25e0690-e9b798b8de667da1.js +1 -0
- package/dist/runtime/web/.next/static/chunks/framework-57157ec4d37f64aa.js +1 -0
- package/dist/runtime/web/.next/static/chunks/main-app-156cc0c60371bd78.js +1 -0
- package/dist/runtime/web/.next/static/chunks/main-df25d367c47b1fec.js +1 -0
- package/dist/runtime/web/.next/static/chunks/pages/_app-9f629a5e1131d19f.js +1 -0
- package/dist/runtime/web/.next/static/chunks/pages/_error-9238238274c7efcd.js +1 -0
- package/dist/runtime/web/.next/static/chunks/webpack-cd50e39b423d1808.js +1 -0
- package/dist/runtime/web/.next/static/css/4fbf378a264bd4ea.css +1 -0
- package/dist/runtime/web/package.json +8 -8
- package/dist/runtime/web/server.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -37
- package/dist/runtime/api/lib/image-paste-drop-extension.d.ts +0 -26
- package/dist/runtime/api/lib/image-paste-drop-extension.js +0 -125
- package/dist/runtime/api/lib/markdown-utils.d.ts +0 -8
- package/dist/runtime/api/lib/markdown-utils.js +0 -282
- package/dist/runtime/api/lib/markdown-utils.test.js +0 -348
- package/dist/runtime/api/lib/tiptap-utils.clamp-selection.test.js +0 -27
- package/dist/runtime/api/lib/tiptap-utils.d.ts +0 -130
- package/dist/runtime/api/lib/tiptap-utils.js +0 -327
- package/dist/runtime/api/lib/trpc/client.d.ts +0 -1
- package/dist/runtime/api/lib/trpc/client.js +0 -5
- package/dist/runtime/web/.next/server/chunks/217.js +0 -1
- package/dist/runtime/web/.next/server/chunks/383.js +0 -6
- package/dist/runtime/web/.next/server/chunks/458.js +0 -1
- package/dist/runtime/web/.next/server/chunks/576.js +0 -18
- package/dist/runtime/web/.next/server/chunks/635.js +0 -22
- package/dist/runtime/web/.next/server/chunks/761.js +0 -1
- package/dist/runtime/web/.next/server/chunks/777.js +0 -3
- package/dist/runtime/web/.next/server/chunks/825.js +0 -1
- package/dist/runtime/web/.next/server/chunks/838.js +0 -1
- package/dist/runtime/web/.next/server/chunks/973.js +0 -15
- package/dist/runtime/web/.next/static/chunks/18-15c10d3288afef2e.js +0 -1
- package/dist/runtime/web/.next/static/chunks/1c0ca389.537bbe362e3ffbd9.js +0 -3
- package/dist/runtime/web/.next/static/chunks/22747d63-ad5da0c19f4cfe41.js +0 -71
- package/dist/runtime/web/.next/static/chunks/277-0142a939f08738c3.js +0 -63
- package/dist/runtime/web/.next/static/chunks/355.056c2645878a799a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/420.a5ccf151c9e2b2f1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/439.1be0c6242fd248d5.js +0 -15
- package/dist/runtime/web/.next/static/chunks/440.c52e7c0f797e22b2.js +0 -1
- package/dist/runtime/web/.next/static/chunks/575-e2478287c27da87b.js +0 -1
- package/dist/runtime/web/.next/static/chunks/691.920d88c115087314.js +0 -1
- package/dist/runtime/web/.next/static/chunks/765-e838910065b50c3d.js +0 -1
- package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +0 -1
- package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/_not-found/page-1cb74d1cba27d0ab.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/health/route-105a61ae865ba536.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-105a61ae865ba536.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/upload/route-105a61ae865ba536.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/layout-8435322f09fd0975.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/page-8c3ba579efc6f918.js +0 -1
- package/dist/runtime/web/.next/static/chunks/cac567b0-5b77dd12911823cd.js +0 -1
- package/dist/runtime/web/.next/static/chunks/framework-2518f1345b5b2806.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-17665e5e39de9a8a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-app-c0b0f5ba4f7f9d75.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_app-d6f6b3bbc3d81ee1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_error-75a96cf1997cc3b9.js +0 -1
- package/dist/runtime/web/.next/static/chunks/webpack-c8de37305b4635cf.js +0 -1
- package/dist/runtime/web/.next/static/css/08c950681f1a9a92.css +0 -1
- package/dist/runtime/web/.next/static/mRpNgPfbYR_0wrODzlg_4/_buildManifest.js +0 -1
- /package/dist/runtime/api/{lib/markdown-utils.test.d.ts → agent/amp-cli-provider.test.d.ts} +0 -0
- /package/dist/runtime/api/{lib/tiptap-utils.clamp-selection.test.d.ts → agent/routing-policy.test.d.ts} +0 -0
- /package/dist/runtime/web/.next/static/{mRpNgPfbYR_0wrODzlg_4 → LJFZk_8tvKFN_Ee4HqUuM}/_ssgManifest.js +0 -0
|
@@ -5,21 +5,24 @@ type Deps = {
|
|
|
5
5
|
export declare function buildWorkflowRoutes({ vibingOrchestrator }: Deps): {
|
|
6
6
|
readonly updateWorkflowOptions: import("@trpc/server").TRPCMutationProcedure<{
|
|
7
7
|
input: {
|
|
8
|
-
workflowId: string;
|
|
9
8
|
config: {
|
|
10
|
-
autoCommit?: boolean | undefined;
|
|
11
|
-
createPR?: boolean | undefined;
|
|
12
9
|
autoQualityChecks?: boolean | undefined;
|
|
13
10
|
requireHumanApproval?: boolean | undefined;
|
|
11
|
+
aiCodeReview?: boolean | undefined;
|
|
12
|
+
autoCommit?: boolean | undefined;
|
|
13
|
+
createPR?: boolean | undefined;
|
|
14
14
|
stepByStepMode?: boolean | undefined;
|
|
15
15
|
autoMerge?: boolean | undefined;
|
|
16
|
-
aiCodeReview?: boolean | undefined;
|
|
17
16
|
aiRoutingOverrides?: {
|
|
18
17
|
execute_task?: {
|
|
19
18
|
provider?: string | undefined;
|
|
20
19
|
model?: string | undefined;
|
|
21
20
|
} | undefined;
|
|
22
|
-
|
|
21
|
+
quality_checks?: {
|
|
22
|
+
provider?: string | undefined;
|
|
23
|
+
model?: string | undefined;
|
|
24
|
+
} | undefined;
|
|
25
|
+
ai_codereview?: {
|
|
23
26
|
provider?: string | undefined;
|
|
24
27
|
model?: string | undefined;
|
|
25
28
|
} | undefined;
|
|
@@ -27,12 +30,13 @@ export declare function buildWorkflowRoutes({ vibingOrchestrator }: Deps): {
|
|
|
27
30
|
provider?: string | undefined;
|
|
28
31
|
model?: string | undefined;
|
|
29
32
|
} | undefined;
|
|
30
|
-
|
|
33
|
+
improve_task?: {
|
|
31
34
|
provider?: string | undefined;
|
|
32
35
|
model?: string | undefined;
|
|
33
36
|
} | undefined;
|
|
34
37
|
} | undefined;
|
|
35
38
|
};
|
|
39
|
+
workflowId: string;
|
|
36
40
|
};
|
|
37
41
|
output: {
|
|
38
42
|
readonly success: true;
|
|
@@ -43,19 +47,23 @@ export declare function buildWorkflowRoutes({ vibingOrchestrator }: Deps): {
|
|
|
43
47
|
input: {
|
|
44
48
|
taskId: string;
|
|
45
49
|
config?: {
|
|
46
|
-
autoCommit?: boolean | undefined;
|
|
47
|
-
createPR?: boolean | undefined;
|
|
48
50
|
autoQualityChecks?: boolean | undefined;
|
|
49
51
|
requireHumanApproval?: boolean | undefined;
|
|
52
|
+
aiCodeReview?: boolean | undefined;
|
|
53
|
+
autoCommit?: boolean | undefined;
|
|
54
|
+
createPR?: boolean | undefined;
|
|
50
55
|
stepByStepMode?: boolean | undefined;
|
|
51
56
|
autoMerge?: boolean | undefined;
|
|
52
|
-
aiCodeReview?: boolean | undefined;
|
|
53
57
|
aiRoutingOverrides?: {
|
|
54
58
|
execute_task?: {
|
|
55
59
|
provider?: string | undefined;
|
|
56
60
|
model?: string | undefined;
|
|
57
61
|
} | undefined;
|
|
58
|
-
|
|
62
|
+
quality_checks?: {
|
|
63
|
+
provider?: string | undefined;
|
|
64
|
+
model?: string | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
ai_codereview?: {
|
|
59
67
|
provider?: string | undefined;
|
|
60
68
|
model?: string | undefined;
|
|
61
69
|
} | undefined;
|
|
@@ -63,7 +71,7 @@ export declare function buildWorkflowRoutes({ vibingOrchestrator }: Deps): {
|
|
|
63
71
|
provider?: string | undefined;
|
|
64
72
|
model?: string | undefined;
|
|
65
73
|
} | undefined;
|
|
66
|
-
|
|
74
|
+
improve_task?: {
|
|
67
75
|
provider?: string | undefined;
|
|
68
76
|
model?: string | undefined;
|
|
69
77
|
} | undefined;
|
|
@@ -191,8 +199,8 @@ export declare function buildWorkflowRoutes({ vibingOrchestrator }: Deps): {
|
|
|
191
199
|
input: {
|
|
192
200
|
taskId: string;
|
|
193
201
|
provider?: string | undefined;
|
|
194
|
-
workflowId?: string | undefined;
|
|
195
202
|
model?: string | undefined;
|
|
203
|
+
workflowId?: string | undefined;
|
|
196
204
|
reviewContext?: string | undefined;
|
|
197
205
|
};
|
|
198
206
|
output: {
|
|
@@ -10,9 +10,10 @@ export function buildWorkflowRoutes({ vibingOrchestrator }) {
|
|
|
10
10
|
const WorkflowAIRoutingOverrides = z
|
|
11
11
|
.object({
|
|
12
12
|
execute_task: OperationOverrideSchema.optional(),
|
|
13
|
-
|
|
13
|
+
quality_checks: OperationOverrideSchema.optional(),
|
|
14
14
|
ai_codereview: OperationOverrideSchema.optional(),
|
|
15
15
|
ai_merge: OperationOverrideSchema.optional(),
|
|
16
|
+
improve_task: OperationOverrideSchema.optional(),
|
|
16
17
|
})
|
|
17
18
|
.partial();
|
|
18
19
|
const WorkflowConfig = z.object({
|
|
@@ -87,9 +87,9 @@ export declare function buildWorktreeRoutes({ vibingOrchestrator }: Deps): {
|
|
|
87
87
|
readonly cleanupWorktree: import("@trpc/server").TRPCMutationProcedure<{
|
|
88
88
|
input: {
|
|
89
89
|
isConnectedToTask: boolean;
|
|
90
|
-
taskId?: string | undefined;
|
|
91
|
-
force?: boolean | undefined;
|
|
92
90
|
worktreePath?: string | undefined;
|
|
91
|
+
force?: boolean | undefined;
|
|
92
|
+
taskId?: string | undefined;
|
|
93
93
|
branchName?: string | undefined;
|
|
94
94
|
};
|
|
95
95
|
output: {
|
|
@@ -31,26 +31,26 @@ export declare const TaskCreateSchema: z.ZodObject<{
|
|
|
31
31
|
comments: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
32
32
|
content: z.ZodString;
|
|
33
33
|
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
status: "review" | "in-progress" | "backlog" | "done";
|
|
35
|
-
title: string;
|
|
36
34
|
type: "feature" | "bug" | "chore" | "refactor" | "test" | "doc";
|
|
35
|
+
status: "backlog" | "in-progress" | "review" | "done";
|
|
36
|
+
priority: "low" | "medium" | "high";
|
|
37
|
+
title: string;
|
|
37
38
|
tags: string[];
|
|
38
39
|
assignee: string[];
|
|
39
|
-
priority: "high" | "medium" | "low";
|
|
40
40
|
comments: string[];
|
|
41
41
|
content: string;
|
|
42
42
|
id?: string | undefined;
|
|
43
43
|
due_date?: string | undefined;
|
|
44
44
|
}, {
|
|
45
|
-
title: string;
|
|
46
45
|
type: "feature" | "bug" | "chore" | "refactor" | "test" | "doc";
|
|
46
|
+
title: string;
|
|
47
47
|
content: string;
|
|
48
|
-
status?: "
|
|
48
|
+
status?: "backlog" | "in-progress" | "review" | "done" | undefined;
|
|
49
|
+
priority?: "low" | "medium" | "high" | undefined;
|
|
49
50
|
id?: string | undefined;
|
|
50
51
|
tags?: string[] | undefined;
|
|
51
52
|
due_date?: string | undefined;
|
|
52
53
|
assignee?: string[] | undefined;
|
|
53
|
-
priority?: "high" | "medium" | "low" | undefined;
|
|
54
54
|
comments?: string[] | undefined;
|
|
55
55
|
}>;
|
|
56
56
|
export declare const TaskUpdateSchema: z.ZodObject<{
|
|
@@ -68,25 +68,25 @@ export declare const TaskUpdateSchema: z.ZodObject<{
|
|
|
68
68
|
deleted_at: z.ZodOptional<z.ZodString>;
|
|
69
69
|
}, "strip", z.ZodTypeAny, {
|
|
70
70
|
id: string;
|
|
71
|
-
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
72
|
-
title?: string | undefined;
|
|
73
71
|
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
72
|
+
status?: "backlog" | "in-progress" | "review" | "done" | undefined;
|
|
73
|
+
priority?: "low" | "medium" | "high" | undefined;
|
|
74
|
+
title?: string | undefined;
|
|
74
75
|
tags?: string[] | undefined;
|
|
75
76
|
due_date?: string | undefined;
|
|
76
77
|
assignee?: string[] | undefined;
|
|
77
|
-
priority?: "high" | "medium" | "low" | undefined;
|
|
78
78
|
comments?: string[] | undefined;
|
|
79
79
|
content?: string | undefined;
|
|
80
80
|
deleted_at?: string | undefined;
|
|
81
81
|
}, {
|
|
82
82
|
id: string;
|
|
83
|
-
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
84
|
-
title?: string | undefined;
|
|
85
83
|
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
84
|
+
status?: "backlog" | "in-progress" | "review" | "done" | undefined;
|
|
85
|
+
priority?: "low" | "medium" | "high" | undefined;
|
|
86
|
+
title?: string | undefined;
|
|
86
87
|
tags?: string[] | undefined;
|
|
87
88
|
due_date?: string | undefined;
|
|
88
89
|
assignee?: string[] | undefined;
|
|
89
|
-
priority?: "high" | "medium" | "low" | undefined;
|
|
90
90
|
comments?: string[] | undefined;
|
|
91
91
|
content?: string | undefined;
|
|
92
92
|
deleted_at?: string | undefined;
|
|
@@ -100,19 +100,19 @@ export declare const TaskFilterSchema: z.ZodObject<{
|
|
|
100
100
|
includeDeleted: z.ZodOptional<z.ZodBoolean>;
|
|
101
101
|
onlyDeleted: z.ZodOptional<z.ZodBoolean>;
|
|
102
102
|
}, "strip", z.ZodTypeAny, {
|
|
103
|
-
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
104
103
|
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
105
|
-
|
|
106
|
-
priority?: "
|
|
104
|
+
status?: "backlog" | "in-progress" | "review" | "done" | undefined;
|
|
105
|
+
priority?: "low" | "medium" | "high" | undefined;
|
|
107
106
|
search?: string | undefined;
|
|
107
|
+
tags?: string[] | undefined;
|
|
108
108
|
includeDeleted?: boolean | undefined;
|
|
109
109
|
onlyDeleted?: boolean | undefined;
|
|
110
110
|
}, {
|
|
111
|
-
status?: "review" | "in-progress" | "backlog" | "done" | undefined;
|
|
112
111
|
type?: "feature" | "bug" | "chore" | "refactor" | "test" | "doc" | undefined;
|
|
113
|
-
|
|
114
|
-
priority?: "
|
|
112
|
+
status?: "backlog" | "in-progress" | "review" | "done" | undefined;
|
|
113
|
+
priority?: "low" | "medium" | "high" | undefined;
|
|
115
114
|
search?: string | undefined;
|
|
115
|
+
tags?: string[] | undefined;
|
|
116
116
|
includeDeleted?: boolean | undefined;
|
|
117
117
|
onlyDeleted?: boolean | undefined;
|
|
118
118
|
}>;
|
|
@@ -38,6 +38,38 @@ declare const LocalConfigSchema: z.ZodObject<{
|
|
|
38
38
|
lastDetected?: string | undefined;
|
|
39
39
|
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
40
40
|
}>>;
|
|
41
|
+
gemini: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
binPath: z.ZodOptional<z.ZodString>;
|
|
43
|
+
detectedPath: z.ZodOptional<z.ZodString>;
|
|
44
|
+
lastDetected: z.ZodOptional<z.ZodString>;
|
|
45
|
+
detectionMethod: z.ZodOptional<z.ZodEnum<["explicit", "PATH", "common-location"]>>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
binPath?: string | undefined;
|
|
48
|
+
detectedPath?: string | undefined;
|
|
49
|
+
lastDetected?: string | undefined;
|
|
50
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
binPath?: string | undefined;
|
|
53
|
+
detectedPath?: string | undefined;
|
|
54
|
+
lastDetected?: string | undefined;
|
|
55
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
56
|
+
}>>;
|
|
57
|
+
amp: z.ZodOptional<z.ZodObject<{
|
|
58
|
+
binPath: z.ZodOptional<z.ZodString>;
|
|
59
|
+
detectedPath: z.ZodOptional<z.ZodString>;
|
|
60
|
+
lastDetected: z.ZodOptional<z.ZodString>;
|
|
61
|
+
detectionMethod: z.ZodOptional<z.ZodEnum<["explicit", "PATH", "common-location"]>>;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
binPath?: string | undefined;
|
|
64
|
+
detectedPath?: string | undefined;
|
|
65
|
+
lastDetected?: string | undefined;
|
|
66
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
binPath?: string | undefined;
|
|
69
|
+
detectedPath?: string | undefined;
|
|
70
|
+
lastDetected?: string | undefined;
|
|
71
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
72
|
+
}>>;
|
|
41
73
|
}, "strip", z.ZodTypeAny, {
|
|
42
74
|
'claude-code'?: {
|
|
43
75
|
binPath?: string | undefined;
|
|
@@ -51,6 +83,18 @@ declare const LocalConfigSchema: z.ZodObject<{
|
|
|
51
83
|
lastDetected?: string | undefined;
|
|
52
84
|
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
53
85
|
} | undefined;
|
|
86
|
+
gemini?: {
|
|
87
|
+
binPath?: string | undefined;
|
|
88
|
+
detectedPath?: string | undefined;
|
|
89
|
+
lastDetected?: string | undefined;
|
|
90
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
amp?: {
|
|
93
|
+
binPath?: string | undefined;
|
|
94
|
+
detectedPath?: string | undefined;
|
|
95
|
+
lastDetected?: string | undefined;
|
|
96
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
97
|
+
} | undefined;
|
|
54
98
|
}, {
|
|
55
99
|
'claude-code'?: {
|
|
56
100
|
binPath?: string | undefined;
|
|
@@ -64,6 +108,18 @@ declare const LocalConfigSchema: z.ZodObject<{
|
|
|
64
108
|
lastDetected?: string | undefined;
|
|
65
109
|
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
66
110
|
} | undefined;
|
|
111
|
+
gemini?: {
|
|
112
|
+
binPath?: string | undefined;
|
|
113
|
+
detectedPath?: string | undefined;
|
|
114
|
+
lastDetected?: string | undefined;
|
|
115
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
116
|
+
} | undefined;
|
|
117
|
+
amp?: {
|
|
118
|
+
binPath?: string | undefined;
|
|
119
|
+
detectedPath?: string | undefined;
|
|
120
|
+
lastDetected?: string | undefined;
|
|
121
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
122
|
+
} | undefined;
|
|
67
123
|
}>>;
|
|
68
124
|
cache: z.ZodOptional<z.ZodObject<{
|
|
69
125
|
lastProviderValidation: z.ZodOptional<z.ZodString>;
|
|
@@ -114,6 +170,18 @@ declare const LocalConfigSchema: z.ZodObject<{
|
|
|
114
170
|
lastDetected?: string | undefined;
|
|
115
171
|
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
116
172
|
} | undefined;
|
|
173
|
+
gemini?: {
|
|
174
|
+
binPath?: string | undefined;
|
|
175
|
+
detectedPath?: string | undefined;
|
|
176
|
+
lastDetected?: string | undefined;
|
|
177
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
178
|
+
} | undefined;
|
|
179
|
+
amp?: {
|
|
180
|
+
binPath?: string | undefined;
|
|
181
|
+
detectedPath?: string | undefined;
|
|
182
|
+
lastDetected?: string | undefined;
|
|
183
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
184
|
+
} | undefined;
|
|
117
185
|
} | undefined;
|
|
118
186
|
cache?: {
|
|
119
187
|
lastProviderValidation?: string | undefined;
|
|
@@ -138,6 +206,18 @@ declare const LocalConfigSchema: z.ZodObject<{
|
|
|
138
206
|
lastDetected?: string | undefined;
|
|
139
207
|
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
140
208
|
} | undefined;
|
|
209
|
+
gemini?: {
|
|
210
|
+
binPath?: string | undefined;
|
|
211
|
+
detectedPath?: string | undefined;
|
|
212
|
+
lastDetected?: string | undefined;
|
|
213
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
214
|
+
} | undefined;
|
|
215
|
+
amp?: {
|
|
216
|
+
binPath?: string | undefined;
|
|
217
|
+
detectedPath?: string | undefined;
|
|
218
|
+
lastDetected?: string | undefined;
|
|
219
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
220
|
+
} | undefined;
|
|
141
221
|
} | undefined;
|
|
142
222
|
cache?: {
|
|
143
223
|
lastProviderValidation?: string | undefined;
|
|
@@ -174,7 +254,17 @@ export declare class LocalConfigService extends EventEmitter {
|
|
|
174
254
|
/**
|
|
175
255
|
* Get provider-specific configuration
|
|
176
256
|
*/
|
|
177
|
-
getProviderConfig(provider: 'claude-code' | 'codex'): {
|
|
257
|
+
getProviderConfig(provider: 'claude-code' | 'codex' | 'gemini' | 'amp'): {
|
|
258
|
+
binPath?: string | undefined;
|
|
259
|
+
detectedPath?: string | undefined;
|
|
260
|
+
lastDetected?: string | undefined;
|
|
261
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
262
|
+
} | {
|
|
263
|
+
binPath?: string | undefined;
|
|
264
|
+
detectedPath?: string | undefined;
|
|
265
|
+
lastDetected?: string | undefined;
|
|
266
|
+
detectionMethod?: "explicit" | "PATH" | "common-location" | undefined;
|
|
267
|
+
} | {
|
|
178
268
|
binPath?: string | undefined;
|
|
179
269
|
detectedPath?: string | undefined;
|
|
180
270
|
lastDetected?: string | undefined;
|
|
@@ -188,12 +278,12 @@ export declare class LocalConfigService extends EventEmitter {
|
|
|
188
278
|
/**
|
|
189
279
|
* Set provider binary path and detection info
|
|
190
280
|
*/
|
|
191
|
-
setProviderPath(provider: 'claude-code' | 'codex', binPath: string, detectionMethod?: 'explicit' | 'PATH' | 'common-location'): Promise<void>;
|
|
192
|
-
updateDetectedProvider(provider: 'claude-code' | 'codex', detectedPath: string, detectionMethod?: 'PATH' | 'common-location'): Promise<void>;
|
|
281
|
+
setProviderPath(provider: 'claude-code' | 'codex' | 'gemini' | 'amp', binPath: string, detectionMethod?: 'explicit' | 'PATH' | 'common-location'): Promise<void>;
|
|
282
|
+
updateDetectedProvider(provider: 'claude-code' | 'codex' | 'gemini' | 'amp', detectedPath: string, detectionMethod?: 'PATH' | 'common-location'): Promise<void>;
|
|
193
283
|
/**
|
|
194
284
|
* Clear provider configuration
|
|
195
285
|
*/
|
|
196
|
-
clearProviderPath(provider: 'claude-code' | 'codex'): Promise<void>;
|
|
286
|
+
clearProviderPath(provider: 'claude-code' | 'codex' | 'gemini' | 'amp'): Promise<void>;
|
|
197
287
|
/**
|
|
198
288
|
* Cache provider validation results
|
|
199
289
|
*/
|
|
@@ -28,6 +28,22 @@ const LocalConfigSchema = z.object({
|
|
|
28
28
|
detectionMethod: z.enum(['explicit', 'PATH', 'common-location']).optional(),
|
|
29
29
|
})
|
|
30
30
|
.optional(),
|
|
31
|
+
gemini: z
|
|
32
|
+
.object({
|
|
33
|
+
binPath: z.string().optional(),
|
|
34
|
+
detectedPath: z.string().optional(),
|
|
35
|
+
lastDetected: z.string().optional(), // ISO date
|
|
36
|
+
detectionMethod: z.enum(['explicit', 'PATH', 'common-location']).optional(),
|
|
37
|
+
})
|
|
38
|
+
.optional(),
|
|
39
|
+
amp: z
|
|
40
|
+
.object({
|
|
41
|
+
binPath: z.string().optional(),
|
|
42
|
+
detectedPath: z.string().optional(),
|
|
43
|
+
lastDetected: z.string().optional(), // ISO date
|
|
44
|
+
detectionMethod: z.enum(['explicit', 'PATH', 'common-location']).optional(),
|
|
45
|
+
})
|
|
46
|
+
.optional(),
|
|
31
47
|
})
|
|
32
48
|
.optional(),
|
|
33
49
|
cache: z
|
|
@@ -51,9 +51,11 @@ export declare class ProviderDetectionService {
|
|
|
51
51
|
getCachedResult(providerId: string): Promise<DetectionResult | null>;
|
|
52
52
|
private checkExplicitConfig;
|
|
53
53
|
private checkSystemCommand;
|
|
54
|
+
private checkEnvOverride;
|
|
54
55
|
private getVersion;
|
|
55
56
|
private resolveCommand;
|
|
56
57
|
private toLocalConfigKey;
|
|
57
58
|
private cacheDetectionResult;
|
|
59
|
+
private isVersionLessThan;
|
|
58
60
|
}
|
|
59
61
|
export declare function getProviderDetectionService(): ProviderDetectionService;
|
|
@@ -10,6 +10,7 @@ import { log } from './logger.js';
|
|
|
10
10
|
import { getLocalConfigService } from './local-config.js';
|
|
11
11
|
const execAsync = promisify(exec);
|
|
12
12
|
const execFileAsync = promisify(execFile);
|
|
13
|
+
const MIN_CODEX_CLI_VERSION = '0.73.0';
|
|
13
14
|
/**
|
|
14
15
|
* Provider definitions for detection
|
|
15
16
|
*/
|
|
@@ -26,6 +27,19 @@ export const PROVIDER_DEFINITIONS = {
|
|
|
26
27
|
versionArgsList: [['--version'], ['-v']],
|
|
27
28
|
versionRegex: /(\d+\.\d+\.\d+)/,
|
|
28
29
|
},
|
|
30
|
+
gemini: {
|
|
31
|
+
name: 'Gemini CLI',
|
|
32
|
+
command: 'gemini',
|
|
33
|
+
versionArgsList: [['--version'], ['-v']],
|
|
34
|
+
// Capture a semantic version or generic version-like token
|
|
35
|
+
versionRegex: /(\d+\.\d+\.\d+|\d+\.\d+|[0-9a-zA-Z_.-]+)/,
|
|
36
|
+
},
|
|
37
|
+
amp: {
|
|
38
|
+
name: 'Amp CLI',
|
|
39
|
+
command: 'amp',
|
|
40
|
+
versionArgsList: [['--version'], ['-v']],
|
|
41
|
+
versionRegex: /(\d+\.\d+\.\d+)/,
|
|
42
|
+
},
|
|
29
43
|
};
|
|
30
44
|
/**
|
|
31
45
|
* Enhanced Provider Detection Service
|
|
@@ -50,6 +64,12 @@ export class ProviderDetectionService {
|
|
|
50
64
|
};
|
|
51
65
|
}
|
|
52
66
|
log.debug(`Detecting provider: ${provider.name}`, { providerId }, 'provider-detection');
|
|
67
|
+
// Strategy 0: Explicit environment override (e.g., VIBEMAN_GEMINI_BIN)
|
|
68
|
+
const envOverride = await this.checkEnvOverride(providerId, provider);
|
|
69
|
+
if (envOverride?.found) {
|
|
70
|
+
await this.cacheDetectionResult(providerId, envOverride);
|
|
71
|
+
return envOverride;
|
|
72
|
+
}
|
|
53
73
|
// Strategy 1: Check explicit configuration from local config
|
|
54
74
|
const explicitResult = await this.checkExplicitConfig(providerId, provider);
|
|
55
75
|
if (explicitResult.found) {
|
|
@@ -104,6 +124,16 @@ export class ProviderDetectionService {
|
|
|
104
124
|
}
|
|
105
125
|
// Try to execute version command
|
|
106
126
|
const version = await this.getVersion(binPath, provider);
|
|
127
|
+
if (provider.command === 'codex' && version) {
|
|
128
|
+
if (this.isVersionLessThan(version, MIN_CODEX_CLI_VERSION)) {
|
|
129
|
+
return {
|
|
130
|
+
found: false,
|
|
131
|
+
path: binPath,
|
|
132
|
+
version,
|
|
133
|
+
error: `Codex CLI ${version} is outdated. Install v${MIN_CODEX_CLI_VERSION} or newer to enable --full-auto danger-full-access automation.`,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
107
137
|
return {
|
|
108
138
|
found: true,
|
|
109
139
|
path: binPath,
|
|
@@ -180,6 +210,32 @@ export class ProviderDetectionService {
|
|
|
180
210
|
}
|
|
181
211
|
return this.validateBinaryPath(resolvedPath, provider, 'PATH');
|
|
182
212
|
}
|
|
213
|
+
async checkEnvOverride(providerId, provider) {
|
|
214
|
+
// Only currently defined for known providers
|
|
215
|
+
const envVar = providerId === 'claude-code'
|
|
216
|
+
? process.env.VIBEMAN_CLAUDE_BIN
|
|
217
|
+
: providerId === 'codex'
|
|
218
|
+
? process.env.VIBEMAN_CODEX_BIN
|
|
219
|
+
: providerId === 'gemini'
|
|
220
|
+
? process.env.VIBEMAN_GEMINI_BIN
|
|
221
|
+
: providerId === 'amp'
|
|
222
|
+
? process.env.VIBEMAN_AMP_BIN
|
|
223
|
+
: undefined;
|
|
224
|
+
if (envVar && envVar.trim()) {
|
|
225
|
+
try {
|
|
226
|
+
const result = await this.validateBinaryPath(envVar.trim(), provider, 'explicit');
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
return {
|
|
231
|
+
found: false,
|
|
232
|
+
path: envVar,
|
|
233
|
+
error: `Environment override invalid for ${providerId}`,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
183
239
|
async getVersion(binPath, provider) {
|
|
184
240
|
const argSets = provider.versionArgsList ?? [['--version']];
|
|
185
241
|
for (const args of argSets) {
|
|
@@ -217,7 +273,13 @@ export class ProviderDetectionService {
|
|
|
217
273
|
return null;
|
|
218
274
|
}
|
|
219
275
|
toLocalConfigKey(providerId) {
|
|
220
|
-
|
|
276
|
+
if (providerId === 'claude-code')
|
|
277
|
+
return 'claude-code';
|
|
278
|
+
if (providerId === 'gemini')
|
|
279
|
+
return 'gemini';
|
|
280
|
+
if (providerId === 'amp')
|
|
281
|
+
return 'amp';
|
|
282
|
+
return 'codex';
|
|
221
283
|
}
|
|
222
284
|
async cacheDetectionResult(providerId, result) {
|
|
223
285
|
if (result.found && result.path) {
|
|
@@ -235,6 +297,26 @@ export class ProviderDetectionService {
|
|
|
235
297
|
version: result.version,
|
|
236
298
|
});
|
|
237
299
|
}
|
|
300
|
+
isVersionLessThan(version, minimum) {
|
|
301
|
+
const toParts = (v) => v
|
|
302
|
+
.split('.')
|
|
303
|
+
.map((part) => {
|
|
304
|
+
const parsed = parseInt(part, 10);
|
|
305
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
306
|
+
})
|
|
307
|
+
.slice(0, 4);
|
|
308
|
+
const vParts = toParts(version);
|
|
309
|
+
const mParts = toParts(minimum);
|
|
310
|
+
const maxLength = Math.max(vParts.length, mParts.length);
|
|
311
|
+
for (let i = 0; i < maxLength; i++) {
|
|
312
|
+
const a = vParts[i] ?? 0;
|
|
313
|
+
const b = mParts[i] ?? 0;
|
|
314
|
+
if (a === b)
|
|
315
|
+
continue;
|
|
316
|
+
return a < b;
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
238
320
|
}
|
|
239
321
|
// Singleton instance
|
|
240
322
|
let providerDetectionService = null;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { simpleGit } from 'simple-git';
|
|
5
|
+
import { log } from '../logger.js';
|
|
6
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
function readPackageJson(pkgPath) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
log.warn('Failed to read package.json', { error, path: pkgPath }, 'vibeman-info');
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function findGitRoot(startDir) {
|
|
17
|
+
let dir = startDir;
|
|
18
|
+
const { root } = path.parse(dir);
|
|
19
|
+
while (true) {
|
|
20
|
+
if (fs.existsSync(path.join(dir, '.git'))) {
|
|
21
|
+
return dir;
|
|
22
|
+
}
|
|
23
|
+
if (dir === root)
|
|
24
|
+
break;
|
|
25
|
+
dir = path.dirname(dir);
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function findPackageRoot(startDir, packageName) {
|
|
30
|
+
let dir = startDir;
|
|
31
|
+
const { root } = path.parse(dir);
|
|
32
|
+
while (true) {
|
|
33
|
+
const pkgPath = path.join(dir, 'package.json');
|
|
34
|
+
if (fs.existsSync(pkgPath)) {
|
|
35
|
+
const pkg = readPackageJson(pkgPath);
|
|
36
|
+
if (pkg?.name === packageName) {
|
|
37
|
+
return dir;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (dir === root)
|
|
41
|
+
break;
|
|
42
|
+
dir = path.dirname(dir);
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
function readPackageVersion(pkgPath) {
|
|
47
|
+
const pkg = readPackageJson(pkgPath);
|
|
48
|
+
if (!pkg)
|
|
49
|
+
return undefined;
|
|
50
|
+
const version = pkg.version;
|
|
51
|
+
return typeof version === 'string' && version.trim().length > 0 ? version.trim() : undefined;
|
|
52
|
+
}
|
|
53
|
+
function resolveVibemanVersion(gitRoot, packageRoot) {
|
|
54
|
+
if (gitRoot) {
|
|
55
|
+
const cliPackage = path.join(gitRoot, 'apps', 'cli', 'package.json');
|
|
56
|
+
if (fs.existsSync(cliPackage)) {
|
|
57
|
+
const version = readPackageVersion(cliPackage);
|
|
58
|
+
if (version)
|
|
59
|
+
return version;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (packageRoot) {
|
|
63
|
+
const cliPackage = path.join(packageRoot, 'package.json');
|
|
64
|
+
if (fs.existsSync(cliPackage)) {
|
|
65
|
+
return readPackageVersion(cliPackage);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
export async function getVibemanInfo() {
|
|
71
|
+
const gitRoot = findGitRoot(moduleDir);
|
|
72
|
+
let gitShortHash;
|
|
73
|
+
if (gitRoot) {
|
|
74
|
+
try {
|
|
75
|
+
const hash = await simpleGit(gitRoot).revparse(['--short', 'HEAD']);
|
|
76
|
+
gitShortHash = hash.trim();
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
log.warn('Failed to resolve Vibeman git hash', { error, gitRoot }, 'vibeman-info');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const packageRoot = findPackageRoot(moduleDir, '@vibeman/cli');
|
|
83
|
+
const version = resolveVibemanVersion(gitRoot, packageRoot);
|
|
84
|
+
return { version, gitShortHash };
|
|
85
|
+
}
|