@staff0rd/assist 0.934.4 → 0.935.0

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/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.934.4",
9
+ version: "0.935.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -654,6 +654,16 @@ function getCurrentOrigin(cwd) {
654
654
  return resolveCurrentOrigin(cwd).origin;
655
655
  }
656
656
 
657
+ // src/commands/backlog/getCachedOrigin.ts
658
+ var stableOrigins = /* @__PURE__ */ new Map();
659
+ function getCachedOrigin(cwd) {
660
+ const cached = stableOrigins.get(cwd);
661
+ if (cached !== void 0) return cached;
662
+ const { origin, stable } = resolveCurrentOrigin(cwd);
663
+ if (stable) stableOrigins.set(cwd, origin);
664
+ return origin;
665
+ }
666
+
657
667
  // src/shared/readRepoConfigCache.ts
658
668
  import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
659
669
  import { join as join6 } from "path";
@@ -770,7 +780,7 @@ function resolveRepoLayer(globalRaw, cwd) {
770
780
  const cached = { repos: readRepoConfigCache() };
771
781
  if (Object.keys(cached.repos).length === 0 && !globalRaw.repos)
772
782
  return { override: {} };
773
- const origin = getCurrentOrigin(cwd);
783
+ const origin = getCachedOrigin(cwd);
774
784
  const dbKey = matchRepoConfigKey(cached, origin, SHARED_REPO_CONFIG_SOURCE);
775
785
  if (dbKey !== void 0)
776
786
  return {
@@ -12113,10 +12123,10 @@ function gitInvocation(cwd, args) {
12113
12123
  }
12114
12124
  };
12115
12125
  }
