@sideboard-ai/core 0.1.144 → 0.1.145

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 (31) hide show
  1. package/dist/{agents-OEEOIKUB.js → agents-4WOO4WN4.js} +4 -4
  2. package/dist/{agents-E5AAMHDY.js → agents-VFBNZHI4.js} +4 -4
  3. package/dist/{chunk-OHWN4JEL.js → chunk-2C5RE7K4.js} +1 -1
  4. package/dist/{chunk-OLR4UPP7.js → chunk-335KQKWX.js} +41 -14
  5. package/dist/{chunk-FGT26PJE.js → chunk-3EMJ5LVV.js} +41 -14
  6. package/dist/{chunk-HC5N3BDL.js → chunk-3UD2LW4P.js} +2 -2
  7. package/dist/{chunk-UG5N7ET3.js → chunk-DN7UA3UT.js} +1 -1
  8. package/dist/{chunk-R2W7A2UO.js → chunk-G3KLNP2B.js} +2 -2
  9. package/dist/{chunk-O3JEC2UJ.js → chunk-JSYIBLBK.js} +77 -8
  10. package/dist/{chunk-4D4PEBGB.js → chunk-LWRNRMYY.js} +2 -2
  11. package/dist/{chunk-4Q45TLZ5.js → chunk-QS5JJ2IM.js} +77 -8
  12. package/dist/{chunk-CG25RYQQ.js → chunk-TTJ6EYZC.js} +3 -3
  13. package/dist/{chunk-VHTIHOHE.js → chunk-UJWGZM4K.js} +3 -3
  14. package/dist/{chunk-FADNFPZO.js → chunk-XUYIJY6D.js} +2 -2
  15. package/dist/{coordinator-prompt-2LD3C74O.js → coordinator-prompt-J2WBXGLP.js} +2 -2
  16. package/dist/{coordinator-prompt-FBX7Y4EM.js → coordinator-prompt-JSX22ULD.js} +2 -2
  17. package/dist/{global-workspace-NG7SU3GV.js → global-workspace-6WR7OGMI.js} +3 -3
  18. package/dist/{global-workspace-OCV77UYF.js → global-workspace-AQESFS7I.js} +3 -3
  19. package/dist/index.cjs +107 -8
  20. package/dist/index.d.cts +20 -1
  21. package/dist/index.d.ts +20 -1
  22. package/dist/index.js +10 -6
  23. package/dist/mcp/run-stdio.cjs +103 -8
  24. package/dist/mcp/run-stdio.js +6 -6
  25. package/dist/{orchestrator-IQGVBBSH.js → orchestrator-WWQBBIPP.js} +6 -6
  26. package/dist/{orchestrator-DB5ZSE6M.js → orchestrator-XPGJV7JK.js} +6 -6
  27. package/dist/{workspaces-4FUQW5LD.js → workspaces-V3RNE5ZX.js} +4 -4
  28. package/dist/{workspaces-PU5YHQ7Z.js → workspaces-WALT3MJB.js} +4 -4
  29. package/dist/{worktree-GKLPPNWR.js → worktree-3NLPMA7K.js} +5 -1
  30. package/dist/{worktree-Z22HTSCU.js → worktree-TUZX7F7P.js} +5 -1
  31. package/package.json +1 -1
