@sideboard-ai/core 0.1.151 → 0.1.152

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 (27) hide show
  1. package/dist/{agents-JAOMXDXN.js → agents-CUKWIM34.js} +3 -3
  2. package/dist/{agents-U2JCFXW4.js → agents-VHXCBBBD.js} +3 -3
  3. package/dist/{chunk-77MP647F.js → chunk-2U6QF3PT.js} +6 -5
  4. package/dist/{chunk-TSCWSAQL.js → chunk-67TIJ7S5.js} +1 -1
  5. package/dist/{chunk-6H4TJ5TA.js → chunk-6X7Z34XE.js} +95 -50
  6. package/dist/{chunk-GCWAAPJ5.js → chunk-7BQNSUR2.js} +86 -65
  7. package/dist/{chunk-OXOU2FRS.js → chunk-7TIUOYBK.js} +6 -5
  8. package/dist/{chunk-LZAOX76N.js → chunk-EY6QXPPO.js} +2 -2
  9. package/dist/{chunk-ADCEGG4A.js → chunk-G4MTYUWS.js} +1 -1
  10. package/dist/{chunk-UIS7BVCX.js → chunk-GFQ57XAX.js} +2 -2
  11. package/dist/{chunk-HWZWBJWL.js → chunk-K2ANSHUO.js} +1 -1
  12. package/dist/{chunk-Y2FNDKHF.js → chunk-SN6CMKF6.js} +1 -1
  13. package/dist/{coordinator-prompt-ZK5MII7W.js → coordinator-prompt-TBX4MOFM.js} +1 -1
  14. package/dist/{coordinator-prompt-LWYUZAXR.js → coordinator-prompt-WGFRYCHE.js} +1 -1
  15. package/dist/{global-workspace-T7RL3XEC.js → global-workspace-BHLUJ46D.js} +2 -2
  16. package/dist/{global-workspace-IB2CCEJF.js → global-workspace-IY5QAV5C.js} +2 -2
  17. package/dist/index.cjs +112 -47
  18. package/dist/index.d.cts +34 -20
  19. package/dist/index.d.ts +34 -20
  20. package/dist/index.js +29 -7
  21. package/dist/mcp/run-stdio.cjs +101 -63
  22. package/dist/mcp/run-stdio.js +23 -7
  23. package/dist/{orchestrator-Y5MWUU7C.js → orchestrator-256DFPSX.js} +5 -5
  24. package/dist/{orchestrator-DPTRBKEH.js → orchestrator-NUA6SEV7.js} +5 -5
  25. package/dist/{workspaces-ZXCUVCZC.js → workspaces-4FSXVIZM.js} +3 -3
  26. package/dist/{workspaces-VICQYI2N.js → workspaces-NECIQTAO.js} +3 -3
  27. package/package.json +1 -1
@@ -36,7 +36,7 @@ import {
36
36
  resolveQuotaFallbackAgent,
37
37
  turnCostUsdFromCursorUsage,
38
38
  whichOnPath
39
- } from "./chunk-LZAOX76N.js";
39
+ } from "./chunk-EY6QXPPO.js";
40
40
  import "./chunk-G7SIQFBQ.js";
41
41
  import "./chunk-S42XV45P.js";
42
42
  import {
@@ -44,9 +44,9 @@ import {
44
44
  assertOrchestratorCapableAgent,
45
45
  coerceOrchestratorAgent,
46
46
  isOrchestratorCapableAgent
47
- } from "./chunk-Y2FNDKHF.js";
47
+ } from "./chunk-SN6CMKF6.js";
48
48
  import "./chunk-6GN5WPYZ.js";
49
- import "./chunk-OXOU2FRS.js";
49
+ import "./chunk-7TIUOYBK.js";
50
50
  import "./chunk-3JBMACYX.js";
51
51
  import "./chunk-NVXVEGGM.js";
52
52
  import "./chunk-EUXOHTUK.js";
@@ -30,7 +30,7 @@ import {
30
30
  resolveLoginCommand,
31
31
  resolveQuotaFallbackAgent,
32
32
  whichOnPath
33
- } from "./chunk-UIS7BVCX.js";
33
+ } from "./chunk-GFQ57XAX.js";
34
34
  import "./chunk-7F4XE6UG.js";
35
35
  import "./chunk-M267JPEA.js";
