@sideboard-ai/core 0.1.331 → 0.1.333
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.js +2 -2
- package/dist/{agents-JXQKHY7Q.js → agents-5NJ3FROS.js} +8 -8
- package/dist/{agents-JH4WV2ZH.js → agents-SRM6OVML.js} +7 -7
- package/dist/{chunk-NQHTYX35.js → chunk-25KXB7W6.js} +1 -1
- package/dist/{chunk-QHKNPN55.js → chunk-4J7R2BFU.js} +31 -18
- package/dist/{chunk-G45SGI57.js → chunk-6RUSADA7.js} +4 -4
- package/dist/{chunk-QKHEVSB5.js → chunk-BMRJNRQK.js} +1 -1
- package/dist/{chunk-JQWCZGSO.js → chunk-CS6LQUL6.js} +110 -11
- package/dist/{chunk-KUD24QYI.js → chunk-ELDJBZ52.js} +5 -5
- package/dist/{chunk-4YXZOXMT.js → chunk-GK7H3SY7.js} +1 -1
- package/dist/{chunk-6U6QRUHY.js → chunk-I6RGRUNY.js} +1 -1
- package/dist/{chunk-P4QRDXRY.js → chunk-JJRTVB7D.js} +2 -2
- package/dist/{chunk-O7JSWISN.js → chunk-LEUAYFSG.js} +4 -4
- package/dist/{chunk-U7EANR52.js → chunk-P7S3XGKL.js} +2 -2
- package/dist/{chunk-OOSAMSTE.js → chunk-QKJC725N.js} +29 -16
- package/dist/{chunk-XOIJJRAQ.js → chunk-QNKJCD7B.js} +110 -11
- package/dist/{chunk-2TUE6JKQ.js → chunk-R4W4VQJZ.js} +2 -0
- package/dist/{chunk-7L36GZA4.js → chunk-RCRDNOAT.js} +1 -1
- package/dist/{chunk-PZ5MVD27.js → chunk-RJT6JPNX.js} +5 -5
- package/dist/{chunk-YBTSZ2SW.js → chunk-TL2HK6LZ.js} +2 -0
- package/dist/{chunk-DFKLWWLY.js → chunk-TLL2K2MY.js} +6 -6
- package/dist/{chunk-NURZOXGN.js → chunk-UGUWFONI.js} +1 -1
- package/dist/{chunk-3DJQLQWU.js → chunk-UV33UCV6.js} +3 -3
- package/dist/{chunk-DBRQ5NNB.js → chunk-WXOJSFGO.js} +5 -5
- package/dist/{chunk-S5CJUIPY.js → chunk-XOEKCE6L.js} +5 -5
- package/dist/{conductor-FA27ZGCV.js → conductor-LUPB6RBH.js} +5 -5
- package/dist/{conductor-6DIR7A4N.js → conductor-XSP3SOS2.js} +5 -5
- package/dist/{connected-teams-H4LZOJDC.js → connected-teams-2YDE2EZ2.js} +2 -2
- package/dist/{connected-teams-XYRZMQO4.js → connected-teams-6756SMAW.js} +2 -2
- package/dist/{coordinator-prompt-B6RHGEJK.js → coordinator-prompt-EJJNJ5K7.js} +4 -4
- package/dist/{coordinator-prompt-KAZXK5FZ.js → coordinator-prompt-O75QUEHP.js} +4 -4
- package/dist/{global-workspace-IOKHZCXD.js → global-workspace-3IG44NAT.js} +4 -4
- package/dist/{global-workspace-JKINHUY3.js → global-workspace-Q4OURN7M.js} +4 -4
- package/dist/index.cjs +314 -174
- package/dist/index.d.cts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +36 -18
- package/dist/mcp/run-stdio.cjs +206 -154
- package/dist/mcp/run-stdio.js +12 -12
- package/dist/{optional-cli-FOSC4NVE.js → optional-cli-KWIII44P.js} +3 -3
- package/dist/{optional-cli-NSQZ2DYK.js → optional-cli-XJE4BELL.js} +4 -4
- package/dist/{orchestrator-EKG7FUFK.js → orchestrator-IYXIWNB5.js} +11 -11
- package/dist/{orchestrator-L44O3JPD.js → orchestrator-WHXHBNRS.js} +10 -10
- package/dist/{run-7QMRYP3F.js → run-ARDGUXUN.js} +1 -1
- package/dist/{run-UPNCCRCN.js → run-ZKK3VGO5.js} +1 -1
- package/dist/{workspaces-FJL3TL3K.js → workspaces-ALUHOCWK.js} +4 -4
- package/dist/{workspaces-OLONQF2C.js → workspaces-QGKSXA76.js} +4 -4
- package/dist/{worktree-TX4WXQZV.js → worktree-6WWUWH4K.js} +3 -3
- package/dist/{worktree-QSQJ2POO.js → worktree-N435EXSP.js} +3 -3
- package/dist/{worktree-exclude-P5NJODWP.js → worktree-exclude-KMZQXZKP.js} +2 -2
- package/dist/{worktree-exclude-INRDQFWV.js → worktree-exclude-YQBN43QD.js} +2 -2
- package/package.json +1 -1
package/dist/mcp/run-stdio.cjs
CHANGED
|
@@ -2420,6 +2420,8 @@ var init_path = __esm({
|
|
|
2420
2420
|
import_node_path9 = require("path");
|
|
2421
2421
|
EXTRA_BIN_DIRS = [
|
|
2422
2422
|
".local/bin",
|
|
2423
|
+
// Official OpenCode installer (`curl https://opencode.ai/install | bash`).
|
|
2424
|
+
".opencode/bin",
|
|
2423
2425
|
".cargo/bin",
|
|
2424
2426
|
".nvm/current/bin",
|
|
2425
2427
|
".asdf/shims",
|
|
@@ -11031,7 +11033,7 @@ function ensureGlobalCoordinatorCwd(opts) {
|
|
|
11031
11033
|
"Typical flow (find work): list_projects \u2192 pick repo(s) matching account / project context \u2192 Sideboard list_issues / linear_* (tickets) or list_prs(queue=review) (reviews) \u2192 show the options. Never wait on Claude Linear MCP. Only create_workspace + send_to_chat when they asked to start (e.g. \u201Cfind me work and start it\u201D) \u2014 then wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
|
|
11032
11034
|
'Typical flow (review inbox): list_projects \u2192 list_prs(queue=review, limit=N) \u2192 show those PRs (ticket ids in the title when present). create_workspace sourceType=pr only when they asked to start / do the work. Do not list_issues for "tickets to review". The child writes the review in chat and stops \u2014 do not ask_user after it. Do not github_comment / linear_comment / update the PR or ticket, and do not tell the child to post, until the user types a next step. They should work through the feedback in chat first. The PR or ticket author sees those writes immediately.',
|
|
11033
11035
|
"Typical flow (new app): Bash create/clone under repos dir \u2192 add_project \u2192 create_workspace \u2192 send_to_chat (implement) \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
|
|
11034
|
-
"Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_chat`). If the user gave a goal (Greptile 5/5, CI green), pass that goal through so they watch-fix-push until it lands \u2014 do not start that loop on a plain push, and do not tell the human to poll. Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
|
|
11036
|
+
"Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_chat`). If the user gave a goal (Greptile 5/5, CI green), pass that goal through so they watch-fix-push until it lands \u2014 do not start that loop on a plain push, and do not tell the human to poll. A push can wake a third-party PR review; acknowledge it only inside that goal. Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
|
|
11035
11037
|
].join("\n");
|
|
11036
11038
|
try {
|
|
11037
11039
|
(0, import_node_fs22.writeFileSync)((0, import_node_path25.join)(dir, "AGENTS.md"), `${body}
|
|
@@ -11097,7 +11099,7 @@ var init_coordinator_prompt = __esm({
|
|
|
11097
11099
|
"- ask_user \u2014 composer multiple-choice only when blocked on a concrete choice (approach fork, which API, Save this context / Do not save). Never for hellos, check-ins, invented \u201Cwhat should we do?\u201D menus, or after a review \u2014 reply in chat. Explain options first, description on every option, then wait.",
|
|
11098
11100
|
"- get_viewer_context / update_viewer_context \u2014 read or replace Settings \u2192 Agents (account) and Settings \u2192 Projects (per-repo) context. You can update a project: pass scope=project and repoPath from list_projects (this cwd is not a project). update_viewer_context requires confirmed=true after ask_user. Never write context unprompted.",
|
|
11099
11101
|
"- list_env / set_env / delete_env \u2014 Settings \u2192 Environment. scope=project requires repoPath from list_projects and stores the key under that project prefix (the project name, uppercased, plus _). APPLE_ID for sideboard is SIDEBOARD_APPLE_ID. scope=account is shared by every project and is not prefixed. list_env returns names only.",
|
|
11100
|
-
"- set_caffeinate \u2014 keep this Mac awake across turns (macOS caffeinate).
|
|
11102
|
+
"- set_caffeinate \u2014 keep this Mac awake across turns (macOS caffeinate). A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn on for overnight work, or when the user will be away and no phone is connected. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the machine awake. Closing this chat also releases it.",
|
|
11101
11103
|
"- list_schedules / create_schedule / update_schedule / delete_schedule / run_schedule \u2014 automations that send a prompt to a chat (chatId or self) or start a new Global chat (omit chatId). A job bound to a chat is removed when that chat is archived. Omit chatId only for a Global automation that should outlive the chat. One-shot `at`, interval `every` (15m/1h/6h/1d), clock time `time` + `days` (07:30 and weekdays, or mon,wed), or 5-field `cron`. Recurring jobs without chatId open a new chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking). History keeps the last 5 archived runs for that automation. Worktree agents have the same tools (`chatId=self` continues that coding chat and is removed when that chat is archived). Jobs fire only while Sideboard.app is running; sleep skips until wake. Creating or enabling a future job turns on Settings \u2192 Advanced \u2192 Caffeinate while automations are enabled (or call set_caffeinate). The desktop lists them in the sidebar after Board.",
|
|
11102
11104
|
"Projects:",
|
|
11103
11105
|
"- add_project / remove_project \u2014 register or unregister a git repo",
|
|
@@ -11123,7 +11125,7 @@ var init_coordinator_prompt = __esm({
|
|
|
11123
11125
|
"- get_diff \u2014 compact diff summary",
|
|
11124
11126
|
"- get_pr_checks \u2014 snapshot of a worktree thread's PR checks (null = no PR). Use this to inspect status. If the user gave a goal, the worktree agent watches with `gh pr checks --watch` on GitHub, `origin pr watch` on Cursor, or `entire trail watch` on Entire \u2014 do not poll for the human.",
|
|
11125
11127
|
'- request_review \u2014 run a Review on a worktree thread. Reuses the only unused idle agent when the checkout has a single chat with no messages; otherwise opens a Review tab (attaches .claude/skills/review/SKILL.md when present, else .context/review.md copied from .sideboard/review.md / stock; sends "Review changes in this workspace."); then wait_for_turn (loop while stillRunning) / get_turn_result on the returned id. The review stays in that chat so they can read it and type next steps \u2014 do not tell the child to comment or update the PR or ticket.',
|
|
11126
|
-
"- ask_git \u2014 commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (Resolve, Create PR, \u2026). Always steers the worktree agent; then wait_for_turn (loop while stillRunning). Prefer this over paraphrasing. If the user gave a goal (Greptile 5/5, CI green), send_to_chat that goal so the worktree agent enters the watch-fix-push loop \u2014 do not tell the human to poll.",
|
|
11128
|
+
"- ask_git \u2014 commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (Resolve, Create PR, \u2026). Always steers the worktree agent; then wait_for_turn (loop while stillRunning). Prefer this over paraphrasing. If the user gave a goal (Greptile 5/5, CI green), send_to_chat that goal so the worktree agent enters the watch-fix-push loop \u2014 do not tell the human to poll. A push can wake a third-party PR review; the worktree agent acknowledges that review only inside an existing goal, not on a plain push.",
|
|
11127
11129
|
'- Merge (`ask_git` action=merge / send_to_chat "Merge PR.") only when the user explicitly asked to merge that PR. Do not merge because the work looks done, CI is green, or a typical flow includes it.',
|
|
11128
11130
|
'- Or send_to_chat with those exact phrases: "Commit and push.", "Commit, push, and open a draft PR.", "Ready for review.", "Merge PR." Prefer ask_git resolve-conflicts (it names the actual PR base \u2014 not always main) over paraphrasing. Draft PRs follow that workspace origin: GitHub (`github:`) uses `gh pr create --draft --assignee @me -R <slug>`; Cursor (`cursor:`) uses `origin pr create --draft --push -R <slug>`; Entire (`entire:`) uses `entire trail create --title` (Trails have no draft state). Never upstream. Never run git, gh, origin, or entire from this orchestration cwd, and never merge the PR yourself.',
|
|
11129
11131
|
"Process guides:",
|
|
@@ -18302,6 +18304,15 @@ var init_claude_usage_client = __esm({
|
|
|
18302
18304
|
}
|
|
18303
18305
|
});
|
|
18304
18306
|
|
|
18307
|
+
// src/agents/install-native.ts
|
|
18308
|
+
var init_install_native = __esm({
|
|
18309
|
+
"src/agents/install-native.ts"() {
|
|
18310
|
+
"use strict";
|
|
18311
|
+
init_run();
|
|
18312
|
+
init_install();
|
|
18313
|
+
}
|
|
18314
|
+
});
|
|
18315
|
+
|
|
18305
18316
|
// src/agents/install.ts
|
|
18306
18317
|
async function prepareTerminalCommand(command) {
|
|
18307
18318
|
enrichPathWithNpmGlobalBin();
|
|
@@ -18393,7 +18404,17 @@ async function installNpmGlobalPackage(opts) {
|
|
|
18393
18404
|
}
|
|
18394
18405
|
}
|
|
18395
18406
|
enrichPathWithNpmGlobalBin();
|
|
18396
|
-
const binPath = opts.cliBin ? await
|
|
18407
|
+
const binPath = opts.cliBin ? await resolveCliAfterNpmInstall(opts.cliBin) : null;
|
|
18408
|
+
if (opts.cliBin && !binPath) {
|
|
18409
|
+
return {
|
|
18410
|
+
ok: false,
|
|
18411
|
+
command: opts.installCommand,
|
|
18412
|
+
exitCode: 0,
|
|
18413
|
+
stdout: result.stdout,
|
|
18414
|
+
stderr: result.stderr,
|
|
18415
|
+
message: `Installed ${opts.npmPackage}, but \`${opts.cliBin}\` is not on PATH.`
|
|
18416
|
+
};
|
|
18417
|
+
}
|
|
18397
18418
|
return {
|
|
18398
18419
|
ok: true,
|
|
18399
18420
|
command: opts.installCommand,
|
|
@@ -18401,16 +18422,34 @@ async function installNpmGlobalPackage(opts) {
|
|
|
18401
18422
|
stdout: result.stdout,
|
|
18402
18423
|
stderr: result.stderr,
|
|
18403
18424
|
// Library-only packages (`@cursor/sdk`) have no CLI to look for.
|
|
18404
|
-
message: !opts.cliBin ? `Installed ${opts.npmPackage}` :
|
|
18425
|
+
message: !opts.cliBin ? `Installed ${opts.npmPackage}` : `Installed ${opts.npmPackage} \u2192 ${binPath}`
|
|
18405
18426
|
};
|
|
18406
18427
|
}
|
|
18407
|
-
|
|
18428
|
+
async function resolveCliAfterNpmInstall(cliBin) {
|
|
18429
|
+
const found = await whichOnPath(cliBin);
|
|
18430
|
+
if (found) return found;
|
|
18431
|
+
const prefix = await run("npm", ["prefix", "-g"], { reject: false, timeoutMs: 8e3 });
|
|
18432
|
+
if (prefix.exitCode !== 0) return null;
|
|
18433
|
+
const root = prefix.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.startsWith("/")).pop();
|
|
18434
|
+
if (!root) return null;
|
|
18435
|
+
const candidate = (0, import_node_path46.join)(root, "bin", cliBin);
|
|
18436
|
+
if (!(0, import_node_fs45.existsSync)(candidate)) return null;
|
|
18437
|
+
try {
|
|
18438
|
+
(0, import_node_fs45.chmodSync)(candidate, 493);
|
|
18439
|
+
} catch {
|
|
18440
|
+
}
|
|
18441
|
+
enrichPathWithNpmGlobalBin();
|
|
18442
|
+
return whichOnPath(cliBin);
|
|
18443
|
+
}
|
|
18444
|
+
var import_node_fs45, import_node_path46;
|
|
18408
18445
|
var init_install = __esm({
|
|
18409
18446
|
"src/agents/install.ts"() {
|
|
18410
18447
|
"use strict";
|
|
18411
18448
|
import_node_fs45 = require("fs");
|
|
18449
|
+
import_node_path46 = require("path");
|
|
18412
18450
|
init_run();
|
|
18413
18451
|
init_app_settings();
|
|
18452
|
+
init_install_native();
|
|
18414
18453
|
init_path();
|
|
18415
18454
|
}
|
|
18416
18455
|
});
|
|
@@ -18512,7 +18551,7 @@ function isAgentHostEnvKey(key) {
|
|
|
18512
18551
|
}
|
|
18513
18552
|
function stripHostToolingPath(pathValue) {
|
|
18514
18553
|
if (!pathValue?.trim()) return "";
|
|
18515
|
-
return pathValue.split(
|
|
18554
|
+
return pathValue.split(import_node_path47.delimiter).filter((part) => part && !HOST_PATH_NOISE.test(part.replace(/\\/g, "/"))).join(import_node_path47.delimiter);
|
|
18516
18555
|
}
|
|
18517
18556
|
function sanitizeAgentHostEnv(env, cwd) {
|
|
18518
18557
|
for (const key of Object.keys(env)) {
|
|
@@ -18526,11 +18565,11 @@ function sanitizeAgentHostEnv(env, cwd) {
|
|
|
18526
18565
|
}
|
|
18527
18566
|
return env;
|
|
18528
18567
|
}
|
|
18529
|
-
var
|
|
18568
|
+
var import_node_path47, DROP_EXACT, DROP_PREFIXES, HOST_PATH_NOISE;
|
|
18530
18569
|
var init_agent_host_env = __esm({
|
|
18531
18570
|
"src/hook/agent-host-env.ts"() {
|
|
18532
18571
|
"use strict";
|
|
18533
|
-
|
|
18572
|
+
import_node_path47 = require("path");
|
|
18534
18573
|
DROP_EXACT = /* @__PURE__ */ new Set([
|
|
18535
18574
|
"NODE_PATH",
|
|
18536
18575
|
"NODE_ENV_ELECTRON_VITE",
|
|
@@ -18569,15 +18608,15 @@ var init_agent_host_env = __esm({
|
|
|
18569
18608
|
|
|
18570
18609
|
// src/hook/worktree-pkg-cache.ts
|
|
18571
18610
|
function worktreePkgCacheRoot(worktreePath) {
|
|
18572
|
-
return (0,
|
|
18611
|
+
return (0, import_node_path48.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
|
|
18573
18612
|
}
|
|
18574
18613
|
function worktreePkgCacheEnv(worktreePath) {
|
|
18575
18614
|
const root = worktreePkgCacheRoot(worktreePath);
|
|
18576
|
-
const store = (0,
|
|
18577
|
-
const pnpmCache = (0,
|
|
18578
|
-
const npmCache = (0,
|
|
18579
|
-
const nodeGyp = (0,
|
|
18580
|
-
const electron = (0,
|
|
18615
|
+
const store = (0, import_node_path48.join)(root, "pnpm-store");
|
|
18616
|
+
const pnpmCache = (0, import_node_path48.join)(root, "pnpm");
|
|
18617
|
+
const npmCache = (0, import_node_path48.join)(root, "npm");
|
|
18618
|
+
const nodeGyp = (0, import_node_path48.join)(root, "node-gyp");
|
|
18619
|
+
const electron = (0, import_node_path48.join)(root, "electron");
|
|
18581
18620
|
return {
|
|
18582
18621
|
npm_config_store_dir: store,
|
|
18583
18622
|
PNPM_STORE_DIR: store,
|
|
@@ -18613,12 +18652,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
|
18613
18652
|
fillGroup(env, ["electron_config_cache"], next);
|
|
18614
18653
|
ensureWorktreePkgCacheDirs(cwd);
|
|
18615
18654
|
}
|
|
18616
|
-
var import_node_fs46,
|
|
18655
|
+
var import_node_fs46, import_node_path48, WORKTREE_PKG_CACHE_REL;
|
|
18617
18656
|
var init_worktree_pkg_cache = __esm({
|
|
18618
18657
|
"src/hook/worktree-pkg-cache.ts"() {
|
|
18619
18658
|
"use strict";
|
|
18620
18659
|
import_node_fs46 = require("fs");
|
|
18621
|
-
|
|
18660
|
+
import_node_path48 = require("path");
|
|
18622
18661
|
WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
|
|
18623
18662
|
}
|
|
18624
18663
|
});
|
|
@@ -19099,11 +19138,22 @@ function expandCanonicalGitRequest(prompt, opts) {
|
|
|
19099
19138
|
expansion = forge === "cursor" ? "Investigate that failing check (`origin pr checks`, `origin pr watch`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given. Do not use `gh run`." : forge === "entire" ? "Investigate the blocking gate (`entire trail merge --dry-run`, `entire trail finding list`, `entire trail watch`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given. Do not use `gh run`." : "Investigate that failing check (`gh pr checks`, `gh run view --log-failed`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given.";
|
|
19100
19139
|
}
|
|
19101
19140
|
if (!expansion) return prompt;
|
|
19141
|
+
if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
|
|
19102
19142
|
return `${trimmed}
|
|
19103
19143
|
|
|
19104
19144
|
(Sideboard git request \u2014 do not ask for clarification: ${expansion})`;
|
|
19105
19145
|
}
|
|
19106
|
-
|
|
19146
|
+
function withPushReview(expansion) {
|
|
19147
|
+
const base = expansion.replace(CHECKS_LOOP_UNLESS_GOAL, "").trim();
|
|
19148
|
+
if (base.includes("third-party PR review")) return base;
|
|
19149
|
+
return `${base} ${PUSH_WAKES_REVIEW}`;
|
|
19150
|
+
}
|
|
19151
|
+
function expansionPushes(action, prompt) {
|
|
19152
|
+
if (action === "ready-for-review" || action === "merge") return false;
|
|
19153
|
+
if (action) return true;
|
|
19154
|
+
return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
|
|
19155
|
+
}
|
|
19156
|
+
var AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
|
|
19107
19157
|
var init_agent_git_actions = __esm({
|
|
19108
19158
|
"src/git/agent-git-actions.ts"() {
|
|
19109
19159
|
"use strict";
|
|
@@ -19118,6 +19168,8 @@ var init_agent_git_actions = __esm({
|
|
|
19118
19168
|
RESOLVE_CONFLICTS_RE = /^Merge the remote branch(?: \(([^)]+)\))? into your branch and resolve conflicts\. Then, commit and push your changes\.$/;
|
|
19119
19169
|
MERGE_INTO_RE = /^Merge PR into (.+)\.$/;
|
|
19120
19170
|
FIX_CI_RE = /^Fix CI: .+\.$/;
|
|
19171
|
+
PUSH_WAKES_REVIEW = "A push can start or refresh a third-party PR review (whichever bot this repo runs). If this chat already has a goal to keep going until CI or that review is clean, read the reviewer\u2019s latest comment and unresolved threads and address them. Do not start that loop on a plain push.";
|
|
19172
|
+
CHECKS_LOOP_UNLESS_GOAL = / ?Do not start a checks loop unless a goal was given\./g;
|
|
19121
19173
|
}
|
|
19122
19174
|
});
|
|
19123
19175
|
|
|
@@ -20063,12 +20115,12 @@ function readTextIfPresent(abs) {
|
|
|
20063
20115
|
}
|
|
20064
20116
|
}
|
|
20065
20117
|
function readLocalGuidelines(worktreePath) {
|
|
20066
|
-
const localAbs = (0,
|
|
20118
|
+
const localAbs = (0, import_node_path49.join)(worktreePath, REVIEW_REQUEST_PATH);
|
|
20067
20119
|
const localContent = readTextIfPresent(localAbs);
|
|
20068
20120
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
20069
20121
|
return { path: REVIEW_REQUEST_PATH, content: localContent };
|
|
20070
20122
|
}
|
|
20071
|
-
const legacyAbs = (0,
|
|
20123
|
+
const legacyAbs = (0, import_node_path49.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
20072
20124
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
20073
20125
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
20074
20126
|
return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
|
|
@@ -20092,27 +20144,27 @@ function contextGuidelines(content, source) {
|
|
|
20092
20144
|
};
|
|
20093
20145
|
}
|
|
20094
20146
|
function writeContextGuidelines(worktreePath, content) {
|
|
20095
|
-
const abs = (0,
|
|
20096
|
-
(0, import_node_fs48.mkdirSync)((0,
|
|
20147
|
+
const abs = (0, import_node_path49.join)(worktreePath, CONTEXT_REVIEW_PATH);
|
|
20148
|
+
(0, import_node_fs48.mkdirSync)((0, import_node_path49.dirname)(abs), { recursive: true });
|
|
20097
20149
|
const body = content.endsWith("\n") ? content : `${content}
|
|
20098
20150
|
`;
|
|
20099
20151
|
(0, import_node_fs48.writeFileSync)(abs, body, "utf8");
|
|
20100
20152
|
return body;
|
|
20101
20153
|
}
|
|
20102
20154
|
function readSideboardReview(worktreePath, repoPath) {
|
|
20103
|
-
const fromWorktree = readTextIfPresent((0,
|
|
20155
|
+
const fromWorktree = readTextIfPresent((0, import_node_path49.join)(worktreePath, REPO_REVIEW_PATH));
|
|
20104
20156
|
if (fromWorktree) return fromWorktree;
|
|
20105
20157
|
const repo = repoPath?.replace(/\/+$/, "");
|
|
20106
20158
|
const wt = worktreePath.replace(/\/+$/, "");
|
|
20107
20159
|
if (!repo || repo === wt) return null;
|
|
20108
|
-
return readTextIfPresent((0,
|
|
20160
|
+
return readTextIfPresent((0, import_node_path49.join)(repo, REPO_REVIEW_PATH));
|
|
20109
20161
|
}
|
|
20110
20162
|
function ensureReviewGuidelinesFile(worktreePath, repoPath) {
|
|
20111
|
-
const skillContent = readTextIfPresent((0,
|
|
20163
|
+
const skillContent = readTextIfPresent((0, import_node_path49.join)(worktreePath, REVIEW_SKILL_PATH));
|
|
20112
20164
|
if (skillContent) {
|
|
20113
20165
|
return { ...skillGuidelines(skillContent, "skill"), wrote: false };
|
|
20114
20166
|
}
|
|
20115
|
-
const contextContent = readTextIfPresent((0,
|
|
20167
|
+
const contextContent = readTextIfPresent((0, import_node_path49.join)(worktreePath, CONTEXT_REVIEW_PATH));
|
|
20116
20168
|
if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
|
|
20117
20169
|
return { ...contextGuidelines(contextContent, "local"), wrote: false };
|
|
20118
20170
|
}
|
|
@@ -20188,13 +20240,13 @@ async function requestReview(threadRef, send) {
|
|
|
20188
20240
|
const started = await send(tab.id, REVIEW_REQUEST_PREFILL);
|
|
20189
20241
|
return { tab: started, from };
|
|
20190
20242
|
}
|
|
20191
|
-
var import_node_crypto12, import_node_fs48,
|
|
20243
|
+
var import_node_crypto12, import_node_fs48, import_node_path49, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
|
|
20192
20244
|
var init_request_review = __esm({
|
|
20193
20245
|
"src/review/request-review.ts"() {
|
|
20194
20246
|
"use strict";
|
|
20195
20247
|
import_node_crypto12 = require("crypto");
|
|
20196
20248
|
import_node_fs48 = require("fs");
|
|
20197
|
-
|
|
20249
|
+
import_node_path49 = require("path");
|
|
20198
20250
|
init_global_workspace();
|
|
20199
20251
|
init_chat_tabs();
|
|
20200
20252
|
init_thread_store();
|
|
@@ -20217,7 +20269,7 @@ var init_request_review = __esm({
|
|
|
20217
20269
|
|
|
20218
20270
|
// src/hook/worktree-run-ports.ts
|
|
20219
20271
|
function worktreeRunPortsPath(worktreePath) {
|
|
20220
|
-
return (0,
|
|
20272
|
+
return (0, import_node_path50.join)(worktreePath, RUN_PORTS_REL);
|
|
20221
20273
|
}
|
|
20222
20274
|
function isPort(value) {
|
|
20223
20275
|
return typeof value === "number" && Number.isInteger(value) && value > 0 && value <= 65535;
|
|
@@ -20275,16 +20327,16 @@ function saveWorktreeRunPorts(worktreePath, scriptName, ports) {
|
|
|
20275
20327
|
}
|
|
20276
20328
|
const scripts = { ...current.scripts ?? {} };
|
|
20277
20329
|
scripts[scriptName] = cleaned;
|
|
20278
|
-
(0, import_node_fs49.mkdirSync)((0,
|
|
20330
|
+
(0, import_node_fs49.mkdirSync)((0, import_node_path50.dirname)(path), { recursive: true });
|
|
20279
20331
|
(0, import_node_fs49.writeFileSync)(path, `${JSON.stringify({ scripts }, null, 2)}
|
|
20280
20332
|
`, "utf8");
|
|
20281
20333
|
}
|
|
20282
|
-
var import_node_fs49,
|
|
20334
|
+
var import_node_fs49, import_node_path50, RUN_PORTS_REL;
|
|
20283
20335
|
var init_worktree_run_ports = __esm({
|
|
20284
20336
|
"src/hook/worktree-run-ports.ts"() {
|
|
20285
20337
|
"use strict";
|
|
20286
20338
|
import_node_fs49 = require("fs");
|
|
20287
|
-
|
|
20339
|
+
import_node_path50 = require("path");
|
|
20288
20340
|
RUN_PORTS_REL = ".context/.sideboard/run-ports.json";
|
|
20289
20341
|
}
|
|
20290
20342
|
});
|
|
@@ -20336,7 +20388,7 @@ function readIntFile(file) {
|
|
|
20336
20388
|
return Number.isInteger(n) ? n : null;
|
|
20337
20389
|
}
|
|
20338
20390
|
function jobDir(root, id, legacy = false) {
|
|
20339
|
-
return (0,
|
|
20391
|
+
return (0, import_node_path51.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
|
|
20340
20392
|
}
|
|
20341
20393
|
function resolveJobDir(root, id) {
|
|
20342
20394
|
const modern = jobDir(root, id, false);
|
|
@@ -20346,7 +20398,7 @@ function resolveJobDir(root, id) {
|
|
|
20346
20398
|
return modern;
|
|
20347
20399
|
}
|
|
20348
20400
|
function listJobIdsIn(root, rel) {
|
|
20349
|
-
const dir = (0,
|
|
20401
|
+
const dir = (0, import_node_path51.join)(root, rel);
|
|
20350
20402
|
if (!(0, import_node_fs50.existsSync)(dir)) return [];
|
|
20351
20403
|
return (0, import_node_fs50.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
|
|
20352
20404
|
}
|
|
@@ -20360,7 +20412,7 @@ function listRunningDetachedJobs(worktreePath) {
|
|
|
20360
20412
|
const running = [];
|
|
20361
20413
|
for (const id of ids) {
|
|
20362
20414
|
const dir = resolveJobDir(root, id);
|
|
20363
|
-
const pid = readIntFile((0,
|
|
20415
|
+
const pid = readIntFile((0, import_node_path51.join)(dir, "pid"));
|
|
20364
20416
|
if (jobTreeAlive(pid)) running.push(id);
|
|
20365
20417
|
}
|
|
20366
20418
|
return running.sort();
|
|
@@ -20467,15 +20519,15 @@ function takeDelta(logFile, cursorFile) {
|
|
|
20467
20519
|
return { delta: capJobLogDelta(lines.slice(start).join("\n")), nextCursor: lines.length };
|
|
20468
20520
|
}
|
|
20469
20521
|
function snapshotJob(dir) {
|
|
20470
|
-
const pid = readIntFile((0,
|
|
20522
|
+
const pid = readIntFile((0, import_node_path51.join)(dir, "pid"));
|
|
20471
20523
|
const running = jobTreeAlive(pid);
|
|
20472
20524
|
return {
|
|
20473
20525
|
pid,
|
|
20474
20526
|
running,
|
|
20475
|
-
exitCode: readIntFile((0,
|
|
20476
|
-
log: (0,
|
|
20477
|
-
cursor: (0,
|
|
20478
|
-
progress: tailProgress((0,
|
|
20527
|
+
exitCode: readIntFile((0, import_node_path51.join)(dir, "exit")),
|
|
20528
|
+
log: (0, import_node_path51.join)(dir, "log"),
|
|
20529
|
+
cursor: (0, import_node_path51.join)(dir, "present.cursor"),
|
|
20530
|
+
progress: tailProgress((0, import_node_path51.join)(dir, "log"))
|
|
20479
20531
|
};
|
|
20480
20532
|
}
|
|
20481
20533
|
function toResult(id, snap, extra) {
|
|
@@ -20484,7 +20536,7 @@ function toResult(id, snap, extra) {
|
|
|
20484
20536
|
const stillRunning = snap.running && !ok;
|
|
20485
20537
|
const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
|
|
20486
20538
|
try {
|
|
20487
|
-
(0, import_node_fs50.mkdirSync)((0,
|
|
20539
|
+
(0, import_node_fs50.mkdirSync)((0, import_node_path51.dirname)(snap.cursor), { recursive: true });
|
|
20488
20540
|
(0, import_node_fs50.writeFileSync)(snap.cursor, `${nextCursor}
|
|
20489
20541
|
`);
|
|
20490
20542
|
} catch {
|
|
@@ -20560,7 +20612,7 @@ function killProcessTree(pid, signal) {
|
|
|
20560
20612
|
}
|
|
20561
20613
|
function appendJobLog(logFile, line) {
|
|
20562
20614
|
try {
|
|
20563
|
-
(0, import_node_fs50.mkdirSync)((0,
|
|
20615
|
+
(0, import_node_fs50.mkdirSync)((0, import_node_path51.dirname)(logFile), { recursive: true });
|
|
20564
20616
|
const body = line.endsWith("\n") ? line : `${line}
|
|
20565
20617
|
`;
|
|
20566
20618
|
(0, import_node_fs50.appendFileSync)(logFile, body);
|
|
@@ -20609,7 +20661,7 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
20609
20661
|
killProcessTree(targetPid, "SIGKILL");
|
|
20610
20662
|
await sleep(100);
|
|
20611
20663
|
}
|
|
20612
|
-
const exitFile = (0,
|
|
20664
|
+
const exitFile = (0, import_node_path51.join)(dir, "exit");
|
|
20613
20665
|
if (!(0, import_node_fs50.existsSync)(exitFile)) {
|
|
20614
20666
|
try {
|
|
20615
20667
|
(0, import_node_fs50.writeFileSync)(exitFile, "1\n");
|
|
@@ -20632,12 +20684,12 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
20632
20684
|
hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
|
|
20633
20685
|
};
|
|
20634
20686
|
}
|
|
20635
|
-
var import_node_fs50,
|
|
20687
|
+
var import_node_fs50, import_node_path51, MAX_JOB_CONTINUES, MAX_JOB_DELTA_LINES, MAX_JOB_DELTA_CHARS, DEFERRED_DONE_MAX_CHARS, GH_WATCH_REFRESH, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
|
|
20636
20688
|
var init_wait_for_job = __esm({
|
|
20637
20689
|
"src/mcp/wait-for-job.ts"() {
|
|
20638
20690
|
"use strict";
|
|
20639
20691
|
import_node_fs50 = require("fs");
|
|
20640
|
-
|
|
20692
|
+
import_node_path51 = require("path");
|
|
20641
20693
|
init_workspace_scratch();
|
|
20642
20694
|
init_job_process();
|
|
20643
20695
|
init_wait_for_turn();
|
|
@@ -20913,7 +20965,7 @@ function matchSimpleGlob(pattern, name) {
|
|
|
20913
20965
|
return new RegExp(`^${escaped}$`).test(name);
|
|
20914
20966
|
}
|
|
20915
20967
|
function readWorktreeInclude(repoPath) {
|
|
20916
|
-
const path = (0,
|
|
20968
|
+
const path = (0, import_node_path52.join)(repoPath, ".worktreeinclude");
|
|
20917
20969
|
if (!(0, import_node_fs51.existsSync)(path)) return [];
|
|
20918
20970
|
return (0, import_node_fs51.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
20919
20971
|
}
|
|
@@ -20928,7 +20980,7 @@ function resolveFilesToCopy(repoPath) {
|
|
|
20928
20980
|
for (const entry of (0, import_node_fs51.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
20929
20981
|
if (!entry.isFile()) continue;
|
|
20930
20982
|
for (const glob of settings.fileIncludeGlobs) {
|
|
20931
|
-
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0,
|
|
20983
|
+
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path52.basename)(glob), entry.name)) {
|
|
20932
20984
|
matched.push(entry.name);
|
|
20933
20985
|
break;
|
|
20934
20986
|
}
|
|
@@ -20954,10 +21006,10 @@ function copyConfiguredFiles(repoPath, worktreePath) {
|
|
|
20954
21006
|
const patterns = resolveFilesToCopy(repoPath);
|
|
20955
21007
|
const copied = [];
|
|
20956
21008
|
for (const rel of patterns) {
|
|
20957
|
-
const src = (0,
|
|
21009
|
+
const src = (0, import_node_path52.join)(repoPath, rel);
|
|
20958
21010
|
if (!(0, import_node_fs51.existsSync)(src)) continue;
|
|
20959
|
-
const dest = (0,
|
|
20960
|
-
(0, import_node_fs51.mkdirSync)((0,
|
|
21011
|
+
const dest = (0, import_node_path52.join)(worktreePath, rel);
|
|
21012
|
+
(0, import_node_fs51.mkdirSync)((0, import_node_path52.dirname)(dest), { recursive: true });
|
|
20961
21013
|
(0, import_node_fs51.copyFileSync)(src, dest);
|
|
20962
21014
|
copied.push(rel);
|
|
20963
21015
|
}
|
|
@@ -20971,7 +21023,7 @@ function linkSharedDirectories(repoPath, worktreePath) {
|
|
|
20971
21023
|
for (const rel of dirs) {
|
|
20972
21024
|
if (!isSafeRelativeDir(rel)) continue;
|
|
20973
21025
|
if (!isGitignored(repoPath, rel)) continue;
|
|
20974
|
-
const src = (0,
|
|
21026
|
+
const src = (0, import_node_path52.join)(repoPath, rel);
|
|
20975
21027
|
let srcStat;
|
|
20976
21028
|
try {
|
|
20977
21029
|
srcStat = (0, import_node_fs51.lstatSync)(src);
|
|
@@ -20979,9 +21031,9 @@ function linkSharedDirectories(repoPath, worktreePath) {
|
|
|
20979
21031
|
continue;
|
|
20980
21032
|
}
|
|
20981
21033
|
if (!srcStat.isDirectory()) continue;
|
|
20982
|
-
const dest = (0,
|
|
21034
|
+
const dest = (0, import_node_path52.join)(worktreePath, rel);
|
|
20983
21035
|
if ((0, import_node_fs51.existsSync)(dest)) continue;
|
|
20984
|
-
(0, import_node_fs51.mkdirSync)((0,
|
|
21036
|
+
(0, import_node_fs51.mkdirSync)((0, import_node_path52.dirname)(dest), { recursive: true });
|
|
20985
21037
|
try {
|
|
20986
21038
|
(0, import_node_fs51.symlinkSync)(src, dest);
|
|
20987
21039
|
} catch {
|
|
@@ -20995,11 +21047,11 @@ function samePath(a, b) {
|
|
|
20995
21047
|
try {
|
|
20996
21048
|
return (0, import_node_fs51.realpathSync)(a) === (0, import_node_fs51.realpathSync)(b);
|
|
20997
21049
|
} catch {
|
|
20998
|
-
return (0,
|
|
21050
|
+
return (0, import_node_path52.resolve)(a) === (0, import_node_path52.resolve)(b);
|
|
20999
21051
|
}
|
|
21000
21052
|
}
|
|
21001
21053
|
function isSafeRelativeDir(rel) {
|
|
21002
|
-
if (!rel || (0,
|
|
21054
|
+
if (!rel || (0, import_node_path52.isAbsolute)(rel)) return false;
|
|
21003
21055
|
const parts = rel.split(/[\\/]/).filter(Boolean);
|
|
21004
21056
|
return parts.length > 0 && parts.every((part) => part !== "." && part !== "..");
|
|
21005
21057
|
}
|
|
@@ -21041,7 +21093,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
21041
21093
|
const env = stripNestedElectronEnv({
|
|
21042
21094
|
...baseEnv ?? process.env
|
|
21043
21095
|
});
|
|
21044
|
-
const name = opts.workspaceName ?? (0,
|
|
21096
|
+
const name = opts.workspaceName ?? (0, import_node_path52.basename)(opts.worktreePath);
|
|
21045
21097
|
const ports = opts.ports ?? [];
|
|
21046
21098
|
const primary = ports[0];
|
|
21047
21099
|
env.SIDEBOARD_WORKSPACE_NAME = name;
|
|
@@ -21112,18 +21164,18 @@ function realpathOrResolve(path) {
|
|
|
21112
21164
|
try {
|
|
21113
21165
|
return (0, import_node_fs51.realpathSync)(path);
|
|
21114
21166
|
} catch {
|
|
21115
|
-
return (0,
|
|
21167
|
+
return (0, import_node_path52.resolve)(path);
|
|
21116
21168
|
}
|
|
21117
21169
|
}
|
|
21118
21170
|
function isOtherWorktreeListenerCwd(cwd, worktreePath) {
|
|
21119
21171
|
const wt = realpathOrResolve(worktreePath);
|
|
21120
21172
|
const c = realpathOrResolve(cwd);
|
|
21121
|
-
if (c === wt || c.startsWith(wt +
|
|
21122
|
-
const parent = (0,
|
|
21123
|
-
const thisName = (0,
|
|
21173
|
+
if (c === wt || c.startsWith(wt + import_node_path52.sep)) return false;
|
|
21174
|
+
const parent = (0, import_node_path52.dirname)(wt);
|
|
21175
|
+
const thisName = (0, import_node_path52.basename)(wt);
|
|
21124
21176
|
if (!thisName || c === parent) return false;
|
|
21125
|
-
if (!c.startsWith(parent +
|
|
21126
|
-
const first = c.slice(parent.length + 1).split(
|
|
21177
|
+
if (!c.startsWith(parent + import_node_path52.sep)) return false;
|
|
21178
|
+
const first = c.slice(parent.length + 1).split(import_node_path52.sep)[0];
|
|
21127
21179
|
return Boolean(first) && first !== thisName;
|
|
21128
21180
|
}
|
|
21129
21181
|
function signalPid(pid, signal) {
|
|
@@ -21135,7 +21187,7 @@ function signalPid(pid, signal) {
|
|
|
21135
21187
|
function isThisWorktreeListenerCwd(cwd, worktreePath) {
|
|
21136
21188
|
const wt = realpathOrResolve(worktreePath);
|
|
21137
21189
|
const c = realpathOrResolve(cwd);
|
|
21138
|
-
return c === wt || c.startsWith(wt +
|
|
21190
|
+
return c === wt || c.startsWith(wt + import_node_path52.sep);
|
|
21139
21191
|
}
|
|
21140
21192
|
function killDetachedRunTree(pid, worktreePath) {
|
|
21141
21193
|
if (!Number.isFinite(pid) || pid <= 1 || pid === process.pid) return;
|
|
@@ -21387,13 +21439,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
21387
21439
|
throw err;
|
|
21388
21440
|
}
|
|
21389
21441
|
}
|
|
21390
|
-
var import_node_fs51, import_node_child_process5,
|
|
21442
|
+
var import_node_fs51, import_node_child_process5, import_node_path52, import_execa4, import_node_readline3, cachedLoginEnv;
|
|
21391
21443
|
var init_conductor = __esm({
|
|
21392
21444
|
"src/hook/conductor.ts"() {
|
|
21393
21445
|
"use strict";
|
|
21394
21446
|
import_node_fs51 = require("fs");
|
|
21395
21447
|
import_node_child_process5 = require("child_process");
|
|
21396
|
-
|
|
21448
|
+
import_node_path52 = require("path");
|
|
21397
21449
|
import_execa4 = require("execa");
|
|
21398
21450
|
import_node_readline3 = require("readline");
|
|
21399
21451
|
init_settings();
|
|
@@ -21446,7 +21498,7 @@ function materialize(mem) {
|
|
|
21446
21498
|
};
|
|
21447
21499
|
}
|
|
21448
21500
|
function setupLogPath(threadId) {
|
|
21449
|
-
return (0,
|
|
21501
|
+
return (0, import_node_path53.join)(threadsDir(), `${threadId}.setup.log.json`);
|
|
21450
21502
|
}
|
|
21451
21503
|
function setupLogKeyForWorktree(worktreePath) {
|
|
21452
21504
|
const norm = normalizeWorktreePath(worktreePath);
|
|
@@ -21543,13 +21595,13 @@ function finishSetupLog(threadId, exitCode, source) {
|
|
|
21543
21595
|
persistNow(threadId);
|
|
21544
21596
|
return materialize(mem);
|
|
21545
21597
|
}
|
|
21546
|
-
var import_node_crypto13, import_node_fs52,
|
|
21598
|
+
var import_node_crypto13, import_node_fs52, import_node_path53, EMPTY, MAX_SETUP_LOG_CHARS, memory, persistTimers, PERSIST_DEBOUNCE_MS;
|
|
21547
21599
|
var init_setup_log = __esm({
|
|
21548
21600
|
"src/store/setup-log.ts"() {
|
|
21549
21601
|
"use strict";
|
|
21550
21602
|
import_node_crypto13 = require("crypto");
|
|
21551
21603
|
import_node_fs52 = require("fs");
|
|
21552
|
-
|
|
21604
|
+
import_node_path53 = require("path");
|
|
21553
21605
|
init_worktree_labels();
|
|
21554
21606
|
init_paths();
|
|
21555
21607
|
EMPTY = {
|
|
@@ -21594,7 +21646,7 @@ function safeScriptToken(scriptName) {
|
|
|
21594
21646
|
return token || "dev";
|
|
21595
21647
|
}
|
|
21596
21648
|
function runLogPath(key) {
|
|
21597
|
-
return (0,
|
|
21649
|
+
return (0, import_node_path54.join)(threadsDir(), `${key}.run.log.json`);
|
|
21598
21650
|
}
|
|
21599
21651
|
function runLogKeyForWorktree(worktreePath, scriptName) {
|
|
21600
21652
|
const norm = normalizeWorktreePath(worktreePath);
|
|
@@ -21699,13 +21751,13 @@ function finishRunLog(key, exitCode) {
|
|
|
21699
21751
|
function flushRunLog(key) {
|
|
21700
21752
|
persistNow2(key);
|
|
21701
21753
|
}
|
|
21702
|
-
var import_node_crypto14, import_node_fs53,
|
|
21754
|
+
var import_node_crypto14, import_node_fs53, import_node_path54, EMPTY2, MAX_RUN_LOG_CHARS, DEFAULT_RUN_LOG_TAIL_CHARS, memory2, persistTimers2, PERSIST_DEBOUNCE_MS2;
|
|
21703
21755
|
var init_run_log = __esm({
|
|
21704
21756
|
"src/store/run-log.ts"() {
|
|
21705
21757
|
"use strict";
|
|
21706
21758
|
import_node_crypto14 = require("crypto");
|
|
21707
21759
|
import_node_fs53 = require("fs");
|
|
21708
|
-
|
|
21760
|
+
import_node_path54 = require("path");
|
|
21709
21761
|
init_worktree_labels();
|
|
21710
21762
|
init_setup_log();
|
|
21711
21763
|
init_paths();
|
|
@@ -21770,9 +21822,9 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
21770
21822
|
if ((0, import_node_fs54.existsSync)(root)) {
|
|
21771
21823
|
for (const entry of (0, import_node_fs54.readdirSync)(root, { withFileTypes: true })) {
|
|
21772
21824
|
if (!entry.isDirectory()) continue;
|
|
21773
|
-
const path = (0,
|
|
21825
|
+
const path = (0, import_node_path55.join)(root, entry.name).replace(/\/$/, "");
|
|
21774
21826
|
if (known.has(path) || seen.has(path)) continue;
|
|
21775
|
-
if (!(0, import_node_fs54.existsSync)((0,
|
|
21827
|
+
if (!(0, import_node_fs54.existsSync)((0, import_node_path55.join)(path, ".git"))) continue;
|
|
21776
21828
|
seen.add(path);
|
|
21777
21829
|
let mtimeMs = 0;
|
|
21778
21830
|
try {
|
|
@@ -21828,12 +21880,12 @@ function shouldRunWorktreeCleanup(settings = loadAppSettings()) {
|
|
|
21828
21880
|
const elapsed = Date.now() - Date.parse(last);
|
|
21829
21881
|
return elapsed >= intervalHours * 36e5;
|
|
21830
21882
|
}
|
|
21831
|
-
var import_node_fs54,
|
|
21883
|
+
var import_node_fs54, import_node_path55;
|
|
21832
21884
|
var init_orphan_cleanup = __esm({
|
|
21833
21885
|
"src/git/orphan-cleanup.ts"() {
|
|
21834
21886
|
"use strict";
|
|
21835
21887
|
import_node_fs54 = require("fs");
|
|
21836
|
-
|
|
21888
|
+
import_node_path55 = require("path");
|
|
21837
21889
|
init_worktree();
|
|
21838
21890
|
init_thread_store();
|
|
21839
21891
|
init_paths();
|
|
@@ -22009,11 +22061,11 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
22009
22061
|
if (!url) throw new Error("Clone URL is required");
|
|
22010
22062
|
let name = opts.name?.trim();
|
|
22011
22063
|
if (!name) {
|
|
22012
|
-
const leaf = (0,
|
|
22064
|
+
const leaf = (0, import_node_path56.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
|
|
22013
22065
|
name = leaf || "repo";
|
|
22014
22066
|
}
|
|
22015
22067
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
22016
|
-
const dest = (0,
|
|
22068
|
+
const dest = (0, import_node_path56.join)(sideboardReposDir(), name);
|
|
22017
22069
|
if ((0, import_node_fs55.existsSync)(dest)) {
|
|
22018
22070
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
22019
22071
|
const workspace2 = await addWorkspace(repoPath2);
|
|
@@ -22029,12 +22081,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
22029
22081
|
const workspace = await addWorkspace(repoPath);
|
|
22030
22082
|
return { repoPath, workspace };
|
|
22031
22083
|
}
|
|
22032
|
-
var import_node_fs55,
|
|
22084
|
+
var import_node_fs55, import_node_path56, import_execa6;
|
|
22033
22085
|
var init_clone_repo = __esm({
|
|
22034
22086
|
"src/git/clone-repo.ts"() {
|
|
22035
22087
|
"use strict";
|
|
22036
22088
|
import_node_fs55 = require("fs");
|
|
22037
|
-
|
|
22089
|
+
import_node_path56 = require("path");
|
|
22038
22090
|
import_execa6 = require("execa");
|
|
22039
22091
|
init_paths();
|
|
22040
22092
|
init_workspaces();
|
|
@@ -22054,7 +22106,7 @@ var init_thread = __esm({
|
|
|
22054
22106
|
|
|
22055
22107
|
// src/store/desktop-host.ts
|
|
22056
22108
|
function desktopHostPidPath() {
|
|
22057
|
-
return (0,
|
|
22109
|
+
return (0, import_node_path57.join)(appDataDir(), "desktop-host.pid");
|
|
22058
22110
|
}
|
|
22059
22111
|
function readDesktopHostPid() {
|
|
22060
22112
|
try {
|
|
@@ -22084,12 +22136,12 @@ function thisProcessShouldDrainAgentQueues() {
|
|
|
22084
22136
|
if (isThisProcessDesktopHost()) return true;
|
|
22085
22137
|
return !isDesktopHostAlive();
|
|
22086
22138
|
}
|
|
22087
|
-
var import_node_fs56,
|
|
22139
|
+
var import_node_fs56, import_node_path57;
|
|
22088
22140
|
var init_desktop_host = __esm({
|
|
22089
22141
|
"src/store/desktop-host.ts"() {
|
|
22090
22142
|
"use strict";
|
|
22091
22143
|
import_node_fs56 = require("fs");
|
|
22092
|
-
|
|
22144
|
+
import_node_path57 = require("path");
|
|
22093
22145
|
init_paths();
|
|
22094
22146
|
}
|
|
22095
22147
|
});
|
|
@@ -22129,12 +22181,12 @@ function denyPendingToolPermissions(threadId) {
|
|
|
22129
22181
|
const last = pending[pending.length - 1];
|
|
22130
22182
|
if (last) clearPrompt(threadId, last.id);
|
|
22131
22183
|
}
|
|
22132
|
-
var import_node_crypto15,
|
|
22184
|
+
var import_node_crypto15, import_node_path58, queues, publisher;
|
|
22133
22185
|
var init_tool_permission = __esm({
|
|
22134
22186
|
"src/agents/tool-permission.ts"() {
|
|
22135
22187
|
"use strict";
|
|
22136
22188
|
import_node_crypto15 = require("crypto");
|
|
22137
|
-
|
|
22189
|
+
import_node_path58 = require("path");
|
|
22138
22190
|
init_claude_mcp();
|
|
22139
22191
|
queues = /* @__PURE__ */ new Map();
|
|
22140
22192
|
publisher = null;
|
|
@@ -25469,7 +25521,7 @@ function stampOf(thread) {
|
|
|
25469
25521
|
function repoLabel(thread) {
|
|
25470
25522
|
if (isOrchestratorThread(thread)) return "Orchestration";
|
|
25471
25523
|
const path = thread.repoPath?.trim() ?? "";
|
|
25472
|
-
return path && (0,
|
|
25524
|
+
return path && (0, import_node_path59.basename)(path) || path || "project";
|
|
25473
25525
|
}
|
|
25474
25526
|
function toAgent(thread, flags) {
|
|
25475
25527
|
const prUrl = thread.prUrl?.trim();
|
|
@@ -25668,11 +25720,11 @@ function formatFleetArchive(view) {
|
|
|
25668
25720
|
}
|
|
25669
25721
|
return lines.join("\n");
|
|
25670
25722
|
}
|
|
25671
|
-
var
|
|
25723
|
+
var import_node_path59, DEFAULT_LIMIT, MAX_LIMIT;
|
|
25672
25724
|
var init_fleet_archive = __esm({
|
|
25673
25725
|
"src/archive/fleet-archive.ts"() {
|
|
25674
25726
|
"use strict";
|
|
25675
|
-
|
|
25727
|
+
import_node_path59 = require("path");
|
|
25676
25728
|
init_global_workspace();
|
|
25677
25729
|
init_worktree_labels();
|
|
25678
25730
|
DEFAULT_LIMIT = 40;
|
|
@@ -26169,7 +26221,7 @@ var init_quota_failover = __esm({
|
|
|
26169
26221
|
// src/threads/adopt.ts
|
|
26170
26222
|
function thisModuleFile2() {
|
|
26171
26223
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
26172
|
-
return cjsFile || process.argv[1] || (0,
|
|
26224
|
+
return cjsFile || process.argv[1] || (0, import_node_path60.join)(process.cwd(), "package.json");
|
|
26173
26225
|
}
|
|
26174
26226
|
function openReadonlySqlite(file) {
|
|
26175
26227
|
const req = (0, import_node_module6.createRequire)(thisModuleFile2());
|
|
@@ -26197,7 +26249,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
26197
26249
|
return null;
|
|
26198
26250
|
}
|
|
26199
26251
|
for (const hash of hashes) {
|
|
26200
|
-
const agentsFile = (0,
|
|
26252
|
+
const agentsFile = (0, import_node_path60.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
26201
26253
|
if (!(0, import_node_fs59.existsSync)(agentsFile)) continue;
|
|
26202
26254
|
let text7;
|
|
26203
26255
|
try {
|
|
@@ -26254,8 +26306,8 @@ function listConductorWorkspaces() {
|
|
|
26254
26306
|
if (!(0, import_node_fs59.existsSync)(CONDUCTOR_DB)) {
|
|
26255
26307
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
26256
26308
|
}
|
|
26257
|
-
const tmp = (0, import_node_fs59.mkdtempSync)((0,
|
|
26258
|
-
const snapshot = (0,
|
|
26309
|
+
const tmp = (0, import_node_fs59.mkdtempSync)((0, import_node_path60.join)((0, import_node_os18.tmpdir)(), "sideboard-conductor-"));
|
|
26310
|
+
const snapshot = (0, import_node_path60.join)(tmp, "conductor.db");
|
|
26259
26311
|
try {
|
|
26260
26312
|
(0, import_node_fs59.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
26261
26313
|
for (const suffix of ["-wal", "-shm"]) {
|
|
@@ -26345,8 +26397,8 @@ function importConductorWorkspace(workspaceId) {
|
|
|
26345
26397
|
if (!(0, import_node_fs59.existsSync)(CONDUCTOR_DB)) {
|
|
26346
26398
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
26347
26399
|
}
|
|
26348
|
-
const tmp = (0, import_node_fs59.mkdtempSync)((0,
|
|
26349
|
-
const snapshot = (0,
|
|
26400
|
+
const tmp = (0, import_node_fs59.mkdtempSync)((0, import_node_path60.join)((0, import_node_os18.tmpdir)(), "sideboard-conductor-"));
|
|
26401
|
+
const snapshot = (0, import_node_path60.join)(tmp, "conductor.db");
|
|
26350
26402
|
try {
|
|
26351
26403
|
(0, import_node_fs59.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
26352
26404
|
for (const suffix of ["-wal", "-shm"]) {
|
|
@@ -26440,25 +26492,25 @@ function importConductorWorkspace(workspaceId) {
|
|
|
26440
26492
|
async function importConductorWorkspaceAsync(workspaceId) {
|
|
26441
26493
|
return importConductorWorkspace(workspaceId);
|
|
26442
26494
|
}
|
|
26443
|
-
var import_node_child_process6, import_node_fs59, import_node_os18,
|
|
26495
|
+
var import_node_child_process6, import_node_fs59, import_node_os18, import_node_path60, import_node_module6, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
|
|
26444
26496
|
var init_adopt = __esm({
|
|
26445
26497
|
"src/threads/adopt.ts"() {
|
|
26446
26498
|
"use strict";
|
|
26447
26499
|
import_node_child_process6 = require("child_process");
|
|
26448
26500
|
import_node_fs59 = require("fs");
|
|
26449
26501
|
import_node_os18 = require("os");
|
|
26450
|
-
|
|
26502
|
+
import_node_path60 = require("path");
|
|
26451
26503
|
import_node_module6 = require("module");
|
|
26452
26504
|
init_worktree();
|
|
26453
26505
|
init_thread_store();
|
|
26454
|
-
CONDUCTOR_APP_SUPPORT = (0,
|
|
26506
|
+
CONDUCTOR_APP_SUPPORT = (0, import_node_path60.join)(
|
|
26455
26507
|
process.env.HOME ?? "",
|
|
26456
26508
|
"Library",
|
|
26457
26509
|
"Application Support",
|
|
26458
26510
|
"com.conductor.app"
|
|
26459
26511
|
);
|
|
26460
|
-
CONDUCTOR_DB = (0,
|
|
26461
|
-
CURSOR_SDK_STORE = (0,
|
|
26512
|
+
CONDUCTOR_DB = (0, import_node_path60.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
26513
|
+
CURSOR_SDK_STORE = (0, import_node_path60.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
26462
26514
|
}
|
|
26463
26515
|
});
|
|
26464
26516
|
|
|
@@ -26788,7 +26840,7 @@ async function formatPrCreateFailure(raw, cwd, ctx) {
|
|
|
26788
26840
|
}
|
|
26789
26841
|
async function createCursorPullRequest(worktreePath, slug, opts) {
|
|
26790
26842
|
const bodyText = (opts.body ?? opts.title).trim() || opts.title;
|
|
26791
|
-
const bodyFile = (0,
|
|
26843
|
+
const bodyFile = (0, import_node_path61.join)(
|
|
26792
26844
|
(0, import_node_os19.tmpdir)(),
|
|
26793
26845
|
`sideboard-pr-body-${process.pid}-${(0, import_node_crypto19.randomBytes)(6).toString("hex")}.md`
|
|
26794
26846
|
);
|
|
@@ -26830,7 +26882,7 @@ async function createOrUpdatePr(worktreePath, opts) {
|
|
|
26830
26882
|
const headRef = ghHeadRef(slug, opts.head);
|
|
26831
26883
|
const branchOnly = opts.head.trim().replace(/^refs\/heads\//, "");
|
|
26832
26884
|
const bodyText = clampGithubPrBody(opts.body ?? opts.title);
|
|
26833
|
-
const bodyFile = (0,
|
|
26885
|
+
const bodyFile = (0, import_node_path61.join)(
|
|
26834
26886
|
(0, import_node_os19.tmpdir)(),
|
|
26835
26887
|
`sideboard-pr-body-${process.pid}-${(0, import_node_crypto19.randomBytes)(6).toString("hex")}.md`
|
|
26836
26888
|
);
|
|
@@ -26923,14 +26975,14 @@ async function createOrUpdatePrWithBodyFile(worktreePath, opts) {
|
|
|
26923
26975
|
const url = created.stdout.trim().split("\n").find((l) => l.startsWith("http")) ?? created.stdout.trim();
|
|
26924
26976
|
return url;
|
|
26925
26977
|
}
|
|
26926
|
-
var import_node_crypto19, import_node_fs61, import_node_os19,
|
|
26978
|
+
var import_node_crypto19, import_node_fs61, import_node_os19, import_node_path61;
|
|
26927
26979
|
var init_pr_write = __esm({
|
|
26928
26980
|
"src/git/pr-write.ts"() {
|
|
26929
26981
|
"use strict";
|
|
26930
26982
|
import_node_crypto19 = require("crypto");
|
|
26931
26983
|
import_node_fs61 = require("fs");
|
|
26932
26984
|
import_node_os19 = require("os");
|
|
26933
|
-
|
|
26985
|
+
import_node_path61 = require("path");
|
|
26934
26986
|
init_gh_errors();
|
|
26935
26987
|
init_run();
|
|
26936
26988
|
init_cursor_pr();
|
|
@@ -27082,7 +27134,7 @@ new file mode 100644
|
|
|
27082
27134
|
};
|
|
27083
27135
|
}
|
|
27084
27136
|
async function untrackedPatch(worktreePath, path, maxHunk) {
|
|
27085
|
-
const abs = (0,
|
|
27137
|
+
const abs = (0, import_node_path62.join)(worktreePath, path);
|
|
27086
27138
|
try {
|
|
27087
27139
|
const st = (0, import_node_fs62.statSync)(abs);
|
|
27088
27140
|
if (st.isFile() && st.size > maxHunk) {
|
|
@@ -27553,7 +27605,7 @@ async function getDiff(worktreePath, repoPath, opts) {
|
|
|
27553
27605
|
}
|
|
27554
27606
|
function statWorktreePath(worktreePath, relativePath) {
|
|
27555
27607
|
assertSafeRelativePath(relativePath);
|
|
27556
|
-
const abs = (0,
|
|
27608
|
+
const abs = (0, import_node_path62.join)(worktreePath, relativePath);
|
|
27557
27609
|
if (!(0, import_node_fs62.existsSync)(abs)) return "missing";
|
|
27558
27610
|
const st = (0, import_node_fs62.statSync)(abs);
|
|
27559
27611
|
if (st.isDirectory()) return "dir";
|
|
@@ -27584,7 +27636,7 @@ function isImageRelativePath(relativePath) {
|
|
|
27584
27636
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
27585
27637
|
assertSafeRelativePath(relativePath);
|
|
27586
27638
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
27587
|
-
const abs = (0,
|
|
27639
|
+
const abs = (0, import_node_path62.join)(worktreePath, relativePath);
|
|
27588
27640
|
const st = (0, import_node_fs62.statSync)(abs);
|
|
27589
27641
|
if (!st.isFile()) {
|
|
27590
27642
|
throw new Error(`Not a file: ${relativePath}`);
|
|
@@ -27604,7 +27656,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
27604
27656
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
27605
27657
|
assertSafeRelativePath(relativePath);
|
|
27606
27658
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
27607
|
-
const abs = (0,
|
|
27659
|
+
const abs = (0, import_node_path62.join)(worktreePath, relativePath);
|
|
27608
27660
|
const st = (0, import_node_fs62.statSync)(abs);
|
|
27609
27661
|
if (!st.isFile()) {
|
|
27610
27662
|
throw new Error(`Not a file: ${relativePath}`);
|
|
@@ -27652,8 +27704,8 @@ function assertSafeRelativePath(relativePath) {
|
|
|
27652
27704
|
}
|
|
27653
27705
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
27654
27706
|
assertSafeRelativePath(relativePath);
|
|
27655
|
-
const abs = (0,
|
|
27656
|
-
(0, import_node_fs62.mkdirSync)((0,
|
|
27707
|
+
const abs = (0, import_node_path62.join)(worktreePath, relativePath);
|
|
27708
|
+
(0, import_node_fs62.mkdirSync)((0, import_node_path62.dirname)(abs), { recursive: true });
|
|
27657
27709
|
(0, import_node_fs62.writeFileSync)(abs, content, "utf8");
|
|
27658
27710
|
return { path: relativePath };
|
|
27659
27711
|
}
|
|
@@ -27694,12 +27746,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
27694
27746
|
truncated: full.files.length > maxFiles
|
|
27695
27747
|
};
|
|
27696
27748
|
}
|
|
27697
|
-
var import_node_fs62,
|
|
27749
|
+
var import_node_fs62, import_node_path62, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
|
|
27698
27750
|
var init_diff = __esm({
|
|
27699
27751
|
"src/diff/diff.ts"() {
|
|
27700
27752
|
"use strict";
|
|
27701
27753
|
import_node_fs62 = require("fs");
|
|
27702
|
-
|
|
27754
|
+
import_node_path62 = require("path");
|
|
27703
27755
|
init_run();
|
|
27704
27756
|
init_worktree();
|
|
27705
27757
|
mergeBaseCache = /* @__PURE__ */ new Map();
|
|
@@ -27922,7 +27974,7 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
|
|
|
27922
27974
|
if (!relativePath || relativePath.includes("..") || relativePath.startsWith("/")) {
|
|
27923
27975
|
throw new Error("Invalid path");
|
|
27924
27976
|
}
|
|
27925
|
-
const abs = (0,
|
|
27977
|
+
const abs = (0, import_node_path63.join)(worktreePath, relativePath);
|
|
27926
27978
|
const fd = (0, import_node_fs63.openSync)(abs, "r");
|
|
27927
27979
|
try {
|
|
27928
27980
|
const st = (0, import_node_fs63.fstatSync)(fd);
|
|
@@ -27952,12 +28004,12 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
|
|
|
27952
28004
|
(0, import_node_fs63.closeSync)(fd);
|
|
27953
28005
|
}
|
|
27954
28006
|
}
|
|
27955
|
-
var import_node_fs63,
|
|
28007
|
+
var import_node_fs63, import_node_path63, WORKTREE_TAIL_BYTES;
|
|
27956
28008
|
var init_read_worktree_tail = __esm({
|
|
27957
28009
|
"src/diff/read-worktree-tail.ts"() {
|
|
27958
28010
|
"use strict";
|
|
27959
28011
|
import_node_fs63 = require("fs");
|
|
27960
|
-
|
|
28012
|
+
import_node_path63 = require("path");
|
|
27961
28013
|
WORKTREE_TAIL_BYTES = 2e5;
|
|
27962
28014
|
}
|
|
27963
28015
|
});
|
|
@@ -28134,7 +28186,7 @@ function scanSkillsDir(dir, source, out) {
|
|
|
28134
28186
|
}
|
|
28135
28187
|
for (const entry of entries) {
|
|
28136
28188
|
if (entry.startsWith(".")) continue;
|
|
28137
|
-
const skillMd = (0,
|
|
28189
|
+
const skillMd = (0, import_node_path64.join)(dir, entry, "SKILL.md");
|
|
28138
28190
|
if (!(0, import_node_fs64.existsSync)(skillMd)) continue;
|
|
28139
28191
|
try {
|
|
28140
28192
|
if (!(0, import_node_fs64.statSync)(skillMd).isFile()) continue;
|
|
@@ -28156,12 +28208,12 @@ function scanClaudePluginSkills(pluginsRoot, out) {
|
|
|
28156
28208
|
return;
|
|
28157
28209
|
}
|
|
28158
28210
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
28159
|
-
const skill = readSkill((0,
|
|
28211
|
+
const skill = readSkill((0, import_node_path64.join)(dir, "SKILL.md"), "cli");
|
|
28160
28212
|
if (skill) out.push(skill);
|
|
28161
28213
|
}
|
|
28162
28214
|
for (const entry of entries) {
|
|
28163
28215
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
28164
|
-
const full = (0,
|
|
28216
|
+
const full = (0, import_node_path64.join)(dir, entry);
|
|
28165
28217
|
try {
|
|
28166
28218
|
if (!(0, import_node_fs64.statSync)(full).isDirectory()) continue;
|
|
28167
28219
|
} catch {
|
|
@@ -28181,17 +28233,17 @@ function discoverSkills(worktreePath) {
|
|
|
28181
28233
|
const home = (0, import_node_os20.homedir)();
|
|
28182
28234
|
const collected = [];
|
|
28183
28235
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
28184
|
-
scanSkillsDir((0,
|
|
28236
|
+
scanSkillsDir((0, import_node_path64.join)(worktreePath, rel), "workspace", collected);
|
|
28185
28237
|
}
|
|
28186
28238
|
for (const abs of [
|
|
28187
|
-
(0,
|
|
28188
|
-
(0,
|
|
28189
|
-
(0,
|
|
28190
|
-
(0,
|
|
28239
|
+
(0, import_node_path64.join)(home, ".claude/skills"),
|
|
28240
|
+
(0, import_node_path64.join)(home, ".cursor/skills"),
|
|
28241
|
+
(0, import_node_path64.join)(home, ".sideboard/skills"),
|
|
28242
|
+
(0, import_node_path64.join)(home, ".brightsy/skills")
|
|
28191
28243
|
]) {
|
|
28192
28244
|
scanSkillsDir(abs, "user", collected);
|
|
28193
28245
|
}
|
|
28194
|
-
scanClaudePluginSkills((0,
|
|
28246
|
+
scanClaudePluginSkills((0, import_node_path64.join)(home, ".claude/plugins"), collected);
|
|
28195
28247
|
collected.push(...bundledSkills());
|
|
28196
28248
|
const rank = {
|
|
28197
28249
|
workspace: 0,
|
|
@@ -28231,13 +28283,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
28231
28283
|
|
|
28232
28284
|
\u2026(truncated)` : raw;
|
|
28233
28285
|
}
|
|
28234
|
-
var import_node_fs64, import_node_os20,
|
|
28286
|
+
var import_node_fs64, import_node_os20, import_node_path64, BUNDLED_SKILL_PREFIX;
|
|
28235
28287
|
var init_discover = __esm({
|
|
28236
28288
|
"src/skills/discover.ts"() {
|
|
28237
28289
|
"use strict";
|
|
28238
28290
|
import_node_fs64 = require("fs");
|
|
28239
28291
|
import_node_os20 = require("os");
|
|
28240
|
-
|
|
28292
|
+
import_node_path64 = require("path");
|
|
28241
28293
|
init_long_running();
|
|
28242
28294
|
BUNDLED_SKILL_PREFIX = "bundled:";
|
|
28243
28295
|
}
|
|
@@ -28602,7 +28654,7 @@ function compiledModuleDir() {
|
|
|
28602
28654
|
try {
|
|
28603
28655
|
const url = import_meta8.url;
|
|
28604
28656
|
if (typeof url === "string" && url.length > 0) {
|
|
28605
|
-
return (0,
|
|
28657
|
+
return (0, import_node_path65.dirname)((0, import_node_url6.fileURLToPath)(url));
|
|
28606
28658
|
}
|
|
28607
28659
|
} catch {
|
|
28608
28660
|
}
|
|
@@ -28610,7 +28662,7 @@ function compiledModuleDir() {
|
|
|
28610
28662
|
}
|
|
28611
28663
|
function detachedJobScriptIn(dir) {
|
|
28612
28664
|
for (const name of DETACHED_JOB_FILENAMES) {
|
|
28613
|
-
const script = (0,
|
|
28665
|
+
const script = (0, import_node_path65.join)(dir, "scripts", name);
|
|
28614
28666
|
if ((0, import_node_fs65.existsSync)(script)) return script;
|
|
28615
28667
|
}
|
|
28616
28668
|
return null;
|
|
@@ -28628,7 +28680,7 @@ function resolveDetachedJobScript() {
|
|
|
28628
28680
|
for (let i = 0; i < 8; i++) {
|
|
28629
28681
|
const candidate = detachedJobScriptIn(dir);
|
|
28630
28682
|
if (candidate) return candidate;
|
|
28631
|
-
const parent = (0,
|
|
28683
|
+
const parent = (0, import_node_path65.dirname)(dir);
|
|
28632
28684
|
if (parent === dir) break;
|
|
28633
28685
|
dir = parent;
|
|
28634
28686
|
}
|
|
@@ -28639,12 +28691,12 @@ function formatDetachedJobInvoke(scriptPath) {
|
|
|
28639
28691
|
if (resolved) return `node ${JSON.stringify(resolved)}`;
|
|
28640
28692
|
return "node scripts/detached-job.cjs";
|
|
28641
28693
|
}
|
|
28642
|
-
var import_node_fs65,
|
|
28694
|
+
var import_node_fs65, import_node_path65, import_node_url6, import_meta8, DETACHED_JOB_FILENAMES;
|
|
28643
28695
|
var init_detached_job_path = __esm({
|
|
28644
28696
|
"src/skills/detached-job-path.ts"() {
|
|
28645
28697
|
"use strict";
|
|
28646
28698
|
import_node_fs65 = require("fs");
|
|
28647
|
-
|
|
28699
|
+
import_node_path65 = require("path");
|
|
28648
28700
|
import_node_url6 = require("url");
|
|
28649
28701
|
init_packaged_runtime();
|
|
28650
28702
|
import_meta8 = {};
|
|
@@ -28873,14 +28925,14 @@ function formatPrGateDirective() {
|
|
|
28873
28925
|
"If a goal is given (not after every push):",
|
|
28874
28926
|
"- Enter a watch-fix-push loop and stay in it until that goal is met or you are blocked (examples: \u201CGreptile 5/5\u201D, \u201CCI green\u201D, \u201Cuntil checks pass\u201D). Do not stop after one red run or one review cycle.",
|
|
28875
28927
|
"- Wait with `/long-running`: detach `gh pr checks --watch` (add `-R <origin>` when needed), then loop `wait_for_job` until stillRunning is false. Do not end the turn \u2014 a native CLI Task or bash notify does not resume this chat. Do not ask the human to poll.",
|
|
28876
|
-
"-
|
|
28928
|
+
"- A commit or push can start or refresh a third-party PR review (Greptile, CodeRabbit, Bugbot, Copilot, or another bot on the PR). Read that reviewer\u2019s latest comment and unresolved threads, including any score or fix-it block they posted. Acknowledge it: make the requested changes, push, and wait for the refreshed review. Done = the goal the user named, with that reviewer\u2019s unresolved comments addressed. Do not invent a vendor trigger. Cap about 5 iterations, then report leftovers. Do not merge unless asked."
|
|
28877
28929
|
].join("\n");
|
|
28878
28930
|
}
|
|
28879
28931
|
function formatProcessGuideDirective(opts) {
|
|
28880
28932
|
const worktree = opts?.worktreePath?.trim();
|
|
28881
|
-
const hasGraphSkill = !!worktree && (0, import_node_fs66.existsSync)((0,
|
|
28882
|
-
const hasReviewSkill = !!worktree && (0, import_node_fs66.existsSync)((0,
|
|
28883
|
-
const hasInstallSkill = !!worktree && (0, import_node_fs66.existsSync)((0,
|
|
28933
|
+
const hasGraphSkill = !!worktree && (0, import_node_fs66.existsSync)((0, import_node_path66.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
|
|
28934
|
+
const hasReviewSkill = !!worktree && (0, import_node_fs66.existsSync)((0, import_node_path66.join)(worktree, ".claude/skills/review/SKILL.md"));
|
|
28935
|
+
const hasInstallSkill = !!worktree && (0, import_node_fs66.existsSync)((0, import_node_path66.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
|
|
28884
28936
|
return [
|
|
28885
28937
|
"Process guides (recurring work only):",
|
|
28886
28938
|
hasGraphSkill ? "- Migrations, ports, batch fixes, and other fan-out: follow `.claude/skills/graph-engineering/SKILL.md` (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch around it." : null,
|
|
@@ -28920,12 +28972,12 @@ function formatArtifactDirective() {
|
|
|
28920
28972
|
function formatUiReminder() {
|
|
28921
28973
|
return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. type=log appends (same artifact_id, new lines only). Chat links: `[name](sideboard://artifact/<id-or-title>)` opens that pane; `[name](sideboard://file/path#L12-L40)` opens a file. ask_user only for a real multiple-choice (not hellos, \u201Cwhat next?\u201D, or after a review) \u2014 reply in chat. ask_user wakes the parent orchestrator; notify_orchestrator if blocked without a picker. Do not say artifacts/CMS UI are unavailable. Dev / preview: run_dev_script (same as the Dev button; pass name \u2014 several scripts can run at once) returns {url, port, preview} (SIDEBOARD_PORT \u2014 never guess :3000). preview=url \u2192 open url; preview=window \u2192 Electron window is the app, url is renderer/HMR only. list_run_scripts active[].url if already running; get_run_log for that script\u2019s Run-tab terminal; stop_dev_script to stop one.";
|
|
28922
28974
|
}
|
|
28923
|
-
var import_node_fs66,
|
|
28975
|
+
var import_node_fs66, import_node_path66, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
|
|
28924
28976
|
var init_instructions = __esm({
|
|
28925
28977
|
"src/agents/instructions.ts"() {
|
|
28926
28978
|
"use strict";
|
|
28927
28979
|
import_node_fs66 = require("fs");
|
|
28928
|
-
|
|
28980
|
+
import_node_path66 = require("path");
|
|
28929
28981
|
init_git_auth_mode();
|
|
28930
28982
|
init_forge_git_directives();
|
|
28931
28983
|
init_branch_prefix();
|
|
@@ -29592,13 +29644,13 @@ __export(plan_file_exports, {
|
|
|
29592
29644
|
writePlanFile: () => writePlanFile
|
|
29593
29645
|
});
|
|
29594
29646
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
29595
|
-
const gitignoreAbs = (0,
|
|
29647
|
+
const gitignoreAbs = (0, import_node_path67.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
29596
29648
|
if ((0, import_node_fs67.existsSync)(gitignoreAbs)) return;
|
|
29597
|
-
(0, import_node_fs67.mkdirSync)((0,
|
|
29649
|
+
(0, import_node_fs67.mkdirSync)((0, import_node_path67.dirname)(gitignoreAbs), { recursive: true });
|
|
29598
29650
|
(0, import_node_fs67.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
29599
29651
|
}
|
|
29600
29652
|
function planFileAbs(worktreePath) {
|
|
29601
|
-
return (0,
|
|
29653
|
+
return (0, import_node_path67.join)(worktreePath, PLAN_FILE_REL);
|
|
29602
29654
|
}
|
|
29603
29655
|
function readTextIfPresent2(abs) {
|
|
29604
29656
|
if (!(0, import_node_fs67.existsSync)(abs)) return null;
|
|
@@ -29610,22 +29662,22 @@ function readTextIfPresent2(abs) {
|
|
|
29610
29662
|
}
|
|
29611
29663
|
}
|
|
29612
29664
|
function readPlanFile(worktreePath) {
|
|
29613
|
-
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0,
|
|
29665
|
+
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path67.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path67.join)(worktreePath, LEGACY_PLAN_FILE_REL));
|
|
29614
29666
|
}
|
|
29615
29667
|
function writePlanFile(worktreePath, content) {
|
|
29616
29668
|
ensureAttachmentsGitignore(worktreePath);
|
|
29617
29669
|
const abs = planFileAbs(worktreePath);
|
|
29618
|
-
(0, import_node_fs67.mkdirSync)((0,
|
|
29670
|
+
(0, import_node_fs67.mkdirSync)((0, import_node_path67.dirname)(abs), { recursive: true });
|
|
29619
29671
|
const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
|
|
29620
29672
|
(0, import_node_fs67.writeFileSync)(abs, body, "utf8");
|
|
29621
29673
|
return PLAN_FILE_REL;
|
|
29622
29674
|
}
|
|
29623
|
-
var import_node_fs67,
|
|
29675
|
+
var import_node_fs67, import_node_path67;
|
|
29624
29676
|
var init_plan_file = __esm({
|
|
29625
29677
|
"src/plan/plan-file.ts"() {
|
|
29626
29678
|
"use strict";
|
|
29627
29679
|
import_node_fs67 = require("fs");
|
|
29628
|
-
|
|
29680
|
+
import_node_path67 = require("path");
|
|
29629
29681
|
init_workspace_scratch();
|
|
29630
29682
|
init_plan_present();
|
|
29631
29683
|
init_plan_present();
|
|
@@ -29674,7 +29726,7 @@ function setCaffeinateHoldHooks(next) {
|
|
|
29674
29726
|
hooks = next;
|
|
29675
29727
|
}
|
|
29676
29728
|
function caffeinateHoldPath() {
|
|
29677
|
-
return (0,
|
|
29729
|
+
return (0, import_node_path68.join)(appDataDir(), "caffeinate-hold.json");
|
|
29678
29730
|
}
|
|
29679
29731
|
function processAlive(pid) {
|
|
29680
29732
|
if (hooks.processAlive) return hooks.processAlive(pid);
|
|
@@ -29817,13 +29869,13 @@ function releaseCaffeinateHoldForThread(threadId) {
|
|
|
29817
29869
|
}
|
|
29818
29870
|
return setCaffeinateHold(false, { threadId: id });
|
|
29819
29871
|
}
|
|
29820
|
-
var import_node_child_process7, import_node_fs68,
|
|
29872
|
+
var import_node_child_process7, import_node_fs68, import_node_path68, hooks;
|
|
29821
29873
|
var init_caffeinate_hold = __esm({
|
|
29822
29874
|
"src/store/caffeinate-hold.ts"() {
|
|
29823
29875
|
"use strict";
|
|
29824
29876
|
import_node_child_process7 = require("child_process");
|
|
29825
29877
|
import_node_fs68 = require("fs");
|
|
29826
|
-
|
|
29878
|
+
import_node_path68 = require("path");
|
|
29827
29879
|
init_paths();
|
|
29828
29880
|
init_private_file();
|
|
29829
29881
|
hooks = {};
|
|
@@ -33084,7 +33136,7 @@ function createClippedMcpServer() {
|
|
|
33084
33136
|
// src/mcp/server.ts
|
|
33085
33137
|
var import_zod11 = require("zod");
|
|
33086
33138
|
var import_node_crypto23 = require("crypto");
|
|
33087
|
-
var
|
|
33139
|
+
var import_node_path72 = require("path");
|
|
33088
33140
|
init_orchestrator();
|
|
33089
33141
|
init_task_state();
|
|
33090
33142
|
init_worktree();
|
|
@@ -35491,7 +35543,7 @@ function registerScheduleTools(server) {
|
|
|
35491
35543
|
|
|
35492
35544
|
// src/agent-rpc/handlers.ts
|
|
35493
35545
|
var import_node_crypto21 = require("crypto");
|
|
35494
|
-
var
|
|
35546
|
+
var import_node_path69 = require("path");
|
|
35495
35547
|
init_wait_for_job();
|
|
35496
35548
|
init_wait_for_turn();
|
|
35497
35549
|
|
|
@@ -35557,20 +35609,20 @@ init_git_auth_mode();
|
|
|
35557
35609
|
|
|
35558
35610
|
// src/board/load-home-board.ts
|
|
35559
35611
|
var import_node_fs72 = require("fs");
|
|
35560
|
-
var
|
|
35612
|
+
var import_node_path71 = require("path");
|
|
35561
35613
|
init_worktree();
|
|
35562
35614
|
init_paths();
|
|
35563
35615
|
|
|
35564
35616
|
// src/board/board-pins.ts
|
|
35565
35617
|
var import_node_crypto22 = require("crypto");
|
|
35566
35618
|
var import_node_fs71 = require("fs");
|
|
35567
|
-
var
|
|
35619
|
+
var import_node_path70 = require("path");
|
|
35568
35620
|
init_paths();
|
|
35569
35621
|
init_home_board();
|
|
35570
35622
|
var FILE = "home-board-pins.json";
|
|
35571
35623
|
var VERSION = 1;
|
|
35572
35624
|
function pinsFile() {
|
|
35573
|
-
return (0,
|
|
35625
|
+
return (0, import_node_path70.join)(appDataDir(), FILE);
|
|
35574
35626
|
}
|
|
35575
35627
|
function readDisk() {
|
|
35576
35628
|
const path = pinsFile();
|
|
@@ -35606,7 +35658,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
35606
35658
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
35607
35659
|
}
|
|
35608
35660
|
function cacheFile() {
|
|
35609
|
-
return (0,
|
|
35661
|
+
return (0, import_node_path71.join)(appDataDir(), "home-board-cache.json");
|
|
35610
35662
|
}
|
|
35611
35663
|
function emptyInputs() {
|
|
35612
35664
|
return {
|
|
@@ -35904,7 +35956,7 @@ async function startMcpServer() {
|
|
|
35904
35956
|
async () => {
|
|
35905
35957
|
const threads = orch.getThreads();
|
|
35906
35958
|
const lines = threads.map((t) => {
|
|
35907
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
35959
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path72.basename)(t.repoPath) || t.repoPath;
|
|
35908
35960
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
35909
35961
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
35910
35962
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -36391,7 +36443,7 @@ async function startMcpServer() {
|
|
|
36391
36443
|
const accountDefaultsHint = `Account defaults: agent=${accountDefaults.agent}, model=${accountDefaults.model?.trim() || "Auto"}, effort=${accountDefaults.effort}`;
|
|
36392
36444
|
server.tool(
|
|
36393
36445
|
"set_caffeinate",
|
|
36394
|
-
"Keep this Mac awake with caffeinate
|
|
36446
|
+
"Keep this Mac awake with caffeinate across turns \u2014 independent of Settings toggles. A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn ON when the user will be away and no phone is connected, or they ask you to keep the machine awake. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the Mac awake. Closing or archiving this orchestration chat also releases the hold. macOS only.",
|
|
36395
36447
|
{
|
|
36396
36448
|
enabled: import_zod11.z.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
|
|
36397
36449
|
},
|
|
@@ -36709,7 +36761,7 @@ async function startMcpServer() {
|
|
|
36709
36761
|
);
|
|
36710
36762
|
server.tool(
|
|
36711
36763
|
"ask_git",
|
|
36712
|
-
"Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (including Resolve). Always steers the worktree agent; does not push or open the PR locally. Then wait_for_turn (loop while stillRunning). Do not start a checks loop on a plain push \u2014 only if the user gave a goal (
|
|
36764
|
+
"Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (including Resolve). Always steers the worktree agent; does not push or open the PR locally. Then wait_for_turn (loop while stillRunning). Do not start a checks loop on a plain push \u2014 only if the user gave a goal (CI green, a review score, until checks pass). A push can wake a third-party PR review; the worktree agent acknowledges it only inside that goal. Pass a worktree thread ref (not the orchestrator). action=ready-for-review and action=merge only when the user explicitly asked (or clicked the desktop button). Do not run git or gh from the orchestration cwd.",
|
|
36713
36765
|
{
|
|
36714
36766
|
ref: import_zod11.z.string().describe("Worktree thread id/ref"),
|
|
36715
36767
|
action: import_zod11.z.enum(AGENT_GIT_ACTIONS).describe(
|