@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.
Files changed (51) hide show
  1. package/dist/agents/cursor-runner.cjs +23 -13
  2. package/dist/agents/cursor-runner.js +1 -1
  3. package/dist/{agents-HJ3Y2JN5.js → agents-V6PVSQYH.js} +8 -8
  4. package/dist/{agents-NDHD3VOL.js → agents-W5446HSV.js} +8 -8
  5. package/dist/{app-settings-PEXK5VEX.js → app-settings-F36ISTCF.js} +2 -2
  6. package/dist/{app-settings-K6RFCRF6.js → app-settings-HFINR3XG.js} +2 -2
  7. package/dist/{caffeinate-hold-EAZNWJBE.js → caffeinate-hold-I7SG6UQR.js} +2 -2
  8. package/dist/{caffeinate-hold-OHAUWOA6.js → caffeinate-hold-U3QJBV67.js} +2 -2
  9. package/dist/{chunk-HA2QTIWN.js → chunk-3MA6JH6G.js} +5 -5
  10. package/dist/{chunk-FWJYLBO6.js → chunk-3WA37BRI.js} +1 -1
  11. package/dist/{chunk-U4RZ3IQI.js → chunk-4PTN2LED.js} +5 -5
  12. package/dist/{chunk-RV6DBEDQ.js → chunk-7KDBDMNC.js} +1 -1
  13. package/dist/{chunk-ZN4NDAHV.js → chunk-A7LONVNO.js} +5 -5
  14. package/dist/{chunk-M37RITA6.js → chunk-B4R2VB2A.js} +164 -30
  15. package/dist/{chunk-6ZGTM2E7.js → chunk-CY45C3GA.js} +3 -3
  16. package/dist/{chunk-6K5VAPVR.js → chunk-DKHGWYWR.js} +1 -1
  17. package/dist/{chunk-IGEL6M4G.js → chunk-HBXQQ5TO.js} +3 -3
  18. package/dist/{chunk-7MV3RXSC.js → chunk-JL4SJ6V7.js} +137 -26
  19. package/dist/{chunk-7FD7COKE.js → chunk-JOF3XIEM.js} +1 -1
  20. package/dist/{chunk-OBHZKT2T.js → chunk-L63LLCTX.js} +3 -3
  21. package/dist/{chunk-MFF2RE3I.js → chunk-NZPGMNFC.js} +1 -1
  22. package/dist/{chunk-HHTHF5BQ.js → chunk-QSLE4VEM.js} +4 -4
  23. package/dist/{chunk-KE6QLNTJ.js → chunk-QWNROSRB.js} +6 -6
  24. package/dist/{chunk-45U4RQ74.js → chunk-R2EOZNQI.js} +3 -3
  25. package/dist/{chunk-AY53MPDE.js → chunk-TC2KY5G7.js} +1 -1
  26. package/dist/{chunk-4Y745GLN.js → chunk-U4GZKLIV.js} +6 -6
  27. package/dist/{chunk-EWKHP6DD.js → chunk-UVNXLTFB.js} +5 -5
  28. package/dist/{chunk-I3FRXL7J.js → chunk-XY6XXMAK.js} +1 -1
  29. package/dist/{connected-teams-BNBM7OIC.js → connected-teams-SWHJWK2A.js} +2 -2
  30. package/dist/{connected-teams-LSQ5TAZP.js → connected-teams-TLVKZPJP.js} +2 -2
  31. package/dist/{coordinator-prompt-HOMHBR2L.js → coordinator-prompt-EC3KQLN3.js} +5 -5
  32. package/dist/{coordinator-prompt-L65MIGCV.js → coordinator-prompt-PYRAXZN3.js} +5 -5
  33. package/dist/{cursor-recover-L5PNQUDT.js → cursor-recover-G34BYKL2.js} +1 -1
  34. package/dist/{cursor-recover-NNK7JPQM.js → cursor-recover-S5ORPW34.js} +1 -1
  35. package/dist/{global-workspace-VGKPYFE2.js → global-workspace-ICWOWUW6.js} +6 -6
  36. package/dist/{global-workspace-MXOLTUAR.js → global-workspace-T5IAJF4R.js} +6 -6
  37. package/dist/index.cjs +632 -525
  38. package/dist/index.d.cts +43 -9
  39. package/dist/index.d.ts +43 -9
  40. package/dist/index.js +212 -252
  41. package/dist/mcp/run-stdio.cjs +569 -489
  42. package/dist/mcp/run-stdio.js +184 -225
  43. package/dist/{paths-VPH3ITBK.js → paths-JQM2XRAD.js} +1 -1
  44. package/dist/{paths-2OFB7UJG.js → paths-TZX4L5X7.js} +1 -1
  45. package/dist/{thread-store-BUBR24YA.js → thread-store-V7NOOXKE.js} +2 -2
  46. package/dist/{thread-store-XTPFCJAI.js → thread-store-XAKWCV2E.js} +2 -2
  47. package/dist/{workspaces-2GZ2VNNU.js → workspaces-AJCAFW64.js} +7 -7
  48. package/dist/{workspaces-VWQ5YSND.js → workspaces-J4ULXOUH.js} +7 -7
  49. package/dist/{worktree-RFCCG23P.js → worktree-4Z2VSHAQ.js} +4 -4
  50. package/dist/{worktree-WZJ3CFEN.js → worktree-H57CCHWO.js} +4 -4
  51. 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 import_node_fs3 = require("fs");
