@staff0rd/assist 0.872.0 → 0.872.2

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.872.0",
9
+ version: "0.872.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -14116,6 +14116,15 @@ async function getReviewSynthesis(req, res) {
14116
14116
  // src/commands/sessions/web/githubFileContent.ts
14117
14117
  import { execFile as execFile7 } from "child_process";
14118
14118
  import { promisify as promisify6 } from "util";
14119
+
14120
+ // src/shared/ghFailure.ts
14121
+ function ghFailure(error) {
14122
+ const stderr = error.stderr;
14123
+ if (typeof stderr === "string" && stderr.trim()) return stderr.trim();
14124
+ return error instanceof Error ? error.message : "gh api failed";
14125
+ }
14126
+
14127
+ // src/commands/sessions/web/githubFileContent.ts
14119
14128
  var execFileAsync6 = promisify6(execFile7);
14120
14129
  var MAX_FILE_BYTES2 = 2 * 1024 * 1024;
14121
14130
  var REPO = /^[\w.-]+\/[\w.-]+$/;
@@ -14123,11 +14132,6 @@ var SHA = /^[0-9a-f]{7,40}$/i;
14123
14132
  function validPath(path109) {
14124
14133
  return path109.length > 0 && !path109.startsWith("/") && path109.split("/").every((part) => part !== "" && part !== "..");
14125
14134
  }
14126
- function ghFailure(error) {
14127
- const stderr = error.stderr;
14128
- if (typeof stderr === "string" && stderr.trim()) return stderr.trim();
14129
- return error instanceof Error ? error.message : "gh api failed";
14130
- }
14131
14135
  async function githubFileContent(req, res) {
14132
14136
  const params = new URL(req.url ?? "/", "http://localhost").searchParams;
14133
14137
  const repo = params.get("repo") ?? "";
@@ -27514,6 +27518,7 @@ var persistedSessionSchema = z10.object({
27514
27518
  reviewStarted: z10.boolean().optional(),
27515
27519
  launchedFrom: z10.string().optional(),
27516
27520
  interrupted: z10.object({ reason: z10.string(), at: z10.number() }).optional(),
27521
+ awaitingSeed: z10.boolean().optional(),
27517
27522
  undurable: z10.object({ reason: z10.string(), removesTree: z10.boolean().optional() }).optional()
27518
27523
  });
27519
27524
 
@@ -27547,7 +27552,8 @@ function toPersistedSession(session) {
27547
27552
  reviewStarted: session.reviewStarted,
27548
27553
  launchedFrom: session.launchedFrom,
27549
27554
  interrupted: session.interrupted,
27550
- undurable: session.undurable
27555
+ undurable: session.undurable,
27556
+ awaitingSeed: session.awaitingSeed
27551
27557
  };
27552
27558
  }
