@sideboard-ai/core 0.1.192 → 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.
Files changed (68) hide show
  1. package/dist/{abletime-JFMBCSIQ.js → abletime-QHKWGTBY.js} +4 -3
  2. package/dist/{abletime-53T7G667.js → abletime-UX53JTIH.js} +4 -3
  3. package/dist/agents/cursor-runner.js +4 -4
  4. package/dist/{agents-TXGQIK2E.js → agents-MN4GSQTL.js} +19 -17
  5. package/dist/{agents-T5VBB6X3.js → agents-OK5VD25T.js} +10 -8
  6. package/dist/{app-settings-663VQWUV.js → app-settings-LO7UFHQ6.js} +5 -2
  7. package/dist/{app-settings-74HBAAH7.js → app-settings-QYLNKRK4.js} +5 -2
  8. package/dist/branch-prefix-7F37FIPX.js +10 -0
  9. package/dist/branch-prefix-EVW2KHGQ.js +12 -0
  10. package/dist/{caffeinate-hold-SK2QISPE.js → caffeinate-hold-22VFDPSO.js} +2 -2
  11. package/dist/{caffeinate-hold-DBKMRZZO.js → caffeinate-hold-OK4JJ5PP.js} +2 -2
  12. package/dist/{chunk-FZ3G5TXM.js → chunk-3DX2T2KR.js} +174 -172
  13. package/dist/{chunk-HVIEYTUK.js → chunk-3OHR73VK.js} +1 -1
  14. package/dist/{chunk-VV7UT3E2.js → chunk-4OVCJPVI.js} +11 -9
  15. package/dist/{chunk-UBQIELFS.js → chunk-4QJRH5DL.js} +1 -1
  16. package/dist/{chunk-AO35MGOE.js → chunk-4TYXWPAJ.js} +1 -1
  17. package/dist/chunk-64QSHOKV.js +869 -0
  18. package/dist/{chunk-FY64F2ZQ.js → chunk-7AJ7OZZF.js} +4 -4
  19. package/dist/{chunk-WLPXZFRE.js → chunk-7J72QJOM.js} +1 -1
  20. package/dist/chunk-7SNJMKD6.js +20 -0
  21. package/dist/{chunk-WXKXSZN4.js → chunk-BIKCWYRP.js} +16 -873
  22. package/dist/{chunk-J7LQVLFQ.js → chunk-BWRS6GAS.js} +19 -1
  23. package/dist/{chunk-GOZ6T3AG.js → chunk-CJFBSQIB.js} +1 -1
  24. package/dist/{chunk-WHD4JNTN.js → chunk-EBPBGQ4P.js} +13 -13
  25. package/dist/{chunk-JTJHOYCU.js → chunk-EQNRWDLN.js} +10 -4
  26. package/dist/{chunk-NF6ENGHS.js → chunk-EQXXGOMD.js} +185 -182
  27. package/dist/{chunk-7NSXGL6L.js → chunk-HIX2VDRE.js} +11 -9
  28. package/dist/chunk-ILWQT2UN.js +55 -0
  29. package/dist/chunk-JTWKGOFI.js +23 -0
  30. package/dist/{chunk-TCQAFTSV.js → chunk-KJBYIIJU.js} +1 -1
  31. package/dist/{chunk-OKZFTOM2.js → chunk-KORE4WOF.js} +19 -1
  32. package/dist/{chunk-TWSCTJCR.js → chunk-MQC2VA5U.js} +14 -14
  33. package/dist/{chunk-4M2AK3O5.js → chunk-O4BMPY5Y.js} +1 -1
  34. package/dist/chunk-PBEPPXMY.js +57 -0
  35. package/dist/{chunk-IEEAVWAP.js → chunk-PE337IM2.js} +7 -7
  36. package/dist/chunk-RCWHL4TK.js +866 -0
  37. package/dist/{chunk-EFVFB2AH.js → chunk-WFUDY6PC.js} +12 -5
  38. package/dist/{chunk-XBLN52RZ.js → chunk-XPKKCFRT.js} +9 -866
  39. package/dist/{chunk-OCQPTUR7.js → chunk-YWI3IBP2.js} +1 -1
  40. package/dist/{connected-teams-WOYCH7FR.js → connected-teams-PU4AMFNA.js} +2 -2
  41. package/dist/{connected-teams-ON2KIKQX.js → connected-teams-SYQQGCXD.js} +2 -2
  42. package/dist/{coordinator-prompt-PNUDN4DW.js → coordinator-prompt-GXJIPWNA.js} +7 -5
  43. package/dist/{coordinator-prompt-S4HHFSLI.js → coordinator-prompt-WB65HIZ3.js} +9 -7
  44. package/dist/{cursor-recover-NDMLLNYX.js → cursor-recover-DTQAUDGO.js} +2 -2
  45. package/dist/{cursor-recover-L5MD6MBO.js → cursor-recover-TXVTLAMA.js} +1 -1
  46. package/dist/github-DWROJOB7.js +11 -0
  47. package/dist/github-IIF7AQNO.js +9 -0
  48. package/dist/{global-workspace-2BVCJUAL.js → global-workspace-BZ6V6TEX.js} +7 -5
  49. package/dist/{global-workspace-JTBBH2K5.js → global-workspace-MMK5UFUZ.js} +9 -7
  50. package/dist/index.cjs +274 -194
  51. package/dist/index.d.cts +47 -8
  52. package/dist/index.d.ts +47 -8
  53. package/dist/index.js +98 -127
  54. package/dist/mcp/run-stdio.cjs +260 -190
  55. package/dist/mcp/run-stdio.js +36 -76
  56. package/dist/{orchestrator-LWEZ74RK.js → orchestrator-4KI6VIFG.js} +14 -12
  57. package/dist/{orchestrator-4G76BOHH.js → orchestrator-SFOT6Q6F.js} +13 -11
  58. package/dist/{paths-RRCLNSJB.js → paths-C2VERLAE.js} +1 -1
  59. package/dist/{paths-53TLA7VQ.js → paths-LOXCISLX.js} +1 -1
  60. package/dist/{thread-store-ZL6GDIDP.js → thread-store-CO77HV2K.js} +2 -2
  61. package/dist/{thread-store-RXXNSRVO.js → thread-store-M4B52FUS.js} +2 -2
  62. package/dist/{workspaces-OY7D5RPU.js → workspaces-ACMZMKPD.js} +7 -5
  63. package/dist/{workspaces-ZYPME3YD.js → workspaces-KPJS7GLY.js} +9 -7
  64. package/dist/{worktree-7LOSSD7G.js → worktree-6IEVF3GN.js} +15 -12
  65. package/dist/{worktree-LPWTX2NA.js → worktree-UW6DNBIE.js} +20 -17
  66. package/dist/worktree-labels-3XDS6O3U.js +22 -0
  67. package/dist/worktree-labels-PEDOJBMD.js +24 -0
  68. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -274,9 +274,12 @@ function parseSettingsFile(path2, source) {
274
274
  const prompts = {
275
275
  renameBranch: typeof promptsRaw.rename_branch === "string" ? promptsRaw.rename_branch : void 0,
276
276
  createPr: typeof promptsRaw.create_pr === "string" ? promptsRaw.create_pr : void 0,
277
- general: typeof promptsRaw.general === "string" ? promptsRaw.general : void 0
277
+ general: typeof promptsRaw.general === "string" ? promptsRaw.general : void 0,
278
+ resolveMergeConflicts: typeof promptsRaw.resolve_merge_conflicts === "string" ? promptsRaw.resolve_merge_conflicts : void 0
278
279
  };
279
- const hasPrompts = Boolean(prompts.renameBranch || prompts.createPr || prompts.general);
280
+ const hasPrompts = Boolean(
281
+ prompts.renameBranch || prompts.createPr || prompts.general || prompts.resolveMergeConflicts
282
+ );
280
283
  return {
281
284
  source,
282
285
  setup,
@@ -302,9 +305,12 @@ function mergeSettings(base, overlay) {
302
305
  const prompts = {
303
306
  renameBranch: overlay.prompts?.renameBranch ?? base.prompts?.renameBranch,
304
307
  createPr: overlay.prompts?.createPr ?? base.prompts?.createPr,
305
- general: overlay.prompts?.general ?? base.prompts?.general
308
+ general: overlay.prompts?.general ?? base.prompts?.general,
309
+ resolveMergeConflicts: overlay.prompts?.resolveMergeConflicts ?? base.prompts?.resolveMergeConflicts
306
310
  };
307
- const hasPrompts = Boolean(prompts.renameBranch || prompts.createPr || prompts.general);
311
+ const hasPrompts = Boolean(
312
+ prompts.renameBranch || prompts.createPr || prompts.general || prompts.resolveMergeConflicts
313
+ );
308
314
  return {
309
315
  source: overlay.source,
310
316
  setup: overlay.setup ?? base.setup,
@@ -428,7 +434,8 @@ function getRepoSetupInfo(worktreePath, repoPath) {
428
434
  return {
429
435
  hasConfig: hasWorkspaceHook(worktreePath, repoPath) || cursor || Boolean(convention),
430
436
  hasSetupScript,
431
- configLabel
437
+ configLabel,
438
+ ...settings?.prompts ? { prompts: settings.prompts } : {}
432
439
  };
433
440
  }
434
441
  var import_node_fs3, import_node_os, import_node_path3, import_smol_toml;
@@ -955,6 +962,32 @@ var init_secret_vault = __esm({
955
962
  }
956
963
  });
957
964
 
965
+ // src/git/branch-prefix.ts
966
+ var branch_prefix_exports = {};
967
+ __export(branch_prefix_exports, {
968
+ examplePrefixedBranch: () => examplePrefixedBranch,
969
+ resolveGitBranchPrefix: () => resolveGitBranchPrefix,
970
+ sanitizeGitBranchPrefix: () => sanitizeGitBranchPrefix
971
+ });
972
+ function sanitizeGitBranchPrefix(raw) {
973
+ const first = (raw ?? "").trim().replace(/^\/+|\/+$/g, "").split("/")[0] ?? "";
974
+ const slug = first.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 39);
975
+ return slug || null;
976
+ }
977
+ function resolveGitBranchPrefix(opts) {
978
+ return sanitizeGitBranchPrefix(opts.setting) ?? sanitizeGitBranchPrefix(opts.githubLogin);
979
+ }
980
+ function examplePrefixedBranch(prefix, ticket) {
981
+ const head = sanitizeGitBranchPrefix(prefix);
982
+ const slug = ticket?.trim() ? `${ticket.trim()}-eng-fix-thing` : "bb-1234-eng-fix-thing";
983
+ return head ? `${head}/${slug}` : slug;
984
+ }
985
+ var init_branch_prefix = __esm({
986
+ "src/git/branch-prefix.ts"() {
987
+ "use strict";
988
+ }
989
+ });
990
+
958
991
  // src/store/issue-source-labels.ts
959
992
  function issueSourceLabel(source) {
960
993
  if (source && source in ISSUE_SOURCE_LABELS) {
@@ -1023,6 +1056,7 @@ __export(app_settings_exports, {
1023
1056
  getGithubPat: () => getGithubPat,
1024
1057
  getIssueSource: () => getIssueSource,
1025
1058
  getLinearApiKey: () => getLinearApiKey,
1059
+ gitBranchPrefixSetting: () => gitBranchPrefixSetting,
1026
1060
  harnessEnvKey: () => harnessEnvKey,
1027
1061
  isAbleTimeConnected: () => isAbleTimeConnected,
1028
1062
  isIssueSourceConnected: () => isIssueSourceConnected,
@@ -1398,6 +1432,10 @@ function normalizeAdvanced(raw) {
1398
1432
  if (typeof source.autoRenameBranch === "boolean") {
1399
1433
  out.autoRenameBranch = source.autoRenameBranch;
1400
1434
  }
1435
+ if (typeof source.branchPrefix === "string") {
1436
+ const prefix = sanitizeGitBranchPrefix(source.branchPrefix);
1437
+ if (prefix) out.branchPrefix = prefix;
1438
+ }
1401
1439
  if (typeof source.autoRunAfterSetup === "boolean") {
1402
1440
  out.autoRunAfterSetup = source.autoRunAfterSetup;
1403
1441
  }
@@ -2251,6 +2289,13 @@ function updateAdvancedSettings(patch) {
2251
2289
  if (typeof patch.autoRenameBranch === "boolean") {
2252
2290
  advanced.autoRenameBranch = patch.autoRenameBranch;
2253
2291
  }
2292
+ if (patch.branchPrefix === null || patch.branchPrefix === "") {
2293
+ delete advanced.branchPrefix;
2294
+ } else if (typeof patch.branchPrefix === "string") {
2295
+ const prefix = sanitizeGitBranchPrefix(patch.branchPrefix);
2296
+ if (prefix) advanced.branchPrefix = prefix;
2297
+ else delete advanced.branchPrefix;
2298
+ }
2254
2299
  if (typeof patch.autoRunAfterSetup === "boolean") {
2255
2300
  advanced.autoRunAfterSetup = patch.autoRunAfterSetup;
2256
2301
  }
@@ -2311,6 +2356,9 @@ function updateAdvancedSettings(patch) {
2311
2356
  function autoRenameBranchEnabled(settings = loadAppSettings()) {
2312
2357
  return settings.advanced.autoRenameBranch !== false;
2313
2358
  }
2359
+ function gitBranchPrefixSetting(settings = loadAppSettings()) {
2360
+ return sanitizeGitBranchPrefix(settings.advanced.branchPrefix);
2361
+ }
2314
2362
  function autoRunAfterSetupEnabled(settings = loadAppSettings()) {
2315
2363
  return Boolean(settings.advanced.autoRunAfterSetup);
2316
2364
  }
@@ -2456,6 +2504,7 @@ var init_app_settings = __esm({
2456
2504
  init_paths();
2457
2505
  init_private_file();
2458
2506
  init_secret_vault();
2507
+ init_branch_prefix();
2459
2508
  init_issue_source_labels();
2460
2509
  init_account_profile();
2461
2510
  HARNESS_ENV_KEYS = {
@@ -4454,6 +4503,18 @@ var init_teams = __esm({
4454
4503
  });
4455
4504
 
4456
4505
  // src/git/worktree-labels.ts
4506
+ var worktree_labels_exports = {};
4507
+ __export(worktree_labels_exports, {
4508
+ branchDisplayLabel: () => branchDisplayLabel,
4509
+ isPlaceholderBranch: () => isPlaceholderBranch,
4510
+ normalizeWorktreePath: () => normalizeWorktreePath,
4511
+ threadDisplayLabel: () => threadDisplayLabel,
4512
+ ticketSlugForBranch: () => ticketSlugForBranch,
4513
+ worktreeDisplayLabel: () => worktreeDisplayLabel,
4514
+ worktreeDisplayLabelForGroup: () => worktreeDisplayLabelForGroup,
4515
+ worktreeNameFromPath: () => worktreeNameFromPath,
4516
+ worktreeSlugForTicket: () => worktreeSlugForTicket
4517
+ });
4457
4518
  function normalizeWorktreePath(worktreePath) {
4458
4519
  const trimmed = (worktreePath ?? "").replace(/\/+$/, "") || "/";
4459
4520
  const absolute = trimmed.startsWith("/");
@@ -7783,7 +7844,7 @@ var init_coordinator_prompt = __esm({
7783
7844
  "- get_diff \u2014 compact diff summary",
7784
7845
  "- 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` \u2014 do not poll for the human.",
7785
7846
  '- request_review \u2014 open a Review chat tab on a worktree thread (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.',
7786
- "- ask_git \u2014 commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge. When the worktree is clean, Sideboard pushes / opens the PR itself. When dirty, it steers the worktree agent \u2014 then wait_for_turn (loop while stillRunning). Prefer this over paraphrasing. If ask_git / get_thread lastError says the GraphQL/PR body is too long, the branch is already pushed \u2014 send_to_thread so the worktree agent runs `gh pr create --body-file` with a short description. Do not invent SSH or auth failures from that error. If the user gave a goal (Greptile 5/5, CI green), send_to_thread that goal so the worktree agent enters the watch-fix-push loop \u2014 do not tell the human to poll.",
7847
+ "- 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_thread that goal so the worktree agent enters the watch-fix-push loop \u2014 do not tell the human to poll.",
7787
7848
  '- Merge (`ask_git` action=merge / send_to_thread "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.',
7788
7849
  '- Or send_to_thread with those exact phrases: "Commit and push.", "Commit, push, and open a draft PR.", "Ready for review.", "Merge the remote branch (main) into your branch and resolve conflicts. Then, commit and push your changes.", "Merge PR." (draft PRs: `gh pr create --draft -R <origin-owner/name>` using the workspace `github:` slug \u2014 never upstream). Never run git/gh from this orchestration cwd, and never merge the PR yourself.',
7789
7850
  "Process guides:",
@@ -14176,87 +14237,6 @@ var init_spawn = __esm({
14176
14237
  }
14177
14238
  });
14178
14239
 
14179
- // src/land/pr-metadata.ts
14180
- function looksGeneric(title) {
14181
- const t = title.trim();
14182
- if (!t) return true;
14183
- if (t.length < 4) return true;
14184
- if (GENERIC_TITLE_RE.test(t)) return true;
14185
- if (!/[\s:/\-_]/.test(t) && t.length <= 24) return true;
14186
- return false;
14187
- }
14188
- function truncateTitle(title, max = 72) {
14189
- const t = title.trim().replace(/\s+/g, " ");
14190
- if (t.length <= max) return t;
14191
- return `${t.slice(0, max - 1).trimEnd()}\u2026`;
14192
- }
14193
- function titleFromPaths(paths) {
14194
- if (paths.length === 0) return null;
14195
- const top = paths.slice(0, 3).map((p) => p.replace(/\/$/, ""));
14196
- if (paths.length === 1) return truncateTitle(`Update ${top[0]}`);
14197
- if (paths.length <= 3) return truncateTitle(`Update ${top.join(", ")}`);
14198
- return truncateTitle(`Update ${top[0]} and ${paths.length - 1} more files`);
14199
- }
14200
- async function suggestPrMetadata(worktreePath, opts) {
14201
- const [{ stdout: logOut }, { stdout: nameStatus }, { stdout: statOut }] = await Promise.all([
14202
- git(["log", "--format=%s", `${opts.base}..HEAD`], worktreePath, {
14203
- reject: false
14204
- }),
14205
- git(["diff", "--name-only", `${opts.base}...HEAD`], worktreePath, {
14206
- reject: false
14207
- }),
14208
- git(["diff", "--stat", `${opts.base}...HEAD`], worktreePath, {
14209
- reject: false
14210
- })
14211
- ]);
14212
- const { stdout: dirtyNames } = await git(["diff", "--name-only", "HEAD"], worktreePath, {
14213
- reject: false
14214
- });
14215
- const { stdout: untracked } = await git(
14216
- ["ls-files", "--others", "--exclude-standard"],
14217
- worktreePath,
14218
- { reject: false }
14219
- );
14220
- const subjects = logOut.split("\n").map((s) => s.trim()).filter(Boolean);
14221
- const paths = [
14222
- ...new Set(
14223
- [...nameStatus.split("\n"), ...dirtyNames.split("\n"), ...untracked.split("\n")].map((p) => p.trim()).filter(Boolean)
14224
- )
14225
- ].sort((a, b) => a.localeCompare(b));
14226
- const meaningfulSubjects = subjects.filter((s) => !looksGeneric(s));
14227
- const fallback = opts.fallbackTitle?.trim() || null;
14228
- const fallbackOk = fallback && !looksGeneric(fallback) ? fallback : null;
14229
- const title = truncateTitle(
14230
- meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? "Sideboard changes"
14231
- );
14232
- const commitMessage = meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? `sideboard: ${title}`;
14233
- const summaryLines = meaningfulSubjects.length > 0 ? meaningfulSubjects.slice(0, 12).map((s) => `- ${s}`) : paths.slice(0, 20).map((p) => `- \`${p}\``);
14234
- const bodyParts = [
14235
- "## Summary",
14236
- summaryLines.length > 0 ? summaryLines.join("\n") : "- Changes landed via Sideboard.",
14237
- ""
14238
- ];
14239
- if (statOut.trim()) {
14240
- bodyParts.push("## Diff", "```", statOut.trim(), "```", "");
14241
- }
14242
- if (opts.sourceLabel) {
14243
- bodyParts.push(`_Landed via Sideboard from ${opts.sourceLabel}_`);
14244
- }
14245
- return {
14246
- title,
14247
- body: bodyParts.join("\n").trim() + "\n",
14248
- commitMessage: truncateTitle(commitMessage, 72)
14249
- };
14250
- }
14251
- var GENERIC_TITLE_RE;
14252
- var init_pr_metadata = __esm({
14253
- "src/land/pr-metadata.ts"() {
14254
- "use strict";
14255
- init_run();
14256
- GENERIC_TITLE_RE = /^(sideboard:|thread\/|wip\b|tmp\b|update\b|changes?\b|misc\b|stuff\b)/i;
14257
- }
14258
- });
14259
-
14260
14240
  // src/git/agent-git-actions.ts
14261
14241
  function agentGitPrompt(action, opts) {
14262
14242
  switch (action) {
@@ -14277,6 +14257,19 @@ function agentGitPrompt(action, opts) {
14277
14257
  return "Merge PR.";
14278
14258
  }
14279
14259
  }
14260
+ function resolveSidebarGitPrompt(action, opts) {
14261
+ if (action === "create-pr" || action === "create-draft" || action === "create-web") {
14262
+ const custom = opts?.createPr?.trim();
14263
+ if (custom) return custom;
14264
+ return agentGitPrompt(action === "create-pr" ? "create-draft" : action);
14265
+ }
14266
+ if (action === "resolve-conflicts") {
14267
+ const custom = opts?.resolveMergeConflicts?.trim();
14268
+ if (custom) return custom;
14269
+ return agentGitPrompt("resolve-conflicts", opts);
14270
+ }
14271
+ return agentGitPrompt(action, opts);
14272
+ }
14280
14273
  function gitActionExpansion(action, base) {
14281
14274
  switch (action) {
14282
14275
  case "commit-push":
@@ -19505,6 +19498,87 @@ var init_diff = __esm({
19505
19498
  }
19506
19499
  });
19507
19500
 
19501
+ // src/land/pr-metadata.ts
19502
+ function looksGeneric(title) {
19503
+ const t = title.trim();
19504
+ if (!t) return true;
19505
+ if (t.length < 4) return true;
19506
+ if (GENERIC_TITLE_RE.test(t)) return true;
19507
+ if (!/[\s:/\-_]/.test(t) && t.length <= 24) return true;
19508
+ return false;
19509
+ }
19510
+ function truncateTitle(title, max = 72) {
19511
+ const t = title.trim().replace(/\s+/g, " ");
19512
+ if (t.length <= max) return t;
19513
+ return `${t.slice(0, max - 1).trimEnd()}\u2026`;
19514
+ }
19515
+ function titleFromPaths(paths) {
19516
+ if (paths.length === 0) return null;
19517
+ const top = paths.slice(0, 3).map((p) => p.replace(/\/$/, ""));
19518
+ if (paths.length === 1) return truncateTitle(`Update ${top[0]}`);
19519
+ if (paths.length <= 3) return truncateTitle(`Update ${top.join(", ")}`);
19520
+ return truncateTitle(`Update ${top[0]} and ${paths.length - 1} more files`);
19521
+ }
19522
+ async function suggestPrMetadata(worktreePath, opts) {
19523
+ const [{ stdout: logOut }, { stdout: nameStatus }, { stdout: statOut }] = await Promise.all([
19524
+ git(["log", "--format=%s", `${opts.base}..HEAD`], worktreePath, {
19525
+ reject: false
19526
+ }),
19527
+ git(["diff", "--name-only", `${opts.base}...HEAD`], worktreePath, {
19528
+ reject: false
19529
+ }),
19530
+ git(["diff", "--stat", `${opts.base}...HEAD`], worktreePath, {
19531
+ reject: false
19532
+ })
19533
+ ]);
19534
+ const { stdout: dirtyNames } = await git(["diff", "--name-only", "HEAD"], worktreePath, {
19535
+ reject: false
19536
+ });
19537
+ const { stdout: untracked } = await git(
19538
+ ["ls-files", "--others", "--exclude-standard"],
19539
+ worktreePath,
19540
+ { reject: false }
19541
+ );
19542
+ const subjects = logOut.split("\n").map((s) => s.trim()).filter(Boolean);
19543
+ const paths = [
19544
+ ...new Set(
19545
+ [...nameStatus.split("\n"), ...dirtyNames.split("\n"), ...untracked.split("\n")].map((p) => p.trim()).filter(Boolean)
19546
+ )
19547
+ ].sort((a, b) => a.localeCompare(b));
19548
+ const meaningfulSubjects = subjects.filter((s) => !looksGeneric(s));
19549
+ const fallback = opts.fallbackTitle?.trim() || null;
19550
+ const fallbackOk = fallback && !looksGeneric(fallback) ? fallback : null;
19551
+ const title = truncateTitle(
19552
+ meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? "Sideboard changes"
19553
+ );
19554
+ const commitMessage = meaningfulSubjects[0] ?? fallbackOk ?? titleFromPaths(paths) ?? `sideboard: ${title}`;
19555
+ const summaryLines = meaningfulSubjects.length > 0 ? meaningfulSubjects.slice(0, 12).map((s) => `- ${s}`) : paths.slice(0, 20).map((p) => `- \`${p}\``);
19556
+ const bodyParts = [
19557
+ "## Summary",
19558
+ summaryLines.length > 0 ? summaryLines.join("\n") : "- Changes landed via Sideboard.",
19559
+ ""
19560
+ ];
19561
+ if (statOut.trim()) {
19562
+ bodyParts.push("## Diff", "```", statOut.trim(), "```", "");
19563
+ }
19564
+ if (opts.sourceLabel) {
19565
+ bodyParts.push(`_Landed via Sideboard from ${opts.sourceLabel}_`);
19566
+ }
19567
+ return {
19568
+ title,
19569
+ body: bodyParts.join("\n").trim() + "\n",
19570
+ commitMessage: truncateTitle(commitMessage, 72)
19571
+ };
19572
+ }
19573
+ var GENERIC_TITLE_RE;
19574
+ var init_pr_metadata = __esm({
19575
+ "src/land/pr-metadata.ts"() {
19576
+ "use strict";
19577
+ init_run();
19578
+ GENERIC_TITLE_RE = /^(sideboard:|thread\/|wip\b|tmp\b|update\b|changes?\b|misc\b|stuff\b)/i;
19579
+ }
19580
+ });
19581
+
19508
19582
  // src/land/land.ts
19509
19583
  async function previewLand(thread) {
19510
19584
  if (thread.sourceIsFork) {
@@ -20035,13 +20109,14 @@ function formatRenameBranchDirective(thread, opts) {
20035
20109
  if (!isPlaceholderBranch(thread.branchName, thread.worktreePath)) return null;
20036
20110
  const dir = worktreeNameFromPath(thread.worktreePath);
20037
20111
  const ticket = thread.sourceType === "ticket" ? ticketSlugForBranch(thread.sourceRef ?? "") : null;
20038
- const example = ticket ? `\`feat/${ticket}-dark-mode\` or \`fix/${ticket}-panel-width\`` : "`fix/panel-width` or `feat/dark-mode`";
20112
+ const prefix = sanitizeGitBranchPrefix(opts?.branchPrefix);
20113
+ const example = examplePrefixedBranch(prefix, ticket);
20114
+ const shape = prefix ? `\`${prefix}/<ticket-or-task>-<short-kebab-description>\`` : "`<ticket-or-task>-<short-kebab-description>`";
20039
20115
  const lines = [
20040
20116
  "Branch naming (do this early in the turn):",
20041
20117
  `- Current branch \`${thread.branchName}\` is a temporary placeholder. The worktree folder \`${dir}\` is a stable nickname \u2014 do not rename or leave that directory.`,
20042
- `- Rename the git branch to a short kebab-case name that describes this task (what you are changing), e.g. ${example}:`,
20118
+ `- Rename the git branch to ${shape}, e.g. \`${example}\`:`,
20043
20119
  " `git branch -m <new-name>`",
20044
- "- Prefer Conventional Commits style prefixes when they fit (`fix/`, `feat/`, `chore/`, `docs/`).",
20045
20120
  ...ticket ? [
20046
20121
  `- Keep ticket \`${ticket}\` in the new branch name so the issue stays findable.`
20047
20122
  ] : [],
@@ -20247,6 +20322,7 @@ var init_instructions = __esm({
20247
20322
  import_node_fs50 = require("fs");
20248
20323
  import_node_path47 = require("path");
20249
20324
  init_git_auth_mode();
20325
+ init_branch_prefix();
20250
20326
  init_worktree_labels();
20251
20327
  init_detached_job_path();
20252
20328
  PR_GOAL_RE = /greptile|\bci\b.*\b(green|pass)|checks?\s+(pass|green)|until\s+.*\b(pass|green|merge|clean)|\bfix ci\b|watch[- ]fix[- ]push/i;
@@ -20709,6 +20785,64 @@ var init_sync_branch = __esm({
20709
20785
  }
20710
20786
  });
20711
20787
 
20788
+ // src/integrations/github.ts
20789
+ var github_exports = {};
20790
+ __export(github_exports, {
20791
+ getGitHubStatus: () => getGitHubStatus,
20792
+ refreshGitHubAuth: () => refreshGitHubAuth
20793
+ });
20794
+ async function getGitHubStatus() {
20795
+ const which = await run("which", ["gh"], { reject: false });
20796
+ if (which.exitCode !== 0 || !which.stdout.trim()) {
20797
+ return {
20798
+ connected: false,
20799
+ login: null,
20800
+ hosts: [],
20801
+ reason: "gh CLI not found on PATH"
20802
+ };
20803
+ }
20804
+ const loginResult = await run(
20805
+ "gh",
20806
+ ["api", "user", "--jq", ".login"],
20807
+ { reject: false }
20808
+ );
20809
+ if (loginResult.exitCode === 0 && loginResult.stdout.trim()) {
20810
+ return {
20811
+ connected: true,
20812
+ login: loginResult.stdout.trim(),
20813
+ hosts: ["github.com"],
20814
+ reason: null
20815
+ };
20816
+ }
20817
+ const status = await run("gh", ["auth", "status"], { reject: false });
20818
+ const text7 = `${status.stdout}
20819
+ ${status.stderr}`;
20820
+ const loginMatch = text7.match(/Logged in to ([^\s]+) account (\S+)/i) ?? text7.match(/Logged in to ([^\s]+) as (\S+)/i);
20821
+ if (loginMatch) {
20822
+ return {
20823
+ connected: true,
20824
+ login: loginMatch[2].replace(/['"]/g, ""),
20825
+ hosts: [loginMatch[1]],
20826
+ reason: null
20827
+ };
20828
+ }
20829
+ return {
20830
+ connected: false,
20831
+ login: null,
20832
+ hosts: [],
20833
+ reason: status.stderr.trim() || status.stdout.trim() || "Not logged in to GitHub (run: gh auth login)"
20834
+ };
20835
+ }
20836
+ async function refreshGitHubAuth() {
20837
+ return getGitHubStatus();
20838
+ }
20839
+ var init_github = __esm({
20840
+ "src/integrations/github.ts"() {
20841
+ "use strict";
20842
+ init_run();
20843
+ }
20844
+ });
20845
+
20712
20846
  // src/agents/cursor-store.ts
20713
20847
  function cursorSdkStoreDir(threadId) {
20714
20848
  const root = (0, import_node_path49.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
@@ -20948,7 +21082,6 @@ var init_orchestrator = __esm({
20948
21082
  init_spawn();
20949
21083
  init_agents();
20950
21084
  init_worktree();
20951
- init_pr_metadata();
20952
21085
  init_stack();
20953
21086
  init_agent_git_actions();
20954
21087
  init_pr_merge_archive();
@@ -21736,7 +21869,7 @@ var init_orchestrator = __esm({
21736
21869
  }
21737
21870
  const isBrightsy = fresh.agent === "brightsy";
21738
21871
  const isOrchestration = isOrchestratorThread(fresh);
21739
- const { autoRenameBranchEnabled: autoRenameBranchEnabled2, getGithubGitAuthMode: getGithubGitAuthMode2 } = await Promise.resolve().then(() => (init_app_settings(), app_settings_exports));
21872
+ const { autoRenameBranchEnabled: autoRenameBranchEnabled2, getGithubGitAuthMode: getGithubGitAuthMode2, gitBranchPrefixSetting: gitBranchPrefixSetting2 } = await Promise.resolve().then(() => (init_app_settings(), app_settings_exports));
21740
21873
  const gitAuthMode = getGithubGitAuthMode2();
21741
21874
  const worktreeDirective = isBrightsy || isOrchestration ? null : formatWorktreeDirective(fresh, {
21742
21875
  githubSlug: await resolveGithubRepoSlug(fresh.worktreePath).catch(
@@ -21772,9 +21905,26 @@ var init_orchestrator = __esm({
21772
21905
  }
21773
21906
  }
21774
21907
  const settings = loadWorkspaceSettings(fresh.worktreePath, fresh.repoPath);
21775
- const renameBranchDirective = !isBrightsy && !isOrchestration && autoRenameBranchEnabled2() ? formatRenameBranchDirective(fresh, {
21776
- customPrompt: settings?.prompts?.renameBranch
21777
- }) : null;
21908
+ let renameBranchDirective = null;
21909
+ if (!isBrightsy && !isOrchestration && autoRenameBranchEnabled2()) {
21910
+ const { isPlaceholderBranch: isPlaceholderBranch2 } = await Promise.resolve().then(() => (init_worktree_labels(), worktree_labels_exports));
21911
+ let githubLogin = null;
21912
+ if (isPlaceholderBranch2(fresh.branchName, fresh.worktreePath) && !gitBranchPrefixSetting2()) {
21913
+ try {
21914
+ const { getGitHubStatus: getGitHubStatus2 } = await Promise.resolve().then(() => (init_github(), github_exports));
21915
+ githubLogin = (await getGitHubStatus2()).login;
21916
+ } catch {
21917
+ }
21918
+ }
21919
+ const { resolveGitBranchPrefix: resolveGitBranchPrefix2 } = await Promise.resolve().then(() => (init_branch_prefix(), branch_prefix_exports));
21920
+ renameBranchDirective = formatRenameBranchDirective(fresh, {
21921
+ customPrompt: settings?.prompts?.renameBranch,
21922
+ branchPrefix: resolveGitBranchPrefix2({
21923
+ setting: gitBranchPrefixSetting2(),
21924
+ githubLogin
21925
+ })
21926
+ });
21927
+ }
21778
21928
  let seed = null;
21779
21929
  if (!fresh.sessionId) {
21780
21930
  const prior = fresh.messages.slice(0, -1);
@@ -22804,9 +22954,9 @@ var init_orchestrator = __esm({
22804
22954
  return tab;
22805
22955
  }
22806
22956
  /**
22807
- * Desktop git buttons + MCP `ask_git`.
22808
- * When the worktree is clean, push / open the PR here (HTTPS via `gh` if SSH
22809
- * is missing). When dirty, steer the worktree agent to commit first.
22957
+ * Desktop git buttons + MCP `ask_git`. Always queues the worktree agent
22958
+ * with the action prompt (same path as Resolve). Repository `[prompts]`
22959
+ * overrides apply when set.
22810
22960
  */
22811
22961
  async askGit(threadRef, action) {
22812
22962
  if (!AGENT_GIT_ACTIONS.includes(action)) {
@@ -22824,17 +22974,6 @@ var init_orchestrator = __esm({
22824
22974
  "No pull request linked. Ask the worktree agent to open a draft PR first (ask_git create-draft)."
22825
22975
  );
22826
22976
  }
22827
- if ((action === "commit-push" || action === "create-draft" || action === "create-web") && thread.worktreePath?.trim() && !await isDirty(thread.worktreePath)) {
22828
- try {
22829
- await this.pushAndMaybeOpenPr(thread, action);
22830
- } catch (err) {
22831
- const message = err instanceof Error ? err.message : String(err);
22832
- updateThread(thread.id, { lastError: message });
22833
- this.emit({ type: "error", threadId: thread.id, message });
22834
- throw err;
22835
- }
22836
- return this.requireThread(threadRef);
22837
- }
22838
22977
  let prBase;
22839
22978
  if (action === "resolve-conflicts") {
22840
22979
  try {
@@ -22843,42 +22982,18 @@ var init_orchestrator = __esm({
22843
22982
  } catch {
22844
22983
  }
22845
22984
  }
22846
- return this.send(threadRef, agentGitPrompt(action, { prBase }), {
22847
- followUp: resolveOrchChildFollowUp()
22848
- });
22849
- }
22850
- /** Push origin (gh HTTPS fallback) and create/update the PR when requested. */
22851
- async pushAndMaybeOpenPr(thread, action) {
22852
- const cwd = thread.worktreePath;
22853
- const branch = await currentBranch(cwd);
22854
- await pushBranch(cwd, branch);
22855
- if (action === "commit-push") return;
22856
- const base = await resolveDefaultBranch(thread.repoPath);
22857
- const meta = await suggestPrMetadata(cwd, {
22858
- base,
22859
- fallbackTitle: thread.prTitle ?? thread.title
22860
- });
22861
- const url = await createOrUpdatePr(cwd, {
22862
- title: meta.title,
22863
- body: meta.body,
22864
- base,
22865
- head: branch,
22866
- draft: action === "create-draft",
22867
- web: action === "create-web"
22868
- });
22869
- if (!url) return;
22870
- const patch = {
22871
- prUrl: url,
22872
- prTitle: meta.title,
22873
- prIsDraft: action === "create-draft"
22874
- };
22875
- try {
22876
- const fetched = await getPrMeta(cwd, url);
22877
- if (fetched?.title) patch.prTitle = fetched.title;
22878
- if (fetched) patch.prIsDraft = Boolean(fetched.isDraft);
22879
- } catch {
22880
- }
22881
- updateThread(thread.id, patch);
22985
+ const settings = loadWorkspaceSettings(thread.worktreePath, thread.repoPath);
22986
+ return this.send(
22987
+ threadRef,
22988
+ resolveSidebarGitPrompt(action, {
22989
+ prBase,
22990
+ createPr: settings?.prompts?.createPr,
22991
+ resolveMergeConflicts: settings?.prompts?.resolveMergeConflicts
22992
+ }),
22993
+ {
22994
+ followUp: resolveOrchChildFollowUp()
22995
+ }
22996
+ );
22882
22997
  }
22883
22998
  setThreadOptions(threadRef, patch) {
22884
22999
  const thread = this.requireThread(threadRef);
@@ -23494,6 +23609,7 @@ __export(index_exports, {
23494
23609
  estimateMessageChars: () => estimateMessageChars,
23495
23610
  estimateOccupancyTokens: () => estimateOccupancyTokens,
23496
23611
  estimateThreadChars: () => estimateThreadChars,
23612
+ examplePrefixedBranch: () => examplePrefixedBranch,
23497
23613
  expandComposerPrompt: () => expandComposerPrompt,
23498
23614
  extractBrightsyContextSummary: () => extractBrightsyContextSummary,
23499
23615
  extractGhErrorDetail: () => extractGhErrorDetail,
@@ -23606,6 +23722,7 @@ __export(index_exports, {
23606
23722
  ghHeadRef: () => ghHeadRef,
23607
23723
  ghRepoSelectArgs: () => ghRepoSelectArgs,
23608
23724
  git: () => git,
23725
+ gitBranchPrefixSetting: () => gitBranchPrefixSetting,
23609
23726
  githubAgentGitEnv: () => githubAgentGitEnv,
23610
23727
  githubHttpsInsteadOfEntries: () => githubHttpsInsteadOfEntries,
23611
23728
  githubRelationEditFlag: () => githubRelationEditFlag,
@@ -23854,6 +23971,7 @@ __export(index_exports, {
23854
23971
  resolveEffectiveIssueSource: () => resolveEffectiveIssueSource,
23855
23972
  resolveFilesToCopy: () => resolveFilesToCopy,
23856
23973
  resolveGhAuthToken: () => resolveGhAuthToken,
23974
+ resolveGitBranchPrefix: () => resolveGitBranchPrefix,
23857
23975
  resolveGitDirsForLockRecovery: () => resolveGitDirsForLockRecovery,
23858
23976
  resolveGitHubIssueRepo: () => resolveGitHubIssueRepo,
23859
23977
  resolveGithubAgentToken: () => resolveGithubAgentToken,
@@ -23876,6 +23994,7 @@ __export(index_exports, {
23876
23994
  resolveReviewGuidelines: () => resolveReviewGuidelines,
23877
23995
  resolveScheduleThreadId: () => resolveScheduleThreadId,
23878
23996
  resolveSendFollowUp: () => resolveSendFollowUp,
23997
+ resolveSidebarGitPrompt: () => resolveSidebarGitPrompt,
23879
23998
  resolveSlackListenMode: () => resolveSlackListenMode,
23880
23999
  resolveThreadDefaults: () => resolveThreadDefaults,
23881
24000
  resolveThreadEffort: () => resolveThreadEffort,
@@ -23895,6 +24014,7 @@ __export(index_exports, {
23895
24014
  runSlackRelayClient: () => runSlackRelayClient,
23896
24015
  runWorkspaceSetup: () => runWorkspaceSetup,
23897
24016
  sameWorktreePath: () => sameWorktreePath,
24017
+ sanitizeGitBranchPrefix: () => sanitizeGitBranchPrefix,
23898
24018
  sanitizeMcpServerName: () => sanitizeMcpServerName,
23899
24019
  saveAbleTimeConnection: () => saveAbleTimeConnection,
23900
24020
  saveAppSettings: () => saveAppSettings,
@@ -24040,55 +24160,9 @@ init_gh_errors();
24040
24160
  init_git_auth_mode();
24041
24161
  init_worktree();
24042
24162
  init_stack();
24163
+ init_branch_prefix();
24043
24164
  init_agent_git_actions();
24044
-
24045
- // src/integrations/github.ts
24046
- init_run();
24047
- async function getGitHubStatus() {
24048
- const which = await run("which", ["gh"], { reject: false });
24049
- if (which.exitCode !== 0 || !which.stdout.trim()) {
24050
- return {
24051
- connected: false,
24052
- login: null,
24053
- hosts: [],
24054
- reason: "gh CLI not found on PATH"
24055
- };
24056
- }
24057
- const loginResult = await run(
24058
- "gh",
24059
- ["api", "user", "--jq", ".login"],
24060
- { reject: false }
24061
- );
24062
- if (loginResult.exitCode === 0 && loginResult.stdout.trim()) {
24063
- return {
24064
- connected: true,
24065
- login: loginResult.stdout.trim(),
24066
- hosts: ["github.com"],
24067
- reason: null
24068
- };
24069
- }
24070
- const status = await run("gh", ["auth", "status"], { reject: false });
24071
- const text7 = `${status.stdout}
24072
- ${status.stderr}`;
24073
- const loginMatch = text7.match(/Logged in to ([^\s]+) account (\S+)/i) ?? text7.match(/Logged in to ([^\s]+) as (\S+)/i);
24074
- if (loginMatch) {
24075
- return {
24076
- connected: true,
24077
- login: loginMatch[2].replace(/['"]/g, ""),
24078
- hosts: [loginMatch[1]],
24079
- reason: null
24080
- };
24081
- }
24082
- return {
24083
- connected: false,
24084
- login: null,
24085
- hosts: [],
24086
- reason: status.stderr.trim() || status.stdout.trim() || "Not logged in to GitHub (run: gh auth login)"
24087
- };
24088
- }
24089
- async function refreshGitHubAuth() {
24090
- return getGitHubStatus();
24091
- }
24165
+ init_github();
24092
24166
 
24093
24167
  // src/integrations/linear.ts
24094
24168
  init_fetch();
@@ -28366,6 +28440,7 @@ async function getHomeBoardInputs(workspaces, opts) {
28366
28440
 
28367
28441
  // src/mcp/server.ts
28368
28442
  init_home_board();
28443
+ init_github();
28369
28444
 
28370
28445
  // src/mcp/create-thread-agent.ts
28371
28446
  init_cursor();
@@ -29183,7 +29258,7 @@ async function startMcpServer() {
29183
29258
  );
29184
29259
  server.tool(
29185
29260
  "ask_git",
29186
- "Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same actions as the desktop git buttons. When the worktree is clean, Sideboard pushes / opens the PR itself (HTTPS via `gh` even when origin is SSH / Settings \u2192 Git is SSH). When dirty, steers the worktree agent to commit (Settings \u2192 Follow-up, default interrupt now); 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 (Greptile 5/5, CI green). 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. If this tool errors that the GraphQL/PR body is too long, the branch is already pushed \u2014 have the worktree agent retry `gh pr create --body-file` with a short description (GitHub limit 65,536 characters). Do not invent SSH/auth failures from that error.",
29261
+ "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 (Greptile 5/5, CI green). 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.",
29187
29262
  {
29188
29263
  ref: import_zod9.z.string().describe("Worktree thread id/ref"),
29189
29264
  action: import_zod9.z.enum(AGENT_GIT_ACTIONS).describe(
@@ -32104,6 +32179,7 @@ init_outbound_watch();
32104
32179
  estimateMessageChars,
32105
32180
  estimateOccupancyTokens,
32106
32181
  estimateThreadChars,
32182
+ examplePrefixedBranch,
32107
32183
  expandComposerPrompt,
32108
32184
  extractBrightsyContextSummary,
32109
32185
  extractGhErrorDetail,
@@ -32216,6 +32292,7 @@ init_outbound_watch();
32216
32292
  ghHeadRef,
32217
32293
  ghRepoSelectArgs,
32218
32294
  git,
32295
+ gitBranchPrefixSetting,
32219
32296
  githubAgentGitEnv,
32220
32297
  githubHttpsInsteadOfEntries,
32221
32298
  githubRelationEditFlag,
@@ -32464,6 +32541,7 @@ init_outbound_watch();
32464
32541
  resolveEffectiveIssueSource,
32465
32542
  resolveFilesToCopy,
32466
32543
  resolveGhAuthToken,
32544
+ resolveGitBranchPrefix,
32467
32545
  resolveGitDirsForLockRecovery,
32468
32546
  resolveGitHubIssueRepo,
32469
32547
  resolveGithubAgentToken,
@@ -32486,6 +32564,7 @@ init_outbound_watch();
32486
32564
  resolveReviewGuidelines,
32487
32565
  resolveScheduleThreadId,
32488
32566
  resolveSendFollowUp,
32567
+ resolveSidebarGitPrompt,
32489
32568
  resolveSlackListenMode,
32490
32569
  resolveThreadDefaults,
32491
32570
  resolveThreadEffort,
@@ -32505,6 +32584,7 @@ init_outbound_watch();
32505
32584
  runSlackRelayClient,
32506
32585
  runWorkspaceSetup,
32507
32586
  sameWorktreePath,
32587
+ sanitizeGitBranchPrefix,
32508
32588
  sanitizeMcpServerName,
32509
32589
  saveAbleTimeConnection,
32510
32590
  saveAppSettings,