@staff0rd/assist 0.618.1 → 0.619.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.618.1",
9
+ version: "0.619.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -11341,8 +11341,8 @@ function subsequenceScore(text18, query) {
11341
11341
  function scoreFilePath(path90, query) {
11342
11342
  const needle = query.trim().toLowerCase();
11343
11343
  if (!needle) return 0;
11344
- const basename26 = path90.slice(path90.lastIndexOf("/") + 1);
11345
- const inBasename = subsequenceScore(basename26, needle);
11344
+ const basename27 = path90.slice(path90.lastIndexOf("/") + 1);
11345
+ const inBasename = subsequenceScore(basename27, needle);
11346
11346
  if (inBasename !== null) return BASENAME_WEIGHT + inBasename;
11347
11347
  return subsequenceScore(path90, needle);
11348
11348
  }
@@ -18132,11 +18132,11 @@ function pushTargetForRenamedUpstream(trunkMode) {
18132
18132
  const remote = gitOrNull2(
18133
18133
  `git config --get branch.${shellQuote(branch2)}.remote`
18134
18134
  );
18135
- const merge = gitOrNull2(
18135
+ const merge2 = gitOrNull2(
18136
18136
  `git config --get branch.${shellQuote(branch2)}.merge`
18137
18137
  );
18138
- if (!remote || !merge) return null;
18139
- const upstream = merge.startsWith(HEADS_PREFIX) ? merge.slice(HEADS_PREFIX.length) : merge;
18138
+ if (!remote || !merge2) return null;
18139
+ const upstream = merge2.startsWith(HEADS_PREFIX) ? merge2.slice(HEADS_PREFIX.length) : merge2;
18140
18140
  if (upstream === branch2) return null;
18141
18141
  return trunkMode ? landOnTrackedMainline(remote, upstream) : raiseOwnRemoteBranch(remote, branch2);
18142
18142
  }
@@ -23801,8 +23801,8 @@ async function reviewPrComments(number, options2 = {}) {
23801
23801
 
23802
23802
  // src/commands/fixConflict.ts
23803
23803
  import { randomUUID as randomUUID11 } from "crypto";
23804
- function buildPrompt3(rebase) {
23805
- return rebase ? "/fix-conflict --rebase" : "/fix-conflict";
23804
+ function buildPrompt3(rebase2) {
23805
+ return rebase2 ? "/fix-conflict --rebase" : "/fix-conflict";
23806
23806
  }
23807
23807
  async function fixConflict(number, options2 = {}) {
23808
23808
  const { resumeSessionId } = options2;
@@ -28625,8 +28625,8 @@ function findRootParent(file, importedBy, visited) {
28625
28625
  function clusterFiles(graph) {
28626
28626
  const clusters = /* @__PURE__ */ new Map();
28627
28627
  for (const file of graph.files) {
28628
- const basename26 = path61.basename(file, path61.extname(file));
28629
- if (basename26 === "index") continue;
28628
+ const basename27 = path61.basename(file, path61.extname(file));
28629
+ if (basename27 === "index") continue;
28630
28630
  const importers = graph.importedBy.get(file);
28631
28631
  if (!importers || importers.size !== 1) continue;
28632
28632
  const parent = [...importers][0];
@@ -32437,9 +32437,28 @@ function formatCue(cue) {
32437
32437
  return `${timing}
32438
32438
  ${text18}`;
32439
32439
  }
32440
+ function formatClock(ms) {
32441
+ return formatTimestamp2(ms).slice(0, 8);
32442
+ }
32443
+ function formatNoteBlock(lines2) {
32444
+ return lines2.length ? [lines2.map((line) => `NOTE ${line}`).join("\n")] : [];
32445
+ }
32446
+ function formatPassage(passage) {
32447
+ return [
32448
+ `NOTE source: ${passage.source} @ ${formatClock(passage.sourceStartMs)}`,
32449
+ ...passage.cues.map(formatCue)
32450
+ ];
32451
+ }
32440
32452
  function formatVtt(cues) {
32441
32453
  return ["WEBVTT", ...cues.map(formatCue)].join("\n\n");
32442
32454
  }
32455
+ function formatVttPassages(passages, notes = []) {
32456
+ return [
32457
+ "WEBVTT",
32458
+ ...formatNoteBlock(notes),
32459
+ ...passages.flatMap(formatPassage)
32460
+ ].join("\n\n");
32461
+ }
32443
32462
 
32444
32463
  // src/commands/transcript/convert/readCleanedCues.ts
32445
32464
  import { readFileSync as readFileSync55 } from "fs";
@@ -32558,9 +32577,62 @@ function list4() {
32558
32577
  }
32559
32578
  }
32560
32579
 
32580
+ // src/commands/transcript/merge.ts
32581
+ import { existsSync as existsSync73, writeFileSync as writeFileSync46 } from "fs";
32582
+ import { basename as basename21 } from "path";
32583
+ var JOIN_GAP_MS = 1e3;
32584
+ function fail6(message3) {
32585
+ console.error(`Error: ${message3}`);
32586
+ process.exit(1);
32587
+ }
32588
+ function readSource2(file) {
32589
+ if (!existsSync73(file)) fail6(`VTT file not found: ${file}`);
32590
+ const cues = readCleanedCues(file);
32591
+ if (cues.length === 0) fail6(`no cues found in: ${file}`);
32592
+ return { source: basename21(file), sourceStartMs: cues[0].startMs, cues };
32593
+ }
32594
+ function shift(cues, offsetMs) {
32595
+ return cues.map((cue) => ({
32596
+ ...cue,
32597
+ startMs: cue.startMs + offsetMs,
32598
+ endMs: cue.endMs + offsetMs
32599
+ }));
32600
+ }
32601
+ function lastEndMs(cues) {
32602
+ return Math.max(...cues.map((cue) => cue.endMs));
32603
+ }
32604
+ function rebase(passages) {
32605
+ let cursorMs = 0;
32606
+ return passages.map((passage) => {
32607
+ const cues = shift(passage.cues, cursorMs - passage.sourceStartMs);
32608
+ cursorMs = lastEndMs(cues) + JOIN_GAP_MS;
32609
+ return { ...passage, cues };
32610
+ });
32611
+ }
32612
+ function headerNotes(sources) {
32613
+ return [
32614
+ `Collapsed ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)} from:`,
32615
+ ...sources.map((source) => ` ${source}`)
32616
+ ];
32617
+ }
32618
+ function merge(files, options2 = {}) {
32619
+ const passages = rebase(files.map(readSource2));
32620
+ const document = formatVttPassages(
32621
+ passages,
32622
+ headerNotes(files.map((file) => basename21(file)))
32623
+ );
32624
+ if (!options2.out) {
32625
+ console.log(document);
32626
+ return;
32627
+ }
32628
+ writeFileSync46(options2.out, `${document}
32629
+ `, "utf8");
32630
+ console.log(`Merged transcript: ${options2.out}`);
32631
+ }
32632
+
32561
32633
  // src/commands/transcript/move.ts
32562
- import { existsSync as existsSync73, mkdirSync as mkdirSync28, renameSync as renameSync2, writeFileSync as writeFileSync46 } from "fs";
32563
- import { basename as basename21, join as join85 } from "path";
32634
+ import { existsSync as existsSync74, mkdirSync as mkdirSync28, renameSync as renameSync2, writeFileSync as writeFileSync47 } from "fs";
32635
+ import { basename as basename22, join as join85 } from "path";
32564
32636
 
32565
32637
  // src/commands/transcript/convertVttToMarkdown.ts
32566
32638
  function convertVttToMarkdown(inputPath) {
@@ -32581,18 +32653,18 @@ function move(file, options2) {
32581
32653
  process.exit(1);
32582
32654
  }
32583
32655
  const { vttDir, transcriptsDir, summaryDir } = getTranscriptConfig();
32584
- const filename = basename21(file);
32656
+ const filename = basename22(file);
32585
32657
  const sourcePath = join85(vttDir, filename);
32586
- if (!existsSync73(sourcePath)) {
32658
+ if (!existsSync74(sourcePath)) {
32587
32659
  console.error(`Error: VTT file not found: ${sourcePath}`);
32588
32660
  process.exit(1);
32589
32661
  }
32590
- const base = basename21(filename, ".vtt").replace(/ Transcription$/, "");
32662
+ const base = basename22(filename, ".vtt").replace(/ Transcription$/, "");
32591
32663
  const outputName = `${date} ${base}.md`;
32592
32664
  const formattedDir = join85(transcriptsDir, client);
32593
32665
  mkdirSync28(formattedDir, { recursive: true });
32594
32666
  const formattedPath = join85(formattedDir, outputName);
32595
- writeFileSync46(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
32667
+ writeFileSync47(formattedPath, convertVttToMarkdown(sourcePath), "utf8");
32596
32668
  archiveRawVtt(vttDir, sourcePath, filename);
32597
32669
  const summaryPath = join85(summaryDir, client, outputName);
32598
32670
  console.log(`Formatted transcript: ${formattedPath}`);
@@ -32606,6 +32678,9 @@ function registerTranscript(program2) {
32606
32678
  transcriptCommand.command("configure").description("Configure transcript directories").action(configure);
32607
32679
  transcriptCommand.command("list").description("List raw .vtt filenames waiting in the pick-up directory").action(list4);
32608
32680
  transcriptCommand.command("clean <path>").description("Clean any .vtt file and write the result to stdout").option("--format <md|vtt>", "output format", "md").action(clean);
32681
+ transcriptCommand.command("merge <path...>").description(
32682
+ "Collapse several .vtt files into one transcript with NOTE provenance"
32683
+ ).option("--out <path>", "write the merged transcript to this path").action(merge);
32609
32684
  transcriptCommand.command("move <file>").description(
32610
32685
  "Convert a raw .vtt to a dated markdown transcript and archive the original"
32611
32686
  ).requiredOption("--date <YYYY-MM-DD>", "meeting date").requiredOption("--client <name>", "client name").action(move);
@@ -32713,9 +32788,9 @@ function devices() {
32713
32788
  }
32714
32789
 
32715
32790
  // src/commands/voice/logs.ts
32716
- import { existsSync as existsSync74, readFileSync as readFileSync56 } from "fs";
32791
+ import { existsSync as existsSync75, readFileSync as readFileSync56 } from "fs";
32717
32792
  function logs(options2) {
32718
- if (!existsSync74(voicePaths.log)) {
32793
+ if (!existsSync75(voicePaths.log)) {
32719
32794
  console.log("No voice log file found");
32720
32795
  return;
32721
32796
  }
@@ -32747,7 +32822,7 @@ import { join as join89 } from "path";
32747
32822
 
32748
32823
  // src/commands/voice/checkLockFile.ts
32749
32824
  import { execSync as execSync59 } from "child_process";
32750
- import { existsSync as existsSync75, mkdirSync as mkdirSync29, readFileSync as readFileSync57, writeFileSync as writeFileSync47 } from "fs";
32825
+ import { existsSync as existsSync76, mkdirSync as mkdirSync29, readFileSync as readFileSync57, writeFileSync as writeFileSync48 } from "fs";
32751
32826
  import { join as join88 } from "path";
32752
32827
  function isProcessAlive2(pid) {
32753
32828
  try {
@@ -32759,7 +32834,7 @@ function isProcessAlive2(pid) {
32759
32834
  }
32760
32835
  function checkLockFile() {
32761
32836
  const lockFile = getLockFile();
32762
- if (!existsSync75(lockFile)) return;
32837
+ if (!existsSync76(lockFile)) return;
32763
32838
  try {
32764
32839
  const lock2 = JSON.parse(readFileSync57(lockFile, "utf8"));
32765
32840
  if (lock2.pid && isProcessAlive2(lock2.pid)) {
@@ -32772,7 +32847,7 @@ function checkLockFile() {
32772
32847
  }
32773
32848
  }
32774
32849
  function bootstrapVenv() {
32775
- if (existsSync75(getVenvPython())) return;
32850
+ if (existsSync76(getVenvPython())) return;
32776
32851
  console.log("Setting up Python environment...");
32777
32852
  const pythonDir = getPythonDir();
32778
32853
  execSync59(
@@ -32786,7 +32861,7 @@ function bootstrapVenv() {
32786
32861
  function writeLockFile(pid) {
32787
32862
  const lockFile = getLockFile();
32788
32863
  mkdirSync29(join88(lockFile, ".."), { recursive: true });
32789
- writeFileSync47(
32864
+ writeFileSync48(
32790
32865
  lockFile,
32791
32866
  JSON.stringify({
32792
32867
  pid,
@@ -32814,7 +32889,7 @@ function setup() {
32814
32889
 
32815
32890
  // src/commands/voice/start.ts
32816
32891
  import { spawn as spawn8 } from "child_process";
32817
- import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync48 } from "fs";
32892
+ import { mkdirSync as mkdirSync31, writeFileSync as writeFileSync49 } from "fs";
32818
32893
  import { join as join90 } from "path";
32819
32894
 
32820
32895
  // src/commands/voice/buildDaemonEnv.ts
@@ -32843,7 +32918,7 @@ function spawnBackground(python, script, env) {
32843
32918
  console.error("Failed to start voice daemon");
32844
32919
  process.exit(1);
32845
32920
  }
32846
- writeFileSync48(voicePaths.pid, String(pid));
32921
+ writeFileSync49(voicePaths.pid, String(pid));
32847
32922
  writeLockFile(pid);
32848
32923
  console.log(`Voice daemon started (PID ${pid})`);
32849
32924
  }
@@ -32863,7 +32938,7 @@ function start2(options2) {
32863
32938
  }
32864
32939
 
32865
32940
  // src/commands/voice/status.ts
32866
- import { existsSync as existsSync76, readFileSync as readFileSync58 } from "fs";
32941
+ import { existsSync as existsSync77, readFileSync as readFileSync58 } from "fs";
32867
32942
  function isProcessAlive3(pid) {
32868
32943
  try {
32869
32944
  process.kill(pid, 0);
@@ -32873,12 +32948,12 @@ function isProcessAlive3(pid) {
32873
32948
  }
32874
32949
  }
32875
32950
  function readRecentLogs(count8) {
32876
- if (!existsSync76(voicePaths.log)) return [];
32951
+ if (!existsSync77(voicePaths.log)) return [];
32877
32952
  const lines2 = readFileSync58(voicePaths.log, "utf8").trim().split("\n");
32878
32953
  return lines2.slice(-count8);
32879
32954
  }
32880
32955
  function status2() {
32881
- if (!existsSync76(voicePaths.pid)) {
32956
+ if (!existsSync77(voicePaths.pid)) {
32882
32957
  console.log("Voice daemon: not running (no PID file)");
32883
32958
  return;
32884
32959
  }
@@ -32901,9 +32976,9 @@ function status2() {
32901
32976
  }
32902
32977
 
32903
32978
  // src/commands/voice/stop.ts
32904
- import { existsSync as existsSync77, readFileSync as readFileSync59, unlinkSync as unlinkSync20 } from "fs";
32979
+ import { existsSync as existsSync78, readFileSync as readFileSync59, unlinkSync as unlinkSync20 } from "fs";
32905
32980
  function stop2() {
32906
- if (!existsSync77(voicePaths.pid)) {
32981
+ if (!existsSync78(voicePaths.pid)) {
32907
32982
  console.log("Voice daemon is not running (no PID file)");
32908
32983
  return;
32909
32984
  }
@@ -32920,7 +32995,7 @@ function stop2() {
32920
32995
  }
32921
32996
  try {
32922
32997
  const lockFile = getLockFile();
32923
- if (existsSync77(lockFile)) unlinkSync20(lockFile);
32998
+ if (existsSync78(lockFile)) unlinkSync20(lockFile);
32924
32999
  } catch {
32925
33000
  }
32926
33001
  console.log("Voice daemon stopped");
@@ -33239,9 +33314,9 @@ function stashDirtyTree(cwd) {
33239
33314
  function mergeBehindBranch(cwd) {
33240
33315
  const stash = stashDirtyTree(cwd);
33241
33316
  if (!stash.ok) return { kind: "blocked", reason: stash.reason };
33242
- const merge = attemptGit(["merge", "--ff-only", "@{u}"], cwd);
33317
+ const merge2 = attemptGit(["merge", "--ff-only", "@{u}"], cwd);
33243
33318
  const restore2 = stash.stashed ? attemptGit(["stash", "pop"], cwd) : { ok: true };
33244
- if (!merge.ok) return { kind: "blocked", reason: merge.reason };
33319
+ if (!merge2.ok) return { kind: "blocked", reason: merge2.reason };
33245
33320
  if (!restore2.ok) return { kind: "blocked", reason: restore2.reason };
33246
33321
  return fastForwarded(cwd);
33247
33322
  }
@@ -33325,7 +33400,7 @@ function resolveParams(params, cliArgs) {
33325
33400
  }
33326
33401
 
33327
33402
  // src/commands/run/resolveRunCwd.ts
33328
- import { existsSync as existsSync78 } from "fs";
33403
+ import { existsSync as existsSync79 } from "fs";
33329
33404
  import { resolve as resolve19 } from "path";
33330
33405
  var MissingRunCwdError = class extends Error {
33331
33406
  constructor(runName, cwd) {
@@ -33338,17 +33413,17 @@ var MissingRunCwdError = class extends Error {
33338
33413
  function resolveRunCwd(config, baseDir = runConfigBaseDir()) {
33339
33414
  if (!config.cwd) return void 0;
33340
33415
  const cwd = resolve19(baseDir, config.cwd);
33341
- if (!existsSync78(cwd)) throw new MissingRunCwdError(config.name, cwd);
33416
+ if (!existsSync79(cwd)) throw new MissingRunCwdError(config.name, cwd);
33342
33417
  return cwd;
33343
33418
  }
33344
33419
 
33345
33420
  // src/commands/run/runCommandToCompletion.ts
33346
33421
  import { spawn as spawn9 } from "child_process";
33347
- import { existsSync as existsSync80 } from "fs";
33422
+ import { existsSync as existsSync81 } from "fs";
33348
33423
 
33349
33424
  // src/commands/run/resolveCommand.ts
33350
33425
  import { execFileSync as execFileSync17 } from "child_process";
33351
- import { existsSync as existsSync79 } from "fs";
33426
+ import { existsSync as existsSync80 } from "fs";
33352
33427
  import { dirname as dirname37, join as join92, resolve as resolve20 } from "path";
33353
33428
  function resolveCommand2(command) {
33354
33429
  if (process.platform !== "win32" || command !== "bash") return command;
@@ -33356,7 +33431,7 @@ function resolveCommand2(command) {
33356
33431
  const gitPath = execFileSync17("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
33357
33432
  const gitRoot = resolve20(dirname37(gitPath), "..");
33358
33433
  const gitBash = join92(gitRoot, "bin", "bash.exe");
33359
- if (existsSync79(gitBash)) return gitBash;
33434
+ if (existsSync80(gitBash)) return gitBash;
33360
33435
  } catch {
33361
33436
  return command;
33362
33437
  }
@@ -33366,7 +33441,7 @@ function resolveCommand2(command) {
33366
33441
  // src/commands/run/runCommandToCompletion.ts
33367
33442
  function runCommandToCompletion(command, args, env, cwd, quiet) {
33368
33443
  return new Promise((resolveResult) => {
33369
- if (cwd && !existsSync80(cwd)) {
33444
+ if (cwd && !existsSync81(cwd)) {
33370
33445
  resolveResult({
33371
33446
  kind: "failed",
33372
33447
  message: `Failed to execute command: cwd ${cwd} does not exist`
@@ -33944,7 +34019,7 @@ async function run3(name, args) {
33944
34019
  }
33945
34020
 
33946
34021
  // src/commands/run/add.ts
33947
- import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync49 } from "fs";
34022
+ import { mkdirSync as mkdirSync32, writeFileSync as writeFileSync50 } from "fs";
33948
34023
  import { join as join94 } from "path";
33949
34024
 
33950
34025
  // src/commands/run/extractOption.ts
@@ -34015,7 +34090,7 @@ description: Run ${name}
34015
34090
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
34016
34091
  `;
34017
34092
  const filePath = join94(dir, `${name}.md`);
34018
- writeFileSync49(filePath, content);
34093
+ writeFileSync50(filePath, content);
34019
34094
  console.log(`Created command file: ${filePath}`);
34020
34095
  }
34021
34096
  function add3() {
@@ -34070,7 +34145,7 @@ function link2() {
34070
34145
  }
34071
34146
 
34072
34147
  // src/commands/run/remove.ts
34073
- import { existsSync as existsSync81, unlinkSync as unlinkSync21 } from "fs";
34148
+ import { existsSync as existsSync82, unlinkSync as unlinkSync21 } from "fs";
34074
34149
  import { join as join95 } from "path";
34075
34150
  function findRemoveIndex() {
34076
34151
  const idx = process.argv.indexOf("remove");
@@ -34087,7 +34162,7 @@ function parseRemoveName() {
34087
34162
  }
34088
34163
  function deleteCommandFile(name) {
34089
34164
  const filePath = join95(".claude", "commands", `${name}.md`);
34090
- if (existsSync81(filePath)) {
34165
+ if (existsSync82(filePath)) {
34091
34166
  unlinkSync21(filePath);
34092
34167
  console.log(`Deleted command file: ${filePath}`);
34093
34168
  }
@@ -34132,7 +34207,7 @@ function registerRun(program2) {
34132
34207
 
34133
34208
  // src/commands/screenshot/index.ts
34134
34209
  import { execSync as execSync61 } from "child_process";
34135
- import { existsSync as existsSync82, mkdirSync as mkdirSync33, unlinkSync as unlinkSync22, writeFileSync as writeFileSync50 } from "fs";
34210
+ import { existsSync as existsSync83, mkdirSync as mkdirSync33, unlinkSync as unlinkSync22, writeFileSync as writeFileSync51 } from "fs";
34136
34211
  import { tmpdir as tmpdir9 } from "os";
34137
34212
  import { join as join96, resolve as resolve21 } from "path";
34138
34213
  import chalk227 from "chalk";
@@ -34264,7 +34339,7 @@ Write-Output $OutputPath
34264
34339
 
34265
34340
  // src/commands/screenshot/index.ts
34266
34341
  function buildOutputPath(outputDir, processName) {
34267
- if (!existsSync82(outputDir)) {
34342
+ if (!existsSync83(outputDir)) {
34268
34343
  mkdirSync33(outputDir, { recursive: true });
34269
34344
  }
34270
34345
  const timestamp6 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
@@ -34272,7 +34347,7 @@ function buildOutputPath(outputDir, processName) {
34272
34347
  }
34273
34348
  function runPowerShellScript(processName, outputPath) {
34274
34349
  const scriptPath = join96(tmpdir9(), `assist-screenshot-${Date.now()}.ps1`);
34275
- writeFileSync50(scriptPath, captureWindowPs1, "utf8");
34350
+ writeFileSync51(scriptPath, captureWindowPs1, "utf8");
34276
34351
  try {
34277
34352
  execSync61(
34278
34353
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
@@ -34609,12 +34684,12 @@ function toSessionRunInfo({
34609
34684
  }
34610
34685
 
34611
34686
  // src/commands/sessions/daemon/worktree/joinRefusal.ts
34612
- import { existsSync as existsSync83 } from "fs";
34687
+ import { existsSync as existsSync84 } from "fs";
34613
34688
  function joinRefusal(session) {
34614
34689
  if (session.commandType === "run") return "a server run has no agent stream";
34615
34690
  if (session.closing === true) return "the session is closing";
34616
34691
  if (!session.cwd) return "the session has no working directory";
34617
- if (!existsSync83(session.cwd))
34692
+ if (!existsSync84(session.cwd))
34618
34693
  return "the session's workspace no longer exists";
34619
34694
  return void 0;
34620
34695
  }
@@ -34778,11 +34853,11 @@ function sessionBase(id, status3) {
34778
34853
  }
34779
34854
 
34780
34855
  // src/commands/sessions/daemon/spawnPty.ts
34781
- import { existsSync as existsSync85 } from "fs";
34856
+ import { existsSync as existsSync86 } from "fs";
34782
34857
  import * as pty from "node-pty";
34783
34858
 
34784
34859
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
34785
- import { chmodSync, existsSync as existsSync84, statSync as statSync13 } from "fs";
34860
+ import { chmodSync, existsSync as existsSync85, statSync as statSync13 } from "fs";
34786
34861
  import { createRequire as createRequire3 } from "module";
34787
34862
  import path85 from "path";
34788
34863
  var require4 = createRequire3(import.meta.url);
@@ -34797,7 +34872,7 @@ function ensureSpawnHelperExecutable() {
34797
34872
  `${process.platform}-${process.arch}`,
34798
34873
  "spawn-helper"
34799
34874
  );
34800
- if (!existsSync84(helper)) return;
34875
+ if (!existsSync85(helper)) return;
34801
34876
  const mode = statSync13(helper).mode;
34802
34877
  if ((mode & 73) === 0) chmodSync(helper, mode | 493);
34803
34878
  }
@@ -34833,7 +34908,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
34833
34908
  });
34834
34909
  }
34835
34910
  function refuseMissingCwd(cwd, sessionId) {
34836
- if (!cwd || existsSync85(cwd)) return;
34911
+ if (!cwd || existsSync86(cwd)) return;
34837
34912
  daemonLog(
34838
34913
  `${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
34839
34914
  );
@@ -35015,11 +35090,11 @@ function setStatus2(session, newStatus) {
35015
35090
  }
35016
35091
 
35017
35092
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
35018
- import { existsSync as existsSync87 } from "fs";
35019
- import { basename as basename22 } from "path";
35093
+ import { existsSync as existsSync88 } from "fs";
35094
+ import { basename as basename23 } from "path";
35020
35095
 
35021
35096
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
35022
- import { existsSync as existsSync86 } from "fs";
35097
+ import { existsSync as existsSync87 } from "fs";
35023
35098
  import { join as join99 } from "path";
35024
35099
 
35025
35100
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
@@ -35089,7 +35164,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
35089
35164
  );
35090
35165
  }
35091
35166
  function strandedReason(worktreePath, cause) {
35092
- if (!existsSync86(join99(worktreePath, ".git")))
35167
+ if (!existsSync87(join99(worktreePath, ".git")))
35093
35168
  return "its .git link is already gone";
35094
35169
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
35095
35170
  return "git no longer recognises it as a working tree";
@@ -35141,7 +35216,7 @@ function reason3(error) {
35141
35216
 
35142
35217
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
35143
35218
  async function reapWorktree(worktreePath, force = false) {
35144
- if (!existsSync87(worktreePath)) {
35219
+ if (!existsSync88(worktreePath)) {
35145
35220
  forgetWorktree(worktreePath);
35146
35221
  daemonLog(
35147
35222
  `worktree ${worktreePath} already gone; its record was forgotten`
@@ -35159,14 +35234,14 @@ async function reapWorktree(worktreePath, force = false) {
35159
35234
  const clone = owningClone(worktreePath);
35160
35235
  const removal = await removeTree(clone, worktreePath, force);
35161
35236
  if (!removal.removed) return removal;
35162
- await deleteWorktreeBranch(clone, basename22(worktreePath));
35237
+ await deleteWorktreeBranch(clone, basename23(worktreePath));
35163
35238
  forgetWorktree(worktreePath);
35164
35239
  daemonLog(`worktree ${worktreePath} reaped${force ? " (forced)" : ""}`);
35165
35240
  return removal;
35166
35241
  }
35167
35242
  function owningClone(worktreePath) {
35168
35243
  const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
35169
- if (recorded && existsSync87(recorded)) return recorded;
35244
+ if (recorded && existsSync88(recorded)) return recorded;
35170
35245
  const detected = mainWorktree(worktreePath);
35171
35246
  if (detected) return detected;
35172
35247
  daemonLog(
@@ -35297,12 +35372,12 @@ function closeGateApplies(sessions, session) {
35297
35372
  }
35298
35373
 
35299
35374
  // src/commands/sessions/daemon/worktree/watchGitState.ts
35300
- import { existsSync as existsSync88, watch } from "fs";
35375
+ import { existsSync as existsSync89, watch } from "fs";
35301
35376
  var DEBOUNCE_MS = 500;
35302
35377
  var POLL_MS = 3e4;
35303
35378
  function watchGitState(cwd, onChange) {
35304
35379
  const common = gitCommonDir(cwd);
35305
- if (!common || !existsSync88(common)) return void 0;
35380
+ if (!common || !existsSync89(common)) return void 0;
35306
35381
  const watchers = [
35307
35382
  watchGitDir(common, onChange),
35308
35383
  pollGitState(cwd, onChange)
@@ -35792,10 +35867,10 @@ function emitSessionOutput(session, clients, data) {
35792
35867
  }
35793
35868
 
35794
35869
  // src/commands/sessions/daemon/exitReason.ts
35795
- import { existsSync as existsSync89 } from "fs";
35870
+ import { existsSync as existsSync90 } from "fs";
35796
35871
  import { resolve as resolve22 } from "path";
35797
35872
  function exitDetail(session) {
35798
- if (session.cwd && !existsSync89(session.cwd))
35873
+ if (session.cwd && !existsSync90(session.cwd))
35799
35874
  return `working directory ${session.cwd} no longer exists`;
35800
35875
  return missingRunConfigCwd(session);
35801
35876
  }
@@ -35809,7 +35884,7 @@ function missingRunConfigCwd(session) {
35809
35884
  const config = resolveRunConfig(session.runName, dir);
35810
35885
  if (!config?.cwd) return void 0;
35811
35886
  const configured = resolve22(runConfigBaseDirFrom(dir), config.cwd);
35812
- if (existsSync89(configured)) return void 0;
35887
+ if (existsSync90(configured)) return void 0;
35813
35888
  return `run config "${config.name}": cwd ${configured} does not exist`;
35814
35889
  }
35815
35890
 
@@ -35850,7 +35925,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
35850
35925
  }
35851
35926
 
35852
35927
  // src/commands/sessions/daemon/watchActivity.ts
35853
- import { existsSync as existsSync90, mkdirSync as mkdirSync34, watch as watch2 } from "fs";
35928
+ import { existsSync as existsSync91, mkdirSync as mkdirSync34, watch as watch2 } from "fs";
35854
35929
  import { dirname as dirname39 } from "path";
35855
35930
 
35856
35931
  // src/commands/sessions/daemon/applyActivityToSession.ts
@@ -35936,7 +36011,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
35936
36011
  if (timer) clearTimeout(timer);
35937
36012
  timer = setTimeout(read3, DEBOUNCE_MS2);
35938
36013
  });
35939
- if (existsSync90(path90)) read3();
36014
+ if (existsSync91(path90)) read3();
35940
36015
  }
35941
36016
  function refreshActivity(session) {
35942
36017
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -37659,8 +37734,8 @@ function rearmStoppedSessions(sessions, notify2) {
37659
37734
  }
37660
37735
 
37661
37736
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
37662
- import { existsSync as existsSync93 } from "fs";
37663
- import { basename as basename24 } from "path";
37737
+ import { existsSync as existsSync94 } from "fs";
37738
+ import { basename as basename25 } from "path";
37664
37739
 
37665
37740
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
37666
37741
  function accountedTrees(sessions) {
@@ -37714,9 +37789,9 @@ function bindResumedWorktree(session, cwd, notify2) {
37714
37789
  }
37715
37790
 
37716
37791
  // src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
37717
- import { existsSync as existsSync92 } from "fs";
37792
+ import { existsSync as existsSync93 } from "fs";
37718
37793
  async function reclaimVanishedWorktrees(clone, paths) {
37719
- if (!existsSync92(clone)) {
37794
+ if (!existsSync93(clone)) {
37720
37795
  for (const { path: path90 } of paths) forgetWorktree(path90);
37721
37796
  daemonLog(
37722
37797
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
@@ -37802,7 +37877,7 @@ function capped(lines2) {
37802
37877
  }
37803
37878
 
37804
37879
  // src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
37805
- import { basename as basename23 } from "path";
37880
+ import { basename as basename24 } from "path";
37806
37881
  function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
37807
37882
  const { orphan, reason: reason4, held } = recovered;
37808
37883
  let id;
@@ -37825,7 +37900,7 @@ function orphanedSession(id, recovered) {
37825
37900
  const { orphan, reason: reason4, held } = recovered;
37826
37901
  return {
37827
37902
  ...sessionBase(id, "stopped"),
37828
- name: `recovered ${basename23(orphan.path)}`,
37903
+ name: `recovered ${basename24(orphan.path)}`,
37829
37904
  subtitle: `${held.summary} in ${orphan.path}`,
37830
37905
  commandType: "claude",
37831
37906
  pty: null,
@@ -37882,11 +37957,11 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
37882
37957
  );
37883
37958
  continue;
37884
37959
  }
37885
- if (!existsSync93(path90)) {
37960
+ if (!existsSync94(path90)) {
37886
37961
  logVanishedTree(sessions, path90);
37887
37962
  vanished.set(clone, [
37888
37963
  ...vanished.get(clone) ?? [],
37889
- { path: path90, branch: basename24(path90) }
37964
+ { path: path90, branch: basename25(path90) }
37890
37965
  ]);
37891
37966
  continue;
37892
37967
  }
@@ -38527,13 +38602,13 @@ async function defaultConnect() {
38527
38602
  }
38528
38603
 
38529
38604
  // src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
38530
- import { existsSync as existsSync94, readFileSync as readFileSync63 } from "fs";
38605
+ import { existsSync as existsSync95, readFileSync as readFileSync63 } from "fs";
38531
38606
  import { posix as posix3 } from "path";
38532
38607
  function hasPersistedWindowsSessions() {
38533
38608
  const sessionsFile = windowsSessionsFileFromWsl();
38534
38609
  if (!sessionsFile) return false;
38535
38610
  try {
38536
- if (!existsSync94(sessionsFile)) return false;
38611
+ if (!existsSync95(sessionsFile)) return false;
38537
38612
  const data = JSON.parse(readFileSync63(sessionsFile, "utf8"));
38538
38613
  return Array.isArray(data) && data.length > 0;
38539
38614
  } catch (error) {
@@ -39268,7 +39343,7 @@ function setAutoAdvance(sessions, id, enabled) {
39268
39343
  }
39269
39344
 
39270
39345
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
39271
- import { existsSync as existsSync97 } from "fs";
39346
+ import { existsSync as existsSync98 } from "fs";
39272
39347
 
39273
39348
  // src/commands/sessions/daemon/resumeSession.ts
39274
39349
  function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
@@ -39299,10 +39374,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty, harness) {
39299
39374
  }
39300
39375
 
39301
39376
  // src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
39302
- import { existsSync as existsSync96 } from "fs";
39377
+ import { existsSync as existsSync97 } from "fs";
39303
39378
 
39304
39379
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
39305
- import { copyFileSync as copyFileSync7, existsSync as existsSync95, mkdirSync as mkdirSync36 } from "fs";
39380
+ import { copyFileSync as copyFileSync7, existsSync as existsSync96, mkdirSync as mkdirSync36 } from "fs";
39306
39381
  import { join as join101 } from "path";
39307
39382
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
39308
39383
  const dir = projectDirForCwd(toCwd);
@@ -39313,7 +39388,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
39313
39388
  return;
39314
39389
  }
39315
39390
  const dest = join101(dir, `${claudeSessionId}.jsonl`);
39316
- if (existsSync95(dest)) {
39391
+ if (existsSync96(dest)) {
39317
39392
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
39318
39393
  return;
39319
39394
  }
@@ -39364,7 +39439,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name, harness
39364
39439
  }
39365
39440
  function cloneForReapedTree(missingCwd) {
39366
39441
  const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
39367
- if (!clone || !existsSync96(clone))
39442
+ if (!clone || !existsSync97(clone))
39368
39443
  throw new Error(
39369
39444
  `working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
39370
39445
  );
@@ -39373,7 +39448,7 @@ function cloneForReapedTree(missingCwd) {
39373
39448
 
39374
39449
  // src/commands/sessions/daemon/worktree/resumeInTree.ts
39375
39450
  function resumeInTree(ctx, sessionId, cwd, name, harness) {
39376
- if (!existsSync97(cwd))
39451
+ if (!existsSync98(cwd))
39377
39452
  return resumeInReplacementTree(ctx, sessionId, cwd, name, harness);
39378
39453
  const id = ctx.spawnWith(
39379
39454
  (sid) => resumeSession(sid, sessionId, cwd, name, void 0, harness)
@@ -39956,7 +40031,7 @@ function handleConnection(socket, manager) {
39956
40031
  }
39957
40032
 
39958
40033
  // src/commands/sessions/daemon/onListening.ts
39959
- import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync51 } from "fs";
40034
+ import { unlinkSync as unlinkSync23, writeFileSync as writeFileSync52 } from "fs";
39960
40035
 
39961
40036
  // src/commands/sessions/daemon/startPidFileWatchdog.ts
39962
40037
  import { readFileSync as readFileSync64 } from "fs";
@@ -39978,7 +40053,7 @@ function ownsPidFile() {
39978
40053
 
39979
40054
  // src/commands/sessions/daemon/onListening.ts
39980
40055
  function onListening(manager, checkAutoExit) {
39981
- writeFileSync51(daemonPaths.pid, String(process.pid));
40056
+ writeFileSync52(daemonPaths.pid, String(process.pid));
39982
40057
  startPidFileWatchdog(() => {
39983
40058
  daemonLog("lost daemon.pid ownership; shutting down sessions and exiting");
39984
40059
  void manager.flushActiveMs().finally(() => {