@staff0rd/assist 0.562.0 → 0.563.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.562.0",
9
+ version: "0.563.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -13393,26 +13393,8 @@ async function web2(options2) {
13393
13393
  import chalk64 from "chalk";
13394
13394
 
13395
13395
  // src/commands/sessions/shared/resolveSessionTranscript.ts
13396
- import * as fs23 from "fs";
13397
- import * as path31 from "path";
13398
-
13399
- // src/commands/sessions/summarise/readTranscriptTail.ts
13400
13396
  import * as fs22 from "fs";
13401
- function readTranscriptTail(filePath, maxBytes = 65536) {
13402
- let fd;
13403
- try {
13404
- const { size } = fs22.statSync(filePath);
13405
- const start3 = Math.max(0, size - maxBytes);
13406
- fd = fs22.openSync(filePath, "r");
13407
- const buf = Buffer.alloc(size - start3);
13408
- const bytesRead = fs22.readSync(fd, buf, 0, buf.length, start3);
13409
- return buf.toString("utf8", 0, bytesRead);
13410
- } catch {
13411
- return void 0;
13412
- } finally {
13413
- if (fd !== void 0) fs22.closeSync(fd);
13414
- }
13415
- }
13397
+ import * as path31 from "path";
13416
13398
 
13417
13399
  // src/commands/sessions/shared/claudeProjectsRoot.ts
13418
13400
  import * as os4 from "os";
@@ -13425,47 +13407,33 @@ function projectSlug(cwd) {
13425
13407
  }
13426
13408
 
13427
13409
  // src/commands/sessions/shared/resolveSessionTranscript.ts
13410
+ var MAX_PROMPT_LENGTH = 80;
13428
13411
  function resolveSessionTranscript(sessionId, projectsRoot = claudeProjectsRoot()) {
13429
13412
  const filePath = findTranscriptFile(sessionId, projectsRoot);
13430
13413
  if (!filePath) return void 0;
13431
- const meta = extractSessionMeta(splitLines(readTranscriptHead(filePath)));
13432
- return {
13433
- path: filePath,
13434
- prompt: meta.name || void 0,
13435
- firstTimestamp: meta.timestamp || void 0,
13436
- lastTimestamp: lastTimestamp(splitLines(readTranscriptTail(filePath)))
13437
- };
13414
+ const head = readTranscriptHead(filePath);
13415
+ const meta = extractSessionMeta(head ? head.split("\n").filter(Boolean) : []);
13416
+ return { path: filePath, prompt: promptOf(meta) };
13438
13417
  }
13439
13418
  function findTranscriptFile(sessionId, projectsRoot) {
13440
13419
  let projectDirs;
13441
13420
  try {
13442
- projectDirs = fs23.readdirSync(projectsRoot);
13421
+ projectDirs = fs22.readdirSync(projectsRoot);
13443
13422
  } catch {
13444
13423
  return void 0;
13445
13424
  }
13446
13425
  for (const dir of projectDirs) {
13447
13426
  const candidate = path31.join(projectsRoot, dir, `${sessionId}.jsonl`);
13448
- if (fs23.existsSync(candidate)) return candidate;
13427
+ if (fs22.existsSync(candidate)) return candidate;
13449
13428
  }
13450
13429
  return void 0;
13451
13430
  }
