@sideboard-ai/core 0.1.191 → 0.1.193
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/{abletime-JFMBCSIQ.js → abletime-QHKWGTBY.js} +4 -3
- package/dist/{abletime-53T7G667.js → abletime-UX53JTIH.js} +4 -3
- package/dist/agents/cursor-runner.js +4 -4
- package/dist/{agents-DTPVTDB5.js → agents-MN4GSQTL.js} +19 -17
- package/dist/{agents-5OBZETUV.js → agents-OK5VD25T.js} +10 -8
- package/dist/{app-settings-663VQWUV.js → app-settings-LO7UFHQ6.js} +5 -2
- package/dist/{app-settings-74HBAAH7.js → app-settings-QYLNKRK4.js} +5 -2
- package/dist/branch-prefix-7F37FIPX.js +10 -0
- package/dist/branch-prefix-EVW2KHGQ.js +12 -0
- package/dist/{caffeinate-hold-SK2QISPE.js → caffeinate-hold-22VFDPSO.js} +2 -2
- package/dist/{caffeinate-hold-DBKMRZZO.js → caffeinate-hold-OK4JJ5PP.js} +2 -2
- package/dist/{chunk-GPSIZGEZ.js → chunk-3DX2T2KR.js} +181 -172
- package/dist/{chunk-HVIEYTUK.js → chunk-3OHR73VK.js} +1 -1
- package/dist/{chunk-VIODP5PT.js → chunk-4OVCJPVI.js} +13 -11
- package/dist/{chunk-UBQIELFS.js → chunk-4QJRH5DL.js} +1 -1
- package/dist/{chunk-AO35MGOE.js → chunk-4TYXWPAJ.js} +1 -1
- package/dist/chunk-64QSHOKV.js +869 -0
- package/dist/{chunk-FY64F2ZQ.js → chunk-7AJ7OZZF.js} +4 -4
- package/dist/{chunk-WLPXZFRE.js → chunk-7J72QJOM.js} +1 -1
- package/dist/chunk-7SNJMKD6.js +20 -0
- package/dist/{chunk-WXKXSZN4.js → chunk-BIKCWYRP.js} +16 -873
- package/dist/{chunk-J7LQVLFQ.js → chunk-BWRS6GAS.js} +19 -1
- package/dist/{chunk-GOZ6T3AG.js → chunk-CJFBSQIB.js} +1 -1
- package/dist/{chunk-GBWKMWUQ.js → chunk-EBPBGQ4P.js} +13 -13
- package/dist/{chunk-JTJHOYCU.js → chunk-EQNRWDLN.js} +10 -4
- package/dist/{chunk-5RRAKGPK.js → chunk-EQXXGOMD.js} +192 -182
- package/dist/{chunk-XXEIF2IL.js → chunk-HIX2VDRE.js} +13 -11
- package/dist/chunk-ILWQT2UN.js +55 -0
- package/dist/chunk-JTWKGOFI.js +23 -0
- package/dist/{chunk-TCQAFTSV.js → chunk-KJBYIIJU.js} +1 -1
- package/dist/{chunk-OKZFTOM2.js → chunk-KORE4WOF.js} +19 -1
- package/dist/{chunk-OLDZXO53.js → chunk-MQC2VA5U.js} +14 -14
- package/dist/{chunk-4M2AK3O5.js → chunk-O4BMPY5Y.js} +1 -1
- package/dist/chunk-PBEPPXMY.js +57 -0
- package/dist/{chunk-IEEAVWAP.js → chunk-PE337IM2.js} +7 -7
- package/dist/chunk-RCWHL4TK.js +866 -0
- package/dist/{chunk-EFVFB2AH.js → chunk-WFUDY6PC.js} +12 -5
- package/dist/{chunk-XBLN52RZ.js → chunk-XPKKCFRT.js} +9 -866
- package/dist/{chunk-OCQPTUR7.js → chunk-YWI3IBP2.js} +1 -1
- package/dist/{connected-teams-WOYCH7FR.js → connected-teams-PU4AMFNA.js} +2 -2
- package/dist/{connected-teams-ON2KIKQX.js → connected-teams-SYQQGCXD.js} +2 -2
- package/dist/{coordinator-prompt-LWKOL3AZ.js → coordinator-prompt-GXJIPWNA.js} +7 -5
- package/dist/{coordinator-prompt-MSC44OOM.js → coordinator-prompt-WB65HIZ3.js} +9 -7
- package/dist/{cursor-recover-NDMLLNYX.js → cursor-recover-DTQAUDGO.js} +2 -2
- package/dist/{cursor-recover-L5MD6MBO.js → cursor-recover-TXVTLAMA.js} +1 -1
- package/dist/github-DWROJOB7.js +11 -0
- package/dist/github-IIF7AQNO.js +9 -0
- package/dist/{global-workspace-6G5JJH2E.js → global-workspace-BZ6V6TEX.js} +7 -5
- package/dist/{global-workspace-XATJTV3N.js → global-workspace-MMK5UFUZ.js} +9 -7
- package/dist/index.cjs +332 -205
- package/dist/index.d.cts +53 -9
- package/dist/index.d.ts +53 -9
- package/dist/index.js +147 -136
- package/dist/mcp/run-stdio.cjs +316 -201
- package/dist/mcp/run-stdio.js +84 -85
- package/dist/{orchestrator-F3CXDBZB.js → orchestrator-4KI6VIFG.js} +16 -12
- package/dist/{orchestrator-2X6LYBQI.js → orchestrator-SFOT6Q6F.js} +15 -11
- package/dist/{paths-RRCLNSJB.js → paths-C2VERLAE.js} +1 -1
- package/dist/{paths-53TLA7VQ.js → paths-LOXCISLX.js} +1 -1
- package/dist/{thread-store-ZL6GDIDP.js → thread-store-CO77HV2K.js} +2 -2
- package/dist/{thread-store-RXXNSRVO.js → thread-store-M4B52FUS.js} +2 -2
- package/dist/{workspaces-LMFCRXTT.js → workspaces-ACMZMKPD.js} +7 -5
- package/dist/{workspaces-FWKPWSXV.js → workspaces-KPJS7GLY.js} +9 -7
- package/dist/{worktree-7LOSSD7G.js → worktree-6IEVF3GN.js} +15 -12
- package/dist/{worktree-LPWTX2NA.js → worktree-UW6DNBIE.js} +20 -17
- package/dist/worktree-labels-3XDS6O3U.js +22 -0
- package/dist/worktree-labels-PEDOJBMD.js +24 -0
- package/package.json +1 -1
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
extractPresentedPlan,
|
|
5
|
+
readPlanFile,
|
|
6
|
+
writePlanFile
|
|
7
|
+
} from "./chunk-JFOPOMK7.js";
|
|
8
|
+
import {
|
|
9
|
+
releaseCaffeinateHoldForThread
|
|
10
|
+
} from "./chunk-YWI3IBP2.js";
|
|
3
11
|
import {
|
|
4
12
|
PLAN_MODE_INSTRUCTION,
|
|
5
13
|
applyAgentEvent,
|
|
@@ -33,15 +41,7 @@ import {
|
|
|
33
41
|
summarizeTurnStderr,
|
|
34
42
|
toolDescription,
|
|
35
43
|
turnFailChatText
|
|
36
|
-
} from "./chunk-
|
|
37
|
-
import {
|
|
38
|
-
extractPresentedPlan,
|
|
39
|
-
readPlanFile,
|
|
40
|
-
writePlanFile
|
|
41
|
-
} from "./chunk-JFOPOMK7.js";
|
|
42
|
-
import {
|
|
43
|
-
releaseCaffeinateHoldForThread
|
|
44
|
-
} from "./chunk-OCQPTUR7.js";
|
|
44
|
+
} from "./chunk-EBPBGQ4P.js";
|
|
45
45
|
import {
|
|
46
46
|
SLACK_REPLY_FORMATTING,
|
|
47
47
|
addWorkspace,
|
|
@@ -64,10 +64,9 @@ import {
|
|
|
64
64
|
stageAbsolutePathsAsAttachments,
|
|
65
65
|
stageBuffersAsAttachments,
|
|
66
66
|
syncWorkspacesFromThreads
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-HIX2VDRE.js";
|
|
68
68
|
import {
|
|
69
69
|
addPrStackLayer,
|
|
70
|
-
allocateTeamName,
|
|
71
70
|
allocateTeamSlug,
|
|
72
71
|
canonicalizeRepoPath,
|
|
73
72
|
commitAll,
|
|
@@ -90,13 +89,11 @@ import {
|
|
|
90
89
|
getPrStack,
|
|
91
90
|
initPrStack,
|
|
92
91
|
isDirty,
|
|
93
|
-
isPlaceholderBranch,
|
|
94
92
|
isSideboardScratchPath,
|
|
95
93
|
listWorktrees,
|
|
96
94
|
markPrReady,
|
|
97
95
|
mergeAgentGitAuthEnv,
|
|
98
96
|
mergePr,
|
|
99
|
-
normalizeWorktreePath,
|
|
100
97
|
originGhRepoEnv,
|
|
101
98
|
pushBranch,
|
|
102
99
|
removeWorktree,
|
|
@@ -107,14 +104,8 @@ import {
|
|
|
107
104
|
resolvePrSelector,
|
|
108
105
|
resolvePrSelectors,
|
|
109
106
|
resolveRepoRoot,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
ticketSlugForBranch,
|
|
113
|
-
withRepoGitLock,
|
|
114
|
-
worktreeDisplayLabelForGroup,
|
|
115
|
-
worktreeNameFromPath,
|
|
116
|
-
worktreeSlugForTicket
|
|
117
|
-
} from "./chunk-XBLN52RZ.js";
|
|
107
|
+
withRepoGitLock
|
|
108
|
+
} from "./chunk-XPKKCFRT.js";
|
|
118
109
|
import {
|
|
119
110
|
ATTACHMENTS_DIR,
|
|
120
111
|
DETACHED_JOBS_DIR,
|
|
@@ -132,7 +123,18 @@ import {
|
|
|
132
123
|
updateThread,
|
|
133
124
|
withThreadLock,
|
|
134
125
|
writeThread
|
|
135
|
-
} from "./chunk-
|
|
126
|
+
} from "./chunk-CJFBSQIB.js";
|
|
127
|
+
import {
|
|
128
|
+
allocateTeamName,
|
|
129
|
+
isPlaceholderBranch,
|
|
130
|
+
normalizeWorktreePath,
|
|
131
|
+
takenSlugsFromThread,
|
|
132
|
+
threadDisplayLabel,
|
|
133
|
+
ticketSlugForBranch,
|
|
134
|
+
worktreeDisplayLabelForGroup,
|
|
135
|
+
worktreeNameFromPath,
|
|
136
|
+
worktreeSlugForTicket
|
|
137
|
+
} from "./chunk-64QSHOKV.js";
|
|
136
138
|
import {
|
|
137
139
|
ensureWorktreeSideboardIgnored
|
|
138
140
|
} from "./chunk-SYFVUF2C.js";
|
|
@@ -168,7 +170,7 @@ import {
|
|
|
168
170
|
stripNestedElectronEnv,
|
|
169
171
|
updateAdvancedSettings,
|
|
170
172
|
writeSecureJson
|
|
171
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-KORE4WOF.js";
|
|
172
174
|
import {
|
|
173
175
|
writePrivateFile
|
|
174
176
|
} from "./chunk-NSTQ6QKD.js";
|
|
@@ -184,7 +186,11 @@ import {
|
|
|
184
186
|
threadsDir,
|
|
185
187
|
workspaceSettingsSourceLabel,
|
|
186
188
|
worktreesRoot
|
|
187
|
-
} from "./chunk-
|
|
189
|
+
} from "./chunk-EQNRWDLN.js";
|
|
190
|
+
import {
|
|
191
|
+
examplePrefixedBranch,
|
|
192
|
+
sanitizeGitBranchPrefix
|
|
193
|
+
} from "./chunk-JTWKGOFI.js";
|
|
188
194
|
|
|
189
195
|
// src/orchestrator/orchestrator.ts
|
|
190
196
|
import { EventEmitter } from "events";
|
|
@@ -402,7 +408,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
402
408
|
await continueOnReply(threadId, prompt);
|
|
403
409
|
return;
|
|
404
410
|
}
|
|
405
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
411
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-SFOT6Q6F.js");
|
|
406
412
|
await getOrchestrator2().send(threadId, prompt);
|
|
407
413
|
} catch {
|
|
408
414
|
}
|
|
@@ -795,9 +801,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
795
801
|
`Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
|
|
796
802
|
);
|
|
797
803
|
}
|
|
798
|
-
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-
|
|
804
|
+
const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-BZ6V6TEX.js");
|
|
799
805
|
if (isGlobalThread2(thread)) {
|
|
800
|
-
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-
|
|
806
|
+
const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-GXJIPWNA.js");
|
|
801
807
|
ensureGlobalCoordinatorCwd2(
|
|
802
808
|
isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
|
|
803
809
|
);
|
|
@@ -912,80 +918,6 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
912
918
|
};
|
|
913
919
|
}
|
|
914
920
|
|
|
915
|
-
// src/land/pr-metadata.ts
|
|
916
|
-
var GENERIC_TITLE_RE = /^(sideboard:|thread\/|wip\b|tmp\b|update\b|changes?\b|misc\b|stuff\b)/i;
|
|
917
|
-
function looksGeneric(title) {
|
|
918
|
-
const t = title.trim();
|
|
919
|
-
if (!t) return true;
|
|
920
|
-
if (t.length < 4) return true;
|
|
921
|
-
if (GENERIC_TITLE_RE.test(t)) return true;
|
|
922
|
-
if (!/[\s:/\-_]/.test(t) && t.length <= 24) return true;
|
|
923
|
-
return false;
|
|
924
|
-
}
|
|
925
|
-
function truncateTitle(title, max = 72) {
|
|
926
|
-
const t = title.trim().replace(/\s+/g, " ");
|
|
927
|
-
if (t.length <= max) return t;
|
|
928
|
-
return `${t.slice(0, max - 1).trimEnd()}\u2026`;
|
|
929
|
-
}
|
|
930
|
-
function titleFromPaths(paths) {
|
|
931
|
-
if (paths.length === 0) return null;
|
|
932
|
-
const top = paths.slice(0, 3).map((p) => p.replace(/\/$/, ""));
|
|
933
|
-
if (paths.length === 1) return truncateTitle(`Update ${top[0]}`);
|
|
934
|
-
if (paths.length <= 3) return truncateTitle(`Update ${top.join(", ")}`);
|
|
935
|
-
return truncateTitle(`Update ${top[0]} and ${paths.length - 1} more files`);
|
|
936
|
-
}
|
|
937
|
-
async function suggestPrMetadata(worktreePath, opts) {
|
|
938
|
-
const [{ stdout: logOut }, { stdout: nameStatus }, { stdout: statOut }] = await Promise.all([
|
|
939
|
-
git(["log", "--format=%s", `${opts.base}..HEAD`], worktreePath, {
|
|
940
|
-
reject: false
|
|
941
|
-
}),
|
|
942
|
-
git(["diff", "--name-only", `${opts.base}...HEAD`], worktreePath, {
|
|
943
|
-
reject: false
|
|
944
|
-
}),
|
|
945
|
-
git(["diff", "--stat", `${opts.base}...HEAD`], worktreePath, {
|
|
946
|
-
reject: false
|
|
947
|
-
})
|
|
948
|
-
]);
|
|
949
|
-
const { stdout: dirtyNames } = await git(["diff", "--name-only", "HEAD"], worktreePath, {
|
|
950
|
-
reject: false
|
|
951
|
-
});
|
|
952
|
-
const { stdout: untracked } = await git(
|
|
953
|
-
["ls-files", "--others", "--exclude-standard"],
|
|
954
|
-
worktreePath,
|
|
955
|
-
{ reject: false }
|
|
956
|
-
);
|
|
957
|
-
const subjects = logOut.split("\n").map((s) => s.trim()).filter(Boolean);
|
|
958
|
-
const paths = [
|
|
959
|
-
...new Set(
|
|
960
|
-
[...nameStatus.split("\n"), ...dirtyNames.split("\n"), ...untracked.split("\n")].map((p) => p.trim()).filter(Boolean)
|
|
961
|
-
)
|
|
962
|
-
].sort((a, b) => a.localeCompare(b));
|
|
963
|
-
const meaningfulSubjects = subjects.filter((s) => !looksGeneric(s));
|
|
964
|
-
const fallback = opts.fallbackTitle?.trim() || null;
|
|
965
|
-
const fallbackOk = fallback && !looksGeneric(fallback) ? fallback : null;
|
|
966
|
-
const title = truncateTitle(
|
|
967
|
-
meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? "Sideboard changes"
|
|
968
|
-
);
|
|
969
|
-
const commitMessage = meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? `sideboard: ${title}`;
|
|
970
|
-
const summaryLines = meaningfulSubjects.length > 0 ? meaningfulSubjects.slice(0, 12).map((s) => `- ${s}`) : paths.slice(0, 20).map((p) => `- \`${p}\``);
|
|
971
|
-
const bodyParts = [
|
|
972
|
-
"## Summary",
|
|
973
|
-
summaryLines.length > 0 ? summaryLines.join("\n") : "- Changes landed via Sideboard.",
|
|
974
|
-
""
|
|
975
|
-
];
|
|
976
|
-
if (statOut.trim()) {
|
|
977
|
-
bodyParts.push("## Diff", "```", statOut.trim(), "```", "");
|
|
978
|
-
}
|
|
979
|
-
if (opts.sourceLabel) {
|
|
980
|
-
bodyParts.push(`_Landed via Sideboard from ${opts.sourceLabel}_`);
|
|
981
|
-
}
|
|
982
|
-
return {
|
|
983
|
-
title,
|
|
984
|
-
body: bodyParts.join("\n").trim() + "\n",
|
|
985
|
-
commitMessage: truncateTitle(commitMessage, 72)
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
|
|
989
921
|
// src/git/agent-git-actions.ts
|
|
990
922
|
var AGENT_GIT_ACTIONS = [
|
|
991
923
|
"commit-push",
|
|
@@ -1014,6 +946,19 @@ function agentGitPrompt(action, opts) {
|
|
|
1014
946
|
return "Merge PR.";
|
|
1015
947
|
}
|
|
1016
948
|
}
|
|
949
|
+
function resolveSidebarGitPrompt(action, opts) {
|
|
950
|
+
if (action === "create-pr" || action === "create-draft" || action === "create-web") {
|
|
951
|
+
const custom = opts?.createPr?.trim();
|
|
952
|
+
if (custom) return custom;
|
|
953
|
+
return agentGitPrompt(action === "create-pr" ? "create-draft" : action);
|
|
954
|
+
}
|
|
955
|
+
if (action === "resolve-conflicts") {
|
|
956
|
+
const custom = opts?.resolveMergeConflicts?.trim();
|
|
957
|
+
if (custom) return custom;
|
|
958
|
+
return agentGitPrompt("resolve-conflicts", opts);
|
|
959
|
+
}
|
|
960
|
+
return agentGitPrompt(action, opts);
|
|
961
|
+
}
|
|
1017
962
|
var RESOLVE_CONFLICTS_RE = /^Merge the remote branch(?: \(([^)]+)\))? into your branch and resolve conflicts\. Then, commit and push your changes\.$/;
|
|
1018
963
|
function gitActionExpansion(action, base) {
|
|
1019
964
|
switch (action) {
|
|
@@ -2658,8 +2603,8 @@ function mcpWaitForTurnTimeoutMs(requested) {
|
|
|
2658
2603
|
if (!Number.isFinite(n)) return MCP_WAIT_FOR_TURN_MAX_MS;
|
|
2659
2604
|
return Math.min(Math.max(1e3, Math.floor(n)), MCP_WAIT_FOR_TURN_MAX_MS);
|
|
2660
2605
|
}
|
|
2661
|
-
var MCP_WAIT_STILL_RUNNING_HINT = "Child is still working. Call wait_for_turn again. Do not
|
|
2662
|
-
var MCP_WAIT_QUEUED_HINT = "Child is queued waiting for a concurrency slot \u2014 it has not started yet. Call wait_for_turn again. Do not
|
|
2606
|
+
var MCP_WAIT_STILL_RUNNING_HINT = "Child is still working. Call wait_for_turn again. Do not send_to_thread a check-in (that steers / interrupts) or assume a hang while progress is updating.";
|
|
2607
|
+
var MCP_WAIT_QUEUED_HINT = "Child is queued waiting for a concurrency slot \u2014 it has not started yet. Call wait_for_turn again. Do not send_to_thread a check-in (that steers / interrupts), force_stop, or assume it failed to start.";
|
|
2663
2608
|
function mcpWaitStillRunningHint(status) {
|
|
2664
2609
|
return status === "queued" ? MCP_WAIT_QUEUED_HINT : MCP_WAIT_STILL_RUNNING_HINT;
|
|
2665
2610
|
}
|
|
@@ -3585,7 +3530,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3585
3530
|
});
|
|
3586
3531
|
await requireAgent(resolved.agent);
|
|
3587
3532
|
if (input.cowboy) {
|
|
3588
|
-
const { cowboyModeEnabled } = await import("./app-settings-
|
|
3533
|
+
const { cowboyModeEnabled } = await import("./app-settings-QYLNKRK4.js");
|
|
3589
3534
|
if (!cowboyModeEnabled()) {
|
|
3590
3535
|
throw new Error(
|
|
3591
3536
|
"Cowboy mode is off. Enable it in Settings \u2192 Advanced."
|
|
@@ -3643,7 +3588,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3643
3588
|
let sourceIsFork = false;
|
|
3644
3589
|
if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
|
|
3645
3590
|
if (isAbleTimeConnected() && getIssueSource() === "abletime") {
|
|
3646
|
-
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-
|
|
3591
|
+
const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-UX53JTIH.js");
|
|
3647
3592
|
const task = await ensureAbleTimeTask({
|
|
3648
3593
|
title: title?.trim() || "Untitled work",
|
|
3649
3594
|
description: input.prompt?.trim() || void 0
|
|
@@ -4155,7 +4100,7 @@ async function adoptThread(input) {
|
|
|
4155
4100
|
messages: input.messages ?? []
|
|
4156
4101
|
});
|
|
4157
4102
|
writeThread(thread);
|
|
4158
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
4103
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-ACMZMKPD.js");
|
|
4159
4104
|
await ensureWorkspace2(repoPath);
|
|
4160
4105
|
const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-N5X5I422.js");
|
|
4161
4106
|
await ensureWorktreeSideboardIgnored2(input.worktreePath);
|
|
@@ -5377,6 +5322,80 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
5377
5322
|
};
|
|
5378
5323
|
}
|
|
5379
5324
|
|
|
5325
|
+
// src/land/pr-metadata.ts
|
|
5326
|
+
var GENERIC_TITLE_RE = /^(sideboard:|thread\/|wip\b|tmp\b|update\b|changes?\b|misc\b|stuff\b)/i;
|
|
5327
|
+
function looksGeneric(title) {
|
|
5328
|
+
const t = title.trim();
|
|
5329
|
+
if (!t) return true;
|
|
5330
|
+
if (t.length < 4) return true;
|
|
5331
|
+
if (GENERIC_TITLE_RE.test(t)) return true;
|
|
5332
|
+
if (!/[\s:/\-_]/.test(t) && t.length <= 24) return true;
|
|
5333
|
+
return false;
|
|
5334
|
+
}
|
|
5335
|
+
function truncateTitle(title, max = 72) {
|
|
5336
|
+
const t = title.trim().replace(/\s+/g, " ");
|
|
5337
|
+
if (t.length <= max) return t;
|
|
5338
|
+
return `${t.slice(0, max - 1).trimEnd()}\u2026`;
|
|
5339
|
+
}
|
|
5340
|
+
function titleFromPaths(paths) {
|
|
5341
|
+
if (paths.length === 0) return null;
|
|
5342
|
+
const top = paths.slice(0, 3).map((p) => p.replace(/\/$/, ""));
|
|
5343
|
+
if (paths.length === 1) return truncateTitle(`Update ${top[0]}`);
|
|
5344
|
+
if (paths.length <= 3) return truncateTitle(`Update ${top.join(", ")}`);
|
|
5345
|
+
return truncateTitle(`Update ${top[0]} and ${paths.length - 1} more files`);
|
|
5346
|
+
}
|
|
5347
|
+
async function suggestPrMetadata(worktreePath, opts) {
|
|
5348
|
+
const [{ stdout: logOut }, { stdout: nameStatus }, { stdout: statOut }] = await Promise.all([
|
|
5349
|
+
git(["log", "--format=%s", `${opts.base}..HEAD`], worktreePath, {
|
|
5350
|
+
reject: false
|
|
5351
|
+
}),
|
|
5352
|
+
git(["diff", "--name-only", `${opts.base}...HEAD`], worktreePath, {
|
|
5353
|
+
reject: false
|
|
5354
|
+
}),
|
|
5355
|
+
git(["diff", "--stat", `${opts.base}...HEAD`], worktreePath, {
|
|
5356
|
+
reject: false
|
|
5357
|
+
})
|
|
5358
|
+
]);
|
|
5359
|
+
const { stdout: dirtyNames } = await git(["diff", "--name-only", "HEAD"], worktreePath, {
|
|
5360
|
+
reject: false
|
|
5361
|
+
});
|
|
5362
|
+
const { stdout: untracked } = await git(
|
|
5363
|
+
["ls-files", "--others", "--exclude-standard"],
|
|
5364
|
+
worktreePath,
|
|
5365
|
+
{ reject: false }
|
|
5366
|
+
);
|
|
5367
|
+
const subjects = logOut.split("\n").map((s) => s.trim()).filter(Boolean);
|
|
5368
|
+
const paths = [
|
|
5369
|
+
...new Set(
|
|
5370
|
+
[...nameStatus.split("\n"), ...dirtyNames.split("\n"), ...untracked.split("\n")].map((p) => p.trim()).filter(Boolean)
|
|
5371
|
+
)
|
|
5372
|
+
].sort((a, b) => a.localeCompare(b));
|
|
5373
|
+
const meaningfulSubjects = subjects.filter((s) => !looksGeneric(s));
|
|
5374
|
+
const fallback = opts.fallbackTitle?.trim() || null;
|
|
5375
|
+
const fallbackOk = fallback && !looksGeneric(fallback) ? fallback : null;
|
|
5376
|
+
const title = truncateTitle(
|
|
5377
|
+
meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? "Sideboard changes"
|
|
5378
|
+
);
|
|
5379
|
+
const commitMessage = meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? `sideboard: ${title}`;
|
|
5380
|
+
const summaryLines = meaningfulSubjects.length > 0 ? meaningfulSubjects.slice(0, 12).map((s) => `- ${s}`) : paths.slice(0, 20).map((p) => `- \`${p}\``);
|
|
5381
|
+
const bodyParts = [
|
|
5382
|
+
"## Summary",
|
|
5383
|
+
summaryLines.length > 0 ? summaryLines.join("\n") : "- Changes landed via Sideboard.",
|
|
5384
|
+
""
|
|
5385
|
+
];
|
|
5386
|
+
if (statOut.trim()) {
|
|
5387
|
+
bodyParts.push("## Diff", "```", statOut.trim(), "```", "");
|
|
5388
|
+
}
|
|
5389
|
+
if (opts.sourceLabel) {
|
|
5390
|
+
bodyParts.push(`_Landed via Sideboard from ${opts.sourceLabel}_`);
|
|
5391
|
+
}
|
|
5392
|
+
return {
|
|
5393
|
+
title,
|
|
5394
|
+
body: bodyParts.join("\n").trim() + "\n",
|
|
5395
|
+
commitMessage: truncateTitle(commitMessage, 72)
|
|
5396
|
+
};
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5380
5399
|
// src/land/land.ts
|
|
5381
5400
|
async function previewLand(thread) {
|
|
5382
5401
|
if (thread.sourceIsFork) {
|
|
@@ -5874,13 +5893,14 @@ function formatRenameBranchDirective(thread, opts) {
|
|
|
5874
5893
|
if (!isPlaceholderBranch(thread.branchName, thread.worktreePath)) return null;
|
|
5875
5894
|
const dir = worktreeNameFromPath(thread.worktreePath);
|
|
5876
5895
|
const ticket = thread.sourceType === "ticket" ? ticketSlugForBranch(thread.sourceRef ?? "") : null;
|
|
5877
|
-
const
|
|
5896
|
+
const prefix = sanitizeGitBranchPrefix(opts?.branchPrefix);
|
|
5897
|
+
const example = examplePrefixedBranch(prefix, ticket);
|
|
5898
|
+
const shape = prefix ? `\`${prefix}/<ticket-or-task>-<short-kebab-description>\`` : "`<ticket-or-task>-<short-kebab-description>`";
|
|
5878
5899
|
const lines = [
|
|
5879
5900
|
"Branch naming (do this early in the turn):",
|
|
5880
5901
|
`- Current branch \`${thread.branchName}\` is a temporary placeholder. The worktree folder \`${dir}\` is a stable nickname \u2014 do not rename or leave that directory.`,
|
|
5881
|
-
`- Rename the git branch to
|
|
5902
|
+
`- Rename the git branch to ${shape}, e.g. \`${example}\`:`,
|
|
5882
5903
|
" `git branch -m <new-name>`",
|
|
5883
|
-
"- Prefer Conventional Commits style prefixes when they fit (`fix/`, `feat/`, `chore/`, `docs/`).",
|
|
5884
5904
|
...ticket ? [
|
|
5885
5905
|
`- Keep ticket \`${ticket}\` in the new branch name so the issue stays findable.`
|
|
5886
5906
|
] : [],
|
|
@@ -6458,7 +6478,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
6458
6478
|
${prompt}`;
|
|
6459
6479
|
}
|
|
6460
6480
|
async function defaultDeps() {
|
|
6461
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
6481
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-SFOT6Q6F.js");
|
|
6462
6482
|
const orch = getOrchestrator2();
|
|
6463
6483
|
return {
|
|
6464
6484
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -6589,6 +6609,10 @@ function resolveSendFollowUp(thread, requested) {
|
|
|
6589
6609
|
if (requested === "steer" || requested === "queue") return requested;
|
|
6590
6610
|
return isOrchestratorThread(thread) ? followUpBehavior() : "queue";
|
|
6591
6611
|
}
|
|
6612
|
+
function resolveOrchChildFollowUp(requested) {
|
|
6613
|
+
if (requested === "steer" || requested === "queue") return requested;
|
|
6614
|
+
return followUpBehavior();
|
|
6615
|
+
}
|
|
6592
6616
|
var STALE_AGENT_PID_WAIT_MS = 2500;
|
|
6593
6617
|
function writeLiveStatus(threadId, status, lastError) {
|
|
6594
6618
|
const latest = readThread(threadId);
|
|
@@ -6729,7 +6753,7 @@ var Orchestrator = class {
|
|
|
6729
6753
|
orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
|
|
6730
6754
|
});
|
|
6731
6755
|
}
|
|
6732
|
-
const { autoCleanupOrphansEnabled } = await import("./app-settings-
|
|
6756
|
+
const { autoCleanupOrphansEnabled } = await import("./app-settings-QYLNKRK4.js");
|
|
6733
6757
|
if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
|
|
6734
6758
|
await cleanupOrphanWorktrees({ repoPaths });
|
|
6735
6759
|
}
|
|
@@ -7008,7 +7032,7 @@ var Orchestrator = class {
|
|
|
7008
7032
|
}
|
|
7009
7033
|
await setup;
|
|
7010
7034
|
if (skipSetup) return;
|
|
7011
|
-
const { autoRunAfterSetupEnabled } = await import("./app-settings-
|
|
7035
|
+
const { autoRunAfterSetupEnabled } = await import("./app-settings-QYLNKRK4.js");
|
|
7012
7036
|
if (autoRunAfterSetupEnabled()) {
|
|
7013
7037
|
try {
|
|
7014
7038
|
await this.startDev(threadId);
|
|
@@ -7331,7 +7355,7 @@ var Orchestrator = class {
|
|
|
7331
7355
|
}
|
|
7332
7356
|
const isBrightsy = fresh.agent === "brightsy";
|
|
7333
7357
|
const isOrchestration = isOrchestratorThread(fresh);
|
|
7334
|
-
const { autoRenameBranchEnabled, getGithubGitAuthMode } = await import("./app-settings-
|
|
7358
|
+
const { autoRenameBranchEnabled, getGithubGitAuthMode, gitBranchPrefixSetting } = await import("./app-settings-QYLNKRK4.js");
|
|
7335
7359
|
const gitAuthMode = getGithubGitAuthMode();
|
|
7336
7360
|
const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
|
|
7337
7361
|
githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
|
|
@@ -7367,9 +7391,26 @@ var Orchestrator = class {
|
|
|
7367
7391
|
}
|
|
7368
7392
|
}
|
|
7369
7393
|
const settings = loadWorkspaceSettings(fresh.worktreePath, fresh.repoPath);
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7394
|
+
let renameBranchDirective = null;
|
|
7395
|
+
if (!isBrightsy && !isOrchestration && autoRenameBranchEnabled()) {
|
|
7396
|
+
const { isPlaceholderBranch: isPlaceholderBranch2 } = await import("./worktree-labels-PEDOJBMD.js");
|
|
7397
|
+
let githubLogin = null;
|
|
7398
|
+
if (isPlaceholderBranch2(fresh.branchName, fresh.worktreePath) && !gitBranchPrefixSetting()) {
|
|
7399
|
+
try {
|
|
7400
|
+
const { getGitHubStatus } = await import("./github-DWROJOB7.js");
|
|
7401
|
+
githubLogin = (await getGitHubStatus()).login;
|
|
7402
|
+
} catch {
|
|
7403
|
+
}
|
|
7404
|
+
}
|
|
7405
|
+
const { resolveGitBranchPrefix } = await import("./branch-prefix-EVW2KHGQ.js");
|
|
7406
|
+
renameBranchDirective = formatRenameBranchDirective(fresh, {
|
|
7407
|
+
customPrompt: settings?.prompts?.renameBranch,
|
|
7408
|
+
branchPrefix: resolveGitBranchPrefix({
|
|
7409
|
+
setting: gitBranchPrefixSetting(),
|
|
7410
|
+
githubLogin
|
|
7411
|
+
})
|
|
7412
|
+
});
|
|
7413
|
+
}
|
|
7373
7414
|
let seed = null;
|
|
7374
7415
|
if (!fresh.sessionId) {
|
|
7375
7416
|
const prior = fresh.messages.slice(0, -1);
|
|
@@ -7464,7 +7505,7 @@ var Orchestrator = class {
|
|
|
7464
7505
|
if (!this.stoppedTurns.has(threadId) && this.requireThread(threadId).agent === "cursor" && exitCode !== 0 && !assistantText && parts.length === 0) {
|
|
7465
7506
|
const sessionId = result.sessionId || this.requireThread(threadId).sessionId || "";
|
|
7466
7507
|
if (sessionId) {
|
|
7467
|
-
const { recoverFinishedCursorRun } = await import("./cursor-recover-
|
|
7508
|
+
const { recoverFinishedCursorRun } = await import("./cursor-recover-TXVTLAMA.js");
|
|
7468
7509
|
for (let i = 0; i < 8; i++) {
|
|
7469
7510
|
const recovered = recoverFinishedCursorRun({
|
|
7470
7511
|
agentId: sessionId,
|
|
@@ -8257,7 +8298,7 @@ var Orchestrator = class {
|
|
|
8257
8298
|
updateThread(thread.id, { title: meta.title });
|
|
8258
8299
|
}
|
|
8259
8300
|
}
|
|
8260
|
-
const { autoArchiveOnMergeEnabled } = await import("./app-settings-
|
|
8301
|
+
const { autoArchiveOnMergeEnabled } = await import("./app-settings-QYLNKRK4.js");
|
|
8261
8302
|
const latest = this.requireThread(thread.id);
|
|
8262
8303
|
if (!shouldAutoArchiveOnPrMerge({
|
|
8263
8304
|
previousPrState: prevState || null,
|
|
@@ -8399,9 +8440,9 @@ var Orchestrator = class {
|
|
|
8399
8440
|
return tab;
|
|
8400
8441
|
}
|
|
8401
8442
|
/**
|
|
8402
|
-
* Desktop git buttons + MCP `ask_git`.
|
|
8403
|
-
*
|
|
8404
|
-
*
|
|
8443
|
+
* Desktop git buttons + MCP `ask_git`. Always queues the worktree agent
|
|
8444
|
+
* with the action prompt (same path as Resolve). Repository `[prompts]`
|
|
8445
|
+
* overrides apply when set.
|
|
8405
8446
|
*/
|
|
8406
8447
|
async askGit(threadRef, action) {
|
|
8407
8448
|
if (!AGENT_GIT_ACTIONS.includes(action)) {
|
|
@@ -8419,17 +8460,6 @@ var Orchestrator = class {
|
|
|
8419
8460
|
"No pull request linked. Ask the worktree agent to open a draft PR first (ask_git create-draft)."
|
|
8420
8461
|
);
|
|
8421
8462
|
}
|
|
8422
|
-
if ((action === "commit-push" || action === "create-draft" || action === "create-web") && thread.worktreePath?.trim() && !await isDirty(thread.worktreePath)) {
|
|
8423
|
-
try {
|
|
8424
|
-
await this.pushAndMaybeOpenPr(thread, action);
|
|
8425
|
-
} catch (err) {
|
|
8426
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
8427
|
-
updateThread(thread.id, { lastError: message });
|
|
8428
|
-
this.emit({ type: "error", threadId: thread.id, message });
|
|
8429
|
-
throw err;
|
|
8430
|
-
}
|
|
8431
|
-
return this.requireThread(threadRef);
|
|
8432
|
-
}
|
|
8433
8463
|
let prBase;
|
|
8434
8464
|
if (action === "resolve-conflicts") {
|
|
8435
8465
|
try {
|
|
@@ -8438,40 +8468,18 @@ var Orchestrator = class {
|
|
|
8438
8468
|
} catch {
|
|
8439
8469
|
}
|
|
8440
8470
|
}
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
});
|
|
8454
|
-
const url = await createOrUpdatePr(cwd, {
|
|
8455
|
-
title: meta.title,
|
|
8456
|
-
body: meta.body,
|
|
8457
|
-
base,
|
|
8458
|
-
head: branch,
|
|
8459
|
-
draft: action === "create-draft",
|
|
8460
|
-
web: action === "create-web"
|
|
8461
|
-
});
|
|
8462
|
-
if (!url) return;
|
|
8463
|
-
const patch = {
|
|
8464
|
-
prUrl: url,
|
|
8465
|
-
prTitle: meta.title,
|
|
8466
|
-
prIsDraft: action === "create-draft"
|
|
8467
|
-
};
|
|
8468
|
-
try {
|
|
8469
|
-
const fetched = await getPrMeta(cwd, url);
|
|
8470
|
-
if (fetched?.title) patch.prTitle = fetched.title;
|
|
8471
|
-
if (fetched) patch.prIsDraft = Boolean(fetched.isDraft);
|
|
8472
|
-
} catch {
|
|
8473
|
-
}
|
|
8474
|
-
updateThread(thread.id, patch);
|
|
8471
|
+
const settings = loadWorkspaceSettings(thread.worktreePath, thread.repoPath);
|
|
8472
|
+
return this.send(
|
|
8473
|
+
threadRef,
|
|
8474
|
+
resolveSidebarGitPrompt(action, {
|
|
8475
|
+
prBase,
|
|
8476
|
+
createPr: settings?.prompts?.createPr,
|
|
8477
|
+
resolveMergeConflicts: settings?.prompts?.resolveMergeConflicts
|
|
8478
|
+
}),
|
|
8479
|
+
{
|
|
8480
|
+
followUp: resolveOrchChildFollowUp()
|
|
8481
|
+
}
|
|
8482
|
+
);
|
|
8475
8483
|
}
|
|
8476
8484
|
setThreadOptions(threadRef, patch) {
|
|
8477
8485
|
const thread = this.requireThread(threadRef);
|
|
@@ -8582,7 +8590,7 @@ var Orchestrator = class {
|
|
|
8582
8590
|
this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
|
|
8583
8591
|
if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
|
|
8584
8592
|
try {
|
|
8585
|
-
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-
|
|
8593
|
+
const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-ACMZMKPD.js");
|
|
8586
8594
|
await ensureWorkspace2(thread.repoPath);
|
|
8587
8595
|
} catch {
|
|
8588
8596
|
}
|
|
@@ -8609,7 +8617,7 @@ var Orchestrator = class {
|
|
|
8609
8617
|
await runArchiveScript(thread.repoPath, thread.worktreePath);
|
|
8610
8618
|
} catch {
|
|
8611
8619
|
}
|
|
8612
|
-
const { deleteBranchOnPurgeEnabled } = await import("./app-settings-
|
|
8620
|
+
const { deleteBranchOnPurgeEnabled } = await import("./app-settings-QYLNKRK4.js");
|
|
8613
8621
|
const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
|
|
8614
8622
|
await removeWorktree(thread.repoPath, thread.worktreePath, {
|
|
8615
8623
|
deleteBranch: deleteBranch ? thread.branchName : void 0
|
|
@@ -8624,7 +8632,7 @@ var Orchestrator = class {
|
|
|
8624
8632
|
throw new Error("Thread is not archived");
|
|
8625
8633
|
}
|
|
8626
8634
|
if (isGlobalThread(thread)) {
|
|
8627
|
-
const { globalAgentCwd } = await import("./paths-
|
|
8635
|
+
const { globalAgentCwd } = await import("./paths-C2VERLAE.js");
|
|
8628
8636
|
updateThread(thread.id, { worktreePath: globalAgentCwd() });
|
|
8629
8637
|
const restored2 = setStatus(thread.id, "idle");
|
|
8630
8638
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
@@ -8636,7 +8644,7 @@ var Orchestrator = class {
|
|
|
8636
8644
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
8637
8645
|
);
|
|
8638
8646
|
}
|
|
8639
|
-
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-
|
|
8647
|
+
const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-6IEVF3GN.js");
|
|
8640
8648
|
const slug = thread.worktreePath.split("/").pop();
|
|
8641
8649
|
const dest = thread.worktreePath;
|
|
8642
8650
|
await withRepoGitLock(thread.repoPath, async () => {
|
|
@@ -8746,7 +8754,7 @@ async function startOrchestration(opts) {
|
|
|
8746
8754
|
sourceRef: "default",
|
|
8747
8755
|
...createOpts
|
|
8748
8756
|
}).catch(async () => {
|
|
8749
|
-
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-
|
|
8757
|
+
const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-6IEVF3GN.js");
|
|
8750
8758
|
const repo = await resolveRepoRoot2(repoPath);
|
|
8751
8759
|
const def = await resolveDefaultBranch2(repo);
|
|
8752
8760
|
return orch.createThread({
|
|
@@ -8756,7 +8764,7 @@ async function startOrchestration(opts) {
|
|
|
8756
8764
|
repoPath: repo
|
|
8757
8765
|
});
|
|
8758
8766
|
});
|
|
8759
|
-
const { updateThread: upd } = await import("./thread-store-
|
|
8767
|
+
const { updateThread: upd } = await import("./thread-store-CO77HV2K.js");
|
|
8760
8768
|
const updated = upd(thread.id, {
|
|
8761
8769
|
sourceType: "orchestration",
|
|
8762
8770
|
sourceRef: goal
|
|
@@ -8807,6 +8815,7 @@ export {
|
|
|
8807
8815
|
isPidAlive,
|
|
8808
8816
|
waitForPidExit,
|
|
8809
8817
|
resolveSendFollowUp,
|
|
8818
|
+
resolveOrchChildFollowUp,
|
|
8810
8819
|
Orchestrator,
|
|
8811
8820
|
getOrchestrator,
|
|
8812
8821
|
startOrchestration
|