skimpyclaw 0.3.14 → 0.4.0
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/README.md +47 -37
- package/dist/__tests__/adapter-types.test.d.ts +4 -0
- package/dist/__tests__/adapter-types.test.js +63 -0
- package/dist/__tests__/anthropic-adapter.test.d.ts +4 -0
- package/dist/__tests__/anthropic-adapter.test.js +264 -0
- package/dist/__tests__/api.test.js +0 -1
- package/dist/__tests__/cli.integration.test.js +2 -4
- package/dist/__tests__/cli.test.js +0 -1
- package/dist/__tests__/code-agents-notifications.test.js +137 -0
- package/dist/__tests__/code-agents-parser.test.js +19 -1
- package/dist/__tests__/code-agents-preflight.test.js +3 -28
- package/dist/__tests__/code-agents-utils.test.js +34 -9
- package/dist/__tests__/code-agents-worktrees.test.js +116 -0
- package/dist/__tests__/codex-adapter.test.js +184 -0
- package/dist/__tests__/codex-auth.test.js +66 -0
- package/dist/__tests__/codex-provider-gating.test.js +35 -0
- package/dist/__tests__/codex-unified-loop.test.js +111 -0
- package/dist/__tests__/config-security.test.js +127 -0
- package/dist/__tests__/config.test.js +23 -0
- package/dist/__tests__/context-manager.test.js +243 -164
- package/dist/__tests__/cron-run.test.js +250 -0
- package/dist/__tests__/cron.test.js +12 -38
- package/dist/__tests__/digests.test.js +67 -0
- package/dist/__tests__/discord-attachments.test.js +211 -0
- package/dist/__tests__/discord-docs.test.d.ts +1 -0
- package/dist/__tests__/discord-docs.test.js +27 -0
- package/dist/__tests__/discord-thread-agents.test.d.ts +1 -0
- package/dist/__tests__/discord-thread-agents.test.js +115 -0
- package/dist/__tests__/discord-thread-context.test.d.ts +1 -0
- package/dist/__tests__/discord-thread-context.test.js +42 -0
- package/dist/__tests__/doctor.formatters.test.js +4 -4
- package/dist/__tests__/doctor.index.test.js +1 -1
- package/dist/__tests__/doctor.runner.test.js +3 -15
- package/dist/__tests__/env-sanitizer.test.d.ts +1 -0
- package/dist/__tests__/env-sanitizer.test.js +45 -0
- package/dist/__tests__/exec-approval.test.js +61 -0
- package/dist/__tests__/fetch-tool.test.d.ts +1 -0
- package/dist/__tests__/fetch-tool.test.js +85 -0
- package/dist/__tests__/gateway-status-auth.test.d.ts +1 -0
- package/dist/__tests__/gateway-status-auth.test.js +72 -0
- package/dist/__tests__/heartbeat.test.js +3 -3
- package/dist/__tests__/interactive-sessions.test.d.ts +1 -0
- package/dist/__tests__/interactive-sessions.test.js +96 -0
- package/dist/__tests__/langfuse.test.js +6 -18
- package/dist/__tests__/model-selection.test.js +3 -4
- package/dist/__tests__/providers-init.test.js +2 -8
- package/dist/__tests__/providers-routing.test.js +1 -1
- package/dist/__tests__/providers-utils.test.js +13 -3
- package/dist/__tests__/sessions.test.js +14 -10
- package/dist/__tests__/setup.test.js +12 -29
- package/dist/__tests__/skills.test.js +10 -7
- package/dist/__tests__/stream-formatter.test.d.ts +1 -0
- package/dist/__tests__/stream-formatter.test.js +114 -0
- package/dist/__tests__/token-efficiency.test.js +131 -15
- package/dist/__tests__/tool-loop.test.d.ts +4 -0
- package/dist/__tests__/tool-loop.test.js +505 -0
- package/dist/__tests__/tools.test.js +101 -276
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/__tests__/utils.test.js +14 -0
- package/dist/__tests__/voice.test.js +21 -0
- package/dist/agent.js +35 -4
- package/dist/api.js +113 -37
- package/dist/channels/discord/attachments.d.ts +50 -0
- package/dist/channels/discord/attachments.js +137 -0
- package/dist/channels/discord/delegation.d.ts +5 -0
- package/dist/channels/discord/delegation.js +136 -0
- package/dist/channels/discord/handlers.js +694 -7
- package/dist/channels/discord/index.d.ts +16 -1
- package/dist/channels/discord/index.js +64 -1
- package/dist/channels/discord/thread-agents.d.ts +54 -0
- package/dist/channels/discord/thread-agents.js +323 -0
- package/dist/channels/discord/threads.d.ts +58 -0
- package/dist/channels/discord/threads.js +192 -0
- package/dist/channels/discord/types.js +4 -2
- package/dist/channels/discord/utils.d.ts +16 -0
- package/dist/channels/discord/utils.js +86 -6
- package/dist/channels/telegram/index.d.ts +1 -1
- package/dist/channels/telegram/types.js +1 -1
- package/dist/channels/telegram/utils.js +9 -3
- package/dist/channels.d.ts +1 -1
- package/dist/cli.js +20 -400
- package/dist/code-agents/executor.d.ts +1 -1
- package/dist/code-agents/executor.js +101 -45
- package/dist/code-agents/index.d.ts +2 -7
- package/dist/code-agents/index.js +111 -80
- package/dist/code-agents/interactive-resume.d.ts +6 -0
- package/dist/code-agents/interactive-resume.js +98 -0
- package/dist/code-agents/interactive-sessions.d.ts +20 -0
- package/dist/code-agents/interactive-sessions.js +132 -0
- package/dist/code-agents/parser.js +5 -1
- package/dist/code-agents/registry.d.ts +7 -1
- package/dist/code-agents/registry.js +11 -23
- package/dist/code-agents/stream-formatter.d.ts +8 -0
- package/dist/code-agents/stream-formatter.js +92 -0
- package/dist/code-agents/types.d.ts +16 -24
- package/dist/code-agents/utils.d.ts +35 -11
- package/dist/code-agents/utils.js +349 -95
- package/dist/code-agents/worktrees.d.ts +37 -0
- package/dist/code-agents/worktrees.js +116 -0
- package/dist/config.d.ts +2 -4
- package/dist/config.js +123 -23
- package/dist/cron.d.ts +1 -6
- package/dist/cron.js +175 -82
- package/dist/dashboard/assets/index-B345aOO-.js +65 -0
- package/dist/dashboard/assets/index-ZWK4dalJ.css +1 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/digests.d.ts +1 -0
- package/dist/digests.js +132 -42
- package/dist/doctor/checks.d.ts +0 -3
- package/dist/doctor/checks.js +1 -108
- package/dist/doctor/runner.js +1 -4
- package/dist/env-sanitizer.d.ts +2 -0
- package/dist/env-sanitizer.js +61 -0
- package/dist/exec-approval.d.ts +11 -1
- package/dist/exec-approval.js +17 -4
- package/dist/gateway.d.ts +3 -1
- package/dist/gateway.js +17 -7
- package/dist/heartbeat.js +1 -6
- package/dist/langfuse.js +3 -29
- package/dist/model-selection.js +3 -1
- package/dist/providers/adapter.d.ts +118 -0
- package/dist/providers/adapter.js +6 -0
- package/dist/providers/adapters/anthropic-adapter.d.ts +22 -0
- package/dist/providers/adapters/anthropic-adapter.js +204 -0
- package/dist/providers/adapters/codex-adapter.d.ts +26 -0
- package/dist/providers/adapters/codex-adapter.js +203 -0
- package/dist/providers/anthropic.d.ts +1 -0
- package/dist/providers/anthropic.js +10 -272
- package/dist/providers/codex.d.ts +21 -0
- package/dist/providers/codex.js +149 -330
- package/dist/providers/content.d.ts +1 -1
- package/dist/providers/content.js +2 -2
- package/dist/providers/context-manager.d.ts +18 -6
- package/dist/providers/context-manager.js +199 -223
- package/dist/providers/index.d.ts +9 -1
- package/dist/providers/index.js +73 -64
- package/dist/providers/loop-utils.d.ts +20 -0
- package/dist/providers/loop-utils.js +30 -0
- package/dist/providers/tool-loop.d.ts +12 -0
- package/dist/providers/tool-loop.js +251 -0
- package/dist/providers/utils.d.ts +19 -3
- package/dist/providers/utils.js +100 -29
- package/dist/secure-store.d.ts +8 -0
- package/dist/secure-store.js +80 -0
- package/dist/service.js +3 -28
- package/dist/sessions.d.ts +3 -0
- package/dist/sessions.js +147 -18
- package/dist/setup-templates.js +13 -25
- package/dist/setup.d.ts +10 -6
- package/dist/setup.js +84 -292
- package/dist/skills.js +3 -11
- package/dist/tools/agent-delegation.d.ts +19 -0
- package/dist/tools/agent-delegation.js +49 -0
- package/dist/tools/bash-tool.js +89 -34
- package/dist/tools/definitions.d.ts +199 -302
- package/dist/tools/definitions.js +70 -123
- package/dist/tools/execute-context.d.ts +13 -4
- package/dist/tools/fetch-tool.js +109 -13
- package/dist/tools/file-tools.js +7 -1
- package/dist/tools.d.ts +7 -7
- package/dist/tools.js +133 -151
- package/dist/types.d.ts +37 -30
- package/dist/utils.js +4 -6
- package/dist/voice.d.ts +1 -1
- package/dist/voice.js +17 -4
- package/package.json +33 -23
- package/templates/TOOLS.md +0 -27
- package/dist/__tests__/audit.test.js +0 -122
- package/dist/__tests__/code-agents-orchestrator.test.js +0 -216
- package/dist/__tests__/code-agents-sandbox.test.js +0 -163
- package/dist/__tests__/orchestrator.test.js +0 -425
- package/dist/__tests__/sandbox-bridge.test.js +0 -116
- package/dist/__tests__/sandbox-manager.test.js +0 -144
- package/dist/__tests__/sandbox-mount-security.test.js +0 -139
- package/dist/__tests__/sandbox-runtime.test.js +0 -176
- package/dist/__tests__/subagent.test.js +0 -240
- package/dist/__tests__/telegram.test.js +0 -42
- package/dist/code-agents/orchestrator.d.ts +0 -29
- package/dist/code-agents/orchestrator.js +0 -694
- package/dist/code-agents/worktree.d.ts +0 -40
- package/dist/code-agents/worktree.js +0 -215
- package/dist/dashboard/assets/index-BoTHPby4.js +0 -65
- package/dist/dashboard/assets/index-D4mufvBg.css +0 -1
- package/dist/dashboard.d.ts +0 -8
- package/dist/dashboard.js +0 -4071
- package/dist/discord.d.ts +0 -8
- package/dist/discord.js +0 -792
- package/dist/mcp-context-a8c.d.ts +0 -13
- package/dist/mcp-context-a8c.js +0 -34
- package/dist/orchestrator.d.ts +0 -15
- package/dist/orchestrator.js +0 -676
- package/dist/providers/openai.d.ts +0 -10
- package/dist/providers/openai.js +0 -355
- package/dist/sandbox/bridge.d.ts +0 -5
- package/dist/sandbox/bridge.js +0 -63
- package/dist/sandbox/index.d.ts +0 -5
- package/dist/sandbox/index.js +0 -4
- package/dist/sandbox/manager.d.ts +0 -7
- package/dist/sandbox/manager.js +0 -100
- package/dist/sandbox/mount-security.d.ts +0 -12
- package/dist/sandbox/mount-security.js +0 -122
- package/dist/sandbox/runtime.d.ts +0 -39
- package/dist/sandbox/runtime.js +0 -192
- package/dist/sandbox-utils.d.ts +0 -6
- package/dist/sandbox-utils.js +0 -36
- package/dist/subagent.d.ts +0 -19
- package/dist/subagent.js +0 -407
- package/dist/telegram.d.ts +0 -2
- package/dist/telegram.js +0 -11
- package/dist/tools/browser-tool.d.ts +0 -3
- package/dist/tools/browser-tool.js +0 -266
- package/sandbox/Dockerfile +0 -40
- /package/dist/__tests__/{audit.test.d.ts → code-agents-notifications.test.d.ts} +0 -0
- /package/dist/__tests__/{code-agents-orchestrator.test.d.ts → code-agents-worktrees.test.d.ts} +0 -0
- /package/dist/__tests__/{code-agents-sandbox.test.d.ts → codex-adapter.test.d.ts} +0 -0
- /package/dist/__tests__/{orchestrator.test.d.ts → codex-auth.test.d.ts} +0 -0
- /package/dist/__tests__/{sandbox-bridge.test.d.ts → codex-provider-gating.test.d.ts} +0 -0
- /package/dist/__tests__/{sandbox-manager.test.d.ts → codex-unified-loop.test.d.ts} +0 -0
- /package/dist/__tests__/{sandbox-mount-security.test.d.ts → config-security.test.d.ts} +0 -0
- /package/dist/__tests__/{sandbox-runtime.test.d.ts → cron-run.test.d.ts} +0 -0
- /package/dist/__tests__/{subagent.test.d.ts → digests.test.d.ts} +0 -0
- /package/dist/__tests__/{telegram.test.d.ts → discord-attachments.test.d.ts} +0 -0
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export interface WorktreeInfo {
|
|
2
|
-
/** Absolute path to the worktree directory */
|
|
3
|
-
path: string;
|
|
4
|
-
/** Branch name created for this worktree */
|
|
5
|
-
branch: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Check if a directory is inside a git repo.
|
|
9
|
-
*/
|
|
10
|
-
export declare function isGitRepo(workdir: string): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Get the git repo root directory.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getGitRoot(workdir: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Stage and commit all current changes so worktrees branch from a clean state.
|
|
17
|
-
* Returns the commit hash, or null if nothing to commit.
|
|
18
|
-
*/
|
|
19
|
-
export declare function commitPendingChanges(workdir: string, message: string): string | null;
|
|
20
|
-
/**
|
|
21
|
-
* Create a git worktree for a child agent.
|
|
22
|
-
* Creates a new branch and worktree directory under .skimpyclaw-worktrees/.
|
|
23
|
-
*/
|
|
24
|
-
export declare function createWorktree(workdir: string, childId: string): WorktreeInfo;
|
|
25
|
-
/**
|
|
26
|
-
* Merge a child's worktree branch back into the current branch.
|
|
27
|
-
* Returns { merged: true } on success, { merged: false, conflict: string } on conflict.
|
|
28
|
-
*/
|
|
29
|
-
export declare function mergeWorktree(workdir: string, branch: string, childId: string): {
|
|
30
|
-
merged: boolean;
|
|
31
|
-
conflict?: string;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Remove a worktree and its branch.
|
|
35
|
-
*/
|
|
36
|
-
export declare function removeWorktree(workdir: string, childId: string, branch: string): void;
|
|
37
|
-
/**
|
|
38
|
-
* Clean up all skimpyclaw worktrees in a repo (e.g. on crash recovery).
|
|
39
|
-
*/
|
|
40
|
-
export declare function cleanupAllWorktrees(workdir: string): void;
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
// Git worktree isolation for parallel coding agents.
|
|
2
|
-
// Each parallel child gets its own worktree so they can't overwrite each other.
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
|
-
import { existsSync, rmSync } from 'fs';
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
/**
|
|
7
|
-
* Check if a directory is inside a git repo.
|
|
8
|
-
*/
|
|
9
|
-
export function isGitRepo(workdir) {
|
|
10
|
-
try {
|
|
11
|
-
execSync('git rev-parse --is-inside-work-tree', {
|
|
12
|
-
cwd: workdir,
|
|
13
|
-
timeout: 5000,
|
|
14
|
-
encoding: 'utf-8',
|
|
15
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
16
|
-
});
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get the git repo root directory.
|
|
25
|
-
*/
|
|
26
|
-
export function getGitRoot(workdir) {
|
|
27
|
-
return execSync('git rev-parse --show-toplevel', {
|
|
28
|
-
cwd: workdir,
|
|
29
|
-
timeout: 5000,
|
|
30
|
-
encoding: 'utf-8',
|
|
31
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
32
|
-
}).trim();
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Stage and commit all current changes so worktrees branch from a clean state.
|
|
36
|
-
* Returns the commit hash, or null if nothing to commit.
|
|
37
|
-
*/
|
|
38
|
-
export function commitPendingChanges(workdir, message) {
|
|
39
|
-
try {
|
|
40
|
-
// Check for any changes (staged or unstaged)
|
|
41
|
-
const status = execSync('git status --porcelain', {
|
|
42
|
-
cwd: workdir,
|
|
43
|
-
timeout: 5000,
|
|
44
|
-
encoding: 'utf-8',
|
|
45
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
46
|
-
}).trim();
|
|
47
|
-
if (!status)
|
|
48
|
-
return null;
|
|
49
|
-
execSync('git add -A && git commit -m ' + JSON.stringify(message), {
|
|
50
|
-
cwd: workdir,
|
|
51
|
-
timeout: 10000,
|
|
52
|
-
encoding: 'utf-8',
|
|
53
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
54
|
-
});
|
|
55
|
-
return execSync('git rev-parse HEAD', {
|
|
56
|
-
cwd: workdir,
|
|
57
|
-
timeout: 5000,
|
|
58
|
-
encoding: 'utf-8',
|
|
59
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
60
|
-
}).trim();
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Create a git worktree for a child agent.
|
|
68
|
-
* Creates a new branch and worktree directory under .skimpyclaw-worktrees/.
|
|
69
|
-
*/
|
|
70
|
-
export function createWorktree(workdir, childId) {
|
|
71
|
-
const gitRoot = getGitRoot(workdir);
|
|
72
|
-
const worktreeDir = join(gitRoot, '.skimpyclaw-worktrees', childId);
|
|
73
|
-
const branch = `skimpyclaw-team/${childId}`;
|
|
74
|
-
// Clean up stale worktree/branch if they exist
|
|
75
|
-
try {
|
|
76
|
-
execSync(`git worktree remove --force ${JSON.stringify(worktreeDir)}`, {
|
|
77
|
-
cwd: gitRoot,
|
|
78
|
-
timeout: 10000,
|
|
79
|
-
encoding: 'utf-8',
|
|
80
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
catch { /* didn't exist */ }
|
|
84
|
-
try {
|
|
85
|
-
execSync(`git branch -D ${JSON.stringify(branch)}`, {
|
|
86
|
-
cwd: gitRoot,
|
|
87
|
-
timeout: 5000,
|
|
88
|
-
encoding: 'utf-8',
|
|
89
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
catch { /* didn't exist */ }
|
|
93
|
-
// Create worktree on a new branch from HEAD
|
|
94
|
-
execSync(`git worktree add -b ${JSON.stringify(branch)} ${JSON.stringify(worktreeDir)} HEAD`, {
|
|
95
|
-
cwd: gitRoot,
|
|
96
|
-
timeout: 15000,
|
|
97
|
-
encoding: 'utf-8',
|
|
98
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
99
|
-
});
|
|
100
|
-
return { path: worktreeDir, branch };
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Merge a child's worktree branch back into the current branch.
|
|
104
|
-
* Returns { merged: true } on success, { merged: false, conflict: string } on conflict.
|
|
105
|
-
*/
|
|
106
|
-
export function mergeWorktree(workdir, branch, childId) {
|
|
107
|
-
const gitRoot = getGitRoot(workdir);
|
|
108
|
-
try {
|
|
109
|
-
// First check if the child branch has any changes compared to where it branched
|
|
110
|
-
const diff = execSync(`git diff HEAD...${JSON.stringify(branch)} --stat`, {
|
|
111
|
-
cwd: gitRoot,
|
|
112
|
-
timeout: 10000,
|
|
113
|
-
encoding: 'utf-8',
|
|
114
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
115
|
-
}).trim();
|
|
116
|
-
if (!diff) {
|
|
117
|
-
// No changes on child branch — nothing to merge
|
|
118
|
-
return { merged: true };
|
|
119
|
-
}
|
|
120
|
-
execSync(`git merge --no-edit ${JSON.stringify(branch)}`, {
|
|
121
|
-
cwd: gitRoot,
|
|
122
|
-
timeout: 15000,
|
|
123
|
-
encoding: 'utf-8',
|
|
124
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
125
|
-
});
|
|
126
|
-
return { merged: true };
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
// Merge conflict — abort and report
|
|
130
|
-
try {
|
|
131
|
-
execSync('git merge --abort', {
|
|
132
|
-
cwd: gitRoot,
|
|
133
|
-
timeout: 5000,
|
|
134
|
-
encoding: 'utf-8',
|
|
135
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
catch { /* no merge in progress */ }
|
|
139
|
-
const conflict = err instanceof Error ? err.message : String(err);
|
|
140
|
-
return { merged: false, conflict: conflict.slice(0, 2000) };
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Remove a worktree and its branch.
|
|
145
|
-
*/
|
|
146
|
-
export function removeWorktree(workdir, childId, branch) {
|
|
147
|
-
const gitRoot = getGitRoot(workdir);
|
|
148
|
-
const worktreeDir = join(gitRoot, '.skimpyclaw-worktrees', childId);
|
|
149
|
-
try {
|
|
150
|
-
execSync(`git worktree remove --force ${JSON.stringify(worktreeDir)}`, {
|
|
151
|
-
cwd: gitRoot,
|
|
152
|
-
timeout: 10000,
|
|
153
|
-
encoding: 'utf-8',
|
|
154
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
catch { /* already removed */ }
|
|
158
|
-
// Clean up directory if git worktree remove didn't
|
|
159
|
-
if (existsSync(worktreeDir)) {
|
|
160
|
-
rmSync(worktreeDir, { recursive: true, force: true });
|
|
161
|
-
}
|
|
162
|
-
try {
|
|
163
|
-
execSync(`git branch -D ${JSON.stringify(branch)}`, {
|
|
164
|
-
cwd: gitRoot,
|
|
165
|
-
timeout: 5000,
|
|
166
|
-
encoding: 'utf-8',
|
|
167
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
catch { /* already deleted */ }
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Clean up all skimpyclaw worktrees in a repo (e.g. on crash recovery).
|
|
174
|
-
*/
|
|
175
|
-
export function cleanupAllWorktrees(workdir) {
|
|
176
|
-
const gitRoot = getGitRoot(workdir);
|
|
177
|
-
const worktreeBaseDir = join(gitRoot, '.skimpyclaw-worktrees');
|
|
178
|
-
// Prune stale worktree references
|
|
179
|
-
try {
|
|
180
|
-
execSync('git worktree prune', {
|
|
181
|
-
cwd: gitRoot,
|
|
182
|
-
timeout: 10000,
|
|
183
|
-
encoding: 'utf-8',
|
|
184
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
catch { /* ignore */ }
|
|
188
|
-
// Remove the directory
|
|
189
|
-
if (existsSync(worktreeBaseDir)) {
|
|
190
|
-
rmSync(worktreeBaseDir, { recursive: true, force: true });
|
|
191
|
-
}
|
|
192
|
-
// Delete all skimpyclaw-team/* branches
|
|
193
|
-
try {
|
|
194
|
-
const branches = execSync('git branch --list "skimpyclaw-team/*"', {
|
|
195
|
-
cwd: gitRoot,
|
|
196
|
-
timeout: 5000,
|
|
197
|
-
encoding: 'utf-8',
|
|
198
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
199
|
-
}).trim();
|
|
200
|
-
if (branches) {
|
|
201
|
-
for (const b of branches.split('\n').map(s => s.trim()).filter(Boolean)) {
|
|
202
|
-
try {
|
|
203
|
-
execSync(`git branch -D ${JSON.stringify(b)}`, {
|
|
204
|
-
cwd: gitRoot,
|
|
205
|
-
timeout: 5000,
|
|
206
|
-
encoding: 'utf-8',
|
|
207
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
catch { /* ignore */ }
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
catch { /* ignore */ }
|
|
215
|
-
}
|