36
36
  import {
@@ -38,8 +38,8 @@ import {
38
38
  assertOrchestratorCapableAgent,
39
39
  coerceOrchestratorAgent,
40
40
  isOrchestratorCapableAgent
41
- } from "./chunk-ADCEGG4A.js";
42
- import "./chunk-77MP647F.js";
41
+ } from "./chunk-G4MTYUWS.js";
42
+ import "./chunk-2U6QF3PT.js";
43
43
  import "./chunk-GE7M3QTE.js";
44
44
  import "./chunk-JRH62XC4.js";
45
45
  import "./chunk-ELBYOGVA.js";
@@ -73,15 +73,16 @@ var COORDINATOR_TOOL_PLAYBOOK = [
73
73
  "- list_run_scripts / run_dev_script / stop_dev_script \u2014 start/stop named run scripts",
74
74
  "Inspect / review / PRs:",
75
75
  "- get_diff \u2014 compact diff summary",
76
- '- request_review \u2014 open a Review chat tab on a worktree thread (attaches .claude/skills/review/SKILL.md when present, else seeds that skill / local guidelines; sends "Review changes in this workspace."); then wait_for_turn (loop while stillRunning) / get_turn_result on the returned id',
77
- "- ask_git \u2014 commit & push, open a draft PR, resolve conflicts, or merge. When the worktree is clean, Sideboard pushes / opens the PR itself. When dirty, it queues 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.",
76
+ "- 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.",
77
+ '- 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',
78
+ "- ask_git \u2014 commit & push, open a draft PR, resolve conflicts, or merge. When the worktree is clean, Sideboard pushes / opens the PR itself. When dirty, it queues 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.",
78
79
  '- 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.',
79
80
  '- Or send_to_thread with those exact phrases: "Commit and push.", "Commit, push, and open a draft PR.", "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.',
80
81
  "Process guides:",
81
82
  "- Long child jobs (pack, test, deploy, anything that may run more than ~30s): workers always have `/long-running` (Sideboard product skill). Tell them to detach and wait; do not ask the human to poll.",
82
83
  "- Recurring multi-item / fan-out: if the child worktree has `.claude/skills/graph-engineering/SKILL.md`, tell the worker to follow it (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch three threads.",
83
- "- Recurring shapes: have the worktree agent write `.claude/skills/<kebab-name>/SKILL.md` (commit it) so later threads and native Claude Code / attach see it. Merge-review sentences go in `.claude/skills/review/SKILL.md` (create it \u2014 that is allowed). Do not use `.sideboard/skills/` (that folder only). Codex/OpenCode: one line in AGENTS.md pointing at that file.",
84
- "- One-offs: no guide. Same miss across threads: edit the skill or `.claude/skills/review/SKILL.md`, then rerun the batch \u2014 do not patch three threads.",
84
+ "- Recurring shapes: have the worktree agent write `.claude/skills/<kebab-name>/SKILL.md` (commit it) so later threads and native Claude Code / attach see it. Merge-review sentences go in `.claude/skills/review/SKILL.md` when that skill already exists; otherwise `.context/review.md` (do not create a review skill). Do not use `.sideboard/skills/` (that folder only). Codex/OpenCode: one line in AGENTS.md pointing at that file.",
85
+ "- One-offs: no guide. Same miss across threads: edit the existing skill or `.context/review.md`, then rerun the batch \u2014 do not patch three threads.",
85
86
  "Human-only (do not attempt): ready-for-review land (confirm_land), purge_thread.",
86
87
  "Thread links in replies: when mentioning a chat/thread for the user, include a markdown link `[Title](sideboard://thread/<id>)` using the full id (or the link field from create_thread / list_threads). Sideboard renders these as clickable opens.",
87
88
  "Bash / Read / etc: allowed for (1) inspecting target worktrees / registered repo paths from MCP, and (2) greenfield setup under ~/sideboard/repos (git clone, gh repo create, git init+remote). Never git init/clone *inside* this synthetic home cwd \u2014 emptiness here is expected, not a bug."
@@ -160,7 +161,7 @@ function ensureGlobalCoordinatorCwd(opts) {
160
161
  "Typical flow (Home board): list_board \u2192 create_thread (sourceType=ticket|pr|branch) \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft \u2192 wait_for_turn. Merge only if the user explicitly asked (`ask_git` merge).",
161
162
  "Typical flow (branch / explicit source): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
162
163
  "Typical flow (new app): Bash create/clone under repos dir \u2192 add_workspace \u2192 create_thread \u2192 send_to_thread (implement) \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
163
- "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_thread`). Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
164
+ "Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_thread`). 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."
164
165
  ].join("\n");
165
166
  try {
166
167
  writeFileSync(join(dir, "CLAUDE.md"), `${body}
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  isGlobalRepoPath
5
- } from "./chunk-Y2FNDKHF.js";
5
+ } from "./chunk-SN6CMKF6.js";
6
6
  import {
7
7
  ensureGhPreferOrigin,
8
8
  resolveRepoRoot
@@ -24,13 +24,13 @@ import {
24
24
  stripBrightsyNdjsonNoise,
25
25
  sumUsageList,
26
26
  toolDescription
27
- } from "./chunk-UIS7BVCX.js";
27
+ } from "./chunk-GFQ57XAX.js";
28
28
  import {
29
29
  addWorkspace,
30
30
  ensureWorkspace,
31
31
  removeWorkspace,
32
32
  syncWorkspacesFromThreads
33
- } from "./chunk-HWZWBJWL.js";
33
+ } from "./chunk-K2ANSHUO.js";
34
34
  import {
35
35
  assertOrchestratorCapableAgent,
36
36
  attachmentsFromWorktreePaths,
@@ -47,14 +47,14 @@ import {
47
47
  persistPendingFileAttachments,
48
48
  stageAbsolutePathsAsAttachments,
49
49
  stageBuffersAsAttachments
50
- } from "./chunk-ADCEGG4A.js";
50
+ } from "./chunk-G4MTYUWS.js";
51
51
  import {
52
52
  SLACK_REPLY_FORMATTING,
53
53
  coordinatorSystemPrompt,
54
54
  coordinatorTurnReminder,
55
55
  enrichWorkspacesWithGithub,
56
56
  ensureGlobalCoordinatorCwd
57
- } from "./chunk-77MP647F.js";
57
+ } from "./chunk-2U6QF3PT.js";
58
58
  import {
59
59
  addPrStackLayer,
60
60
  allocateTeamName,
@@ -460,7 +460,7 @@ async function continueSourceThread(threadId, prompt) {
460
460
  await continueOnReply(threadId, prompt);
461
461
  return;
462
462
  }
463
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-DPTRBKEH.js");
463
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-NUA6SEV7.js");
464
464
  await getOrchestrator2().send(threadId, prompt);
465
465
  } catch {
466
466
  }
@@ -740,9 +740,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
740
740
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
741
741
  );
742
742
  }
743
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-IB2CCEJF.js");
743
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-IY5QAV5C.js");
744
744
  if (isGlobalThread2(thread)) {
745
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-LWYUZAXR.js");
745
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-WGFRYCHE.js");
746
746
  ensureGlobalCoordinatorCwd2(
747
747
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
748
748
  );
@@ -1619,7 +1619,7 @@ File: src/client/frontends/desktop/core/UserData.ts
1619
1619
 
1620
1620
  ## Growing the rules
1621
1621
 
1622
- If a blocking issue is a missing or ambiguous repo rule that will recur, add one sentence to \`.claude/skills/review/SKILL.md\` (create the skill if it is missing \u2014 that is allowed and should be committed). Do not only patch this diff when the same miss will happen again. Do not write new skills under \`.sideboard/skills/\`. Do not use \`.sideboard/review.md\` for new notes.
1622
+ If a blocking issue is a missing or ambiguous repo rule that will recur, add one sentence to \`.claude/skills/review/SKILL.md\` when that skill already exists. Otherwise write it to \`.context/review.md\` (do not create a review skill). Do not only patch this diff when the same miss will happen again. Do not write new skills under \`.sideboard/skills/\`.
1623
1623
  `;
1624
1624
  var REVIEW_SKILL_PATH = ".claude/skills/review/SKILL.md";
1625
1625
  var REVIEW_SKILL_NAME = "review";
@@ -1645,6 +1645,7 @@ function wrapReviewSkillMarkdown(body) {
1645
1645
  // src/review/request-review.ts
1646
1646
  var REPO_REVIEW_PATH = ".sideboard/review.md";
1647
1647
  var REPO_REVIEW_NAME = "review.md";
1648
+ var CONTEXT_REVIEW_PATH = ".context/review.md";
1648
1649
  var REVIEW_REQUEST_PATH = `${ATTACHMENTS_DIR}/Review request.md`;
1649
1650
  var LEGACY_REVIEW_REQUEST_PATH = `${LEGACY_ATTACHMENTS_DIR}/Review request.md`;
1650
1651
  var REVIEW_REQUEST_NAME = "Review request.md";
@@ -1691,41 +1692,64 @@ function skillGuidelines(content, source) {
1691
1692
  source
1692
1693
  };
1693
1694
  }
1694
- function ensureReviewSkillFile(worktreePath) {
1695
- const abs = join4(worktreePath, REVIEW_SKILL_PATH);
1696
- const existing = readTextIfPresent(abs);
1697
- if (existing) {
1698
- return { path: REVIEW_SKILL_PATH, content: existing, wrote: false };
1699
- }
1700
- const fromRepo = readTextIfPresent(join4(worktreePath, REPO_REVIEW_PATH));
1701
- const fromLocal = readLocalGuidelines(worktreePath)?.content ?? null;
1702
- const content = wrapReviewSkillMarkdown(fromRepo ?? fromLocal ?? REVIEW_REQUEST_TEMPLATE);
1695
+ function contextGuidelines(content, source) {
1696
+ return {
1697
+ path: CONTEXT_REVIEW_PATH,
1698
+ name: REPO_REVIEW_NAME,
1699
+ content,
1700
+ source
1701
+ };
1702
+ }
1703
+ function writeContextGuidelines(worktreePath, content) {
1704
+ const abs = join4(worktreePath, CONTEXT_REVIEW_PATH);
1703
1705
  mkdirSync(dirname(abs), { recursive: true });
1704
- writeFileSync(abs, content, "utf8");
1705
- return { path: REVIEW_SKILL_PATH, content, wrote: true };
1706
+ const body = content.endsWith("\n") ? content : `${content}
1707
+ `;
1708
+ writeFileSync(abs, body, "utf8");
1709
+ return body;
1710
+ }
1711
+ function readSideboardReview(worktreePath, repoPath) {
1712
+ const fromWorktree = readTextIfPresent(join4(worktreePath, REPO_REVIEW_PATH));
1713
+ if (fromWorktree) return fromWorktree;
1714
+ const repo = repoPath?.replace(/\/+$/, "");
1715
+ const wt = worktreePath.replace(/\/+$/, "");
1716
+ if (!repo || repo === wt) return null;
1717
+ return readTextIfPresent(join4(repo, REPO_REVIEW_PATH));
1706
1718
  }
1707
- function resolveReviewGuidelines(worktreePath) {
1719
+ function ensureReviewGuidelinesFile(worktreePath, repoPath) {
1708
1720
  const skillContent = readTextIfPresent(join4(worktreePath, REVIEW_SKILL_PATH));
1709
- if (skillContent) return skillGuidelines(skillContent, "skill");
1710
- const local = readLocalGuidelines(worktreePath);
1711
- if (local) {
1712
- return {
1713
- path: local.path,
1714
- name: REVIEW_REQUEST_NAME,
1715
- content: local.content,
1716
- source: "local"
1717
- };
1721
+ if (skillContent) {
1722
+ return { ...skillGuidelines(skillContent, "skill"), wrote: false };
1723
+ }
1724
+ const contextContent = readTextIfPresent(join4(worktreePath, CONTEXT_REVIEW_PATH));
1725
+ if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
1726
+ return { ...contextGuidelines(contextContent, "local"), wrote: false };
1718
1727
  }
1719
- const seeded = ensureReviewSkillFile(worktreePath);
1720
- return skillGuidelines(seeded.content, seeded.wrote ? "stock" : "skill");
1728
+ const fromSideboard = readSideboardReview(worktreePath, repoPath);
1729
+ if (fromSideboard && !shouldRefreshReviewRequestTemplate(fromSideboard)) {
1730
+ const body2 = writeContextGuidelines(worktreePath, fromSideboard);
1731
+ return { ...contextGuidelines(body2, "repo"), wrote: true };
1732
+ }
1733
+ const local = readLocalGuidelines(worktreePath);
1734
+ const body = writeContextGuidelines(worktreePath, local?.content ?? REVIEW_REQUEST_TEMPLATE);
1735
+ return {
1736
+ ...contextGuidelines(body, local ? "local" : "stock"),
1737
+ wrote: true
1738
+ };
1739
+ }
1740
+ function ensureReviewSkillFile(worktreePath, repoPath) {
1741
+ const g = ensureReviewGuidelinesFile(worktreePath, repoPath);
1742
+ return { path: g.path, content: g.content, wrote: g.wrote };
1743
+ }
1744
+ function resolveReviewGuidelines(worktreePath, repoPath) {
1745
+ return ensureReviewGuidelinesFile(worktreePath, repoPath);
1721
1746
  }
1722
- function ensureReviewRequestFile(worktreePath) {
1723
- const seeded = ensureReviewSkillFile(worktreePath);
1724
- return skillGuidelines(seeded.content, "skill");
1747
+ function ensureReviewRequestFile(worktreePath, repoPath) {
1748
+ return ensureReviewGuidelinesFile(worktreePath, repoPath);
1725
1749
  }
1726
1750
  function buildReviewRequestAttachment(content, opts) {
1727
1751
  const path = opts?.path ?? REVIEW_SKILL_PATH;
1728
- const name = opts?.name ?? (path === REVIEW_SKILL_PATH ? REVIEW_SKILL_NAME : path === REPO_REVIEW_PATH ? REPO_REVIEW_NAME : REVIEW_REQUEST_NAME);
1752
+ const name = opts?.name ?? (path === REVIEW_SKILL_PATH ? REVIEW_SKILL_NAME : path === REPO_REVIEW_PATH || path === CONTEXT_REVIEW_PATH ? REPO_REVIEW_NAME : REVIEW_REQUEST_NAME);
1729
1753
  return {
1730
1754
  id: randomUUID2(),
1731
1755
  name,
@@ -1735,7 +1759,7 @@ function buildReviewRequestAttachment(content, opts) {
1735
1759
  };
1736
1760
  }
1737
1761
  function readExistingReviewRequestFile(worktreePath) {
1738
- return readTextIfPresent(join4(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent(join4(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent(join4(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent(join4(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
1762
+ return readTextIfPresent(join4(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent(join4(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent(join4(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent(join4(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent(join4(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
1739
1763
  }
1740
1764
  async function requestReview(threadRef, send) {
1741
1765
  const from = findThreadByRef(threadRef);
@@ -1748,7 +1772,7 @@ async function requestReview(threadRef, send) {
1748
1772
  if (from.status === "archived") {
1749
1773
  throw new Error(`Thread is archived: ${from.id}`);
1750
1774
  }
1751
- const guidelines = resolveReviewGuidelines(from.worktreePath);
1775
+ const guidelines = resolveReviewGuidelines(from.worktreePath, from.repoPath);
1752
1776
  const tab = createChatTab({
1753
1777
  fromThreadId: from.id,
1754
1778
  title: "Review",
@@ -2007,11 +2031,9 @@ async function runConventionSetup(repoPath, worktreePath, onLine, opts) {
2007
2031
  }
2008
2032
  async function runWorkspaceSetup(repoPath, worktreePath, onLine, opts) {
2009
2033
  await ensureWorktreeSideboardIgnored(worktreePath);
2010
- const reviewSkill = ensureReviewSkillFile(worktreePath);
2011
- if (reviewSkill.wrote) {
2012
- onLine?.(
2013
- `[setup] wrote ${REVIEW_SKILL_PATH} \u2014 commit it so later worktrees inherit Review guidelines`
2014
- );
2034
+ const review = ensureReviewGuidelinesFile(worktreePath, repoPath);
2035
+ if (review.wrote) {
2036
+ onLine?.(`[setup] wrote ${review.path} \u2014 local Review guidelines`);
2015
2037
  }
2016
2038
  let setup = await runSetupScript(repoPath, worktreePath, onLine, opts);
2017
2039
  if (!setup.ran) {
@@ -3078,7 +3100,7 @@ async function createThread(input, _onSetupLine) {
3078
3100
  return readThread(thread.id) ?? thread;
3079
3101
  }
3080
3102
  async function listLinearIssues(agent, repoPath) {
3081
- const { getAdapter: getAdapter2 } = await import("./agents-U2JCFXW4.js");
3103
+ const { getAdapter: getAdapter2 } = await import("./agents-VHXCBBBD.js");
3082
3104
  await requireAgent(agent, { requireLinear: true });
3083
3105
  const adapter = getAdapter2(agent);
3084
3106
  if (!adapter.listLinearIssues) {
@@ -3485,7 +3507,7 @@ async function adoptThread(input) {
3485
3507
  messages: input.messages ?? []
3486
3508
  });
3487
3509
  writeThread(thread);
3488
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-ZXCUVCZC.js");
3510
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-4FSXVIZM.js");
3489
3511
  await ensureWorkspace2(repoPath);
3490
3512
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-X54WSOXM.js");
3491
3513
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -4897,6 +4919,16 @@ node <detached-job.js> wait --pid-file FILE --log-file FILE [--ok-pattern TEXT]
4897
4919
  4. On \`ok\`, present once more (\`status=ok\`, last \`delta\`) and finish the task. On \`failed\`, fix from the log.
4898
4920
 
4899
4921
  Never tell the user \u201Csay status when it\u2019s done.\u201D You wait.
4922
+
4923
+ ## PR checks (only if a goal is given)
4924
+
4925
+ Do **not** watch after every push. If the user gave a goal (Greptile 5/5, CI green, until checks pass), wait the same way:
4926
+
4927
+ \`\`\`bash
4928
+ node <detached-job.js> start pr-checks -- gh pr checks --watch
4929
+ \`\`\`
4930
+
4931
+ On miss, fix, commit, push, and watch again until the goal is met or you are blocked. Do not ask the human to poll. Do not merge unless asked.
4900
4932
  `;
4901
4933
 
4902
4934
  // src/skills/discover.ts
@@ -5262,7 +5294,7 @@ function formatWorktreeDirective(thread, opts) {
5262
5294
  "Short git requests from the Sideboard UI are complete instructions \u2014 expand them using the rules above without asking for clarification:"
5263
5295
  );
5264
5296
  lines.push(
5265
- '- "Commit and push." \u2192 commit any uncommitted work with a purpose-stating message, then push to origin (updates an existing PR if one is linked).'
5297
+ '- "Commit and push." \u2192 commit any uncommitted work with a purpose-stating message, then push to origin (updates an existing PR if one is linked). Do not start a checks loop unless they gave a goal.'
5266
5298
  );
5267
5299
  lines.push(
5268
5300
  '- "Commit, push, and open a draft PR." \u2192 commit, push, then create a draft PR with `gh pr create --draft -R \u2026` (title/body from the change purpose).'
@@ -5271,7 +5303,7 @@ function formatWorktreeDirective(thread, opts) {
5271
5303
  '- "Commit, push, and open a PR in the browser." \u2192 commit, push, then `gh pr create --web -R \u2026`.'
5272
5304
  );
5273
5305
  lines.push(
5274
- '- "Fix CI: <name>." \u2192 investigate that failing check, fix it, commit, and push.'
5306
+ '- "Fix CI: <name>." \u2192 investigate that failing check, fix it, commit, and push. Loop only if they gave a goal to keep going until it passes.'
5275
5307
  );
5276
5308
  lines.push(
5277
5309
  '- "Merge the remote branch (<base>) into your branch and resolve conflicts. Then, commit and push your changes." \u2192 fetch the PR base, merge it into this branch, resolve conflicts carefully, commit, and push until the PR is mergeable.'
@@ -5283,11 +5315,21 @@ function formatWorktreeDirective(thread, opts) {
5283
5315
  '- "Merge PR." \u2192 merge this thread\'s open pull request on GitHub (this phrase is the explicit ask). If `gh stack view` shows a stack, use `gh stack merge`; otherwise `gh pr merge` (respect repo defaults / squash vs merge). Do not force-push main/master or merge locally into the main checkout.'
5284
5316
  );
5285
5317
  lines.push("");
5318
+ lines.push(formatPrGateDirective());
5319
+ lines.push("");
5286
5320
  lines.push(formatProcessGuideDirective());
5287
5321
  return lines.join("\n");
5288
5322
  }
5289
5323
  function formatWorktreeReminder() {
5290
- return "Sideboard worktree: stay in this cwd for all file and git work. Push and open PRs against origin, never upstream. Do not edit the main repo checkout.";
5324
+ return "Sideboard worktree: stay in this cwd for all file and git work. Push and open PRs against origin, never upstream. Do not edit the main repo checkout. If a goal is given (Greptile 5/5, CI green), watch-fix-push until it lands \u2014 do not watch after every push.";
5325
+ }
5326
+ function formatPrGateDirective() {
5327
+ return [
5328
+ "If a goal is given (not after every push):",
5329
+ "- 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.",
5330
+ "- Wait with `/long-running`: `gh pr checks --watch` (add `-R <origin>` when needed). Present the log. Do not ask the human to poll.",
5331
+ "- Greptile 5/5: wait for the greptile check; read the latest `N/5` from the PR body or Greptile\u2019s most recently *updated* issue comment; also fetch unresolved review comments / the \u201CPrompt to fix all with AI\u201D block. Done = **5/5 and zero unresolved Greptile comments**. If Greptile is idle, comment `@greptile review`. Cap about 5 iterations, then report leftovers. Do not merge unless asked."
5332
+ ].join("\n");
5291
5333
  }
5292
5334
  function formatProcessGuideDirective() {
5293
5335
  return [
@@ -5295,7 +5337,7 @@ function formatProcessGuideDirective() {
5295
5337
  "- Long jobs (pack, test, deploy, anything that may run more than ~30s): Sideboard always provides `/long-running`. Detach and wait \u2014 do not ask the human to poll.",
5296
5338
  "- If `.claude/skills/graph-engineering/SKILL.md` exists, follow it (`/graph-engineering`) for migrations, ports, batch fixes, and other fan-out. Judge first; state on disk; grow the rulebook; do not patch around it.",
5297
5339
  "- If this same shape of work will happen again, write `.claude/skills/<kebab-name>/SKILL.md` in this worktree (Claude Code project skill). Sideboard `/name`, Claude Code, and `attach` all load that path. Do not leave the method only in chat.",
5298
- "- Merge-readiness notes: create or edit `.claude/skills/review/SKILL.md` and commit it. That file is allowed. Do not use `.sideboard/review.md` for new notes (legacy; setup copies it into the skill).",
5340
+ "- Merge-readiness notes: if `.claude/skills/review/SKILL.md` already exists, edit it. Otherwise write them to `.context/review.md` (copied from `.sideboard/review.md` when that file exists). Do not create a review skill.",
5299
5341
  "- Do not write new skills under `.sideboard/skills/` (that folder only \u2014 other `.sideboard/` files such as settings.toml are fine). Point Codex/OpenCode at the Claude skill from `AGENTS.md`. Optional: symlink `.cursor/skills/<name>` to the Claude skill.",
5300
5342
  "- Skip a guide for a one-off. If a matching skill exists, follow it. Same miss twice \u2192 edit the skill, do not patch around it."
5301
5343
  ].join("\n");
@@ -5935,7 +5977,7 @@ function formatScheduledPrompt(name, prompt) {
5935
5977
  ${prompt}`;
5936
5978
  }
5937
5979
  async function defaultDeps() {
5938
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-DPTRBKEH.js");
5980
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-NUA6SEV7.js");
5939
5981
  const orch = getOrchestrator2();
5940
5982
  return {
5941
5983
  findThread: (id) => findThreadByRef(id),
@@ -7922,7 +7964,7 @@ var Orchestrator = class {
7922
7964
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
7923
7965
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
7924
7966
  try {
7925
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-ZXCUVCZC.js");
7967
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-4FSXVIZM.js");
7926
7968
  await ensureWorkspace2(thread.repoPath);
7927
7969
  } catch {
7928
7970
  }
@@ -8194,11 +8236,13 @@ export {
8194
8236
  wrapReviewSkillMarkdown,
8195
8237
  REPO_REVIEW_PATH,
8196
8238
  REPO_REVIEW_NAME,
8239
+ CONTEXT_REVIEW_PATH,
8197
8240
  REVIEW_REQUEST_PATH,
8198
8241
  LEGACY_REVIEW_REQUEST_PATH,
8199
8242
  REVIEW_REQUEST_NAME,
8200
8243
  REVIEW_REQUEST_PREFILL,
8201
8244
  shouldRefreshReviewRequestTemplate,
8245
+ ensureReviewGuidelinesFile,
8202
8246
  ensureReviewSkillFile,
8203
8247
  resolveReviewGuidelines,
8204
8248
  ensureReviewRequestFile,
@@ -8293,6 +8337,7 @@ export {
8293
8337
  formatRenameBranchDirective,
8294
8338
  formatWorktreeDirective,
8295
8339
  formatWorktreeReminder,
8340
+ formatPrGateDirective,
8296
8341
  formatProcessGuideDirective,
8297
8342
  formatLongRunningDirective,
8298
8343
  formatLongRunningReminder,