7
- var import_node_path4 = require("path");
8
- var import_node_readline = require("readline");
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 import_node_path2 = require("path");
28
+ var import_node_path4 = require("path");
29
29
  var import_node_os2 = require("os");
30
- var import_node_path3 = require("path");
31
- var import_node_fs2 = require("fs");
30
+ var import_node_path5 = require("path");
31
+ var import_node_fs4 = require("fs");
32
32
 
33
33
  // src/hook/settings.ts
34
- var import_node_fs = require("fs");
34
+ var import_node_fs3 = require("fs");
35
35
  var import_node_os = require("os");
36
- var import_node_path = require("path");
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, import_node_path3.join)((0, import_node_os2.homedir)(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? (0, import_node_path3.join)(process.env.APPDATA ?? (0, import_node_path3.join)((0, import_node_os2.homedir)(), "AppData", "Roaming"), "sideboard") : (0, import_node_path3.join)((0, import_node_os2.homedir)(), ".local", "share", "sideboard");
43
- (0, import_node_fs2.mkdirSync)(base, { recursive: true });
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, import_node_path4.join)(appDataDir(), "cursor-sdk-store");
301
- (0, import_node_fs3.mkdirSync)(root, { recursive: true });
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, import_node_readline.createInterface)({ input: process.stdin, crlfDelay: Infinity });
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);
@@ -8,7 +8,7 @@ import {
8
8
  } from "../chunk-5KLC2MWZ.js";
9
9
  import {
10
10
  appDataDir
11
- } from "../chunk-M37RITA6.js";
11
+ } from "../chunk-B4R2VB2A.js";
12
12
 
13
13
  // src/agents/cursor-runner.ts
14
14
  import { Agent, CursorAgentError, JsonlLocalAgentStore } from "@cursor/sdk";
@@ -28,27 +28,27 @@ import {
28
28
  resolveCursorModelId,
29
29
  resolveLoginCommand,
30
30
  resolveQuotaFallbackAgent
31
- } from "./chunk-4Y745GLN.js";
31
+ } from "./chunk-U4GZKLIV.js";
32
32
  import {
33
33
  ORCHESTRATOR_AGENT_KINDS,
34
34
  assertOrchestratorCapableAgent,
35
35
  coerceOrchestratorAgent,
36
36
  isOrchestratorCapableAgent
37
- } from "./chunk-U4RZ3IQI.js";
38
- import "./chunk-ZN4NDAHV.js";
39
- import "./chunk-HHTHF5BQ.js";
37
+ } from "./chunk-4PTN2LED.js";
38
+ import "./chunk-A7LONVNO.js";
39
+ import "./chunk-QSLE4VEM.js";
40
40
  import {
41
41
  cursorSdkMessageToEvents,
42
42
  parseCursorRunnerLine
43
43
  } from "./chunk-CBJSPTBG.js";
44
- import "./chunk-OBHZKT2T.js";
44
+ import "./chunk-L63LLCTX.js";
45
45
  import "./chunk-FKOIHGKV.js";
46
- import "./chunk-I3FRXL7J.js";
46
+ import "./chunk-XY6XXMAK.js";
47
47
  import "./chunk-5KLC2MWZ.js";
48
48
  import "./chunk-JT7R45JB.js";
49
- import "./chunk-FWJYLBO6.js";
49
+ import "./chunk-3WA37BRI.js";
50
50
  import "./chunk-77WWLBCI.js";
