vibeman 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +43 -0
- package/dist/index.js +227 -104
- package/dist/ui/assets/index-C_kQPI1m.js +9 -0
- package/dist/ui/index.html +12 -0
- package/package.json +13 -46
- package/README.md +0 -12
- package/dist/runtime/api/.tsbuildinfo +0 -1
- package/dist/runtime/api/agent/agent-service.d.ts +0 -229
- package/dist/runtime/api/agent/agent-service.js +0 -963
- package/dist/runtime/api/agent/ai-providers/amp-cli-provider.d.ts +0 -38
- package/dist/runtime/api/agent/ai-providers/amp-cli-provider.js +0 -268
- package/dist/runtime/api/agent/ai-providers/claude-code-adapter.d.ts +0 -61
- package/dist/runtime/api/agent/ai-providers/claude-code-adapter.js +0 -362
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.d.ts +0 -36
- package/dist/runtime/api/agent/ai-providers/codex-cli-provider.js +0 -375
- package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.d.ts +0 -24
- package/dist/runtime/api/agent/ai-providers/gemini-cli-provider.js +0 -291
- package/dist/runtime/api/agent/ai-providers/index.d.ts +0 -9
- package/dist/runtime/api/agent/ai-providers/index.js +0 -9
- package/dist/runtime/api/agent/ai-providers/types.d.ts +0 -185
- package/dist/runtime/api/agent/ai-providers/types.js +0 -5
- package/dist/runtime/api/agent/amp-cli-provider.test.d.ts +0 -1
- package/dist/runtime/api/agent/amp-cli-provider.test.js +0 -99
- package/dist/runtime/api/agent/codex-cli-provider.test.d.ts +0 -1
- package/dist/runtime/api/agent/codex-cli-provider.test.js +0 -172
- package/dist/runtime/api/agent/core-agent-service.d.ts +0 -119
- package/dist/runtime/api/agent/core-agent-service.js +0 -267
- package/dist/runtime/api/agent/parsers.d.ts +0 -16
- package/dist/runtime/api/agent/parsers.js +0 -308
- package/dist/runtime/api/agent/prompt-service.d.ts +0 -30
- package/dist/runtime/api/agent/prompt-service.js +0 -452
- package/dist/runtime/api/agent/prompt-service.test.d.ts +0 -1
- package/dist/runtime/api/agent/prompt-service.test.js +0 -265
- package/dist/runtime/api/agent/routing-policy.d.ts +0 -171
- package/dist/runtime/api/agent/routing-policy.js +0 -196
- package/dist/runtime/api/agent/routing-policy.test.d.ts +0 -1
- package/dist/runtime/api/agent/routing-policy.test.js +0 -63
- package/dist/runtime/api/api/router-helpers.d.ts +0 -32
- package/dist/runtime/api/api/router-helpers.js +0 -31
- package/dist/runtime/api/api/routers/ai.d.ts +0 -200
- package/dist/runtime/api/api/routers/ai.js +0 -396
- package/dist/runtime/api/api/routers/executions.d.ts +0 -93
- package/dist/runtime/api/api/routers/executions.js +0 -94
- package/dist/runtime/api/api/routers/git.d.ts +0 -45
- package/dist/runtime/api/api/routers/git.js +0 -35
- package/dist/runtime/api/api/routers/provider-config.d.ts +0 -199
- package/dist/runtime/api/api/routers/provider-config.js +0 -252
- package/dist/runtime/api/api/routers/settings.d.ts +0 -158
- package/dist/runtime/api/api/routers/settings.js +0 -129
- package/dist/runtime/api/api/routers/tasks.d.ts +0 -141
- package/dist/runtime/api/api/routers/tasks.js +0 -238
- package/dist/runtime/api/api/routers/workflows.d.ts +0 -275
- package/dist/runtime/api/api/routers/workflows.js +0 -311
- package/dist/runtime/api/api/routers/worktrees.d.ts +0 -101
- package/dist/runtime/api/api/routers/worktrees.js +0 -80
- package/dist/runtime/api/api/trpc.d.ts +0 -118
- package/dist/runtime/api/api/trpc.js +0 -34
- package/dist/runtime/api/index.d.ts +0 -9
- package/dist/runtime/api/index.js +0 -117
- package/dist/runtime/api/lib/id-generator.d.ts +0 -70
- package/dist/runtime/api/lib/id-generator.js +0 -123
- package/dist/runtime/api/lib/local-config.d.ts +0 -335
- package/dist/runtime/api/lib/local-config.js +0 -304
- package/dist/runtime/api/lib/logger.d.ts +0 -11
- package/dist/runtime/api/lib/logger.js +0 -188
- package/dist/runtime/api/lib/provider-detection.d.ts +0 -61
- package/dist/runtime/api/lib/provider-detection.js +0 -326
- package/dist/runtime/api/lib/server/agent-service-singleton.d.ts +0 -6
- package/dist/runtime/api/lib/server/agent-service-singleton.js +0 -27
- package/dist/runtime/api/lib/server/bootstrap.d.ts +0 -38
- package/dist/runtime/api/lib/server/bootstrap.js +0 -197
- package/dist/runtime/api/lib/server/git-service-singleton.d.ts +0 -6
- package/dist/runtime/api/lib/server/git-service-singleton.js +0 -47
- package/dist/runtime/api/lib/server/project-root.d.ts +0 -2
- package/dist/runtime/api/lib/server/project-root.js +0 -61
- package/dist/runtime/api/lib/server/task-service-singleton.d.ts +0 -7
- package/dist/runtime/api/lib/server/task-service-singleton.js +0 -58
- package/dist/runtime/api/lib/server/vibeman-info.d.ts +0 -5
- package/dist/runtime/api/lib/server/vibeman-info.js +0 -85
- package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.d.ts +0 -7
- package/dist/runtime/api/lib/server/vibing-orchestrator-singleton.js +0 -57
- package/dist/runtime/api/lib/trpc/server.d.ts +0 -965
- package/dist/runtime/api/lib/trpc/server.js +0 -11
- package/dist/runtime/api/lib/trpc/ws-server.d.ts +0 -8
- package/dist/runtime/api/lib/trpc/ws-server.js +0 -33
- package/dist/runtime/api/persistence/database-service.d.ts +0 -14
- package/dist/runtime/api/persistence/database-service.js +0 -74
- package/dist/runtime/api/persistence/execution-log-persistence.d.ts +0 -90
- package/dist/runtime/api/persistence/execution-log-persistence.js +0 -426
- package/dist/runtime/api/persistence/execution-log-persistence.test.d.ts +0 -1
- package/dist/runtime/api/persistence/execution-log-persistence.test.js +0 -170
- package/dist/runtime/api/router.d.ts +0 -968
- package/dist/runtime/api/router.js +0 -34
- package/dist/runtime/api/settings-service.d.ts +0 -110
- package/dist/runtime/api/settings-service.js +0 -678
- package/dist/runtime/api/tasks/file-watcher.d.ts +0 -23
- package/dist/runtime/api/tasks/file-watcher.js +0 -88
- package/dist/runtime/api/tasks/task-file-parser.d.ts +0 -14
- package/dist/runtime/api/tasks/task-file-parser.js +0 -180
- package/dist/runtime/api/tasks/task-service.d.ts +0 -36
- package/dist/runtime/api/tasks/task-service.js +0 -173
- package/dist/runtime/api/tasks/task-updater.d.ts +0 -62
- package/dist/runtime/api/tasks/task-updater.js +0 -260
- package/dist/runtime/api/tasks/task-updater.test.d.ts +0 -1
- package/dist/runtime/api/tasks/task-updater.test.js +0 -303
- package/dist/runtime/api/types/index.d.ts +0 -186
- package/dist/runtime/api/types/index.js +0 -1
- package/dist/runtime/api/types/settings.d.ts +0 -105
- package/dist/runtime/api/types/settings.js +0 -2
- package/dist/runtime/api/types.d.ts +0 -2
- package/dist/runtime/api/types.js +0 -1
- package/dist/runtime/api/utils/env.d.ts +0 -6
- package/dist/runtime/api/utils/env.js +0 -12
- package/dist/runtime/api/utils/stripNextEnv.d.ts +0 -7
- package/dist/runtime/api/utils/stripNextEnv.js +0 -22
- package/dist/runtime/api/utils/title-slug.d.ts +0 -6
- package/dist/runtime/api/utils/title-slug.js +0 -77
- package/dist/runtime/api/utils/url.d.ts +0 -2
- package/dist/runtime/api/utils/url.js +0 -19
- package/dist/runtime/api/vcs/git-history-service.d.ts +0 -57
- package/dist/runtime/api/vcs/git-history-service.js +0 -228
- package/dist/runtime/api/vcs/git-service.d.ts +0 -136
- package/dist/runtime/api/vcs/git-service.js +0 -307
- package/dist/runtime/api/vcs/worktree-service.d.ts +0 -93
- package/dist/runtime/api/vcs/worktree-service.js +0 -518
- package/dist/runtime/api/vcs/worktree-service.test.d.ts +0 -1
- package/dist/runtime/api/vcs/worktree-service.test.js +0 -20
- package/dist/runtime/api/workflows/quality-pipeline.d.ts +0 -58
- package/dist/runtime/api/workflows/quality-pipeline.js +0 -401
- package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +0 -406
- package/dist/runtime/api/workflows/vibing-orchestrator.js +0 -2462
- package/dist/runtime/api/workflows/workflow-effects.d.ts +0 -45
- package/dist/runtime/api/workflows/workflow-effects.js +0 -49
- package/dist/runtime/api/workflows/workflow-reconciler.d.ts +0 -65
- package/dist/runtime/api/workflows/workflow-reconciler.js +0 -226
- package/dist/runtime/api/workflows/workflow-reducer.d.ts +0 -26
- package/dist/runtime/api/workflows/workflow-reducer.js +0 -288
- package/dist/runtime/api/workflows/workflow-reducer.test.d.ts +0 -1
- package/dist/runtime/api/workflows/workflow-reducer.test.js +0 -247
- package/dist/runtime/api/workflows/workflow-schema.d.ts +0 -546
- package/dist/runtime/api/workflows/workflow-schema.js +0 -256
- package/dist/runtime/web/.next/BUILD_ID +0 -1
- package/dist/runtime/web/.next/app-build-manifest.json +0 -66
- package/dist/runtime/web/.next/app-path-routes-manifest.json +0 -8
- package/dist/runtime/web/.next/build-manifest.json +0 -33
- package/dist/runtime/web/.next/package.json +0 -1
- package/dist/runtime/web/.next/prerender-manifest.json +0 -61
- package/dist/runtime/web/.next/react-loadable-manifest.json +0 -8
- package/dist/runtime/web/.next/required-server-files.json +0 -334
- package/dist/runtime/web/.next/routes-manifest.json +0 -70
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js +0 -1
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/.vibeman/assets/images/[...path]/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/_not-found/page.js +0 -2
- package/dist/runtime/web/.next/server/app/_not-found/page.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/_not-found/page_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/_not-found.html +0 -7
- package/dist/runtime/web/.next/server/app/_not-found.meta +0 -8
- package/dist/runtime/web/.next/server/app/_not-found.rsc +0 -22
- package/dist/runtime/web/.next/server/app/api/health/route.js +0 -1
- package/dist/runtime/web/.next/server/app/api/health/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/api/health/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js +0 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/api/images/[...path]/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/api/upload/route.js +0 -1
- package/dist/runtime/web/.next/server/app/api/upload/route.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/api/upload/route_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app/index.html +0 -7
- package/dist/runtime/web/.next/server/app/index.meta +0 -7
- package/dist/runtime/web/.next/server/app/index.rsc +0 -27
- package/dist/runtime/web/.next/server/app/page.js +0 -112
- package/dist/runtime/web/.next/server/app/page.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/app/page_client-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/app-paths-manifest.json +0 -8
- package/dist/runtime/web/.next/server/chunks/210.js +0 -1
- package/dist/runtime/web/.next/server/chunks/291.js +0 -18
- package/dist/runtime/web/.next/server/chunks/552.js +0 -22
- package/dist/runtime/web/.next/server/chunks/780.js +0 -1
- package/dist/runtime/web/.next/server/chunks/905.js +0 -6
- package/dist/runtime/web/.next/server/chunks/98.js +0 -1
- package/dist/runtime/web/.next/server/functions-config-manifest.json +0 -4
- package/dist/runtime/web/.next/server/middleware-build-manifest.js +0 -1
- package/dist/runtime/web/.next/server/middleware-manifest.json +0 -6
- package/dist/runtime/web/.next/server/middleware-react-loadable-manifest.js +0 -1
- package/dist/runtime/web/.next/server/next-font-manifest.js +0 -1
- package/dist/runtime/web/.next/server/next-font-manifest.json +0 -1
- package/dist/runtime/web/.next/server/pages/404.html +0 -7
- package/dist/runtime/web/.next/server/pages/500.html +0 -1
- package/dist/runtime/web/.next/server/pages/_app.js +0 -1
- package/dist/runtime/web/.next/server/pages/_app.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/pages/_document.js +0 -1
- package/dist/runtime/web/.next/server/pages/_document.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/pages/_error.js +0 -19
- package/dist/runtime/web/.next/server/pages/_error.js.nft.json +0 -1
- package/dist/runtime/web/.next/server/pages-manifest.json +0 -6
- package/dist/runtime/web/.next/server/server-reference-manifest.js +0 -1
- package/dist/runtime/web/.next/server/server-reference-manifest.json +0 -1
- package/dist/runtime/web/.next/server/webpack-runtime.js +0 -1
- package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_buildManifest.js +0 -1
- package/dist/runtime/web/.next/static/LJFZk_8tvKFN_Ee4HqUuM/_ssgManifest.js +0 -1
- package/dist/runtime/web/.next/static/chunks/05c91ade-7d09b2b280adffd1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/201-51bef3fa8c832e2e.js +0 -1
- package/dist/runtime/web/.next/static/chunks/524-89747ed9b0294f8a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/554-8bec6e9cca6acc67.js +0 -1
- package/dist/runtime/web/.next/static/chunks/764.86e9503a69d45a85.js +0 -1
- package/dist/runtime/web/.next/static/chunks/7ab4dc20-239138e0ae7af24a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/905-342391e3d3a3678f.js +0 -20
- package/dist/runtime/web/.next/static/chunks/a8a5ce16-4edea7df2d9b544a.js +0 -79
- package/dist/runtime/web/.next/static/chunks/ad74d572-4c1b162e2c15acaa.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/_not-found/page-34e66b251c2b5044.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/health/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/upload/route-7b752a8641f96c1f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/layout-df9ac93cb02b2385.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/page-6610743f7de5f92a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/c25e0690-e9b798b8de667da1.js +0 -1
- package/dist/runtime/web/.next/static/chunks/framework-57157ec4d37f64aa.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-app-156cc0c60371bd78.js +0 -1
- package/dist/runtime/web/.next/static/chunks/main-df25d367c47b1fec.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_app-9f629a5e1131d19f.js +0 -1
- package/dist/runtime/web/.next/static/chunks/pages/_error-9238238274c7efcd.js +0 -1
- package/dist/runtime/web/.next/static/chunks/polyfills-42372ed130431b0a.js +0 -1
- package/dist/runtime/web/.next/static/chunks/webpack-cd50e39b423d1808.js +0 -1
- package/dist/runtime/web/.next/static/css/2728291c68f99cb1.css +0 -3
- package/dist/runtime/web/.next/static/css/4fbf378a264bd4ea.css +0 -1
- package/dist/runtime/web/.next/static/css/521bd69cc298cd1a.css +0 -1
- package/dist/runtime/web/.next/static/css/537e22821e101b87.css +0 -1
- package/dist/runtime/web/.next/static/media/19cfc7226ec3afaa-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/21350d82a1f187e9-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/8e9860b6e62d6359-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/ba9851c3c22cd980-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/c5fe6dc8356a8c31-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/df0a9ae256c0569c-s.woff2 +0 -0
- package/dist/runtime/web/.next/static/media/e4af272ccee01ff0-s.p.woff2 +0 -0
- package/dist/runtime/web/package.json +0 -65
- package/dist/runtime/web/server.js +0 -44
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import pino from 'pino';
|
|
2
|
-
// Check if we're running in browser context
|
|
3
|
-
const isBrowser = typeof globalThis !== 'undefined' && 'window' in globalThis;
|
|
4
|
-
// Simple environment detection to avoid import issues
|
|
5
|
-
function isDevelopment() {
|
|
6
|
-
return process.env.NODE_ENV === 'development';
|
|
7
|
-
}
|
|
8
|
-
// Environment detection - check both environment variable and process args for verbose mode
|
|
9
|
-
const isVerbose = process.env.VERBOSE === 'true' ||
|
|
10
|
-
(typeof process !== 'undefined' &&
|
|
11
|
-
process.argv &&
|
|
12
|
-
(process.argv.includes('--verbose') || process.argv.includes('-v')));
|
|
13
|
-
// Optional explicit log level/format override
|
|
14
|
-
const envLogLevel = (process.env.VIBEMAN_LOG_LEVEL || process.env.LOG_LEVEL || '').toLowerCase();
|
|
15
|
-
const envLogStyle = (process.env.VIBEMAN_LOG_STYLE || process.env.LOG_STYLE || '').toLowerCase();
|
|
16
|
-
const paramSplitter = process.env.VIBEMAN_LOG_SPLIT || process.env.LOG_SPLIT || ' | ';
|
|
17
|
-
// Determine log level based on environment and verbose flag
|
|
18
|
-
function getLogLevel() {
|
|
19
|
-
if (envLogLevel &&
|
|
20
|
-
['silent', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'].includes(envLogLevel)) {
|
|
21
|
-
return envLogLevel;
|
|
22
|
-
}
|
|
23
|
-
if (isVerbose)
|
|
24
|
-
return 'debug';
|
|
25
|
-
if (isDevelopment())
|
|
26
|
-
return 'info';
|
|
27
|
-
return 'error';
|
|
28
|
-
}
|
|
29
|
-
// Create logger configuration
|
|
30
|
-
const loggerConfig = {
|
|
31
|
-
level: getLogLevel(),
|
|
32
|
-
...(isBrowser
|
|
33
|
-
? {
|
|
34
|
-
// Browser configuration - use simple console
|
|
35
|
-
browser: { asObject: false },
|
|
36
|
-
}
|
|
37
|
-
: {
|
|
38
|
-
// Node.js configuration
|
|
39
|
-
formatters: {
|
|
40
|
-
level: (label) => ({ level: label }),
|
|
41
|
-
log: (object) => object,
|
|
42
|
-
},
|
|
43
|
-
transport: {
|
|
44
|
-
target: 'pino-pretty',
|
|
45
|
-
options: (() => {
|
|
46
|
-
const base = {
|
|
47
|
-
colorize: true,
|
|
48
|
-
translateTime: 'HH:MM:ss',
|
|
49
|
-
ignore: 'pid,hostname',
|
|
50
|
-
};
|
|
51
|
-
if (envLogStyle !== 'pretty') {
|
|
52
|
-
base.singleLine = false;
|
|
53
|
-
base.hideObject = false; // allow error objects to render stacks
|
|
54
|
-
return base;
|
|
55
|
-
}
|
|
56
|
-
// Pretty (multi-line) with inline context, print objects nicely
|
|
57
|
-
base.levelFirst = true;
|
|
58
|
-
base.messageFormat = (log, messageKey) => log?.context ? `[${log.context}] ${log[messageKey]}` : log[messageKey];
|
|
59
|
-
return base;
|
|
60
|
-
})(),
|
|
61
|
-
},
|
|
62
|
-
}),
|
|
63
|
-
};
|
|
64
|
-
// Create the logger instance
|
|
65
|
-
export const logger = pino(loggerConfig);
|
|
66
|
-
// Context-aware logger factory
|
|
67
|
-
export function createContextLogger(context) {
|
|
68
|
-
return logger.child({ context });
|
|
69
|
-
}
|
|
70
|
-
// Convenience methods for common logging patterns
|
|
71
|
-
export const log = {
|
|
72
|
-
error: (message, error, context) => {
|
|
73
|
-
const contextLogger = context ? createContextLogger(context) : logger;
|
|
74
|
-
const msg = context ? `[${context}] ${message}` : message;
|
|
75
|
-
if (error instanceof Error) {
|
|
76
|
-
// Keep error object so stack renders, even in compact
|
|
77
|
-
contextLogger.error({ err: error }, msg);
|
|
78
|
-
}
|
|
79
|
-
else if (error) {
|
|
80
|
-
contextLogger.error({ err: error }, msg);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
contextLogger.error(msg);
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
warn: (message, data, context) => {
|
|
87
|
-
const contextLogger = context ? createContextLogger(context) : logger;
|
|
88
|
-
const msg = context ? `[${context}] ${message}` : message;
|
|
89
|
-
if (data && envLogStyle !== 'pretty') {
|
|
90
|
-
const entries = Object.entries(data);
|
|
91
|
-
const messageEntry = entries.find(([k]) => k === 'message');
|
|
92
|
-
const other = entries.filter(([k]) => k !== 'message');
|
|
93
|
-
const pairs = other.map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(paramSplitter);
|
|
94
|
-
const body = (() => {
|
|
95
|
-
if (!messageEntry)
|
|
96
|
-
return '';
|
|
97
|
-
const val = messageEntry[1];
|
|
98
|
-
if (typeof val === 'string')
|
|
99
|
-
return `\n${val}`; // print as-is (newlines preserved)
|
|
100
|
-
return `\n${JSON.stringify(val, null, 2)}`;
|
|
101
|
-
})();
|
|
102
|
-
contextLogger.warn(pairs ? `${msg} ${pairs}${body}` : `${msg}${body}`);
|
|
103
|
-
}
|
|
104
|
-
else if (data) {
|
|
105
|
-
contextLogger.warn(data, msg);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
contextLogger.warn(msg);
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
info: (message, data, context) => {
|
|
112
|
-
const contextLogger = context ? createContextLogger(context) : logger;
|
|
113
|
-
const msg = context ? `[${context}] ${message}` : message;
|
|
114
|
-
if (data && envLogStyle !== 'pretty') {
|
|
115
|
-
const entries = Object.entries(data);
|
|
116
|
-
const messageEntry = entries.find(([k]) => k === 'message');
|
|
117
|
-
const other = entries.filter(([k]) => k !== 'message');
|
|
118
|
-
const pairs = other.map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(paramSplitter);
|
|
119
|
-
const body = (() => {
|
|
120
|
-
if (!messageEntry)
|
|
121
|
-
return '';
|
|
122
|
-
const val = messageEntry[1];
|
|
123
|
-
if (typeof val === 'string')
|
|
124
|
-
return `\n${val}`;
|
|
125
|
-
return `\n${JSON.stringify(val, null, 2)}`;
|
|
126
|
-
})();
|
|
127
|
-
contextLogger.info(pairs ? `${msg} ${pairs}${body}` : `${msg}${body}`);
|
|
128
|
-
}
|
|
129
|
-
else if (data) {
|
|
130
|
-
contextLogger.info(data, msg);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
contextLogger.info(msg);
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
debug: (message, data, context) => {
|
|
137
|
-
const contextLogger = context ? createContextLogger(context) : logger;
|
|
138
|
-
const msg = context ? `[${context}] ${message}` : message;
|
|
139
|
-
if (data && envLogStyle !== 'pretty') {
|
|
140
|
-
const entries = Object.entries(data);
|
|
141
|
-
const messageEntry = entries.find(([k]) => k === 'message');
|
|
142
|
-
const other = entries.filter(([k]) => k !== 'message');
|
|
143
|
-
const pairs = other.map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(paramSplitter);
|
|
144
|
-
const body = (() => {
|
|
145
|
-
if (!messageEntry)
|
|
146
|
-
return '';
|
|
147
|
-
const val = messageEntry[1];
|
|
148
|
-
if (typeof val === 'string')
|
|
149
|
-
return `\n${val}`;
|
|
150
|
-
return `\n${JSON.stringify(val, null, 2)}`;
|
|
151
|
-
})();
|
|
152
|
-
contextLogger.debug(pairs ? `${msg} ${pairs}${body}` : `${msg}${body}`);
|
|
153
|
-
}
|
|
154
|
-
else if (data) {
|
|
155
|
-
contextLogger.debug(data, msg);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
contextLogger.debug(msg);
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
trace: (message, data, context) => {
|
|
162
|
-
const contextLogger = context ? createContextLogger(context) : logger;
|
|
163
|
-
const msg = context ? `[${context}] ${message}` : message;
|
|
164
|
-
if (data && envLogStyle !== 'pretty') {
|
|
165
|
-
const entries = Object.entries(data);
|
|
166
|
-
const messageEntry = entries.find(([k]) => k === 'message');
|
|
167
|
-
const other = entries.filter(([k]) => k !== 'message');
|
|
168
|
-
const pairs = other.map(([k, v]) => `${k}=${JSON.stringify(v)}`).join(paramSplitter);
|
|
169
|
-
const body = (() => {
|
|
170
|
-
if (!messageEntry)
|
|
171
|
-
return '';
|
|
172
|
-
const val = messageEntry[1];
|
|
173
|
-
if (typeof val === 'string')
|
|
174
|
-
return `\n${val}`;
|
|
175
|
-
return `\n${JSON.stringify(val, null, 2)}`;
|
|
176
|
-
})();
|
|
177
|
-
contextLogger.trace(pairs ? `${msg} ${pairs}${body}` : `${msg}${body}`);
|
|
178
|
-
}
|
|
179
|
-
else if (data) {
|
|
180
|
-
contextLogger.trace(data, msg);
|
|
181
|
-
}
|
|
182
|
-
else {
|
|
183
|
-
contextLogger.trace(msg);
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
// Export default logger for direct use
|
|
188
|
-
export default logger;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enhanced Provider Detection Service
|
|
3
|
-
* Robust detection logic for AI provider CLI tools with multiple fallback strategies
|
|
4
|
-
*/
|
|
5
|
-
export interface DetectionResult {
|
|
6
|
-
found: boolean;
|
|
7
|
-
path?: string;
|
|
8
|
-
version?: string;
|
|
9
|
-
method?: 'explicit' | 'PATH' | 'common-location';
|
|
10
|
-
error?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ProviderInfo {
|
|
13
|
-
name: string;
|
|
14
|
-
command: string;
|
|
15
|
-
versionArgsList?: string[][];
|
|
16
|
-
versionRegex: RegExp;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Provider definitions for detection
|
|
20
|
-
*/
|
|
21
|
-
export declare const PROVIDER_DEFINITIONS: Record<string, ProviderInfo>;
|
|
22
|
-
/**
|
|
23
|
-
* Enhanced Provider Detection Service
|
|
24
|
-
*/
|
|
25
|
-
export declare class ProviderDetectionService {
|
|
26
|
-
private localConfig;
|
|
27
|
-
constructor();
|
|
28
|
-
/**
|
|
29
|
-
* Detect a specific provider with all fallback strategies
|
|
30
|
-
*/
|
|
31
|
-
detectProvider(providerId: string): Promise<DetectionResult>;
|
|
32
|
-
/**
|
|
33
|
-
* Detect all configured providers
|
|
34
|
-
*/
|
|
35
|
-
detectAllProviders(): Promise<Record<string, DetectionResult>>;
|
|
36
|
-
/**
|
|
37
|
-
* Validate a specific binary path
|
|
38
|
-
*/
|
|
39
|
-
validateBinaryPath(binPath: string, provider: ProviderInfo, method?: DetectionResult['method']): Promise<DetectionResult>;
|
|
40
|
-
/**
|
|
41
|
-
* Set explicit provider path and cache it
|
|
42
|
-
*/
|
|
43
|
-
setProviderPath(providerId: string, binPath: string): Promise<DetectionResult>;
|
|
44
|
-
/**
|
|
45
|
-
* Clear cached provider configuration
|
|
46
|
-
*/
|
|
47
|
-
clearProviderPath(providerId: string): Promise<void>;
|
|
48
|
-
/**
|
|
49
|
-
* Get cached detection results if still fresh
|
|
50
|
-
*/
|
|
51
|
-
getCachedResult(providerId: string): Promise<DetectionResult | null>;
|
|
52
|
-
private checkExplicitConfig;
|
|
53
|
-
private checkSystemCommand;
|
|
54
|
-
private checkEnvOverride;
|
|
55
|
-
private getVersion;
|
|
56
|
-
private resolveCommand;
|
|
57
|
-
private toLocalConfigKey;
|
|
58
|
-
private cacheDetectionResult;
|
|
59
|
-
private isVersionLessThan;
|
|
60
|
-
}
|
|
61
|
-
export declare function getProviderDetectionService(): ProviderDetectionService;
|
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enhanced Provider Detection Service
|
|
3
|
-
* Robust detection logic for AI provider CLI tools with multiple fallback strategies
|
|
4
|
-
*/
|
|
5
|
-
import { exec, execFile } from 'child_process';
|
|
6
|
-
import { promisify } from 'util';
|
|
7
|
-
import fs from 'fs/promises';
|
|
8
|
-
import which from 'which';
|
|
9
|
-
import { log } from './logger.js';
|
|
10
|
-
import { getLocalConfigService } from './local-config.js';
|
|
11
|
-
const execAsync = promisify(exec);
|
|
12
|
-
const execFileAsync = promisify(execFile);
|
|
13
|
-
const MIN_CODEX_CLI_VERSION = '0.73.0';
|
|
14
|
-
/**
|
|
15
|
-
* Provider definitions for detection
|
|
16
|
-
*/
|
|
17
|
-
export const PROVIDER_DEFINITIONS = {
|
|
18
|
-
'claude-code': {
|
|
19
|
-
name: 'Claude Code',
|
|
20
|
-
command: 'claude',
|
|
21
|
-
versionArgsList: [['--version'], ['-v']],
|
|
22
|
-
versionRegex: /(\d+\.\d+\.\d+)/,
|
|
23
|
-
},
|
|
24
|
-
codex: {
|
|
25
|
-
name: 'Codex CLI',
|
|
26
|
-
command: 'codex',
|
|
27
|
-
versionArgsList: [['--version'], ['-v']],
|
|
28
|
-
versionRegex: /(\d+\.\d+\.\d+)/,
|
|
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
|
-
},
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Enhanced Provider Detection Service
|
|
46
|
-
*/
|
|
47
|
-
export class ProviderDetectionService {
|
|
48
|
-
constructor() {
|
|
49
|
-
this.localConfig = getLocalConfigService();
|
|
50
|
-
// Ensure local config is initialized
|
|
51
|
-
this.localConfig.initialize().catch((error) => {
|
|
52
|
-
log.error('Failed to initialize local config for provider detection', error, 'provider-detection');
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Detect a specific provider with all fallback strategies
|
|
57
|
-
*/
|
|
58
|
-
async detectProvider(providerId) {
|
|
59
|
-
const provider = PROVIDER_DEFINITIONS[providerId];
|
|
60
|
-
if (!provider) {
|
|
61
|
-
return {
|
|
62
|
-
found: false,
|
|
63
|
-
error: `Unknown provider: ${providerId}`,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
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
|
-
}
|
|
73
|
-
// Strategy 1: Check explicit configuration from local config
|
|
74
|
-
const explicitResult = await this.checkExplicitConfig(providerId, provider);
|
|
75
|
-
if (explicitResult.found) {
|
|
76
|
-
log.info(`Provider found via explicit config: ${provider.name}`, explicitResult, 'provider-detection');
|
|
77
|
-
return explicitResult;
|
|
78
|
-
}
|
|
79
|
-
// Strategy 2: Resolve via system command lookup
|
|
80
|
-
const systemResult = await this.checkSystemCommand(provider);
|
|
81
|
-
if (systemResult.found) {
|
|
82
|
-
log.info(`Provider found on system PATH: ${provider.name}`, systemResult, 'provider-detection');
|
|
83
|
-
await this.cacheDetectionResult(providerId, systemResult);
|
|
84
|
-
return systemResult;
|
|
85
|
-
}
|
|
86
|
-
// All strategies failed
|
|
87
|
-
const result = {
|
|
88
|
-
found: false,
|
|
89
|
-
error: `${provider.name} not found via explicit config or system PATH`,
|
|
90
|
-
};
|
|
91
|
-
log.warn(`Provider not found: ${provider.name}`, result, 'provider-detection');
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Detect all configured providers
|
|
96
|
-
*/
|
|
97
|
-
async detectAllProviders() {
|
|
98
|
-
const results = {};
|
|
99
|
-
for (const providerId of Object.keys(PROVIDER_DEFINITIONS)) {
|
|
100
|
-
try {
|
|
101
|
-
results[providerId] = await this.detectProvider(providerId);
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
results[providerId] = {
|
|
105
|
-
found: false,
|
|
106
|
-
error: `Detection failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return results;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Validate a specific binary path
|
|
114
|
-
*/
|
|
115
|
-
async validateBinaryPath(binPath, provider, method = 'explicit') {
|
|
116
|
-
try {
|
|
117
|
-
// Check if file exists and is executable
|
|
118
|
-
const stats = await fs.stat(binPath);
|
|
119
|
-
if (!stats.isFile()) {
|
|
120
|
-
return {
|
|
121
|
-
found: false,
|
|
122
|
-
error: `Path is not a file: ${binPath}`,
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
// Try to execute version command
|
|
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
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
found: true,
|
|
139
|
-
path: binPath,
|
|
140
|
-
version,
|
|
141
|
-
method,
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
return {
|
|
146
|
-
found: false,
|
|
147
|
-
path: binPath,
|
|
148
|
-
error: `Validation failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Set explicit provider path and cache it
|
|
154
|
-
*/
|
|
155
|
-
async setProviderPath(providerId, binPath) {
|
|
156
|
-
const provider = PROVIDER_DEFINITIONS[providerId];
|
|
157
|
-
if (!provider) {
|
|
158
|
-
return {
|
|
159
|
-
found: false,
|
|
160
|
-
error: `Unknown provider: ${providerId}`,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
const result = await this.validateBinaryPath(binPath, provider);
|
|
164
|
-
if (result.found) {
|
|
165
|
-
const localId = this.toLocalConfigKey(providerId);
|
|
166
|
-
await this.localConfig.setProviderPath(localId, binPath, 'explicit');
|
|
167
|
-
}
|
|
168
|
-
return result;
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Clear cached provider configuration
|
|
172
|
-
*/
|
|
173
|
-
async clearProviderPath(providerId) {
|
|
174
|
-
const localId = this.toLocalConfigKey(providerId);
|
|
175
|
-
await this.localConfig.clearProviderPath(localId);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Get cached detection results if still fresh
|
|
179
|
-
*/
|
|
180
|
-
async getCachedResult(providerId) {
|
|
181
|
-
if (this.localConfig.isCachedValidationFresh(providerId)) {
|
|
182
|
-
const cached = this.localConfig.getCachedValidationResult(providerId);
|
|
183
|
-
if (cached) {
|
|
184
|
-
const localId = this.toLocalConfigKey(providerId);
|
|
185
|
-
return {
|
|
186
|
-
found: cached.available,
|
|
187
|
-
path: cached.available
|
|
188
|
-
? this.localConfig.getProviderConfig(localId)?.detectedPath
|
|
189
|
-
: undefined,
|
|
190
|
-
version: cached.version,
|
|
191
|
-
error: cached.error,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
// Private detection strategies
|
|
198
|
-
async checkExplicitConfig(providerId, provider) {
|
|
199
|
-
const localId = this.toLocalConfigKey(providerId);
|
|
200
|
-
const config = this.localConfig.getProviderConfig(localId);
|
|
201
|
-
if (!config?.binPath) {
|
|
202
|
-
return { found: false };
|
|
203
|
-
}
|
|
204
|
-
return this.validateBinaryPath(config.binPath, provider, 'explicit');
|
|
205
|
-
}
|
|
206
|
-
async checkSystemCommand(provider) {
|
|
207
|
-
const resolvedPath = await this.resolveCommand(provider.command);
|
|
208
|
-
if (!resolvedPath) {
|
|
209
|
-
return { found: false };
|
|
210
|
-
}
|
|
211
|
-
return this.validateBinaryPath(resolvedPath, provider, 'PATH');
|
|
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
|
-
}
|
|
239
|
-
async getVersion(binPath, provider) {
|
|
240
|
-
const argSets = provider.versionArgsList ?? [['--version']];
|
|
241
|
-
for (const args of argSets) {
|
|
242
|
-
try {
|
|
243
|
-
const { stdout, stderr } = await execFileAsync(binPath, args, { timeout: 10000 });
|
|
244
|
-
const output = (stdout + stderr).trim();
|
|
245
|
-
const match = output.match(provider.versionRegex);
|
|
246
|
-
if (match?.[1]) {
|
|
247
|
-
return match[1];
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
log.debug(`Version command failed for ${binPath}`, { args, error }, 'provider-detection');
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return undefined;
|
|
255
|
-
}
|
|
256
|
-
async resolveCommand(command) {
|
|
257
|
-
try {
|
|
258
|
-
return await which(command);
|
|
259
|
-
}
|
|
260
|
-
catch (error) {
|
|
261
|
-
log.debug(`which lookup failed for ${command}`, error, 'provider-detection');
|
|
262
|
-
}
|
|
263
|
-
if (process.platform !== 'win32') {
|
|
264
|
-
try {
|
|
265
|
-
const { stdout } = await execAsync(`command -v ${command}`, { timeout: 5000 });
|
|
266
|
-
const resolved = stdout.trim().split('\n')[0];
|
|
267
|
-
return resolved ? resolved : null;
|
|
268
|
-
}
|
|
269
|
-
catch (error) {
|
|
270
|
-
log.debug(`command -v lookup failed for ${command}`, error, 'provider-detection');
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
toLocalConfigKey(providerId) {
|
|
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';
|
|
283
|
-
}
|
|
284
|
-
async cacheDetectionResult(providerId, result) {
|
|
285
|
-
if (result.found && result.path) {
|
|
286
|
-
const localId = this.toLocalConfigKey(providerId);
|
|
287
|
-
if (result.method === 'explicit') {
|
|
288
|
-
await this.localConfig.setProviderPath(localId, result.path, 'explicit');
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
await this.localConfig.updateDetectedProvider(localId, result.path, result.method || 'PATH');
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
await this.localConfig.cacheValidationResult(providerId, {
|
|
295
|
-
available: result.found,
|
|
296
|
-
error: result.error,
|
|
297
|
-
version: result.version,
|
|
298
|
-
});
|
|
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
|
-
}
|
|
320
|
-
}
|
|
321
|
-
// Singleton instance
|
|
322
|
-
let providerDetectionService = null;
|
|
323
|
-
export function getProviderDetectionService() {
|
|
324
|
-
providerDetectionService ?? (providerDetectionService = new ProviderDetectionService());
|
|
325
|
-
return providerDetectionService;
|
|
326
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AgentService } from '../../agent/agent-service.js';
|
|
2
|
-
import { getTaskService } from './task-service-singleton.js';
|
|
3
|
-
import { getSettingsService } from '../../settings-service.js';
|
|
4
|
-
import { getProjectRoot, getVibeDir } from './project-root.js';
|
|
5
|
-
export function getAgentService() {
|
|
6
|
-
if (!globalThis.__vibeman_agent_service__) {
|
|
7
|
-
const taskService = getTaskService();
|
|
8
|
-
const settingsVibeDir = (() => {
|
|
9
|
-
try {
|
|
10
|
-
const svc = getSettingsService();
|
|
11
|
-
const s = svc.getSettings();
|
|
12
|
-
return s?.development?.vibeDir;
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
})();
|
|
18
|
-
const projectRoot = getProjectRoot();
|
|
19
|
-
const vibeDir = settingsVibeDir || getVibeDir();
|
|
20
|
-
globalThis.__vibeman_agent_service__ = new AgentService(taskService, projectRoot);
|
|
21
|
-
console.log(`🤖 Agent Service initialized (projectRoot=${projectRoot}, vibeDir=${vibeDir})`);
|
|
22
|
-
}
|
|
23
|
-
return globalThis.__vibeman_agent_service__;
|
|
24
|
-
}
|
|
25
|
-
export function resetAgentService() {
|
|
26
|
-
globalThis.__vibeman_agent_service__ = undefined;
|
|
27
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Server Bootstrap - Async-first service initialization
|
|
3
|
-
*
|
|
4
|
-
* Provides ordered initialization of core services before router creation,
|
|
5
|
-
* ensuring all dependencies are ready for synchronous access during runtime.
|
|
6
|
-
*/
|
|
7
|
-
import { getSettingsService } from '../../settings-service.js';
|
|
8
|
-
import { TaskService } from '../../tasks/task-service.js';
|
|
9
|
-
import { AgentService } from '../../agent/agent-service.js';
|
|
10
|
-
import { GitService } from '../../vcs/git-service.js';
|
|
11
|
-
import { WorktreeService } from '../../vcs/worktree-service.js';
|
|
12
|
-
import { VibingOrchestrator } from '../../workflows/vibing-orchestrator.js';
|
|
13
|
-
/**
|
|
14
|
-
* Initialize core services in proper dependency order.
|
|
15
|
-
* Must be called before any service getters or router creation.
|
|
16
|
-
*/
|
|
17
|
-
export declare function bootstrap(): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Ready-only sync getters - throw if called before bootstrap
|
|
20
|
-
*/
|
|
21
|
-
export declare function getBootstrappedSettingsService(): ReturnType<typeof getSettingsService>;
|
|
22
|
-
export declare function getBootstrappedTaskService(): TaskService;
|
|
23
|
-
export declare function getBootstrappedAgentService(): AgentService;
|
|
24
|
-
export declare function getBootstrappedGitService(): GitService;
|
|
25
|
-
export declare function getBootstrappedWorktreeService(): WorktreeService;
|
|
26
|
-
export declare function getBootstrappedVibingOrchestrator(): VibingOrchestrator;
|
|
27
|
-
/**
|
|
28
|
-
* Get bootstrap completion promise for diagnostics/tests
|
|
29
|
-
*/
|
|
30
|
-
export declare function getBootstrapReady(): Promise<void> | null;
|
|
31
|
-
/**
|
|
32
|
-
* Check if bootstrap has completed
|
|
33
|
-
*/
|
|
34
|
-
export declare function isBootstrapComplete(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Test bootstrap function that initializes against a temp workspace
|
|
37
|
-
*/
|
|
38
|
-
export declare function testBootstrap(tempWorkspace?: string): Promise<void>;
|