@staff0rd/assist 0.916.0 → 0.917.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.916.0",
9
+ version: "0.917.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -27275,11 +27275,8 @@ function fetchQuietly(cwd, intervalMs) {
27275
27275
  }
27276
27276
  }
27277
27277
 
27278
- // src/commands/sessions/daemon/worktree/planAllocation.ts
27278
+ // src/commands/sessions/daemon/worktree/nextWorktreePath.ts
27279
27279
  import { basename as basename18, join as join70 } from "path";
27280
- function planAllocation(clone, boundTreeRoots2) {
27281
- return boundTreeRoots2.has(clone) ? "spill" : "primary";
27282
- }
27283
27280
  function nextWorktreePath(clone, base, isTaken) {
27284
27281
  const name = basename18(clone);
27285
27282
  for (let n = 2; n < 1e3; n++) {
@@ -27336,81 +27333,6 @@ function keptInTree(cwd, reason4) {
27336
27333
  return { cwd, kind: "primary", created: false };
27337
27334
  }
27338
27335
 
27339
- // src/commands/sessions/daemon/worktree/treeDurability.ts
27340
- import { existsSync as existsSync60 } from "fs";
27341
- var treeIsGone = { durable: true, gone: true };
27342
- function treeDurability(state) {
27343
- if (state.dirty) return { durable: false, reason: "uncommitted changes" };
27344
- if (state.localOnlyCommits)
27345
- return { durable: false, reason: "unpushed commits" };
27346
- return { durable: true };
27347
- }
27348
- function* durabilityProbes() {
27349
- const status2 = yield ["status", "--porcelain"];
27350
- if (!status2.ok)
27351
- return { durable: false, reason: `tree state unreadable: ${status2.error}` };
27352
- const dirty = status2.out !== "";
27353
- const upstream = yield [
27354
- "rev-parse",
27355
- "--abbrev-ref",
27356
- "--symbolic-full-name",
27357
- "@{upstream}"
27358
- ];
27359
- if (upstream.ok && upstream.out) {
27360
- const ahead = yield ["rev-list", "--count", "@{upstream}..HEAD"];
27361
- if (ahead.ok && Number(ahead.out) === 0)
27362
- return treeDurability({ dirty, localOnlyCommits: false });
27363
- }
27364
- const remoteBranches = yield ["branch", "-r", "--contains", "HEAD"];
27365
- return treeDurability({
27366
- dirty,
27367
- localOnlyCommits: !remoteBranches.ok || remoteBranches.out === ""
27368
- });
27369
- }
27370
- async function checkDurability(cwd) {
27371
- if (!existsSync60(cwd)) return treeIsGone;
27372
- const probes = durabilityProbes();
27373
- let step3 = probes.next();
27374
- while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
27375
- return step3.value;
27376
- }
27377
- function checkDurabilitySync(cwd) {
27378
- if (!existsSync60(cwd)) return treeIsGone;
27379
- const probes = durabilityProbes();
27380
- let step3 = probes.next();
27381
- while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
27382
- return step3.value;
27383
- }
27384
-
27385
- // src/commands/sessions/daemon/worktree/reusesClone.ts
27386
- function reusesClone(clone, boundTreeRoots2, options2) {
27387
- if (planAllocation(clone, boundTreeRoots2) !== "primary") {
27388
- daemonLog(
27389
- `clone ${clone} is held by a live session \u2014 spilling to a worktree`
27390
- );
27391
- return false;
27392
- }
27393
- if (wouldDisturbWorkInProgress(clone, options2.forCheckout === true))
27394
- return false;
27395
- daemonLog(
27396
- `session kept in the clone ${clone}: no live session holds it${describeHolders(boundTreeRoots2)}`
27397
- );
27398
- return true;
27399
- }
27400
- function describeHolders(boundTreeRoots2) {
27401
- if (boundTreeRoots2.size === 0) return " and no tree is bound";
27402
- return ` (bound trees: ${[...boundTreeRoots2].join(", ")})`;
27403
- }
27404
- function wouldDisturbWorkInProgress(clone, forCheckout) {
27405
- if (!forCheckout) return false;
27406
- const durability = checkDurabilitySync(clone);
27407
- if (durability.durable) return false;
27408
- daemonLog(
27409
- `tree ${clone} not used for a PR checkout: ${durability.reason} \u2014 spilling to a worktree`
27410
- );
27411
- return true;
27412
- }
27413
-
27414
27336
  // src/commands/sessions/daemon/worktree/worktreeConfigFor.ts
27415
27337
  var DISABLED = {
27416
27338
  enabled: false,
@@ -27427,19 +27349,6 @@ function worktreeConfigFor(cwd) {
27427
27349
  }
27428
27350
  }
27429
27351
 
27430
- // src/commands/sessions/daemon/worktree/forcedSpillReason.ts
27431
- function forcedSpillReason(clone, trunk, options2) {
27432
- if (options2.replacesTree)
27433
- return `resumed session spilled out of the clone ${clone}: its worktree ${options2.replacesTree} is gone`;
27434
- if (options2.backlogRun === true)
27435
- return `backlog run spilled out of the clone ${clone}: backlog runs never use the clone`;
27436
- if (trunk === true && options2.commits === true)
27437
- return `committing session spilled out of the clone ${clone}: worktree.trunk is on, so a commit here would land on the local mainline`;
27438
- if (options2.assistCommand !== void 0)
27439
- return `assist ${options2.assistCommand} session spilled out of the clone ${clone}: only prompt sessions use the clone`;
27440
- return void 0;
27441
- }
27442
-
27443
27352
  // src/commands/sessions/daemon/worktree/allocateTree.ts
27444
27353
  function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
27445
27354
  if (!requestedCwd)
@@ -27459,16 +27368,15 @@ function allocateTree(requestedCwd, boundTreeRoots2, options2 = {}) {
27459
27368
  `worktree.enabled is off for ${repoRoot2}, so every session shares this tree`
27460
27369
  );
27461
27370
  const clone = canonicalTreePath(mainWorktree(repoRoot2) ?? repoRoot2);
27462
- const forcedSpill = forcedSpillReason(clone, cfg.trunk, options2);
27463
- if (forcedSpill) daemonLog(forcedSpill);
27464
- else if (reusesClone(clone, boundTreeRoots2, options2))
27465
- return { cwd: clone, kind: "primary", created: false, clone };
27466
27371
  const path108 = createWorktree(
27467
27372
  clone,
27468
27373
  { root: cfg.root, trunk: cfg.trunk },
27469
27374
  boundTreeRoots2,
27470
27375
  options2.replacesTree
27471
27376
  );
27377
+ daemonLog(
27378
+ `session spilled out of the clone ${clone} into ${path108}: worktree.enabled is on, so every session gets its own worktree`
27379
+ );
27472
27380
  return { cwd: path108, kind: "worktree", created: true, clone };
27473
27381
  }
27474
27382
 
@@ -27624,20 +27532,20 @@ function persistedTreeRoots() {
27624
27532
  }
27625
27533
 
27626
27534
  // src/commands/sessions/daemon/worktree/seedWorktree.ts
27627
- import { copyFileSync, existsSync as existsSync62, mkdirSync as mkdirSync19 } from "fs";
27535
+ import { copyFileSync, existsSync as existsSync61, mkdirSync as mkdirSync19 } from "fs";
27628
27536
  import { dirname as dirname32, join as join72 } from "path";
27629
27537
 
27630
27538
  // src/commands/sessions/daemon/worktree/runInstall.ts
27631
27539
  import { resolve as resolve18 } from "path";
27632
27540
 
27633
27541
  // src/commands/sessions/daemon/worktree/detectInstallCommand.ts
27634
- import { existsSync as existsSync61 } from "fs";
27542
+ import { existsSync as existsSync60 } from "fs";
27635
27543
  import { join as join71 } from "path";
27636
27544
  function detectInstallCommand(dir) {
27637
- if (!existsSync61(join71(dir, "package.json"))) return null;
27638
- if (existsSync61(join71(dir, "pnpm-lock.yaml"))) return "pnpm install";
27639
- if (existsSync61(join71(dir, "yarn.lock"))) return "yarn install";
27640
- if (existsSync61(join71(dir, "bun.lockb"))) return "bun install";
27545
+ if (!existsSync60(join71(dir, "package.json"))) return null;
27546
+ if (existsSync60(join71(dir, "pnpm-lock.yaml"))) return "pnpm install";
27547
+ if (existsSync60(join71(dir, "yarn.lock"))) return "yarn install";
27548
+ if (existsSync60(join71(dir, "bun.lockb"))) return "bun install";
27641
27549
  return "npm install";
27642
27550
  }
27643
27551
 
@@ -27803,7 +27711,7 @@ function seedWorktree(worktreePath, clone, onSeeded = () => {
27803
27711
  function copyConfigFiles(worktreePath, clone, copy) {
27804
27712
  for (const rel of copy) {
27805
27713
  const src = join72(clone, rel);
27806
- if (!existsSync62(src)) continue;
27714
+ if (!existsSync61(src)) continue;
27807
27715
  const dest = join72(worktreePath, rel);
27808
27716
  try {
27809
27717
  mkdirSync19(dirname32(dest), { recursive: true });
@@ -27833,10 +27741,7 @@ function seed(worktreePath, clone) {
27833
27741
  async function moveToPrCheckoutTree() {
27834
27742
  if (placedByDaemon()) return;
27835
27743
  const from = process.cwd();
27836
- const alloc = allocateTree(from, persistedTreeRoots(), {
27837
- forCheckout: true,
27838
- commits: true
27839
- });
27744
+ const alloc = allocateTree(from, persistedTreeRoots());
27840
27745
  if (!alloc.cwd || alloc.cwd === from) return;
27841
27746
  process.chdir(alloc.cwd);
27842
27747
  console.log(`Checking the PR out in ${alloc.cwd}`);
@@ -28414,10 +28319,10 @@ function applyIgnore(texts, ignore3) {
28414
28319
  }
28415
28320
 
28416
28321
  // src/commands/miro/readIgnoreList.ts
28417
- import { existsSync as existsSync63, readFileSync as readFileSync42 } from "fs";
28322
+ import { existsSync as existsSync62, readFileSync as readFileSync42 } from "fs";
28418
28323
  import { parse as parse2 } from "yaml";
28419
28324
  function readIgnoreList(file) {
28420
- if (!existsSync63(file))
28325
+ if (!existsSync62(file))
28421
28326
  throw new MiroExtractError(
28422
28327
  `No ignore file at ${file}. Write a YAML list of the box texts to drop, or omit --ignore.`
28423
28328
  );
@@ -29862,7 +29767,7 @@ import { execSync as execSync40 } from "child_process";
29862
29767
  import { execFileSync as execFileSync19 } from "child_process";
29863
29768
 
29864
29769
  // src/commands/prs/loadCommentsCache.ts
29865
- import { existsSync as existsSync64, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
29770
+ import { existsSync as existsSync63, readFileSync as readFileSync45, unlinkSync as unlinkSync13 } from "fs";
29866
29771
  import { parse as parse3 } from "yaml";
29867
29772
 
29868
29773
  // src/commands/prs/commentsCachePath.ts
@@ -29882,7 +29787,7 @@ function commentsCachePath(org, repo, prNumber) {
29882
29787
  // src/commands/prs/loadCommentsCache.ts
29883
29788
  function loadCommentsCache(org, repo, prNumber) {
29884
29789
  const cachePath = commentsCachePath(org, repo, prNumber);
29885
- if (!existsSync64(cachePath)) {
29790
+ if (!existsSync63(cachePath)) {
29886
29791
  return null;
29887
29792
  }
29888
29793
  const content = readFileSync45(cachePath, "utf8");
@@ -29890,7 +29795,7 @@ function loadCommentsCache(org, repo, prNumber) {
29890
29795
  }
29891
29796
  function deleteCommentsCache(org, repo, prNumber) {
29892
29797
  const cachePath = commentsCachePath(org, repo, prNumber);
29893
- if (existsSync64(cachePath)) {
29798
+ if (existsSync63(cachePath)) {
29894
29799
  unlinkSync13(cachePath);
29895
29800
  console.log("No more unresolved line comments. Cache dropped.");
29896
29801
  }
@@ -32801,7 +32706,7 @@ async function notify() {
32801
32706
 
32802
32707
  // src/commands/screenshot.ts
32803
32708
  import { execSync as execSync49 } from "child_process";
32804
- import { existsSync as existsSync65, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync37 } from "fs";
32709
+ import { existsSync as existsSync64, mkdirSync as mkdirSync23, unlinkSync as unlinkSync15, writeFileSync as writeFileSync37 } from "fs";
32805
32710
  import { tmpdir as tmpdir6 } from "os";
32806
32711
  import { join as join80, resolve as resolve24 } from "path";
32807
32712
  import chalk208 from "chalk";
@@ -32933,7 +32838,7 @@ Write-Output $OutputPath
32933
32838
 
32934
32839
  // src/commands/screenshot.ts
32935
32840
  function buildOutputPath(outputDir, processName) {
32936
- if (!existsSync65(outputDir)) {
32841
+ if (!existsSync64(outputDir)) {
32937
32842
  mkdirSync23(outputDir, { recursive: true });
32938
32843
  }
32939
32844
  const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
@@ -36391,9 +36296,9 @@ function highLevelDraftPath(repo, headRef, headSha) {
36391
36296
  }
36392
36297
 
36393
36298
  // src/commands/review/highLevel/readJsonFile.ts
36394
- import { existsSync as existsSync66, readFileSync as readFileSync49 } from "fs";
36299
+ import { existsSync as existsSync65, readFileSync as readFileSync49 } from "fs";
36395
36300
  function readJsonFile(path108) {
36396
- if (!existsSync66(path108)) return void 0;
36301
+ if (!existsSync65(path108)) return void 0;
36397
36302
  try {
36398
36303
  return JSON.parse(readFileSync49(path108, "utf8"));
36399
36304
  } catch {
@@ -38249,7 +38154,7 @@ async function runClaudeReviewer(spec) {
38249
38154
  }
38250
38155
 
38251
38156
  // src/commands/review/runCodexReviewer.ts
38252
- import { existsSync as existsSync67, unlinkSync as unlinkSync16 } from "fs";
38157
+ import { existsSync as existsSync66, unlinkSync as unlinkSync16 } from "fs";
38253
38158
 
38254
38159
  // src/commands/review/parseCodexUsage.ts
38255
38160
  function parseCodexUsage(usage) {
@@ -38338,7 +38243,7 @@ async function runCodexReviewer(spec) {
38338
38243
  ...override.args.length > 0 ? { env: override.env } : {},
38339
38244
  onLine
38340
38245
  });
38341
- if (result.exitCode !== 0 && existsSync67(spec.outputPath)) {
38246
+ if (result.exitCode !== 0 && existsSync66(spec.outputPath)) {
38342
38247
  unlinkSync16(spec.outputPath);
38343
38248
  }
38344
38249
  const finalised = finaliseReviewerRun(
@@ -38429,7 +38334,7 @@ async function runReviewers(reviewDir, claudePath, codexPath, stdinPrompt, optio
38429
38334
  }
38430
38335
 
38431
38336
  // src/commands/review/synthesiseAfterReviewers.ts
38432
- import { existsSync as existsSync68, unlinkSync as unlinkSync17 } from "fs";
38337
+ import { existsSync as existsSync67, unlinkSync as unlinkSync17 } from "fs";
38433
38338
 
38434
38339
  // src/commands/review/synthesise.ts
38435
38340
  import { readFileSync as readFileSync51 } from "fs";
@@ -38536,7 +38441,7 @@ async function synthesise(paths, options2) {
38536
38441
  // src/commands/review/synthesiseAfterReviewers.ts
38537
38442
  async function synthesiseAfterReviewers(input) {
38538
38443
  const { paths, failures } = input;
38539
- if (input.anyFresh && existsSync68(paths.synthesisPath)) {
38444
+ if (input.anyFresh && existsSync67(paths.synthesisPath)) {
38540
38445
  unlinkSync17(paths.synthesisPath);
38541
38446
  }
38542
38447
  const synthesisResult = await synthesise(paths, {
@@ -38817,10 +38722,10 @@ function fetchExistingComments() {
38817
38722
  }
38818
38723
 
38819
38724
  // src/commands/review/prepareReviewDir.ts
38820
- import { existsSync as existsSync69, mkdirSync as mkdirSync26, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
38725
+ import { existsSync as existsSync68, mkdirSync as mkdirSync26, unlinkSync as unlinkSync18, writeFileSync as writeFileSync40 } from "fs";
38821
38726
  function clearReviewFiles(paths) {
38822
38727
  for (const path108 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
38823
- if (existsSync69(path108)) unlinkSync18(path108);
38728
+ if (existsSync68(path108)) unlinkSync18(path108);
38824
38729
  }
38825
38730
  }
38826
38731
  function prepareReviewDir(paths, requestBody, force) {
@@ -39474,7 +39379,7 @@ function registerReview(program) {
39474
39379
  }
39475
39380
 
39476
39381
  // src/commands/rules/addRule.ts
39477
- import { existsSync as existsSync72, readFileSync as readFileSync56, writeFileSync as writeFileSync42 } from "fs";
39382
+ import { existsSync as existsSync71, readFileSync as readFileSync56, writeFileSync as writeFileSync42 } from "fs";
39478
39383
  import path87 from "path";
39479
39384
  import chalk242 from "chalk";
39480
39385
 
@@ -39531,7 +39436,7 @@ function nextRuleCode(root2) {
39531
39436
  }
39532
39437
 
39533
39438
  // src/commands/rules/resolveRuleScope.ts
39534
- import { existsSync as existsSync70 } from "fs";
39439
+ import { existsSync as existsSync69 } from "fs";
39535
39440
  import path84 from "path";
39536
39441
  function resolveRuleScope(target) {
39537
39442
  const resolved = path84.resolve(target);
@@ -39541,7 +39446,7 @@ function resolveRuleScope(target) {
39541
39446
  let current = startDir;
39542
39447
  while (true) {
39543
39448
  const candidate = path84.join(current, "CLAUDE.md");
39544
- if (existsSync70(candidate)) return candidate;
39449
+ if (existsSync69(candidate)) return candidate;
39545
39450
  if (current === root2 || current === path84.dirname(current)) break;
39546
39451
  current = path84.dirname(current);
39547
39452
  }
@@ -39549,7 +39454,7 @@ function resolveRuleScope(target) {
39549
39454
  }
39550
39455
 
39551
39456
  // src/commands/rules/updateScopedRulesIndex.ts
39552
- import { existsSync as existsSync71, readFileSync as readFileSync55, writeFileSync as writeFileSync41 } from "fs";
39457
+ import { existsSync as existsSync70, readFileSync as readFileSync55, writeFileSync as writeFileSync41 } from "fs";
39553
39458
  import path86 from "path";
39554
39459
 
39555
39460
  // src/commands/rules/scopedRuleDirectories.ts
@@ -39599,7 +39504,7 @@ function upsertScopedRulesPointer(content, directories) {
39599
39504
  function updateScopedRulesIndex(root2) {
39600
39505
  const directories = scopedRuleDirectories(root2);
39601
39506
  const rootFile = path86.join(root2, "CLAUDE.md");
39602
- const before = existsSync71(rootFile) ? readFileSync55(rootFile, "utf8") : "";
39507
+ const before = existsSync70(rootFile) ? readFileSync55(rootFile, "utf8") : "";
39603
39508
  const after = upsertScopedRulesPointer(before, directories);
39604
39509
  if (after !== before) writeFileSync41(rootFile, after);
39605
39510
  return directories;
@@ -39607,7 +39512,7 @@ function updateScopedRulesIndex(root2) {
39607
39512
 
39608
39513
  // src/commands/rules/addRule.ts
39609
39514
  function read2(file) {
39610
- return existsSync72(file) ? readFileSync56(file, "utf8") : "";
39515
+ return existsSync71(file) ? readFileSync56(file, "utf8") : "";
39611
39516
  }
39612
39517
  function addRule(text17, options2) {
39613
39518
  const rule = text17.trim();
@@ -41019,7 +40924,7 @@ function registerSync(program) {
41019
40924
  }
41020
40925
 
41021
40926
  // src/commands/transcript/clean.ts
41022
- import { existsSync as existsSync77 } from "fs";
40927
+ import { existsSync as existsSync76 } from "fs";
41023
40928
 
41024
40929
  // src/commands/transcript/convert/formatTimestamp.ts
41025
40930
  function pad(value, width2) {
@@ -41297,7 +41202,7 @@ function clean(file, options2 = {}) {
41297
41202
  );
41298
41203
  process.exit(1);
41299
41204
  }
41300
- if (!existsSync77(file)) {
41205
+ if (!existsSync76(file)) {
41301
41206
  console.error(`Error: VTT file not found: ${file}`);
41302
41207
  process.exit(1);
41303
41208
  }
@@ -41380,11 +41285,11 @@ async function configure() {
41380
41285
  }
41381
41286
 
41382
41287
  // src/commands/transcript/list.ts
41383
- import { existsSync as existsSync78, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
41288
+ import { existsSync as existsSync77, readdirSync as readdirSync20, statSync as statSync12 } from "fs";
41384
41289
  import { join as join97 } from "path";
41385
41290
  function list4() {
41386
41291
  const { vttDir } = getTranscriptConfig();
41387
- if (!existsSync78(vttDir)) return;
41292
+ if (!existsSync77(vttDir)) return;
41388
41293
  for (const entry of readdirSync20(vttDir)) {
41389
41294
  if (!entry.endsWith(".vtt")) continue;
41390
41295
  if (statSync12(join97(vttDir, entry)).isDirectory()) continue;
@@ -41393,7 +41298,7 @@ function list4() {
41393
41298
  }
41394
41299
 
41395
41300
  // src/commands/transcript/move.ts
41396
- import { existsSync as existsSync79, mkdirSync as mkdirSync34, renameSync as renameSync4, writeFileSync as writeFileSync49 } from "fs";
41301
+ import { existsSync as existsSync78, mkdirSync as mkdirSync34, renameSync as renameSync4, writeFileSync as writeFileSync49 } from "fs";
41397
41302
  import { basename as basename27, join as join98 } from "path";
41398
41303
 
41399
41304
  // src/commands/transcript/convertVttToMarkdown.ts
@@ -41417,7 +41322,7 @@ function move(file, options2) {
41417
41322
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
41418
41323
  const filename = basename27(file);
41419
41324
  const sourcePath = join98(vttDir, filename);
41420
- if (!existsSync79(sourcePath)) {
41325
+ if (!existsSync78(sourcePath)) {
41421
41326
  console.error(`Error: VTT file not found: ${sourcePath}`);
41422
41327
  process.exit(1);
41423
41328
  }
@@ -41434,7 +41339,7 @@ function move(file, options2) {
41434
41339
  }
41435
41340
 
41436
41341
  // src/commands/transcript/merge.ts
41437
- import { existsSync as existsSync80, writeFileSync as writeFileSync50 } from "fs";
41342
+ import { existsSync as existsSync79, writeFileSync as writeFileSync50 } from "fs";
41438
41343
  import { basename as basename28 } from "path";
41439
41344
 
41440
41345
  // src/commands/transcript/failTranscript.ts
@@ -41578,7 +41483,7 @@ function widenAudience(passages) {
41578
41483
 
41579
41484
  // src/commands/transcript/merge.ts
41580
41485
  function readSource3(file) {
41581
- if (!existsSync80(file)) failTranscript(`VTT file not found: ${file}`);
41486
+ if (!existsSync79(file)) failTranscript(`VTT file not found: ${file}`);
41582
41487
  const cues = readCleanedCues(file);
41583
41488
  if (cues.length === 0) failTranscript(`no cues found in: ${file}`);
41584
41489
  return { path: file, name: basename28(file), cues };
@@ -42045,7 +41950,7 @@ function configKeys2() {
42045
41950
  }
42046
41951
 
42047
41952
  // src/commands/verify/forbiddenStrings.ts
42048
- import { existsSync as existsSync81, readFileSync as readFileSync63 } from "fs";
41953
+ import { existsSync as existsSync80, readFileSync as readFileSync63 } from "fs";
42049
41954
 
42050
41955
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
42051
41956
  import { minimatch as minimatch10 } from "minimatch";
@@ -42086,7 +41991,7 @@ function forbiddenStrings() {
42086
41991
  const cache7 = /* @__PURE__ */ new Map();
42087
41992
  const readJson = (file) => {
42088
41993
  if (cache7.has(file)) return cache7.get(file);
42089
- if (!existsSync81(file)) {
41994
+ if (!existsSync80(file)) {
42090
41995
  console.log(`Forbidden-strings file not found: ${file}`);
42091
41996
  process.exit(1);
42092
41997
  }
@@ -42774,7 +42679,7 @@ function resolveParams(params, cliArgs) {
42774
42679
  }
42775
42680
 
42776
42681
  // src/commands/run/resolveRunCwd.ts
42777
- import { existsSync as existsSync82 } from "fs";
42682
+ import { existsSync as existsSync81 } from "fs";
42778
42683
  import { resolve as resolve27 } from "path";
42779
42684
  var MissingRunCwdError = class extends Error {
42780
42685
  constructor(runName, cwd) {
@@ -42787,7 +42692,7 @@ var MissingRunCwdError = class extends Error {
42787
42692
  function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
42788
42693
  if (!config.cwd) return void 0;
42789
42694
  const cwd = resolve27(baseDir, config.cwd);
42790
- if (!existsSync82(cwd)) throw new MissingRunCwdError(config.name, cwd);
42695
+ if (!existsSync81(cwd)) throw new MissingRunCwdError(config.name, cwd);
42791
42696
  return cwd;
42792
42697
  }
42793
42698
 
@@ -42907,10 +42812,10 @@ ${buildWatchReport(from)}`);
42907
42812
  }
42908
42813
 
42909
42814
  // src/commands/watch/consumeMarker.ts
42910
- import { existsSync as existsSync83, rmSync as rmSync10 } from "fs";
42815
+ import { existsSync as existsSync82, rmSync as rmSync10 } from "fs";
42911
42816
  function consumeMarker(path108) {
42912
42817
  try {
42913
- if (!existsSync83(path108)) return false;
42818
+ if (!existsSync82(path108)) return false;
42914
42819
  rmSync10(path108);
42915
42820
  return true;
42916
42821
  } catch {
@@ -43841,7 +43746,7 @@ function registerRunAdd(runCommand) {
43841
43746
  }
43842
43747
 
43843
43748
  // src/commands/run/remove.ts
43844
- import { existsSync as existsSync84, unlinkSync as unlinkSync19 } from "fs";
43749
+ import { existsSync as existsSync83, unlinkSync as unlinkSync19 } from "fs";
43845
43750
  import { join as join101 } from "path";
43846
43751
 
43847
43752
  // src/commands/run/removeRepoRunConfig.ts
@@ -43861,7 +43766,7 @@ function removeRepoRunConfig(name, repoName, cwd = process.cwd()) {
43861
43766
  // src/commands/run/remove.ts
43862
43767
  function deleteCommandFile(name) {
43863
43768
  const filePath = join101(".claude", "commands", `${name}.md`);
43864
- if (existsSync84(filePath)) {
43769
+ if (existsSync83(filePath)) {
43865
43770
  unlinkSync19(filePath);
43866
43771
  console.log(`Deleted command file: ${filePath}`);
43867
43772
  }
@@ -44309,12 +44214,12 @@ function toSessionRunInfo({
44309
44214
  }
44310
44215
 
44311
44216
  // src/commands/sessions/daemon/worktree/joinRefusal.ts
44312
- import { existsSync as existsSync85 } from "fs";
44217
+ import { existsSync as existsSync84 } from "fs";
44313
44218
  function joinRefusal(session) {
44314
44219
  if (session.commandType === "run") return "a server run has no agent stream";
44315
44220
  if (session.closing === true) return "the session is closing";
44316
44221
  if (!session.cwd) return "the session has no working directory";
44317
- if (!existsSync85(session.cwd))
44222
+ if (!existsSync84(session.cwd))
44318
44223
  return "the session's workspace no longer exists";
44319
44224
  return void 0;
44320
44225
  }
@@ -44395,7 +44300,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
44395
44300
  }
44396
44301
 
44397
44302
  // src/commands/sessions/daemon/findServerParents.ts
44398
- import { existsSync as existsSync86 } from "fs";
44303
+ import { existsSync as existsSync85 } from "fs";
44399
44304
  import { join as join102, resolve as resolve29 } from "path";
44400
44305
  function isLive(session) {
44401
44306
  return !!session.pty && session.status !== "done" && session.status !== "error";
@@ -44405,7 +44310,7 @@ function isLiveAgent(session) {
44405
44310
  }
44406
44311
  function serverRunDirs(sessions, file) {
44407
44312
  return new Set(
44408
- sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync86(join102(dir, file)))
44313
+ sessions.filter((s) => s.server && s.cwd && isLive(s)).map((s) => resolve29(s.cwd)).filter((dir) => existsSync85(join102(dir, file)))
44409
44314
  );
44410
44315
  }
44411
44316
  function findServerParents(sessions, file) {
@@ -45021,11 +44926,11 @@ function sessionBase(id, status2) {
45021
44926
  }
45022
44927
 
45023
44928
  // src/commands/sessions/daemon/spawnPty.ts
45024
- import { existsSync as existsSync89 } from "fs";
44929
+ import { existsSync as existsSync88 } from "fs";
45025
44930
  import * as pty from "node-pty";
45026
44931
 
45027
44932
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
45028
- import { chmodSync, existsSync as existsSync88, statSync as statSync14 } from "fs";
44933
+ import { chmodSync, existsSync as existsSync87, statSync as statSync14 } from "fs";
45029
44934
  import { createRequire as createRequire3 } from "module";
45030
44935
  import path105 from "path";
45031
44936
  var require4 = createRequire3(import.meta.url);
@@ -45040,7 +44945,7 @@ function ensureSpawnHelperExecutable() {
45040
44945
  `${process.platform}-${process.arch}`,
45041
44946
  "spawn-helper"
45042
44947
  );
45043
- if (!existsSync88(helper)) return;
44948
+ if (!existsSync87(helper)) return;
45044
44949
  const mode = statSync14(helper).mode;
45045
44950
  if ((mode & 73) === 0) chmodSync(helper, mode | 493);
45046
44951
  }
@@ -45096,7 +45001,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
45096
45001
  });
45097
45002
  }
45098
45003
  function refuseMissingCwd(cwd, sessionId) {
45099
- if (!cwd || existsSync89(cwd)) return;
45004
+ if (!cwd || existsSync88(cwd)) return;
45100
45005
  daemonLog(
45101
45006
  `${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
45102
45007
  );
@@ -45266,7 +45171,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
45266
45171
  }
45267
45172
 
45268
45173
  // src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
45269
- import { existsSync as existsSync90, rmSync as rmSync11, writeFileSync as writeFileSync54 } from "fs";
45174
+ import { existsSync as existsSync89, rmSync as rmSync11, writeFileSync as writeFileSync54 } from "fs";
45270
45175
  var paused;
45271
45176
  var wake;
45272
45177
  function persist2(value) {
@@ -45278,7 +45183,7 @@ function persist2(value) {
45278
45183
  }
45279
45184
  var autoUpdateControl = {
45280
45185
  paused: () => {
45281
- paused ??= existsSync90(daemonPaths.autoUpdatePaused);
45186
+ paused ??= existsSync89(daemonPaths.autoUpdatePaused);
45282
45187
  return paused;
45283
45188
  },
45284
45189
  setPaused: (value) => {
@@ -45474,6 +45379,52 @@ function bindResumedWorktree(session, cwd, notify2) {
45474
45379
  notify2();
45475
45380
  }
45476
45381
 
45382
+ // src/commands/sessions/daemon/worktree/treeDurability.ts
45383
+ import { existsSync as existsSync90 } from "fs";
45384
+ var treeIsGone = { durable: true, gone: true };
45385
+ function treeDurability(state) {
45386
+ if (state.dirty) return { durable: false, reason: "uncommitted changes" };
45387
+ if (state.localOnlyCommits)
45388
+ return { durable: false, reason: "unpushed commits" };
45389
+ return { durable: true };
45390
+ }
45391
+ function* durabilityProbes() {
45392
+ const status2 = yield ["status", "--porcelain"];
45393
+ if (!status2.ok)
45394
+ return { durable: false, reason: `tree state unreadable: ${status2.error}` };
45395
+ const dirty = status2.out !== "";
45396
+ const upstream = yield [
45397
+ "rev-parse",
45398
+ "--abbrev-ref",
45399
+ "--symbolic-full-name",
45400
+ "@{upstream}"
45401
+ ];
45402
+ if (upstream.ok && upstream.out) {
45403
+ const ahead = yield ["rev-list", "--count", "@{upstream}..HEAD"];
45404
+ if (ahead.ok && Number(ahead.out) === 0)
45405
+ return treeDurability({ dirty, localOnlyCommits: false });
45406
+ }
45407
+ const remoteBranches = yield ["branch", "-r", "--contains", "HEAD"];
45408
+ return treeDurability({
45409
+ dirty,
45410
+ localOnlyCommits: !remoteBranches.ok || remoteBranches.out === ""
45411
+ });
45412
+ }
45413
+ async function checkDurability(cwd) {
45414
+ if (!existsSync90(cwd)) return treeIsGone;
45415
+ const probes = durabilityProbes();
45416
+ let step3 = probes.next();
45417
+ while (!step3.done) step3 = probes.next(await gitResult(cwd, step3.value));
45418
+ return step3.value;
45419
+ }
45420
+ function checkDurabilitySync(cwd) {
45421
+ if (!existsSync90(cwd)) return treeIsGone;
45422
+ const probes = durabilityProbes();
45423
+ let step3 = probes.next();
45424
+ while (!step3.done) step3 = probes.next(gitSyncResult(cwd, step3.value));
45425
+ return step3.value;
45426
+ }
45427
+
45477
45428
  // src/commands/sessions/daemon/worktree/boundTreeRoots.ts
45478
45429
  function boundTreeRoots(sessions, exclude) {
45479
45430
  const roots = /* @__PURE__ */ new Set();
@@ -50098,36 +50049,6 @@ function addAgentToStream(ctx, targetId, request) {
50098
50049
  };
50099
50050
  }
50100
50051
 
50101
- // src/commands/sessions/daemon/worktree/isBacklogRunArgs.ts
50102
- var ITEM_ID = /^a?\d+$/;
50103
- function isBacklogRunArgs(args) {
50104
- const [command, subcommand, ...rest] = args;
50105
- if (command !== "backlog" || subcommand !== "run") return false;
50106
- return rest.some((arg) => ITEM_ID.test(arg));
50107
- }
50108
-
50109
- // src/commands/sessions/daemon/worktree/prCheckoutNumber.ts
50110
- var CHECKOUT_COMMANDS = /* @__PURE__ */ new Set([
50111
- "review",
50112
- "review-pr-comments",
50113
- "fix-conflict"
50114
- ]);
50115
- function prCheckoutNumber(args) {
50116
- const [command, ...rest] = args;
50117
- if (!command || !CHECKOUT_COMMANDS.has(command)) return void 0;
50118
- return rest.find((arg) => /^[1-9]\d*$/.test(arg));
50119
- }
50120
-
50121
- // src/commands/sessions/daemon/worktree/isPrCheckoutArgs.ts
50122
- function isPrCheckoutArgs(args) {
50123
- return prCheckoutNumber(args) !== void 0;
50124
- }
50125
-
50126
- // src/commands/sessions/daemon/worktree/isCommittingArgs.ts
50127
- function isCommittingArgs(args) {
50128
- return isPrCheckoutArgs(args) || isBacklogRunArgs(args);
50129
- }
50130
-
50131
50052
  // src/commands/sessions/daemon/worktree/spawnInTree.ts
50132
50053
  function spawnInTree(ctx, { prompt, cwd, design, auto, harness, inPlace }, context) {
50133
50054
  return allocateAndBind(
@@ -50150,13 +50071,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
50150
50071
  ctx,
50151
50072
  cwd,
50152
50073
  (sid, resolvedCwd, holdUntilSeeded) => createAssistSession(sid, assistArgs, resolvedCwd, meta, holdUntilSeeded),
50153
- {
50154
- forCheckout: isPrCheckoutArgs(assistArgs),
50155
- commits: isCommittingArgs(assistArgs),
50156
- backlogRun: isBacklogRunArgs(assistArgs),
50157
- assistCommand: assistArgs[0] ?? "",
50158
- inPlace: meta?.inPlace
50159
- },
50074
+ { inPlace: meta?.inPlace },
50160
50075
  context
50161
50076
  );
50162
50077
  }
@@ -51246,6 +51161,23 @@ var sessionSettingHandlers = {
51246
51161
  )
51247
51162
  };
51248
51163
 
51164
+ // src/commands/sessions/daemon/worktree/prCheckoutNumber.ts
51165
+ var CHECKOUT_COMMANDS = /* @__PURE__ */ new Set([
51166
+ "review",
51167
+ "review-pr-comments",
51168
+ "fix-conflict"
51169
+ ]);
51170
+ function prCheckoutNumber(args) {
51171
+ const [command, ...rest] = args;
51172
+ if (!command || !CHECKOUT_COMMANDS.has(command)) return void 0;
51173
+ return rest.find((arg) => /^[1-9]\d*$/.test(arg));
51174
+ }
51175
+
51176
+ // src/commands/sessions/daemon/worktree/isPrCheckoutArgs.ts
51177
+ function isPrCheckoutArgs(args) {
51178
+ return prCheckoutNumber(args) !== void 0;
51179
+ }
51180
+
51249
51181
  // src/commands/sessions/daemon/worktree/prCheckoutHolder.ts
51250
51182
  import { execFile as execFile14 } from "child_process";
51251
51183
  import { existsSync as existsSync101 } from "fs";