@sideboard-ai/core 0.1.49 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agents-3P4N6KHC.js → agents-5ROTZNCX.js} +3 -3
- package/dist/{agents-LUB3Q773.js → agents-HIEJL3UV.js} +3 -3
- package/dist/{chunk-SS34TVSY.js → chunk-5ZPSH7VI.js} +3 -3
- package/dist/{chunk-RQI4TOXK.js → chunk-7EUWSBWR.js} +3 -3
- package/dist/{chunk-AJ6ROGD7.js → chunk-7LNGIP3X.js} +20 -2
- package/dist/{chunk-ILQK4P5R.js → chunk-BXJ76RHF.js} +4 -4
- package/dist/{chunk-3NAS4MWH.js → chunk-E4VVEKAM.js} +2 -2
- package/dist/{chunk-GZXBYHJC.js → chunk-F4Q3IM6V.js} +1 -1
- package/dist/{chunk-E35APBHV.js → chunk-H6GGDLYS.js} +1 -1
- package/dist/{chunk-ZQCQIWIP.js → chunk-K3WMKGFY.js} +1 -1
- package/dist/{chunk-5WYEJ3F3.js → chunk-O5DOO7DP.js} +2 -2
- package/dist/{chunk-V4JRXYYU.js → chunk-QN7XNQAT.js} +2 -2
- package/dist/{chunk-ZVV5EEQN.js → chunk-XRSAGVRW.js} +62 -17
- package/dist/{chunk-DF5VQQKA.js → chunk-YFJ4FG2P.js} +2 -2
- package/dist/{chunk-FV6FN6V5.js → chunk-ZH5QZ4CR.js} +62 -17
- package/dist/{chunk-ISY4EGF6.js → chunk-ZNM4MAN4.js} +20 -2
- package/dist/{connected-teams-UBXHZGO4.js → connected-teams-2ANNZCP5.js} +2 -2
- package/dist/{connected-teams-GF52Q7LB.js → connected-teams-ONC4666A.js} +2 -2
- package/dist/{coordinator-prompt-VG4BZ5JL.js → coordinator-prompt-7HHJRO7B.js} +3 -3
- package/dist/{coordinator-prompt-SPGDT7J5.js → coordinator-prompt-WD7FAMA2.js} +3 -3
- package/dist/{global-workspace-KSR3E63K.js → global-workspace-ECYN2MKL.js} +4 -4
- package/dist/{global-workspace-OJF4ENH4.js → global-workspace-OJEPGDXA.js} +4 -4
- package/dist/index.cjs +92 -21
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +30 -21
- package/dist/mcp/run-stdio.cjs +88 -21
- package/dist/mcp/run-stdio.js +26 -20
- package/dist/{run-HMRSRG3U.js → run-H3IMNOYN.js} +3 -1
- package/dist/run-ZJKYHXGN.js +12 -0
- package/dist/{workspaces-OZE7LRDO.js → workspaces-MUU7RGVV.js} +5 -5
- package/dist/{workspaces-UJX7JIGH.js → workspaces-ZWOOFZUV.js} +5 -5
- package/dist/{worktree-XG5PCLZY.js → worktree-DVNDMWZ7.js} +4 -2
- package/dist/{worktree-TEDAJ57S.js → worktree-GDV56MX4.js} +4 -2
- package/package.json +1 -1
- package/dist/run-LF6E5IKL.js +0 -10
|
@@ -26,14 +26,14 @@ import {
|
|
|
26
26
|
permissionMode,
|
|
27
27
|
resolveCursorModelId,
|
|
28
28
|
resolveQuotaFallbackAgent
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-5ZPSH7VI.js";
|
|
30
30
|
import {
|
|
31
31
|
ORCHESTRATOR_AGENT_KINDS,
|
|
32
32
|
assertOrchestratorCapableAgent,
|
|
33
33
|
coerceOrchestratorAgent,
|
|
34
34
|
isOrchestratorCapableAgent
|
|
35
35
|
} from "./chunk-GI7E5733.js";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-BXJ76RHF.js";
|
|
37
37
|
import {
|
|
38
38
|
cursorSdkMessageToEvents,
|
|
39
39
|
parseCursorRunnerLine
|
|
@@ -43,7 +43,7 @@ import "./chunk-77WWLBCI.js";
|
|
|
43
43
|
import "./chunk-M37RITA6.js";
|
|
44
44
|
import {
|
|
45
45
|
ensureAgentPath
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-7LNGIP3X.js";
|
|
47
47
|
export {
|
|
48
48
|
CLAUDE_MODEL_CATALOG,
|
|
49
49
|
ORCHESTRATOR_AGENT_KINDS,
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
permissionMode,
|
|
31
31
|
resolveCursorModelId,
|
|
32
32
|
resolveQuotaFallbackAgent
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-7EUWSBWR.js";
|
|
34
|
+
import "./chunk-H6GGDLYS.js";
|
|
35
35
|
import "./chunk-HBJSHRY2.js";
|
|
36
36
|
import {
|
|
37
37
|
ORCHESTRATOR_AGENT_KINDS,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
} from "./chunk-S2LL5HA4.js";
|
|
42
42
|
import {
|
|
43
43
|
ensureAgentPath
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-ZNM4MAN4.js";
|
|
45
45
|
import "./chunk-KGZBYWZ3.js";
|
|
46
46
|
import "./chunk-7MV3RXSC.js";
|
|
47
47
|
export {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ensureCliTeamTracked,
|
|
5
5
|
ensureConnectedBrightsyTeamTokens,
|
|
6
6
|
loadBrightsyConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BXJ76RHF.js";
|
|
8
8
|
import {
|
|
9
9
|
extractJsonErrorMessage,
|
|
10
10
|
formatUnknownDetail,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import {
|
|
20
20
|
ensureAgentPath,
|
|
21
21
|
run
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-7LNGIP3X.js";
|
|
23
23
|
|
|
24
24
|
// src/agents/brightsy-targets.ts
|
|
25
25
|
function encodeBrightsyTarget(type, id, accountId) {
|
|
@@ -837,7 +837,7 @@ var claudeAdapter = {
|
|
|
837
837
|
);
|
|
838
838
|
}
|
|
839
839
|
const mode = permissionMode(thread);
|
|
840
|
-
const { isOrchestratorThread } = await import("./global-workspace-
|
|
840
|
+
const { isOrchestratorThread } = await import("./global-workspace-ECYN2MKL.js");
|
|
841
841
|
const isOrchestrator = isOrchestratorThread(thread);
|
|
842
842
|
const injectedServers = await buildInjectedMcpServers({
|
|
843
843
|
includeSideboard: true,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
ensureCliTeamTracked,
|
|
7
7
|
ensureConnectedBrightsyTeamTokens,
|
|
8
8
|
loadBrightsyConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-H6GGDLYS.js";
|
|
10
10
|
import {
|
|
11
11
|
claudeChromeEnabled,
|
|
12
12
|
loadAppSettings,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
ensureAgentPath,
|
|
17
17
|
run
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZNM4MAN4.js";
|
|
19
19
|
|
|
20
20
|
// src/agents/brightsy-targets.ts
|
|
21
21
|
function encodeBrightsyTarget(type, id, accountId) {
|
|
@@ -899,7 +899,7 @@ var claudeAdapter = {
|
|
|
899
899
|
);
|
|
900
900
|
}
|
|
901
901
|
const mode = permissionMode(thread);
|
|
902
|
-
const { isOrchestratorThread } = await import("./global-workspace-
|
|
902
|
+
const { isOrchestratorThread } = await import("./global-workspace-OJEPGDXA.js");
|
|
903
903
|
const isOrchestrator = isOrchestratorThread(thread);
|
|
904
904
|
const injectedServers = await buildInjectedMcpServers({
|
|
905
905
|
includeSideboard: true,
|
|
@@ -60,15 +60,33 @@ async function run(file, args, opts) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
async function git(args, cwd, opts) {
|
|
63
|
-
|
|
63
|
+
const prefix = [];
|
|
64
|
+
if (opts?.config) {
|
|
65
|
+
for (const [key, value] of Object.entries(opts.config)) {
|
|
66
|
+
if (!key) continue;
|
|
67
|
+
prefix.push("-c", `${key}=${value}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return run("git", [...prefix, ...args], {
|
|
71
|
+
cwd,
|
|
72
|
+
reject: opts?.reject,
|
|
73
|
+
env: opts?.env
|
|
74
|
+
});
|
|
64
75
|
}
|
|
65
76
|
async function gh(args, cwd, opts) {
|
|
66
77
|
return run("gh", args, { cwd, reject: opts?.reject });
|
|
67
78
|
}
|
|
79
|
+
async function resolveGhAuthToken(cwd) {
|
|
80
|
+
const result = await gh(["auth", "token"], cwd, { reject: false });
|
|
81
|
+
if (result.exitCode !== 0) return null;
|
|
82
|
+
const token = result.stdout.trim();
|
|
83
|
+
return token || null;
|
|
84
|
+
}
|
|
68
85
|
|
|
69
86
|
export {
|
|
70
87
|
ensureAgentPath,
|
|
71
88
|
run,
|
|
72
89
|
git,
|
|
73
|
-
gh
|
|
90
|
+
gh,
|
|
91
|
+
resolveGhAuthToken
|
|
74
92
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-M37RITA6.js";
|
|
4
4
|
import {
|
|
5
5
|
run
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7LNGIP3X.js";
|
|
7
7
|
|
|
8
8
|
// src/brightsy/connected-teams.ts
|
|
9
9
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -36,7 +36,7 @@ function saveBrightsyConfig(cfg) {
|
|
|
36
36
|
|
|
37
37
|
// src/brightsy/accounts.ts
|
|
38
38
|
async function loadConnectedTeams() {
|
|
39
|
-
const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-
|
|
39
|
+
const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-ONC4666A.js");
|
|
40
40
|
return listConnectedBrightsyTeams2();
|
|
41
41
|
}
|
|
42
42
|
async function runBrightsyTeamsJson(args) {
|
|
@@ -68,7 +68,7 @@ async function getBrightsySession() {
|
|
|
68
68
|
const data = await runBrightsyTeamsJson([]);
|
|
69
69
|
const accounts = Array.isArray(data.teams) ? data.teams : [];
|
|
70
70
|
const active = data.active ?? accounts.find((a) => a.active) ?? null;
|
|
71
|
-
const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-
|
|
71
|
+
const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-ONC4666A.js");
|
|
72
72
|
const connectedTeams = ensureCliTeamTracked2(
|
|
73
73
|
active ? { id: active.id, slug: active.slug, name: active.name } : void 0
|
|
74
74
|
);
|
|
@@ -108,7 +108,7 @@ async function performBrightsyAccountSwitch(accountIdOrSlug) {
|
|
|
108
108
|
return { cfg, target: data.active };
|
|
109
109
|
}
|
|
110
110
|
async function switchBrightsyAccount(accountIdOrSlug) {
|
|
111
|
-
const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-
|
|
111
|
+
const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-ONC4666A.js");
|
|
112
112
|
await connectBrightsyTeam2(accountIdOrSlug);
|
|
113
113
|
return getBrightsySession();
|
|
114
114
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isGlobalRepoPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-O5DOO7DP.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureGhPreferOrigin,
|
|
6
6
|
resolveRepoRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZH5QZ4CR.js";
|
|
8
8
|
import {
|
|
9
9
|
appDataDir
|
|
10
10
|
} from "./chunk-M37RITA6.js";
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./chunk-GI7E5733.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureGlobalCoordinatorCwd
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K3WMKGFY.js";
|
|
7
7
|
import {
|
|
8
8
|
allocateTeamName,
|
|
9
9
|
takenSlugsFromThread,
|
|
10
10
|
teamSlugFromName
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ZH5QZ4CR.js";
|
|
12
12
|
import {
|
|
13
13
|
createEmptyThread,
|
|
14
14
|
listThreads,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
isGlobalRepoPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YFJ4FG2P.js";
|
|
6
6
|
import {
|
|
7
7
|
ensureGhPreferOrigin,
|
|
8
8
|
resolveRepoRoot
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-XRSAGVRW.js";
|
|
10
10
|
import {
|
|
11
11
|
appDataDir
|
|
12
12
|
} from "./chunk-7MV3RXSC.js";
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
} from "./chunk-EOYDCKQC.js";
|
|
6
6
|
import {
|
|
7
7
|
gh,
|
|
8
|
-
git
|
|
9
|
-
|
|
8
|
+
git,
|
|
9
|
+
resolveGhAuthToken
|
|
10
|
+
} from "./chunk-ZNM4MAN4.js";
|
|
10
11
|
import {
|
|
11
12
|
worktreesRoot
|
|
12
13
|
} from "./chunk-7MV3RXSC.js";
|
|
@@ -1471,18 +1472,31 @@ async function fetchPrHead(repoPath, number, localBranch) {
|
|
|
1471
1472
|
const slug = await resolveGithubRepoSlug(repoPath);
|
|
1472
1473
|
const refspec = `+pull/${number}/head:${localBranch}`;
|
|
1473
1474
|
const errors = [];
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1475
|
+
const httpsRemote = slug ? `https://github.com/${slug}.git` : null;
|
|
1476
|
+
const tryFetch = async (remote, opts) => {
|
|
1477
|
+
const label = opts?.ghAuth ? `${remote} (gh auth)` : remote;
|
|
1478
|
+
const gitOpts = { reject: false };
|
|
1479
|
+
if (opts?.ghAuth) {
|
|
1480
|
+
const token = await resolveGhAuthToken(repoPath);
|
|
1481
|
+
if (!token) {
|
|
1482
|
+
errors.push(`${label}: gh auth token unavailable`);
|
|
1483
|
+
return false;
|
|
1484
|
+
}
|
|
1485
|
+
gitOpts.env = { GIT_TERMINAL_PROMPT: "0" };
|
|
1486
|
+
gitOpts.config = {
|
|
1487
|
+
"http.extraHeader": `AUTHORIZATION: bearer ${token}`
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
const result = await git(["fetch", remote, refspec], repoPath, gitOpts);
|
|
1478
1491
|
if (result.exitCode === 0) return true;
|
|
1479
1492
|
const detail = (result.stderr || result.stdout).trim();
|
|
1480
|
-
if (detail) errors.push(`${
|
|
1493
|
+
if (detail) errors.push(`${label}: ${detail}`);
|
|
1481
1494
|
return false;
|
|
1482
1495
|
};
|
|
1483
1496
|
let fetched = await tryFetch("origin");
|
|
1484
|
-
if (!fetched &&
|
|
1485
|
-
fetched = await tryFetch(
|
|
1497
|
+
if (!fetched && httpsRemote) {
|
|
1498
|
+
fetched = await tryFetch(httpsRemote);
|
|
1499
|
+
if (!fetched) fetched = await tryFetch(httpsRemote, { ghAuth: true });
|
|
1486
1500
|
}
|
|
1487
1501
|
const localOk = async () => {
|
|
1488
1502
|
const verify = await git(["rev-parse", "--verify", localBranch], repoPath, {
|
|
@@ -1511,18 +1525,28 @@ async function fetchPrHead(repoPath, number, localBranch) {
|
|
|
1511
1525
|
}
|
|
1512
1526
|
}
|
|
1513
1527
|
if (oid) {
|
|
1514
|
-
const ensureOid = async (remote) => {
|
|
1515
|
-
const
|
|
1516
|
-
|
|
1517
|
-
|
|
1528
|
+
const ensureOid = async (remote, opts) => {
|
|
1529
|
+
const gitOpts = { reject: false };
|
|
1530
|
+
if (opts?.ghAuth) {
|
|
1531
|
+
const token = await resolveGhAuthToken(repoPath);
|
|
1532
|
+
if (!token) return false;
|
|
1533
|
+
gitOpts.env = { GIT_TERMINAL_PROMPT: "0" };
|
|
1534
|
+
gitOpts.config = {
|
|
1535
|
+
"http.extraHeader": `AUTHORIZATION: bearer ${token}`
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
const got = await git(["fetch", remote, oid], repoPath, gitOpts);
|
|
1518
1539
|
return got.exitCode === 0;
|
|
1519
1540
|
};
|
|
1520
1541
|
let haveObject = (await git(["cat-file", "-e", `${oid}^{commit}`], repoPath, {
|
|
1521
1542
|
reject: false
|
|
1522
1543
|
})).exitCode === 0;
|
|
1523
1544
|
if (!haveObject) haveObject = await ensureOid("origin");
|
|
1524
|
-
if (!haveObject &&
|
|
1525
|
-
haveObject = await ensureOid(
|
|
1545
|
+
if (!haveObject && httpsRemote) {
|
|
1546
|
+
haveObject = await ensureOid(httpsRemote);
|
|
1547
|
+
if (!haveObject) {
|
|
1548
|
+
haveObject = await ensureOid(httpsRemote, { ghAuth: true });
|
|
1549
|
+
}
|
|
1526
1550
|
}
|
|
1527
1551
|
if (haveObject) {
|
|
1528
1552
|
const branched = await git(["branch", "-f", localBranch, oid], repoPath, {
|
|
@@ -1646,8 +1670,28 @@ async function listWorktrees(repoPath) {
|
|
|
1646
1670
|
return entries;
|
|
1647
1671
|
}
|
|
1648
1672
|
async function isDirty(worktreePath) {
|
|
1649
|
-
const { stdout } = await git(["status", "--porcelain"], worktreePath);
|
|
1650
|
-
|
|
1673
|
+
const { stdout } = await git(["status", "--porcelain", "-uall"], worktreePath);
|
|
1674
|
+
for (const line of stdout.split("\n")) {
|
|
1675
|
+
if (!line.trim()) continue;
|
|
1676
|
+
const rel = porcelainStatusPath(line);
|
|
1677
|
+
if (!rel || isSideboardScratchPath(rel)) continue;
|
|
1678
|
+
return true;
|
|
1679
|
+
}
|
|
1680
|
+
return false;
|
|
1681
|
+
}
|
|
1682
|
+
function isSideboardScratchPath(relativePath) {
|
|
1683
|
+
const p = relativePath.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/$/, "");
|
|
1684
|
+
return p === ".sideboard/attachments" || p.startsWith(".sideboard/attachments/");
|
|
1685
|
+
}
|
|
1686
|
+
function porcelainStatusPath(line) {
|
|
1687
|
+
const rest = line.length >= 3 ? line.slice(3) : "";
|
|
1688
|
+
if (!rest) return "";
|
|
1689
|
+
const arrow = rest.lastIndexOf(" -> ");
|
|
1690
|
+
const raw = arrow >= 0 ? rest.slice(arrow + 4) : rest;
|
|
1691
|
+
if (raw.startsWith('"') && raw.endsWith('"')) {
|
|
1692
|
+
return raw.slice(1, -1).replace(/\\([\\"])/g, "$1");
|
|
1693
|
+
}
|
|
1694
|
+
return raw;
|
|
1651
1695
|
}
|
|
1652
1696
|
async function currentBranch(worktreePath) {
|
|
1653
1697
|
const { stdout } = await git(["rev-parse", "--abbrev-ref", "HEAD"], worktreePath);
|
|
@@ -1881,6 +1925,7 @@ export {
|
|
|
1881
1925
|
removeWorktree,
|
|
1882
1926
|
listWorktrees,
|
|
1883
1927
|
isDirty,
|
|
1928
|
+
isSideboardScratchPath,
|
|
1884
1929
|
currentBranch,
|
|
1885
1930
|
commitAll,
|
|
1886
1931
|
pushBranch,
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
} from "./chunk-S2LL5HA4.js";
|
|
6
6
|
import {
|
|
7
7
|
ensureGlobalCoordinatorCwd
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-F4Q3IM6V.js";
|
|
9
9
|
import {
|
|
10
10
|
allocateTeamName,
|
|
11
11
|
takenSlugsFromThread,
|
|
12
12
|
teamSlugFromName
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XRSAGVRW.js";
|
|
14
14
|
import {
|
|
15
15
|
createEmptyThread,
|
|
16
16
|
listThreads,
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
} from "./chunk-M37RITA6.js";
|
|
7
7
|
import {
|
|
8
8
|
gh,
|
|
9
|
-
git
|
|
10
|
-
|
|
9
|
+
git,
|
|
10
|
+
resolveGhAuthToken
|
|
11
|
+
} from "./chunk-7LNGIP3X.js";
|
|
11
12
|
|
|
12
13
|
// src/git/worktree.ts
|
|
13
14
|
import { existsSync, readdirSync } from "fs";
|
|
@@ -1476,18 +1477,31 @@ async function fetchPrHead(repoPath, number, localBranch) {
|
|
|
1476
1477
|
const slug = await resolveGithubRepoSlug(repoPath);
|
|
1477
1478
|
const refspec = `+pull/${number}/head:${localBranch}`;
|
|
1478
1479
|
const errors = [];
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
}
|
|
1480
|
+
const httpsRemote = slug ? `https://github.com/${slug}.git` : null;
|
|
1481
|
+
const tryFetch = async (remote, opts) => {
|
|
1482
|
+
const label = opts?.ghAuth ? `${remote} (gh auth)` : remote;
|
|
1483
|
+
const gitOpts = { reject: false };
|
|
1484
|
+
if (opts?.ghAuth) {
|
|
1485
|
+
const token = await resolveGhAuthToken(repoPath);
|
|
1486
|
+
if (!token) {
|
|
1487
|
+
errors.push(`${label}: gh auth token unavailable`);
|
|
1488
|
+
return false;
|
|
1489
|
+
}
|
|
1490
|
+
gitOpts.env = { GIT_TERMINAL_PROMPT: "0" };
|
|
1491
|
+
gitOpts.config = {
|
|
1492
|
+
"http.extraHeader": `AUTHORIZATION: bearer ${token}`
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
const result = await git(["fetch", remote, refspec], repoPath, gitOpts);
|
|
1483
1496
|
if (result.exitCode === 0) return true;
|
|
1484
1497
|
const detail = (result.stderr || result.stdout).trim();
|
|
1485
|
-
if (detail) errors.push(`${
|
|
1498
|
+
if (detail) errors.push(`${label}: ${detail}`);
|
|
1486
1499
|
return false;
|
|
1487
1500
|
};
|
|
1488
1501
|
let fetched = await tryFetch("origin");
|
|
1489
|
-
if (!fetched &&
|
|
1490
|
-
fetched = await tryFetch(
|
|
1502
|
+
if (!fetched && httpsRemote) {
|
|
1503
|
+
fetched = await tryFetch(httpsRemote);
|
|
1504
|
+
if (!fetched) fetched = await tryFetch(httpsRemote, { ghAuth: true });
|
|
1491
1505
|
}
|
|
1492
1506
|
const localOk = async () => {
|
|
1493
1507
|
const verify = await git(["rev-parse", "--verify", localBranch], repoPath, {
|
|
@@ -1516,18 +1530,28 @@ async function fetchPrHead(repoPath, number, localBranch) {
|
|
|
1516
1530
|
}
|
|
1517
1531
|
}
|
|
1518
1532
|
if (oid) {
|
|
1519
|
-
const ensureOid = async (remote) => {
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1522
|
-
|
|
1533
|
+
const ensureOid = async (remote, opts) => {
|
|
1534
|
+
const gitOpts = { reject: false };
|
|
1535
|
+
if (opts?.ghAuth) {
|
|
1536
|
+
const token = await resolveGhAuthToken(repoPath);
|
|
1537
|
+
if (!token) return false;
|
|
1538
|
+
gitOpts.env = { GIT_TERMINAL_PROMPT: "0" };
|
|
1539
|
+
gitOpts.config = {
|
|
1540
|
+
"http.extraHeader": `AUTHORIZATION: bearer ${token}`
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
const got = await git(["fetch", remote, oid], repoPath, gitOpts);
|
|
1523
1544
|
return got.exitCode === 0;
|
|
1524
1545
|
};
|
|
1525
1546
|
let haveObject = (await git(["cat-file", "-e", `${oid}^{commit}`], repoPath, {
|
|
1526
1547
|
reject: false
|
|
1527
1548
|
})).exitCode === 0;
|
|
1528
1549
|
if (!haveObject) haveObject = await ensureOid("origin");
|
|
1529
|
-
if (!haveObject &&
|
|
1530
|
-
haveObject = await ensureOid(
|
|
1550
|
+
if (!haveObject && httpsRemote) {
|
|
1551
|
+
haveObject = await ensureOid(httpsRemote);
|
|
1552
|
+
if (!haveObject) {
|
|
1553
|
+
haveObject = await ensureOid(httpsRemote, { ghAuth: true });
|
|
1554
|
+
}
|
|
1531
1555
|
}
|
|
1532
1556
|
if (haveObject) {
|
|
1533
1557
|
const branched = await git(["branch", "-f", localBranch, oid], repoPath, {
|
|
@@ -1651,8 +1675,28 @@ async function listWorktrees(repoPath) {
|
|
|
1651
1675
|
return entries;
|
|
1652
1676
|
}
|
|
1653
1677
|
async function isDirty(worktreePath) {
|
|
1654
|
-
const { stdout } = await git(["status", "--porcelain"], worktreePath);
|
|
1655
|
-
|
|
1678
|
+
const { stdout } = await git(["status", "--porcelain", "-uall"], worktreePath);
|
|
1679
|
+
for (const line of stdout.split("\n")) {
|
|
1680
|
+
if (!line.trim()) continue;
|
|
1681
|
+
const rel = porcelainStatusPath(line);
|
|
1682
|
+
if (!rel || isSideboardScratchPath(rel)) continue;
|
|
1683
|
+
return true;
|
|
1684
|
+
}
|
|
1685
|
+
return false;
|
|
1686
|
+
}
|
|
1687
|
+
function isSideboardScratchPath(relativePath) {
|
|
1688
|
+
const p = relativePath.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/$/, "");
|
|
1689
|
+
return p === ".sideboard/attachments" || p.startsWith(".sideboard/attachments/");
|
|
1690
|
+
}
|
|
1691
|
+
function porcelainStatusPath(line) {
|
|
1692
|
+
const rest = line.length >= 3 ? line.slice(3) : "";
|
|
1693
|
+
if (!rest) return "";
|
|
1694
|
+
const arrow = rest.lastIndexOf(" -> ");
|
|
1695
|
+
const raw = arrow >= 0 ? rest.slice(arrow + 4) : rest;
|
|
1696
|
+
if (raw.startsWith('"') && raw.endsWith('"')) {
|
|
1697
|
+
return raw.slice(1, -1).replace(/\\([\\"])/g, "$1");
|
|
1698
|
+
}
|
|
1699
|
+
return raw;
|
|
1656
1700
|
}
|
|
1657
1701
|
async function currentBranch(worktreePath) {
|
|
1658
1702
|
const { stdout } = await git(["rev-parse", "--abbrev-ref", "HEAD"], worktreePath);
|
|
@@ -1890,6 +1934,7 @@ export {
|
|
|
1890
1934
|
removeWorktree,
|
|
1891
1935
|
listWorktrees,
|
|
1892
1936
|
isDirty,
|
|
1937
|
+
isSideboardScratchPath,
|
|
1893
1938
|
currentBranch,
|
|
1894
1939
|
commitAll,
|
|
1895
1940
|
pushBranch,
|
|
@@ -63,15 +63,33 @@ async function run(file, args, opts) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
async function git(args, cwd, opts) {
|
|
66
|
-
|
|
66
|
+
const prefix = [];
|
|
67
|
+
if (opts?.config) {
|
|
68
|
+
for (const [key, value] of Object.entries(opts.config)) {
|
|
69
|
+
if (!key) continue;
|
|
70
|
+
prefix.push("-c", `${key}=${value}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return run("git", [...prefix, ...args], {
|
|
74
|
+
cwd,
|
|
75
|
+
reject: opts?.reject,
|
|
76
|
+
env: opts?.env
|
|
77
|
+
});
|
|
67
78
|
}
|
|
68
79
|
async function gh(args, cwd, opts) {
|
|
69
80
|
return run("gh", args, { cwd, reject: opts?.reject });
|
|
70
81
|
}
|
|
82
|
+
async function resolveGhAuthToken(cwd) {
|
|
83
|
+
const result = await gh(["auth", "token"], cwd, { reject: false });
|
|
84
|
+
if (result.exitCode !== 0) return null;
|
|
85
|
+
const token = result.stdout.trim();
|
|
86
|
+
return token || null;
|
|
87
|
+
}
|
|
71
88
|
|
|
72
89
|
export {
|
|
73
90
|
ensureAgentPath,
|
|
74
91
|
run,
|
|
75
92
|
git,
|
|
76
|
-
gh
|
|
93
|
+
gh,
|
|
94
|
+
resolveGhAuthToken
|
|
77
95
|
};
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
ensureConnectedBrightsyTeamTokens,
|
|
10
10
|
getConnectedBrightsyTeamsRaw,
|
|
11
11
|
listConnectedBrightsyTeams
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-H6GGDLYS.js";
|
|
13
|
+
import "./chunk-ZNM4MAN4.js";
|
|
14
14
|
import "./chunk-7MV3RXSC.js";
|
|
15
15
|
export {
|
|
16
16
|
applyConnectedTeamToCli,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
ensureConnectedBrightsyTeamTokens,
|
|
8
8
|
getConnectedBrightsyTeamsRaw,
|
|
9
9
|
listConnectedBrightsyTeams
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BXJ76RHF.js";
|
|
11
11
|
import "./chunk-M37RITA6.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-7LNGIP3X.js";
|
|
13
13
|
export {
|
|
14
14
|
applyConnectedTeamToCli,
|
|
15
15
|
brightsyMcpServerName,
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
enrichWorkspacesWithGithub,
|
|
9
9
|
ensureGlobalCoordinatorCwd,
|
|
10
10
|
formatWorkspaceInventory
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-F4Q3IM6V.js";
|
|
12
|
+
import "./chunk-XRSAGVRW.js";
|
|
13
13
|
import "./chunk-EOYDCKQC.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-ZNM4MAN4.js";
|
|
15
15
|
import "./chunk-KGZBYWZ3.js";
|
|
16
16
|
import "./chunk-7MV3RXSC.js";
|
|
17
17
|
export {
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
enrichWorkspacesWithGithub,
|
|
7
7
|
ensureGlobalCoordinatorCwd,
|
|
8
8
|
formatWorkspaceInventory
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-K3WMKGFY.js";
|
|
10
|
+
import "./chunk-ZH5QZ4CR.js";
|
|
11
11
|
import "./chunk-O6W3P7V3.js";
|
|
12
12
|
import "./chunk-77WWLBCI.js";
|
|
13
13
|
import "./chunk-M37RITA6.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-7LNGIP3X.js";
|
|
15
15
|
export {
|
|
16
16
|
COORDINATOR_TOOL_PLAYBOOK,
|
|
17
17
|
coordinatorGreenfieldPlaybook,
|
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
orchestrationTitleNeedsSoccerNickname,
|
|
12
12
|
orchestratorSessionPoisonedByBuiltins,
|
|
13
13
|
takenTeamSlugsForOrchestration
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-O5DOO7DP.js";
|
|
15
15
|
import "./chunk-GI7E5733.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-K3WMKGFY.js";
|
|
17
|
+
import "./chunk-ZH5QZ4CR.js";
|
|
18
18
|
import "./chunk-O6W3P7V3.js";
|
|
19
19
|
import "./chunk-77WWLBCI.js";
|
|
20
20
|
import {
|
|
21
21
|
globalAgentCwd
|
|
22
22
|
} from "./chunk-M37RITA6.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-7LNGIP3X.js";
|
|
24
24
|
export {
|
|
25
25
|
GLOBAL_WORKSPACE_ID,
|
|
26
26
|
createGlobalChat,
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
orchestrationTitleNeedsSoccerNickname,
|
|
14
14
|
orchestratorSessionPoisonedByBuiltins,
|
|
15
15
|
takenTeamSlugsForOrchestration
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YFJ4FG2P.js";
|
|
17
17
|
import "./chunk-S2LL5HA4.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-F4Q3IM6V.js";
|
|
19
|
+
import "./chunk-XRSAGVRW.js";
|
|
20
20
|
import "./chunk-EOYDCKQC.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-ZNM4MAN4.js";
|
|
22
22
|
import "./chunk-KGZBYWZ3.js";
|
|
23
23
|
import {
|
|
24
24
|
globalAgentCwd
|