51
- import "./chunk-M37RITA6.js";
51
+ import "./chunk-B4R2VB2A.js";
52
52
  import {
53
53
  conductorBundledBinDir,
54
54
  enrichPathWithNpmGlobalBin,
@@ -32,22 +32,22 @@ import {
32
32
  resolveCursorModelId,
33
33
  resolveLoginCommand,
34
34
  resolveQuotaFallbackAgent
35
- } from "./chunk-KE6QLNTJ.js";
36
- import "./chunk-6K5VAPVR.js";
35
+ } from "./chunk-QWNROSRB.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-EWKHP6DD.js";
43
- import "./chunk-HA2QTIWN.js";
44
- import "./chunk-6ZGTM2E7.js";
42
+ } from "./chunk-UVNXLTFB.js";
43
+ import "./chunk-3MA6JH6G.js";
44
+ import "./chunk-CY45C3GA.js";
45
45
  import "./chunk-B3SJXYIJ.js";
46
- import "./chunk-7FD7COKE.js";
47
- import "./chunk-AY53MPDE.js";
46
+ import "./chunk-JOF3XIEM.js";
47
+ import "./chunk-TC2KY5G7.js";
48
48
  import "./chunk-NSTQ6QKD.js";
49
49
  import "./chunk-KGZBYWZ3.js";
50
- import "./chunk-7MV3RXSC.js";
50
+ import "./chunk-JL4SJ6V7.js";
51
51
  import {
52
52
  conductorBundledBinDir,
53
53
  enrichPathWithNpmGlobalBin,
@@ -54,10 +54,10 @@ import {
54
54
  updateDefaultsSettings,
55
55
  updateIntegrationsSettings,
56
56
  updateOpencodeSettings
57
- } from "./chunk-AY53MPDE.js";
57
+ } from "./chunk-TC2KY5G7.js";
58
58
  import "./chunk-NSTQ6QKD.js";
59
59
  import "./chunk-KGZBYWZ3.js";
60
- import "./chunk-7MV3RXSC.js";
60
+ import "./chunk-JL4SJ6V7.js";
61
61
  export {
62
62
  GITHUB_GIT_AUTH_MODES,
63
63
  HARNESS_ENV_KEYS,
@@ -52,11 +52,11 @@ import {
52
52
  updateDefaultsSettings,
53
53
  updateIntegrationsSettings,
54
54
  updateOpencodeSettings
55
- } from "./chunk-I3FRXL7J.js";
55
+ } from "./chunk-XY6XXMAK.js";
56
56
  import "./chunk-5KLC2MWZ.js";
57
57
  import "./chunk-JT7R45JB.js";
58
58
  import "./chunk-77WWLBCI.js";
59
- import "./chunk-M37RITA6.js";
59
+ import "./chunk-B4R2VB2A.js";
60
60
  export {
61
61
  GITHUB_GIT_AUTH_MODES,
62
62
  HARNESS_ENV_KEYS,
@@ -5,9 +5,9 @@ import {
5
5
  releaseCaffeinateHoldForThread,
6
6
  setCaffeinateHold,
7
7
  setCaffeinateHoldHooks
8
- } from "./chunk-MFF2RE3I.js";
8
+ } from "./chunk-NZPGMNFC.js";
9
9
  import "./chunk-JT7R45JB.js";
10
- import "./chunk-M37RITA6.js";
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-RV6DBEDQ.js";
10
+ } from "./chunk-7KDBDMNC.js";
11
11
  import "./chunk-NSTQ6QKD.js";
12
- import "./chunk-7MV3RXSC.js";
12
+ import "./chunk-JL4SJ6V7.js";
13
13
  export {
14
14
  caffeinateHoldPath,
15
15
  getCaffeinateHold,
@@ -2,14 +2,14 @@
2
2
 
3
3
  import {
4
4
  resolveGithubRepoSlug
5
- } from "./chunk-6ZGTM2E7.js";
5
+ } from "./chunk-CY45C3GA.js";
6
6
  import {
7
7
  resolveThreadDefaults
8
- } from "./chunk-AY53MPDE.js";
8
+ } from "./chunk-TC2KY5G7.js";
9
9
  import {
10
10
  globalAgentCwd,
11
11
  sideboardReposDir
12
- } from "./chunk-7MV3RXSC.js";
12
+ } from "./chunk-JL4SJ6V7.js";
13
13
 