12116
- function git2(cwd, args) {
12126
+ function git2(cwd, args, timeout) {
12117
12127
  const { file, argv, options: options2 } = gitInvocation(cwd, args);
12118
12128
  return new Promise((resolve31, reject) => {
12119
- execFile10(file, argv, options2, (error, stdout) => {
12129
+ execFile10(file, argv, { ...options2, timeout }, (error, stdout) => {
12120
12130
  if (error) reject(error);
12121
12131
  else resolve31(stdout.toString());
12122
12132
  });
@@ -12129,9 +12139,9 @@ async function gitOrNull(cwd, args) {
12129
12139
  return null;
12130
12140
  }
12131
12141
  }
12132
- async function gitResult(cwd, args) {
12142
+ async function gitResult(cwd, args, timeout) {
12133
12143
  try {
12134
- return { ok: true, out: (await git2(cwd, args)).trim() };
12144
+ return { ok: true, out: (await git2(cwd, args, timeout)).trim() };
12135
12145
  } catch (error) {
12136
12146
  return {
12137
12147
  ok: false,
@@ -16493,17 +16503,17 @@ import chalk67 from "chalk";
16493
16503
 
16494
16504
  // src/commands/sessions/daemon/worktree/cloneHead.ts
16495
16505
  function cloneHead(clone) {
16496
- return gitSyncOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
16506
+ return gitOrNull(clone, ["symbolic-ref", "--short", "HEAD"]);
16497
16507
  }
16498
16508
 
16499
16509
  // src/commands/sessions/daemon/worktree/remoteDefaultBranch.ts
16500
- function remoteDefaultBranch(clone) {
16501
- const head = gitSyncOrNull(clone, [
16510
+ async function remoteDefaultBranch(clone) {
16511
+ const head = await gitOrNull(clone, [
16502
16512
  "symbolic-ref",
16503
16513
  "--short",
16504
16514
  "refs/remotes/origin/HEAD"
16505
16515
  ]);
16506
- if (!head) return cloneHead(clone) ?? "main";
16516
+ if (!head) return await cloneHead(clone) ?? "main";
16507
16517
  const slash = head.indexOf("/");
16508
16518
  return slash === -1 ? head : head.slice(slash + 1);
16509
16519
  }
@@ -27555,7 +27565,7 @@ function registerRefineLaunch(program, resumeFlag) {
27555
27565
  import { randomUUID as randomUUID12 } from "crypto";
27556
27566
 
27557
27567
  // src/commands/review/checkoutPr.ts
27558
- import { execFileSync as execFileSync19 } from "child_process";
27568
+ import { execFileSync as execFileSync18 } from "child_process";
27559
27569
 
27560
27570
  // src/commands/review/clearStalePrBranch.ts
27561
27571
  var tipSetFromRemote = /^branch: (Created from|Reset to)|^fetch\b|: Fast-forward$/;
@@ -27614,22 +27624,6 @@ function recentDaemonLogLines(includeRelayed = true) {
27614
27624
  import { existsSync as existsSync60 } from "fs";
27615
27625
  import { basename as basename19, dirname as dirname32 } from "path";
27616
27626
 
27617
- // src/commands/watch/fetchQuietly.ts
27618
- import { execFileSync as execFileSync16 } from "child_process";
27619
- var MIN_FETCH_TIMEOUT_MS = 6e4;
27620
- function fetchQuietly(cwd, intervalMs) {
27621
- try {
27622
- execFileSync16("git", ["fetch", "--quiet"], {
27623
- stdio: ["pipe", "pipe", "pipe"],
27624
- cwd,
27625
- timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
27626
- });
27627
- return void 0;
27628
- } catch (error) {
27629
- return error instanceof Error ? error.message : String(error);
27630
- }
27631
- }
27632
-
27633
27627
  // src/commands/sessions/daemon/worktree/nextWorktreePath.ts
27634
27628
  import { basename as basename18, join as join72 } from "path";
27635
27629
  function nextWorktreePath(clone, base, isTaken) {
@@ -27642,31 +27636,42 @@ function nextWorktreePath(clone, base, isTaken) {
27642
27636
  }
27643
27637
 
27644
27638
  // src/commands/sessions/daemon/worktree/worktreeStartPoint.ts
27645
- function worktreeStartPoint(clone, trunk) {
27646
- const branch2 = trunk ? cloneTrunkBranch(clone) : remoteDefaultBranch(clone);
27639
+ async function worktreeStartPoint(clone, trunk) {
27640
+ const branch2 = trunk ? await cloneTrunkBranch(clone) : await remoteDefaultBranch(clone);
27647
27641
  const ref = `origin/${branch2}`;
27648
- if (gitSyncOrNull(clone, ["rev-parse", "--verify", "--quiet", ref]))
27642
+ if (await gitOrNull(clone, ["rev-parse", "--verify", "--quiet", ref]))
27649
27643
  return { ref, track: trunk };
27650
27644
  return { ref: "HEAD", track: false };
27651
27645
  }
27652
- function cloneTrunkBranch(clone) {
27653
- return cloneHead(clone) ?? remoteDefaultBranch(clone);
27646
+ async function cloneTrunkBranch(clone) {
27647
+ return await cloneHead(clone) ?? remoteDefaultBranch(clone);
27654
27648
  }
27655
27649
 
27656
27650
  // src/commands/sessions/daemon/worktree/createWorktree.ts
27651
+ var FETCH_TIMEOUT_MS = 6e4;
27657
27652
  function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
27658
27653
  const base = strategy.root ? expandTilde(strategy.root) : dirname32(clone);
27659
27654
  const registered = new Set(listWorktreePaths(clone));
27660
27655
  const branches = new Set(listLocalBranches(clone));
27661
27656
  const isTaken = (candidate) => registered.has(candidate) || existsSync60(candidate) || boundTreeRoots2.has(candidate) || branches.has(basename19(candidate));
27662
27657
  const path108 = preferredPath && !isTaken(preferredPath) ? preferredPath : nextWorktreePath(clone, base, isTaken);
27663
- const fetchError = fetchQuietly(clone, 0);
27664
- if (fetchError)
27658
+ const ready = addWorktree(clone, path108, strategy.trunk);
27659
+ ready.catch(() => {
27660
+ });
27661
+ return { path: path108, ready };
27662
+ }
27663
+ async function addWorktree(clone, path108, trunk) {
27664
+ const fetched = await gitResult(
27665
+ clone,
27666
+ ["fetch", "--quiet"],
27667
+ FETCH_TIMEOUT_MS
27668
+ );
27669
+ if (!fetched.ok)
27665
27670
  daemonLog(
27666
- `fetch before allocating a worktree for clone ${clone} failed, branching off local refs: ${fetchError}`
27671
+ `fetch before allocating a worktree for clone ${clone} failed, branching off local refs: ${fetched.error}`
27667
27672
  );
27668
- const start2 = worktreeStartPoint(clone, strategy.trunk);
27669
- gitSync(clone, [
27673
+ const start2 = await worktreeStartPoint(clone, trunk);
27674
+ await git2(clone, [
27670
27675
  "worktree",
27671
27676
  "add",
27672
27677
  start2.track ? "--track" : "--no-track",
@@ -27675,11 +27680,10 @@ function createWorktree(clone, strategy, boundTreeRoots2, preferredPath) {
27675
27680
  path108,
27676
27681
  start2.ref
27677
27682
  ]);
27678
- recordWorktree(path108, clone, getCurrentOrigin(clone));
27683
+ recordWorktree(path108, clone, getCachedOrigin(clone));
27679
27684
  daemonLog(
27680
27685
  start2.track ? `worktree allocated ${path108} (branch ${basename19(path108)} tracking ${start2.ref}) for clone ${clone}` : `worktree allocated ${path108} (branch ${basename19(path108)} off ${start2.ref}, no mainline tracking) for clone ${clone}`
27681
27686
  );
27682
- return path108;
27683
27687
  }
27684
27688
 
27685
27689
  // src/commands/sessions/daemon/worktree/keptInTree.ts
@@ -27723,7 +27727,7 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
27723
27727
  `worktree.enabled is off for ${repoRoot2}, so every session shares this tree`
27724
27728
  );
27725
27729
  const clone = canonicalTreePath(mainWorktree(repoRoot2) ?? repoRoot2);
27726
- const path108 = createWorktree(
27730
+ const { path: path108, ready } = createWorktree(
27727
27731
  clone,
27728
27732
  { root: cfg.root, trunk: cfg.trunk },
27729
27733
  boundTreeRoots2,
@@ -27732,7 +27736,7 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
27732
27736
  daemonLog(
27733
27737
  `session spilled out of the clone ${clone} into ${path108}: worktree.enabled is on, so every session gets its own worktree`
27734
27738
  );
27735
- return { cwd: path108, kind: "worktree", created: true, clone };
27739
+ return { cwd: path108, kind: "worktree", created: true, clone, ready };
27736
27740
  }
27737
27741
 
27738
27742
  // src/commands/sessions/daemon/describePersistedSession.ts
@@ -28099,6 +28103,7 @@ async function moveToPrCheckoutTree() {
28099
28103
  const from = process.cwd();
28100
28104
  const alloc = allocateTree(from, persistedTreeRoots());
28101
28105
  if (!alloc.cwd || alloc.cwd === from) return;
28106
+ await alloc.ready;
28102
28107
  process.chdir(alloc.cwd);
28103
28108
  console.log(`Checking the PR out in ${alloc.cwd}`);
28104
28109
  appendDaemonLog(`pr checkout placed in ${alloc.cwd} (invoked from ${from})`);
@@ -28159,13 +28164,13 @@ function prCliCommands(number, cwd) {
28159
28164
  }
28160
28165
 
28161
28166
  // src/commands/review/prHeadBranch.ts
28162
- import { execFileSync as execFileSync17 } from "child_process";
28167
+ import { execFileSync as execFileSync16 } from "child_process";
28163
28168
  function prHeadBranch({
28164
28169
  headBranch
28165
28170
  }) {
28166
28171
  try {
28167
28172
  return headBranch.parse(
28168
- execFileSync17(headBranch.file, headBranch.args, {
28173
+ execFileSync16(headBranch.file, headBranch.args, {
28169
28174
  encoding: "utf8",
28170
28175
  stdio: ["ignore", "pipe", "pipe"]
28171
28176
  })
@@ -28236,7 +28241,7 @@ function worktreeHoldingBranch(cwd, branch2) {
28236
28241
  import chalk173 from "chalk";
28237
28242
 
28238
28243
  // src/commands/review/azCliProblem.ts
28239
- import { execFileSync as execFileSync18 } from "child_process";
28244
+ import { execFileSync as execFileSync17 } from "child_process";
28240
28245
 
28241
28246
  // src/commands/review/azFailureProblem.ts
28242
28247
  var azProblems = {
@@ -28264,7 +28269,7 @@ function azFailureProblem(error) {
28264
28269
  // src/commands/review/azCliProblem.ts
28265
28270
  function runAz(args) {
28266
28271
  try {
28267
- execFileSync18("az", args, { stdio: "ignore" });
28272
+ execFileSync17("az", args, { stdio: "ignore" });
28268
28273
  return "ok";
28269
28274
  } catch (error) {
28270
28275
  return error.code === "ENOENT" ? "missing" : "failed";
@@ -28327,7 +28332,7 @@ async function checkoutPr(number) {
28327
28332
  const from = branch2 === "HEAD" ? gitSyncOrNull(process.cwd(), ["rev-parse", "HEAD"]) : branch2;
28328
28333
  const stale = headRef ? clearStalePrBranch(process.cwd(), headRef) : "absent";
28329
28334
  try {
28330
- execFileSync19(commands.checkout.file, commands.checkout.args, {
28335
+ execFileSync18(commands.checkout.file, commands.checkout.args, {
28331
28336
  stdio: "inherit"
28332
28337
  });
28333
28338
  } catch {
@@ -30354,9 +30359,9 @@ var azureDevopsThreadRequests = {
30354
30359
  };
30355
30360
 
30356
30361
  // src/commands/prs/azureDevops/currentAzureDevopsPr.ts
30357
- import { execFileSync as execFileSync20 } from "child_process";
30362
+ import { execFileSync as execFileSync19 } from "child_process";
30358
30363
  function findPrForBranch(repo, branch2) {
30359
- const stdout = execFileSync20(
30364
+ const stdout = execFileSync19(
30360
30365
  "az",
30361
30366
  [
30362
30367
  "repos",
@@ -30403,7 +30408,7 @@ function failAzureDevops(error) {
30403
30408
  }
30404
30409
 
30405
30410
  // src/commands/prs/azureDevops/invokeAzDevops.ts
30406
- import { execFileSync as execFileSync21 } from "child_process";
30411
+ import { execFileSync as execFileSync20 } from "child_process";
30407
30412
  import { mkdtempSync as mkdtempSync2, rmSync as rmSync6, writeFileSync as writeFileSync38 } from "fs";
30408
30413
  import { tmpdir as tmpdir6 } from "os";
30409
30414
  import { join as join82 } from "path";
@@ -30432,7 +30437,7 @@ function azDevopsInvokeArgs(request, inFile) {
30432
30437
  ];
30433
30438
  }
30434
30439
  function runAz2(args) {
30435
- const stdout = execFileSync21("az", args, {
30440
+ const stdout = execFileSync20("az", args, {
30436
30441
  encoding: "utf8",
30437
30442
  stdio: ["ignore", "pipe", "pipe"],
30438
30443
  windowsHide: true
@@ -30501,10 +30506,10 @@ function listAzureDevopsComments(repo) {
30501
30506
  }
30502
30507
 
30503
30508
  // src/commands/prs/fetchThreadIds.ts
30504
- import { execFileSync as execFileSync22 } from "child_process";
30509
+ import { execFileSync as execFileSync21 } from "child_process";
30505
30510
  var THREAD_QUERY = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { id isResolved comments(first: 100) { nodes { databaseId } } } } } } }`;
30506
30511
  function fetchThreadIds(org, repo, prNumber) {
30507
- const result = execFileSync22(
30512
+ const result = execFileSync21(
30508
30513
  "gh",
30509
30514
  [
30510
30515
  "api",
@@ -30785,7 +30790,7 @@ function printComments2(result) {
30785
30790
  import { execSync as execSync41 } from "child_process";
30786
30791
 
30787
30792
  // src/commands/prs/threadTarget.ts
30788
- import { execFileSync as execFileSync23 } from "child_process";
30793
+ import { execFileSync as execFileSync22 } from "child_process";
30789
30794
 
30790
30795
  // src/commands/prs/azureDevops/azureDevopsThreadActions.ts
30791
30796
  function attempt(run4) {
@@ -30833,7 +30838,7 @@ function replyToComment(org, repo, prNumber, commentId, message3) {
30833
30838
  // src/commands/prs/threadTarget.ts
30834
30839
  function resolveThread(threadId) {
30835
30840
  const mutation = `mutation($threadId: ID!) { resolveReviewThread(input: {threadId: $threadId}) { thread { isResolved } } }`;
30836
- execFileSync23(
30841
+ execFileSync22(
30837
30842
  "gh",
30838
30843
  ["api", "graphql", "-f", `query=${mutation}`, "-f", `threadId=${threadId}`],
30839
30844
  { stdio: ["inherit", "pipe", "inherit"] }
@@ -31473,7 +31478,7 @@ function buildValidatedBody(options2, usage) {
31473
31478
  }
31474
31479
 
31475
31480
  // src/commands/prs/placePr.ts
31476
- import { execFileSync as execFileSync24 } from "child_process";
31481
+ import { execFileSync as execFileSync23 } from "child_process";
31477
31482
 
31478
31483
  // src/commands/prs/buildCreateArgs.ts
31479
31484
  function buildCreateArgs(title, body, options2, attachments = []) {
@@ -31559,7 +31564,7 @@ function buildEditArgs(number, title, body, attachments = []) {
31559
31564
  // src/commands/prs/placePr.ts
31560
31565
  function hasUpstream2() {
31561
31566
  try {
31562
- execFileSync24(
31567
+ execFileSync23(
31563
31568
  "git",
31564
31569
  ["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"],
31565
31570
  { stdio: "pipe" }
@@ -31571,7 +31576,7 @@ function hasUpstream2() {
31571
31576
  }
31572
31577
  function ensureBranchPushed() {
31573
31578
  const args = hasUpstream2() ? ["push"] : ["push", "--set-upstream", "origin", "HEAD"];
31574
- execFileSync24("git", args, { stdio: "inherit" });
31579
+ execFileSync23("git", args, { stdio: "inherit" });
31575
31580
  }
31576
31581
  async function placePr(prNumber, title, body, options2, attachments = []) {
31577
31582
  const args = prNumber !== null ? buildEditArgs(prNumber, title, body, attachments) : buildCreateArgs(title, body, options2, attachments);
@@ -31642,10 +31647,10 @@ function warn(reason4) {
31642
31647
  }
31643
31648
 
31644
31649
  // src/commands/prs/enableAutoMerge.ts
31645
- import { execFileSync as execFileSync25 } from "child_process";
31650
+ import { execFileSync as execFileSync24 } from "child_process";
31646
31651
  function enableAutoMerge() {
31647
31652
  try {
31648
- execFileSync25(
31653
+ execFileSync24(
31649
31654
  "gh",
31650
31655
  ["pr", "merge", getCurrentBranch2(), "--auto", "--squash"],
31651
31656
  { stdio: "inherit" }
@@ -31903,10 +31908,10 @@ function prsSlackChannel() {
31903
31908
  }
31904
31909
 
31905
31910
  // src/commands/prs/status/fetchReviewThreads.ts
31906
- import { execFileSync as execFileSync26 } from "child_process";
31911
+ import { execFileSync as execFileSync25 } from "child_process";
31907
31912
  var THREAD_QUERY2 = `query($owner: String!, $repo: String!, $prNumber: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $prNumber) { reviewThreads(first: 100) { nodes { isResolved } } } } }`;
31908
31913
  function fetchReviewThreads(org, repo, prNumber) {
31909
- const output = execFileSync26(
31914
+ const output = execFileSync25(
31910
31915
  "gh",
31911
31916
  [
31912
31917
  "api",
@@ -36225,7 +36230,7 @@ function exitWith(message3) {
36225
36230
  }
36226
36231
 
36227
36232
  // src/commands/review/highLevel/proposeHighLevelGlobs.ts
36228
- import { execFileSync as execFileSync28 } from "child_process";
36233
+ import { execFileSync as execFileSync27 } from "child_process";
36229
36234
  import chalk234 from "chalk";
36230
36235
 
36231
36236
  // src/commands/review/highLevel/buildGlobProposalPrompt.ts
@@ -36274,7 +36279,7 @@ function readGlobs(value) {
36274
36279
  }
36275
36280
 
36276
36281
  // src/commands/review/highLevel/summariseRepoTree.ts
36277
- import { execFileSync as execFileSync27 } from "child_process";
36282
+ import { execFileSync as execFileSync26 } from "child_process";
36278
36283
  import { dirname as dirname39, extname as extname6 } from "path";
36279
36284
  var MAX_DIRECTORIES = 200;
36280
36285
  var MAX_EXTENSIONS_PER_DIRECTORY = 6;
@@ -36290,7 +36295,7 @@ function summariseRepoTree(cwd = process.cwd()) {
36290
36295
  }
36291
36296
  function listTrackedFiles(cwd) {
36292
36297
  try {
36293
- return execFileSync27("git", ["ls-files"], {
36298
+ return execFileSync26("git", ["ls-files"], {
36294
36299
  cwd,
36295
36300
  encoding: "utf8",
36296
36301
  maxBuffer: 64 * 1024 * 1024
@@ -36335,7 +36340,7 @@ function proposeHighLevelGlobs(cwd = process.cwd()) {
36335
36340
  }
36336
36341
  function askClaude(prompt, cwd) {
36337
36342
  try {
36338
- return execFileSync28("claude", ["-p", "--model", "sonnet", prompt], {
36343
+ return execFileSync27("claude", ["-p", "--model", "sonnet", prompt], {
36339
36344
  cwd,
36340
36345
  encoding: "utf8",
36341
36346
  timeout: 12e4,
@@ -36975,11 +36980,11 @@ function evaluateHighLevelChecks(subject) {
36975
36980
  }
36976
36981
 
36977
36982
  // src/commands/review/highLevel/fetchFileAtSha.ts
36978
- import { execFileSync as execFileSync29 } from "child_process";
36983
+ import { execFileSync as execFileSync28 } from "child_process";
36979
36984
  function fetchFileAtSha(repo, sha, path108) {
36980
36985
  const encodedPath = path108.split("/").map(encodeURIComponent).join("/");
36981
36986
  try {
36982
- return execFileSync29(
36987
+ return execFileSync28(
36983
36988
  "gh",
36984
36989
  [
36985
36990
  "api",
@@ -37001,7 +37006,7 @@ function fetchFileAtSha(repo, sha, path108) {
37001
37006
  }
37002
37007
 
37003
37008
  // src/commands/review/highLevel/fetchHighLevelFiles.ts
37004
- import { execFileSync as execFileSync30 } from "child_process";
37009
+ import { execFileSync as execFileSync29 } from "child_process";
37005
37010
  import { createHash as createHash4 } from "crypto";
37006
37011
  var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
37007
37012
  function toStatus(status2) {
@@ -37014,7 +37019,7 @@ function diffUrl(repo, prNumber, path108) {
37014
37019
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
37015
37020
  }
37016
37021
  function fetchHighLevelFiles(prNumber, repo) {
37017
- const out = execFileSync30(
37022
+ const out = execFileSync29(
37018
37023
  "gh",
37019
37024
  ["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
37020
37025
  { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
@@ -42843,13 +42848,13 @@ Total: ${violations.length} forbidden string(s).`);
42843
42848
  }
42844
42849
 
42845
42850
  // src/commands/verify/hardcodedColors.ts
42846
- import { execFileSync as execFileSync31 } from "child_process";
42851
+ import { execFileSync as execFileSync30 } from "child_process";
42847
42852
  import { minimatch as minimatch11 } from "minimatch";
42848
42853
  var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
42849
42854
  function hardcodedColors() {
42850
42855
  const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
42851
42856
  try {
42852
- const output = execFileSync31("grep", ["-rEnH", "-f", "-", "src/"], {
42857
+ const output = execFileSync30("grep", ["-rEnH", "-f", "-", "src/"], {
42853
42858
  encoding: "utf8",
42854
42859
  input: `${pattern}
42855
42860
  `
@@ -43666,6 +43671,22 @@ function consumeSimulatedDivergence(cwd) {
43666
43671
  }
43667
43672
  }
43668
43673
 
43674
+ // src/commands/watch/fetchQuietly.ts
43675
+ import { execFileSync as execFileSync31 } from "child_process";
43676
+ var MIN_FETCH_TIMEOUT_MS = 6e4;
43677
+ function fetchQuietly(cwd, intervalMs) {
43678
+ try {
43679
+ execFileSync31("git", ["fetch", "--quiet"], {
43680
+ stdio: ["pipe", "pipe", "pipe"],
43681
+ cwd,
43682
+ timeout: Math.max(intervalMs, MIN_FETCH_TIMEOUT_MS)
43683
+ });
43684
+ return void 0;
43685
+ } catch (error) {
43686
+ return error instanceof Error ? error.message : String(error);
43687
+ }
43688
+ }
43689
+
43669
43690
  // src/commands/watch/detectMovement.ts
43670
43691
  function detectMovement(from, to, count10) {
43671
43692
  if (from === to) return void 0;
@@ -45997,6 +46018,18 @@ function detectExistingWorktree(cwd) {
45997
46018
  return void 0;
45998
46019
  }
45999
46020
 
46021
+ // src/commands/sessions/daemon/worktree/refuseUnallocatedStart.ts
46022
+ function refuseUnallocatedStart(session, path108, error, startHeld) {
46023
+ const reason4 = error instanceof Error ? error.message : String(error);
46024
+ daemonLog(
46025
+ `session ${session.id} worktree ${path108} could not be created: ${reason4}`
46026
+ );
46027
+ session.pendingStart = () => {
46028
+ throw new Error(`worktree ${path108} could not be created: ${reason4}`);
46029
+ };
46030
+ startHeld(session);
46031
+ }
46032
+
46000
46033
  // src/commands/sessions/daemon/worktree/bindNewWorktree.ts
46001
46034
  function bindNewWorktree(session, alloc, notify2, startHeld = () => {
46002
46035
  }) {
@@ -46005,7 +46038,11 @@ function bindNewWorktree(session, alloc, notify2, startHeld = () => {
46005
46038
  session.worktree = { path: alloc.cwd, clone: alloc.clone };
46006
46039
  if (alloc.created) {
46007
46040
  session.awaitingSeed = true;
46008
- seedHeldSession(session, alloc.cwd, alloc.clone, notify2, startHeld);
46041
+ const { cwd, clone } = alloc;
46042
+ void (alloc.ready ?? Promise.resolve()).then(
46043
+ () => seedHeldSession(session, cwd, clone, notify2, startHeld),
46044
+ (error) => refuseUnallocatedStart(session, cwd, error, startHeld)
46045
+ );
46009
46046
  }
46010
46047
  notify2();
46011
46048
  }
@@ -46902,25 +46939,6 @@ function flushPhaseActiveMs(session) {
46902
46939
  return chain2;
46903
46940
  }
46904
46941
 
46905
- // src/commands/sessions/daemon/replayScrollback.ts
46906
- function replayScrollback(sessions, client) {
46907
- for (const s of sessions.values()) {
46908
- if (s.scrollback)
46909
- sendTo(client, {
46910
- type: "output",
46911
- sessionId: s.id,
46912
- data: sessionSnapshot(s)
46913
- });
46914
- }
46915
- }
46916
-
46917
- // src/commands/sessions/daemon/greetClient.ts
46918
- function greetClient(client, sessions, links2) {
46919
- replayScrollback(sessions, client);
46920
- links2.replayScrollback(client);
46921
- links2.sendNodes(client);
46922
- }
46923
-
46924
46942
  // src/commands/sessions/daemon/logPrDecision.ts
46925
46943
  function count9(value) {
46926
46944
  return Array.isArray(value) ? value.length : 0;
@@ -50700,6 +50718,18 @@ var NodeLinks = class {
50700
50718
  }
50701
50719
  };
50702
50720
 
50721
+ // src/commands/sessions/daemon/replayScrollback.ts
50722
+ function replayScrollback(sessions, client) {
50723
+ for (const s of sessions.values()) {
50724
+ if (s.scrollback)
50725
+ sendTo(client, {
50726
+ type: "output",
50727
+ sessionId: s.id,
50728
+ data: sessionSnapshot(s)
50729
+ });
50730
+ }
50731
+ }
50732
+
50703
50733
  // src/commands/sessions/daemon/worktree/joinableStream.ts
50704
50734
  function joinableStream(sessions, targetId) {
50705
50735
  const target = sessions.get(targetId);
@@ -50908,9 +50938,13 @@ var SessionManager = class {
50908
50938
  addClient(client) {
50909
50939
  this.clients.add(client);
50910
50940
  this.notify();
50911
- greetClient(client, this.sessions, this.links);
50941
+ this.links.sendNodes(client);
50912
50942
  }
50913
50943
  replayLocal = (client) => replayScrollback(this.sessions, client);
50944
+ replayAll = (client) => {
50945
+ this.replayLocal(client);
50946
+ this.links.replayScrollback(client);
50947
+ };
50914
50948
  removeClient(client) {
50915
50949
  this.io.viewerLeft(client);
50916
50950
  releaseClient(client, this.clients, this.prPreview, this.verify);
@@ -51183,7 +51217,7 @@ var handleAutoUpdateControl = (client, _m, d) => {
51183
51217
  // src/commands/sessions/daemon/handleHelloRequest.ts
51184
51218
  var handleHelloRequest = (client, m, d) => {
51185
51219
  sendTo(client, buildHello());
51186
- if (d.peer !== true) return;
51220
+ if (d.peer !== true) return m.replayAll(client);
51187
51221
  daemonLog(
51188
51222
  `peer link from ${d.nodeName ?? "unknown node"} (${d.version ?? "unknown version"}); exporting local sessions only`
51189
51223
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.934.4",
3
+ "version": "0.935.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {