@sideboard-ai/core 0.1.77 → 0.1.79

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-XJV6J3K2.js → agents-EWPHOM6Y.js} +6 -6
  2. package/dist/{agents-LKUHPPEQ.js → agents-GRAPUXWW.js} +5 -5
  3. package/dist/{app-settings-3TLA2EJ7.js → app-settings-6IOQYGBK.js} +7 -1
  4. package/dist/{app-settings-P42Z3VOB.js → app-settings-NILNWNNQ.js} +7 -1
  5. package/dist/{chunk-VERLUKN2.js → chunk-5LXWTU3J.js} +6 -6
  6. package/dist/{chunk-2ZIPJRJE.js → chunk-5VTWBI3I.js} +2 -2
  7. package/dist/{chunk-GWTLKXXP.js → chunk-6T2SKGCS.js} +3 -3
  8. package/dist/{chunk-OE7YBB5X.js → chunk-FUUVPN4A.js} +108 -3
  9. package/dist/{chunk-EEKSZTMU.js → chunk-HCGEFU3J.js} +5 -5
  10. package/dist/{chunk-XJNCWYFR.js → chunk-HSLQXL6M.js} +3 -3
  11. package/dist/{chunk-W7YOTDVO.js → chunk-IFPN6TER.js} +47 -2
  12. package/dist/{chunk-2FJI5JXX.js → chunk-P33ZQ7ZC.js} +3 -3
  13. package/dist/{chunk-75U65MBE.js → chunk-PW5YHHP3.js} +2 -2
  14. package/dist/{chunk-QD37IILI.js → chunk-SHCR6RPU.js} +3 -3
  15. package/dist/{chunk-PTJJIQK7.js → chunk-XKNBSYA7.js} +47 -2
  16. package/dist/{chunk-MF2YMEGD.js → chunk-YVVXWWCC.js} +110 -3
  17. package/dist/{coordinator-prompt-LLFJUO2R.js → coordinator-prompt-2OVON2LQ.js} +4 -4
  18. package/dist/{coordinator-prompt-MRCMMRSF.js → coordinator-prompt-K2R34A5T.js} +3 -3
  19. package/dist/{global-workspace-TWHMYLTZ.js → global-workspace-RI367AM6.js} +4 -4
  20. package/dist/{global-workspace-YNMNO4CL.js → global-workspace-VG44RZUH.js} +5 -5
  21. package/dist/index.cjs +500 -178
  22. package/dist/index.d.cts +83 -8
  23. package/dist/index.d.ts +83 -8
  24. package/dist/index.js +344 -179
  25. package/dist/mcp/run-stdio.cjs +2439 -2228
  26. package/dist/mcp/run-stdio.js +156 -100
  27. package/dist/{workspaces-GQ4XKBD3.js → workspaces-BQWQEZWE.js} +5 -5
  28. package/dist/{workspaces-O3U5BENH.js → workspaces-TYPJNUSM.js} +6 -6
  29. package/dist/{worktree-VOCH3WS3.js → worktree-5VLLFI5W.js} +5 -1
  30. package/dist/{worktree-KWXHMKRN.js → worktree-UNSOCYZU.js} +5 -1
  31. package/package.json +1 -1
@@ -172,6 +172,9 @@ function normalizeVault(raw) {
172
172
  if (typeof raw.slackAppToken === "string" && raw.slackAppToken.trim()) {
173
173
  out.slackAppToken = raw.slackAppToken.trim();
174
174
  }
175
+ if (typeof raw.githubPat === "string" && raw.githubPat.trim()) {
176
+ out.githubPat = raw.githubPat.trim();
177
+ }
175
178
  if (raw.environment && typeof raw.environment === "object") {
176
179
  const environment = {};
177
180
  for (const [key, value] of Object.entries(raw.environment)) {
@@ -199,6 +202,7 @@ var DEFAULT_AGENTS = /* @__PURE__ */ new Set([
199
202
  "brightsy",
200
203
  "cursor"
201
204
  ]);
205
+ var GITHUB_GIT_AUTH_MODES = ["auto", "gh", "ssh", "token"];
202
206
  function hasLinearOAuth(integrations) {
203
207
  return Boolean(
204
208
  integrations.linearAccessToken?.trim() || integrations.linearRefreshToken?.trim()
@@ -215,12 +219,14 @@ function toPublicAppSettings(settings) {
215
219
  const integrations = { ...settings.integrations };
216
220
  const slackClientSecret = integrations.slackClientSecret;
217
221
  const slackAppToken = integrations.slackAppToken;
222
+ const githubPat = integrations.githubPat;
218
223
  delete integrations.linearApiKey;
219
224
  delete integrations.linearAccessToken;
220
225
  delete integrations.linearRefreshToken;
221
226
  delete integrations.linearClientSecret;
222
227
  delete integrations.slackClientSecret;
223
228
  delete integrations.slackAppToken;
229
+ delete integrations.githubPat;
224
230
  return {
225
231
  ...settings,
226
232
  environment,
@@ -229,7 +235,8 @@ function toPublicAppSettings(settings) {
229
235
  hasLinearApiKey: hasLinearCredentials(settings.integrations),
230
236
  hasLinearOAuth: hasLinearOAuth(settings.integrations),
231
237
  hasSlackClientSecret: Boolean(slackClientSecret?.trim()),
232
- hasSlackAppToken: Boolean(slackAppToken?.trim())
238
+ hasSlackAppToken: Boolean(slackAppToken?.trim()),
239
+ hasGithubPat: Boolean(githubPat?.trim())
233
240
  }
234
241
  };
235
242
  }
@@ -288,6 +295,7 @@ function normalizeBrightsy(raw) {
288
295
  return out;
289
296
  }
290
297
  var ISSUE_SOURCES = /* @__PURE__ */ new Set(["linear", "github"]);
298
+ var GIT_AUTH_MODES = new Set(GITHUB_GIT_AUTH_MODES);
291
299
  function normalizeIntegrations(raw) {
292
300
  if (!raw || typeof raw !== "object") return {};
293
301
  const source = raw;
@@ -352,6 +360,13 @@ function normalizeIntegrations(raw) {
352
360
  const label = source.slackDeviceLabel.trim().slice(0, 64);
353
361
  if (label) out.slackDeviceLabel = label;
354
362
  }
363
+ if (typeof source.githubGitAuthMode === "string" && GIT_AUTH_MODES.has(source.githubGitAuthMode)) {
364
+ out.githubGitAuthMode = source.githubGitAuthMode;
365
+ }
366
+ if (typeof source.githubPat === "string") {
367
+ const pat = source.githubPat.trim();
368
+ if (pat) out.githubPat = pat;
369
+ }
355
370
  return out;
356
371
  }
357
372
  function normalizeDefaults(raw) {
@@ -501,7 +516,7 @@ function readSettingsFile() {
501
516
  }
502
517
  function diskHoldsSecrets(disk) {
503
518
  return Boolean(
504
- disk.integrations.linearApiKey || disk.integrations.linearAccessToken || disk.integrations.linearRefreshToken || disk.integrations.linearClientSecret || disk.integrations.slackClientSecret || disk.integrations.slackAppToken || Object.keys(disk.environment).length > 0
519
+ disk.integrations.linearApiKey || disk.integrations.linearAccessToken || disk.integrations.linearRefreshToken || disk.integrations.linearClientSecret || disk.integrations.slackClientSecret || disk.integrations.slackAppToken || disk.integrations.githubPat || Object.keys(disk.environment).length > 0
505
520
  );
506
521
  }
507
522
  function mergeVault(disk) {
@@ -526,6 +541,9 @@ function mergeVault(disk) {
526
541
  if (vault.slackAppToken && !integrations.slackAppToken) {
527
542
  integrations.slackAppToken = vault.slackAppToken;
528
543
  }
544
+ if (vault.githubPat && !integrations.githubPat) {
545
+ integrations.githubPat = vault.githubPat;
546
+ }
529
547
  return { ...disk, environment, integrations };
530
548
  }
531
549
  function persistSplit(settings) {
@@ -536,12 +554,14 @@ function persistSplit(settings) {
536
554
  const linearClientSecret = integrations.linearClientSecret;
537
555
  const slackClientSecret = integrations.slackClientSecret;
538
556
  const slackAppToken = integrations.slackAppToken;
557
+ const githubPat = integrations.githubPat;
539
558
  delete integrations.linearApiKey;
540
559
  delete integrations.linearAccessToken;
541
560
  delete integrations.linearRefreshToken;
542
561
  delete integrations.linearClientSecret;
543
562
  delete integrations.slackClientSecret;
544
563
  delete integrations.slackAppToken;
564
+ delete integrations.githubPat;
545
565
  writePrivateFile(
546
566
  appSettingsPath(),
547
567
  `${JSON.stringify({ ...settings, environment: {}, integrations }, null, 2)}
@@ -554,6 +574,7 @@ function persistSplit(settings) {
554
574
  linearClientSecret,
555
575
  slackClientSecret,
556
576
  slackAppToken,
577
+ githubPat,
557
578
  environment: settings.environment
558
579
  });
559
580
  }
@@ -719,6 +740,20 @@ function updateIntegrationsSettings(patch) {
719
740
  integrations.slackDeviceLabel = patch.slackDeviceLabel.trim().slice(0, 64);
720
741
  }
721
742
  }
743
+ if ("githubGitAuthMode" in patch) {
744
+ if (patch.githubGitAuthMode == null) {
745
+ delete integrations.githubGitAuthMode;
746
+ } else if (GIT_AUTH_MODES.has(patch.githubGitAuthMode)) {
747
+ integrations.githubGitAuthMode = patch.githubGitAuthMode;
748
+ }
749
+ }
750
+ if ("githubPat" in patch) {
751
+ if (patch.githubPat == null || patch.githubPat.trim() === "") {
752
+ delete integrations.githubPat;
753
+ } else {
754
+ integrations.githubPat = patch.githubPat.trim();
755
+ }
756
+ }
722
757
  return saveAppSettings({ ...current, integrations });
723
758
  }
724
759
  function updateDefaultsSettings(patch) {
@@ -826,6 +861,13 @@ function disconnectLinearConnection() {
826
861
  function getIssueSource(settings = loadAppSettings()) {
827
862
  return settings.integrations.issueSource ?? "github";
828
863
  }
864
+ function getGithubGitAuthMode(settings = loadAppSettings()) {
865
+ return settings.integrations.githubGitAuthMode ?? "auto";
866
+ }
867
+ function getGithubPat(settings = loadAppSettings()) {
868
+ const pat = settings.integrations.githubPat?.trim();
869
+ return pat || null;
870
+ }
829
871
  function resolveEffectiveIssueSource(settings = loadAppSettings()) {
830
872
  const preferred = getIssueSource(settings);
831
873
  if (preferred === "linear" && !isLinearConnected(settings)) return "github";
@@ -1039,6 +1081,7 @@ export {
1039
1081
  writeSecureJson,
1040
1082
  isSecureFileEncrypted,
1041
1083
  HARNESS_ENV_KEYS,
1084
+ GITHUB_GIT_AUTH_MODES,
1042
1085
  toPublicAppSettings,
1043
1086
  appSettingsPath,
1044
1087
  claudeUserSettingsPath,
@@ -1061,6 +1104,8 @@ export {
1061
1104
  saveLinearOAuth,
1062
1105
  disconnectLinearConnection,
1063
1106
  getIssueSource,
1107
+ getGithubGitAuthMode,
1108
+ getGithubPat,
1064
1109
  resolveEffectiveIssueSource,
1065
1110
  getLinearApiKey,
1066
1111
  brightsyCloudConnectEnabled,
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  isWorkspaceScratchPath
3
3
  } from "./chunk-FKOIHGKV.js";
4
+ import {
5
+ getGithubGitAuthMode,
6
+ getGithubPat
7
+ } from "./chunk-IFPN6TER.js";
4
8
  import {
5
9
  listThreads
6
10
  } from "./chunk-FWJYLBO6.js";
@@ -886,6 +890,74 @@ function formatIpcInvokeError(err) {
886
890
  return formatGhLandError(msg);
887
891
  }
888
892
 
893
+ // src/git/git-auth-mode.ts
894
+ var HTTPS_REWRITE = [
895
+ { key: "url.https://github.com/.insteadOf", value: "git@github.com:" },
896
+ { key: "url.https://github.com/.insteadOf", value: "ssh://git@github.com/" },
897
+ { key: "credential.https://github.com.helper", value: "!gh auth git-credential" }
898
+ ];
899
+ function appendIndexedGitConfig(existing, entries) {
900
+ const start = Number.parseInt(String(existing?.GIT_CONFIG_COUNT ?? "0"), 10);
901
+ const count = Number.isFinite(start) && start > 0 ? start : 0;
902
+ const out = {};
903
+ entries.forEach((entry, i) => {
904
+ const n = count + i;
905
+ out[`GIT_CONFIG_KEY_${n}`] = entry.key;
906
+ out[`GIT_CONFIG_VALUE_${n}`] = entry.value;
907
+ });
908
+ out.GIT_CONFIG_COUNT = String(count + entries.length);
909
+ return out;
910
+ }
911
+ function githubAgentGitEnv(existing) {
912
+ return appendIndexedGitConfig(existing, HTTPS_REWRITE);
913
+ }
914
+ function applyGithubGitAuthEnv(existing, opts) {
915
+ const out = {};
916
+ if (opts.mode === "gh" || opts.mode === "token") {
917
+ Object.assign(out, githubAgentGitEnv(existing));
918
+ }
919
+ if (opts.mode === "token") {
920
+ const token = opts.token?.trim();
921
+ if (token && !existing?.GH_TOKEN?.trim()) {
922
+ out.GH_TOKEN = token;
923
+ }
924
+ }
925
+ return out;
926
+ }
927
+ function formatGitAuthModeDirective(mode) {
928
+ switch (mode) {
929
+ case "gh":
930
+ return [
931
+ "Git authentication (Account \u2192 GitHub mode: gh CLI):",
932
+ "- This process rewrites `git@github.com:` and `ssh://git@github.com/` to HTTPS.",
933
+ "- `gh` supplies credentials (`gh auth git-credential`). Do not switch remotes to SSH.",
934
+ "- Push with `git push -u origin HEAD`. Create/update PRs with `gh` as below."
935
+ ].join("\n");
936
+ case "ssh":
937
+ return [
938
+ "Git authentication (Account \u2192 GitHub mode: SSH):",
939
+ "- Keep SSH remotes (`git@github.com:\u2026`). Do not rewrite them to HTTPS.",
940
+ "- Use this Mac\u2019s SSH agent / keys. If push fails with `Permission denied (publickey)`, tell the user to start ssh-agent or switch Account \u2192 GitHub to Auto / gh CLI \u2014 do not rewrite remotes yourself.",
941
+ "- Push with `git push -u origin HEAD`. Create/update PRs with `gh` as below (API still uses `gh`)."
942
+ ].join("\n");
943
+ case "token":
944
+ return [
945
+ "Git authentication (Account \u2192 GitHub mode: personal access token):",
946
+ "- This process rewrites GitHub SSH remotes to HTTPS.",
947
+ "- `GH_TOKEN` is set in the environment. Use HTTPS git and `gh`; do not paste the token into commands or chat.",
948
+ "- Push with `git push -u origin HEAD`. Create/update PRs with `gh` as below."
949
+ ].join("\n");
950
+ case "auto":
951
+ default:
952
+ return [
953
+ "Git authentication (Account \u2192 GitHub mode: auto):",
954
+ "- Prefer the existing remote URL (SSH or HTTPS). Do not rewrite remotes unless a push/fetch fails.",
955
+ '- If `git push` fails with `Permission denied (publickey)`, this shell has no ssh-agent. Retry over HTTPS (do not stop): `git -c url.https://github.com/.insteadOf=git@github.com: -c http.extraHeader="AUTHORIZATION: bearer $(gh auth token)" push -u origin HEAD`.',
956
+ "- Then create/update the PR with `gh` as below."
957
+ ].join("\n");
958
+ }
959
+ }
960
+
889
961
  // src/git/pr-gates.ts
890
962
  function prIsInMergeQueue(gate) {
891
963
  if (gate.isInMergeQueue) return true;
@@ -1286,10 +1358,15 @@ ${view.stderr}`;
1286
1358
  timeoutMs: 15e3
1287
1359
  });
1288
1360
  }
1289
- async function originGhRepoEnv(cwd) {
1361
+ async function originGhRepoEnv(cwd, opts) {
1290
1362
  await ensureGhPreferOrigin(cwd);
1291
1363
  const slug = await resolveGithubRepoSlug(cwd);
1292
- return slug ? { GH_REPO: slug } : {};
1364
+ const mode = opts?.mode ?? getGithubGitAuthMode();
1365
+ const token = mode === "token" ? getGithubPat() : null;
1366
+ return {
1367
+ ...applyGithubGitAuthEnv(opts?.env, { mode, token }),
1368
+ ...slug ? { GH_REPO: slug } : {}
1369
+ };
1293
1370
  }
1294
1371
  async function resolveDefaultBranch(repoPath, opts) {
1295
1372
  const viaOrigin = await git(
@@ -2038,7 +2115,33 @@ async function commitAll(worktreePath, message) {
2038
2115
  return true;
2039
2116
  }
2040
2117
  async function pushBranch(worktreePath, branchName) {
2041
- await git(["push", "-u", "origin", branchName], worktreePath);
2118
+ const ssh = await git(["push", "-u", "origin", branchName], worktreePath, {
2119
+ reject: false
2120
+ });
2121
+ if (ssh.exitCode === 0) return;
2122
+ const sshErr = (ssh.stderr || ssh.stdout).trim();
2123
+ const slug = await resolveGithubRepoSlug(worktreePath);
2124
+ const token = await resolveGhAuthToken(worktreePath);
2125
+ if (!slug || !token) {
2126
+ throw new Error(
2127
+ sshErr || `git push origin ${branchName} failed` + (!token ? " (no SSH agent and gh auth token unavailable \u2014 run: gh auth login)" : "")
2128
+ );
2129
+ }
2130
+ const tryHttps = async (header) => git(["push", "-u", "origin", branchName], worktreePath, {
2131
+ reject: false,
2132
+ env: { GIT_TERMINAL_PROMPT: "0" },
2133
+ config: {
2134
+ "url.https://github.com/.insteadOf": "git@github.com:",
2135
+ "http.extraHeader": header
2136
+ }
2137
+ });
2138
+ const bearer = await tryHttps(`AUTHORIZATION: bearer ${token}`);
2139
+ if (bearer.exitCode === 0) return;
2140
+ const basic = Buffer.from(`x-access-token:${token}`, "utf8").toString("base64");
2141
+ const basicPush = await tryHttps(`Authorization: Basic ${basic}`);
2142
+ if (basicPush.exitCode === 0) return;
2143
+ const httpsErr = (basicPush.stderr || bearer.stderr || bearer.stdout).trim();
2144
+ throw new Error(httpsErr || sshErr || `git push origin ${branchName} failed`);
2042
2145
  }
2043
2146
  async function mergePr(cwd, selector, opts) {
2044
2147
  const slug = await resolveGithubRepoSlug(cwd);
@@ -2251,6 +2354,10 @@ export {
2251
2354
  extractGhErrorDetail,
2252
2355
  formatGhLandError,
2253
2356
  formatIpcInvokeError,
2357
+ appendIndexedGitConfig,
2358
+ githubAgentGitEnv,
2359
+ applyGithubGitAuthEnv,
2360
+ formatGitAuthModeDirective,
2254
2361
  detectGhStack,
2255
2362
  resetGhStackDetectCache,
2256
2363
  parseGhStackViewJson,
@@ -7,11 +7,11 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-EEKSZTMU.js";
11
- import "./chunk-W7YOTDVO.js";
12
- import "./chunk-JT7R45JB.js";
13
- import "./chunk-MF2YMEGD.js";
10
+ } from "./chunk-HCGEFU3J.js";
11
+ import "./chunk-YVVXWWCC.js";
14
12
  import "./chunk-FKOIHGKV.js";
13
+ import "./chunk-IFPN6TER.js";
14
+ import "./chunk-JT7R45JB.js";
15
15
  import "./chunk-FWJYLBO6.js";
16
16
  import "./chunk-77WWLBCI.js";
17
17
  import "./chunk-M37RITA6.js";
@@ -9,12 +9,12 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-XJNCWYFR.js";
13
- import "./chunk-OE7YBB5X.js";
12
+ } from "./chunk-HSLQXL6M.js";
13
+ import "./chunk-FUUVPN4A.js";
14
14
  import "./chunk-B3SJXYIJ.js";
15
15
  import "./chunk-7FD7COKE.js";
16
16
  import "./chunk-AE5VBOFE.js";
17
- import "./chunk-PTJJIQK7.js";
17
+ import "./chunk-XKNBSYA7.js";
18
18
  import "./chunk-NSTQ6QKD.js";
19
19
  import "./chunk-KGZBYWZ3.js";
20
20
  import "./chunk-7MV3RXSC.js";
@@ -16,13 +16,13 @@ import {
16
16
  orchestratorSessionPoisonedByBuiltins,
17
17
  slackCoordinatorSourceRef,
18
18
  takenTeamSlugsForOrchestration
19
- } from "./chunk-GWTLKXXP.js";
20
- import "./chunk-XJNCWYFR.js";
21
- import "./chunk-OE7YBB5X.js";
19
+ } from "./chunk-6T2SKGCS.js";
20
+ import "./chunk-HSLQXL6M.js";
21
+ import "./chunk-FUUVPN4A.js";
22
22
  import "./chunk-B3SJXYIJ.js";
23
23
  import "./chunk-7FD7COKE.js";
24
24
  import "./chunk-AE5VBOFE.js";
25
- import "./chunk-PTJJIQK7.js";
25
+ import "./chunk-XKNBSYA7.js";
26
26
  import "./chunk-NSTQ6QKD.js";
27
27
  import "./chunk-KGZBYWZ3.js";
28
28
  import {
@@ -14,12 +14,12 @@ import {
14
14
  orchestratorSessionPoisonedByBuiltins,
15
15
  slackCoordinatorSourceRef,
16
16
  takenTeamSlugsForOrchestration
17
- } from "./chunk-VERLUKN2.js";
18
- import "./chunk-EEKSZTMU.js";
19
- import "./chunk-W7YOTDVO.js";
20
- import "./chunk-JT7R45JB.js";
21
- import "./chunk-MF2YMEGD.js";
17
+ } from "./chunk-5LXWTU3J.js";
18
+ import "./chunk-HCGEFU3J.js";
19
+ import "./chunk-YVVXWWCC.js";
22
20
  import "./chunk-FKOIHGKV.js";
21
+ import "./chunk-IFPN6TER.js";
22
+ import "./chunk-JT7R45JB.js";
23
23
  import "./chunk-FWJYLBO6.js";
24
24
  import "./chunk-77WWLBCI.js";
25
25
  import {