27553
27559
  function accumulatedRunningMs(session) {
@@ -27588,7 +27594,7 @@ function savePersistedSessions(sessions) {
27588
27594
  }
27589
27595
  function persistLiveSessions(sessions) {
27590
27596
  const live = [...sessions.values()].filter(
27591
- (s) => (s.pty || s.status === "stopped") && s.status !== "done"
27597
+ (s) => (s.pty || s.status === "stopped" || s.awaitingSeed && s.pendingStart) && s.status !== "done"
27592
27598
  );
27593
27599
  savePersistedSessions(live.map(toPersistedSession));
27594
27600
  logPersist(live);
@@ -35821,8 +35827,6 @@ function capHighLevelTestSources(files) {
35821
35827
  }
35822
35828
 
35823
35829
  // src/commands/review/highLevel/collectHighLevelTests.ts
35824
- import { existsSync as existsSync65, readFileSync as readFileSync49 } from "fs";
35825
- import { join as join82 } from "path";
35826
35830
  import { minimatch as minimatch6 } from "minimatch";
35827
35831
 
35828
35832
  // src/commands/review/highLevel/extractTestHierarchy.ts
@@ -35944,23 +35948,17 @@ function patchAddedLines(patch2) {
35944
35948
  }
35945
35949
 
35946
35950
  // src/commands/review/highLevel/collectHighLevelTests.ts
35947
- function testFile(file, repoRoot2) {
35948
- const absolute2 = join82(repoRoot2, file.path);
35949
- if (!existsSync65(absolute2)) return [];
35951
+ function testFile(file, readSource4) {
35950
35952
  const changed = file.patch === void 0 ? void 0 : patchAddedLines(file.patch);
35951
- const tests = extractTestHierarchy(
35952
- file.path,
35953
- readFileSync49(absolute2, "utf8"),
35954
- changed
35955
- );
35953
+ const tests = extractTestHierarchy(file.path, readSource4(file.path), changed);
35956
35954
  if (tests.length === 0) return [];
35957
35955
  const { path: path109, status: status2, additions, deletions, diffUrl: diffUrl2 } = file;
35958
35956
  return [{ path: path109, status: status2, additions, deletions, diffUrl: diffUrl2, tests }];
35959
35957
  }
35960
- function collectHighLevelTests(files, testPaths, repoRoot2) {
35958
+ function collectHighLevelTests(files, testPaths, readSource4) {
35961
35959
  return files.filter(
35962
35960
  (file) => file.status !== "removed" && testPaths.some((glob) => minimatch6(file.path, glob))
35963
- ).flatMap((file) => testFile(file, repoRoot2));
35961
+ ).flatMap((file) => testFile(file, readSource4));
35964
35962
  }
35965
35963
 
35966
35964
  // src/commands/review/highLevel/checkDescriptionLinksIssue.ts
@@ -36161,8 +36159,34 @@ function evaluateHighLevelChecks(subject) {
36161
36159
  });
36162
36160
  }
36163
36161
 
36164
- // src/commands/review/highLevel/fetchHighLevelFiles.ts
36162
+ // src/commands/review/highLevel/fetchFileAtSha.ts
36165
36163
  import { execFileSync as execFileSync26 } from "child_process";
36164
+ function fetchFileAtSha(repo, sha, path109) {
36165
+ const encodedPath = path109.split("/").map(encodeURIComponent).join("/");
36166
+ try {
36167
+ return execFileSync26(
36168
+ "gh",
36169
+ [
36170
+ "api",
36171
+ "-H",
36172
+ "Accept: application/vnd.github.raw",
36173
+ `repos/${repo}/contents/${encodedPath}?ref=${sha}`
36174
+ ],
36175
+ {
36176
+ encoding: "utf8",
36177
+ maxBuffer: 64 * 1024 * 1024,
36178
+ stdio: ["ignore", "pipe", "pipe"]
36179
+ }
36180
+ );
36181
+ } catch (error) {
36182
+ throw new Error(
36183
+ `Could not read ${path109} at PR head ${sha.slice(0, 7)}: ${ghFailure(error)}`
36184
+ );
36185
+ }
36186
+ }
36187
+
36188
+ // src/commands/review/highLevel/fetchHighLevelFiles.ts
36189
+ import { execFileSync as execFileSync27 } from "child_process";
36166
36190
  import { createHash as createHash4 } from "crypto";
36167
36191
  var JQ = ".[] | {filename,status,additions,deletions,patch} | @json";
36168
36192
  function toStatus(status2) {
@@ -36175,7 +36199,7 @@ function diffUrl(repo, prNumber, path109) {
36175
36199
  return `https://github.com/${repo}/pull/${prNumber}/files#diff-${anchor}`;
36176
36200
  }
36177
36201
  function fetchHighLevelFiles(prNumber, repo) {
36178
- const out = execFileSync26(
36202
+ const out = execFileSync27(
36179
36203
  "gh",
36180
36204
  ["api", `repos/${repo}/pulls/${prNumber}/files`, "--paginate", "--jq", JQ],
36181
36205
  { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
@@ -36242,15 +36266,15 @@ function fetchHighLevelPr(prNumber, repo) {
36242
36266
  }
36243
36267
 
36244
36268
  // src/commands/review/highLevel/loadHighLevelReview.ts
36245
- import { existsSync as existsSync66, readFileSync as readFileSync50 } from "fs";
36269
+ import { existsSync as existsSync65, readFileSync as readFileSync49 } from "fs";
36246
36270
 
36247
36271
  // src/commands/review/highLevel/highLevelReviewPath.ts
36248
- import { join as join83 } from "path";
36272
+ import { join as join82 } from "path";
36249
36273
  function slug(value) {
36250
36274
  return value.replace(/[^\w.-]+/g, "-");
36251
36275
  }
36252
36276
  function highLevelReviewPath(repo, headRef, headSha) {
36253
- return join83(
36277
+ return join82(
36254
36278
  getStoreDir(),
36255
36279
  "high-level-reviews",
36256
36280
  slug(repo),
@@ -36261,9 +36285,9 @@ function highLevelReviewPath(repo, headRef, headSha) {
36261
36285
  // src/commands/review/highLevel/loadHighLevelReview.ts
36262
36286
  function loadHighLevelReview(repo, headRef, headSha) {
36263
36287
  const path109 = highLevelReviewPath(repo, headRef, headSha);
36264
- if (!existsSync66(path109)) return void 0;
36288
+ if (!existsSync65(path109)) return void 0;
36265
36289
  try {
36266
- return JSON.parse(readFileSync50(path109, "utf8"));
36290
+ return JSON.parse(readFileSync49(path109, "utf8"));
36267
36291
  } catch {
36268
36292
  return void 0;
36269
36293
  }
@@ -36316,7 +36340,7 @@ function gatherHighLevelSubject(prNumber, force) {
36316
36340
  collectHighLevelTests(
36317
36341
  fetched,
36318
36342
  config.testPaths,
36319
- findRepoRoot(process.cwd()) ?? process.cwd()
36343
+ (path109) => fetchFileAtSha(slug2, pr.headSha, path109)
36320
36344
  )
36321
36345
  ),
36322
36346
  testPaths: config.testPaths,
@@ -36815,9 +36839,19 @@ function resolvePrNumber2(number) {
36815
36839
  }
36816
36840
  return parsed;
36817
36841
  }
36842
+ function gatherSubject(prNumber, force) {
36843
+ try {
36844
+ return gatherHighLevelSubject(prNumber, force);
36845
+ } catch (error) {
36846
+ console.error(
36847
+ `Error: ${error instanceof Error ? error.message : String(error)}`
36848
+ );
36849
+ process.exit(1);
36850
+ }
36851
+ }
36818
36852
  async function runHighLevelReview(number, options2 = {}) {
36819
36853
  const force = options2.force === true;
36820
- const subject = gatherHighLevelSubject(resolvePrNumber2(number), force);
36854
+ const subject = gatherSubject(resolvePrNumber2(number), force);
36821
36855
  announceSavedReview(subject, force);
36822
36856
  const sessionId = process.env.ASSIST_SESSION_ID;
36823
36857
  if (process.env.ASSIST_SESSION !== "1" || !sessionId)
@@ -36826,7 +36860,7 @@ async function runHighLevelReview(number, options2 = {}) {
36826
36860
  }
36827
36861
 
36828
36862
  // src/commands/review/ci/writeJobSummary.ts
36829
- import { appendFileSync as appendFileSync2, readFileSync as readFileSync51 } from "fs";
36863
+ import { appendFileSync as appendFileSync2, readFileSync as readFileSync50 } from "fs";
36830
36864
 
36831
36865
  // src/commands/review/carriedUnanchoredFindings.ts
36832
36866
  function carriedUnanchoredFindings(unanchored) {
@@ -37202,7 +37236,7 @@ function buildTokenUsageTable(usages) {
37202
37236
  // src/commands/review/ci/writeJobSummary.ts
37203
37237
  function writeJobSummary(synthesisPath, prInfo, summaryPath, slots) {
37204
37238
  if (!summaryPath) return;
37205
- const markdown = readFileSync51(synthesisPath, "utf8");
37239
+ const markdown = readFileSync50(synthesisPath, "utf8");
37206
37240
  const { unanchored } = selectPostableFindings(markdown, prInfo);
37207
37241
  const usageTable = buildTokenUsageTable(slots.map((slot) => slot.usage));
37208
37242
  appendFileSync2(
@@ -37321,7 +37355,7 @@ import { format as format2 } from "util";
37321
37355
 
37322
37356
  // src/commands/review/createReviewLogSink.ts
37323
37357
  import { appendFileSync as appendFileSync3, mkdirSync as mkdirSync24 } from "fs";
37324
- import { join as join84 } from "path";
37358
+ import { join as join83 } from "path";
37325
37359
  var LOG_FILE = "review.log";
37326
37360
  function createReviewLogSink() {
37327
37361
  let logPath2;
@@ -37338,7 +37372,7 @@ function createReviewLogSink() {
37338
37372
  },
37339
37373
  attach(reviewDir) {
37340
37374
  mkdirSync24(reviewDir, { recursive: true });
37341
- logPath2 = join84(reviewDir, LOG_FILE);
37375
+ logPath2 = join83(reviewDir, LOG_FILE);
37342
37376
  const lines2 = [
37343
37377
  "",
37344
37378
  `=== ${(/* @__PURE__ */ new Date()).toISOString()} ===`,
@@ -38037,7 +38071,7 @@ async function runClaudeReviewer(spec) {
38037
38071
  }
38038
38072
 
38039
38073
  // src/commands/review/runCodexReviewer.ts
38040
- import { existsSync as existsSync67, unlinkSync as unlinkSync16 } from "fs";
38074
+ import { existsSync as existsSync66, unlinkSync as unlinkSync16 } from "fs";
38041
38075
 
38042
38076
  // src/commands/review/parseCodexUsage.ts
38043
38077
  function parseCodexUsage(usage) {
@@ -38126,7 +38160,7 @@ async function runCodexReviewer(spec) {
38126
38160
  ...override.args.length > 0 ? { env: override.env } : {},
38127
38161
  onLine
38128
38162
  });
38129
- if (result.exitCode !== 0 && existsSync67(spec.outputPath)) {
38163
+ if (result.exitCode !== 0 && existsSync66(spec.outputPath)) {
38130
38164
  unlinkSync16(spec.outputPath);
38131
38165
  }
38132
38166
  const finalised = finaliseReviewerRun(
@@ -38217,10 +38251,10 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
38217
38251
  }
38218
38252
 
38219
38253
  // src/commands/review/synthesiseAfterReviewers.ts
38220
- import { existsSync as existsSync68, unlinkSync as unlinkSync17 } from "fs";
38254
+ import { existsSync as existsSync67, unlinkSync as unlinkSync17 } from "fs";
38221
38255
 
38222
38256
  // src/commands/review/synthesise.ts
38223
- import { readFileSync as readFileSync52 } from "fs";
38257
+ import { readFileSync as readFileSync51 } from "fs";
38224
38258
 
38225
38259
  // src/commands/review/buildSynthesisStdin.ts
38226
38260
  var SYNTHESIS_PROMPT = `You are consolidating two independent code reviews of the same change. The original review request is in request.md. The two reviews are in claude.md and codex.md in the current working directory.
@@ -38289,7 +38323,7 @@ Files:
38289
38323
 
38290
38324
  // src/commands/review/synthesise.ts
38291
38325
  function printSummary2(synthesisPath) {
38292
- const markdown = readFileSync52(synthesisPath, "utf8");
38326
+ const markdown = readFileSync51(synthesisPath, "utf8");
38293
38327
  console.log("");
38294
38328
  console.log(buildReviewSummary(markdown));
38295
38329
  console.log("");
@@ -38324,7 +38358,7 @@ async function synthesise(paths, options2) {
38324
38358
  // src/commands/review/synthesiseAfterReviewers.ts
38325
38359
  async function synthesiseAfterReviewers(input) {
38326
38360
  const { paths, failures } = input;
38327
- if (input.anyFresh && existsSync68(paths.synthesisPath)) {
38361
+ if (input.anyFresh && existsSync67(paths.synthesisPath)) {
38328
38362
  unlinkSync17(paths.synthesisPath);
38329
38363
  }
38330
38364
  const synthesisResult = await synthesise(paths, {
@@ -38553,9 +38587,9 @@ ${annotateDiffWithLineNumbers(context.diff.trimEnd())}
38553
38587
 
38554
38588
  // src/commands/review/buildReviewPaths.ts
38555
38589
  import { homedir as homedir25 } from "os";
38556
- import { basename as basename25, join as join85 } from "path";
38590
+ import { basename as basename25, join as join84 } from "path";
38557
38591
  function buildReviewPaths(repoRoot2, key) {
38558
- const reviewDir = join85(
38592
+ const reviewDir = join84(
38559
38593
  homedir25(),
38560
38594
  ".assist",
38561
38595
  "reviews",
@@ -38564,10 +38598,10 @@ function buildReviewPaths(repoRoot2, key) {
38564
38598
  );
38565
38599
  return {
38566
38600
  reviewDir,
38567
- requestPath: join85(reviewDir, "request.md"),
38568
- claudePath: join85(reviewDir, "claude.md"),
38569
- codexPath: join85(reviewDir, "codex.md"),
38570
- synthesisPath: join85(reviewDir, "synthesis.md")
38601
+ requestPath: join84(reviewDir, "request.md"),
38602
+ claudePath: join84(reviewDir, "claude.md"),
38603
+ codexPath: join84(reviewDir, "codex.md"),
38604
+ synthesisPath: join84(reviewDir, "synthesis.md")
38571
38605
  };
38572
38606
  }
38573
38607
 
@@ -38605,10 +38639,10 @@ function fetchExistingComments() {
38605
38639
  }
38606
38640
 
38607
38641
  // src/commands/review/prepareReviewDir.ts
38608
- import { existsSync as existsSync69, mkdirSync as mkdirSync25, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
38642
+ import { existsSync as existsSync68, mkdirSync as mkdirSync25, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
38609
38643
  function clearReviewFiles(paths) {
38610
38644
  for (const path109 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
38611
- if (existsSync69(path109)) unlinkSync18(path109);
38645
+ if (existsSync68(path109)) unlinkSync18(path109);
38612
38646
  }
38613
38647
  }
38614
38648
  function prepareReviewDir(paths, requestBody, force) {
@@ -38731,7 +38765,7 @@ function gatherChangedContext() {
38731
38765
  }
38732
38766
 
38733
38767
  // src/commands/review/postReviewToPr.ts
38734
- import { readFileSync as readFileSync53 } from "fs";
38768
+ import { readFileSync as readFileSync52 } from "fs";
38735
38769
 
38736
38770
  // src/commands/review/chainAddressComments.ts
38737
38771
  function chainAddressComments(prNumber, announce) {
@@ -38913,7 +38947,7 @@ async function confirmPost(prNumber, work, options2) {
38913
38947
  return promptConfirm(`Post ${work} to PR #${prNumber}?`, false);
38914
38948
  }
38915
38949
  async function postFindingsToPr(prInfo, synthesisPath, options2) {
38916
- const markdown = readFileSync53(synthesisPath, "utf8");
38950
+ const markdown = readFileSync52(synthesisPath, "utf8");
38917
38951
  const { inDiff, unanchored } = selectPostableFindings(markdown, prInfo);
38918
38952
  const carried = carriedUnanchoredFindings(unanchored);
38919
38953
  if (inDiff.length === 0 && carried.length === 0)
@@ -39259,7 +39293,7 @@ function registerReview(program2) {
39259
39293
  }
39260
39294
 
39261
39295
  // src/commands/rules/addRule.ts
39262
- import { existsSync as existsSync72, readFileSync as readFileSync57, writeFileSync as writeFileSync42 } from "fs";
39296
+ import { existsSync as existsSync71, readFileSync as readFileSync56, writeFileSync as writeFileSync42 } from "fs";
39263
39297
  import path88 from "path";
39264
39298
  import chalk244 from "chalk";
39265
39299
 
@@ -39284,7 +39318,7 @@ function insertRuleBullet(content, rule) {
39284
39318
  }
39285
39319
 
39286
39320
  // src/commands/rules/nextRuleCode.ts
39287
- import { readFileSync as readFileSync54 } from "fs";
39321
+ import { readFileSync as readFileSync53 } from "fs";
39288
39322
 
39289
39323
  // src/commands/rules/findClaudeFiles.ts
39290
39324
  import { readdirSync as readdirSync13 } from "fs";
@@ -39308,7 +39342,7 @@ function findClaudeFiles(dir) {
39308
39342
  var CODE_PREFIX = "R";
39309
39343
  function nextRuleCode(root2) {
39310
39344
  const numbers = findClaudeFiles(root2).flatMap(
39311
- (file) => parseRulesSection(readFileSync54(file, "utf8")).map(
39345
+ (file) => parseRulesSection(readFileSync53(file, "utf8")).map(
39312
39346
  (rule) => Number(/(\d+)\s*$/.exec(rule.code)?.[1] ?? 0)
39313
39347
  )
39314
39348
  );
@@ -39316,7 +39350,7 @@ function nextRuleCode(root2) {
39316
39350
  }
39317
39351
 
39318
39352
  // src/commands/rules/resolveRuleScope.ts
39319
- import { existsSync as existsSync70 } from "fs";
39353
+ import { existsSync as existsSync69 } from "fs";
39320
39354
  import path85 from "path";
39321
39355
  function resolveRuleScope(target) {
39322
39356
  const resolved = path85.resolve(target);
@@ -39326,7 +39360,7 @@ function resolveRuleScope(target) {
39326
39360
  let current = startDir;
39327
39361
  while (true) {
39328
39362
  const candidate = path85.join(current, "CLAUDE.md");
39329
- if (existsSync70(candidate)) return candidate;
39363
+ if (existsSync69(candidate)) return candidate;
39330
39364
  if (current === root2 || current === path85.dirname(current)) break;
39331
39365
  current = path85.dirname(current);
39332
39366
  }
@@ -39334,15 +39368,15 @@ function resolveRuleScope(target) {
39334
39368
  }
39335
39369
 
39336
39370
  // src/commands/rules/updateScopedRulesIndex.ts
39337
- import { existsSync as existsSync71, readFileSync as readFileSync56, writeFileSync as writeFileSync41 } from "fs";
39371
+ import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync41 } from "fs";
39338
39372
  import path87 from "path";
39339
39373
 
39340
39374
  // src/commands/rules/scopedRuleDirectories.ts
39341
- import { readFileSync as readFileSync55 } from "fs";
39375
+ import { readFileSync as readFileSync54 } from "fs";
39342
39376
  import path86 from "path";
39343
39377
  function scopedRuleDirectories(root2) {
39344
39378
  return findClaudeFiles(root2).filter(
39345
- (file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync55(file, "utf8")).length > 0
39379
+ (file) => path86.dirname(file) !== root2 && parseRulesSection(readFileSync54(file, "utf8")).length > 0
39346
39380
  ).map(
39347
39381
  (file) => `${path86.relative(root2, path86.dirname(file)).split(path86.sep).join("/")}/`
39348
39382
  ).sort();
@@ -39384,7 +39418,7 @@ function upsertScopedRulesPointer(content, directories) {
39384
39418
  function updateScopedRulesIndex(root2) {
39385
39419
  const directories = scopedRuleDirectories(root2);
39386
39420
  const rootFile = path87.join(root2, "CLAUDE.md");
39387
- const before = existsSync71(rootFile) ? readFileSync56(rootFile, "utf8") : "";
39421
+ const before = existsSync70(rootFile) ? readFileSync55(rootFile, "utf8") : "";
39388
39422
  const after = upsertScopedRulesPointer(before, directories);
39389
39423
  if (after !== before) writeFileSync41(rootFile, after);
39390
39424
  return directories;
@@ -39392,7 +39426,7 @@ function updateScopedRulesIndex(root2) {
39392
39426
 
39393
39427
  // src/commands/rules/addRule.ts
39394
39428
  function read2(file) {
39395
- return existsSync72(file) ? readFileSync57(file, "utf8") : "";
39429
+ return existsSync71(file) ? readFileSync56(file, "utf8") : "";
39396
39430
  }
39397
39431
  function addRule(text18, options2) {
39398
39432
  const rule = text18.trim();
@@ -39927,12 +39961,12 @@ import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync44 } from "fs";
39927
39961
  import { mkdirSync as mkdirSync26, writeFileSync as writeFileSync43 } from "fs";
39928
39962
 
39929
39963
  // src/commands/slack/readSlackParts.ts
39930
- import { readFileSync as readFileSync58 } from "fs";
39964
+ import { readFileSync as readFileSync57 } from "fs";
39931
39965
  function readSlackParts(files) {
39932
39966
  return files.map((file) => {
39933
39967
  let contents;
39934
39968
  try {
39935
- contents = readFileSync58(file, "utf8");
39969
+ contents = readFileSync57(file, "utf8");
39936
39970
  } catch {
39937
39971
  console.error(`Error: Part file not found: ${file}`);
39938
39972
  process.exit(1);
@@ -39970,12 +40004,12 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
39970
40004
  }
39971
40005
 
39972
40006
  // src/commands/slack/slackWorkingFile.ts
39973
- import { join as join86 } from "path";
40007
+ import { join as join85 } from "path";
39974
40008
  function slackWorkingFile(channel, partIndex) {
39975
40009
  const slug2 = channel.replace(/^[#@]/, "").toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "channel";
39976
- const dir = join86(getStoreDir(), "slack");
40010
+ const dir = join85(getStoreDir(), "slack");
39977
40011
  const name = partIndex === void 0 ? slug2 : `${slug2}-${partIndex}`;
39978
- return { dir, bodyPath: join86(dir, `${name}.md`) };
40012
+ return { dir, bodyPath: join85(dir, `${name}.md`) };
39979
40013
  }
39980
40014
 
39981
40015
  // src/commands/slack/previewSlackThreadParts.ts
@@ -40793,7 +40827,7 @@ function registerSync(program2) {
40793
40827
  }
40794
40828
 
40795
40829
  // src/commands/transcript/clean.ts
40796
- import { existsSync as existsSync77 } from "fs";
40830
+ import { existsSync as existsSync76 } from "fs";
40797
40831
 
40798
40832
  // src/commands/transcript/convert/formatTimestamp.ts
40799
40833
  function pad(value, width2) {
@@ -41043,9 +41077,9 @@ function formatVttPassages(passages, notes = [], { sourceMarks = true } = {}) {
41043
41077
  }
41044
41078
 
41045
41079
  // src/commands/transcript/convert/readCleanedCues.ts
41046
- import { readFileSync as readFileSync63 } from "fs";
41080
+ import { readFileSync as readFileSync62 } from "fs";
41047
41081
  function readCleanedCues(inputPath) {
41048
- return deduplicateCues(parseVtt(readFileSync63(inputPath, "utf8")));
41082
+ return deduplicateCues(parseVtt(readFileSync62(inputPath, "utf8")));
41049
41083
  }
41050
41084
 
41051
41085
  // src/commands/transcript/clean.ts
@@ -41071,7 +41105,7 @@ function clean(file, options2 = {}) {
41071
41105
  );
41072
41106
  process.exit(1);
41073
41107
  }
41074
- if (!existsSync77(file)) {
41108
+ if (!existsSync76(file)) {
41075
41109
  console.error(`Error: VTT file not found: ${file}`);
41076
41110
  process.exit(1);
41077
41111
  }
@@ -41154,21 +41188,21 @@ async function configure() {
41154
41188
  }
41155
41189
 
41156
41190
  // src/commands/transcript/list.ts
41157
- import { existsSync as existsSync78, readdirSync as readdirSync20, statSync as statSync13 } from "fs";
41158
- import { join as join98 } from "path";
41191
+ import { existsSync as existsSync77, readdirSync as readdirSync20, statSync as statSync13 } from "fs";
41192
+ import { join as join97 } from "path";
41159
41193
  function list3() {
41160
41194
  const { vttDir } = getTranscriptConfig();
41161
- if (!existsSync78(vttDir)) return;
41195
+ if (!existsSync77(vttDir)) return;
41162
41196
  for (const entry of readdirSync20(vttDir)) {
41163
41197
  if (!entry.endsWith(".vtt")) continue;
41164
- if (statSync13(join98(vttDir, entry)).isDirectory()) continue;
41198
+ if (statSync13(join97(vttDir, entry)).isDirectory()) continue;
41165
41199
  console.log(entry);
41166
41200
  }
41167
41201
  }
41168
41202
 
41169
41203
  // src/commands/transcript/move.ts
41170
- import { existsSync as existsSync79, mkdirSync as mkdirSync33, renameSync as renameSync4, writeFileSync as writeFileSync49 } from "fs";
41171
- import { basename as basename29, join as join99 } from "path";
41204
+ import { existsSync as existsSync78, mkdirSync as mkdirSync33, renameSync as renameSync4, writeFileSync as writeFileSync49 } from "fs";
41205
+ import { basename as basename29, join as join98 } from "path";
41172
41206
 
41173
41207
  // src/commands/transcript/convertVttToMarkdown.ts
41174
41208
  function convertVttToMarkdown(inputPath) {
@@ -41178,9 +41212,9 @@ function convertVttToMarkdown(inputPath) {
41178
41212
  // src/commands/transcript/move.ts
41179
41213
  var DATE_REGEX = /^\d{4}-\d{2}-\d{2}$/;
41180
41214
  function archiveRawVtt(vttDir, sourcePath, filename) {
41181
- const processedDir = join99(vttDir, "processed");
41215
+ const processedDir = join98(vttDir, "processed");
41182
41216
  mkdirSync33(processedDir, { recursive: true });
41183
- renameSync4(sourcePath, join99(processedDir, filename));
41217
+ renameSync4(sourcePath, join98(processedDir, filename));
41184
41218
  }
41185
41219
  function move(file, options2) {
41186
41220
  const { date, client } = options2;
@@ -41190,25 +41224,25 @@ function move(file, options2) {
41190
41224
  }
41191
41225
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
41192
41226
  const filename = basename29(file);
41193
- const sourcePath = join99(vttDir, filename);
41194
- if (!existsSync79(sourcePath)) {
41227
+ const sourcePath = join98(vttDir, filename);
41228
+ if (!existsSync78(sourcePath)) {
41195
41229
  console.error(`Error: VTT file not found: ${sourcePath}`);
41196
41230
  process.exit(1);
41197
41231
  }
41198
41232
  const base = basename29(filename, ".vtt").replace(/ Transcription$/, "");
41199
41233
  const outputName = `${date} ${base}.md`;
41200
- const formattedDir = join99(transcriptsDir, client);
41234
+ const formattedDir = join98(transcriptsDir, client);
41201
41235
  mkdirSync33(formattedDir, { recursive: true });
41202
- const formattedPath = join99(formattedDir, outputName);
41236
+ const formattedPath = join98(formattedDir, outputName);
41203
41237
  writeFileSync49(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
41204
41238
  archiveRawVtt(vttDir, sourcePath, filename);
41205
- const summaryPath = join99(summaryDir, client, outputName);
41239
+ const summaryPath = join98(summaryDir, client, outputName);
41206
41240
  console.log(`Formatted transcript: ${formattedPath}`);
41207
41241
  console.log(`Summary target: ${summaryPath}`);
41208
41242
  }
41209
41243
 
41210
41244
  // src/commands/transcript/merge.ts
41211
- import { existsSync as existsSync80, writeFileSync as writeFileSync50 } from "fs";
41245
+ import { existsSync as existsSync79, writeFileSync as writeFileSync50 } from "fs";
41212
41246
  import { basename as basename30 } from "path";
41213
41247
 
41214
41248
  // src/commands/transcript/failTranscript.ts
@@ -41352,7 +41386,7 @@ function widenAudience(passages) {
41352
41386
 
41353
41387
  // src/commands/transcript/merge.ts
41354
41388
  function readSource3(file) {
41355
- if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
41389
+ if (!existsSync79(file)) failTranscript(`VTT file not found: ${file}`);
41356
41390
  const cues = readCleanedCues(file);
41357
41391
  if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
41358
41392
  return { path: file, name: basename30(file), cues };
@@ -41819,7 +41853,7 @@ function configKeys2() {
41819
41853
  }
41820
41854
 
41821
41855
  // src/commands/verify/forbiddenStrings.ts
41822
- import { existsSync as existsSync81, readFileSync as readFileSync64 } from "fs";
41856
+ import { existsSync as existsSync80, readFileSync as readFileSync63 } from "fs";
41823
41857
 
41824
41858
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
41825
41859
  import { minimatch as minimatch10 } from "minimatch";
@@ -41860,13 +41894,13 @@ function forbiddenStrings() {
41860
41894
  const cache6 = /* @__PURE__ */ new Map();
41861
41895
  const readJson = (file) => {
41862
41896
  if (cache6.has(file)) return cache6.get(file);
41863
- if (!existsSync81(file)) {
41897
+ if (!existsSync80(file)) {
41864
41898
  console.log(`Forbidden-strings file not found: ${file}`);
41865
41899
  process.exit(1);
41866
41900
  }
41867
41901
  let parsed;
41868
41902
  try {
41869
- parsed = JSON.parse(readFileSync64(file, "utf8"));
41903
+ parsed = JSON.parse(readFileSync63(file, "utf8"));
41870
41904
  } catch (error) {
41871
41905
  console.log(`Could not parse ${file}: ${error.message}`);
41872
41906
  process.exit(1);
@@ -41892,13 +41926,13 @@ Total: ${violations.length} forbidden string(s).`);
41892
41926
  }
41893
41927
 
41894
41928
  // src/commands/verify/hardcodedColors.ts
41895
- import { execFileSync as execFileSync27 } from "child_process";
41929
+ import { execFileSync as execFileSync28 } from "child_process";
41896
41930
  import { minimatch as minimatch11 } from "minimatch";
41897
41931
  var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
41898
41932
  function hardcodedColors() {
41899
41933
  const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
41900
41934
  try {
41901
- const output = execFileSync27("grep", ["-rEnH", "-f", "-", "src/"], {
41935
+ const output = execFileSync28("grep", ["-rEnH", "-f", "-", "src/"], {
41902
41936
  encoding: "utf8",
41903
41937
  input: `${pattern}
41904
41938
  `
@@ -41938,7 +41972,7 @@ Total: ${lines2.length} hardcoded color(s)`);
41938
41972
  }
41939
41973
 
41940
41974
  // src/commands/verify/migrations.ts
41941
- import { readFileSync as readFileSync65 } from "fs";
41975
+ import { readFileSync as readFileSync64 } from "fs";
41942
41976
  import path104 from "path";
41943
41977
 
41944
41978
  // src/commands/verify/migrations/checkAppendOnly.ts
@@ -42103,7 +42137,7 @@ function migrations2() {
42103
42137
  if (ref) {
42104
42138
  const baseline = readBaselineMigrations(REPO_RELATIVE_DIR, ref);
42105
42139
  const current = new Map(
42106
- files.map((file) => [file, readFileSync65(path104.join(dir, file), "utf8")])
42140
+ files.map((file) => [file, readFileSync64(path104.join(dir, file), "utf8")])
42107
42141
  );
42108
42142
  for (const finding of checkAppendOnly(baseline, current)) {
42109
42143
  problems.push(
@@ -42649,7 +42683,7 @@ function resolveParams(params, cliArgs) {
42649
42683
  }
42650
42684
 
42651
42685
  // src/commands/run/resolveRunCwd.ts
42652
- import { existsSync as existsSync82 } from "fs";
42686
+ import { existsSync as existsSync81 } from "fs";
42653
42687
  import { resolve as resolve28 } from "path";
42654
42688
  var MissingRunCwdError = class extends Error {
42655
42689
  constructor(runName, cwd) {
@@ -42662,7 +42696,7 @@ var MissingRunCwdError = class extends Error {
42662
42696
  function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
42663
42697
  if (!config.cwd) return void 0;
42664
42698
  const cwd = resolve28(baseDir, config.cwd);
42665
- if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
42699
+ if (!existsSync81(cwd)) throw new MissingRunCwdError(config.name, cwd);
42666
42700
  return cwd;
42667
42701
  }
42668
42702
 
@@ -42782,10 +42816,10 @@ ${buildWatchReport(from)}`);
42782
42816
  }
42783
42817
 
42784
42818
  // src/commands/watch/consumeMarker.ts
42785
- import { existsSync as existsSync83, rmSync as rmSync9 } from "fs";
42819
+ import { existsSync as existsSync82, rmSync as rmSync9 } from "fs";
42786
42820
  function consumeMarker(path109) {
42787
42821
  try {
42788
- if (!existsSync83(path109)) return false;
42822
+ if (!existsSync82(path109)) return false;
42789
42823
  rmSync9(path109);
42790
42824
  return true;
42791
42825
  } catch {
@@ -43118,9 +43152,9 @@ async function auth() {
43118
43152
  }
43119
43153
 
43120
43154
  // src/commands/roam/postRoamActivity.ts
43121
- import { execFileSync as execFileSync28 } from "child_process";
43122
- import { readdirSync as readdirSync22, readFileSync as readFileSync66, statSync as statSync14 } from "fs";
43123
- import { join as join100 } from "path";
43155
+ import { execFileSync as execFileSync29 } from "child_process";
43156
+ import { readdirSync as readdirSync22, readFileSync as readFileSync65, statSync as statSync14 } from "fs";
43157
+ import { join as join99 } from "path";
43124
43158
  function findPortFile(roamDir) {
43125
43159
  let entries;
43126
43160
  try {
@@ -43129,7 +43163,7 @@ function findPortFile(roamDir) {
43129
43163
  return void 0;
43130
43164
  }
43131
43165
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
43132
- const path109 = join100(roamDir, name);
43166
+ const path109 = join99(roamDir, name);
43133
43167
  try {
43134
43168
  return { path: path109, mtimeMs: statSync14(path109).mtimeMs };
43135
43169
  } catch {
@@ -43146,18 +43180,18 @@ var PID_BY_APP = {
43146
43180
  function postRoamActivity(app, event) {
43147
43181
  const appData = process.env.APPDATA;
43148
43182
  if (!appData) return;
43149
- const portFile = findPortFile(join100(appData, "Roam"));
43183
+ const portFile = findPortFile(join99(appData, "Roam"));
43150
43184
  if (!portFile) return;
43151
43185
  let port;
43152
43186
  try {
43153
- port = readFileSync66(portFile, "utf8").trim();
43187
+ port = readFileSync65(portFile, "utf8").trim();
43154
43188
  } catch {
43155
43189
  return;
43156
43190
  }
43157
43191
  const pid = PID_BY_APP[app] ?? 99999;
43158
43192
  const url = `http://127.0.0.1:${port}/api/v1/activity/${app}/${event}?pid=${pid}`;
43159
43193
  try {
43160
- execFileSync28("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
43194
+ execFileSync29("curl", ["-sf", "--max-time", "0.2", "-X", "POST", url], {
43161
43195
  stdio: "ignore"
43162
43196
  });
43163
43197
  } catch {
@@ -43332,7 +43366,7 @@ function link2() {
43332
43366
 
43333
43367
  // src/commands/run/add.ts
43334
43368
  import { mkdirSync as mkdirSync34, writeFileSync as writeFileSync52 } from "fs";
43335
- import { join as join101 } from "path";
43369
+ import { join as join100 } from "path";
43336
43370
 
43337
43371
  // src/commands/run/editRepoRunList.ts
43338
43372
  async function editRepoRunList(repoName, cwd, edit2) {
@@ -43503,7 +43537,7 @@ function saveProjectRunConfig(entry) {
43503
43537
  saveConfig(config);
43504
43538
  }
43505
43539
  function createCommandFile(name) {
43506
- const dir = join101(".claude", "commands");
43540
+ const dir = join100(".claude", "commands");
43507
43541
  mkdirSync34(dir, { recursive: true });
43508
43542
  const content = `---
43509
43543
  description: Run ${name}
@@ -43511,7 +43545,7 @@ description: Run ${name}
43511
43545
 
43512
43546
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
43513
43547
  `;
43514
- const filePath = join101(dir, `${name}.md`);
43548
+ const filePath = join100(dir, `${name}.md`);
43515
43549
  writeFileSync52(filePath, content);
43516
43550
  console.log(`Created command file: ${filePath}`);
43517
43551
  }
@@ -43616,8 +43650,8 @@ function registerRunAdd(runCommand) {
43616
43650
  }
43617
43651
 
43618
43652
  // src/commands/run/remove.ts
43619
- import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
43620
- import { join as join102 } from "path";
43653
+ import { existsSync as existsSync83, unlinkSync as unlinkSync19 } from "fs";
43654
+ import { join as join101 } from "path";
43621
43655
 
43622
43656
  // src/commands/run/removeRepoRunConfig.ts
43623
43657
  function isNamed(entry, name) {
@@ -43635,8 +43669,8 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
43635
43669
 
43636
43670
  // src/commands/run/remove.ts
43637
43671
  function deleteCommandFile(name) {
43638
- const filePath = join102(".claude", "commands", `${name}.md`);
43639
- if (existsSync84(filePath)) {
43672
+ const filePath = join101(".claude", "commands", `${name}.md`);
43673
+ if (existsSync83(filePath)) {
43640
43674
  unlinkSync19(filePath);
43641
43675
  console.log(`Deleted command file: ${filePath}`);
43642
43676
  }
@@ -43705,11 +43739,11 @@ function formatLink(link3) {
43705
43739
  }
43706
43740
 
43707
43741
  // src/commands/sessions/daemon/listDaemonPids.ts
43708
- import { execFileSync as execFileSync29 } from "child_process";
43742
+ import { execFileSync as execFileSync30 } from "child_process";
43709
43743
  function listDaemonPids() {
43710
43744
  if (process.platform === "win32") return [];
43711
43745
  try {
43712
- const out = execFileSync29("ps", ["-eo", "pid=,args="], {
43746
+ const out = execFileSync30("ps", ["-eo", "pid=,args="], {
43713
43747
  encoding: "utf8"
43714
43748
  });
43715
43749
  return out.split("\n").filter((line) => line.includes("assist") && / daemon run\b/.test(line)).map((line) => Number.parseInt(line.trim(), 10)).filter((pid) => Number.isInteger(pid));
@@ -43755,11 +43789,11 @@ function applyLine(result, pending, line) {
43755
43789
  }
43756
43790
 
43757
43791
  // src/commands/sessions/daemon/readDaemonPidFile.ts
43758
- import { readFileSync as readFileSync67 } from "fs";
43792
+ import { readFileSync as readFileSync66 } from "fs";
43759
43793
  function readDaemonPidFile() {
43760
43794
  try {
43761
43795
  const pid = Number.parseInt(
43762
- readFileSync67(daemonPaths.pid, "utf8").trim(),
43796
+ readFileSync66(daemonPaths.pid, "utf8").trim(),
43763
43797
  10
43764
43798
  );
43765
43799
  return Number.isInteger(pid) ? pid : void 0;
@@ -44075,12 +44109,12 @@ function toSessionRunInfo({
44075
44109
  }
44076
44110
 
44077
44111
  // src/commands/sessions/daemon/worktree/joinRefusal.ts
44078
- import { existsSync as existsSync85 } from "fs";
44112
+ import { existsSync as existsSync84 } from "fs";
44079
44113
  function joinRefusal(session) {
44080
44114
  if (session.commandType === "run") return "a server run has no agent stream";
44081
44115
  if (session.closing === true) return "the session is closing";
44082
44116
  if (!session.cwd) return "the session has no working directory";
44083
- if (!existsSync85(session.cwd))
44117
+ if (!existsSync84(session.cwd))
44084
44118
  return "the session's workspace no longer exists";
44085
44119
  return void 0;
44086
44120
  }
@@ -44229,7 +44263,7 @@ function sendResizeSnapshot(s, send) {
44229
44263
  }
44230
44264
 
44231
44265
  // src/commands/sessions/daemon/viewerSize.ts
44232
- import { readFileSync as readFileSync68, writeFileSync as writeFileSync53 } from "fs";
44266
+ import { readFileSync as readFileSync67, writeFileSync as writeFileSync53 } from "fs";
44233
44267
  var DEFAULT_SIZE = { cols: 120, rows: 30 };
44234
44268
  var remembered;
44235
44269
  function rememberViewerSize(cols, rows) {
@@ -44251,7 +44285,7 @@ function viewerSize() {
44251
44285
  function readSavedSize() {
44252
44286
  try {
44253
44287
  const { cols, rows } = JSON.parse(
44254
- readFileSync68(daemonPaths.viewerSize, "utf8")
44288
+ readFileSync67(daemonPaths.viewerSize, "utf8")
44255
44289
  );
44256
44290
  if (typeof cols === "number" && typeof rows === "number" && cols > 0)
44257
44291
  return { cols, rows };
@@ -44546,11 +44580,11 @@ function sessionBase(id, status2) {
44546
44580
  }
44547
44581
 
44548
44582
  // src/commands/sessions/daemon/spawnPty.ts
44549
- import { existsSync as existsSync87 } from "fs";
44583
+ import { existsSync as existsSync86 } from "fs";
44550
44584
  import * as pty from "node-pty";
44551
44585
 
44552
44586
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
44553
- import { chmodSync, existsSync as existsSync86, statSync as statSync15 } from "fs";
44587
+ import { chmodSync, existsSync as existsSync85, statSync as statSync15 } from "fs";
44554
44588
  import { createRequire as createRequire3 } from "module";
44555
44589
  import path105 from "path";
44556
44590
  var require4 = createRequire3(import.meta.url);
@@ -44565,7 +44599,7 @@ function ensureSpawnHelperExecutable() {
44565
44599
  `${process.platform}-${process.arch}`,
44566
44600
  "spawn-helper"
44567
44601
  );
44568
- if (!existsSync86(helper)) return;
44602
+ if (!existsSync85(helper)) return;
44569
44603
  const mode = statSync15(helper).mode;
44570
44604
  if ((mode & 73) === 0) chmodSync(helper, mode | 493);
44571
44605
  }
@@ -44621,7 +44655,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
44621
44655
  });
44622
44656
  }
44623
44657
  function refuseMissingCwd(cwd, sessionId) {
44624
- if (!cwd || existsSync87(cwd)) return;
44658
+ if (!cwd || existsSync86(cwd)) return;
44625
44659
  daemonLog(
44626
44660
  `${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
44627
44661
  );
@@ -44791,7 +44825,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
44791
44825
  }
44792
44826
 
44793
44827
  // src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
44794
- import { existsSync as existsSync88, rmSync as rmSync10, writeFileSync as writeFileSync54 } from "fs";
44828
+ import { existsSync as existsSync87, rmSync as rmSync10, writeFileSync as writeFileSync54 } from "fs";
44795
44829
  var paused;
44796
44830
  var wake;
44797
44831
  function persist2(value) {
@@ -44803,7 +44837,7 @@ function persist2(value) {
44803
44837
  }
44804
44838
  var autoUpdateControl = {
44805
44839
  paused: () => {
44806
- paused ??= existsSync88(daemonPaths.autoUpdatePaused);
44840
+ paused ??= existsSync87(daemonPaths.autoUpdatePaused);
44807
44841
  return paused;
44808
44842
  },
44809
44843
  setPaused: (value) => {
@@ -44921,14 +44955,14 @@ async function runAutoUpdateLoop(deps2, maxLaps = Number.POSITIVE_INFINITY) {
44921
44955
  }
44922
44956
 
44923
44957
  // src/commands/sessions/daemon/autoUpdate/trimWatcherLog.ts
44924
- import { readFileSync as readFileSync70, writeFileSync as writeFileSync55 } from "fs";
44958
+ import { readFileSync as readFileSync69, writeFileSync as writeFileSync55 } from "fs";
44925
44959
  var KEEP_TAIL = 256 * 1024;
44926
44960
  var MAX_LOG_SIZE = 4 * 1024 * 1024;
44927
44961
  function trimWatcherLog(cwd) {
44928
44962
  const path109 = watcherLogPath(cwd);
44929
44963
  let log2;
44930
44964
  try {
44931
- log2 = readFileSync70(path109, "utf8");
44965
+ log2 = readFileSync69(path109, "utf8");
44932
44966
  } catch {
44933
44967
  return;
44934
44968
  }
@@ -44964,21 +44998,26 @@ function bindNewWorktree(session, alloc, notify2, startHeld = () => {
44964
44998
  if (alloc.kind !== "worktree" || !alloc.cwd || !alloc.clone || !session)
44965
44999
  return;
44966
45000
  session.worktree = { path: alloc.cwd, clone: alloc.clone };
44967
- if (alloc.created)
44968
- seedWorktree(
44969
- alloc.cwd,
44970
- alloc.clone,
44971
- () => {
44972
- session.seeding = void 0;
44973
- startHeld(session);
44974
- },
44975
- (path109) => {
44976
- session.seeding = `Installing dependencies${path109 ? ` in ${path109}` : ""}\u2026`;
44977
- notify2();
44978
- }
44979
- );
45001
+ if (alloc.created) {
45002
+ session.awaitingSeed = true;
45003
+ seedHeldSession(session, alloc.cwd, alloc.clone, notify2, startHeld);
45004
+ }
44980
45005
  notify2();
44981
45006
  }
45007
+ function seedHeldSession(session, path109, clone, notify2, startHeld) {
45008
+ seedWorktree(
45009
+ path109,
45010
+ clone,
45011
+ () => {
45012
+ session.seeding = void 0;
45013
+ startHeld(session);
45014
+ },
45015
+ (installPath) => {
45016
+ session.seeding = `Installing dependencies${installPath ? ` in ${installPath}` : ""}\u2026`;
45017
+ notify2();
45018
+ }
45019
+ );
45020
+ }
44982
45021
  function bindRestoredWorktrees(sessions) {
44983
45022
  for (const session of sessions.values()) {
44984
45023
  if (session.worktree || !session.cwd) continue;
@@ -45241,17 +45280,17 @@ function setStatus2(session, newStatus) {
45241
45280
  }
45242
45281
 
45243
45282
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
45244
- import { existsSync as existsSync90 } from "fs";
45283
+ import { existsSync as existsSync89 } from "fs";
45245
45284
  import { basename as basename32 } from "path";
45246
45285
 
45247
45286
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
45248
- import { existsSync as existsSync89 } from "fs";
45249
- import { join as join105 } from "path";
45287
+ import { existsSync as existsSync88 } from "fs";
45288
+ import { join as join104 } from "path";
45250
45289
 
45251
45290
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
45252
45291
  import { statSync as statSync16 } from "fs";
45253
45292
  import { rm as rm3 } from "fs/promises";
45254
- import { join as join104 } from "path";
45293
+ import { join as join103 } from "path";
45255
45294
  async function deleteTreeDirectly(clone, worktreePath, why) {
45256
45295
  if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
45257
45296
  const refusal = "it is a clone of its own, not a linked worktree";
@@ -45279,7 +45318,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
45279
45318
  return { removed: true };
45280
45319
  }
45281
45320
  function holdsAGitDirectoryRatherThanALink(worktreePath) {
45282
- return statSync16(join104(worktreePath, ".git"), {
45321
+ return statSync16(join103(worktreePath, ".git"), {
45283
45322
  throwIfNoEntry: false
45284
45323
  })?.isDirectory() === true;
45285
45324
  }
@@ -45315,7 +45354,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
45315
45354
  );
45316
45355
  }
45317
45356
  function strandedReason(worktreePath, cause) {
45318
- if (!existsSync89(join105(worktreePath, ".git")))
45357
+ if (!existsSync88(join104(worktreePath, ".git")))
45319
45358
  return "its .git link is already gone";
45320
45359
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
45321
45360
  return "git no longer recognises it as a working tree";
@@ -45367,7 +45406,7 @@ function reason3(error) {
45367
45406
 
45368
45407
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
45369
45408
  async function reapWorktree(worktreePath, force = false) {
45370
- if (!existsSync90(worktreePath)) {
45409
+ if (!existsSync89(worktreePath)) {
45371
45410
  forgetWorktree(worktreePath);
45372
45411
  daemonLog(
45373
45412
  `worktree ${worktreePath} already gone; its record was forgotten`
@@ -45392,7 +45431,7 @@ async function reapWorktree(worktreePath, force = false) {
45392
45431
  }
45393
45432
  function owningClone(worktreePath) {
45394
45433
  const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
45395
- if (recorded && existsSync90(recorded)) return recorded;
45434
+ if (recorded && existsSync89(recorded)) return recorded;
45396
45435
  const detected = mainWorktree(worktreePath);
45397
45436
  if (detected) return detected;
45398
45437
  daemonLog(
@@ -45593,12 +45632,12 @@ async function closeBlockReason(sessionId, tree) {
45593
45632
  }
45594
45633
 
45595
45634
  // src/commands/sessions/daemon/worktree/watchGitState.ts
45596
- import { existsSync as existsSync91, watch } from "fs";
45635
+ import { existsSync as existsSync90, watch } from "fs";
45597
45636
  var DEBOUNCE_MS = 500;
45598
45637
  var POLL_MS3 = 3e4;
45599
45638
  function watchGitState(cwd, onChange) {
45600
45639
  const common = gitCommonDir(cwd);
45601
- if (!common || !existsSync91(common)) return void 0;
45640
+ if (!common || !existsSync90(common)) return void 0;
45602
45641
  const watchers = [
45603
45642
  watchGitDir(common, onChange),
45604
45643
  pollGitState(cwd, onChange)
@@ -46246,10 +46285,10 @@ function emitSessionOutput(session, clients, data) {
46246
46285
  }
46247
46286
 
46248
46287
  // src/commands/sessions/daemon/exitReason.ts
46249
- import { existsSync as existsSync92 } from "fs";
46288
+ import { existsSync as existsSync91 } from "fs";
46250
46289
  import { resolve as resolve29 } from "path";
46251
46290
  function exitDetail(session) {
46252
- if (session.cwd && !existsSync92(session.cwd))
46291
+ if (session.cwd && !existsSync91(session.cwd))
46253
46292
  return `working directory ${session.cwd} no longer exists`;
46254
46293
  return missingRunConfigCwd(session);
46255
46294
  }
@@ -46263,7 +46302,7 @@ function missingRunConfigCwd(session) {
46263
46302
  const config = resolveRunConfig(session.runName, dir);
46264
46303
  if (!config?.cwd) return void 0;
46265
46304
  const configured = resolve29(runConfigBaseDirFrom(dir), config.cwd);
46266
- if (existsSync92(configured)) return void 0;
46305
+ if (existsSync91(configured)) return void 0;
46267
46306
  return `run config "${config.name}": cwd ${configured} does not exist`;
46268
46307
  }
46269
46308
 
@@ -46311,7 +46350,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
46311
46350
  }
46312
46351
 
46313
46352
  // src/commands/sessions/daemon/watchActivity.ts
46314
- import { existsSync as existsSync93, mkdirSync as mkdirSync36, watch as watch2 } from "fs";
46353
+ import { existsSync as existsSync92, mkdirSync as mkdirSync36, watch as watch2 } from "fs";
46315
46354
  import { dirname as dirname44 } from "path";
46316
46355
 
46317
46356
  // src/commands/sessions/daemon/applyActivityToSession.ts
@@ -46397,7 +46436,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
46397
46436
  if (timer) clearTimeout(timer);
46398
46437
  timer = setTimeout(read3, DEBOUNCE_MS2);
46399
46438
  });
46400
- if (existsSync93(path109)) read3();
46439
+ if (existsSync92(path109)) read3();
46401
46440
  }
46402
46441
  function refreshActivity(session) {
46403
46442
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -47668,7 +47707,7 @@ function releaseClient(client, clients, prPreview, verify) {
47668
47707
  }
47669
47708
 
47670
47709
  // src/commands/sessions/daemon/findPortHolderPid.ts
47671
- import { execFileSync as execFileSync30 } from "child_process";
47710
+ import { execFileSync as execFileSync31 } from "child_process";
47672
47711
  var PROBE_TIMEOUT_MS = 3e3;
47673
47712
  function findPortHolderPid(port) {
47674
47713
  try {
@@ -47678,7 +47717,7 @@ function findPortHolderPid(port) {
47678
47717
  }
47679
47718
  }
47680
47719
  function probe(command, args) {
47681
- return execFileSync30(command, args, {
47720
+ return execFileSync31(command, args, {
47682
47721
  encoding: "utf8",
47683
47722
  timeout: PROBE_TIMEOUT_MS,
47684
47723
  stdio: ["ignore", "pipe", "ignore"]
@@ -47727,6 +47766,7 @@ function startHeldSession(session, sessions, clients, onStatusChange, notify2, t
47727
47766
  const start2 = session.pendingStart;
47728
47767
  if (!start2) return;
47729
47768
  session.pendingStart = void 0;
47769
+ session.awaitingSeed = void 0;
47730
47770
  if (heldStartBlocked(session, sessions)) return;
47731
47771
  session.startedAt = Date.now();
47732
47772
  if (session.status === "running") session.runningSince = session.startedAt;
@@ -47962,6 +48002,78 @@ function deriveRestoreStatus(persisted) {
47962
48002
  return awaitsQuestionAnswer(entries) ? "asking" : "waiting";
47963
48003
  }
47964
48004
 
48005
+ // src/commands/sessions/daemon/createAssistSession.ts
48006
+ function createAssistSession(id, assistArgs, cwd, meta, holdPty) {
48007
+ const startedAt = Date.now();
48008
+ return {
48009
+ id,
48010
+ name: `assist ${assistArgs.join(" ")}`,
48011
+ title: meta?.title,
48012
+ subtitle: meta?.subtitle,
48013
+ commandType: "assist",
48014
+ status: "running",
48015
+ startedAt,
48016
+ runningMs: 0,
48017
+ runningSince: startedAt,
48018
+ waitingSince: null,
48019
+ ...startOrHoldPty(
48020
+ () => spawnPty(["assist", ...assistArgs], cwd, id),
48021
+ holdPty
48022
+ ),
48023
+ scrollback: "",
48024
+ assistArgs,
48025
+ cwd
48026
+ };
48027
+ }
48028
+
48029
+ // src/commands/sessions/daemon/relaunchHeldSession.ts
48030
+ function relaunchHeldSession(id, persisted) {
48031
+ const worktree = detectExistingWorktree(persisted.cwd);
48032
+ if (!worktree)
48033
+ return errorSession(
48034
+ id,
48035
+ persisted,
48036
+ `not restored: its worktree ${persisted.cwd} was still being prepared when the daemon restarted and is no longer there`
48037
+ );
48038
+ const created = createHeld(id, persisted);
48039
+ if (!created)
48040
+ return errorSession(
48041
+ id,
48042
+ persisted,
48043
+ `not restored: it was still preparing its worktree ${persisted.cwd} when the daemon restarted and has no launch to relaunch`
48044
+ );
48045
+ const base = restoreBase(id, persisted);
48046
+ return {
48047
+ ...base,
48048
+ ...created,
48049
+ name: base.name,
48050
+ title: base.title,
48051
+ subtitle: base.subtitle,
48052
+ worktree,
48053
+ awaitingSeed: true
48054
+ };
48055
+ }
48056
+ function createHeld(id, persisted) {
48057
+ if (persisted.commandType === "assist")
48058
+ return persisted.assistArgs ? createAssistSession(
48059
+ id,
48060
+ persisted.assistArgs,
48061
+ persisted.cwd,
48062
+ void 0,
48063
+ true
48064
+ ) : void 0;
48065
+ if (persisted.commandType === "claude")
48066
+ return createSession(id, {
48067
+ prompt: persisted.initialPrompt,
48068
+ cwd: persisted.cwd,
48069
+ design: persisted.design,
48070
+ auto: persisted.auto,
48071
+ harness: persisted.harness,
48072
+ holdPty: true
48073
+ });
48074
+ return void 0;
48075
+ }
48076
+
47965
48077
  // src/commands/sessions/daemon/daemonRestartPrompt.ts
47966
48078
  function daemonRestartPrompt(backgroundTaskIds) {
47967
48079
  const preamble = "The assist sessions daemon restarted and killed this session's processes. This was not a deliberate stop and nothing you were running was told to finish.";
@@ -48264,6 +48376,7 @@ function isOnceLaunch(persisted) {
48264
48376
 
48265
48377
  // src/commands/sessions/daemon/restoreSession.ts
48266
48378
  function restoreSession(id, persisted) {
48379
+ if (persisted.awaitingSeed) return relaunchHeldSession(id, persisted);
48267
48380
  const base = restoreBase(id, persisted);
48268
48381
  if (persisted.status === "stopped") return stoppedSession(base, persisted);
48269
48382
  if (isUpdate(persisted)) return updatedSession(id, persisted);
@@ -48362,7 +48475,7 @@ function rearmStoppedSessions(sessions, notify2) {
48362
48475
  }
48363
48476
 
48364
48477
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
48365
- import { existsSync as existsSync96 } from "fs";
48478
+ import { existsSync as existsSync95 } from "fs";
48366
48479
  import { basename as basename34 } from "path";
48367
48480
 
48368
48481
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
@@ -48383,9 +48496,9 @@ function accountedTrees(sessions) {
48383
48496
  }
48384
48497
 
48385
48498
  // src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
48386
- import { existsSync as existsSync95 } from "fs";
48499
+ import { existsSync as existsSync94 } from "fs";
48387
48500
  async function reclaimVanishedWorktrees(clone, paths) {
48388
- if (!existsSync95(clone)) {
48501
+ if (!existsSync94(clone)) {
48389
48502
  for (const { path: path109 } of paths) forgetWorktree(path109);
48390
48503
  daemonLog(
48391
48504
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
@@ -48551,7 +48664,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
48551
48664
  );
48552
48665
  continue;
48553
48666
  }
48554
- if (!existsSync96(path109)) {
48667
+ if (!existsSync95(path109)) {
48555
48668
  logVanishedTree(sessions, path109);
48556
48669
  vanished.set(clone, [
48557
48670
  ...vanished.get(clone) ?? [],
@@ -48566,10 +48679,47 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
48566
48679
  await reclaimVanishedWorktrees(clone, paths);
48567
48680
  }
48568
48681
 
48682
+ // src/commands/sessions/daemon/startHeldInTree.ts
48683
+ function startHeldInTree(seeded, sessions, clients, onStatusChange, notify2) {
48684
+ const start2 = (session) => startHeldSession(session, sessions, clients, onStatusChange, notify2);
48685
+ start2(seeded);
48686
+ for (const session of sessions.values())
48687
+ if (session !== seeded && session.pendingStart && session.cwd === seeded.cwd)
48688
+ start2(session);
48689
+ }
48690
+
48691
+ // src/commands/sessions/daemon/worktree/reseedRestoredWorktrees.ts
48692
+ function reseedRestoredWorktrees(deps2) {
48693
+ const { sessions, clients, onStatusChange, notify: notify2 } = deps2;
48694
+ for (const [path109, { session, clone }] of heldTrees(sessions)) {
48695
+ daemonLog(
48696
+ `session ${session.id} ("${session.name}") restored mid worktree setup; re-seeding ${path109} before starting it`
48697
+ );
48698
+ seedHeldSession(
48699
+ session,
48700
+ path109,
48701
+ clone,
48702
+ notify2,
48703
+ (seeded) => startHeldInTree(seeded, sessions, clients, onStatusChange, notify2)
48704
+ );
48705
+ }
48706
+ }
48707
+ function heldTrees(sessions) {
48708
+ const trees = /* @__PURE__ */ new Map();
48709
+ for (const session of sessions.values()) {
48710
+ const { worktree } = session;
48711
+ if (!session.awaitingSeed || !session.pendingStart || !worktree) continue;
48712
+ if (!trees.has(worktree.path))
48713
+ trees.set(worktree.path, { session, clone: worktree.clone });
48714
+ }
48715
+ return trees;
48716
+ }
48717
+
48569
48718
  // src/commands/sessions/daemon/restoreAllSessions.ts
48570
48719
  function restoreAllSessions(spawner, deps2) {
48571
48720
  const { sessions, notify: notify2 } = deps2;
48572
48721
  const names = restoreAll(spawner, sessions);
48722
+ reseedRestoredWorktrees(deps2);
48573
48723
  reconcileWorktreesOnRestore(sessions, spawner.recoveryCard, notify2);
48574
48724
  rearmStoppedSessions(sessions, notify2);
48575
48725
  for (const session of sessions.values())
@@ -48720,15 +48870,6 @@ function recordInterruptions(sessions) {
48720
48870
  }
48721
48871
  }
48722
48872
 
48723
- // src/commands/sessions/daemon/startHeldInTree.ts
48724
- function startHeldInTree(seeded, sessions, clients, onStatusChange, notify2) {
48725
- const start2 = (session) => startHeldSession(session, sessions, clients, onStatusChange, notify2);
48726
- start2(seeded);
48727
- for (const session of sessions.values())
48728
- if (session !== seeded && session.pendingStart && session.cwd === seeded.cwd)
48729
- start2(session);
48730
- }
48731
-
48732
48873
  // src/commands/sessions/daemon/treeSpawnContext.ts
48733
48874
  function treeSpawnContext(sessions, spawnWith, notify2, clients, onStatusChange) {
48734
48875
  return {
@@ -49513,6 +49654,7 @@ function spawnIntoStream(ctx, target, { prompt, harness, auto }) {
49513
49654
  );
49514
49655
  const joined = ctx.sessions.get(id);
49515
49656
  if (joined && target.worktree) joined.worktree = { ...target.worktree };
49657
+ if (joined && holdUntilSeeded) joined.awaitingSeed = true;
49516
49658
  daemonLog(
49517
49659
  `session ${id} added to the stream of session ${target.id} in ${target.cwd}: no workspace allocated${auto ? ", in auto mode" : ""}${holdUntilSeeded ? ", held until that workspace finishes seeding" : ""}`
49518
49660
  );
@@ -49534,30 +49676,6 @@ function addAgentToStream(ctx, targetId, request) {
49534
49676
  };
49535
49677
  }
49536
49678
 
49537
- // src/commands/sessions/daemon/createAssistSession.ts
49538
- function createAssistSession(id, assistArgs, cwd, meta, holdPty) {
49539
- const startedAt = Date.now();
49540
- return {
49541
- id,
49542
- name: `assist ${assistArgs.join(" ")}`,
49543
- title: meta?.title,
49544
- subtitle: meta?.subtitle,
49545
- commandType: "assist",
49546
- status: "running",
49547
- startedAt,
49548
- runningMs: 0,
49549
- runningSince: startedAt,
49550
- waitingSince: null,
49551
- ...startOrHoldPty(
49552
- () => spawnPty(["assist", ...assistArgs], cwd, id),
49553
- holdPty
49554
- ),
49555
- scrollback: "",
49556
- assistArgs,
49557
- cwd
49558
- };
49559
- }
49560
-
49561
49679
  // src/commands/sessions/daemon/worktree/isBacklogRunArgs.ts
49562
49680
  var ITEM_ID = /^a?\d+$/;
49563
49681
  function isBacklogRunArgs(args) {
@@ -49622,7 +49740,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
49622
49740
  }
49623
49741
 
49624
49742
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
49625
- import { existsSync as existsSync99 } from "fs";
49743
+ import { existsSync as existsSync98 } from "fs";
49626
49744
 
49627
49745
  // src/commands/sessions/daemon/resumeSession.ts
49628
49746
  function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
@@ -49653,11 +49771,11 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
49653
49771
  }
49654
49772
 
49655
49773
  // src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
49656
- import { existsSync as existsSync98 } from "fs";
49774
+ import { existsSync as existsSync97 } from "fs";
49657
49775
 
49658
49776
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
49659
- import { copyFileSync as copyFileSync5, existsSync as existsSync97, mkdirSync as mkdirSync38 } from "fs";
49660
- import { join as join107 } from "path";
49777
+ import { copyFileSync as copyFileSync5, existsSync as existsSync96, mkdirSync as mkdirSync38 } from "fs";
49778
+ import { join as join106 } from "path";
49661
49779
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
49662
49780
  const dir = projectDirForCwd(toCwd);
49663
49781
  if (dir === projectDirForCwd(fromCwd)) {
@@ -49666,8 +49784,8 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
49666
49784
  );
49667
49785
  return;
49668
49786
  }
49669
- const dest = join107(dir, `${claudeSessionId}.jsonl`);
49670
- if (existsSync97(dest)) {
49787
+ const dest = join106(dir, `${claudeSessionId}.jsonl`);
49788
+ if (existsSync96(dest)) {
49671
49789
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
49672
49790
  return;
49673
49791
  }
@@ -49718,7 +49836,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
49718
49836
  }
49719
49837
  function cloneForReapedTree(missingCwd) {
49720
49838
  const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
49721
- if (!clone || !existsSync98(clone))
49839
+ if (!clone || !existsSync97(clone))
49722
49840
  throw new Error(
49723
49841
  `working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
49724
49842
  );
@@ -49727,7 +49845,7 @@ function cloneForReapedTree(missingCwd) {
49727
49845
 
49728
49846
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
49729
49847
  function resumeInTree(ctx, sessionId, cwd, name, harness) {
49730
- if (!existsSync99(cwd))
49848
+ if (!existsSync98(cwd))
49731
49849
  return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
49732
49850
  const id = ctx.spawnWith(
49733
49851
  (sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
@@ -50690,7 +50808,7 @@ var sessionSettingHandlers = {
50690
50808
 
50691
50809
  // src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
50692
50810
  import { execFile as execFile14 } from "child_process";
50693
- import { existsSync as existsSync100 } from "fs";
50811
+ import { existsSync as existsSync99 } from "fs";
50694
50812
  function prHeadBranch2(number, cwd) {
50695
50813
  return new Promise((resolve30) => {
50696
50814
  execFile14(
@@ -50703,12 +50821,12 @@ function prHeadBranch2(number, cwd) {
50703
50821
  }
50704
50822
  async function prCheckoutHolder(assistArgs, cwd) {
50705
50823
  const number = prCheckoutNumber(assistArgs);
50706
- if (!number || !cwd || !existsSync100(cwd)) return void 0;
50824
+ if (!number || !cwd || !existsSync99(cwd)) return void 0;
50707
50825
  const headRef = await prHeadBranch2(number, cwd);
50708
50826
  if (!headRef) return void 0;
50709
50827
  const listing = await gitOrNull(cwd, ["worktree", "list", "--porcelain"]);
50710
50828
  const holder = listing ? worktreeWithBranch(listing, headRef) : null;
50711
- if (!holder || !existsSync100(holder)) return void 0;
50829
+ if (!holder || !existsSync99(holder)) return void 0;
50712
50830
  daemonLog(
50713
50831
  `pr #${number} assist ${assistArgs[0]} launched in its checkout ${holder}: head branch ${headRef} is already checked out there, so no worktree is allocated`
50714
50832
  );
@@ -50880,7 +50998,7 @@ function handleConnection(socket, manager) {
50880
50998
  import { unlinkSync as unlinkSync20, writeFileSync as writeFileSync57 } from "fs";
50881
50999
 
50882
51000
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
50883
- import { readFileSync as readFileSync71 } from "fs";
51001
+ import { readFileSync as readFileSync70 } from "fs";
50884
51002
  var WATCHDOG_INTERVAL_MS = 5e3;
50885
51003
  function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
50886
51004
  const timer = setInterval(() => {
@@ -50891,7 +51009,7 @@ function startPidFileWatchdog(onLost, intervalMs = WATCHDOG_INTERVAL_MS) {
50891
51009
  }
50892
51010
  function ownsPidFile() {
50893
51011
  try {
50894
- return readFileSync71(daemonPaths.pid, "utf8").trim() === String(process.pid);
51012
+ return readFileSync70(daemonPaths.pid, "utf8").trim() === String(process.pid);
50895
51013
  } catch {
50896
51014
  return false;
50897
51015
  }
@@ -51596,7 +51714,7 @@ function summaryPathFor(jsonlPath2) {
51596
51714
  }
51597
51715
 
51598
51716
  // src/commands/sessions/summarise/summariseSession.ts
51599
- import { execFileSync as execFileSync31 } from "child_process";
51717
+ import { execFileSync as execFileSync32 } from "child_process";
51600
51718
  function summariseSession(jsonlPath2) {
51601
51719
  const firstMessage = extractFirstUserMessage(jsonlPath2);
51602
51720
  const backlogIds = scanSessionBacklogRefs(jsonlPath2);
@@ -51605,7 +51723,7 @@ function summariseSession(jsonlPath2) {
51605
51723
  }
51606
51724
  const prompt = buildPrompt6(firstMessage, backlogIds);
51607
51725
  try {
51608
- const output = execFileSync31("claude", ["-p", "--model", "haiku", prompt], {
51726
+ const output = execFileSync32("claude", ["-p", "--model", "haiku", prompt], {
51609
51727
  encoding: "utf8",
51610
51728
  timeout: 3e4,
51611
51729
  stdio: ["ignore", "pipe", "ignore"]