@sideboard-ai/core 0.1.86 → 0.1.88
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 +2 -2
- package/dist/{agents-NDHD3VOL.js → agents-LMUFTGKF.js} +8 -8
- package/dist/{agents-HJ3Y2JN5.js → agents-ODBP7J6E.js} +9 -9
- package/dist/{app-settings-K6RFCRF6.js → app-settings-BRF7VKTQ.js} +3 -3
- package/dist/{app-settings-PEXK5VEX.js → app-settings-ZXPAB3QN.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-FWJYLBO6.js → chunk-3WA37BRI.js} +1 -1
- package/dist/{chunk-IGEL6M4G.js → chunk-6EZRSCIT.js} +3 -3
- package/dist/{chunk-AY53MPDE.js → chunk-6LFV4VFI.js} +15 -2
- package/dist/{chunk-OBHZKT2T.js → chunk-7D27DD2X.js} +3 -3
- package/dist/{chunk-RV6DBEDQ.js → chunk-7KDBDMNC.js} +1 -1
- package/dist/{chunk-U4RZ3IQI.js → chunk-B2KIO2SD.js} +5 -5
- package/dist/{chunk-M37RITA6.js → chunk-B4R2VB2A.js} +164 -30
- package/dist/{chunk-6K5VAPVR.js → chunk-DKHGWYWR.js} +1 -1
- package/dist/{chunk-I3FRXL7J.js → chunk-FT2SQOL4.js} +2 -2
- package/dist/{chunk-KE6QLNTJ.js → chunk-JE75QW2I.js} +58 -24
- package/dist/{chunk-7MV3RXSC.js → chunk-JL4SJ6V7.js} +137 -26
- package/dist/{chunk-7FD7COKE.js → chunk-JOF3XIEM.js} +1 -1
- package/dist/{chunk-MFF2RE3I.js → chunk-NZPGMNFC.js} +1 -1
- package/dist/{chunk-HA2QTIWN.js → chunk-OB6IRIFV.js} +5 -5
- package/dist/{chunk-HHTHF5BQ.js → chunk-QSLE4VEM.js} +4 -4
- package/dist/{chunk-4Y745GLN.js → chunk-RJLBSYUO.js} +59 -25
- package/dist/{chunk-5KLC2MWZ.js → chunk-TLPJHLLM.js} +14 -1
- package/dist/{chunk-EWKHP6DD.js → chunk-UHTNJKZX.js} +5 -5
- package/dist/{chunk-ZN4NDAHV.js → chunk-VZ2L4AEJ.js} +5 -5
- package/dist/{chunk-45U4RQ74.js → chunk-WANQFU3S.js} +3 -3
- package/dist/{chunk-6ZGTM2E7.js → chunk-ZXYWWSHZ.js} +3 -3
- 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-L65MIGCV.js → coordinator-prompt-CI5SHONJ.js} +5 -5
- package/dist/{coordinator-prompt-HOMHBR2L.js → coordinator-prompt-UK5LYFN5.js} +6 -6
- 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-MXOLTUAR.js → global-workspace-2YZ2V4I5.js} +6 -6
- package/dist/{global-workspace-VGKPYFE2.js → global-workspace-JQQLPJM5.js} +7 -7
- package/dist/index.cjs +693 -541
- package/dist/index.d.cts +43 -9
- package/dist/index.d.ts +43 -9
- package/dist/index.js +213 -253
- package/dist/mcp/run-stdio.cjs +630 -505
- 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-VWQ5YSND.js → workspaces-FDO5L4NI.js} +7 -7
- package/dist/{workspaces-2GZ2VNNU.js → workspaces-YWCC3WV4.js} +8 -8
- package/dist/{worktree-RFCCG23P.js → worktree-4555QBQ7.js} +4 -4
- package/dist/{worktree-WZJ3CFEN.js → worktree-7YNSJ224.js} +5 -5
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
// src/agents/cursor-runner.ts
|
|
5
5
|
var import_sdk = require("@cursor/sdk");
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
6
|
+
var import_node_fs5 = require("fs");
|
|
7
|
+
var import_node_path6 = require("path");
|
|
8
|
+
var import_node_readline2 = require("readline");
|
|
9
9
|
|
|
10
10
|
// src/hook/nested-electron-env.ts
|
|
11
11
|
var NESTED_ELECTRON_ENV_PREFIXES = ["ELECTRON_", "CHROME_"];
|
|
@@ -25,22 +25,32 @@ var STRIP_NESTED_ELECTRON_THEN_EXEC = [
|
|
|
25
25
|
].join("; ");
|
|
26
26
|
|
|
27
27
|
// src/store/paths.ts
|
|
28
|
-
var
|
|
28
|
+
var import_node_path4 = require("path");
|
|
29
29
|
var import_node_os2 = require("os");
|
|
30
|
-
var
|
|
31
|
-
var
|
|
30
|
+
var import_node_path5 = require("path");
|
|
31
|
+
var import_node_fs4 = require("fs");
|
|
32
32
|
|
|
33
33
|
// src/hook/settings.ts
|
|
34
|
-
var
|
|
34
|
+
var import_node_fs3 = require("fs");
|
|
35
35
|
var import_node_os = require("os");
|
|
36
|
-
var
|
|
36
|
+
var import_node_path3 = require("path");
|
|
37
37
|
var import_smol_toml = require("smol-toml");
|
|
38
38
|
|
|
39
|
+
// src/hook/convention-setup.ts
|
|
40
|
+
var import_node_fs = require("fs");
|
|
41
|
+
var import_node_path = require("path");
|
|
42
|
+
|
|
43
|
+
// src/hook/cursor-worktrees.ts
|
|
44
|
+
var import_node_fs2 = require("fs");
|
|
45
|
+
var import_node_path2 = require("path");
|
|
46
|
+
var import_execa = require("execa");
|
|
47
|
+
var import_node_readline = require("readline");
|
|
48
|
+
|
|
39
49
|
// src/store/paths.ts
|
|
40
50
|
function appDataDir() {
|
|
41
51
|
const override = process.env.SIDEBOARD_APP_DATA?.trim();
|
|
42
|
-
const base = override ? override : process.platform === "darwin" ? (0,
|
|
43
|
-
(0,
|
|
52
|
+
const base = override ? override : process.platform === "darwin" ? (0, import_node_path5.join)((0, import_node_os2.homedir)(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? (0, import_node_path5.join)(process.env.APPDATA ?? (0, import_node_path5.join)((0, import_node_os2.homedir)(), "AppData", "Roaming"), "sideboard") : (0, import_node_path5.join)((0, import_node_os2.homedir)(), ".local", "share", "sideboard");
|
|
53
|
+
(0, import_node_fs4.mkdirSync)(base, { recursive: true });
|
|
44
54
|
return base;
|
|
45
55
|
}
|
|
46
56
|
|
|
@@ -297,8 +307,8 @@ function modelSelection(model, opts) {
|
|
|
297
307
|
return params.length > 0 ? { id, params } : { id };
|
|
298
308
|
}
|
|
299
309
|
function localAgentStore() {
|
|
300
|
-
const root = (0,
|
|
301
|
-
(0,
|
|
310
|
+
const root = (0, import_node_path6.join)(appDataDir(), "cursor-sdk-store");
|
|
311
|
+
(0, import_node_fs5.mkdirSync)(root, { recursive: true });
|
|
302
312
|
return new import_sdk.JsonlLocalAgentStore(root);
|
|
303
313
|
}
|
|
304
314
|
async function cancelStaleLocalRuns(agentId, opts) {
|
|
@@ -324,7 +334,7 @@ async function cancelStaleLocalRuns(agentId, opts) {
|
|
|
324
334
|
return cancelled;
|
|
325
335
|
}
|
|
326
336
|
async function readStdinJson() {
|
|
327
|
-
const rl = (0,
|
|
337
|
+
const rl = (0, import_node_readline2.createInterface)({ input: process.stdin, crlfDelay: Infinity });
|
|
328
338
|
const chunks = [];
|
|
329
339
|
for await (const line of rl) {
|
|
330
340
|
chunks.push(line);
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "../chunk-CBJSPTBG.js";
|
|
6
6
|
import {
|
|
7
7
|
dropNestedElectronEnvFromProcess
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-TLPJHLLM.js";
|
|
9
9
|
import {
|
|
10
10
|
appDataDir
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-B4R2VB2A.js";
|
|
12
12
|
|
|
13
13
|
// src/agents/cursor-runner.ts
|
|
14
14
|
import { Agent, CursorAgentError, JsonlLocalAgentStore } from "@cursor/sdk";
|
|
@@ -32,22 +32,22 @@ import {
|
|
|
32
32
|
resolveCursorModelId,
|
|
33
33
|
resolveLoginCommand,
|
|
34
34
|
resolveQuotaFallbackAgent
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-
|
|
35
|
+
} from "./chunk-JE75QW2I.js";
|
|
36
|
+
import "./chunk-DKHGWYWR.js";
|
|
37
37
|
import {
|
|
38
38
|
ORCHESTRATOR_AGENT_KINDS,
|
|
39
39
|
assertOrchestratorCapableAgent,
|
|
40
40
|
coerceOrchestratorAgent,
|
|
41
41
|
isOrchestratorCapableAgent
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-UHTNJKZX.js";
|
|
43
|
+
import "./chunk-OB6IRIFV.js";
|
|
44
|
+
import "./chunk-ZXYWWSHZ.js";
|
|
45
45
|
import "./chunk-B3SJXYIJ.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-JOF3XIEM.js";
|
|
47
|
+
import "./chunk-6LFV4VFI.js";
|
|
48
48
|
import "./chunk-NSTQ6QKD.js";
|
|
49
49
|
import "./chunk-KGZBYWZ3.js";
|
|
50
|
-
import "./chunk-
|
|
50
|
+
import "./chunk-JL4SJ6V7.js";
|
|
51
51
|
import {
|
|
52
52
|
conductorBundledBinDir,
|
|
53
53
|
enrichPathWithNpmGlobalBin,
|
|
@@ -28,27 +28,27 @@ import {
|
|
|
28
28
|
resolveCursorModelId,
|
|
29
29
|
resolveLoginCommand,
|
|
30
30
|
resolveQuotaFallbackAgent
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-RJLBSYUO.js";
|
|
32
32
|
import {
|
|
33
33
|
ORCHESTRATOR_AGENT_KINDS,
|
|
34
34
|
assertOrchestratorCapableAgent,
|
|
35
35
|
coerceOrchestratorAgent,
|
|
36
36
|
isOrchestratorCapableAgent
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-B2KIO2SD.js";
|
|
38
|
+
import "./chunk-VZ2L4AEJ.js";
|
|
39
|
+
import "./chunk-QSLE4VEM.js";
|
|
40
40
|
import {
|
|
41
41
|
cursorSdkMessageToEvents,
|
|
42
42
|
parseCursorRunnerLine
|
|
43
43
|
} from "./chunk-CBJSPTBG.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-7D27DD2X.js";
|
|
45
45
|
import "./chunk-FKOIHGKV.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-FT2SQOL4.js";
|
|
47
|
+
import "./chunk-TLPJHLLM.js";
|
|
48
48
|
import "./chunk-JT7R45JB.js";
|
|
49
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-3WA37BRI.js";
|
|
50
50
|
import "./chunk-77WWLBCI.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-B4R2VB2A.js";
|
|
52
52
|
import {
|
|
53
53
|
conductorBundledBinDir,
|
|
54
54
|
enrichPathWithNpmGlobalBin,
|
|
@@ -52,11 +52,11 @@ import {
|
|
|
52
52
|
updateDefaultsSettings,
|
|
53
53
|
updateIntegrationsSettings,
|
|
54
54
|
updateOpencodeSettings
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
55
|
+
} from "./chunk-FT2SQOL4.js";
|
|
56
|
+
import "./chunk-TLPJHLLM.js";
|
|
57
57
|
import "./chunk-JT7R45JB.js";
|
|
58
58
|
import "./chunk-77WWLBCI.js";
|
|
59
|
-
import "./chunk-
|
|
59
|
+
import "./chunk-B4R2VB2A.js";
|
|
60
60
|
export {
|
|
61
61
|
GITHUB_GIT_AUTH_MODES,
|
|
62
62
|
HARNESS_ENV_KEYS,
|
|
@@ -54,10 +54,10 @@ import {
|
|
|
54
54
|
updateDefaultsSettings,
|
|
55
55
|
updateIntegrationsSettings,
|
|
56
56
|
updateOpencodeSettings
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-6LFV4VFI.js";
|
|
58
58
|
import "./chunk-NSTQ6QKD.js";
|
|
59
59
|
import "./chunk-KGZBYWZ3.js";
|
|
60
|
-
import "./chunk-
|
|
60
|
+
import "./chunk-JL4SJ6V7.js";
|
|
61
61
|
export {
|
|
62
62
|
GITHUB_GIT_AUTH_MODES,
|
|
63
63
|
HARNESS_ENV_KEYS,
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
releaseCaffeinateHoldForThread,
|
|
6
6
|
setCaffeinateHold,
|
|
7
7
|
setCaffeinateHoldHooks
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NZPGMNFC.js";
|
|
9
9
|
import "./chunk-JT7R45JB.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-B4R2VB2A.js";
|
|
11
11
|
export {
|
|
12
12
|
caffeinateHoldPath,
|
|
13
13
|
getCaffeinateHold,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
releaseCaffeinateHoldForThread,
|
|
8
8
|
setCaffeinateHold,
|
|
9
9
|
setCaffeinateHoldHooks
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7KDBDMNC.js";
|
|
11
11
|
import "./chunk-NSTQ6QKD.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-JL4SJ6V7.js";
|
|
13
13
|
export {
|
|
14
14
|
caffeinateHoldPath,
|
|
15
15
|
getCaffeinateHold,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isGlobalRepoPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B2KIO2SD.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureGhPreferOrigin,
|
|
6
6
|
resolveRepoRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7D27DD2X.js";
|
|
8
8
|
import {
|
|
9
9
|
appDataDir
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-B4R2VB2A.js";
|
|
11
11
|
|
|
12
12
|
// src/store/workspaces.ts
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-KGZBYWZ3.js";
|
|
10
10
|
import {
|
|
11
11
|
appDataDir
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JL4SJ6V7.js";
|
|
13
13
|
|
|
14
14
|
// src/store/app-settings.ts
|
|
15
15
|
import { randomUUID } from "crypto";
|
|
@@ -50,6 +50,18 @@ function wrapElectronAsNodeLaunch(file, args) {
|
|
|
50
50
|
function isStrippedElectronLaunch(command, args) {
|
|
51
51
|
return command === "/bin/sh" && Boolean(args?.[1]?.includes("ELECTRON_RUN_AS_NODE") && args[1].includes("unset"));
|
|
52
52
|
}
|
|
53
|
+
function isElectronLikeCommand(command) {
|
|
54
|
+
const name = command.trim();
|
|
55
|
+
if (!name) return false;
|
|
56
|
+
if (process.versions.electron && name === process.execPath) return true;
|
|
57
|
+
return /(?:^|[/\\])Electron(?:\.exe)?$/i.test(name) || /Sideboard\.app[/\\]/i.test(name) || /Electron\.app[/\\]/i.test(name);
|
|
58
|
+
}
|
|
59
|
+
function unwrapStrippedElectronLaunch(command, args) {
|
|
60
|
+
if (!isStrippedElectronLaunch(command, args) || !args || args.length < 4) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return { file: args[3], args: args.slice(4) };
|
|
64
|
+
}
|
|
53
65
|
|
|
54
66
|
// src/store/secret-vault.ts
|
|
55
67
|
import { join } from "path";
|
|
@@ -1113,7 +1125,8 @@ export {
|
|
|
1113
1125
|
stripNestedElectronEnv,
|
|
1114
1126
|
dropNestedElectronEnvFromProcess,
|
|
1115
1127
|
wrapElectronAsNodeLaunch,
|
|
1116
|
-
|
|
1128
|
+
isElectronLikeCommand,
|
|
1129
|
+
unwrapStrippedElectronLaunch,
|
|
1117
1130
|
resolveVaultKey,
|
|
1118
1131
|
readSecureJson,
|
|
1119
1132
|
writeSecureJson,
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getGithubGitAuthMode,
|
|
6
6
|
getGithubPat
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FT2SQOL4.js";
|
|
8
8
|
import {
|
|
9
9
|
listThreads
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3WA37BRI.js";
|
|
11
11
|
import {
|
|
12
12
|
worktreesRoot
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-B4R2VB2A.js";
|
|
14
14
|
import {
|
|
15
15
|
gh,
|
|
16
16
|
git,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureGlobalCoordinatorCwd
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VZ2L4AEJ.js";
|
|
4
4
|
import {
|
|
5
5
|
allocateTeamName,
|
|
6
6
|
takenSlugsFromThread,
|
|
7
7
|
teamSlugFromName
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7D27DD2X.js";
|
|
9
9
|
import {
|
|
10
10
|
resolveNewThreadOptions,
|
|
11
11
|
resolveThreadDefaults
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-FT2SQOL4.js";
|
|
13
13
|
import {
|
|
14
14
|
createEmptyThread,
|
|
15
15
|
listThreads,
|
|
16
16
|
updateThread,
|
|
17
17
|
writeThread
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3WA37BRI.js";
|
|
19
19
|
import {
|
|
20
20
|
globalAgentCwd
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-B4R2VB2A.js";
|
|
22
22
|
|
|
23
23
|
// src/brightsy/cloud-connect-constants.ts
|
|
24
24
|
var CLOUD_ORCHESTRATOR_GOAL = "Cloud-connected Sideboard orchestrator";
|
|
@@ -1,17 +1,136 @@
|
|
|
1
1
|
// src/store/paths.ts
|
|
2
2
|
import { basename } from "path";
|
|
3
3
|
import { homedir as homedir2 } from "os";
|
|
4
|
-
import { join as
|
|
4
|
+
import { join as join4 } from "path";
|
|
5
5
|
import { mkdirSync } from "fs";
|
|
6
6
|
|
|
7
7
|
// src/hook/settings.ts
|
|
8
|
-
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
9
9
|
import { homedir } from "os";
|
|
10
|
-
import { join } from "path";
|
|
10
|
+
import { join as join3 } from "path";
|
|
11
11
|
import { parse as parseToml } from "smol-toml";
|
|
12
|
+
|
|
13
|
+
// src/hook/convention-setup.ts
|
|
14
|
+
import { existsSync, statSync } from "fs";
|
|
15
|
+
import { join } from "path";
|
|
16
|
+
var CONVENTION_SETUP_RELPATHS = [
|
|
17
|
+
"script/setup",
|
|
18
|
+
"bin/setup",
|
|
19
|
+
"scripts/setup.sh",
|
|
20
|
+
"scripts/setup"
|
|
21
|
+
];
|
|
22
|
+
function isFile(path) {
|
|
23
|
+
try {
|
|
24
|
+
return statSync(path).isFile();
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function normPath(p) {
|
|
30
|
+
return p.replace(/\/+$/, "");
|
|
31
|
+
}
|
|
32
|
+
function findConventionSetup(worktreePath, repoPath) {
|
|
33
|
+
const roots = [
|
|
34
|
+
{ root: worktreePath, where: "worktree" }
|
|
35
|
+
];
|
|
36
|
+
if (repoPath && normPath(repoPath) !== normPath(worktreePath)) {
|
|
37
|
+
roots.push({ root: repoPath, where: "main repo" });
|
|
38
|
+
}
|
|
39
|
+
for (const { root, where } of roots) {
|
|
40
|
+
for (const relPath of CONVENTION_SETUP_RELPATHS) {
|
|
41
|
+
const absPath = join(root, relPath);
|
|
42
|
+
if (!existsSync(absPath) || !isFile(absPath)) continue;
|
|
43
|
+
return {
|
|
44
|
+
relPath,
|
|
45
|
+
absPath,
|
|
46
|
+
command: `bash ${JSON.stringify(absPath)}`,
|
|
47
|
+
source: `${relPath} (${where})`
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function hasConventionSetup(worktreePath, repoPath) {
|
|
54
|
+
return findConventionSetup(worktreePath, repoPath) !== null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// src/hook/cursor-worktrees.ts
|
|
58
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
59
|
+
import { join as join2 } from "path";
|
|
60
|
+
import { execa } from "execa";
|
|
61
|
+
import { createInterface } from "readline";
|
|
62
|
+
function loadCursorWorktreesJson(rootPath) {
|
|
63
|
+
const path = join2(rootPath, ".cursor", "worktrees.json");
|
|
64
|
+
if (!existsSync2(path)) return null;
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
67
|
+
} catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function resolveSetupSpec(config) {
|
|
72
|
+
if (process.platform === "win32") {
|
|
73
|
+
return config["setup-worktree-windows"] ?? config["setup-worktree"] ?? null;
|
|
74
|
+
}
|
|
75
|
+
return config["setup-worktree-unix"] ?? config["setup-worktree"] ?? null;
|
|
76
|
+
}
|
|
77
|
+
async function runCursorWorktreeSetup(repoPath, worktreePath, onLine) {
|
|
78
|
+
const fromWorktree = loadCursorWorktreesJson(worktreePath);
|
|
79
|
+
const fromRepo = worktreePath !== repoPath ? loadCursorWorktreesJson(repoPath) : null;
|
|
80
|
+
const config = fromWorktree ?? fromRepo;
|
|
81
|
+
if (!config) return { ran: false, exitCode: null, source: null };
|
|
82
|
+
const spec = resolveSetupSpec(config);
|
|
83
|
+
if (!spec) return { ran: false, exitCode: null, source: null };
|
|
84
|
+
const sourceLabel = fromWorktree ? ".cursor/worktrees.json (worktree)" : ".cursor/worktrees.json (main repo)";
|
|
85
|
+
const env = {
|
|
86
|
+
...process.env,
|
|
87
|
+
ROOT_WORKTREE_PATH: repoPath
|
|
88
|
+
};
|
|
89
|
+
if (process.platform === "win32") {
|
|
90
|
+
env.ROOT_WORKTREE_PATH = repoPath;
|
|
91
|
+
}
|
|
92
|
+
const commands = Array.isArray(spec) ? spec : [spec.endsWith(".sh") || spec.endsWith(".ps1") ? join2(
|
|
93
|
+
fromWorktree ? worktreePath : repoPath,
|
|
94
|
+
".cursor",
|
|
95
|
+
spec
|
|
96
|
+
) : spec];
|
|
97
|
+
let lastExit = 0;
|
|
98
|
+
for (const command of commands) {
|
|
99
|
+
const isScriptPath = typeof spec === "string" && (spec.endsWith(".sh") || spec.endsWith(".ps1"));
|
|
100
|
+
const shell = process.platform === "win32" ? "powershell" : "bash";
|
|
101
|
+
const args = process.platform === "win32" ? isScriptPath ? ["-File", command] : ["-Command", command] : isScriptPath ? [command] : ["-lc", command];
|
|
102
|
+
onLine?.(`[cursor setup] ${command}`);
|
|
103
|
+
const child = execa(shell, args, {
|
|
104
|
+
cwd: worktreePath,
|
|
105
|
+
reject: false,
|
|
106
|
+
env
|
|
107
|
+
});
|
|
108
|
+
if (child.stdout && onLine) {
|
|
109
|
+
const rl = createInterface({ input: child.stdout });
|
|
110
|
+
rl.on("line", onLine);
|
|
111
|
+
}
|
|
112
|
+
if (child.stderr && onLine) {
|
|
113
|
+
const rl = createInterface({ input: child.stderr });
|
|
114
|
+
rl.on("line", onLine);
|
|
115
|
+
}
|
|
116
|
+
const result = await child;
|
|
117
|
+
lastExit = result.exitCode ?? null;
|
|
118
|
+
if (lastExit !== 0 && lastExit !== null) break;
|
|
119
|
+
}
|
|
120
|
+
return { ran: true, exitCode: lastExit, source: sourceLabel };
|
|
121
|
+
}
|
|
122
|
+
function hasCursorWorktreeSetup(worktreePath, repoPath) {
|
|
123
|
+
if (loadCursorWorktreesJson(worktreePath)) return true;
|
|
124
|
+
if (repoPath && repoPath !== worktreePath && loadCursorWorktreesJson(repoPath)) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// src/hook/settings.ts
|
|
12
131
|
function expandHome(path) {
|
|
13
132
|
if (path.startsWith("~/") || path === "~") {
|
|
14
|
-
return
|
|
133
|
+
return join3(homedir(), path.slice(2));
|
|
15
134
|
}
|
|
16
135
|
return path;
|
|
17
136
|
}
|
|
@@ -24,8 +143,8 @@ function parseAvailableIn(raw) {
|
|
|
24
143
|
return out.length ? out : void 0;
|
|
25
144
|
}
|
|
26
145
|
function parseSettingsFile(path, source) {
|
|
27
|
-
if (!
|
|
28
|
-
const raw =
|
|
146
|
+
if (!existsSync3(path)) return null;
|
|
147
|
+
const raw = readFileSync2(path, "utf8");
|
|
29
148
|
const data = parseToml(raw);
|
|
30
149
|
const scripts = data.scripts ?? {};
|
|
31
150
|
const setup = typeof scripts.setup === "string" ? scripts.setup : void 0;
|
|
@@ -128,15 +247,15 @@ function finalizeSettings(parsed) {
|
|
|
128
247
|
};
|
|
129
248
|
}
|
|
130
249
|
function familyFiles(rootPath, source) {
|
|
131
|
-
const dir =
|
|
250
|
+
const dir = join3(rootPath, `.${source}`);
|
|
132
251
|
return {
|
|
133
|
-
toml:
|
|
134
|
-
local:
|
|
252
|
+
toml: join3(dir, "settings.toml"),
|
|
253
|
+
local: join3(dir, "settings.local.toml")
|
|
135
254
|
};
|
|
136
255
|
}
|
|
137
256
|
function familyExists(rootPath, source) {
|
|
138
257
|
const files = familyFiles(rootPath, source);
|
|
139
|
-
return
|
|
258
|
+
return existsSync3(files.toml) || existsSync3(files.local);
|
|
140
259
|
}
|
|
141
260
|
function detectFamily(rootPath) {
|
|
142
261
|
if (familyExists(rootPath, "sideboard")) return "sideboard";
|
|
@@ -155,7 +274,7 @@ function loadAnyLocal(rootPath) {
|
|
|
155
274
|
loadLocalToml(rootPath, "sideboard")
|
|
156
275
|
);
|
|
157
276
|
}
|
|
158
|
-
function
|
|
277
|
+
function normPath2(p) {
|
|
159
278
|
return p.replace(/\/+$/, "");
|
|
160
279
|
}
|
|
161
280
|
function loadRepoSettings(repoPath) {
|
|
@@ -169,11 +288,11 @@ function loadRepoSettings(repoPath) {
|
|
|
169
288
|
}
|
|
170
289
|
function loadWorkspaceSettings(worktreePath, repoPath) {
|
|
171
290
|
const wtFamily = detectFamily(worktreePath);
|
|
172
|
-
const repoFamily = repoPath &&
|
|
291
|
+
const repoFamily = repoPath && normPath2(repoPath) !== normPath2(worktreePath) ? detectFamily(repoPath) : null;
|
|
173
292
|
const wtToml = wtFamily ? loadCommittedToml(worktreePath, wtFamily) : null;
|
|
174
293
|
const repoToml = repoPath && repoFamily ? loadCommittedToml(repoPath, repoFamily) : null;
|
|
175
294
|
let merged = wtToml ?? repoToml;
|
|
176
|
-
if (repoPath &&
|
|
295
|
+
if (repoPath && normPath2(repoPath) !== normPath2(worktreePath)) {
|
|
177
296
|
merged = mergeSettings(merged, loadAnyLocal(repoPath));
|
|
178
297
|
}
|
|
179
298
|
merged = mergeSettings(merged, loadAnyLocal(worktreePath));
|
|
@@ -187,7 +306,7 @@ function hasRepoHook(repoPath) {
|
|
|
187
306
|
}
|
|
188
307
|
function hasWorkspaceHook(worktreePath, repoPath) {
|
|
189
308
|
if (hasRepoHook(worktreePath)) return true;
|
|
190
|
-
if (repoPath &&
|
|
309
|
+
if (repoPath && normPath2(repoPath) !== normPath2(worktreePath) && hasRepoHook(repoPath)) {
|
|
191
310
|
return true;
|
|
192
311
|
}
|
|
193
312
|
return false;
|
|
@@ -199,16 +318,16 @@ function settingsSourceLabel(rootPath) {
|
|
|
199
318
|
const family = detectFamily(rootPath);
|
|
200
319
|
if (!family) return null;
|
|
201
320
|
const files = familyFiles(rootPath, family);
|
|
202
|
-
if (
|
|
321
|
+
if (existsSync3(files.toml) && existsSync3(files.local)) {
|
|
203
322
|
return `.${family}/settings.toml + local`;
|
|
204
323
|
}
|
|
205
|
-
if (
|
|
324
|
+
if (existsSync3(files.local)) return `.${family}/settings.local.toml`;
|
|
206
325
|
return `.${family}/settings.toml`;
|
|
207
326
|
}
|
|
208
327
|
function workspaceSettingsSourceLabel(worktreePath, repoPath) {
|
|
209
328
|
const wt = settingsSourceLabel(worktreePath);
|
|
210
329
|
if (wt) return `${wt} (worktree)`;
|
|
211
|
-
if (repoPath &&
|
|
330
|
+
if (repoPath && normPath2(repoPath) !== normPath2(worktreePath)) {
|
|
212
331
|
const repo = settingsSourceLabel(repoPath);
|
|
213
332
|
if (repo) return `${repo} (main repo)`;
|
|
214
333
|
}
|
|
@@ -216,42 +335,52 @@ function workspaceSettingsSourceLabel(worktreePath, repoPath) {
|
|
|
216
335
|
}
|
|
217
336
|
function getRepoSetupInfo(worktreePath, repoPath) {
|
|
218
337
|
const settings = loadWorkspaceSettings(worktreePath, repoPath);
|
|
338
|
+
const convention = findConventionSetup(worktreePath, repoPath);
|
|
339
|
+
const cursor = hasCursorWorktreeSetup(worktreePath, repoPath);
|
|
340
|
+
const hasSetupScript = Boolean(settings?.setup) || cursor || Boolean(convention);
|
|
341
|
+
let configLabel = workspaceSettingsSourceLabel(worktreePath, repoPath);
|
|
342
|
+
if (!settings?.setup) {
|
|
343
|
+
if (convention) configLabel = convention.source;
|
|
344
|
+
else if (cursor) {
|
|
345
|
+
configLabel = hasCursorWorktreeSetup(worktreePath) ? ".cursor/worktrees.json (worktree)" : ".cursor/worktrees.json (main repo)";
|
|
346
|
+
}
|
|
347
|
+
}
|
|
219
348
|
return {
|
|
220
|
-
hasConfig: hasWorkspaceHook(worktreePath, repoPath),
|
|
221
|
-
hasSetupScript
|
|
222
|
-
configLabel
|
|
349
|
+
hasConfig: hasWorkspaceHook(worktreePath, repoPath) || cursor || Boolean(convention),
|
|
350
|
+
hasSetupScript,
|
|
351
|
+
configLabel
|
|
223
352
|
};
|
|
224
353
|
}
|
|
225
354
|
|
|
226
355
|
// src/store/paths.ts
|
|
227
356
|
function appDataDir() {
|
|
228
357
|
const override = process.env.SIDEBOARD_APP_DATA?.trim();
|
|
229
|
-
const base = override ? override : process.platform === "darwin" ?
|
|
358
|
+
const base = override ? override : process.platform === "darwin" ? join4(homedir2(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? join4(process.env.APPDATA ?? join4(homedir2(), "AppData", "Roaming"), "sideboard") : join4(homedir2(), ".local", "share", "sideboard");
|
|
230
359
|
mkdirSync(base, { recursive: true });
|
|
231
360
|
return base;
|
|
232
361
|
}
|
|
233
362
|
function threadsDir() {
|
|
234
|
-
const dir =
|
|
363
|
+
const dir = join4(appDataDir(), "threads");
|
|
235
364
|
mkdirSync(dir, { recursive: true });
|
|
236
365
|
return dir;
|
|
237
366
|
}
|
|
238
367
|
function locksDir() {
|
|
239
|
-
const dir =
|
|
368
|
+
const dir = join4(appDataDir(), "locks");
|
|
240
369
|
mkdirSync(dir, { recursive: true });
|
|
241
370
|
return dir;
|
|
242
371
|
}
|
|
243
372
|
function sideboardHomeDir() {
|
|
244
|
-
const dir =
|
|
373
|
+
const dir = join4(homedir2(), "sideboard");
|
|
245
374
|
mkdirSync(dir, { recursive: true });
|
|
246
375
|
return dir;
|
|
247
376
|
}
|
|
248
377
|
function sideboardReposDir() {
|
|
249
|
-
const dir =
|
|
378
|
+
const dir = join4(sideboardHomeDir(), "repos");
|
|
250
379
|
mkdirSync(dir, { recursive: true });
|
|
251
380
|
return dir;
|
|
252
381
|
}
|
|
253
382
|
function sideboardWorkspacesDir() {
|
|
254
|
-
const dir =
|
|
383
|
+
const dir = join4(sideboardHomeDir(), "workspaces");
|
|
255
384
|
mkdirSync(dir, { recursive: true });
|
|
256
385
|
return dir;
|
|
257
386
|
}
|
|
@@ -264,23 +393,28 @@ function worktreesRoot(repoPath) {
|
|
|
264
393
|
mkdirSync(settings.worktreesRoot, { recursive: true });
|
|
265
394
|
return settings.worktreesRoot;
|
|
266
395
|
}
|
|
267
|
-
const dir =
|
|
396
|
+
const dir = join4(sideboardWorkspacesDir(), repoSlug(repoPath));
|
|
268
397
|
mkdirSync(dir, { recursive: true });
|
|
269
398
|
return dir;
|
|
270
399
|
}
|
|
271
400
|
function threadFilePath(id) {
|
|
272
|
-
return
|
|
401
|
+
return join4(threadsDir(), `${id}.json`);
|
|
273
402
|
}
|
|
274
403
|
function threadLockPath(id) {
|
|
275
|
-
return
|
|
404
|
+
return join4(locksDir(), `${id}.lock`);
|
|
276
405
|
}
|
|
277
406
|
function globalAgentCwd() {
|
|
278
|
-
const dir =
|
|
407
|
+
const dir = join4(appDataDir(), "global");
|
|
279
408
|
mkdirSync(dir, { recursive: true });
|
|
280
409
|
return dir;
|
|
281
410
|
}
|
|
282
411
|
|
|
283
412
|
export {
|
|
413
|
+
CONVENTION_SETUP_RELPATHS,
|
|
414
|
+
findConventionSetup,
|
|
415
|
+
hasConventionSetup,
|
|
416
|
+
runCursorWorktreeSetup,
|
|
417
|
+
hasCursorWorktreeSetup,
|
|
284
418
|
loadRepoSettings,
|
|
285
419
|
loadWorkspaceSettings,
|
|
286
420
|
loadConductorSettings,
|