13452
- function splitLines(content) {
13453
- return content ? content.split("\n").filter(Boolean) : [];
13454
- }
13455
- function lastTimestamp(lines2) {
13456
- for (const line of lines2.reverse()) {
13457
- const timestamp6 = timestampOf(line);
13458
- if (timestamp6) return timestamp6;
13459
- }
13460
- return void 0;
13461
- }
13462
- function timestampOf(line) {
13463
- try {
13464
- const entry = JSON.parse(line);
13465
- return typeof entry.timestamp === "string" ? entry.timestamp : void 0;
13466
- } catch {
13467
- return void 0;
13468
- }
13431
+ function promptOf(meta) {
13432
+ if (meta.name) return meta.name;
13433
+ if (!meta.commandName) return void 0;
13434
+ const command = `/${meta.commandName}`;
13435
+ const rendered = meta.commandArgs ? `${command} ${meta.commandArgs}` : command;
13436
+ return rendered.slice(0, MAX_PROMPT_LENGTH);
13469
13437
  }
13470
13438
 
13471
13439
  // src/commands/backlog/addActivity.ts
@@ -13506,7 +13474,7 @@ async function addActivity(id, kind, ref, options2) {
13506
13474
  import chalk65 from "chalk";
13507
13475
 
13508
13476
  // src/commands/sessions/shared/resolveCurrentSessionId.ts
13509
- import * as fs24 from "fs";
13477
+ import * as fs23 from "fs";
13510
13478
  import * as path32 from "path";
13511
13479
  var SESSION_ID_ENV = "CLAUDE_CODE_SESSION_ID";
13512
13480
  function resolveCurrentSessionId(options2 = {}) {
@@ -13521,7 +13489,7 @@ function resolveCurrentSessionId(options2 = {}) {
13521
13489
  function newestTranscriptId(dir) {
13522
13490
  let entries;
13523
13491
  try {
13524
- entries = fs24.readdirSync(dir);
13492
+ entries = fs23.readdirSync(dir);
13525
13493
  } catch {
13526
13494
  return void 0;
13527
13495
  }
@@ -13537,7 +13505,7 @@ function newestTranscriptId(dir) {
13537
13505
  }
13538
13506
  function modifiedAtOf(filePath) {
13539
13507
  try {
13540
- return fs24.statSync(filePath).mtimeMs;
13508
+ return fs23.statSync(filePath).mtimeMs;
13541
13509
  } catch {
13542
13510
  return void 0;
13543
13511
  }
@@ -17579,7 +17547,7 @@ function getPinStatePath(pin) {
17579
17547
  }
17580
17548
 
17581
17549
  // src/commands/codeComment/sweepRestrictedDir.ts
17582
- import { readdirSync as readdirSync5, statSync as statSync7, unlinkSync as unlinkSync7 } from "fs";
17550
+ import { readdirSync as readdirSync5, statSync as statSync6, unlinkSync as unlinkSync7 } from "fs";
17583
17551
  import { join as join41 } from "path";
17584
17552
  var STALE_AFTER_MS = 30 * 60 * 1e3;
17585
17553
  function sweepRestrictedDir(dir = getRestrictedDir()) {
@@ -17593,7 +17561,7 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
17593
17561
  for (const entry of entries) {
17594
17562
  const path80 = join41(dir, entry);
17595
17563
  try {
17596
- if (statSync7(path80).mtimeMs < cutoff) unlinkSync7(path80);
17564
+ if (statSync6(path80).mtimeMs < cutoff) unlinkSync7(path80);
17597
17565
  } catch {
17598
17566
  continue;
17599
17567
  }
@@ -17841,13 +17809,13 @@ import chalk132 from "chalk";
17841
17809
  import chalk125 from "chalk";
17842
17810
 
17843
17811
  // src/commands/complexity/shared/index.ts
17844
- import fs26 from "fs";
17812
+ import fs25 from "fs";
17845
17813
  import path34 from "path";
17846
17814
  import chalk124 from "chalk";
17847
17815
  import ts5 from "typescript";
17848
17816
 
17849
17817
  // src/commands/complexity/findSourceFiles.ts
17850
- import fs25 from "fs";
17818
+ import fs24 from "fs";
17851
17819
  import path33 from "path";
17852
17820
  import { minimatch as minimatch5 } from "minimatch";
17853
17821
  function applyIgnoreGlobs(files, extraIgnore = []) {
@@ -17856,11 +17824,11 @@ function applyIgnoreGlobs(files, extraIgnore = []) {
17856
17824
  return files.filter((f) => !ignore3.some((glob) => minimatch5(f, glob)));
17857
17825
  }
17858
17826
  function walk2(dir, results) {
17859
- if (!fs25.existsSync(dir)) {
17827
+ if (!fs24.existsSync(dir)) {
17860
17828
  return;
17861
17829
  }
17862
17830
  const extensions = [".ts", ".tsx"];
17863
- const entries = fs25.readdirSync(dir, { withFileTypes: true });
17831
+ const entries = fs24.readdirSync(dir, { withFileTypes: true });
17864
17832
  for (const entry of entries) {
17865
17833
  const fullPath = path33.join(dir, entry.name);
17866
17834
  if (entry.isDirectory()) {
@@ -17881,10 +17849,10 @@ function findSourceFiles2(pattern2, baseDir = ".", extraIgnore = []) {
17881
17849
  extraIgnore
17882
17850
  );
17883
17851
  }
17884
- if (fs25.existsSync(pattern2) && fs25.statSync(pattern2).isFile()) {
17852
+ if (fs24.existsSync(pattern2) && fs24.statSync(pattern2).isFile()) {
17885
17853
  return [pattern2];
17886
17854
  }
17887
- if (fs25.existsSync(pattern2) && fs25.statSync(pattern2).isDirectory()) {
17855
+ if (fs24.existsSync(pattern2) && fs24.statSync(pattern2).isDirectory()) {
17888
17856
  walk2(pattern2, results);
17889
17857
  return applyIgnoreGlobs(results, extraIgnore);
17890
17858
  }
@@ -18082,7 +18050,7 @@ function countSloc(content) {
18082
18050
 
18083
18051
  // src/commands/complexity/shared/index.ts
18084
18052
  function createSourceFromFile(filePath) {
18085
- const content = fs26.readFileSync(filePath, "utf8");
18053
+ const content = fs25.readFileSync(filePath, "utf8");
18086
18054
  return ts5.createSourceFile(
18087
18055
  path34.basename(filePath),
18088
18056
  content,
@@ -18194,7 +18162,7 @@ function aggregateResults(fileMetrics) {
18194
18162
  }
18195
18163
 
18196
18164
  // src/commands/complexity/maintainability/collectFileMetrics.ts
18197
- import fs27 from "fs";
18165
+ import fs26 from "fs";
18198
18166
 
18199
18167
  // src/commands/complexity/maintainability/calculateMaintainabilityIndex.ts
18200
18168
  function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, sloc2) {
@@ -18209,7 +18177,7 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
18209
18177
  function collectFileMetrics(files) {
18210
18178
  const fileMetrics = /* @__PURE__ */ new Map();
18211
18179
  for (const file of files) {
18212
- const content = fs27.readFileSync(file, "utf8");
18180
+ const content = fs26.readFileSync(file, "utf8");
18213
18181
  fileMetrics.set(file, {
18214
18182
  sloc: countSloc(content),
18215
18183
  functions: [],
@@ -18370,14 +18338,14 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
18370
18338
  }
18371
18339
 
18372
18340
  // src/commands/complexity/sloc.ts
18373
- import fs28 from "fs";
18341
+ import fs27 from "fs";
18374
18342
  import chalk131 from "chalk";
18375
18343
  async function sloc(pattern2 = "**/*.ts", options2 = {}) {
18376
18344
  withSourceFiles(pattern2, (files) => {
18377
18345
  const results = [];
18378
18346
  let hasViolation = false;
18379
18347
  for (const file of files) {
18380
- const content = fs28.readFileSync(file, "utf8");
18348
+ const content = fs27.readFileSync(file, "utf8");
18381
18349
  const lines2 = countSloc(content);
18382
18350
  results.push({ file, lines: lines2 });
18383
18351
  if (options2.threshold !== void 0 && lines2 > options2.threshold) {
@@ -19443,7 +19411,7 @@ function registerDevlog(program2) {
19443
19411
  }
19444
19412
 
19445
19413
  // src/commands/dotnet/checkBuildLocks.ts
19446
- import { closeSync as closeSync4, openSync as openSync4, readdirSync as readdirSync7 } from "fs";
19414
+ import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync7 } from "fs";
19447
19415
  import { join as join47 } from "path";
19448
19416
  import chalk150 from "chalk";
19449
19417
  var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
@@ -19458,8 +19426,8 @@ function isLockedDll(debugDir) {
19458
19426
  if (!file.toLowerCase().endsWith(".dll")) continue;
19459
19427
  const dllPath = join47(debugDir, file);
19460
19428
  try {
19461
- const fd = openSync4(dllPath, "r+");
19462
- closeSync4(fd);
19429
+ const fd = openSync3(dllPath, "r+");
19430
+ closeSync3(fd);
19463
19431
  } catch {
19464
19432
  return dllPath;
19465
19433
  }
@@ -19549,7 +19517,7 @@ function collectAllDeps(node) {
19549
19517
  }
19550
19518
 
19551
19519
  // src/commands/dotnet/findContainingSolutions.ts
19552
- import { readdirSync as readdirSync8, readFileSync as readFileSync35, statSync as statSync8 } from "fs";
19520
+ import { readdirSync as readdirSync8, readFileSync as readFileSync35, statSync as statSync7 } from "fs";
19553
19521
  import path38 from "path";
19554
19522
  function findSlnFiles(dir, maxDepth, depth = 0) {
19555
19523
  if (depth > maxDepth) return [];
@@ -19565,7 +19533,7 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
19565
19533
  continue;
19566
19534
  const full = path38.join(dir, entry);
19567
19535
  try {
19568
- const stat4 = statSync8(full);
19536
+ const stat4 = statSync7(full);
19569
19537
  if (stat4.isFile() && entry.endsWith(".sln")) {
19570
19538
  results.push(full);
19571
19539
  } else if (stat4.isDirectory()) {
@@ -20053,7 +20021,7 @@ function registerDotnet(program2) {
20053
20021
  }
20054
20022
 
20055
20023
  // src/commands/editHook/index.ts
20056
- import fs29 from "fs";
20024
+ import fs28 from "fs";
20057
20025
 
20058
20026
  // src/commands/editHook/introducedComments.ts
20059
20027
  function introducedComments(added, removed) {
@@ -20300,7 +20268,7 @@ function tryParseInput2(raw) {
20300
20268
  function readExisting(filePath) {
20301
20269
  if (!filePath) return void 0;
20302
20270
  try {
20303
- return fs29.readFileSync(filePath, "utf8");
20271
+ return fs28.readFileSync(filePath, "utf8");
20304
20272
  } catch {
20305
20273
  return void 0;
20306
20274
  }
@@ -20563,7 +20531,7 @@ import {
20563
20531
  readdirSync as readdirSync10,
20564
20532
  readFileSync as readFileSync37,
20565
20533
  rmSync as rmSync3,
20566
- statSync as statSync9
20534
+ statSync as statSync8
20567
20535
  } from "fs";
20568
20536
  import { basename as basename14, join as join52 } from "path";
20569
20537
 
@@ -20636,13 +20604,13 @@ async function migrateFile(orm, origin, file, createdAt) {
20636
20604
  async function migrateDiskHandovers(orm, origin, cwd = process.cwd()) {
20637
20605
  let migrated = 0;
20638
20606
  for (const file of collectMarkdown(getHandoversDir(cwd))) {
20639
- const createdAt = parseArchiveTimestamp(basename14(file)) ?? statSync9(file).mtime;
20607
+ const createdAt = parseArchiveTimestamp(basename14(file)) ?? statSync8(file).mtime;
20640
20608
  await migrateFile(orm, origin, file, createdAt);
20641
20609
  migrated++;
20642
20610
  }
20643
20611
  const handoverPath = getHandoverPath(cwd);
20644
20612
  if (existsSync46(handoverPath)) {
20645
- await migrateFile(orm, origin, handoverPath, statSync9(handoverPath).mtime);
20613
+ await migrateFile(orm, origin, handoverPath, statSync8(handoverPath).mtime);
20646
20614
  migrated++;
20647
20615
  }
20648
20616
  return migrated;
@@ -24657,17 +24625,17 @@ Refactor check failed:
24657
24625
 
24658
24626
  // src/commands/refactor/check/getViolations/index.ts
24659
24627
  import { execSync as execSync53 } from "child_process";
24660
- import fs31 from "fs";
24628
+ import fs30 from "fs";
24661
24629
  import { minimatch as minimatch6 } from "minimatch";
24662
24630
 
24663
24631
  // src/commands/refactor/check/getViolations/getIgnoredFiles.ts
24664
- import fs30 from "fs";
24632
+ import fs29 from "fs";
24665
24633
  var REFACTOR_YML_PATH = "refactor.yml";
24666
24634
  function parseRefactorYml() {
24667
- if (!fs30.existsSync(REFACTOR_YML_PATH)) {
24635
+ if (!fs29.existsSync(REFACTOR_YML_PATH)) {
24668
24636
  return [];
24669
24637
  }
24670
- const content = fs30.readFileSync(REFACTOR_YML_PATH, "utf8");
24638
+ const content = fs29.readFileSync(REFACTOR_YML_PATH, "utf8");
24671
24639
  const entries = [];
24672
24640
  const lines2 = content.split("\n");
24673
24641
  let currentEntry = {};
@@ -24697,7 +24665,7 @@ function getIgnoredFiles() {
24697
24665
 
24698
24666
  // src/commands/refactor/check/getViolations/index.ts
24699
24667
  function countLines(filePath) {
24700
- const content = fs31.readFileSync(filePath, "utf8");
24668
+ const content = fs30.readFileSync(filePath, "utf8");
24701
24669
  return content.split("\n").length;
24702
24670
  }
24703
24671
  function getGitFiles(options2) {
@@ -25455,11 +25423,11 @@ import chalk189 from "chalk";
25455
25423
  import { Project as Project4 } from "ts-morph";
25456
25424
 
25457
25425
  // src/commands/refactor/extract/findTsConfig.ts
25458
- import fs33 from "fs";
25426
+ import fs32 from "fs";
25459
25427
  import path48 from "path";
25460
25428
 
25461
25429
  // src/commands/refactor/extract/findEnclosingTsConfig.ts
25462
- import fs32 from "fs";
25430
+ import fs31 from "fs";
25463
25431
  import path47 from "path";
25464
25432
 
25465
25433
  // src/commands/refactor/extract/projectIncludesFile.ts
@@ -25480,7 +25448,7 @@ function findEnclosingTsConfig(sourcePath, rootDir, tried) {
25480
25448
  const nested = path47.join(dir, "tsconfig.json");
25481
25449
  if (!tried.has(nested)) {
25482
25450
  tried.add(nested);
25483
- if (fs32.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
25451
+ if (fs31.existsSync(nested) && projectIncludesFile(nested, sourcePath)) {
25484
25452
  return nested;
25485
25453
  }
25486
25454
  }
@@ -25494,7 +25462,7 @@ function findEnclosingTsConfig(sourcePath, rootDir, tried) {
25494
25462
  // src/commands/refactor/extract/findTsConfig.ts
25495
25463
  function findTsConfig(sourcePath) {
25496
25464
  const rootConfig = path48.resolve("tsconfig.json");
25497
- if (!fs33.existsSync(rootConfig)) return rootConfig;
25465
+ if (!fs32.existsSync(rootConfig)) return rootConfig;
25498
25466
  const tried = /* @__PURE__ */ new Set();
25499
25467
  const candidates = [rootConfig, ...readReferences(rootConfig)];
25500
25468
  for (const candidate of candidates) {
@@ -25502,7 +25470,7 @@ function findTsConfig(sourcePath) {
25502
25470
  tried.add(candidate);
25503
25471
  if (projectIncludesFile(candidate, sourcePath)) return candidate;
25504
25472
  }
25505
- const siblings = fs33.readdirSync(path48.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path48.resolve(path48.dirname(rootConfig), f));
25473
+ const siblings = fs32.readdirSync(path48.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path48.resolve(path48.dirname(rootConfig), f));
25506
25474
  for (const sibling of siblings) {
25507
25475
  if (tried.has(sibling)) continue;
25508
25476
  tried.add(sibling);
@@ -25517,8 +25485,8 @@ function findTsConfig(sourcePath) {
25517
25485
  return rootConfig;
25518
25486
  }
25519
25487
  function readReferences(configPath) {
25520
- if (!fs33.existsSync(configPath)) return [];
25521
- const raw = fs33.readFileSync(configPath, "utf8");
25488
+ if (!fs32.existsSync(configPath)) return [];
25489
+ const raw = fs32.readFileSync(configPath, "utf8");
25522
25490
  const stripped = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
25523
25491
  let parsed;
25524
25492
  try {
@@ -25530,8 +25498,8 @@ function readReferences(configPath) {
25530
25498
  const cwd = path48.dirname(configPath);
25531
25499
  return parsed.references.map((ref) => {
25532
25500
  const refPath = path48.resolve(cwd, ref.path);
25533
- return fs33.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path48.join(refPath, "tsconfig.json") : refPath;
25534
- }).filter((p) => fs33.existsSync(p));
25501
+ return fs32.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path48.join(refPath, "tsconfig.json") : refPath;
25502
+ }).filter((p) => fs32.existsSync(p));
25535
25503
  }
25536
25504
 
25537
25505
  // src/commands/refactor/extract/loadProjectFile.ts
@@ -25573,25 +25541,25 @@ async function extract(file, functionName, destination, options2 = {}) {
25573
25541
  }
25574
25542
 
25575
25543
  // src/commands/refactor/ignore.ts
25576
- import fs34 from "fs";
25544
+ import fs33 from "fs";
25577
25545
  import chalk191 from "chalk";
25578
25546
  var REFACTOR_YML_PATH2 = "refactor.yml";
25579
25547
  function ignore2(file) {
25580
- if (!fs34.existsSync(file)) {
25548
+ if (!fs33.existsSync(file)) {
25581
25549
  console.error(chalk191.red(`Error: File does not exist: ${file}`));
25582
25550
  process.exit(1);
25583
25551
  }
25584
- const content = fs34.readFileSync(file, "utf8");
25552
+ const content = fs33.readFileSync(file, "utf8");
25585
25553
  const lineCount = content.split("\n").length;
25586
25554
  const maxLines = lineCount + 10;
25587
25555
  const entry = `- file: ${file}
25588
25556
  maxLines: ${maxLines}
25589
25557
  `;
25590
- if (fs34.existsSync(REFACTOR_YML_PATH2)) {
25591
- const existing = fs34.readFileSync(REFACTOR_YML_PATH2, "utf8");
25592
- fs34.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
25558
+ if (fs33.existsSync(REFACTOR_YML_PATH2)) {
25559
+ const existing = fs33.readFileSync(REFACTOR_YML_PATH2, "utf8");
25560
+ fs33.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
25593
25561
  } else {
25594
- fs34.writeFileSync(REFACTOR_YML_PATH2, entry);
25562
+ fs33.writeFileSync(REFACTOR_YML_PATH2, entry);
25595
25563
  }
25596
25564
  console.log(
25597
25565
  chalk191.green(
@@ -25601,12 +25569,12 @@ function ignore2(file) {
25601
25569
  }
25602
25570
 
25603
25571
  // src/commands/refactor/rename/index.ts
25604
- import fs37 from "fs";
25572
+ import fs36 from "fs";
25605
25573
  import path55 from "path";
25606
25574
  import chalk194 from "chalk";
25607
25575
 
25608
25576
  // src/commands/refactor/rename/applyRename.ts
25609
- import fs36 from "fs";
25577
+ import fs35 from "fs";
25610
25578
  import path52 from "path";
25611
25579
  import chalk192 from "chalk";
25612
25580
 
@@ -25614,7 +25582,7 @@ import chalk192 from "chalk";
25614
25582
  import path51 from "path";
25615
25583
 
25616
25584
  // src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
25617
- import fs35 from "fs";
25585
+ import fs34 from "fs";
25618
25586
  function getOrCreateList(map, key) {
25619
25587
  const list5 = map.get(key) ?? [];
25620
25588
  if (!map.has(key)) map.set(key, list5);
@@ -25633,7 +25601,7 @@ function rewriteSpecifier(content, oldSpecifier, newSpecifier) {
25633
25601
  return content.replace(pattern2, `$1${newSpecifier}$2`);
25634
25602
  }
25635
25603
  function applyFileRewrites(file, fileRewrites) {
25636
- let content = fs35.readFileSync(file, "utf8");
25604
+ let content = fs34.readFileSync(file, "utf8");
25637
25605
  for (const { oldSpecifier, newSpecifier } of fileRewrites) {
25638
25606
  content = rewriteSpecifier(content, oldSpecifier, newSpecifier);
25639
25607
  }
@@ -25712,12 +25680,12 @@ function computeRewrites(moves, edges, allProjectFiles) {
25712
25680
  function applyRename(rewrites, sourcePath, destPath, cwd) {
25713
25681
  const updatedContents = applyRewrites(rewrites);
25714
25682
  for (const [file, content] of updatedContents) {
25715
- fs36.writeFileSync(file, content, "utf8");
25683
+ fs35.writeFileSync(file, content, "utf8");
25716
25684
  console.log(chalk192.cyan(` Updated imports in ${path52.relative(cwd, file)}`));
25717
25685
  }
25718
25686
  const destDir = path52.dirname(destPath);
25719
- if (!fs36.existsSync(destDir)) fs36.mkdirSync(destDir, { recursive: true });
25720
- fs36.renameSync(sourcePath, destPath);
25687
+ if (!fs35.existsSync(destDir)) fs35.mkdirSync(destDir, { recursive: true });
25688
+ fs35.renameSync(sourcePath, destPath);
25721
25689
  console.log(
25722
25690
  chalk192.white(
25723
25691
  ` Moved ${path52.relative(cwd, sourcePath)} \u2192 ${path52.relative(cwd, destPath)}`
@@ -25825,11 +25793,11 @@ async function rename(source, destination, options2 = {}) {
25825
25793
  const cwd = process.cwd();
25826
25794
  const relSource = path55.relative(cwd, sourcePath);
25827
25795
  const relDest = path55.relative(cwd, destPath);
25828
- if (!fs37.existsSync(sourcePath)) {
25796
+ if (!fs36.existsSync(sourcePath)) {
25829
25797
  console.log(chalk194.red(`File not found: ${source}`));
25830
25798
  process.exit(1);
25831
25799
  }
25832
- if (destPath !== sourcePath && fs37.existsSync(destPath)) {
25800
+ if (destPath !== sourcePath && fs36.existsSync(destPath)) {
25833
25801
  console.log(chalk194.red(`Destination already exists: ${destination}`));
25834
25802
  process.exit(1);
25835
25803
  }
@@ -26054,27 +26022,27 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
26054
26022
  }
26055
26023
 
26056
26024
  // src/commands/refactor/restructure/executePlan.ts
26057
- import fs38 from "fs";
26025
+ import fs37 from "fs";
26058
26026
  import path60 from "path";
26059
26027
  import chalk197 from "chalk";
26060
26028
  function executePlan(plan2) {
26061
26029
  const updatedContents = applyRewrites(plan2.rewrites);
26062
26030
  for (const [file, content] of updatedContents) {
26063
- fs38.writeFileSync(file, content, "utf8");
26031
+ fs37.writeFileSync(file, content, "utf8");
26064
26032
  console.log(
26065
26033
  chalk197.cyan(` Rewrote imports in ${path60.relative(process.cwd(), file)}`)
26066
26034
  );
26067
26035
  }
26068
26036
  for (const dir of plan2.newDirectories) {
26069
- fs38.mkdirSync(dir, { recursive: true });
26037
+ fs37.mkdirSync(dir, { recursive: true });
26070
26038
  console.log(chalk197.green(` Created ${path60.relative(process.cwd(), dir)}/`));
26071
26039
  }
26072
26040
  for (const move2 of plan2.moves) {
26073
26041
  const targetDir = path60.dirname(move2.to);
26074
- if (!fs38.existsSync(targetDir)) {
26075
- fs38.mkdirSync(targetDir, { recursive: true });
26042
+ if (!fs37.existsSync(targetDir)) {
26043
+ fs37.mkdirSync(targetDir, { recursive: true });
26076
26044
  }
26077
- fs38.renameSync(move2.from, move2.to);
26045
+ fs37.renameSync(move2.from, move2.to);
26078
26046
  console.log(
26079
26047
  chalk197.white(
26080
26048
  ` Moved ${path60.relative(process.cwd(), move2.from)} \u2192 ${path60.relative(process.cwd(), move2.to)}`
@@ -26086,10 +26054,10 @@ function executePlan(plan2) {
26086
26054
  function removeEmptyDirectories(dirs) {
26087
26055
  const unique = [...new Set(dirs)];
26088
26056
  for (const dir of unique) {
26089
- if (!fs38.existsSync(dir)) continue;
26090
- const entries = fs38.readdirSync(dir);
26057
+ if (!fs37.existsSync(dir)) continue;
26058
+ const entries = fs37.readdirSync(dir);
26091
26059
  if (entries.length === 0) {
26092
- fs38.rmdirSync(dir);
26060
+ fs37.rmdirSync(dir);
26093
26061
  console.log(
26094
26062
  chalk197.dim(
26095
26063
  ` Removed empty directory ${path60.relative(process.cwd(), dir)}`
@@ -26103,18 +26071,18 @@ function removeEmptyDirectories(dirs) {
26103
26071
  import path62 from "path";
26104
26072
 
26105
26073
  // src/commands/refactor/restructure/planFileMoves/shared.ts
26106
- import fs39 from "fs";
26074
+ import fs38 from "fs";
26107
26075
  function emptyResult() {
26108
26076
  return { moves: [], directories: [], warnings: [] };
26109
26077
  }
26110
26078
  function checkDirConflict(result, label2, dir) {
26111
- if (!fs39.existsSync(dir)) return false;
26079
+ if (!fs38.existsSync(dir)) return false;
26112
26080
  result.warnings.push(`Skipping ${label2}: directory ${dir} already exists`);
26113
26081
  return true;
26114
26082
  }
26115
26083
 
26116
26084
  // src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
26117
- import fs40 from "fs";
26085
+ import fs39 from "fs";
26118
26086
  import path61 from "path";
26119
26087
  function collectEntry2(results, dir, entry) {
26120
26088
  const full = path61.join(dir, entry.name);
@@ -26122,9 +26090,9 @@ function collectEntry2(results, dir, entry) {
26122
26090
  results.push(...items2);
26123
26091
  }
26124
26092
  function listFilesRecursive(dir) {
26125
- if (!fs40.existsSync(dir)) return [];
26093
+ if (!fs39.existsSync(dir)) return [];
26126
26094
  const results = [];
26127
- for (const entry of fs40.readdirSync(dir, { withFileTypes: true })) {
26095
+ for (const entry of fs39.readdirSync(dir, { withFileTypes: true })) {
26128
26096
  collectEntry2(results, dir, entry);
26129
26097
  }
26130
26098
  return results;
@@ -27159,11 +27127,11 @@ function prepareReviewDir(paths, requestBody, force) {
27159
27127
  }
27160
27128
 
27161
27129
  // src/commands/review/cachedReviewerResult.ts
27162
- import { statSync as statSync10 } from "fs";
27130
+ import { statSync as statSync9 } from "fs";
27163
27131
  function cachedReviewerResult(name, outputPath) {
27164
27132
  let size;
27165
27133
  try {
27166
- size = statSync10(outputPath).size;
27134
+ size = statSync9(outputPath).size;
27167
27135
  } catch {
27168
27136
  return null;
27169
27137
  }
@@ -28809,7 +28777,7 @@ function registerSql(program2) {
28809
28777
  }
28810
28778
 
28811
28779
  // src/commands/sync.ts
28812
- import * as fs49 from "fs";
28780
+ import * as fs48 from "fs";
28813
28781
  import * as os5 from "os";
28814
28782
  import * as path74 from "path";
28815
28783
  import { fileURLToPath as fileURLToPath7 } from "url";
@@ -28818,7 +28786,7 @@ import { fileURLToPath as fileURLToPath7 } from "url";
28818
28786
  import * as path65 from "path";
28819
28787
 
28820
28788
  // src/commands/sync/pruneTarget.ts
28821
- import * as fs41 from "fs";
28789
+ import * as fs40 from "fs";
28822
28790
  import * as path64 from "path";
28823
28791
  function pruneTarget(targetDir, keepNames, shape, options2) {
28824
28792
  const result = {
@@ -28827,9 +28795,9 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
28827
28795
  skipped: [],
28828
28796
  unmanaged: []
28829
28797
  };
28830
- if (!fs41.existsSync(targetDir)) return result;
28798
+ if (!fs40.existsSync(targetDir)) return result;
28831
28799
  const keep = new Set(keepNames);
28832
- for (const entry of fs41.readdirSync(targetDir, { withFileTypes: true })) {
28800
+ for (const entry of fs40.readdirSync(targetDir, { withFileTypes: true })) {
28833
28801
  const name = shape.nameOf(entry);
28834
28802
  if (name === void 0) {
28835
28803
  result.unmanaged.push(entry.name);
@@ -28844,7 +28812,7 @@ function pruneTarget(targetDir, keepNames, shape, options2) {
28844
28812
  continue;
28845
28813
  }
28846
28814
  if (options2.force) {
28847
- fs41.rmSync(entryPath, { recursive: true });
28815
+ fs40.rmSync(entryPath, { recursive: true });
28848
28816
  result.removed.push(entry.name);
28849
28817
  }
28850
28818
  }
@@ -28891,15 +28859,15 @@ function reportPrune(label2, result, force) {
28891
28859
  }
28892
28860
 
28893
28861
  // src/commands/sync/syncClaudeMd.ts
28894
- import * as fs42 from "fs";
28862
+ import * as fs41 from "fs";
28895
28863
  import * as path66 from "path";
28896
28864
  import chalk213 from "chalk";
28897
28865
  async function syncClaudeMd(claudeDir, targetBase, options2) {
28898
28866
  const source = path66.join(claudeDir, "CLAUDE.md");
28899
28867
  const target = path66.join(targetBase, "CLAUDE.md");
28900
- const sourceContent = fs42.readFileSync(source, "utf8");
28901
- if (fs42.existsSync(target)) {
28902
- const targetContent = fs42.readFileSync(target, "utf8");
28868
+ const sourceContent = fs41.readFileSync(source, "utf8");
28869
+ if (fs41.existsSync(target)) {
28870
+ const targetContent = fs41.readFileSync(target, "utf8");
28903
28871
  if (sourceContent !== targetContent) {
28904
28872
  console.log(
28905
28873
  chalk213.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
@@ -28919,7 +28887,7 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
28919
28887
  }
28920
28888
  }
28921
28889
  }
28922
- fs42.copyFileSync(source, target);
28890
+ fs41.copyFileSync(source, target);
28923
28891
  console.log("Copied CLAUDE.md to ~/.claude/CLAUDE.md");
28924
28892
  }
28925
28893
 
@@ -28927,31 +28895,31 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
28927
28895
  import * as path69 from "path";
28928
28896
 
28929
28897
  // src/commands/sync/installHarnessCommands.ts
28930
- import * as fs43 from "fs";
28898
+ import * as fs42 from "fs";
28931
28899
  import * as path67 from "path";
28932
28900
  function installHarnessCommands(claudeDir, harness, transform) {
28933
28901
  const commandsSource = path67.join(claudeDir, "commands");
28934
- const files = fs43.readdirSync(commandsSource);
28902
+ const files = fs42.readdirSync(commandsSource);
28935
28903
  const names = [];
28936
28904
  let synced = 0;
28937
28905
  for (const file of files) {
28938
28906
  if (!file.endsWith(".md")) continue;
28939
28907
  const name = file.replace(/\.md$/, "");
28940
28908
  names.push(name);
28941
- const content = fs43.readFileSync(path67.join(commandsSource, file), "utf8");
28909
+ const content = fs42.readFileSync(path67.join(commandsSource, file), "utf8");
28942
28910
  const target = path67.join(harness.homeDir, harness.sync.commandDest(name));
28943
- fs43.mkdirSync(path67.dirname(target), { recursive: true });
28944
- fs43.writeFileSync(target, transform(name, content));
28911
+ fs42.mkdirSync(path67.dirname(target), { recursive: true });
28912
+ fs42.writeFileSync(target, transform(name, content));
28945
28913
  synced++;
28946
28914
  }
28947
28915
  const agentsTarget = path67.join(harness.homeDir, harness.sync.agentsFile);
28948
- fs43.mkdirSync(path67.dirname(agentsTarget), { recursive: true });
28949
- fs43.copyFileSync(path67.join(claudeDir, "CLAUDE.md"), agentsTarget);
28916
+ fs42.mkdirSync(path67.dirname(agentsTarget), { recursive: true });
28917
+ fs42.copyFileSync(path67.join(claudeDir, "CLAUDE.md"), agentsTarget);
28950
28918
  return { total: files.length, synced, names };
28951
28919
  }
28952
28920
 
28953
28921
  // src/commands/sync/pruneSkills.ts
28954
- import * as fs44 from "fs";
28922
+ import * as fs43 from "fs";
28955
28923
  function pruneSkills(targetDir, skillNames, options2) {
28956
28924
  return pruneTarget(
28957
28925
  targetDir,
@@ -28964,14 +28932,14 @@ function pruneSkills(targetDir, skillNames, options2) {
28964
28932
  );
28965
28933
  }
28966
28934
  function unexpectedContent(skillDir) {
28967
- const entries = fs44.readdirSync(skillDir);
28935
+ const entries = fs43.readdirSync(skillDir);
28968
28936
  const others = entries.filter((entry) => entry !== "SKILL.md");
28969
28937
  if (others.length > 0) return `contains ${others.sort().join(", ")}`;
28970
28938
  return entries.length === 0 ? "no SKILL.md" : void 0;
28971
28939
  }
28972
28940
 
28973
28941
  // src/commands/sync/syncCodexHooks.ts
28974
- import * as fs45 from "fs";
28942
+ import * as fs44 from "fs";
28975
28943
  import * as path68 from "path";
28976
28944
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
28977
28945
  var END = "# <<< assist codex hooks (managed) <<<";
@@ -29002,11 +28970,11 @@ ${rest}
29002
28970
  `;
29003
28971
  }
29004
28972
  function syncCodexHooks(sourcePath) {
29005
- const body = fs45.readFileSync(sourcePath, "utf8");
28973
+ const body = fs44.readFileSync(sourcePath, "utf8");
29006
28974
  const configPath = path68.join(harnesses.codex.homeDir, "config.toml");
29007
- const existing = fs45.existsSync(configPath) ? fs45.readFileSync(configPath, "utf8") : "";
29008
- fs45.mkdirSync(path68.dirname(configPath), { recursive: true });
29009
- fs45.writeFileSync(configPath, upsertManagedBlock(existing, body));
28975
+ const existing = fs44.existsSync(configPath) ? fs44.readFileSync(configPath, "utf8") : "";
28976
+ fs44.mkdirSync(path68.dirname(configPath), { recursive: true });
28977
+ fs44.writeFileSync(configPath, upsertManagedBlock(existing, body));
29010
28978
  console.log(
29011
28979
  "Registered assist codex-hook in ~/.codex/config.toml (UserPromptSubmit, PreToolUse, PostToolUse, PermissionRequest, Stop)"
29012
28980
  );
@@ -29051,21 +29019,21 @@ function syncCodex(claudeDir, options2) {
29051
29019
  }
29052
29020
 
29053
29021
  // src/commands/sync/syncDesign.ts
29054
- import * as fs46 from "fs";
29022
+ import * as fs45 from "fs";
29055
29023
  import * as path70 from "path";
29056
29024
  function syncDesign(claudeDir, targetBase) {
29057
29025
  const systemPromptSource = path70.join(claudeDir, "design-system-prompt.md");
29058
29026
  const systemPromptTarget = path70.join(targetBase, "design-system-prompt.md");
29059
- fs46.copyFileSync(systemPromptSource, systemPromptTarget);
29027
+ fs45.copyFileSync(systemPromptSource, systemPromptTarget);
29060
29028
  console.log(
29061
29029
  "Copied design-system-prompt.md to ~/.claude/design-system-prompt.md"
29062
29030
  );
29063
29031
  const skillsSource = path70.join(claudeDir, "skills");
29064
29032
  const skillsTarget = path70.join(targetBase, "skills");
29065
- fs46.mkdirSync(skillsTarget, { recursive: true });
29066
- const files = fs46.readdirSync(skillsSource);
29033
+ fs45.mkdirSync(skillsTarget, { recursive: true });
29034
+ const files = fs45.readdirSync(skillsSource);
29067
29035
  for (const file of files) {
29068
- fs46.copyFileSync(
29036
+ fs45.copyFileSync(
29069
29037
  path70.join(skillsSource, file),
29070
29038
  path70.join(skillsTarget, file)
29071
29039
  );
@@ -29077,17 +29045,17 @@ function syncDesign(claudeDir, targetBase) {
29077
29045
  import * as path72 from "path";
29078
29046
 
29079
29047
  // src/commands/sync/syncPiHooks.ts
29080
- import * as fs47 from "fs";
29048
+ import * as fs46 from "fs";
29081
29049
  import * as path71 from "path";
29082
29050
  function piExtensionsDir() {
29083
29051
  return path71.join(harnesses.pi.homeDir, "extensions");
29084
29052
  }
29085
29053
  function syncPiHooks(sourceDir) {
29086
29054
  const target = piExtensionsDir();
29087
- fs47.mkdirSync(target, { recursive: true });
29088
- const files = fs47.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
29055
+ fs46.mkdirSync(target, { recursive: true });
29056
+ const files = fs46.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
29089
29057
  for (const file of files) {
29090
- fs47.copyFileSync(
29058
+ fs46.copyFileSync(
29091
29059
  path71.join(sourceDir, file),
29092
29060
  path71.join(target, `assist-${file}`)
29093
29061
  );
@@ -29140,16 +29108,16 @@ function syncPi(claudeDir, options2) {
29140
29108
  }
29141
29109
 
29142
29110
  // src/commands/sync/syncSettings.ts
29143
- import * as fs48 from "fs";
29111
+ import * as fs47 from "fs";
29144
29112
  import * as path73 from "path";
29145
29113
  import chalk214 from "chalk";
29146
29114
  async function syncSettings(claudeDir, targetBase, options2) {
29147
29115
  const source = path73.join(claudeDir, "settings.json");
29148
29116
  const target = path73.join(targetBase, "settings.json");
29149
- const sourceContent = fs48.readFileSync(source, "utf8");
29117
+ const sourceContent = fs47.readFileSync(source, "utf8");
29150
29118
  const sourceSettings = JSON.parse(sourceContent);
29151
- const targetExists = fs48.existsSync(target);
29152
- const targetContent = targetExists ? fs48.readFileSync(target, "utf8") : "";
29119
+ const targetExists = fs47.existsSync(target);
29120
+ const targetContent = targetExists ? fs47.readFileSync(target, "utf8") : "";
29153
29121
  const preservedUserSettings = targetExists ? JSON.parse(targetContent) : {};
29154
29122
  const mergedContent = JSON.stringify(
29155
29123
  { ...preservedUserSettings, ...sourceSettings },
@@ -29179,7 +29147,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
29179
29147
  }
29180
29148
  }
29181
29149
  }
29182
- fs48.writeFileSync(target, mergedContent);
29150
+ fs47.writeFileSync(target, mergedContent);
29183
29151
  console.log("Copied settings.json to ~/.claude/settings.json");
29184
29152
  }
29185
29153
 
@@ -29210,10 +29178,10 @@ async function sync(options2) {
29210
29178
  function syncCommands(claudeDir, targetBase) {
29211
29179
  const sourceDir = path74.join(claudeDir, "commands");
29212
29180
  const targetDir = path74.join(targetBase, "commands");
29213
- fs49.mkdirSync(targetDir, { recursive: true });
29214
- const files = fs49.readdirSync(sourceDir);
29181
+ fs48.mkdirSync(targetDir, { recursive: true });
29182
+ const files = fs48.readdirSync(sourceDir);
29215
29183
  for (const file of files) {
29216
- fs49.copyFileSync(path74.join(sourceDir, file), path74.join(targetDir, file));
29184
+ fs48.copyFileSync(path74.join(sourceDir, file), path74.join(targetDir, file));
29217
29185
  console.log(`Copied ${file} to ${targetDir}`);
29218
29186
  }
29219
29187
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
@@ -29311,14 +29279,14 @@ async function configure() {
29311
29279
  }
29312
29280
 
29313
29281
  // src/commands/transcript/list.ts
29314
- import { existsSync as existsSync59, readdirSync as readdirSync19, statSync as statSync11 } from "fs";
29282
+ import { existsSync as existsSync59, readdirSync as readdirSync19, statSync as statSync10 } from "fs";
29315
29283
  import { join as join76 } from "path";
29316
29284
  function list4() {
29317
29285
  const { vttDir } = getTranscriptConfig();
29318
29286
  if (!existsSync59(vttDir)) return;
29319
29287
  for (const entry of readdirSync19(vttDir)) {
29320
29288
  if (!entry.endsWith(".vtt")) continue;
29321
- if (statSync11(join76(vttDir, entry)).isDirectory()) continue;
29289
+ if (statSync10(join76(vttDir, entry)).isDirectory()) continue;
29322
29290
  console.log(entry);
29323
29291
  }
29324
29292
  }
@@ -30686,7 +30654,7 @@ async function auth() {
30686
30654
 
30687
30655
  // src/commands/roam/postRoamActivity.ts
30688
30656
  import { execFileSync as execFileSync13 } from "child_process";
30689
- import { readdirSync as readdirSync20, readFileSync as readFileSync52, statSync as statSync12 } from "fs";
30657
+ import { readdirSync as readdirSync20, readFileSync as readFileSync52, statSync as statSync11 } from "fs";
30690
30658
  import { join as join85 } from "path";
30691
30659
  function findPortFile(roamDir) {
30692
30660
  let entries;
@@ -30698,7 +30666,7 @@ function findPortFile(roamDir) {
30698
30666
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
30699
30667
  const path80 = join85(roamDir, name);
30700
30668
  try {
30701
- return { path: path80, mtimeMs: statSync12(path80).mtimeMs };
30669
+ return { path: path80, mtimeMs: statSync11(path80).mtimeMs };
30702
30670
  } catch {
30703
30671
  return void 0;
30704
30672
  }
@@ -31668,7 +31636,7 @@ import { existsSync as existsSync72 } from "fs";
31668
31636
  import * as pty from "node-pty";
31669
31637
 
31670
31638
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
31671
- import { chmodSync, existsSync as existsSync71, statSync as statSync13 } from "fs";
31639
+ import { chmodSync, existsSync as existsSync71, statSync as statSync12 } from "fs";
31672
31640
  import { createRequire as createRequire3 } from "module";
31673
31641
  import path75 from "path";
31674
31642
  var require4 = createRequire3(import.meta.url);
@@ -31684,7 +31652,7 @@ function ensureSpawnHelperExecutable() {
31684
31652
  "spawn-helper"
31685
31653
  );
31686
31654
  if (!existsSync71(helper)) return;
31687
- const mode = statSync13(helper).mode;
31655
+ const mode = statSync12(helper).mode;
31688
31656
  if ((mode & 73) === 0) chmodSync(helper, mode | 493);
31689
31657
  }
31690
31658
 
@@ -31797,7 +31765,7 @@ function serverRunMeta(runName, cwd) {
31797
31765
  }
31798
31766
 
31799
31767
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
31800
- import * as fs50 from "fs";
31768
+ import * as fs49 from "fs";
31801
31769
  import * as path76 from "path";
31802
31770
  import { fileURLToPath as fileURLToPath9 } from "url";
31803
31771
  var __filename5 = fileURLToPath9(import.meta.url);
@@ -31809,7 +31777,7 @@ function readDesignSystemPrompt() {
31809
31777
  "claude",
31810
31778
  "design-system-prompt.md"
31811
31779
  );
31812
- return fs50.readFileSync(promptPath, "utf8");
31780
+ return fs49.readFileSync(promptPath, "utf8");
31813
31781
  }
31814
31782
 
31815
31783
  // src/commands/sessions/daemon/spawnClaude.ts
@@ -31901,7 +31869,7 @@ import { existsSync as existsSync73 } from "fs";
31901
31869
  import { join as join91 } from "path";
31902
31870
 
31903
31871
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
31904
- import { statSync as statSync14 } from "fs";
31872
+ import { statSync as statSync13 } from "fs";
31905
31873
  import { rm as rm2 } from "fs/promises";
31906
31874
  import { join as join90 } from "path";
31907
31875
  async function deleteTreeDirectly(clone, worktreePath, why) {
@@ -31931,7 +31899,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
31931
31899
  return { removed: true };
31932
31900
  }
31933
31901
  function holdsAGitDirectoryRatherThanALink(worktreePath) {
31934
- return statSync14(join90(worktreePath, ".git"), {
31902
+ return statSync13(join90(worktreePath, ".git"), {
31935
31903
  throwIfNoEntry: false
31936
31904
  })?.isDirectory() === true;
31937
31905
  }
@@ -32848,7 +32816,7 @@ function reportSilentFailure(session, clients) {
32848
32816
  }
32849
32817
 
32850
32818
  // src/commands/sessions/shared/codex/resolveCodexSessionId.ts
32851
- import * as fs51 from "fs";
32819
+ import * as fs50 from "fs";
32852
32820
  var META_LINES = 5;
32853
32821
  async function resolveCodexSessionId(cwd, sinceMs) {
32854
32822
  if (!cwd) return null;
@@ -32877,7 +32845,7 @@ async function startedIn(file, cwd, sinceMs) {
32877
32845
  }
32878
32846
  async function touchedSince(file, sinceMs) {
32879
32847
  try {
32880
- return (await fs51.promises.stat(file)).mtimeMs >= sinceMs;
32848
+ return (await fs50.promises.stat(file)).mtimeMs >= sinceMs;
32881
32849
  } catch {
32882
32850
  return false;
32883
32851
  }
@@ -32911,7 +32879,7 @@ function bindCodexSession(session, notify2) {
32911
32879
  import { watch as watch3 } from "fs";
32912
32880
 
32913
32881
  // src/commands/sessions/shared/findTranscriptPathSync.ts
32914
- import * as fs52 from "fs";
32882
+ import * as fs51 from "fs";
32915
32883
  import * as path77 from "path";
32916
32884
  function projectDirForCwd(cwd) {
32917
32885
  return path77.join(claudeProjectsRoot(), projectSlug(cwd));
@@ -32921,11 +32889,11 @@ function transcriptPathFor(cwd, claudeSessionId) {
32921
32889
  }
32922
32890
  function findTranscriptPathSync(cwd, claudeSessionId) {
32923
32891
  const direct = transcriptPathFor(cwd, claudeSessionId);
32924
- if (fs52.existsSync(direct)) return direct;
32892
+ if (fs51.existsSync(direct)) return direct;
32925
32893
  const dir = projectDirForCwd(cwd);
32926
32894
  let files;
32927
32895
  try {
32928
- files = fs52.readdirSync(dir);
32896
+ files = fs51.readdirSync(dir);
32929
32897
  } catch {
32930
32898
  return null;
32931
32899
  }
@@ -32939,14 +32907,14 @@ function findTranscriptPathSync(cwd, claudeSessionId) {
32939
32907
  function headContainsSessionId(filePath, claudeSessionId) {
32940
32908
  let fd;
32941
32909
  try {
32942
- fd = fs52.openSync(filePath, "r");
32910
+ fd = fs51.openSync(filePath, "r");
32943
32911
  const buf = Buffer.alloc(16384);
32944
- const bytesRead = fs52.readSync(fd, buf, 0, buf.length, 0);
32912
+ const bytesRead = fs51.readSync(fd, buf, 0, buf.length, 0);
32945
32913
  return buf.toString("utf8", 0, bytesRead).includes(claudeSessionId);
32946
32914
  } catch {
32947
32915
  return false;
32948
32916
  } finally {
32949
- if (fd !== void 0) fs52.closeSync(fd);
32917
+ if (fd !== void 0) fs51.closeSync(fd);
32950
32918
  }
32951
32919
  }
32952
32920
 
@@ -33116,7 +33084,7 @@ function asRecord3(value) {
33116
33084
  }
33117
33085
 
33118
33086
  // src/commands/sessions/shared/readTranscriptTail.ts
33119
- import * as fs53 from "fs";
33087
+ import * as fs52 from "fs";
33120
33088
  var DEFAULT_MAX_BYTES = 256 * 1024;
33121
33089
  function parseTailEntries(raw) {
33122
33090
  const entries = [];
@@ -33137,10 +33105,10 @@ function dropPartialFirstLine(raw, sliced) {
33137
33105
  const newline = raw.indexOf("\n");
33138
33106
  return newline === -1 ? "" : raw.slice(newline + 1);
33139
33107
  }
33140
- async function readTranscriptTail2(filePath, maxBytes = DEFAULT_MAX_BYTES) {
33108
+ async function readTranscriptTail(filePath, maxBytes = DEFAULT_MAX_BYTES) {
33141
33109
  let handle;
33142
33110
  try {
33143
- handle = await fs53.promises.open(filePath, "r");
33111
+ handle = await fs52.promises.open(filePath, "r");
33144
33112
  const { size } = await handle.stat();
33145
33113
  const start3 = Math.max(0, size - maxBytes);
33146
33114
  const length = size - start3;
@@ -33159,20 +33127,20 @@ async function readTranscriptTail2(filePath, maxBytes = DEFAULT_MAX_BYTES) {
33159
33127
  function readTranscriptTailSync(filePath, maxBytes = DEFAULT_MAX_BYTES) {
33160
33128
  let fd;
33161
33129
  try {
33162
- fd = fs53.openSync(filePath, "r");
33163
- const { size } = fs53.fstatSync(fd);
33130
+ fd = fs52.openSync(filePath, "r");
33131
+ const { size } = fs52.fstatSync(fd);
33164
33132
  const start3 = Math.max(0, size - maxBytes);
33165
33133
  const length = size - start3;
33166
33134
  if (length === 0) return [];
33167
33135
  const buf = Buffer.alloc(length);
33168
- fs53.readSync(fd, buf, 0, length, start3);
33136
+ fs52.readSync(fd, buf, 0, length, start3);
33169
33137
  return parseTailEntries(
33170
33138
  dropPartialFirstLine(buf.toString("utf8"), start3 > 0)
33171
33139
  );
33172
33140
  } catch {
33173
33141
  return [];
33174
33142
  } finally {
33175
- if (fd !== void 0) fs53.closeSync(fd);
33143
+ if (fd !== void 0) fs52.closeSync(fd);
33176
33144
  }
33177
33145
  }
33178
33146
 
@@ -33213,7 +33181,7 @@ function isFinished(session) {
33213
33181
  async function reconcileTranscriptStatus(session, onStatusChange, notify2) {
33214
33182
  const filePath = await resolveTranscriptPath(session);
33215
33183
  if (!filePath) return;
33216
- const entries = await readTranscriptTail2(filePath);
33184
+ const entries = await readTranscriptTail(filePath);
33217
33185
  const fingerprint = transcriptTailFingerprint(entries);
33218
33186
  if (fingerprint !== null && fingerprint === session.transcriptFingerprint)
33219
33187
  return;
@@ -33571,7 +33539,7 @@ async function recordWindowTokens(db, window, resetsAt, tokensUp, tokensDown) {
33571
33539
  }
33572
33540
 
33573
33541
  // src/commands/sessions/shared/transcriptUsage.ts
33574
- import * as fs54 from "fs";
33542
+ import * as fs53 from "fs";
33575
33543
  function transcriptUsage(lines2) {
33576
33544
  const byId = /* @__PURE__ */ new Map();
33577
33545
  for (const line of lines2) {
@@ -33595,7 +33563,7 @@ function transcriptUsage(lines2) {
33595
33563
  return [...byId.values()];
33596
33564
  }
33597
33565
  async function readTranscriptUsage(transcriptPath2) {
33598
- const content = await fs54.promises.readFile(transcriptPath2, "utf8");
33566
+ const content = await fs53.promises.readFile(transcriptPath2, "utf8");
33599
33567
  return transcriptUsage(content.split("\n"));
33600
33568
  }
33601
33569
 
@@ -35280,10 +35248,28 @@ function stripOutboundSessionId(data) {
35280
35248
  return stripped;
35281
35249
  }
35282
35250
 
35251
+ // src/commands/sessions/daemon/logWindowsForward.ts
35252
+ function logWindowsForward(delivered, type, sessionId) {
35253
+ if (!delivered)
35254
+ daemonLog(
35255
+ `windows proxy: DROPPED ${type} for ${sessionId} (windows connection not writable)`
35256
+ );
35257
+ else if (type !== "input")
35258
+ daemonLog(`windows proxy: forwarded ${type} for ${sessionId}`);
35259
+ }
35260
+
35261
+ // src/commands/sessions/daemon/forwardWindowsIo.ts
35262
+ function forwardWindowsIo(conn, data) {
35263
+ const sessionId = stripWindowsSessionId(data.sessionId);
35264
+ const delivered = conn.trySend({ ...data, sessionId });
35265
+ logWindowsForward(delivered, data.type, data.sessionId);
35266
+ }
35267
+
35283
35268
  // src/commands/sessions/daemon/WindowsProxyState.ts
35284
35269
  var MAX_SCROLLBACK2 = 256 * 1024;
35285
35270
  var DEFAULT_CREATE_TIMEOUT_MS = 5e3;
35286
- function createState(broadcast2, onSessionsChanged, onVersionMismatch, createTimeoutMs = DEFAULT_CREATE_TIMEOUT_MS) {
35271
+ function createState(broadcast2, onSessionsChanged, onVersionMismatch, onVersionOk = () => {
35272
+ }, createTimeoutMs = DEFAULT_CREATE_TIMEOUT_MS) {
35287
35273
  return {
35288
35274
  windowsSessions: [],
35289
35275
  scrollback: /* @__PURE__ */ new Map(),
@@ -35291,7 +35277,8 @@ function createState(broadcast2, onSessionsChanged, onVersionMismatch, createTim
35291
35277
  createTimeoutMs,
35292
35278
  broadcast: broadcast2,
35293
35279
  onSessionsChanged,
35294
- onVersionMismatch
35280
+ onVersionMismatch,
35281
+ onVersionOk
35295
35282
  };
35296
35283
  }
35297
35284
  function resetState(state) {
@@ -35369,7 +35356,11 @@ function windowsVersionCheck() {
35369
35356
 
35370
35357
  // src/commands/sessions/daemon/handleHello.ts
35371
35358
  function handleHello(state, msg) {
35372
- if (!isHello(msg) || helloCompatible(msg)) return;
35359
+ if (!isHello(msg)) return;
35360
+ if (helloCompatible(msg)) {
35361
+ state.onVersionOk();
35362
+ return;
35363
+ }
35373
35364
  const mode = windowsVersionCheck();
35374
35365
  const mismatch = `windows daemon ${helloMismatchKind(msg)} mismatch`;
35375
35366
  const detail = `protocol ${msg.protocol ?? "legacy"} version ${msg.version} (wsl protocol ${PROTOCOL_VERSION} version ${ASSIST_VERSION})`;
@@ -35505,16 +35496,6 @@ function isWindowsIo(data) {
35505
35496
  return typeof data.sessionId === "string" && isWindowsSessionId(data.sessionId);
35506
35497
  }
35507
35498
 
35508
- // src/commands/sessions/daemon/logWindowsForward.ts
35509
- function logWindowsForward(delivered, type, sessionId) {
35510
- if (!delivered)
35511
- daemonLog(
35512
- `windows proxy: DROPPED ${type} for ${sessionId} (windows connection not writable)`
35513
- );
35514
- else if (type !== "input")
35515
- daemonLog(`windows proxy: forwarded ${type} for ${sessionId}`);
35516
- }
35517
-
35518
35499
  // src/commands/sessions/daemon/WindowsConnection.ts
35519
35500
  import { createInterface as createInterface9 } from "readline";
35520
35501
 
@@ -35641,6 +35622,7 @@ function notifyHealing(state) {
35641
35622
 
35642
35623
  // src/commands/sessions/daemon/WindowsVersionHealer.ts
35643
35624
  var UNRECOVERABLE_MESSAGE = "Windows host is on an incompatible version that auto-update could not resolve; not reconnecting. Update the Windows host manually, then restart.";
35625
+ var HEALED_MESSAGE = "Windows host is up to date \u2014 you can reselect the repo now.";
35644
35626
  var WindowsVersionHealer = class {
35645
35627
  constructor(conn, state, heal) {
35646
35628
  this.conn = conn;
@@ -35650,6 +35632,7 @@ var WindowsVersionHealer = class {
35650
35632
  healAttempted = false;
35651
35633
  healing = false;
35652
35634
  unrecoverable = false;
35635
+ awaitingConfirmation = false;
35653
35636
  get blocked() {
35654
35637
  return this.unrecoverable;
35655
35638
  }
@@ -35661,14 +35644,24 @@ var WindowsVersionHealer = class {
35661
35644
  if (this.healAttempted) return this.giveUp(version2);
35662
35645
  this.healing = true;
35663
35646
  this.healAttempted = true;
35647
+ this.awaitingConfirmation = true;
35664
35648
  try {
35665
35649
  await autoHealWindowsDaemon(this.conn, this.state, this.heal, version2);
35666
35650
  } finally {
35667
35651
  this.healing = false;
35668
35652
  }
35669
35653
  }
35654
+ onCompatible() {
35655
+ if (!this.awaitingConfirmation) return;
35656
+ this.awaitingConfirmation = false;
35657
+ daemonLog(
35658
+ "windows proxy: post-heal handshake compatible; windows host is in step"
35659
+ );
35660
+ this.state.broadcast({ type: "notice", message: HEALED_MESSAGE });
35661
+ }
35670
35662
  giveUp(version2) {
35671
35663
  this.unrecoverable = true;
35664
+ this.awaitingConfirmation = false;
35672
35665
  daemonLog(
35673
35666
  `windows proxy: version mismatch ${version2} persists after heal; not reconnecting until the WSL daemon restarts`
35674
35667
  );
@@ -35689,6 +35682,7 @@ var WindowsProxy = class {
35689
35682
  (msg) => broadcast(clients, msg),
35690
35683
  onSessionsChanged,
35691
35684
  (version2) => void this.healer.onMismatch(version2),
35685
+ () => this.healer.onCompatible(),
35692
35686
  createTimeoutMs
35693
35687
  );
35694
35688
  this.conn = new WindowsConnection({
@@ -35713,7 +35707,10 @@ var WindowsProxy = class {
35713
35707
  route(client, data) {
35714
35708
  if (!this.enabled) return false;
35715
35709
  if (isWindowsCreate(data)) return this.routeCreate(client, data);
35716
- if (isWindowsIo(data)) return this.routeIo(data);
35710
+ if (isWindowsIo(data)) {
35711
+ forwardWindowsIo(this.conn, data);
35712
+ return true;
35713
+ }
35717
35714
  return false;
35718
35715
  }
35719
35716
  routeCreate(client, data) {
@@ -35725,12 +35722,6 @@ var WindowsProxy = class {
35725
35722
  } else void forwardWindowsCreate(this.conn, this.state, client, data);
35726
35723
  return true;
35727
35724
  }
35728
- routeIo(data) {
35729
- const sessionId = stripWindowsSessionId(data.sessionId);
35730
- const delivered = this.conn.trySend({ ...data, sessionId });
35731
- logWindowsForward(delivered, data.type, data.sessionId);
35732
- return true;
35733
- }
35734
35725
  dispose() {
35735
35726
  this.conn.dispose();
35736
35727
  }
@@ -36235,7 +36226,7 @@ function handleSetStatus(client, m, d) {
36235
36226
  }
36236
36227
 
36237
36228
  // src/commands/sessions/shared/parseTranscript.ts
36238
- import * as fs55 from "fs";
36229
+ import * as fs54 from "fs";
36239
36230
 
36240
36231
  // src/commands/sessions/shared/codex/findCodexRolloutPath.ts
36241
36232
  import * as path78 from "path";
@@ -36318,7 +36309,7 @@ async function parseTranscript(sessionId) {
36318
36309
  }
36319
36310
  async function readMessages(filePath, parse3) {
36320
36311
  try {
36321
- const raw = await fs55.promises.readFile(filePath, "utf8");
36312
+ const raw = await fs54.promises.readFile(filePath, "utf8");
36322
36313
  return parse3(raw.split("\n"));
36323
36314
  } catch {
36324
36315
  return [];
@@ -36705,17 +36696,17 @@ function registerSetStatusCommand(cmd) {
36705
36696
  }
36706
36697
 
36707
36698
  // src/commands/sessions/summarise/index.ts
36708
- import * as fs57 from "fs";
36699
+ import * as fs56 from "fs";
36709
36700
  import chalk217 from "chalk";
36710
36701
 
36711
36702
  // src/commands/sessions/summarise/shared.ts
36712
- import * as fs56 from "fs";
36703
+ import * as fs55 from "fs";
36713
36704
  function writeSummary(jsonlPath2, summary) {
36714
- fs56.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
36705
+ fs55.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
36715
36706
  `, "utf8");
36716
36707
  }
36717
36708
  function hasSummary(jsonlPath2) {
36718
- return fs56.existsSync(summaryPathFor(jsonlPath2));
36709
+ return fs55.existsSync(summaryPathFor(jsonlPath2));
36719
36710
  }
36720
36711
  function summaryPathFor(jsonlPath2) {
36721
36712
  return jsonlPath2.replace(/\.jsonl$/, ".summary");
@@ -36787,7 +36778,7 @@ function selectCandidates(files, options2) {
36787
36778
  const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
36788
36779
  candidates.sort((a, b) => {
36789
36780
  try {
36790
- return fs57.statSync(b).mtimeMs - fs57.statSync(a).mtimeMs;
36781
+ return fs56.statSync(b).mtimeMs - fs56.statSync(a).mtimeMs;
36791
36782
  } catch {
36792
36783
  return 0;
36793
36784
  }
@@ -36911,13 +36902,13 @@ function buildLimitsSegment(rateLimits) {
36911
36902
  }
36912
36903
 
36913
36904
  // src/commands/readGitBranch.ts
36914
- import { readFileSync as readFileSync58, statSync as statSync16 } from "fs";
36905
+ import { readFileSync as readFileSync58, statSync as statSync15 } from "fs";
36915
36906
  import { isAbsolute as isAbsolute4, join as join94, resolve as resolve22 } from "path";
36916
36907
  function resolveGitDir(cwd) {
36917
36908
  const dotGit = join94(cwd, ".git");
36918
36909
  let stat4;
36919
36910
  try {
36920
- stat4 = statSync16(dotGit);
36911
+ stat4 = statSync15(dotGit);
36921
36912
  } catch {
36922
36913
  return null;
36923
36914
  }