@sideboard-ai/core 0.1.86 → 0.1.87
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/agents/cursor-runner.cjs +23 -13
- package/dist/agents/cursor-runner.js +1 -1
- package/dist/{agents-HJ3Y2JN5.js → agents-V6PVSQYH.js} +8 -8
- package/dist/{agents-NDHD3VOL.js → agents-W5446HSV.js} +8 -8
- package/dist/{app-settings-PEXK5VEX.js → app-settings-F36ISTCF.js} +2 -2
- package/dist/{app-settings-K6RFCRF6.js → app-settings-HFINR3XG.js} +2 -2
- package/dist/{caffeinate-hold-EAZNWJBE.js → caffeinate-hold-I7SG6UQR.js} +2 -2
- package/dist/{caffeinate-hold-OHAUWOA6.js → caffeinate-hold-U3QJBV67.js} +2 -2
- package/dist/{chunk-HA2QTIWN.js → chunk-3MA6JH6G.js} +5 -5
- package/dist/{chunk-FWJYLBO6.js → chunk-3WA37BRI.js} +1 -1
- package/dist/{chunk-U4RZ3IQI.js → chunk-4PTN2LED.js} +5 -5
- package/dist/{chunk-RV6DBEDQ.js → chunk-7KDBDMNC.js} +1 -1
- package/dist/{chunk-ZN4NDAHV.js → chunk-A7LONVNO.js} +5 -5
- package/dist/{chunk-M37RITA6.js → chunk-B4R2VB2A.js} +164 -30
- package/dist/{chunk-6ZGTM2E7.js → chunk-CY45C3GA.js} +3 -3
- package/dist/{chunk-6K5VAPVR.js → chunk-DKHGWYWR.js} +1 -1
- package/dist/{chunk-IGEL6M4G.js → chunk-HBXQQ5TO.js} +3 -3
- package/dist/{chunk-7MV3RXSC.js → chunk-JL4SJ6V7.js} +137 -26
- package/dist/{chunk-7FD7COKE.js → chunk-JOF3XIEM.js} +1 -1
- package/dist/{chunk-OBHZKT2T.js → chunk-L63LLCTX.js} +3 -3
- package/dist/{chunk-MFF2RE3I.js → chunk-NZPGMNFC.js} +1 -1
- package/dist/{chunk-HHTHF5BQ.js → chunk-QSLE4VEM.js} +4 -4
- package/dist/{chunk-KE6QLNTJ.js → chunk-QWNROSRB.js} +6 -6
- package/dist/{chunk-45U4RQ74.js → chunk-R2EOZNQI.js} +3 -3
- package/dist/{chunk-AY53MPDE.js → chunk-TC2KY5G7.js} +1 -1
- package/dist/{chunk-4Y745GLN.js → chunk-U4GZKLIV.js} +6 -6
- package/dist/{chunk-EWKHP6DD.js → chunk-UVNXLTFB.js} +5 -5
- package/dist/{chunk-I3FRXL7J.js → chunk-XY6XXMAK.js} +1 -1
- package/dist/{connected-teams-BNBM7OIC.js → connected-teams-SWHJWK2A.js} +2 -2
- package/dist/{connected-teams-LSQ5TAZP.js → connected-teams-TLVKZPJP.js} +2 -2
- package/dist/{coordinator-prompt-HOMHBR2L.js → coordinator-prompt-EC3KQLN3.js} +5 -5
- package/dist/{coordinator-prompt-L65MIGCV.js → coordinator-prompt-PYRAXZN3.js} +5 -5
- package/dist/{cursor-recover-L5PNQUDT.js → cursor-recover-G34BYKL2.js} +1 -1
- package/dist/{cursor-recover-NNK7JPQM.js → cursor-recover-S5ORPW34.js} +1 -1
- package/dist/{global-workspace-VGKPYFE2.js → global-workspace-ICWOWUW6.js} +6 -6
- package/dist/{global-workspace-MXOLTUAR.js → global-workspace-T5IAJF4R.js} +6 -6
- package/dist/index.cjs +632 -525
- package/dist/index.d.cts +43 -9
- package/dist/index.d.ts +43 -9
- package/dist/index.js +212 -252
- package/dist/mcp/run-stdio.cjs +569 -489
- package/dist/mcp/run-stdio.js +184 -225
- package/dist/{paths-VPH3ITBK.js → paths-JQM2XRAD.js} +1 -1
- package/dist/{paths-2OFB7UJG.js → paths-TZX4L5X7.js} +1 -1
- package/dist/{thread-store-BUBR24YA.js → thread-store-V7NOOXKE.js} +2 -2
- package/dist/{thread-store-XTPFCJAI.js → thread-store-XAKWCV2E.js} +2 -2
- package/dist/{workspaces-2GZ2VNNU.js → workspaces-AJCAFW64.js} +7 -7
- package/dist/{workspaces-VWQ5YSND.js → workspaces-J4ULXOUH.js} +7 -7
- package/dist/{worktree-RFCCG23P.js → worktree-4Z2VSHAQ.js} +4 -4
- package/dist/{worktree-WZJ3CFEN.js → worktree-H57CCHWO.js} +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
listWorkspaces,
|
|
5
5
|
removeWorkspace,
|
|
6
6
|
syncWorkspacesFromThreads
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HBXQQ5TO.js";
|
|
8
8
|
import {
|
|
9
9
|
BRIGHTSY_MCP_ALLOWED_TOOLS,
|
|
10
10
|
CLAUDE_MODEL_CATALOG,
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
threadRequestsBrightsyMcp,
|
|
65
65
|
totalTokens,
|
|
66
66
|
writeInjectedMcpConfig
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-U4GZKLIV.js";
|
|
68
68
|
import {
|
|
69
69
|
CLOUD_COORDINATOR_BUSY_REPLY,
|
|
70
70
|
CLOUD_COORDINATOR_STOPPED_REPLY,
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
parseForceStopMessage,
|
|
92
92
|
slackCoordinatorSourceRef,
|
|
93
93
|
takenTeamSlugsForOrchestration
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-4PTN2LED.js";
|
|
95
95
|
import {
|
|
96
96
|
COORDINATOR_TOOL_PLAYBOOK,
|
|
97
97
|
SLACK_REPLY_FORMATTING,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
enrichWorkspacesWithGithub,
|
|
101
101
|
ensureGlobalCoordinatorCwd,
|
|
102
102
|
formatWorkspaceInventory
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-A7LONVNO.js";
|
|
104
104
|
import {
|
|
105
105
|
brightsyConfigPath,
|
|
106
106
|
brightsyMcpServerName,
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
loadBrightsyConfig,
|
|
113
113
|
saveBrightsyConfig,
|
|
114
114
|
switchBrightsyAccount
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-QSLE4VEM.js";
|
|
116
116
|
import {
|
|
117
117
|
LEGACY_PLAN_FILE_REL,
|
|
118
118
|
PLAN_FILE_NAME,
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
isThreadCaffeinated,
|
|
142
142
|
releaseCaffeinateHoldForThread,
|
|
143
143
|
setCaffeinateHold
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-NZPGMNFC.js";
|
|
145
145
|
import {
|
|
146
146
|
FAMOUS_SOCCER_TEAMS,
|
|
147
147
|
addPrStackLayer,
|
|
@@ -214,7 +214,7 @@ import {
|
|
|
214
214
|
worktreeDisplayLabel,
|
|
215
215
|
worktreeDisplayLabelForGroup,
|
|
216
216
|
worktreeNameFromPath
|
|
217
|
-
} from "./chunk-
|
|
217
|
+
} from "./chunk-L63LLCTX.js";
|
|
218
218
|
import {
|
|
219
219
|
ATTACHMENTS_DIR,
|
|
220
220
|
LEGACY_ATTACHMENTS_DIR,
|
|
@@ -283,7 +283,7 @@ import {
|
|
|
283
283
|
updateIntegrationsSettings,
|
|
284
284
|
updateOpencodeSettings,
|
|
285
285
|
writeSecureJson
|
|
286
|
-
} from "./chunk-
|
|
286
|
+
} from "./chunk-XY6XXMAK.js";
|
|
287
287
|
import {
|
|
288
288
|
stripNestedElectronEnv
|
|
289
289
|
} from "./chunk-5KLC2MWZ.js";
|
|
@@ -303,7 +303,7 @@ import {
|
|
|
303
303
|
updateThread,
|
|
304
304
|
withThreadLock,
|
|
305
305
|
writeThread
|
|
306
|
-
} from "./chunk-
|
|
306
|
+
} from "./chunk-3WA37BRI.js";
|
|
307
307
|
import {
|
|
308
308
|
THINKING_EFFORTS,
|
|
309
309
|
isThinkingEffort,
|
|
@@ -313,10 +313,14 @@ import {
|
|
|
313
313
|
thinkingEffortLabel
|
|
314
314
|
} from "./chunk-77WWLBCI.js";
|
|
315
315
|
import {
|
|
316
|
+
CONVENTION_SETUP_RELPATHS,
|
|
316
317
|
appDataDir,
|
|
318
|
+
findConventionSetup,
|
|
317
319
|
getRepoSetupInfo,
|
|
318
320
|
globalAgentCwd,
|
|
319
321
|
hasConductorHook,
|
|
322
|
+
hasConventionSetup,
|
|
323
|
+
hasCursorWorktreeSetup,
|
|
320
324
|
hasRepoHook,
|
|
321
325
|
hasWorkspaceHook,
|
|
322
326
|
loadConductorSettings,
|
|
@@ -324,6 +328,7 @@ import {
|
|
|
324
328
|
loadWorkspaceSettings,
|
|
325
329
|
locksDir,
|
|
326
330
|
repoSlug,
|
|
331
|
+
runCursorWorktreeSetup,
|
|
327
332
|
settingsSourceLabel,
|
|
328
333
|
sideboardHomeDir,
|
|
329
334
|
sideboardReposDir,
|
|
@@ -333,7 +338,7 @@ import {
|
|
|
333
338
|
threadsDir,
|
|
334
339
|
workspaceSettingsSourceLabel,
|
|
335
340
|
worktreesRoot
|
|
336
|
-
} from "./chunk-
|
|
341
|
+
} from "./chunk-B4R2VB2A.js";
|
|
337
342
|
import {
|
|
338
343
|
conductorBundledBinDir,
|
|
339
344
|
enrichPathWithNpmGlobalBin,
|
|
@@ -1320,9 +1325,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
1320
1325
|
`Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
|
|
1321
1326
|
);
|
|
1322
1327
|
}
|
|
1323
|
-
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-
|
|
1328
|
+
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-ICWOWUW6.js");
|
|
1324
1329
|
if (isGlobalThread2(thread)) {
|
|
1325
|
-
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-
|
|
1330
|
+
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-EC3KQLN3.js");
|
|
1326
1331
|
ensureGlobalCoordinatorCwd2(
|
|
1327
1332
|
isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
|
|
1328
1333
|
);
|
|
@@ -1886,6 +1891,14 @@ async function spawnWorkspaceScript(command, opts) {
|
|
|
1886
1891
|
child
|
|
1887
1892
|
};
|
|
1888
1893
|
}
|
|
1894
|
+
async function attachAbort(handle, signal) {
|
|
1895
|
+
if (signal) {
|
|
1896
|
+
const onAbort = () => handle.kill();
|
|
1897
|
+
if (signal.aborted) onAbort();
|
|
1898
|
+
else signal.addEventListener("abort", onAbort, { once: true });
|
|
1899
|
+
}
|
|
1900
|
+
return handle.done;
|
|
1901
|
+
}
|
|
1889
1902
|
async function runSetupScript(repoPath, worktreePath, onLine, opts) {
|
|
1890
1903
|
const settings = loadWorkspaceSettings(worktreePath, repoPath);
|
|
1891
1904
|
if (!settings?.setup) return { ran: false, exitCode: null, source: null };
|
|
@@ -1895,12 +1908,7 @@ async function runSetupScript(repoPath, worktreePath, onLine, opts) {
|
|
|
1895
1908
|
defaultBranch: opts?.defaultBranch,
|
|
1896
1909
|
onLine
|
|
1897
1910
|
});
|
|
1898
|
-
|
|
1899
|
-
const onAbort = () => handle.kill();
|
|
1900
|
-
if (opts.signal.aborted) onAbort();
|
|
1901
|
-
else opts.signal.addEventListener("abort", onAbort, { once: true });
|
|
1902
|
-
}
|
|
1903
|
-
const exitCode = await handle.done;
|
|
1911
|
+
const exitCode = await attachAbort(handle, opts?.signal);
|
|
1904
1912
|
return {
|
|
1905
1913
|
ran: true,
|
|
1906
1914
|
exitCode,
|
|
@@ -1908,6 +1916,34 @@ async function runSetupScript(repoPath, worktreePath, onLine, opts) {
|
|
|
1908
1916
|
kill: handle.kill
|
|
1909
1917
|
};
|
|
1910
1918
|
}
|
|
1919
|
+
async function runConventionSetup(repoPath, worktreePath, onLine, opts) {
|
|
1920
|
+
const found = findConventionSetup(worktreePath, repoPath);
|
|
1921
|
+
if (!found) return { ran: false, exitCode: null, source: null };
|
|
1922
|
+
onLine?.(`[setup] ${found.source}`);
|
|
1923
|
+
const handle = await spawnWorkspaceScript(found.command, {
|
|
1924
|
+
worktreePath,
|
|
1925
|
+
repoPath,
|
|
1926
|
+
defaultBranch: opts?.defaultBranch,
|
|
1927
|
+
onLine
|
|
1928
|
+
});
|
|
1929
|
+
const exitCode = await attachAbort(handle, opts?.signal);
|
|
1930
|
+
return {
|
|
1931
|
+
ran: true,
|
|
1932
|
+
exitCode,
|
|
1933
|
+
source: found.source,
|
|
1934
|
+
kill: handle.kill
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
async function runWorkspaceSetup(repoPath, worktreePath, onLine, opts) {
|
|
1938
|
+
let setup = await runSetupScript(repoPath, worktreePath, onLine, opts);
|
|
1939
|
+
if (!setup.ran) {
|
|
1940
|
+
setup = await runCursorWorktreeSetup(repoPath, worktreePath, onLine);
|
|
1941
|
+
}
|
|
1942
|
+
if (!setup.ran) {
|
|
1943
|
+
setup = await runConventionSetup(repoPath, worktreePath, onLine, opts);
|
|
1944
|
+
}
|
|
1945
|
+
return setup;
|
|
1946
|
+
}
|
|
1911
1947
|
async function runArchiveScript(repoPath, worktreePath, onLine) {
|
|
1912
1948
|
const settings = loadWorkspaceSettings(worktreePath, repoPath);
|
|
1913
1949
|
if (!settings?.archive) return { ran: false, exitCode: null };
|
|
@@ -2000,84 +2036,11 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
2000
2036
|
};
|
|
2001
2037
|
}
|
|
2002
2038
|
|
|
2003
|
-
// src/hook/cursor-worktrees.ts
|
|
2004
|
-
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
2005
|
-
import { join as join3 } from "path";
|
|
2006
|
-
import { execa as execa3 } from "execa";
|
|
2007
|
-
import { createInterface as createInterface3 } from "readline";
|
|
2008
|
-
function loadCursorWorktreesJson(rootPath) {
|
|
2009
|
-
const path2 = join3(rootPath, ".cursor", "worktrees.json");
|
|
2010
|
-
if (!existsSync3(path2)) return null;
|
|
2011
|
-
try {
|
|
2012
|
-
return JSON.parse(readFileSync3(path2, "utf8"));
|
|
2013
|
-
} catch {
|
|
2014
|
-
return null;
|
|
2015
|
-
}
|
|
2016
|
-
}
|
|
2017
|
-
function resolveSetupSpec(config) {
|
|
2018
|
-
if (process.platform === "win32") {
|
|
2019
|
-
return config["setup-worktree-windows"] ?? config["setup-worktree"] ?? null;
|
|
2020
|
-
}
|
|
2021
|
-
return config["setup-worktree-unix"] ?? config["setup-worktree"] ?? null;
|
|
2022
|
-
}
|
|
2023
|
-
async function runCursorWorktreeSetup(repoPath, worktreePath, onLine) {
|
|
2024
|
-
const fromWorktree = loadCursorWorktreesJson(worktreePath);
|
|
2025
|
-
const fromRepo = worktreePath !== repoPath ? loadCursorWorktreesJson(repoPath) : null;
|
|
2026
|
-
const config = fromWorktree ?? fromRepo;
|
|
2027
|
-
if (!config) return { ran: false, exitCode: null, source: null };
|
|
2028
|
-
const spec = resolveSetupSpec(config);
|
|
2029
|
-
if (!spec) return { ran: false, exitCode: null, source: null };
|
|
2030
|
-
const sourceLabel = fromWorktree ? ".cursor/worktrees.json (worktree)" : ".cursor/worktrees.json (main repo)";
|
|
2031
|
-
const env = {
|
|
2032
|
-
...process.env,
|
|
2033
|
-
ROOT_WORKTREE_PATH: repoPath
|
|
2034
|
-
};
|
|
2035
|
-
if (process.platform === "win32") {
|
|
2036
|
-
env.ROOT_WORKTREE_PATH = repoPath;
|
|
2037
|
-
}
|
|
2038
|
-
const commands = Array.isArray(spec) ? spec : [spec.endsWith(".sh") || spec.endsWith(".ps1") ? join3(
|
|
2039
|
-
fromWorktree ? worktreePath : repoPath,
|
|
2040
|
-
".cursor",
|
|
2041
|
-
spec
|
|
2042
|
-
) : spec];
|
|
2043
|
-
let lastExit = 0;
|
|
2044
|
-
for (const command of commands) {
|
|
2045
|
-
const isScriptPath = typeof spec === "string" && (spec.endsWith(".sh") || spec.endsWith(".ps1"));
|
|
2046
|
-
const shell = process.platform === "win32" ? "powershell" : "bash";
|
|
2047
|
-
const args = process.platform === "win32" ? isScriptPath ? ["-File", command] : ["-Command", command] : isScriptPath ? [command] : ["-lc", command];
|
|
2048
|
-
onLine?.(`[cursor setup] ${command}`);
|
|
2049
|
-
const child = execa3(shell, args, {
|
|
2050
|
-
cwd: worktreePath,
|
|
2051
|
-
reject: false,
|
|
2052
|
-
env
|
|
2053
|
-
});
|
|
2054
|
-
if (child.stdout && onLine) {
|
|
2055
|
-
const rl = createInterface3({ input: child.stdout });
|
|
2056
|
-
rl.on("line", onLine);
|
|
2057
|
-
}
|
|
2058
|
-
if (child.stderr && onLine) {
|
|
2059
|
-
const rl = createInterface3({ input: child.stderr });
|
|
2060
|
-
rl.on("line", onLine);
|
|
2061
|
-
}
|
|
2062
|
-
const result = await child;
|
|
2063
|
-
lastExit = result.exitCode ?? null;
|
|
2064
|
-
if (lastExit !== 0 && lastExit !== null) break;
|
|
2065
|
-
}
|
|
2066
|
-
return { ran: true, exitCode: lastExit, source: sourceLabel };
|
|
2067
|
-
}
|
|
2068
|
-
function hasCursorWorktreeSetup(worktreePath, repoPath) {
|
|
2069
|
-
if (loadCursorWorktreesJson(worktreePath)) return true;
|
|
2070
|
-
if (repoPath && repoPath !== worktreePath && loadCursorWorktreesJson(repoPath)) {
|
|
2071
|
-
return true;
|
|
2072
|
-
}
|
|
2073
|
-
return false;
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
2039
|
// src/diff/diff.ts
|
|
2077
|
-
import { existsSync as
|
|
2078
|
-
import { dirname as dirname2, join as
|
|
2040
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, statSync as statSync2, writeFileSync } from "fs";
|
|
2041
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
2079
2042
|
async function inspectGitWorktree(worktreePath) {
|
|
2080
|
-
if (!worktreePath || !
|
|
2043
|
+
if (!worktreePath || !existsSync3(worktreePath)) return "missing_worktree";
|
|
2081
2044
|
const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
|
|
2082
2045
|
reject: false
|
|
2083
2046
|
});
|
|
@@ -2085,7 +2048,7 @@ async function inspectGitWorktree(worktreePath) {
|
|
|
2085
2048
|
return "ok";
|
|
2086
2049
|
}
|
|
2087
2050
|
async function initializeGitRepository(worktreePath) {
|
|
2088
|
-
if (!worktreePath || !
|
|
2051
|
+
if (!worktreePath || !existsSync3(worktreePath)) {
|
|
2089
2052
|
throw new Error("Worktree not found");
|
|
2090
2053
|
}
|
|
2091
2054
|
const status = await inspectGitWorktree(worktreePath);
|
|
@@ -2220,11 +2183,11 @@ new file mode 100644
|
|
|
2220
2183
|
};
|
|
2221
2184
|
}
|
|
2222
2185
|
async function untrackedPatch(worktreePath, path2, maxHunk) {
|
|
2223
|
-
const abs =
|
|
2186
|
+
const abs = join3(worktreePath, path2);
|
|
2224
2187
|
try {
|
|
2225
2188
|
const st = statSync2(abs);
|
|
2226
2189
|
if (st.isFile() && st.size > maxHunk) {
|
|
2227
|
-
const buf =
|
|
2190
|
+
const buf = readFileSync3(abs).subarray(0, maxHunk);
|
|
2228
2191
|
return syntheticAddPatch(path2, buf.toString("utf8"), maxHunk);
|
|
2229
2192
|
}
|
|
2230
2193
|
} catch {
|
|
@@ -2725,7 +2688,7 @@ var DEFAULT_UPLOAD_MAX_BYTES = 5e7;
|
|
|
2725
2688
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
2726
2689
|
assertSafeRelativePath(relativePath);
|
|
2727
2690
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
2728
|
-
const abs =
|
|
2691
|
+
const abs = join3(worktreePath, relativePath);
|
|
2729
2692
|
const st = statSync2(abs);
|
|
2730
2693
|
if (!st.isFile()) {
|
|
2731
2694
|
throw new Error(`Not a file: ${relativePath}`);
|
|
@@ -2735,7 +2698,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
2735
2698
|
`File too large to upload (${st.size} bytes; max ${maxBytes})`
|
|
2736
2699
|
);
|
|
2737
2700
|
}
|
|
2738
|
-
const buf =
|
|
2701
|
+
const buf = readFileSync3(abs);
|
|
2739
2702
|
return {
|
|
2740
2703
|
path: relativePath,
|
|
2741
2704
|
contentBase64: buf.toString("base64"),
|
|
@@ -2745,12 +2708,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
2745
2708
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
2746
2709
|
assertSafeRelativePath(relativePath);
|
|
2747
2710
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
2748
|
-
const abs =
|
|
2711
|
+
const abs = join3(worktreePath, relativePath);
|
|
2749
2712
|
const st = statSync2(abs);
|
|
2750
2713
|
if (!st.isFile()) {
|
|
2751
2714
|
throw new Error(`Not a file: ${relativePath}`);
|
|
2752
2715
|
}
|
|
2753
|
-
const buf =
|
|
2716
|
+
const buf = readFileSync3(abs);
|
|
2754
2717
|
if (isImageRelativePath(relativePath)) {
|
|
2755
2718
|
const maxImageBytes = Math.max(maxBytes, 15e6);
|
|
2756
2719
|
const truncated2 = buf.length > maxImageBytes;
|
|
@@ -2793,7 +2756,7 @@ function assertSafeRelativePath(relativePath) {
|
|
|
2793
2756
|
}
|
|
2794
2757
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
2795
2758
|
assertSafeRelativePath(relativePath);
|
|
2796
|
-
const abs =
|
|
2759
|
+
const abs = join3(worktreePath, relativePath);
|
|
2797
2760
|
mkdirSync2(dirname2(abs), { recursive: true });
|
|
2798
2761
|
writeFileSync(abs, content, "utf8");
|
|
2799
2762
|
return { path: relativePath };
|
|
@@ -2814,9 +2777,9 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
2814
2777
|
}
|
|
2815
2778
|
|
|
2816
2779
|
// src/skills/discover.ts
|
|
2817
|
-
import { existsSync as
|
|
2780
|
+
import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync3 } from "fs";
|
|
2818
2781
|
import { homedir } from "os";
|
|
2819
|
-
import { join as
|
|
2782
|
+
import { join as join4 } from "path";
|
|
2820
2783
|
function toCommand(name) {
|
|
2821
2784
|
return name.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2822
2785
|
}
|
|
@@ -2848,7 +2811,7 @@ function parseFrontmatter(content) {
|
|
|
2848
2811
|
}
|
|
2849
2812
|
function readSkill(skillMd, source) {
|
|
2850
2813
|
try {
|
|
2851
|
-
const content =
|
|
2814
|
+
const content = readFileSync4(skillMd, "utf8");
|
|
2852
2815
|
const { name: fmName, description } = parseFrontmatter(content);
|
|
2853
2816
|
const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
|
|
2854
2817
|
const name = fmName || dirName;
|
|
@@ -2867,7 +2830,7 @@ function readSkill(skillMd, source) {
|
|
|
2867
2830
|
}
|
|
2868
2831
|
}
|
|
2869
2832
|
function scanSkillsDir(dir, source, out) {
|
|
2870
|
-
if (!
|
|
2833
|
+
if (!existsSync4(dir)) return;
|
|
2871
2834
|
let entries;
|
|
2872
2835
|
try {
|
|
2873
2836
|
entries = readdirSync2(dir);
|
|
@@ -2876,8 +2839,8 @@ function scanSkillsDir(dir, source, out) {
|
|
|
2876
2839
|
}
|
|
2877
2840
|
for (const entry of entries) {
|
|
2878
2841
|
if (entry.startsWith(".")) continue;
|
|
2879
|
-
const skillMd =
|
|
2880
|
-
if (!
|
|
2842
|
+
const skillMd = join4(dir, entry, "SKILL.md");
|
|
2843
|
+
if (!existsSync4(skillMd)) continue;
|
|
2881
2844
|
try {
|
|
2882
2845
|
if (!statSync3(skillMd).isFile()) continue;
|
|
2883
2846
|
} catch {
|
|
@@ -2888,7 +2851,7 @@ function scanSkillsDir(dir, source, out) {
|
|
|
2888
2851
|
}
|
|
2889
2852
|
}
|
|
2890
2853
|
function scanClaudePluginSkills(pluginsRoot, out) {
|
|
2891
|
-
if (!
|
|
2854
|
+
if (!existsSync4(pluginsRoot)) return;
|
|
2892
2855
|
const walk = (dir, depth, lookingForSkillsDir) => {
|
|
2893
2856
|
if (depth > 7) return;
|
|
2894
2857
|
let entries;
|
|
@@ -2898,12 +2861,12 @@ function scanClaudePluginSkills(pluginsRoot, out) {
|
|
|
2898
2861
|
return;
|
|
2899
2862
|
}
|
|
2900
2863
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
2901
|
-
const skill = readSkill(
|
|
2864
|
+
const skill = readSkill(join4(dir, "SKILL.md"), "cli");
|
|
2902
2865
|
if (skill) out.push(skill);
|
|
2903
2866
|
}
|
|
2904
2867
|
for (const entry of entries) {
|
|
2905
2868
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
2906
|
-
const full =
|
|
2869
|
+
const full = join4(dir, entry);
|
|
2907
2870
|
try {
|
|
2908
2871
|
if (!statSync3(full).isDirectory()) continue;
|
|
2909
2872
|
} catch {
|
|
@@ -2923,17 +2886,17 @@ function discoverSkills(worktreePath) {
|
|
|
2923
2886
|
const home = homedir();
|
|
2924
2887
|
const collected = [];
|
|
2925
2888
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
2926
|
-
scanSkillsDir(
|
|
2889
|
+
scanSkillsDir(join4(worktreePath, rel), "workspace", collected);
|
|
2927
2890
|
}
|
|
2928
2891
|
for (const abs of [
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2892
|
+
join4(home, ".claude/skills"),
|
|
2893
|
+
join4(home, ".cursor/skills"),
|
|
2894
|
+
join4(home, ".sideboard/skills"),
|
|
2895
|
+
join4(home, ".brightsy/skills")
|
|
2933
2896
|
]) {
|
|
2934
2897
|
scanSkillsDir(abs, "user", collected);
|
|
2935
2898
|
}
|
|
2936
|
-
scanClaudePluginSkills(
|
|
2899
|
+
scanClaudePluginSkills(join4(home, ".claude/plugins"), collected);
|
|
2937
2900
|
const rank = { workspace: 0, user: 1, cli: 2 };
|
|
2938
2901
|
const byCommand = /* @__PURE__ */ new Map();
|
|
2939
2902
|
for (const skill of collected) {
|
|
@@ -2945,7 +2908,7 @@ function discoverSkills(worktreePath) {
|
|
|
2945
2908
|
return [...byCommand.values()].sort((a, b) => a.command.localeCompare(b.command));
|
|
2946
2909
|
}
|
|
2947
2910
|
function readSkillBody(skillPath, maxChars = 12e3) {
|
|
2948
|
-
const raw =
|
|
2911
|
+
const raw = readFileSync4(skillPath, "utf8");
|
|
2949
2912
|
if (raw.startsWith("---")) {
|
|
2950
2913
|
const end = raw.indexOf("\n---", 3);
|
|
2951
2914
|
if (end >= 0) {
|
|
@@ -3086,8 +3049,8 @@ function buildDiffCommentAttachment(input) {
|
|
|
3086
3049
|
}
|
|
3087
3050
|
|
|
3088
3051
|
// src/composer/stage-files.ts
|
|
3089
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
3090
|
-
import { basename as basename2, extname, join as
|
|
3052
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync5, statSync as statSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
3053
|
+
import { basename as basename2, extname, join as join5 } from "path";
|
|
3091
3054
|
import { randomUUID } from "crypto";
|
|
3092
3055
|
var IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
3093
3056
|
"png",
|
|
@@ -3122,22 +3085,22 @@ function imageMimeType(filePath) {
|
|
|
3122
3085
|
return IMAGE_MIME_BY_EXT[fileExtension(filePath)] || "image/png";
|
|
3123
3086
|
}
|
|
3124
3087
|
function ensureAttachmentsDir(worktreePath) {
|
|
3125
|
-
const dir =
|
|
3088
|
+
const dir = join5(worktreePath, ATTACHMENTS_DIR);
|
|
3126
3089
|
mkdirSync3(dir, { recursive: true });
|
|
3127
|
-
const gi =
|
|
3128
|
-
if (!
|
|
3090
|
+
const gi = join5(dir, ".gitignore");
|
|
3091
|
+
if (!existsSync5(gi)) {
|
|
3129
3092
|
writeFileSync2(gi, attachmentsGitignoreBody(), "utf8");
|
|
3130
3093
|
}
|
|
3131
3094
|
return dir;
|
|
3132
3095
|
}
|
|
3133
3096
|
function uniqueAttachmentName(dir, originalName) {
|
|
3134
3097
|
const safe = originalName.replace(/[/\\]/g, "_") || "file";
|
|
3135
|
-
if (!
|
|
3098
|
+
if (!existsSync5(join5(dir, safe))) return safe;
|
|
3136
3099
|
const ext = extname(safe);
|
|
3137
3100
|
const stem = ext ? safe.slice(0, -ext.length) : safe;
|
|
3138
3101
|
for (let i = 1; i < 1e4; i++) {
|
|
3139
3102
|
const candidate = `${stem}-${i}${ext}`;
|
|
3140
|
-
if (!
|
|
3103
|
+
if (!existsSync5(join5(dir, candidate))) return candidate;
|
|
3141
3104
|
}
|
|
3142
3105
|
return `${stem}-${randomUUID()}${ext}`;
|
|
3143
3106
|
}
|
|
@@ -3200,7 +3163,7 @@ function attachmentFromAbsolutePath(absolutePath) {
|
|
|
3200
3163
|
content: `(not a file: ${absolutePath})`
|
|
3201
3164
|
};
|
|
3202
3165
|
}
|
|
3203
|
-
const buf =
|
|
3166
|
+
const buf = readFileSync5(absolutePath);
|
|
3204
3167
|
return attachmentFromBuffer(name, buf, { sourceLabel: absolutePath });
|
|
3205
3168
|
} catch (err) {
|
|
3206
3169
|
return {
|
|
@@ -3221,10 +3184,10 @@ function stageAbsolutePathsAsAttachments(worktreePath, absolutePaths) {
|
|
|
3221
3184
|
const st = statSync4(abs);
|
|
3222
3185
|
if (!st.isFile()) continue;
|
|
3223
3186
|
const name = uniqueAttachmentName(dir, originalName);
|
|
3224
|
-
const destAbs =
|
|
3187
|
+
const destAbs = join5(dir, name);
|
|
3225
3188
|
copyFileSync2(abs, destAbs);
|
|
3226
3189
|
const rel = `${ATTACHMENTS_DIR}/${name}`;
|
|
3227
|
-
const buf =
|
|
3190
|
+
const buf = readFileSync5(destAbs);
|
|
3228
3191
|
out.push(attachmentFromBuffer(name, buf, { path: rel, sourceLabel: abs }));
|
|
3229
3192
|
} catch (err) {
|
|
3230
3193
|
out.push({
|
|
@@ -3246,7 +3209,7 @@ function stageBuffersAsAttachments(worktreePath, buffers) {
|
|
|
3246
3209
|
try {
|
|
3247
3210
|
const buf = Buffer.from(item.dataBase64, "base64");
|
|
3248
3211
|
const name = uniqueAttachmentName(dir, originalName);
|
|
3249
|
-
const destAbs =
|
|
3212
|
+
const destAbs = join5(dir, name);
|
|
3250
3213
|
writeFileSync2(destAbs, buf);
|
|
3251
3214
|
const rel = `${ATTACHMENTS_DIR}/${name}`;
|
|
3252
3215
|
out.push(attachmentFromBuffer(name, buf, { path: rel }));
|
|
@@ -3291,10 +3254,10 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
|
|
|
3291
3254
|
}
|
|
3292
3255
|
const name = basename2(rel);
|
|
3293
3256
|
try {
|
|
3294
|
-
const abs =
|
|
3257
|
+
const abs = join5(worktreePath, rel);
|
|
3295
3258
|
const st = statSync4(abs);
|
|
3296
3259
|
if (!st.isFile()) continue;
|
|
3297
|
-
const buf =
|
|
3260
|
+
const buf = readFileSync5(abs);
|
|
3298
3261
|
out.push(attachmentFromBuffer(name, buf, { path: rel, sourceLabel: abs }));
|
|
3299
3262
|
} catch (err) {
|
|
3300
3263
|
out.push({
|
|
@@ -3775,7 +3738,7 @@ async function confirmLand(thread, opts) {
|
|
|
3775
3738
|
}
|
|
3776
3739
|
|
|
3777
3740
|
// src/threads/create.ts
|
|
3778
|
-
import { existsSync as
|
|
3741
|
+
import { existsSync as existsSync6 } from "fs";
|
|
3779
3742
|
async function createThread(input, _onSetupLine) {
|
|
3780
3743
|
const resolved = resolveNewThreadOptions({
|
|
3781
3744
|
agent: input.agent,
|
|
@@ -3785,7 +3748,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3785
3748
|
});
|
|
3786
3749
|
await requireAgent(resolved.agent);
|
|
3787
3750
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
3788
|
-
if (!
|
|
3751
|
+
if (!existsSync6(repoPath)) {
|
|
3789
3752
|
throw new Error(`Repo not found: ${repoPath}`);
|
|
3790
3753
|
}
|
|
3791
3754
|
let sourceRef = input.sourceRef;
|
|
@@ -3843,7 +3806,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3843
3806
|
return readThread(thread.id) ?? thread;
|
|
3844
3807
|
}
|
|
3845
3808
|
async function listLinearIssues(agent, repoPath) {
|
|
3846
|
-
const { getAdapter: getAdapter2 } = await import("./agents-
|
|
3809
|
+
const { getAdapter: getAdapter2 } = await import("./agents-V6PVSQYH.js");
|
|
3847
3810
|
await requireAgent(agent, { requireLinear: true });
|
|
3848
3811
|
const adapter = getAdapter2(agent);
|
|
3849
3812
|
if (!adapter.listLinearIssues) {
|
|
@@ -4004,7 +3967,7 @@ async function forkThreadWorktree(input, onSetupLine) {
|
|
|
4004
3967
|
}
|
|
4005
3968
|
|
|
4006
3969
|
// src/threads/stack-layers.ts
|
|
4007
|
-
import { existsSync as
|
|
3970
|
+
import { existsSync as existsSync7 } from "fs";
|
|
4008
3971
|
function stackIdFrom(stack) {
|
|
4009
3972
|
if (stack.stackNumber != null) return `gh-stack-${stack.stackNumber}`;
|
|
4010
3973
|
const key = stack.layers.map((l) => l.branchName).join("|");
|
|
@@ -4067,7 +4030,7 @@ async function openStackLayer(input, _onSetupLine) {
|
|
|
4067
4030
|
let createdWorktree = false;
|
|
4068
4031
|
const trees = await listWorktrees(repoPath);
|
|
4069
4032
|
const checkedOut = trees.find((w) => w.branch === branchName);
|
|
4070
|
-
if (checkedOut?.path &&
|
|
4033
|
+
if (checkedOut?.path && existsSync7(checkedOut.path)) {
|
|
4071
4034
|
if (input.reuseExistingWorktree !== false) {
|
|
4072
4035
|
worktreePath = checkedOut.path;
|
|
4073
4036
|
} else {
|
|
@@ -4209,7 +4172,7 @@ async function initStackFromThread(input, onSetupLine) {
|
|
|
4209
4172
|
async function createPrStack(input, onSetupLine) {
|
|
4210
4173
|
await requireAgent(input.agent);
|
|
4211
4174
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
4212
|
-
if (!
|
|
4175
|
+
if (!existsSync7(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
|
|
4213
4176
|
if (!input.branches.length) throw new Error("At least one branch name required");
|
|
4214
4177
|
const status = await detectGhStack(repoPath);
|
|
4215
4178
|
if (!status.available) throw new Error(status.reason);
|
|
@@ -4276,7 +4239,7 @@ async function createPrStack(input, onSetupLine) {
|
|
|
4276
4239
|
}
|
|
4277
4240
|
}
|
|
4278
4241
|
const claimed = new Set(threads.map((t) => t.worktreePath));
|
|
4279
|
-
if (!claimed.has(bootstrap.worktreePath) &&
|
|
4242
|
+
if (!claimed.has(bootstrap.worktreePath) && existsSync7(bootstrap.worktreePath)) {
|
|
4280
4243
|
try {
|
|
4281
4244
|
await removeWorktree(repoPath, bootstrap.worktreePath, {
|
|
4282
4245
|
deleteBranch: bootstrap.branchName
|
|
@@ -4301,23 +4264,23 @@ function stackAgentDefaultsFrom(input) {
|
|
|
4301
4264
|
import { execFileSync } from "child_process";
|
|
4302
4265
|
import {
|
|
4303
4266
|
copyFileSync as copyFileSync3,
|
|
4304
|
-
existsSync as
|
|
4267
|
+
existsSync as existsSync8,
|
|
4305
4268
|
mkdtempSync,
|
|
4306
4269
|
readdirSync as readdirSync3,
|
|
4307
|
-
readFileSync as
|
|
4270
|
+
readFileSync as readFileSync6,
|
|
4308
4271
|
rmSync
|
|
4309
4272
|
} from "fs";
|
|
4310
4273
|
import { tmpdir } from "os";
|
|
4311
|
-
import { join as
|
|
4274
|
+
import { join as join6 } from "path";
|
|
4312
4275
|
import Database from "better-sqlite3";
|
|
4313
|
-
var CONDUCTOR_APP_SUPPORT =
|
|
4276
|
+
var CONDUCTOR_APP_SUPPORT = join6(
|
|
4314
4277
|
process.env.HOME ?? "",
|
|
4315
4278
|
"Library",
|
|
4316
4279
|
"Application Support",
|
|
4317
4280
|
"com.conductor.app"
|
|
4318
4281
|
);
|
|
4319
|
-
var CONDUCTOR_DB =
|
|
4320
|
-
var CURSOR_SDK_STORE =
|
|
4282
|
+
var CONDUCTOR_DB = join6(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
4283
|
+
var CURSOR_SDK_STORE = join6(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
4321
4284
|
function mapAgentType(raw) {
|
|
4322
4285
|
if (!raw) return null;
|
|
4323
4286
|
const v = raw.toLowerCase();
|
|
@@ -4329,7 +4292,7 @@ function mapAgentType(raw) {
|
|
|
4329
4292
|
return null;
|
|
4330
4293
|
}
|
|
4331
4294
|
function resolveConductorCursorAgentId(workspacePath) {
|
|
4332
|
-
if (!workspacePath || !
|
|
4295
|
+
if (!workspacePath || !existsSync8(CURSOR_SDK_STORE)) return null;
|
|
4333
4296
|
const normalized = workspacePath.replace(/\/$/, "");
|
|
4334
4297
|
let best = null;
|
|
4335
4298
|
let hashes;
|
|
@@ -4339,11 +4302,11 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
4339
4302
|
return null;
|
|
4340
4303
|
}
|
|
4341
4304
|
for (const hash of hashes) {
|
|
4342
|
-
const agentsFile =
|
|
4343
|
-
if (!
|
|
4305
|
+
const agentsFile = join6(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
4306
|
+
if (!existsSync8(agentsFile)) continue;
|
|
4344
4307
|
let text3;
|
|
4345
4308
|
try {
|
|
4346
|
-
text3 =
|
|
4309
|
+
text3 = readFileSync6(agentsFile, "utf8");
|
|
4347
4310
|
} catch {
|
|
4348
4311
|
continue;
|
|
4349
4312
|
}
|
|
@@ -4367,7 +4330,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
4367
4330
|
return best?.agentId ?? null;
|
|
4368
4331
|
}
|
|
4369
4332
|
async function adoptThread(input) {
|
|
4370
|
-
if (!
|
|
4333
|
+
if (!existsSync8(input.worktreePath)) {
|
|
4371
4334
|
throw new Error(`Worktree not found: ${input.worktreePath}`);
|
|
4372
4335
|
}
|
|
4373
4336
|
const repoPath = await resolveRepoRoot(input.worktreePath);
|
|
@@ -4386,7 +4349,7 @@ async function adoptThread(input) {
|
|
|
4386
4349
|
messages: input.messages ?? []
|
|
4387
4350
|
});
|
|
4388
4351
|
writeThread(thread);
|
|
4389
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
4352
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-AJCAFW64.js");
|
|
4390
4353
|
await ensureWorkspace2(repoPath);
|
|
4391
4354
|
return thread;
|
|
4392
4355
|
}
|
|
@@ -4394,16 +4357,16 @@ function conductorDbPath() {
|
|
|
4394
4357
|
return CONDUCTOR_DB;
|
|
4395
4358
|
}
|
|
4396
4359
|
function listConductorWorkspaces() {
|
|
4397
|
-
if (!
|
|
4360
|
+
if (!existsSync8(CONDUCTOR_DB)) {
|
|
4398
4361
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
4399
4362
|
}
|
|
4400
|
-
const tmp = mkdtempSync(
|
|
4401
|
-
const snapshot =
|
|
4363
|
+
const tmp = mkdtempSync(join6(tmpdir(), "sideboard-conductor-"));
|
|
4364
|
+
const snapshot = join6(tmp, "conductor.db");
|
|
4402
4365
|
try {
|
|
4403
4366
|
copyFileSync3(CONDUCTOR_DB, snapshot);
|
|
4404
4367
|
for (const suffix of ["-wal", "-shm"]) {
|
|
4405
4368
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
4406
|
-
if (
|
|
4369
|
+
if (existsSync8(src)) {
|
|
4407
4370
|
try {
|
|
4408
4371
|
copyFileSync3(src, `${snapshot}${suffix}`);
|
|
4409
4372
|
} catch {
|
|
@@ -4485,16 +4448,16 @@ function listConductorWorkspaces() {
|
|
|
4485
4448
|
}
|
|
4486
4449
|
}
|
|
4487
4450
|
function importConductorWorkspace(workspaceId) {
|
|
4488
|
-
if (!
|
|
4451
|
+
if (!existsSync8(CONDUCTOR_DB)) {
|
|
4489
4452
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
4490
4453
|
}
|
|
4491
|
-
const tmp = mkdtempSync(
|
|
4492
|
-
const snapshot =
|
|
4454
|
+
const tmp = mkdtempSync(join6(tmpdir(), "sideboard-conductor-"));
|
|
4455
|
+
const snapshot = join6(tmp, "conductor.db");
|
|
4493
4456
|
try {
|
|
4494
4457
|
copyFileSync3(CONDUCTOR_DB, snapshot);
|
|
4495
4458
|
for (const suffix of ["-wal", "-shm"]) {
|
|
4496
4459
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
4497
|
-
if (
|
|
4460
|
+
if (existsSync8(src)) {
|
|
4498
4461
|
try {
|
|
4499
4462
|
copyFileSync3(src, `${snapshot}${suffix}`);
|
|
4500
4463
|
} catch {
|
|
@@ -4514,7 +4477,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
4514
4477
|
).get(workspaceId);
|
|
4515
4478
|
if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
|
|
4516
4479
|
const worktreePath = String(row.workspacePath);
|
|
4517
|
-
if (!
|
|
4480
|
+
if (!existsSync8(worktreePath)) {
|
|
4518
4481
|
throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
|
|
4519
4482
|
}
|
|
4520
4483
|
let sessionId = null;
|
|
@@ -4588,8 +4551,8 @@ async function importConductorWorkspaceAsync(workspaceId) {
|
|
|
4588
4551
|
import { EventEmitter } from "events";
|
|
4589
4552
|
|
|
4590
4553
|
// src/slack/outbound-watch.ts
|
|
4591
|
-
import { existsSync as
|
|
4592
|
-
import { join as
|
|
4554
|
+
import { existsSync as existsSync10, readFileSync as readFileSync8 } from "fs";
|
|
4555
|
+
import { join as join9 } from "path";
|
|
4593
4556
|
|
|
4594
4557
|
// src/slack/api.ts
|
|
4595
4558
|
var SLACK_API = "https://slack.com/api";
|
|
@@ -4631,16 +4594,16 @@ async function slackAuthTest(token) {
|
|
|
4631
4594
|
}
|
|
4632
4595
|
|
|
4633
4596
|
// src/slack/reply-target.ts
|
|
4634
|
-
import { existsSync as
|
|
4635
|
-
import { join as
|
|
4597
|
+
import { existsSync as existsSync9, readFileSync as readFileSync7 } from "fs";
|
|
4598
|
+
import { join as join7 } from "path";
|
|
4636
4599
|
function storePath() {
|
|
4637
|
-
return
|
|
4600
|
+
return join7(appDataDir(), "slack-reply-to.json");
|
|
4638
4601
|
}
|
|
4639
4602
|
function readStore() {
|
|
4640
4603
|
const path2 = storePath();
|
|
4641
|
-
if (!
|
|
4604
|
+
if (!existsSync9(path2)) return {};
|
|
4642
4605
|
try {
|
|
4643
|
-
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse(
|
|
4606
|
+
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse(readFileSync7(path2, "utf8"));
|
|
4644
4607
|
return parsed?.targets && typeof parsed.targets === "object" ? parsed.targets : {};
|
|
4645
4608
|
} catch {
|
|
4646
4609
|
return {};
|
|
@@ -4657,9 +4620,9 @@ function getSlackReplyTarget(threadId) {
|
|
|
4657
4620
|
}
|
|
4658
4621
|
|
|
4659
4622
|
// src/slack/workspaces.ts
|
|
4660
|
-
import { join as
|
|
4623
|
+
import { join as join8 } from "path";
|
|
4661
4624
|
function storePath2() {
|
|
4662
|
-
return
|
|
4625
|
+
return join8(appDataDir(), "slack-workspaces.json");
|
|
4663
4626
|
}
|
|
4664
4627
|
function readStore2() {
|
|
4665
4628
|
try {
|
|
@@ -4775,7 +4738,7 @@ var POLL_INTERVAL_MS = 12e3;
|
|
|
4775
4738
|
var lastPollMs = 0;
|
|
4776
4739
|
var nameCache = /* @__PURE__ */ new Map();
|
|
4777
4740
|
function storePath3() {
|
|
4778
|
-
return
|
|
4741
|
+
return join9(appDataDir(), "slack-outbound-watch.json");
|
|
4779
4742
|
}
|
|
4780
4743
|
function watchId(teamId, channelId, ts) {
|
|
4781
4744
|
return `${teamId}:${channelId}:${ts}`;
|
|
@@ -4805,9 +4768,9 @@ function tsNewer(a, b) {
|
|
|
4805
4768
|
}
|
|
4806
4769
|
function readStore3() {
|
|
4807
4770
|
const path2 = storePath3();
|
|
4808
|
-
if (!
|
|
4771
|
+
if (!existsSync10(path2)) return [];
|
|
4809
4772
|
try {
|
|
4810
|
-
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse(
|
|
4773
|
+
const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse(readFileSync8(path2, "utf8"));
|
|
4811
4774
|
return Array.isArray(parsed?.watches) ? parsed.watches : [];
|
|
4812
4775
|
} catch {
|
|
4813
4776
|
return [];
|
|
@@ -5152,7 +5115,7 @@ async function refreshSlackReplyBadges(opts) {
|
|
|
5152
5115
|
}
|
|
5153
5116
|
|
|
5154
5117
|
// src/orchestrator/orchestrator.ts
|
|
5155
|
-
import { existsSync as
|
|
5118
|
+
import { existsSync as existsSync14 } from "fs";
|
|
5156
5119
|
|
|
5157
5120
|
// src/git/pr-merge-archive.ts
|
|
5158
5121
|
function normalizePrState(state) {
|
|
@@ -5169,8 +5132,8 @@ function shouldAutoArchiveOnPrMerge(opts) {
|
|
|
5169
5132
|
}
|
|
5170
5133
|
|
|
5171
5134
|
// src/git/orphan-cleanup.ts
|
|
5172
|
-
import { existsSync as
|
|
5173
|
-
import { join as
|
|
5135
|
+
import { existsSync as existsSync11, readdirSync as readdirSync4, statSync as statSync5 } from "fs";
|
|
5136
|
+
import { join as join10 } from "path";
|
|
5174
5137
|
function isSideboardWorktreePath(path2) {
|
|
5175
5138
|
return path2.includes("/.sideboard/worktrees/") || path2.includes("/sideboard/workspaces/");
|
|
5176
5139
|
}
|
|
@@ -5181,7 +5144,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
5181
5144
|
repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
|
|
5182
5145
|
);
|
|
5183
5146
|
const homeRoot = sideboardWorkspacesDir();
|
|
5184
|
-
if (
|
|
5147
|
+
if (existsSync11(homeRoot)) {
|
|
5185
5148
|
try {
|
|
5186
5149
|
for (const entry of readdirSync4(homeRoot, { withFileTypes: true })) {
|
|
5187
5150
|
if (!entry.isDirectory()) continue;
|
|
@@ -5193,7 +5156,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
5193
5156
|
const orphans = [];
|
|
5194
5157
|
const seen = /* @__PURE__ */ new Set();
|
|
5195
5158
|
for (const repoPath of repos) {
|
|
5196
|
-
if (!repoPath || !
|
|
5159
|
+
if (!repoPath || !existsSync11(repoPath)) continue;
|
|
5197
5160
|
try {
|
|
5198
5161
|
const wts = await listWorktrees(repoPath);
|
|
5199
5162
|
for (const wt of wts) {
|
|
@@ -5214,12 +5177,12 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
5214
5177
|
}
|
|
5215
5178
|
try {
|
|
5216
5179
|
const root = worktreesRoot(repoPath);
|
|
5217
|
-
if (
|
|
5180
|
+
if (existsSync11(root)) {
|
|
5218
5181
|
for (const entry of readdirSync4(root, { withFileTypes: true })) {
|
|
5219
5182
|
if (!entry.isDirectory()) continue;
|
|
5220
|
-
const path2 =
|
|
5183
|
+
const path2 = join10(root, entry.name).replace(/\/$/, "");
|
|
5221
5184
|
if (known.has(path2) || seen.has(path2)) continue;
|
|
5222
|
-
if (!
|
|
5185
|
+
if (!existsSync11(join10(path2, ".git"))) continue;
|
|
5223
5186
|
seen.add(path2);
|
|
5224
5187
|
let mtimeMs = 0;
|
|
5225
5188
|
try {
|
|
@@ -5286,11 +5249,11 @@ function worktreeCleanupSettings() {
|
|
|
5286
5249
|
}
|
|
5287
5250
|
|
|
5288
5251
|
// src/git/apply-into-main.ts
|
|
5289
|
-
import { execa as
|
|
5252
|
+
import { execa as execa3 } from "execa";
|
|
5290
5253
|
async function applyThreadIntoMain(thread, opts) {
|
|
5291
5254
|
const method = opts?.method ?? "merge";
|
|
5292
5255
|
const target = opts?.targetBranch?.trim() || await resolveDefaultBranch(thread.repoPath);
|
|
5293
|
-
const status = await
|
|
5256
|
+
const status = await execa3("git", ["status", "--porcelain"], {
|
|
5294
5257
|
cwd: thread.repoPath,
|
|
5295
5258
|
reject: false
|
|
5296
5259
|
});
|
|
@@ -5299,7 +5262,7 @@ async function applyThreadIntoMain(thread, opts) {
|
|
|
5299
5262
|
`Main checkout is dirty \u2014 commit or stash before apply-into-main (${thread.repoPath})`
|
|
5300
5263
|
);
|
|
5301
5264
|
}
|
|
5302
|
-
const checkout = await
|
|
5265
|
+
const checkout = await execa3("git", ["checkout", target], {
|
|
5303
5266
|
cwd: thread.repoPath,
|
|
5304
5267
|
reject: false
|
|
5305
5268
|
});
|
|
@@ -5309,7 +5272,7 @@ async function applyThreadIntoMain(thread, opts) {
|
|
|
5309
5272
|
);
|
|
5310
5273
|
}
|
|
5311
5274
|
if (method === "cherry-pick") {
|
|
5312
|
-
const log = await
|
|
5275
|
+
const log = await execa3(
|
|
5313
5276
|
"git",
|
|
5314
5277
|
["log", "--reverse", "--format=%H", `${target}..${thread.branchName}`],
|
|
5315
5278
|
{ cwd: thread.repoPath, reject: false }
|
|
@@ -5324,12 +5287,12 @@ async function applyThreadIntoMain(thread, opts) {
|
|
|
5324
5287
|
};
|
|
5325
5288
|
}
|
|
5326
5289
|
for (const sha of shas) {
|
|
5327
|
-
const cp = await
|
|
5290
|
+
const cp = await execa3("git", ["cherry-pick", sha], {
|
|
5328
5291
|
cwd: thread.repoPath,
|
|
5329
5292
|
reject: false
|
|
5330
5293
|
});
|
|
5331
5294
|
if (cp.exitCode !== 0) {
|
|
5332
|
-
await
|
|
5295
|
+
await execa3("git", ["cherry-pick", "--abort"], {
|
|
5333
5296
|
cwd: thread.repoPath,
|
|
5334
5297
|
reject: false
|
|
5335
5298
|
});
|
|
@@ -5345,13 +5308,13 @@ async function applyThreadIntoMain(thread, opts) {
|
|
|
5345
5308
|
message: `Cherry-picked ${shas.length} commit(s) from ${thread.branchName} into ${target}`
|
|
5346
5309
|
};
|
|
5347
5310
|
}
|
|
5348
|
-
const merge = await
|
|
5311
|
+
const merge = await execa3(
|
|
5349
5312
|
"git",
|
|
5350
5313
|
["merge", "--no-ff", "-m", `Apply Sideboard thread ${thread.branchName}`, thread.branchName],
|
|
5351
5314
|
{ cwd: thread.repoPath, reject: false }
|
|
5352
5315
|
);
|
|
5353
5316
|
if (merge.exitCode !== 0) {
|
|
5354
|
-
await
|
|
5317
|
+
await execa3("git", ["merge", "--abort"], {
|
|
5355
5318
|
cwd: thread.repoPath,
|
|
5356
5319
|
reject: false
|
|
5357
5320
|
});
|
|
@@ -5368,9 +5331,9 @@ async function applyThreadIntoMain(thread, opts) {
|
|
|
5368
5331
|
}
|
|
5369
5332
|
|
|
5370
5333
|
// src/git/clone-repo.ts
|
|
5371
|
-
import { existsSync as
|
|
5372
|
-
import { basename as basename3, join as
|
|
5373
|
-
import { execa as
|
|
5334
|
+
import { existsSync as existsSync12 } from "fs";
|
|
5335
|
+
import { basename as basename3, join as join11 } from "path";
|
|
5336
|
+
import { execa as execa4 } from "execa";
|
|
5374
5337
|
async function cloneRepoIntoSideboard(opts) {
|
|
5375
5338
|
const url = opts.url.trim();
|
|
5376
5339
|
if (!url) throw new Error("Clone URL is required");
|
|
@@ -5380,13 +5343,13 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
5380
5343
|
name = leaf || "repo";
|
|
5381
5344
|
}
|
|
5382
5345
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
5383
|
-
const dest =
|
|
5384
|
-
if (
|
|
5346
|
+
const dest = join11(sideboardReposDir(), name);
|
|
5347
|
+
if (existsSync12(dest)) {
|
|
5385
5348
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
5386
5349
|
const workspace2 = await ensureWorkspace(repoPath2);
|
|
5387
5350
|
return { repoPath: repoPath2, workspace: workspace2 };
|
|
5388
5351
|
}
|
|
5389
|
-
const result = await
|
|
5352
|
+
const result = await execa4("git", ["clone", url, dest], { reject: false });
|
|
5390
5353
|
if (result.exitCode !== 0) {
|
|
5391
5354
|
throw new Error(
|
|
5392
5355
|
`git clone failed: ${result.stderr?.trim() || result.stdout?.trim() || `exit ${result.exitCode}`}`
|
|
@@ -5399,8 +5362,8 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
5399
5362
|
|
|
5400
5363
|
// src/review/request-review.ts
|
|
5401
5364
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
5402
|
-
import { existsSync as
|
|
5403
|
-
import { dirname as dirname3, join as
|
|
5365
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync3 } from "fs";
|
|
5366
|
+
import { dirname as dirname3, join as join12 } from "path";
|
|
5404
5367
|
|
|
5405
5368
|
// src/review/review-request-template.ts
|
|
5406
5369
|
var REVIEW_REQUEST_TEMPLATE = `# Review guidelines:
|
|
@@ -5545,22 +5508,22 @@ function shouldRefreshReviewRequestTemplate(content) {
|
|
|
5545
5508
|
return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
|
|
5546
5509
|
}
|
|
5547
5510
|
function readTextIfPresent(abs) {
|
|
5548
|
-
if (!
|
|
5511
|
+
if (!existsSync13(abs)) return null;
|
|
5549
5512
|
try {
|
|
5550
|
-
const content =
|
|
5513
|
+
const content = readFileSync9(abs, "utf8");
|
|
5551
5514
|
return content.trim() ? content : null;
|
|
5552
5515
|
} catch {
|
|
5553
5516
|
return null;
|
|
5554
5517
|
}
|
|
5555
5518
|
}
|
|
5556
5519
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
5557
|
-
const gitignoreAbs =
|
|
5558
|
-
if (
|
|
5520
|
+
const gitignoreAbs = join12(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
5521
|
+
if (existsSync13(gitignoreAbs)) return;
|
|
5559
5522
|
mkdirSync4(dirname3(gitignoreAbs), { recursive: true });
|
|
5560
5523
|
writeFileSync3(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
5561
5524
|
}
|
|
5562
5525
|
function resolveReviewGuidelines(worktreePath) {
|
|
5563
|
-
const repoAbs =
|
|
5526
|
+
const repoAbs = join12(worktreePath, REPO_REVIEW_PATH);
|
|
5564
5527
|
const repoContent = readTextIfPresent(repoAbs);
|
|
5565
5528
|
if (repoContent) {
|
|
5566
5529
|
return {
|
|
@@ -5570,7 +5533,7 @@ function resolveReviewGuidelines(worktreePath) {
|
|
|
5570
5533
|
source: "repo"
|
|
5571
5534
|
};
|
|
5572
5535
|
}
|
|
5573
|
-
const localAbs =
|
|
5536
|
+
const localAbs = join12(worktreePath, REVIEW_REQUEST_PATH);
|
|
5574
5537
|
const localContent = readTextIfPresent(localAbs);
|
|
5575
5538
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
5576
5539
|
return {
|
|
@@ -5580,7 +5543,7 @@ function resolveReviewGuidelines(worktreePath) {
|
|
|
5580
5543
|
source: "local"
|
|
5581
5544
|
};
|
|
5582
5545
|
}
|
|
5583
|
-
const legacyAbs =
|
|
5546
|
+
const legacyAbs = join12(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
5584
5547
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
5585
5548
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
5586
5549
|
return {
|
|
@@ -5601,7 +5564,7 @@ function resolveReviewGuidelines(worktreePath) {
|
|
|
5601
5564
|
};
|
|
5602
5565
|
}
|
|
5603
5566
|
function ensureReviewRequestFile(worktreePath) {
|
|
5604
|
-
const repoAbs =
|
|
5567
|
+
const repoAbs = join12(worktreePath, REPO_REVIEW_PATH);
|
|
5605
5568
|
const repoContent = readTextIfPresent(repoAbs);
|
|
5606
5569
|
if (repoContent) {
|
|
5607
5570
|
return {
|
|
@@ -5611,10 +5574,10 @@ function ensureReviewRequestFile(worktreePath) {
|
|
|
5611
5574
|
source: "repo"
|
|
5612
5575
|
};
|
|
5613
5576
|
}
|
|
5614
|
-
const localAbs =
|
|
5615
|
-
const localContent = readTextIfPresent(localAbs) ?? readTextIfPresent(
|
|
5577
|
+
const localAbs = join12(worktreePath, REVIEW_REQUEST_PATH);
|
|
5578
|
+
const localContent = readTextIfPresent(localAbs) ?? readTextIfPresent(join12(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
|
|
5616
5579
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
5617
|
-
const path2 =
|
|
5580
|
+
const path2 = existsSync13(localAbs) ? REVIEW_REQUEST_PATH : LEGACY_REVIEW_REQUEST_PATH;
|
|
5618
5581
|
return {
|
|
5619
5582
|
path: path2,
|
|
5620
5583
|
name: REVIEW_REQUEST_NAME,
|
|
@@ -5643,7 +5606,7 @@ function buildReviewRequestAttachment(content, opts) {
|
|
|
5643
5606
|
};
|
|
5644
5607
|
}
|
|
5645
5608
|
function readExistingReviewRequestFile(worktreePath) {
|
|
5646
|
-
return readTextIfPresent(
|
|
5609
|
+
return readTextIfPresent(join12(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent(join12(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent(join12(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
|
|
5647
5610
|
}
|
|
5648
5611
|
async function requestReview(threadRef, send2) {
|
|
5649
5612
|
const from = findThreadByRef(threadRef);
|
|
@@ -5888,7 +5851,7 @@ var Orchestrator = class {
|
|
|
5888
5851
|
}
|
|
5889
5852
|
continue;
|
|
5890
5853
|
}
|
|
5891
|
-
if (!
|
|
5854
|
+
if (!existsSync14(thread.worktreePath)) {
|
|
5892
5855
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
5893
5856
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
5894
5857
|
continue;
|
|
@@ -5907,7 +5870,7 @@ var Orchestrator = class {
|
|
|
5907
5870
|
orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
|
|
5908
5871
|
});
|
|
5909
5872
|
}
|
|
5910
|
-
const { autoCleanupOrphansEnabled: autoCleanupOrphansEnabled2 } = await import("./app-settings-
|
|
5873
|
+
const { autoCleanupOrphansEnabled: autoCleanupOrphansEnabled2 } = await import("./app-settings-HFINR3XG.js");
|
|
5911
5874
|
if (autoCleanupOrphansEnabled2() && shouldRunWorktreeCleanup() && orphans.length > 0) {
|
|
5912
5875
|
await cleanupOrphanWorktrees({ repoPaths });
|
|
5913
5876
|
}
|
|
@@ -6063,14 +6026,7 @@ var Orchestrator = class {
|
|
|
6063
6026
|
return thread;
|
|
6064
6027
|
}
|
|
6065
6028
|
async finishCreateThread(threadId, prompt) {
|
|
6066
|
-
|
|
6067
|
-
const { autoRunAfterSetupEnabled: autoRunAfterSetupEnabled2 } = await import("./app-settings-K6RFCRF6.js");
|
|
6068
|
-
if (autoRunAfterSetupEnabled2()) {
|
|
6069
|
-
try {
|
|
6070
|
-
await this.startDev(threadId);
|
|
6071
|
-
} catch {
|
|
6072
|
-
}
|
|
6073
|
-
}
|
|
6029
|
+
const setup = this.runSetupAfterCreate(threadId);
|
|
6074
6030
|
if (prompt) {
|
|
6075
6031
|
try {
|
|
6076
6032
|
await this.send(threadId, prompt);
|
|
@@ -6081,6 +6037,14 @@ var Orchestrator = class {
|
|
|
6081
6037
|
});
|
|
6082
6038
|
}
|
|
6083
6039
|
}
|
|
6040
|
+
await setup;
|
|
6041
|
+
const { autoRunAfterSetupEnabled: autoRunAfterSetupEnabled2 } = await import("./app-settings-HFINR3XG.js");
|
|
6042
|
+
if (autoRunAfterSetupEnabled2()) {
|
|
6043
|
+
try {
|
|
6044
|
+
await this.startDev(threadId);
|
|
6045
|
+
} catch {
|
|
6046
|
+
}
|
|
6047
|
+
}
|
|
6084
6048
|
}
|
|
6085
6049
|
/** Run workspace setup after a new worktree is created (no-op if none configured). */
|
|
6086
6050
|
async runSetupAfterCreate(threadId) {
|
|
@@ -6335,7 +6299,7 @@ var Orchestrator = class {
|
|
|
6335
6299
|
}
|
|
6336
6300
|
const isBrightsy = fresh.agent === "brightsy";
|
|
6337
6301
|
const isOrchestration = isOrchestratorThread(fresh);
|
|
6338
|
-
const { autoRenameBranchEnabled: autoRenameBranchEnabled2, getGithubGitAuthMode: getGithubGitAuthMode2 } = await import("./app-settings-
|
|
6302
|
+
const { autoRenameBranchEnabled: autoRenameBranchEnabled2, getGithubGitAuthMode: getGithubGitAuthMode2 } = await import("./app-settings-HFINR3XG.js");
|
|
6339
6303
|
const gitAuthMode = getGithubGitAuthMode2();
|
|
6340
6304
|
const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
|
|
6341
6305
|
githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
|
|
@@ -6428,7 +6392,7 @@ var Orchestrator = class {
|
|
|
6428
6392
|
if (this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
|
|
6429
6393
|
const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
|
|
6430
6394
|
if (sessionId) {
|
|
6431
|
-
const { recoverFinishedCursorRun } = await import("./cursor-recover-
|
|
6395
|
+
const { recoverFinishedCursorRun } = await import("./cursor-recover-G34BYKL2.js");
|
|
6432
6396
|
for (let i = 0; i < 8; i++) {
|
|
6433
6397
|
const recovered = recoverFinishedCursorRun({
|
|
6434
6398
|
agentId: sessionId,
|
|
@@ -6778,7 +6742,7 @@ var Orchestrator = class {
|
|
|
6778
6742
|
});
|
|
6779
6743
|
this.emit({ type: "setup_started", threadId: thread.id });
|
|
6780
6744
|
try {
|
|
6781
|
-
|
|
6745
|
+
const setup = await runWorkspaceSetup(
|
|
6782
6746
|
thread.repoPath,
|
|
6783
6747
|
thread.worktreePath,
|
|
6784
6748
|
(line) => {
|
|
@@ -6786,18 +6750,9 @@ var Orchestrator = class {
|
|
|
6786
6750
|
},
|
|
6787
6751
|
{ signal: abort.signal }
|
|
6788
6752
|
);
|
|
6789
|
-
if (!setup.ran) {
|
|
6790
|
-
setup = await runCursorWorktreeSetup(
|
|
6791
|
-
thread.repoPath,
|
|
6792
|
-
thread.worktreePath,
|
|
6793
|
-
(line) => {
|
|
6794
|
-
this.emit({ type: "setup_output", threadId: thread.id, line });
|
|
6795
|
-
}
|
|
6796
|
-
);
|
|
6797
|
-
}
|
|
6798
6753
|
if (!setup.ran) {
|
|
6799
6754
|
throw new Error(
|
|
6800
|
-
"No setup script in .sideboard/settings.toml, .conductor/settings.toml,
|
|
6755
|
+
"No setup script in .sideboard/settings.toml, .conductor/settings.toml, .cursor/worktrees.json, or script/setup (bin/setup, scripts/setup)"
|
|
6801
6756
|
);
|
|
6802
6757
|
}
|
|
6803
6758
|
if (setup.exitCode !== 0 && setup.exitCode !== null) {
|
|
@@ -7052,7 +7007,7 @@ var Orchestrator = class {
|
|
|
7052
7007
|
updateThread(thread.id, { title: meta.title });
|
|
7053
7008
|
}
|
|
7054
7009
|
}
|
|
7055
|
-
const { autoArchiveOnMergeEnabled: autoArchiveOnMergeEnabled2 } = await import("./app-settings-
|
|
7010
|
+
const { autoArchiveOnMergeEnabled: autoArchiveOnMergeEnabled2 } = await import("./app-settings-HFINR3XG.js");
|
|
7056
7011
|
const latest = this.requireThread(thread.id);
|
|
7057
7012
|
if (!shouldAutoArchiveOnPrMerge({
|
|
7058
7013
|
previousPrState: prevState || null,
|
|
@@ -7105,7 +7060,7 @@ var Orchestrator = class {
|
|
|
7105
7060
|
this.emit({ type: "status_changed", threadId: t.id, status: t.status });
|
|
7106
7061
|
}
|
|
7107
7062
|
for (const id of result.createdThreadIds) {
|
|
7108
|
-
|
|
7063
|
+
void this.runSetupAfterCreate(id);
|
|
7109
7064
|
}
|
|
7110
7065
|
return { stack: result.stack, threads: result.threads };
|
|
7111
7066
|
}
|
|
@@ -7122,7 +7077,7 @@ var Orchestrator = class {
|
|
|
7122
7077
|
status: result.thread.status
|
|
7123
7078
|
});
|
|
7124
7079
|
if (result.createdWorktree) {
|
|
7125
|
-
|
|
7080
|
+
void this.runSetupAfterCreate(result.thread.id);
|
|
7126
7081
|
}
|
|
7127
7082
|
return { stack: result.stack, thread: result.thread };
|
|
7128
7083
|
}
|
|
@@ -7137,7 +7092,7 @@ var Orchestrator = class {
|
|
|
7137
7092
|
this.emit({ type: "status_changed", threadId: t.id, status: t.status });
|
|
7138
7093
|
}
|
|
7139
7094
|
for (const id of result.createdThreadIds) {
|
|
7140
|
-
|
|
7095
|
+
void this.runSetupAfterCreate(id);
|
|
7141
7096
|
}
|
|
7142
7097
|
return { stack: result.stack, threads: result.threads };
|
|
7143
7098
|
}
|
|
@@ -7148,7 +7103,7 @@ var Orchestrator = class {
|
|
|
7148
7103
|
this.emit({ type: "status_changed", threadId: t.id, status: t.status });
|
|
7149
7104
|
}
|
|
7150
7105
|
for (const id of result.createdThreadIds) {
|
|
7151
|
-
|
|
7106
|
+
void this.runSetupAfterCreate(id);
|
|
7152
7107
|
}
|
|
7153
7108
|
return { stack: result.stack, threads: result.threads };
|
|
7154
7109
|
}
|
|
@@ -7279,7 +7234,7 @@ var Orchestrator = class {
|
|
|
7279
7234
|
async forkThreadWorktree(input) {
|
|
7280
7235
|
const thread = await forkThreadWorktree(input);
|
|
7281
7236
|
this.emit({ type: "status_changed", threadId: thread.id, status: thread.status });
|
|
7282
|
-
|
|
7237
|
+
void this.runSetupAfterCreate(thread.id);
|
|
7283
7238
|
return thread;
|
|
7284
7239
|
}
|
|
7285
7240
|
renameThread(threadRef, title) {
|
|
@@ -7340,7 +7295,7 @@ var Orchestrator = class {
|
|
|
7340
7295
|
this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
|
|
7341
7296
|
if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
|
|
7342
7297
|
try {
|
|
7343
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
7298
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-AJCAFW64.js");
|
|
7344
7299
|
await ensureWorkspace2(thread.repoPath);
|
|
7345
7300
|
} catch {
|
|
7346
7301
|
}
|
|
@@ -7362,7 +7317,7 @@ var Orchestrator = class {
|
|
|
7362
7317
|
await runArchiveScript(thread.repoPath, thread.worktreePath);
|
|
7363
7318
|
} catch {
|
|
7364
7319
|
}
|
|
7365
|
-
const { deleteBranchOnPurgeEnabled: deleteBranchOnPurgeEnabled2 } = await import("./app-settings-
|
|
7320
|
+
const { deleteBranchOnPurgeEnabled: deleteBranchOnPurgeEnabled2 } = await import("./app-settings-HFINR3XG.js");
|
|
7366
7321
|
const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled2();
|
|
7367
7322
|
await removeWorktree(thread.repoPath, thread.worktreePath, {
|
|
7368
7323
|
deleteBranch: deleteBranch ? thread.branchName : void 0
|
|
@@ -7376,18 +7331,18 @@ var Orchestrator = class {
|
|
|
7376
7331
|
throw new Error("Thread is not archived");
|
|
7377
7332
|
}
|
|
7378
7333
|
if (isGlobalThread(thread)) {
|
|
7379
|
-
const { globalAgentCwd: globalAgentCwd2 } = await import("./paths-
|
|
7334
|
+
const { globalAgentCwd: globalAgentCwd2 } = await import("./paths-JQM2XRAD.js");
|
|
7380
7335
|
updateThread(thread.id, { worktreePath: globalAgentCwd2() });
|
|
7381
7336
|
const restored2 = setStatus(thread.id, "idle");
|
|
7382
7337
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
7383
7338
|
return restored2;
|
|
7384
7339
|
}
|
|
7385
|
-
if (!
|
|
7386
|
-
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-
|
|
7387
|
-
const { execa:
|
|
7340
|
+
if (!existsSync14(thread.worktreePath)) {
|
|
7341
|
+
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-H57CCHWO.js");
|
|
7342
|
+
const { execa: execa5 } = await import("execa");
|
|
7388
7343
|
const slug = thread.worktreePath.split("/").pop();
|
|
7389
7344
|
const dest = thread.worktreePath;
|
|
7390
|
-
await
|
|
7345
|
+
await execa5("git", ["worktree", "add", dest, thread.branchName], {
|
|
7391
7346
|
cwd: thread.repoPath
|
|
7392
7347
|
});
|
|
7393
7348
|
void createThreadWorktree2;
|
|
@@ -7487,22 +7442,22 @@ async function startOrchestration(opts) {
|
|
|
7487
7442
|
planMode: opts.planMode,
|
|
7488
7443
|
attachments: opts.attachments
|
|
7489
7444
|
};
|
|
7490
|
-
const thread = await createThread({
|
|
7445
|
+
const thread = await orch.createThread({
|
|
7491
7446
|
sourceType: "branch",
|
|
7492
7447
|
sourceRef: "default",
|
|
7493
7448
|
...createOpts
|
|
7494
7449
|
}).catch(async () => {
|
|
7495
|
-
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-
|
|
7450
|
+
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-H57CCHWO.js");
|
|
7496
7451
|
const repo = await resolveRepoRoot2(repoPath);
|
|
7497
7452
|
const def = await resolveDefaultBranch2(repo);
|
|
7498
|
-
return createThread({
|
|
7453
|
+
return orch.createThread({
|
|
7499
7454
|
sourceType: "branch",
|
|
7500
7455
|
sourceRef: def,
|
|
7501
7456
|
...createOpts,
|
|
7502
7457
|
repoPath: repo
|
|
7503
7458
|
});
|
|
7504
7459
|
});
|
|
7505
|
-
const { updateThread: upd } = await import("./thread-store-
|
|
7460
|
+
const { updateThread: upd } = await import("./thread-store-XAKWCV2E.js");
|
|
7506
7461
|
const updated = upd(thread.id, {
|
|
7507
7462
|
sourceType: "orchestration",
|
|
7508
7463
|
sourceRef: goal
|
|
@@ -8244,7 +8199,7 @@ function withTimeout(promise, ms, label) {
|
|
|
8244
8199
|
async function startMcpServer() {
|
|
8245
8200
|
const orch = getOrchestrator();
|
|
8246
8201
|
try {
|
|
8247
|
-
const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-
|
|
8202
|
+
const { maxConcurrentAgents: maxConcurrentAgents2 } = await import("./app-settings-HFINR3XG.js");
|
|
8248
8203
|
orch.setMaxConcurrent(maxConcurrentAgents2());
|
|
8249
8204
|
} catch {
|
|
8250
8205
|
}
|
|
@@ -8453,8 +8408,8 @@ async function startMcpServer() {
|
|
|
8453
8408
|
registerSlackTools(server);
|
|
8454
8409
|
registerLinearTools(server);
|
|
8455
8410
|
if (sideboardMcpProfile() !== "worktree") {
|
|
8456
|
-
const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await import("./caffeinate-hold-
|
|
8457
|
-
const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-
|
|
8411
|
+
const { getCaffeinateHold: getCaffeinateHold2, setCaffeinateHold: setCaffeinateHold2 } = await import("./caffeinate-hold-I7SG6UQR.js");
|
|
8412
|
+
const { resolveNewThreadOptions: resolveNewThreadOptions2, resolveThreadDefaults: resolveThreadDefaults2 } = await import("./app-settings-HFINR3XG.js");
|
|
8458
8413
|
const accountDefaults = resolveThreadDefaults2();
|
|
8459
8414
|
const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
|
|
8460
8415
|
server.tool(
|
|
@@ -8497,7 +8452,7 @@ async function startMcpServer() {
|
|
|
8497
8452
|
);
|
|
8498
8453
|
server.tool(
|
|
8499
8454
|
"create_thread",
|
|
8500
|
-
`Create a new worktree thread (chat) from branch, pr, or ticket. Pass repoPath from list_workspaces. From an orchestration chat, omit parentThreadId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Prefer omitting agent/model so Sideboard applies ${accountDefaultsHint}. Then use send_to_thread to chat.`,
|
|
8455
|
+
`Create a new worktree thread (chat) from branch, pr, or ticket. Pass repoPath from list_workspaces. From an orchestration chat, omit parentThreadId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Prefer omitting agent/model so Sideboard applies ${accountDefaultsHint}. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn. Then use send_to_thread to chat.`,
|
|
8501
8456
|
{
|
|
8502
8457
|
sourceType: z3.enum(["branch", "pr", "ticket"]),
|
|
8503
8458
|
sourceRef: z3.string(),
|
|
@@ -9015,7 +8970,7 @@ async function startMcpServer() {
|
|
|
9015
8970
|
);
|
|
9016
8971
|
server.tool(
|
|
9017
8972
|
"run_setup",
|
|
9018
|
-
"Re-run workspace setup (Sideboard/Conductor settings
|
|
8973
|
+
"Re-run workspace setup (Sideboard/Conductor settings, .cursor/worktrees.json, or script/setup). New worktrees already run this automatically.",
|
|
9019
8974
|
{ ref: z3.string() },
|
|
9020
8975
|
async ({ ref }) => {
|
|
9021
8976
|
const result = await orch.runSetup(ref);
|
|
@@ -11175,6 +11130,7 @@ export {
|
|
|
11175
11130
|
CONTEXT_KEEP_RECENT_CHARS,
|
|
11176
11131
|
CONTEXT_KEEP_RECENT_MESSAGES,
|
|
11177
11132
|
CONTEXT_MIN_MESSAGES,
|
|
11133
|
+
CONVENTION_SETUP_RELPATHS,
|
|
11178
11134
|
COORDINATOR_TOOL_PLAYBOOK,
|
|
11179
11135
|
FAMOUS_SOCCER_TEAMS,
|
|
11180
11136
|
GITHUB_GIT_AUTH_MODES,
|
|
@@ -11336,6 +11292,7 @@ export {
|
|
|
11336
11292
|
extractiveSummary,
|
|
11337
11293
|
fetchPrHead,
|
|
11338
11294
|
finalizeParts,
|
|
11295
|
+
findConventionSetup,
|
|
11339
11296
|
findInvalidCacheControlTtlOrder,
|
|
11340
11297
|
findOrphanWorktrees,
|
|
11341
11298
|
findThreadByRef,
|
|
@@ -11407,6 +11364,7 @@ export {
|
|
|
11407
11364
|
hasBakedLinearOAuth,
|
|
11408
11365
|
hasBakedSlackOAuth,
|
|
11409
11366
|
hasConductorHook,
|
|
11367
|
+
hasConventionSetup,
|
|
11410
11368
|
hasCursorWorktreeSetup,
|
|
11411
11369
|
hasRepoHook,
|
|
11412
11370
|
hasWorkspaceHook,
|
|
@@ -11582,10 +11540,12 @@ export {
|
|
|
11582
11540
|
run,
|
|
11583
11541
|
runArchiveScript,
|
|
11584
11542
|
runCloudConnect,
|
|
11543
|
+
runConventionSetup,
|
|
11585
11544
|
runCursorWorktreeSetup,
|
|
11586
11545
|
runSetupScript,
|
|
11587
11546
|
runSlackListen,
|
|
11588
11547
|
runSlackRelayClient,
|
|
11548
|
+
runWorkspaceSetup,
|
|
11589
11549
|
sameWorktreePath,
|
|
11590
11550
|
sanitizeMcpServerName,
|
|
11591
11551
|
saveAppSettings,
|