vibeman 0.0.3 → 0.0.6
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 +49 -0
- package/dist/cli.js +135 -0
- package/dist/ui/index-gnk6rhxs.js +9 -0
- package/dist/ui/index.html +10 -0
- package/dist/ui/index.js +2 -0
- package/package.json +10 -80
- package/README.md +0 -12
- package/dist/index.js +0 -114
- package/dist/runtime/api/.tsbuildinfo +0 -1
- package/dist/runtime/api/agent/agent-service.d.ts +0 -225
- package/dist/runtime/api/agent/agent-service.js +0 -904
- 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 -347
- package/dist/runtime/api/agent/ai-providers/index.d.ts +0 -9
- package/dist/runtime/api/agent/ai-providers/index.js +0 -7
- package/dist/runtime/api/agent/ai-providers/types.d.ts +0 -182
- package/dist/runtime/api/agent/ai-providers/types.js +0 -5
- package/dist/runtime/api/agent/codex-cli-provider.test.d.ts +0 -1
- package/dist/runtime/api/agent/codex-cli-provider.test.js +0 -170
- 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 -449
- package/dist/runtime/api/agent/prompt-service.test.d.ts +0 -1
- package/dist/runtime/api/agent/prompt-service.test.js +0 -230
- 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 -98
- 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 -165
- package/dist/runtime/api/api/routers/provider-config.js +0 -252
- package/dist/runtime/api/api/routers/settings.d.ts +0 -139
- package/dist/runtime/api/api/routers/settings.js +0 -113
- 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 -245
- package/dist/runtime/api/lib/local-config.js +0 -288
- 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 -59
- package/dist/runtime/api/lib/provider-detection.js +0 -244
- 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/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/client.d.ts +0 -1
- package/dist/runtime/api/lib/trpc/client.js +0 -5
- package/dist/runtime/api/lib/trpc/server.d.ts +0 -935
- 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 -410
- 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 -938
- 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 -661
- 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 -13
- package/dist/runtime/api/tasks/task-file-parser.js +0 -161
- 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/types/index.d.ts +0 -186
- package/dist/runtime/api/types/index.js +0 -1
- package/dist/runtime/api/types/settings.d.ts +0 -94
- 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 -127
- package/dist/runtime/api/vcs/git-service.js +0 -284
- package/dist/runtime/api/vcs/worktree-service.d.ts +0 -93
- package/dist/runtime/api/vcs/worktree-service.js +0 -506
- 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 -400
- package/dist/runtime/api/workflows/vibing-orchestrator.d.ts +0 -318
- package/dist/runtime/api/workflows/vibing-orchestrator.js +0 -1891
- 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 -39
- 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 -147
- 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/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/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/5_15u1WQCxN1_eHZpldCv/_buildManifest.js +0 -1
- package/dist/runtime/web/.next/static/5_15u1WQCxN1_eHZpldCv/_ssgManifest.js +0 -1
- 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/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/823-6f371a6e829adbba.js +0 -63
- package/dist/runtime/web/.next/static/chunks/87c73c54-09e1ba5c70e60a51.js +0 -1
- package/dist/runtime/web/.next/static/chunks/891cff7f.0f71fc028f87e683.js +0 -1
- package/dist/runtime/web/.next/static/chunks/8bb4d8db-3e2aa02b0a2384b9.js +0 -1
- package/dist/runtime/web/.next/static/chunks/9af238c7-271a911d4e99ab18.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/.vibeman/assets/images/[...path]/route-751c9265a65409e5.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-751c9265a65409e5.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/images/[...path]/route-751c9265a65409e5.js +0 -1
- package/dist/runtime/web/.next/static/chunks/app/api/upload/route-751c9265a65409e5.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-9fe7d75095b4ccec.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/polyfills-42372ed130431b0a.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/css/2728291c68f99cb1.css +0 -3
- 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,284 +0,0 @@
|
|
|
1
|
-
import { simpleGit } from 'simple-git';
|
|
2
|
-
import { log } from '../lib/logger.js';
|
|
3
|
-
import { getProjectRoot } from '../lib/server/project-root.js';
|
|
4
|
-
export class GitService {
|
|
5
|
-
constructor(projectRoot = getProjectRoot(), config = {}) {
|
|
6
|
-
this.projectRoot = projectRoot;
|
|
7
|
-
this.config = config;
|
|
8
|
-
this.git = simpleGit(projectRoot);
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Validate Git repository exists and is properly configured
|
|
12
|
-
*/
|
|
13
|
-
async initializeRepository() {
|
|
14
|
-
const isRepo = await this.git.checkIsRepo();
|
|
15
|
-
if (!isRepo) {
|
|
16
|
-
const error = new Error(`Directory ${this.projectRoot} is not a Git repository. Please run 'git init' first.`);
|
|
17
|
-
log.error('Git repository not found', error, 'git-service');
|
|
18
|
-
throw error;
|
|
19
|
-
}
|
|
20
|
-
// Set up basic Git configuration if not present
|
|
21
|
-
try {
|
|
22
|
-
await this.git.raw(['config', 'user.name']);
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
await this.git.addConfig('user.name', 'Vibeman');
|
|
26
|
-
await this.git.addConfig('user.email', 'vibeman@localhost');
|
|
27
|
-
log.info('Set default Git user configuration', undefined, 'git-service');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get current Git status
|
|
32
|
-
*/
|
|
33
|
-
async getStatus() {
|
|
34
|
-
const status = await this.git.status();
|
|
35
|
-
return {
|
|
36
|
-
current: status.current || 'main',
|
|
37
|
-
staged: status.staged,
|
|
38
|
-
modified: status.modified,
|
|
39
|
-
untracked: status.not_added,
|
|
40
|
-
ahead: status.ahead,
|
|
41
|
-
behind: status.behind,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Generate branch name from task
|
|
46
|
-
*/
|
|
47
|
-
generateBranchName(task) {
|
|
48
|
-
const typePrefix = {
|
|
49
|
-
feature: 'feat',
|
|
50
|
-
bug: 'fix',
|
|
51
|
-
chore: 'chore',
|
|
52
|
-
refactor: 'refactor',
|
|
53
|
-
test: 'test',
|
|
54
|
-
doc: 'docs',
|
|
55
|
-
}[task.type];
|
|
56
|
-
// Keep branch concise and deterministic, use only the task id
|
|
57
|
-
return `${typePrefix}/${task.id.toLowerCase()}`;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Create a new branch for a task
|
|
61
|
-
*/
|
|
62
|
-
async createBranch(task, baseBranch) {
|
|
63
|
-
const branchName = this.generateBranchName(task);
|
|
64
|
-
const base = baseBranch || this.config.defaultBranch || 'main';
|
|
65
|
-
// Check if branch already exists
|
|
66
|
-
const branches = await this.git.branchLocal();
|
|
67
|
-
const exists = branches.all.includes(branchName);
|
|
68
|
-
if (exists) {
|
|
69
|
-
log.info('Branch already exists', { branchName }, 'git-service');
|
|
70
|
-
await this.git.checkout(branchName);
|
|
71
|
-
return {
|
|
72
|
-
name: branchName,
|
|
73
|
-
exists: true,
|
|
74
|
-
isCurrentBranch: true,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
// Ensure we're on the base branch and it's up to date
|
|
78
|
-
try {
|
|
79
|
-
await this.git.checkout(base);
|
|
80
|
-
await this.git.pull('origin', base);
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
log.warn('Could not update base branch', error, 'git-service');
|
|
84
|
-
}
|
|
85
|
-
// Create and checkout new branch
|
|
86
|
-
await this.git.checkoutLocalBranch(branchName);
|
|
87
|
-
log.info('Created and checked out branch', { branchName }, 'git-service');
|
|
88
|
-
return {
|
|
89
|
-
name: branchName,
|
|
90
|
-
exists: false,
|
|
91
|
-
isCurrentBranch: true,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Stage and commit changes
|
|
96
|
-
*/
|
|
97
|
-
async commitChanges(task, message, files = ['.']) {
|
|
98
|
-
// Stage only the specified files
|
|
99
|
-
for (const file of files) {
|
|
100
|
-
await this.git.add(file);
|
|
101
|
-
}
|
|
102
|
-
// Generate commit message if not provided
|
|
103
|
-
const commitMessage = message || this.generateCommitMessage(task);
|
|
104
|
-
// Commit only the specified files (avoid committing other pre-staged changes)
|
|
105
|
-
const result = await this.git.commit(commitMessage, files);
|
|
106
|
-
log.info('Committed changes', { commit: result.commit }, 'git-service');
|
|
107
|
-
return {
|
|
108
|
-
hash: result.commit,
|
|
109
|
-
message: commitMessage,
|
|
110
|
-
author: 'Vibeman',
|
|
111
|
-
date: new Date(),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Generate standardized commit message
|
|
116
|
-
*/
|
|
117
|
-
generateCommitMessage(task) {
|
|
118
|
-
const typeMap = {
|
|
119
|
-
feature: 'feat',
|
|
120
|
-
bug: 'fix',
|
|
121
|
-
chore: 'chore',
|
|
122
|
-
refactor: 'refactor',
|
|
123
|
-
test: 'test',
|
|
124
|
-
doc: 'docs',
|
|
125
|
-
};
|
|
126
|
-
const type = typeMap[task.type];
|
|
127
|
-
const scope = task.tags.length > 0 ? `(${task.tags[0]})` : '';
|
|
128
|
-
return `${type}${scope}: ${task.title}\n\n${task.id}: ${task.title}\n\nImplemented via Vibeman`;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get commit history for current branch
|
|
132
|
-
*/
|
|
133
|
-
async getCommitHistory(maxCount = 10) {
|
|
134
|
-
const log = await this.git.log({ maxCount });
|
|
135
|
-
return log.all.map((commit) => ({
|
|
136
|
-
hash: commit.hash,
|
|
137
|
-
message: commit.message,
|
|
138
|
-
author: commit.author_name,
|
|
139
|
-
date: new Date(commit.date),
|
|
140
|
-
}));
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Get Git version information
|
|
144
|
-
*/
|
|
145
|
-
async getGitVersion() {
|
|
146
|
-
return await this.git.version();
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* List all worktrees in the repository
|
|
150
|
-
*/
|
|
151
|
-
async listWorktrees() {
|
|
152
|
-
const worktreeList = await this.git.raw(['worktree', 'list', '--porcelain']);
|
|
153
|
-
return this.parseWorktreeList(worktreeList);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Parse git worktree list output
|
|
157
|
-
*/
|
|
158
|
-
parseWorktreeList(output) {
|
|
159
|
-
const lines = output.trim().split('\n');
|
|
160
|
-
const worktrees = [];
|
|
161
|
-
let currentWorktree = {};
|
|
162
|
-
for (const line of lines) {
|
|
163
|
-
if (line.startsWith('worktree ')) {
|
|
164
|
-
if (currentWorktree.path) {
|
|
165
|
-
worktrees.push(currentWorktree);
|
|
166
|
-
}
|
|
167
|
-
currentWorktree = { path: line.substring(9) };
|
|
168
|
-
}
|
|
169
|
-
else if (line.startsWith('branch ')) {
|
|
170
|
-
const ref = line.substring(7);
|
|
171
|
-
// Strip refs/heads/ prefix if present for readability
|
|
172
|
-
currentWorktree.branch = ref.startsWith('refs/heads/') ? ref.substring(11) : ref;
|
|
173
|
-
}
|
|
174
|
-
else if (line.startsWith('prunable')) {
|
|
175
|
-
currentWorktree.prunable = true;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
if (currentWorktree.path) {
|
|
179
|
-
worktrees.push(currentWorktree);
|
|
180
|
-
}
|
|
181
|
-
return worktrees;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Create a new worktree
|
|
185
|
-
*/
|
|
186
|
-
async createWorktree(worktreePath, branchName, branchExists) {
|
|
187
|
-
if (branchExists) {
|
|
188
|
-
// Create worktree attached to existing branch (no -b)
|
|
189
|
-
await this.git.raw(['worktree', 'add', worktreePath, branchName]);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
// Create worktree and new branch
|
|
193
|
-
await this.git.raw(['worktree', 'add', worktreePath, '-b', branchName]);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Remove a worktree
|
|
198
|
-
*/
|
|
199
|
-
async removeWorktree(worktreePath, force = false) {
|
|
200
|
-
const args = ['worktree', 'remove', worktreePath];
|
|
201
|
-
if (force)
|
|
202
|
-
args.push('--force');
|
|
203
|
-
await this.git.raw(args);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Prune stale worktrees
|
|
207
|
-
*/
|
|
208
|
-
async pruneWorktrees() {
|
|
209
|
-
await this.git.raw(['worktree', 'prune']);
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Delete a local branch
|
|
213
|
-
*/
|
|
214
|
-
async deleteLocalBranch(branchName, force = false) {
|
|
215
|
-
await this.git.deleteLocalBranch(branchName, force);
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Check if branch exists locally
|
|
219
|
-
*/
|
|
220
|
-
async branchExists(branchName) {
|
|
221
|
-
const localBranches = await this.git.branchLocal();
|
|
222
|
-
return !!localBranches.all.find((b) => b === branchName);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Sync with remote repository
|
|
226
|
-
*/
|
|
227
|
-
async syncWithRemote(branchName) {
|
|
228
|
-
try {
|
|
229
|
-
const status = await this.git.status();
|
|
230
|
-
const currentBranch = branchName || status.current;
|
|
231
|
-
if (currentBranch && currentBranch !== 'HEAD') {
|
|
232
|
-
await this.git.fetch();
|
|
233
|
-
log.info('Synced with remote repository', undefined, 'git-service');
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
catch (error) {
|
|
237
|
-
log.warn('Could not sync with remote', error, 'git-service');
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Get Git instance for a specific directory
|
|
242
|
-
*/
|
|
243
|
-
getGitInstance(directory) {
|
|
244
|
-
return simpleGit(directory);
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Check Git status for a specific directory
|
|
248
|
-
*/
|
|
249
|
-
async getGitStatus(directory) {
|
|
250
|
-
const git = this.getGitInstance(directory);
|
|
251
|
-
const status = await git.status();
|
|
252
|
-
return {
|
|
253
|
-
modified: status.modified,
|
|
254
|
-
staged: status.staged,
|
|
255
|
-
not_added: status.not_added,
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Check if directory has uncommitted changes
|
|
260
|
-
*/
|
|
261
|
-
async hasUncommittedChanges(directory = this.projectRoot) {
|
|
262
|
-
try {
|
|
263
|
-
const status = await this.getGitStatus(directory);
|
|
264
|
-
return status.modified.length > 0 || status.staged.length > 0 || status.not_added.length > 0;
|
|
265
|
-
}
|
|
266
|
-
catch {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Get log for a specific directory/worktree
|
|
272
|
-
*/
|
|
273
|
-
async getLog(directory, options) {
|
|
274
|
-
const git = this.getGitInstance(directory);
|
|
275
|
-
return await git.log(options);
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Push branch from specific directory
|
|
279
|
-
*/
|
|
280
|
-
async pushFromDirectory(directory, remote, branchName, options = []) {
|
|
281
|
-
const git = this.getGitInstance(directory);
|
|
282
|
-
await git.push(remote, branchName, options);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { Task, WorktreeInfo as BaseWorktreeInfo, WorktreeConfig } from '../types/index.js';
|
|
3
|
-
import { GitService } from './git-service.js';
|
|
4
|
-
export interface WorktreeInfo extends BaseWorktreeInfo {
|
|
5
|
-
git: GitService;
|
|
6
|
-
}
|
|
7
|
-
export declare class WorktreeService extends EventEmitter {
|
|
8
|
-
private worktrees;
|
|
9
|
-
private inFlightCreates;
|
|
10
|
-
private gitService;
|
|
11
|
-
private projectRoot;
|
|
12
|
-
private config;
|
|
13
|
-
private initialized;
|
|
14
|
-
private initPromise;
|
|
15
|
-
constructor(projectRoot?: string, gitService?: GitService);
|
|
16
|
-
/**
|
|
17
|
-
* Initialize the worktree service
|
|
18
|
-
*/
|
|
19
|
-
initialize(): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Recover existing worktrees after restart
|
|
22
|
-
*/
|
|
23
|
-
private recoverExistingWorktrees;
|
|
24
|
-
/**
|
|
25
|
-
* Extract task ID from worktree path
|
|
26
|
-
* TODO: need to improve this to be more robust
|
|
27
|
-
*/
|
|
28
|
-
private extractTaskIdFromPath;
|
|
29
|
-
/**
|
|
30
|
-
* Create a new worktree for a task
|
|
31
|
-
*/
|
|
32
|
-
createWorktree(task: Task): Promise<WorktreeInfo>;
|
|
33
|
-
/**
|
|
34
|
-
* Symlink essential files to worktree
|
|
35
|
-
*/
|
|
36
|
-
private symlinkEssentialFiles;
|
|
37
|
-
/**
|
|
38
|
-
* Get worktree info for a task
|
|
39
|
-
*/
|
|
40
|
-
getWorktree(taskId: string): WorktreeInfo | null;
|
|
41
|
-
/**
|
|
42
|
-
* List all Git worktrees with connection status to Vibeman tasks
|
|
43
|
-
*/
|
|
44
|
-
listWorktrees(): Promise<Array<BaseWorktreeInfo & {
|
|
45
|
-
isConnectedToTask: boolean;
|
|
46
|
-
}>>;
|
|
47
|
-
/**
|
|
48
|
-
* Unified cleanup: remove branch first, then worktree
|
|
49
|
-
* For connected worktrees, use taskId; for unconnected, use worktreePath and branchName
|
|
50
|
-
*/
|
|
51
|
-
cleanupWorktree(params: {
|
|
52
|
-
taskId?: string;
|
|
53
|
-
worktreePath?: string;
|
|
54
|
-
branchName?: string;
|
|
55
|
-
isConnectedToTask: boolean;
|
|
56
|
-
force?: boolean;
|
|
57
|
-
}): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Delete a worktree
|
|
60
|
-
*/
|
|
61
|
-
deleteWorktree(taskId: string, force?: boolean): Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
* Create pull request from worktree branch
|
|
64
|
-
*/
|
|
65
|
-
createPullRequest(taskId: string, _baseBranch?: string): Promise<{
|
|
66
|
-
success: boolean;
|
|
67
|
-
pullRequest?: any;
|
|
68
|
-
error?: string;
|
|
69
|
-
}>;
|
|
70
|
-
/**
|
|
71
|
-
* Sync worktree state with Git (public method for manual refresh)
|
|
72
|
-
*/
|
|
73
|
-
syncWorktreeState(): Promise<void>;
|
|
74
|
-
/**
|
|
75
|
-
* Validate Git version compatibility for worktrees
|
|
76
|
-
*/
|
|
77
|
-
private validateGitVersion;
|
|
78
|
-
/**
|
|
79
|
-
* Get worktree counts (synchronous, from memory)
|
|
80
|
-
*/
|
|
81
|
-
getWorktreeCounts(): {
|
|
82
|
-
active: number;
|
|
83
|
-
total: number;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Get current configuration
|
|
87
|
-
*/
|
|
88
|
-
getConfig(): WorktreeConfig;
|
|
89
|
-
/**
|
|
90
|
-
* Get GitService instance for advanced operations
|
|
91
|
-
*/
|
|
92
|
-
getGitService(): GitService;
|
|
93
|
-
}
|