14
14
  // src/orchestrator/coordinator-prompt.ts
15
15
  import { mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -58,7 +58,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
58
58
  "Workspaces:",
59
59
  "- add_workspace / remove_workspace \u2014 register or unregister a git repo",
60
60
  "Worktree threads (chats):",
61
- "- create_thread \u2014 create a worktree + chat from branch | pr | ticket; pass repoPath + parentThreadId; omit agent and model to use Sideboard Account defaults (Settings \u2192 Default agent, model & effort). If you are Codex, do not set agent=codex (nested Codex deadlocks)",
61
+ "- create_thread \u2014 create a worktree + chat from branch | pr | ticket; pass repoPath + parentThreadId; omit agent and model to use Sideboard Account defaults (Settings \u2192 Default agent, model & effort). If the repo has a setup script, Sideboard runs it in the background (does not block send_to_thread). If you are Codex, do not set agent=codex (nested Codex deadlocks)",
62
62
  "- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
63
63
  "- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
64
64
  "- send_to_thread \u2014 queue a prompt (start/continue a chat turn); pass force_stop: true to interrupt mid-turn / clear stale queued prompts before replacing with a new request",
@@ -66,7 +66,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
66
66
  "- stop_thread \u2014 force-stop: kill in-flight turn AND clear queued prompts (do not leave stale queue after an interrupt)",
67
67
  "- archive_thread / restore_thread \u2014 archive (tears down worktree when last tab) or restore",
68
68
  "Setup / run:",
69
- "- run_setup \u2014 re-run worktree setup",
69
+ "- run_setup \u2014 re-run worktree setup (already runs automatically on create when a script exists)",
70
70
  "- list_run_scripts / run_dev_script / stop_dev_script \u2014 start/stop named run scripts",
71
71
  "Inspect / review / PRs:",
72
72
  "- get_diff \u2014 compact diff summary",
@@ -5,7 +5,7 @@ import {
5
5
  threadFilePath,
6
6
  threadLockPath,
7
7
  threadsDir
8
- } from "./chunk-M37RITA6.js";
8
+ } from "./chunk-B4R2VB2A.js";
9
9
 
10
10
  // src/store/thread-store.ts
11
11
  import { randomUUID } from "crypto";
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
- } from "./chunk-ZN4NDAHV.js";
3
+ } from "./chunk-A7LONVNO.js";
4
4
  import {
5
5
  allocateTeamName,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-OBHZKT2T.js";
8
+ } from "./chunk-L63LLCTX.js";
9
9
  import {
10
10
  resolveNewThreadOptions,
11
11
  resolveThreadDefaults
12
- } from "./chunk-I3FRXL7J.js";
12
+ } from "./chunk-XY6XXMAK.js";
13
13
  import {
14
14
  createEmptyThread,
15
15
  listThreads,
16
16
  updateThread,
17
17
  writeThread
18
- } from "./chunk-FWJYLBO6.js";
18
+ } from "./chunk-3WA37BRI.js";
19
19
  import {
20
20
  globalAgentCwd
21
- } from "./chunk-M37RITA6.js";
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";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-NSTQ6QKD.js";
6
6
  import {
7
7
  appDataDir
8
- } from "./chunk-7MV3RXSC.js";
8
+ } from "./chunk-JL4SJ6V7.js";
9
9
 
10
10
  // src/store/caffeinate-hold.ts
11
11
  import { spawn } from "child_process";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  resolveGithubRepoSlug
3
- } from "./chunk-OBHZKT2T.js";
3
+ } from "./chunk-L63LLCTX.js";
4
4
  import {
5
5
  resolveThreadDefaults
6
- } from "./chunk-I3FRXL7J.js";
6
+ } from "./chunk-XY6XXMAK.js";
7
7
  import {
8
8
  globalAgentCwd,
9
9
  sideboardReposDir
10
- } from "./chunk-M37RITA6.js";
10
+ } from "./chunk-B4R2VB2A.js";
11
11
 
12
12
  // src/orchestrator/coordinator-prompt.ts