@@ -4784,6 +4784,7 @@ __export(worktree_exports, {
4784
4784
  canonicalizeRepoPath: () => canonicalizeRepoPath,
4785
4785
  collectTakenTeamSlugs: () => collectTakenTeamSlugs,
4786
4786
  commitAll: () => commitAll,
4787
+ countUnpushedVsOrigin: () => countUnpushedVsOrigin,
4787
4788
  createExistingBranchWorktree: () => createExistingBranchWorktree,
4788
4789
  createOrUpdatePr: () => createOrUpdatePr,
4789
4790
  createThreadWorktree: () => createThreadWorktree,
@@ -4807,6 +4808,7 @@ __export(worktree_exports, {
4807
4808
  listPrs: () => listPrs,
4808
4809
  listWorktrees: () => listWorktrees,
4809
4810
  lookupSoccerTeam: () => lookupSoccerTeam,
4811
+ markPrReady: () => markPrReady,
4810
4812
  mergePr: () => mergePr,
4811
4813
  normalizeWorktreePath: () => normalizeWorktreePath,
4812
4814
  originGhRepoEnv: () => originGhRepoEnv,
@@ -5731,6 +5733,32 @@ async function listWorktrees(repoPath) {
5731
5733
  if (current) entries.push(current);
5732
5734
  return entries;
5733
5735
  }
5736
+ async function countUnpushedVsOrigin(worktreePath) {
5737
+ const head = await git(["rev-parse", "--abbrev-ref", "HEAD"], worktreePath, {
5738
+ reject: false
5739
+ });
5740
+ const branch = head.stdout.trim();
5741
+ if (branch && branch !== "HEAD") {
5742
+ const remote = await git(
5743
+ ["rev-list", "--count", `origin/${branch}..HEAD`],
5744
+ worktreePath,
5745
+ { reject: false }
5746
+ );
5747
+ if (remote.exitCode === 0) {
5748
+ const n = Number(remote.stdout.trim());
5749
+ return Number.isFinite(n) ? n : 1;
5750
+ }
5751
+ const all = await git(["rev-list", "--count", "HEAD"], worktreePath, {
5752
+ reject: false
5753
+ });
5754
+ if (all.exitCode === 0) {
5755
+ const n = Number(all.stdout.trim());
5756
+ if (Number.isFinite(n) && n > 0) return n;
5757
+ }
5758
+ return 1;
5759
+ }
5760
+ return 1;
5761
+ }
5734
5762
  async function isDirty(worktreePath) {
5735
5763
  const { stdout } = await git(["status", "--porcelain"], worktreePath);
5736
5764
  for (const line of stdout.split("\n")) {
@@ -5794,6 +5822,54 @@ async function pushBranch(worktreePath, branchName) {
5794
5822
  const httpsErr = (basicPush.stderr || bearer.stderr || bearer.stdout).trim();
5795
5823
  throw new Error(httpsErr || sshErr || `git push origin ${branchName} failed`);
5796
5824
  }
5825
+ async function runPrReady(cwd, selector, slug) {
5826
+ const readyArgs = ["pr", "ready", selector];
5827
+ if (slug) readyArgs.push("--repo", slug);
5828
+ const ready = await gh(readyArgs, cwd, { reject: false });
5829
+ if (ready.exitCode !== 0) {
5830
+ throw new Error(
5831
+ ready.stderr.trim() || ready.stdout.trim() || "Could not mark draft pull request as ready"
5832
+ );
5833
+ }
5834
+ }
5835
+ async function markPrReady(cwd, selector) {
5836
+ const slug = await resolveGithubRepoSlug(cwd);
5837
+ const viewArgs = ["pr", "view", selector, "--json", "url,state,isDraft"];
5838
+ if (slug) viewArgs.push("--repo", slug);
5839
+ const before = await gh(viewArgs, cwd, { reject: false });
5840
+ if (before.exitCode !== 0 || !before.stdout.trim()) {
5841
+ throw new Error(before.stderr.trim() || "Could not load pull request");
5842
+ }
5843
+ let url = "";
5844
+ let state = "";
5845
+ let isDraft = false;
5846
+ try {
5847
+ const parsed = JSON.parse(before.stdout);
5848
+ url = String(parsed.url ?? "");
5849
+ state = String(parsed.state ?? "").toUpperCase();
5850
+ isDraft = Boolean(parsed.isDraft);
5851
+ } catch {
5852
+ throw new Error("Could not parse pull request details");
5853
+ }
5854
+ if (state === "MERGED" || state === "CLOSED") {
5855
+ return { url, state, isDraft: false };
5856
+ }
5857
+ if (isDraft) {
5858
+ if (await isDirty(cwd)) {
5859
+ throw new Error(
5860
+ "Commit and push local work before marking the pull request ready for review."
5861
+ );
5862
+ }
5863
+ const unpushed = await countUnpushedVsOrigin(cwd);
5864
+ if (unpushed > 0) {
5865
+ throw new Error(
5866
+ "Push this branch to origin before marking the pull request ready for review."
5867
+ );
5868
+ }
5869
+ await runPrReady(cwd, selector, slug);
5870
+ }
5871
+ return { url, state: state || "OPEN", isDraft: false };
5872
+ }
5797
5873
  async function mergePr(cwd, selector, opts) {
5798
5874
  const slug = await resolveGithubRepoSlug(cwd);
5799
5875
  const viewArgs = ["pr", "view", selector, "--json", "url,state,isDraft,number"];
@@ -5828,14 +5904,7 @@ async function mergePr(cwd, selector, opts) {
5828
5904
  return { url, state: "MERGED" };
5829
5905
  }
5830
5906
  if (isDraft) {
5831
- const readyArgs = ["pr", "ready", selector];
5832
- if (slug) readyArgs.push("--repo", slug);
5833
- const ready = await gh(readyArgs, cwd, { reject: false });
5834
- if (ready.exitCode !== 0) {
5835
- throw new Error(
5836
- ready.stderr.trim() || ready.stdout.trim() || "Could not mark draft pull request as ready"
5837
- );
5838
- }
5907
+ await runPrReady(cwd, selector, slug);
5839
5908
  }
5840
5909
  const method = opts?.method ?? "squash";
5841
5910
  const mergeFlag = method === "rebase" ? "--rebase" : method === "merge" ? "--merge" : "--squash";
@@ -18794,6 +18863,32 @@ var init_orchestrator = __esm({
18794
18863
  }
18795
18864
  return result;
18796
18865
  }
18866
+ async markPrReady(threadRef) {
18867
+ const { thread, selectors, cwd } = await this.withPrSelector(threadRef);
18868
+ this.assertNotGlobal(thread, "Ready for review");
18869
+ const selector = selectors[0];
18870
+ if (!selector) throw new Error("No pull request linked to this thread");
18871
+ const result = await markPrReady(cwd, selector);
18872
+ const meta = await getPrMeta(cwd, selector);
18873
+ if (meta) {
18874
+ await this.persistPrMetaAndMaybeArchive(thread, { ...meta, isDraft: false });
18875
+ return { url: meta.url || result.url, state: meta.state || result.state, isDraft: false };
18876
+ }
18877
+ await this.persistPrMetaAndMaybeArchive(thread, {
18878
+ number: 0,
18879
+ title: thread.prTitle ?? thread.title,
18880
+ url: result.url || thread.prUrl || "",
18881
+ state: result.state || "OPEN",
18882
+ isDraft: false,
18883
+ reviewDecision: null,
18884
+ baseRefName: "",
18885
+ headRefName: "",
18886
+ isInMergeQueue: false,
18887
+ mergeable: null,
18888
+ mergeStateStatus: null
18889
+ });
18890
+ return { ...result, isDraft: false };
18891
+ }
18797
18892
  async mergePr(threadRef) {
18798
18893
  const { thread, selectors, cwd } = await this.withPrSelector(threadRef);
18799
18894
  this.assertNotGlobal(thread, "Merge PR");
@@ -32,14 +32,14 @@ import {
32
32
  slackTokenFor,
33
33
  syncBoardPins,
34
34
  updateSchedule
35
- } from "../chunk-OLR4UPP7.js";
35
+ } from "../chunk-335KQKWX.js";
36
36
  import {
37
37
  listModelsForAgent,
38
38
  sideboardMcpProfile
39
- } from "../chunk-CG25RYQQ.js";
39
+ } from "../chunk-TTJ6EYZC.js";
40
40
  import "../chunk-ED4UPEJX.js";
41
41
  import "../chunk-S42XV45P.js";
42
- import "../chunk-4D4PEBGB.js";
42
+ import "../chunk-LWRNRMYY.js";
43
43
  import {
44
44
  createAbleTimeTask,
45
45
  ensureAbleTimeTask,
@@ -59,8 +59,8 @@ import "../chunk-KLBOWJ74.js";
59
59
  import {
60
60
  GLOBAL_WORKSPACE_ID,
61
61
  isCloudCoordinatorThread
62
- } from "../chunk-FADNFPZO.js";
63
- import "../chunk-OHWN4JEL.js";
62
+ } from "../chunk-XUYIJY6D.js";
63
+ import "../chunk-2C5RE7K4.js";
64
64
  import {
65
65
  canonicalizeRepoPath,
66
66
  listBranches,
@@ -68,7 +68,7 @@ import {
68
68
  resolveGithubRepoSlug,
69
69
  resolveRepoRoot,
70
70
  warmGithubAgentAuth
71
- } from "../chunk-4Q45TLZ5.js";
71
+ } from "../chunk-QS5JJ2IM.js";
72
72
  import "../chunk-B3SJXYIJ.js";
73
73
  import "../chunk-EUXOHTUK.js";
74
74
  import {
@@ -6,17 +6,17 @@ import {
6
6
  isPidAlive,
7
7
  startOrchestration,
8
8
  waitForPidExit
9
- } from "./chunk-OLR4UPP7.js";
10
- import "./chunk-CG25RYQQ.js";
9
+ } from "./chunk-335KQKWX.js";
10
+ import "./chunk-TTJ6EYZC.js";
11
11
  import "./chunk-ED4UPEJX.js";
12
12
  import "./chunk-S42XV45P.js";
13
- import "./chunk-4D4PEBGB.js";
13
+ import "./chunk-LWRNRMYY.js";
14
14
  import "./chunk-6GN5WPYZ.js";
15
15
  import "./chunk-N5PM7HGQ.js";
16
16
  import "./chunk-KLBOWJ74.js";
17
- import "./chunk-FADNFPZO.js";
18
- import "./chunk-OHWN4JEL.js";
19
- import "./chunk-4Q45TLZ5.js";
17
+ import "./chunk-XUYIJY6D.js";
18
+ import "./chunk-2C5RE7K4.js";
19
+ import "./chunk-QS5JJ2IM.js";
20
20
  import "./chunk-B3SJXYIJ.js";
21
21
  import "./chunk-EUXOHTUK.js";
22
22
  import "./chunk-KPIYENTF.js";
@@ -4,19 +4,19 @@ import {
4
4
  isPidAlive,
5
5
  startOrchestration,
6
6
  waitForPidExit
7
- } from "./chunk-FGT26PJE.js";
8
- import "./chunk-VHTIHOHE.js";
7
+ } from "./chunk-3EMJ5LVV.js";
8
+ import "./chunk-UJWGZM4K.js";
9
9
  import "./chunk-KBWND62T.js";
10
10
  import "./chunk-M267JPEA.js";
11
- import "./chunk-HC5N3BDL.js";
12
- import "./chunk-R2W7A2UO.js";
13
- import "./chunk-UG5N7ET3.js";
11
+ import "./chunk-3UD2LW4P.js";
12
+ import "./chunk-G3KLNP2B.js";
13
+ import "./chunk-DN7UA3UT.js";
14
14
  import "./chunk-ELBYOGVA.js";
15
15
  import "./chunk-QTUESPAW.js";
16
16
  import "./chunk-AXQ4ZWHK.js";
17
17
  import "./chunk-WT5HSFOU.js";
18
18
  import "./chunk-DCOZABNT.js";
19
- import "./chunk-O3JEC2UJ.js";
19
+ import "./chunk-JSYIBLBK.js";
20
20
  import "./chunk-FKOIHGKV.js";
21
21
  import "./chunk-I77RYPOH.js";
22
22
  import "./chunk-4TR3HZFT.js";
@@ -6,10 +6,10 @@ import {
6
6
  listWorkspaces,
7
7
  removeWorkspace,
8
8
  syncWorkspacesFromThreads
9
- } from "./chunk-4D4PEBGB.js";
10
- import "./chunk-FADNFPZO.js";
11
- import "./chunk-OHWN4JEL.js";
12
- import "./chunk-4Q45TLZ5.js";
9
+ } from "./chunk-LWRNRMYY.js";
10
+ import "./chunk-XUYIJY6D.js";
11
+ import "./chunk-2C5RE7K4.js";
12
+ import "./chunk-QS5JJ2IM.js";
13
13
  import "./chunk-B3SJXYIJ.js";
14
14
  import "./chunk-EUXOHTUK.js";
15
15
  import "./chunk-KPIYENTF.js";
@@ -4,10 +4,10 @@ import {
4
4
  listWorkspaces,
5
5
  removeWorkspace,
6
6
  syncWorkspacesFromThreads
7
- } from "./chunk-HC5N3BDL.js";
8
- import "./chunk-R2W7A2UO.js";
9
- import "./chunk-UG5N7ET3.js";
10
- import "./chunk-O3JEC2UJ.js";
7
+ } from "./chunk-3UD2LW4P.js";
8
+ import "./chunk-G3KLNP2B.js";
9
+ import "./chunk-DN7UA3UT.js";
10
+ import "./chunk-JSYIBLBK.js";
11
11
  import "./chunk-FKOIHGKV.js";
12
12
  import "./chunk-I77RYPOH.js";
13
13
  import "./chunk-4TR3HZFT.js";
@@ -6,6 +6,7 @@ import {
6
6
  canonicalizeRepoPath,
7
7
  collectTakenTeamSlugs,
8
8
  commitAll,
9
+ countUnpushedVsOrigin,
9
10
  createExistingBranchWorktree,
10
11
  createOrUpdatePr,
11
12
  createThreadWorktree,
@@ -29,6 +30,7 @@ import {
29
30
  listPrs,
30
31
  listWorktrees,
31
32
  lookupSoccerTeam,
33
+ markPrReady,
32
34
  mergePr,
33
35
  normalizeWorktreePath,
34
36
  originGhRepoEnv,
@@ -48,7 +50,7 @@ import {
48
50
  worktreeDisplayLabel,
49
51
  worktreeDisplayLabelForGroup,
50
52
  worktreeNameFromPath
51
- } from "./chunk-O3JEC2UJ.js";
53
+ } from "./chunk-JSYIBLBK.js";
52
54
  import "./chunk-FKOIHGKV.js";
53
55
  import "./chunk-I77RYPOH.js";
54
56
  import "./chunk-4TR3HZFT.js";
@@ -65,6 +67,7 @@ export {
65
67
  canonicalizeRepoPath,
66
68
  collectTakenTeamSlugs,
67
69
  commitAll,
70
+ countUnpushedVsOrigin,
68
71
  createExistingBranchWorktree,
69
72
  createOrUpdatePr,
70
73
  createThreadWorktree,
@@ -88,6 +91,7 @@ export {
88
91
  listPrs,
89
92
  listWorktrees,
90
93
  lookupSoccerTeam,
94
+ markPrReady,
91
95
  mergePr,
92
96
  normalizeWorktreePath,
93
97
  originGhRepoEnv,
@@ -8,6 +8,7 @@ import {
8
8
  canonicalizeRepoPath,
9
9
  collectTakenTeamSlugs,
10
10
  commitAll,
11
+ countUnpushedVsOrigin,
11
12
  createExistingBranchWorktree,
12
13
  createOrUpdatePr,
13
14
  createThreadWorktree,
@@ -31,6 +32,7 @@ import {
31
32
  listPrs,
32
33
  listWorktrees,
33
34
  lookupSoccerTeam,
35
+ markPrReady,
34
36
  mergePr,
35
37
  normalizeWorktreePath,
36
38
  originGhRepoEnv,
@@ -50,7 +52,7 @@ import {
50
52
  worktreeDisplayLabel,
51
53
  worktreeDisplayLabelForGroup,
52
54
  worktreeNameFromPath
53
- } from "./chunk-4Q45TLZ5.js";
55
+ } from "./chunk-QS5JJ2IM.js";
54
56
  import "./chunk-B3SJXYIJ.js";
55
57
  import "./chunk-EUXOHTUK.js";
56
58
  import "./chunk-KPIYENTF.js";
@@ -66,6 +68,7 @@ export {
66
68
  canonicalizeRepoPath,
67
69
  collectTakenTeamSlugs,
68
70
  commitAll,
71
+ countUnpushedVsOrigin,
69
72
  createExistingBranchWorktree,
70
73
  createOrUpdatePr,
71
74
  createThreadWorktree,
@@ -89,6 +92,7 @@ export {
89
92
  listPrs,
90
93
  listWorktrees,
91
94
  lookupSoccerTeam,
95
+ markPrReady,
92
96
  mergePr,
93
97
  normalizeWorktreePath,
94
98
  originGhRepoEnv,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sideboard-ai/core",
3
- "version": "0.1.144",
3
+ "version": "0.1.145",
4
4
  "description": "Sideboard core — orchestration, agents, git worktrees, MCP server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",