13
13
  import { mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -56,7 +56,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
56
56
  "Workspaces:",
57
57
  "- add_workspace / remove_workspace \u2014 register or unregister a git repo",
58
58
  "Worktree threads (chats):",
59
- "- create_thread \u2014 create a worktree + chat from branch | pr | ticket; pass repoPath + parentThreadId; omit agent and model to use Sideboard Account defaults (Settings \u2192 Default agent, model & effort). If you are Codex, do not set agent=codex (nested Codex deadlocks)",
59
+ "- create_thread \u2014 create a worktree + chat from branch | pr | ticket; pass repoPath + parentThreadId; omit agent and model to use Sideboard Account defaults (Settings \u2192 Default agent, model & effort). If the repo has a setup script, Sideboard runs it in the background (does not block send_to_thread). If you are Codex, do not set agent=codex (nested Codex deadlocks)",
60
60
  "- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
61
61
  "- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
62
62
  "- send_to_thread \u2014 queue a prompt (start/continue a chat turn); pass force_stop: true to interrupt mid-turn / clear stale queued prompts before replacing with a new request",
@@ -64,7 +64,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
64
64
  "- stop_thread \u2014 force-stop: kill in-flight turn AND clear queued prompts (do not leave stale queue after an interrupt)",
65
65
  "- archive_thread / restore_thread \u2014 archive (tears down worktree when last tab) or restore",
66
66
  "Setup / run:",
67
- "- run_setup \u2014 re-run worktree setup",
67
+ "- run_setup \u2014 re-run worktree setup (already runs automatically on create when a script exists)",
68
68
  "- list_run_scripts / run_dev_script / stop_dev_script \u2014 start/stop named run scripts",
69
69
  "Inspect / review / PRs:",
70
70
  "- get_diff \u2014 compact diff summary",
@@ -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 join2 } from "path";
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 join(homedir(), path.slice(2));
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 (!existsSync(path)) return null;
28
- const raw = readFileSync(path, "utf8");
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 = join(rootPath, `.${source}`);
250
+ const dir = join3(rootPath, `.${source}`);
132
251
  return {
133
- toml: join(dir, "settings.toml"),
134
- local: join(dir, "settings.local.toml")
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 existsSync(files.toml) || existsSync(files.local);
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 normPath(p) {
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 && normPath(repoPath) !== normPath(worktreePath) ? detectFamily(repoPath) : null;
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 && normPath(repoPath) !== normPath(worktreePath)) {
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 && normPath(repoPath) !== normPath(worktreePath) && hasRepoHook(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 (existsSync(files.toml) && existsSync(files.local)) {
321
+ if (existsSync3(files.toml) && existsSync3(files.local)) {
203
322
  return `.${family}/settings.toml + local`;
204
323
  }
205
- if (existsSync(files.local)) return `.${family}/settings.local.toml`;
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 && normPath(repoPath) !== normPath(worktreePath)) {
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: Boolean(settings?.setup),
222
- configLabel: workspaceSettingsSourceLabel(worktreePath, repoPath)
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" ? join2(homedir2(), "Library", "Application Support", "sideboard") : process.platform === "win32" ? join2(process.env.APPDATA ?? join2(homedir2(), "AppData", "Roaming"), "sideboard") : join2(homedir2(), ".local", "share", "sideboard");
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 = join2(appDataDir(), "threads");
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 = join2(appDataDir(), "locks");
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 = join2(homedir2(), "sideboard");
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 = join2(sideboardHomeDir(), "repos");
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 = join2(sideboardHomeDir(), "workspaces");
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 = join2(sideboardWorkspacesDir(), repoSlug(repoPath));
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 join2(threadsDir(), `${id}.json`);
401
+ return join4(threadsDir(), `${id}.json`);
273
402
  }
274
403
  function threadLockPath(id) {
275
- return join2(locksDir(), `${id}.lock`);
404
+ return join4(locksDir(), `${id}.lock`);
276
405
  }
277
406
  function globalAgentCwd() {
278
- const dir = join2(appDataDir(), "global");
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,
@@ -5,14 +5,14 @@ import {
5
5
  } from "./chunk-B3SJXYIJ.js";
6
6
  import {
7
7
  listThreads
8
- } from "./chunk-7FD7COKE.js";
8
+ } from "./chunk-JOF3XIEM.js";
9
9
  import {
10
10
  getGithubGitAuthMode,
11
11
  getGithubPat
12
- } from "./chunk-AY53MPDE.js";
12
+ } from "./chunk-TC2KY5G7.js";
13
13
  import {
14
14
  worktreesRoot
15
- } from "./chunk-7MV3RXSC.js";
15
+ } from "./chunk-JL4SJ6V7.js";
16
16
  import {
17
17
  gh,
18
18
  git,