@staff0rd/assist 0.407.0 → 0.408.1

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.407.0",
9
+ version: "0.408.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -142,10 +142,10 @@ import { stringify as stringifyYaml } from "yaml";
142
142
  // src/shared/loadRawYaml.ts
143
143
  import { existsSync, readFileSync } from "fs";
144
144
  import { parse as parseYaml } from "yaml";
145
- function loadRawYaml(path67) {
146
- if (!existsSync(path67)) return {};
145
+ function loadRawYaml(path69) {
146
+ if (!existsSync(path69)) return {};
147
147
  try {
148
- const content = readFileSync(path67, "utf8");
148
+ const content = readFileSync(path69, "utf8");
149
149
  return parseYaml(content) || {};
150
150
  } catch {
151
151
  return {};
@@ -796,7 +796,8 @@ async function openReset(c, active, usedPercentage) {
796
796
  var lock = ({ tx, window, resetsAt }) => tx.execute(
797
797
  sql`SELECT pg_advisory_xact_lock(hashtextextended(${`${window}:${resetsAt}`}, 0))`
798
798
  );
799
- async function recordWindowPeak(db, window, resetsAt, usedPercentage) {
799
+ async function recordWindowPeak(db, window, resetsAt, usedPercentage, now = Math.floor(Date.now() / 1e3)) {
800
+ if (now >= resetsAt) return;
800
801
  await db.transaction(async (tx) => {
801
802
  const c = { tx, window, resetsAt };
802
803
  await lock(c);
@@ -1436,8 +1437,8 @@ function findUnmergedPaths() {
1436
1437
  }
1437
1438
  const found = /* @__PURE__ */ new Set();
1438
1439
  for (const line of output.split("\n")) {
1439
- const path67 = line.split(" ")[1];
1440
- if (path67) found.add(path67.trim());
1440
+ const path69 = line.split(" ")[1];
1441
+ if (path69) found.add(path69.trim());
1441
1442
  }
1442
1443
  return [...found];
1443
1444
  }
@@ -1536,8 +1537,8 @@ function getPreferredRemoteRepo(cwd) {
1536
1537
  function gitRefUrl(kind, ref, cwd) {
1537
1538
  const repo = getPreferredRemoteRepo(cwd);
1538
1539
  if (!repo) return void 0;
1539
- const path67 = kind === "branch" ? "tree" : "commit";
1540
- return `https://github.com/${repo.org}/${repo.repo}/${path67}/${ref}`;
1540
+ const path69 = kind === "branch" ? "tree" : "commit";
1541
+ return `https://github.com/${repo.org}/${repo.repo}/${path69}/${ref}`;
1541
1542
  }
1542
1543
 
1543
1544
  // src/commands/commit/collectCommitRefs.ts
@@ -3404,9 +3405,9 @@ import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
3404
3405
 
3405
3406
  // src/commands/verify/forbiddenStrings/findForbiddenStrings.ts
3406
3407
  import { minimatch as minimatch2 } from "minimatch";
3407
- function resolveStringsAtPath(data, path67) {
3408
+ function resolveStringsAtPath(data, path69) {
3408
3409
  let current = data;
3409
- for (const segment of path67.split(".")) {
3410
+ for (const segment of path69.split(".")) {
3410
3411
  if (current === null || typeof current !== "object") return [];
3411
3412
  current = current[segment];
3412
3413
  }
@@ -3419,10 +3420,10 @@ function resolveStringsAtPath(data, path67) {
3419
3420
  }
3420
3421
  function findRuleViolations(data, rule) {
3421
3422
  const violations = [];
3422
- for (const path67 of rule.paths) {
3423
- for (const value of resolveStringsAtPath(data, path67)) {
3423
+ for (const path69 of rule.paths) {
3424
+ for (const value of resolveStringsAtPath(data, path69)) {
3424
3425
  if (minimatch2(value, rule.disallowed))
3425
- violations.push({ file: rule.file, path: path67, value });
3426
+ violations.push({ file: rule.file, path: path69, value });
3426
3427
  }
3427
3428
  }
3428
3429
  return violations;
@@ -3461,8 +3462,8 @@ function forbiddenStrings() {
3461
3462
  process.exit(0);
3462
3463
  }
3463
3464
  console.log("Forbidden strings found:\n");
3464
- for (const { file, path: path67, value } of violations) {
3465
- console.log(` ${file} ${path67}: ${value}`);
3465
+ for (const { file, path: path69, value } of violations) {
3466
+ console.log(` ${file} ${path69}: ${value}`);
3466
3467
  }
3467
3468
  console.log(`
3468
3469
  Total: ${violations.length} forbidden string(s).`);
@@ -3754,15 +3755,15 @@ function readBaselineMigrations(repoRelativeDir, ref) {
3754
3755
  } catch {
3755
3756
  return baseline;
3756
3757
  }
3757
- const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path67) => MIGRATION_FILE3.test(basename(path67)));
3758
- for (const path67 of paths) {
3758
+ const paths = listing.split("\n").map((line) => line.trim()).filter(Boolean).filter((path69) => MIGRATION_FILE3.test(basename(path69)));
3759
+ for (const path69 of paths) {
3759
3760
  try {
3760
- const content = execSync12(`git show "${ref}:${path67}"`, {
3761
+ const content = execSync12(`git show "${ref}:${path69}"`, {
3761
3762
  encoding: "utf8",
3762
3763
  maxBuffer: 16 * 1024 * 1024,
3763
3764
  stdio: ["pipe", "pipe", "pipe"]
3764
3765
  });
3765
- baseline.set(basename(path67), content);
3766
+ baseline.set(basename(path69), content);
3766
3767
  } catch {
3767
3768
  }
3768
3769
  }
@@ -5127,10 +5128,10 @@ var hooksSettings = {
5127
5128
  }
5128
5129
  };
5129
5130
  function ensureHooksSettings() {
5130
- const path67 = daemonPaths.hooksSettings;
5131
- mkdirSync5(dirname12(path67), { recursive: true });
5132
- writeFileSync15(path67, JSON.stringify(hooksSettings, null, 2));
5133
- return path67;
5131
+ const path69 = daemonPaths.hooksSettings;
5132
+ mkdirSync5(dirname12(path69), { recursive: true });
5133
+ writeFileSync15(path69, JSON.stringify(hooksSettings, null, 2));
5134
+ return path69;
5134
5135
  }
5135
5136
 
5136
5137
  // src/shared/spawnInherit.ts
@@ -5395,9 +5396,9 @@ var LOCAL_FILES = ["backlog.jsonl", "backlog.db"];
5395
5396
  function backupLocalBacklogFiles(dir) {
5396
5397
  const moved = [];
5397
5398
  for (const name of LOCAL_FILES) {
5398
- const path67 = join15(dir, ".assist", name);
5399
- if (existsSync18(path67)) {
5400
- renameSync(path67, `${path67}.bak`);
5399
+ const path69 = join15(dir, ".assist", name);
5400
+ if (existsSync18(path69)) {
5401
+ renameSync(path69, `${path69}.bak`);
5401
5402
  moved.push(`${name} \u2192 ${name}.bak`);
5402
5403
  }
5403
5404
  }
@@ -5869,8 +5870,8 @@ var backlogItemSchema = z3.strictObject({
5869
5870
  var backlogFileSchema = z3.array(backlogItemSchema);
5870
5871
 
5871
5872
  // src/commands/backlog/parseBacklogJsonl.ts
5872
- function parseBacklogJsonl(path67) {
5873
- const content = readFileSync14(path67, "utf8").trim();
5873
+ function parseBacklogJsonl(path69) {
5874
+ const content = readFileSync14(path69, "utf8").trim();
5874
5875
  if (content.length === 0) return [];
5875
5876
  return content.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => backlogItemSchema.parse(JSON.parse(line)));
5876
5877
  }
@@ -5952,8 +5953,8 @@ function findBacklogUp(startDir) {
5952
5953
 
5953
5954
  // src/commands/backlog/getCurrentOrigin.ts
5954
5955
  import { execFileSync } from "child_process";
5955
- function stripLeadingSlashes(path67) {
5956
- return path67.replace(/^\/+/, "");
5956
+ function stripLeadingSlashes(path69) {
5957
+ return path69.replace(/^\/+/, "");
5957
5958
  }
5958
5959
  function normalizeOrigin(raw) {
5959
5960
  const trimmed = raw.trim().replace(/\.git$/i, "").replace(/\/+$/, "");
@@ -6493,24 +6494,24 @@ function getOwnerPath(itemId2) {
6493
6494
  function recordSignalOwner(itemId2) {
6494
6495
  const sessionId = process.env.ASSIST_SESSION_ID;
6495
6496
  if (!sessionId) return;
6496
- const path67 = getOwnerPath(itemId2);
6497
- mkdirSync7(dirname14(path67), { recursive: true });
6498
- writeFileSync17(path67, JSON.stringify({ sessionId }));
6497
+ const path69 = getOwnerPath(itemId2);
6498
+ mkdirSync7(dirname14(path69), { recursive: true });
6499
+ writeFileSync17(path69, JSON.stringify({ sessionId }));
6499
6500
  }
6500
6501
  function readSignalOwner(itemId2) {
6501
- const path67 = getOwnerPath(itemId2);
6502
- if (!existsSync21(path67)) return void 0;
6502
+ const path69 = getOwnerPath(itemId2);
6503
+ if (!existsSync21(path69)) return void 0;
6503
6504
  try {
6504
- const parsed = JSON.parse(readFileSync15(path67, "utf8"));
6505
+ const parsed = JSON.parse(readFileSync15(path69, "utf8"));
6505
6506
  return parsed.sessionId;
6506
6507
  } catch {
6507
6508
  return void 0;
6508
6509
  }
6509
6510
  }
6510
6511
  function clearSignalOwner(itemId2) {
6511
- const path67 = getOwnerPath(itemId2);
6512
+ const path69 = getOwnerPath(itemId2);
6512
6513
  try {
6513
- rmSync(path67);
6514
+ rmSync(path69);
6514
6515
  } catch {
6515
6516
  }
6516
6517
  }
@@ -6547,19 +6548,19 @@ function resolveSignalTarget(event, data) {
6547
6548
  function writeSignal(event, data) {
6548
6549
  const target = resolveSignalTarget(event, data);
6549
6550
  if (!target) return;
6550
- const path67 = getSignalPath(target);
6551
- if (!path67) return;
6551
+ const path69 = getSignalPath(target);
6552
+ if (!path69) return;
6552
6553
  const signal = { event, sessionId: target, ...data };
6553
- mkdirSync8(dirname15(path67), { recursive: true });
6554
- writeFileSync18(path67, JSON.stringify(signal));
6554
+ mkdirSync8(dirname15(path69), { recursive: true });
6555
+ writeFileSync18(path69, JSON.stringify(signal));
6555
6556
  }
6556
6557
 
6557
6558
  // src/commands/backlog/readSignal.ts
6558
6559
  function readSignal() {
6559
- const path67 = getSignalPath();
6560
- if (!path67 || !existsSync22(path67)) return void 0;
6560
+ const path69 = getSignalPath();
6561
+ if (!path69 || !existsSync22(path69)) return void 0;
6561
6562
  try {
6562
- return JSON.parse(readFileSync16(path67, "utf8"));
6563
+ return JSON.parse(readFileSync16(path69, "utf8"));
6563
6564
  } catch {
6564
6565
  return void 0;
6565
6566
  }
@@ -6692,13 +6693,13 @@ function activityPath(sessionId) {
6692
6693
  function emitActivity(activity2) {
6693
6694
  const sessionId = process.env.ASSIST_ACTIVITY_ID;
6694
6695
  if (!sessionId) return;
6695
- const path67 = activityPath(sessionId);
6696
- mkdirSync9(dirname16(path67), { recursive: true });
6697
- writeFileSync19(path67, JSON.stringify({ ...activity2, startedAt: Date.now() }));
6696
+ const path69 = activityPath(sessionId);
6697
+ mkdirSync9(dirname16(path69), { recursive: true });
6698
+ writeFileSync19(path69, JSON.stringify({ ...activity2, startedAt: Date.now() }));
6698
6699
  }
6699
- function readActivity(path67) {
6700
+ function readActivity(path69) {
6700
6701
  try {
6701
- return JSON.parse(readFileSync17(path67, "utf8"));
6702
+ return JSON.parse(readFileSync17(path69, "utf8"));
6702
6703
  } catch {
6703
6704
  return void 0;
6704
6705
  }
@@ -6708,9 +6709,9 @@ function reconcileActivity(sessionId, activity2) {
6708
6709
  removeActivity(sessionId);
6709
6710
  return;
6710
6711
  }
6711
- const path67 = activityPath(sessionId);
6712
- mkdirSync9(dirname16(path67), { recursive: true });
6713
- writeFileSync19(path67, JSON.stringify(activity2));
6712
+ const path69 = activityPath(sessionId);
6713
+ mkdirSync9(dirname16(path69), { recursive: true });
6714
+ writeFileSync19(path69, JSON.stringify(activity2));
6714
6715
  }
6715
6716
  function removeActivity(sessionId) {
6716
6717
  try {
@@ -7949,8 +7950,8 @@ async function loadItemSummaries(orm, origin) {
7949
7950
  // src/commands/backlog/originDisplayName.ts
7950
7951
  function originDisplayName(origin) {
7951
7952
  if (origin.startsWith("local:")) {
7952
- const path67 = origin.slice("local:".length).replace(/\/+$/, "");
7953
- const segments = path67.split("/").filter(Boolean);
7953
+ const path69 = origin.slice("local:".length).replace(/\/+$/, "");
7954
+ const segments = path69.split("/").filter(Boolean);
7954
7955
  return segments[segments.length - 1] ?? origin;
7955
7956
  }
7956
7957
  const firstSlash = origin.indexOf("/");
@@ -8354,7 +8355,7 @@ function findSynthesisForBranch(repoReviewsDir, branch2) {
8354
8355
  const parent = dirname20(branchKeyPath);
8355
8356
  const branchPrefix = basename5(branchKeyPath);
8356
8357
  if (!existsSync25(parent)) return null;
8357
- const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join23(parent, name, "synthesis.md")).filter((path67) => existsSync25(path67)).map((path67) => ({ path: path67, mtime: statSync2(path67).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
8358
+ const synthesisFiles = readdirSync2(parent).filter((name) => name.startsWith(branchPrefix)).map((name) => join23(parent, name, "synthesis.md")).filter((path69) => existsSync25(path69)).map((path69) => ({ path: path69, mtime: statSync2(path69).mtimeMs })).sort((a, b) => b.mtime - a.mtime);
8358
8359
  return synthesisFiles[0]?.path ?? null;
8359
8360
  }
8360
8361
 
@@ -8408,12 +8409,12 @@ async function getReviewSynthesis(req, res) {
8408
8409
  const cwd = getCwdParam(req, res);
8409
8410
  if (!cwd) return;
8410
8411
  try {
8411
- const path67 = await resolveSynthesisPath(cwd);
8412
- if (!path67) {
8412
+ const path69 = await resolveSynthesisPath(cwd);
8413
+ if (!path69) {
8413
8414
  respondJson(res, 404, { error: "No synthesis found" });
8414
8415
  return;
8415
8416
  }
8416
- respondJson(res, 200, { synthesis: readFileSync19(path67, "utf8") });
8417
+ respondJson(res, 200, { synthesis: readFileSync19(path69, "utf8") });
8417
8418
  } catch {
8418
8419
  respondJson(res, 404, { error: "No synthesis found" });
8419
8420
  }
@@ -8560,10 +8561,10 @@ function getStorePath(filename) {
8560
8561
  return join26(getStoreDir(), filename);
8561
8562
  }
8562
8563
  function loadJson(filename) {
8563
- const path67 = getStorePath(filename);
8564
- if (existsSync26(path67)) {
8564
+ const path69 = getStorePath(filename);
8565
+ if (existsSync26(path69)) {
8565
8566
  try {
8566
- return JSON.parse(readFileSync20(path67, "utf8"));
8567
+ return JSON.parse(readFileSync20(path69, "utf8"));
8567
8568
  } catch {
8568
8569
  return {};
8569
8570
  }
@@ -11914,9 +11915,9 @@ var __dirname4 = dirname21(__filename3);
11914
11915
  function packageRoot() {
11915
11916
  return __dirname4;
11916
11917
  }
11917
- function readLines(path67) {
11918
- if (!existsSync27(path67)) return [];
11919
- return readFileSync23(path67, "utf8").split("\n").filter((line) => line.trim() !== "");
11918
+ function readLines(path69) {
11919
+ if (!existsSync27(path69)) return [];
11920
+ return readFileSync23(path69, "utf8").split("\n").filter((line) => line.trim() !== "");
11920
11921
  }
11921
11922
  var cachedReads;
11922
11923
  var cachedWrites;
@@ -12408,14 +12409,14 @@ function showProgress(p, label2) {
12408
12409
  const pct = Math.round(p.done / p.total * 100);
12409
12410
  process.stderr.write(`\r\x1B[K[${pct}%] Scanning ${label2}...`);
12410
12411
  }
12411
- async function resolveCommand(cli, path67, description, depth, p) {
12412
- showProgress(p, path67.join(" "));
12413
- const subHelp = await runHelp([cli, ...path67]);
12412
+ async function resolveCommand(cli, path69, description, depth, p) {
12413
+ showProgress(p, path69.join(" "));
12414
+ const subHelp = await runHelp([cli, ...path69]);
12414
12415
  if (!subHelp || !hasSubcommands(subHelp)) {
12415
- return [{ path: path67, description }];
12416
+ return [{ path: path69, description }];
12416
12417
  }
12417
- const children = await discoverAt(cli, path67, depth + 1, p);
12418
- return children.length > 0 ? children : [{ path: path67, description }];
12418
+ const children = await discoverAt(cli, path69, depth + 1, p);
12419
+ return children.length > 0 ? children : [{ path: path69, description }];
12419
12420
  }
12420
12421
  async function discoverAt(cli, parentPath, depth, p) {
12421
12422
  if (depth > SAFETY_DEPTH) return [];
@@ -12563,9 +12564,9 @@ function logPath(cli) {
12563
12564
  return join30(homedir16(), ".assist", `cli-discover-${safeName}.log`);
12564
12565
  }
12565
12566
  function readCache(cli) {
12566
- const path67 = logPath(cli);
12567
- if (!existsSync29(path67)) return void 0;
12568
- return readFileSync25(path67, "utf8");
12567
+ const path69 = logPath(cli);
12568
+ if (!existsSync29(path69)) return void 0;
12569
+ return readFileSync25(path69, "utf8");
12569
12570
  }
12570
12571
  function writeCache(cli, output) {
12571
12572
  const dir = join30(homedir16(), ".assist");
@@ -12737,9 +12738,9 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
12737
12738
  }
12738
12739
  const cutoff = Date.now() - STALE_AFTER_MS;
12739
12740
  for (const entry of entries) {
12740
- const path67 = join32(dir, entry);
12741
+ const path69 = join32(dir, entry);
12741
12742
  try {
12742
- if (statSync3(path67).mtimeMs < cutoff) unlinkSync7(path67);
12743
+ if (statSync3(path69).mtimeMs < cutoff) unlinkSync7(path69);
12743
12744
  } catch {
12744
12745
  continue;
12745
12746
  }
@@ -12749,10 +12750,10 @@ function sweepRestrictedDir(dir = getRestrictedDir()) {
12749
12750
  // src/commands/codeComment/readPinState.ts
12750
12751
  import { existsSync as existsSync30, readFileSync as readFileSync26 } from "fs";
12751
12752
  function readPinState(pin) {
12752
- const path67 = getPinStatePath(pin);
12753
- if (!existsSync30(path67)) return void 0;
12753
+ const path69 = getPinStatePath(pin);
12754
+ if (!existsSync30(path69)) return void 0;
12754
12755
  try {
12755
- const state = JSON.parse(readFileSync26(path67, "utf8"));
12756
+ const state = JSON.parse(readFileSync26(path69, "utf8"));
12756
12757
  if (state.pin !== pin) return void 0;
12757
12758
  return state;
12758
12759
  } catch {
@@ -13301,8 +13302,73 @@ Analyzed ${results.length} functions across ${files.length} files`
13301
13302
  });
13302
13303
  }
13303
13304
 
13305
+ // src/commands/complexity/maintainability/aggregateResults.ts
13306
+ function aggregateResults(fileMetrics) {
13307
+ const results = [];
13308
+ for (const [file, metrics] of fileMetrics) {
13309
+ if (metrics.functions.length === 0) continue;
13310
+ const avgMaintainability = metrics.functions.reduce((a, b) => a + b, 0) / metrics.functions.length;
13311
+ const minMaintainability = Math.min(...metrics.functions);
13312
+ results.push({
13313
+ file,
13314
+ avgMaintainability,
13315
+ minMaintainability,
13316
+ override: metrics.override,
13317
+ largestFunction: metrics.largestFunction
13318
+ });
13319
+ }
13320
+ results.sort((a, b) => a.minMaintainability - b.minMaintainability);
13321
+ return results;
13322
+ }
13323
+
13324
+ // src/commands/complexity/maintainability/collectFileMetrics.ts
13325
+ import fs21 from "fs";
13326
+
13327
+ // src/commands/complexity/maintainability/calculateMaintainabilityIndex.ts
13328
+ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, sloc2) {
13329
+ if (halsteadVolume === 0 || sloc2 === 0) {
13330
+ return 100;
13331
+ }
13332
+ const mi = 171 - 5.2 * Math.log(halsteadVolume) - 0.23 * cyclomaticComplexity - 16.2 * Math.log(sloc2);
13333
+ return Math.max(0, Math.min(100, mi));
13334
+ }
13335
+
13336
+ // src/commands/complexity/maintainability/collectFileMetrics.ts
13337
+ function collectFileMetrics(files) {
13338
+ const fileMetrics = /* @__PURE__ */ new Map();
13339
+ for (const file of files) {
13340
+ const content = fs21.readFileSync(file, "utf8");
13341
+ fileMetrics.set(file, {
13342
+ sloc: countSloc(content),
13343
+ functions: [],
13344
+ override: parseMaintainabilityOverride(content),
13345
+ largestFunction: "",
13346
+ largestFunctionSize: -1
13347
+ });
13348
+ }
13349
+ forEachFunction(files, (file, name, node) => {
13350
+ const metrics = fileMetrics.get(file);
13351
+ if (metrics) {
13352
+ const complexity = calculateCyclomaticComplexity(node);
13353
+ const halstead2 = calculateHalstead(node);
13354
+ const mi = calculateMaintainabilityIndex(
13355
+ halstead2.volume,
13356
+ complexity,
13357
+ metrics.sloc
13358
+ );
13359
+ metrics.functions.push(mi);
13360
+ const size = node.end - node.pos;
13361
+ if (size > metrics.largestFunctionSize) {
13362
+ metrics.largestFunctionSize = size;
13363
+ metrics.largestFunction = name;
13364
+ }
13365
+ }
13366
+ });
13367
+ return fileMetrics;
13368
+ }
13369
+
13304
13370
  // src/commands/complexity/maintainability/displayMaintainabilityResults.ts
13305
- import chalk117 from "chalk";
13371
+ import chalk118 from "chalk";
13306
13372
 
13307
13373
  // src/commands/complexity/maintainability/formatResultLine.ts
13308
13374
  import chalk115 from "chalk";
@@ -13313,28 +13379,101 @@ function formatResultLine(entry, failing) {
13313
13379
  return `${name} \u2192 avg: ${chalk115.cyan(avgMaintainability.toFixed(1))}, min: ${chalk115.yellow(minMaintainability.toFixed(1))}${suffix}`;
13314
13380
  }
13315
13381
 
13382
+ // src/commands/complexity/maintainability/getMaintainabilityGitState.ts
13383
+ import { execSync as execSync32 } from "child_process";
13384
+ import path28 from "path";
13385
+ function git2(command) {
13386
+ return execSync32(command, { encoding: "utf8" });
13387
+ }
13388
+ function toAbsolute(root, repoRelative) {
13389
+ return path28.resolve(root, repoRelative);
13390
+ }
13391
+ function collectShrunkFiles(root) {
13392
+ const shrunk = /* @__PURE__ */ new Set();
13393
+ const numstat = git2("git diff --numstat HEAD").trim();
13394
+ if (numstat === "") return shrunk;
13395
+ for (const line of numstat.split("\n")) {
13396
+ const [addedRaw, removedRaw, ...rest] = line.split(" ");
13397
+ const file = rest.join(" ");
13398
+ const added = Number.parseInt(addedRaw, 10);
13399
+ const removed = Number.parseInt(removedRaw, 10);
13400
+ if (Number.isNaN(added) || Number.isNaN(removed)) continue;
13401
+ if (removed > added) shrunk.add(toAbsolute(root, file));
13402
+ }
13403
+ return shrunk;
13404
+ }
13405
+ function hasNewSourceFile() {
13406
+ const status3 = git2("git status --porcelain --untracked-files=all").trim();
13407
+ if (status3 === "") return false;
13408
+ for (const line of status3.split("\n")) {
13409
+ const code = line.slice(0, 2);
13410
+ const file = line.slice(3);
13411
+ const isNew = code.includes("A") || code.includes("?");
13412
+ if (isNew && (file.endsWith(".ts") || file.endsWith(".tsx"))) return true;
13413
+ }
13414
+ return false;
13415
+ }
13416
+ function getMaintainabilityGitState() {
13417
+ try {
13418
+ const root = git2("git rev-parse --show-toplevel").trim();
13419
+ return {
13420
+ shrunkFiles: collectShrunkFiles(root),
13421
+ newFileCreated: hasNewSourceFile()
13422
+ };
13423
+ } catch {
13424
+ return { shrunkFiles: /* @__PURE__ */ new Set(), newFileCreated: false };
13425
+ }
13426
+ }
13427
+
13316
13428
  // src/commands/complexity/maintainability/printMaintainabilityFailure.ts
13429
+ import path29 from "path";
13317
13430
  import chalk116 from "chalk";
13318
- function printMaintainabilityFailure(failingCount, threshold) {
13319
- const thresholdLabel = threshold !== void 0 ? ` ${threshold}` : "";
13431
+ function suggestDestination(file, functionName) {
13432
+ return path29.join(path29.dirname(file), `${functionName}.ts`);
13433
+ }
13434
+ function remediationLine(entry) {
13435
+ const { file, largestFunction } = entry;
13436
+ if (largestFunction === "" || largestFunction.startsWith("<"))
13437
+ return ` Move the largest responsibility out of ${chalk116.bold(file)} into a new file with 'assist refactor extract'.`;
13438
+ const dest = suggestDestination(file, largestFunction);
13439
+ const command = `assist refactor extract ${file} ${largestFunction} ${dest} --apply`;
13440
+ return ` ${chalk116.bold(file)} \u2192 extract '${largestFunction}' to a new file:
13441
+ ${chalk116.cyan(command)}`;
13442
+ }
13443
+ function cheatLine(entry, gitState) {
13444
+ const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
13445
+ if (!shrank || gitState.newFileCreated) return "";
13446
+ return `
13447
+ ${chalk116.red("\u2717 You shrank existing lines in this file without creating a new file. That cannot clear the gate \u2014 extract a responsibility to a new file.")}`;
13448
+ }
13449
+ function printMaintainabilityFailure(failing, gitState) {
13450
+ const blocks = failing.map((entry) => `${remediationLine(entry)}${cheatLine(entry, gitState)}`).join("\n");
13320
13451
  console.error(
13321
13452
  chalk116.red(
13322
13453
  `
13323
- Fail: ${failingCount} file(s) below threshold${thresholdLabel} (files marked "(override: N)" were judged against their own marker). Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
13454
+ Fail: ${failing.length} file(s) below threshold \u2192 extract a responsibility to a new file.
13324
13455
 
13325
- \u26A0\uFE0F ${chalk116.bold("Diagnose and fix one file at a time")} \u2014 do not investigate or fix multiple files in parallel.
13456
+ ${blocks}
13326
13457
 
13327
- The score is a property of the whole file, not your diff: any existing logic counts, so the fix is to shrink the file \u2014 not to revert or micro-optimize the lines you just changed. Identify the largest cohesive responsibility (often the biggest function, or a related group of functions) and move it to a new file with 'assist refactor extract'. Run 'assist complexity <file>' for per-function metrics only to locate that responsibility, not to tweak individual lines.`
13458
+ ${chalk116.bold("Diagnose and fix one file at a time.")} Only a new file (Write) or 'assist refactor extract' clears this gate \u2014 editing the existing lines does not.`
13328
13459
  )
13329
13460
  );
13330
13461
  }
13331
13462
 
13463
+ // src/commands/complexity/maintainability/printMaintainabilityFormula.ts
13464
+ import chalk117 from "chalk";
13465
+ var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
13466
+ function printMaintainabilityFormula() {
13467
+ console.log(chalk117.dim(MI_FORMULA));
13468
+ }
13469
+
13332
13470
  // src/commands/complexity/maintainability/displayMaintainabilityResults.ts
13333
- function displayMaintainabilityResults(results, threshold) {
13471
+ function displayMaintainabilityResults(results, threshold, gitState = getMaintainabilityGitState()) {
13334
13472
  const gating = threshold !== void 0 || results.some((r) => r.override !== void 0);
13335
13473
  if (!gating) {
13474
+ printMaintainabilityFormula();
13336
13475
  for (const entry of results) console.log(formatResultLine(entry, false));
13337
- console.log(chalk117.dim(`
13476
+ console.log(chalk118.dim(`
13338
13477
  Analyzed ${results.length} files`));
13339
13478
  return;
13340
13479
  }
@@ -13343,90 +13482,23 @@ Analyzed ${results.length} files`));
13343
13482
  return limit !== void 0 && r.minMaintainability < limit;
13344
13483
  });
13345
13484
  if (failing.length === 0) {
13346
- console.log(chalk117.green("All files pass maintainability threshold"));
13347
- } else {
13348
- for (const entry of failing) console.log(formatResultLine(entry, true));
13485
+ console.log(chalk118.green("All files pass maintainability threshold"));
13349
13486
  }
13350
13487
  const passingOverrides = results.filter(
13351
13488
  (r) => r.override !== void 0 && !failing.includes(r)
13352
13489
  );
13353
13490
  for (const entry of passingOverrides)
13354
13491
  console.log(formatResultLine(entry, false));
13355
- console.log(chalk117.dim(`
13492
+ console.log(chalk118.dim(`
13356
13493
  Analyzed ${results.length} files`));
13357
13494
  if (failing.length > 0) {
13358
- printMaintainabilityFailure(failing.length, threshold);
13495
+ printMaintainabilityFailure(failing, gitState);
13359
13496
  process.exit(1);
13360
13497
  }
13361
13498
  }
13362
13499
 
13363
- // src/commands/complexity/maintainability/printMaintainabilityFormula.ts
13364
- import chalk118 from "chalk";
13365
- var MI_FORMULA = "171 - 5.2*ln(HalsteadVolume) - 0.23*CyclomaticComplexity - 16.2*ln(SLOC), clamped 0-100";
13366
- function printMaintainabilityFormula() {
13367
- console.log(chalk118.dim(MI_FORMULA));
13368
- }
13369
-
13370
- // src/commands/complexity/maintainability/collectFileMetrics.ts
13371
- import fs21 from "fs";
13372
-
13373
- // src/commands/complexity/maintainability/calculateMaintainabilityIndex.ts
13374
- function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, sloc2) {
13375
- if (halsteadVolume === 0 || sloc2 === 0) {
13376
- return 100;
13377
- }
13378
- const mi = 171 - 5.2 * Math.log(halsteadVolume) - 0.23 * cyclomaticComplexity - 16.2 * Math.log(sloc2);
13379
- return Math.max(0, Math.min(100, mi));
13380
- }
13381
-
13382
- // src/commands/complexity/maintainability/collectFileMetrics.ts
13383
- function collectFileMetrics(files) {
13384
- const fileMetrics = /* @__PURE__ */ new Map();
13385
- for (const file of files) {
13386
- const content = fs21.readFileSync(file, "utf8");
13387
- fileMetrics.set(file, {
13388
- sloc: countSloc(content),
13389
- functions: [],
13390
- override: parseMaintainabilityOverride(content)
13391
- });
13392
- }
13393
- forEachFunction(files, (file, _name, node) => {
13394
- const metrics = fileMetrics.get(file);
13395
- if (metrics) {
13396
- const complexity = calculateCyclomaticComplexity(node);
13397
- const halstead2 = calculateHalstead(node);
13398
- const mi = calculateMaintainabilityIndex(
13399
- halstead2.volume,
13400
- complexity,
13401
- metrics.sloc
13402
- );
13403
- metrics.functions.push(mi);
13404
- }
13405
- });
13406
- return fileMetrics;
13407
- }
13408
-
13409
- // src/commands/complexity/maintainability/aggregateResults.ts
13410
- function aggregateResults(fileMetrics) {
13411
- const results = [];
13412
- for (const [file, metrics] of fileMetrics) {
13413
- if (metrics.functions.length === 0) continue;
13414
- const avgMaintainability = metrics.functions.reduce((a, b) => a + b, 0) / metrics.functions.length;
13415
- const minMaintainability = Math.min(...metrics.functions);
13416
- results.push({
13417
- file,
13418
- avgMaintainability,
13419
- minMaintainability,
13420
- override: metrics.override
13421
- });
13422
- }
13423
- results.sort((a, b) => a.minMaintainability - b.minMaintainability);
13424
- return results;
13425
- }
13426
-
13427
13500
  // src/commands/complexity/maintainability/index.ts
13428
13501
  async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
13429
- printMaintainabilityFormula();
13430
13502
  withSourceFiles(
13431
13503
  pattern2,
13432
13504
  (files) => {
@@ -13577,8 +13649,8 @@ function stepIntoNested(container, key, nextKey) {
13577
13649
  }
13578
13650
  return ensureObject(container, resolved);
13579
13651
  }
13580
- function setNestedValue(obj, path67, value) {
13581
- const keys = path67.split(".");
13652
+ function setNestedValue(obj, path69, value) {
13653
+ const keys = path69.split(".");
13582
13654
  const result = { ...obj };
13583
13655
  let current = result;
13584
13656
  for (let i = 0; i < keys.length - 1; i++) {
@@ -13658,9 +13730,9 @@ function isTraversable(value) {
13658
13730
  function stepInto(current, key) {
13659
13731
  return isTraversable(current) ? current[key] : void 0;
13660
13732
  }
13661
- function getNestedValue(obj, path67) {
13733
+ function getNestedValue(obj, path69) {
13662
13734
  let current = obj;
13663
- for (const key of path67.split(".")) current = stepInto(current, key);
13735
+ for (const key of path69.split(".")) current = stepInto(current, key);
13664
13736
  return current;
13665
13737
  }
13666
13738
 
@@ -13776,10 +13848,10 @@ function getMigrationApprovalPath(migrationId) {
13776
13848
  // src/commands/dbMigration/readMigrationPinState.ts
13777
13849
  import { existsSync as existsSync32, readFileSync as readFileSync28 } from "fs";
13778
13850
  function readMigrationPinState(pin) {
13779
- const path67 = getMigrationPinPath(pin);
13780
- if (!existsSync32(path67)) return void 0;
13851
+ const path69 = getMigrationPinPath(pin);
13852
+ if (!existsSync32(path69)) return void 0;
13781
13853
  try {
13782
- const state = JSON.parse(readFileSync28(path67, "utf8"));
13854
+ const state = JSON.parse(readFileSync28(path69, "utf8"));
13783
13855
  if (state.pin !== pin) return void 0;
13784
13856
  if (!Number.isInteger(state.migrationId)) return void 0;
13785
13857
  return state;
@@ -13918,7 +13990,7 @@ function loadBlogSkipDays(repoName) {
13918
13990
  }
13919
13991
 
13920
13992
  // src/commands/devlog/shared.ts
13921
- import { execSync as execSync32 } from "child_process";
13993
+ import { execSync as execSync33 } from "child_process";
13922
13994
  import chalk127 from "chalk";
13923
13995
 
13924
13996
  // src/shared/getRepoName.ts
@@ -14010,7 +14082,7 @@ function loadAllDevlogLatestDates() {
14010
14082
  // src/commands/devlog/shared.ts
14011
14083
  function getCommitFiles(hash) {
14012
14084
  try {
14013
- const output = execSync32(`git show --name-only --format="" ${hash}`, {
14085
+ const output = execSync33(`git show --name-only --format="" ${hash}`, {
14014
14086
  encoding: "utf8"
14015
14087
  });
14016
14088
  return output.trim().split("\n").filter(Boolean);
@@ -14106,11 +14178,11 @@ function list3(options2) {
14106
14178
  }
14107
14179
 
14108
14180
  // src/commands/devlog/getLastVersionInfo.ts
14109
- import { execFileSync as execFileSync3, execSync as execSync33 } from "child_process";
14181
+ import { execFileSync as execFileSync3, execSync as execSync34 } from "child_process";
14110
14182
  import semver from "semver";
14111
14183
  function getVersionAtCommit(hash) {
14112
14184
  try {
14113
- const content = execSync33(`git show ${hash}:package.json`, {
14185
+ const content = execSync34(`git show ${hash}:package.json`, {
14114
14186
  encoding: "utf8"
14115
14187
  });
14116
14188
  const pkg = JSON.parse(content);
@@ -14283,7 +14355,7 @@ function next2(options2) {
14283
14355
  }
14284
14356
 
14285
14357
  // src/commands/devlog/repos/index.ts
14286
- import { execSync as execSync34 } from "child_process";
14358
+ import { execSync as execSync35 } from "child_process";
14287
14359
 
14288
14360
  // src/commands/devlog/repos/printReposTable.ts
14289
14361
  import chalk131 from "chalk";
@@ -14318,7 +14390,7 @@ function getStatus(lastPush, lastDevlog) {
14318
14390
  return lastDevlog < lastPush ? "outdated" : "ok";
14319
14391
  }
14320
14392
  function fetchRepos(days, all) {
14321
- const json = execSync34(
14393
+ const json = execSync35(
14322
14394
  "gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
14323
14395
  { encoding: "utf8" }
14324
14396
  );
@@ -14452,14 +14524,14 @@ import chalk134 from "chalk";
14452
14524
 
14453
14525
  // src/shared/findRepoRoot.ts
14454
14526
  import { existsSync as existsSync35 } from "fs";
14455
- import path28 from "path";
14527
+ import path30 from "path";
14456
14528
  function findRepoRoot(dir) {
14457
14529
  let current = dir;
14458
- while (current !== path28.dirname(current)) {
14459
- if (existsSync35(path28.join(current, ".git"))) {
14530
+ while (current !== path30.dirname(current)) {
14531
+ if (existsSync35(path30.join(current, ".git"))) {
14460
14532
  return current;
14461
14533
  }
14462
- current = path28.dirname(current);
14534
+ current = path30.dirname(current);
14463
14535
  }
14464
14536
  return null;
14465
14537
  }
@@ -14523,7 +14595,7 @@ async function checkBuildLocksCommand() {
14523
14595
 
14524
14596
  // src/commands/dotnet/buildTree.ts
14525
14597
  import { readFileSync as readFileSync32 } from "fs";
14526
- import path29 from "path";
14598
+ import path31 from "path";
14527
14599
  var PROJECT_REF_RE = /<ProjectReference\s+Include="([^"]+)"/g;
14528
14600
  function getProjectRefs(csprojPath) {
14529
14601
  const content = readFileSync32(csprojPath, "utf8");
@@ -14534,14 +14606,14 @@ function getProjectRefs(csprojPath) {
14534
14606
  return refs;
14535
14607
  }
14536
14608
  function buildTree(csprojPath, repoRoot, visited = /* @__PURE__ */ new Set()) {
14537
- const abs = path29.resolve(csprojPath);
14538
- const rel = path29.relative(repoRoot, abs);
14609
+ const abs = path31.resolve(csprojPath);
14610
+ const rel = path31.relative(repoRoot, abs);
14539
14611
  const node = { path: abs, relativePath: rel, children: [] };
14540
14612
  if (visited.has(abs)) return node;
14541
14613
  visited.add(abs);
14542
- const dir = path29.dirname(abs);
14614
+ const dir = path31.dirname(abs);
14543
14615
  for (const ref of getProjectRefs(abs)) {
14544
- const childAbs = path29.resolve(dir, ref);
14616
+ const childAbs = path31.resolve(dir, ref);
14545
14617
  try {
14546
14618
  readFileSync32(childAbs);
14547
14619
  node.children.push(buildTree(childAbs, repoRoot, visited));
@@ -14569,7 +14641,7 @@ function collectAllDeps(node) {
14569
14641
 
14570
14642
  // src/commands/dotnet/findContainingSolutions.ts
14571
14643
  import { readdirSync as readdirSync6, readFileSync as readFileSync33, statSync as statSync4 } from "fs";
14572
- import path30 from "path";
14644
+ import path32 from "path";
14573
14645
  function findSlnFiles(dir, maxDepth, depth = 0) {
14574
14646
  if (depth > maxDepth) return [];
14575
14647
  const results = [];
@@ -14582,7 +14654,7 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
14582
14654
  for (const entry of entries) {
14583
14655
  if (entry.startsWith(".") || entry === "node_modules" || entry === "packages")
14584
14656
  continue;
14585
- const full = path30.join(dir, entry);
14657
+ const full = path32.join(dir, entry);
14586
14658
  try {
14587
14659
  const stat2 = statSync4(full);
14588
14660
  if (stat2.isFile() && entry.endsWith(".sln")) {
@@ -14596,8 +14668,8 @@ function findSlnFiles(dir, maxDepth, depth = 0) {
14596
14668
  return results;
14597
14669
  }
14598
14670
  function findContainingSolutions(csprojPath, repoRoot) {
14599
- const csprojAbs = path30.resolve(csprojPath);
14600
- const csprojBasename = path30.basename(csprojAbs);
14671
+ const csprojAbs = path32.resolve(csprojPath);
14672
+ const csprojBasename = path32.basename(csprojAbs);
14601
14673
  const slnFiles = findSlnFiles(repoRoot, 3);
14602
14674
  const matches = [];
14603
14675
  const pattern2 = new RegExp(`[\\\\"/]${escapeRegex(csprojBasename)}"`);
@@ -14605,7 +14677,7 @@ function findContainingSolutions(csprojPath, repoRoot) {
14605
14677
  try {
14606
14678
  const content = readFileSync33(sln, "utf8");
14607
14679
  if (pattern2.test(content)) {
14608
- matches.push(path30.relative(repoRoot, sln));
14680
+ matches.push(path32.relative(repoRoot, sln));
14609
14681
  }
14610
14682
  } catch {
14611
14683
  }
@@ -14668,15 +14740,15 @@ function printJson(tree, totalCount, solutions) {
14668
14740
 
14669
14741
  // src/commands/dotnet/resolveCsproj.ts
14670
14742
  import { existsSync as existsSync36 } from "fs";
14671
- import path31 from "path";
14743
+ import path33 from "path";
14672
14744
  import chalk136 from "chalk";
14673
14745
  function resolveCsproj(csprojPath) {
14674
- const resolved = path31.resolve(csprojPath);
14746
+ const resolved = path33.resolve(csprojPath);
14675
14747
  if (!existsSync36(resolved)) {
14676
14748
  console.error(chalk136.red(`File not found: ${resolved}`));
14677
14749
  process.exit(1);
14678
14750
  }
14679
- const repoRoot = findRepoRoot(path31.dirname(resolved));
14751
+ const repoRoot = findRepoRoot(path33.dirname(resolved));
14680
14752
  if (!repoRoot) {
14681
14753
  console.error(chalk136.red("Could not find git repository root"));
14682
14754
  process.exit(1);
@@ -14698,7 +14770,7 @@ async function deps(csprojPath, options2) {
14698
14770
  }
14699
14771
 
14700
14772
  // src/commands/dotnet/getChangedCsFiles.ts
14701
- import { execSync as execSync35 } from "child_process";
14773
+ import { execSync as execSync36 } from "child_process";
14702
14774
  var SCOPE_ALL = "all";
14703
14775
  var SCOPE_BASE = "base:";
14704
14776
  var SCOPE_COMMIT = "commit:";
@@ -14722,7 +14794,7 @@ function getChangedCsFiles(scope) {
14722
14794
  } else {
14723
14795
  cmd = "git diff --name-only HEAD";
14724
14796
  }
14725
- const output = execSync35(cmd, { encoding: "utf8" }).trim();
14797
+ const output = execSync36(cmd, { encoding: "utf8" }).trim();
14726
14798
  if (output === "") return [];
14727
14799
  return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
14728
14800
  }
@@ -14841,7 +14913,7 @@ function filterIssues(issues, all, cliOnly, cliSuppress) {
14841
14913
 
14842
14914
  // src/commands/dotnet/resolveSolution.ts
14843
14915
  import { existsSync as existsSync37 } from "fs";
14844
- import path32 from "path";
14916
+ import path34 from "path";
14845
14917
  import chalk140 from "chalk";
14846
14918
 
14847
14919
  // src/commands/dotnet/findSolution.ts
@@ -14880,7 +14952,7 @@ function findSolution() {
14880
14952
  // src/commands/dotnet/resolveSolution.ts
14881
14953
  function resolveSolution(sln) {
14882
14954
  if (sln) {
14883
- const resolved = path32.resolve(sln);
14955
+ const resolved = path34.resolve(sln);
14884
14956
  if (!existsSync37(resolved)) {
14885
14957
  console.error(chalk140.red(`Solution file not found: ${resolved}`));
14886
14958
  process.exit(1);
@@ -14920,14 +14992,14 @@ function parseInspectReport(json) {
14920
14992
  }
14921
14993
 
14922
14994
  // src/commands/dotnet/runInspectCode.ts
14923
- import { execSync as execSync36 } from "child_process";
14995
+ import { execSync as execSync37 } from "child_process";
14924
14996
  import { existsSync as existsSync38, readFileSync as readFileSync34, unlinkSync as unlinkSync10 } from "fs";
14925
14997
  import { tmpdir as tmpdir3 } from "os";
14926
- import path33 from "path";
14998
+ import path35 from "path";
14927
14999
  import chalk141 from "chalk";
14928
15000
  function assertJbInstalled() {
14929
15001
  try {
14930
- execSync36("jb inspectcode --version", { stdio: "pipe" });
15002
+ execSync37("jb inspectcode --version", { stdio: "pipe" });
14931
15003
  } catch {
14932
15004
  console.error(chalk141.red("jb is not installed. Install with:"));
14933
15005
  console.error(
@@ -14937,11 +15009,11 @@ function assertJbInstalled() {
14937
15009
  }
14938
15010
  }
14939
15011
  function runInspectCode(slnPath, include, swea) {
14940
- const reportPath = path33.join(tmpdir3(), `inspect-${Date.now()}.xml`);
15012
+ const reportPath = path35.join(tmpdir3(), `inspect-${Date.now()}.xml`);
14941
15013
  const includeFlag = include ? ` --include="${include}"` : "";
14942
15014
  const sweaFlag = swea ? " --swea" : "";
14943
15015
  try {
14944
- execSync36(
15016
+ execSync37(
14945
15017
  `jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
14946
15018
  { stdio: "pipe" }
14947
15019
  );
@@ -14962,7 +15034,7 @@ function runInspectCode(slnPath, include, swea) {
14962
15034
  }
14963
15035
 
14964
15036
  // src/commands/dotnet/runRoslynInspect.ts
14965
- import { execSync as execSync37 } from "child_process";
15037
+ import { execSync as execSync38 } from "child_process";
14966
15038
  import chalk142 from "chalk";
14967
15039
  function resolveMsbuildPath() {
14968
15040
  const { run: run4 } = loadConfig();
@@ -14973,7 +15045,7 @@ function resolveMsbuildPath() {
14973
15045
  function assertMsbuildInstalled() {
14974
15046
  const msbuild = resolveMsbuildPath();
14975
15047
  try {
14976
- execSync37(`"${msbuild}" -version`, { stdio: "pipe" });
15048
+ execSync38(`"${msbuild}" -version`, { stdio: "pipe" });
14977
15049
  } catch {
14978
15050
  console.error(chalk142.red(`msbuild not found at: ${msbuild}`));
14979
15051
  console.error(
@@ -14999,7 +15071,7 @@ function runRoslynInspect(slnPath) {
14999
15071
  const msbuild = resolveMsbuildPath();
15000
15072
  let output;
15001
15073
  try {
15002
- output = execSync37(
15074
+ output = execSync38(
15003
15075
  `"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
15004
15076
  { encoding: "utf8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
15005
15077
  );
@@ -15218,10 +15290,10 @@ function decideCommentGuard(input, existingContent) {
15218
15290
  import { existsSync as existsSync39, unlinkSync as unlinkSync11 } from "fs";
15219
15291
  function consumeMigrationApproval(migrationId) {
15220
15292
  sweepRestrictedDir();
15221
- const path67 = getMigrationApprovalPath(migrationId);
15222
- if (!existsSync39(path67)) return false;
15293
+ const path69 = getMigrationApprovalPath(migrationId);
15294
+ if (!existsSync39(path69)) return false;
15223
15295
  try {
15224
- unlinkSync11(path67);
15296
+ unlinkSync11(path69);
15225
15297
  return true;
15226
15298
  } catch {
15227
15299
  return false;
@@ -15846,7 +15918,7 @@ function acceptanceCriteria(issueKey) {
15846
15918
  }
15847
15919
 
15848
15920
  // src/commands/jira/jiraAuth.ts
15849
- import { execSync as execSync38 } from "child_process";
15921
+ import { execSync as execSync39 } from "child_process";
15850
15922
 
15851
15923
  // src/shared/promptInput.ts
15852
15924
  import Enquirer from "enquirer";
@@ -15881,7 +15953,7 @@ async function jiraAuth() {
15881
15953
  console.error("All fields are required.");
15882
15954
  process.exit(1);
15883
15955
  }
15884
- execSync38(`acli jira auth login --site ${site} --email "${email}" --token`, {
15956
+ execSync39(`acli jira auth login --site ${site} --email "${email}" --token`, {
15885
15957
  encoding: "utf8",
15886
15958
  input: token,
15887
15959
  stdio: ["pipe", "inherit", "inherit"]
@@ -16395,9 +16467,9 @@ function parseRscRows(flight) {
16395
16467
  }
16396
16468
  function makeRscResolver(rows) {
16397
16469
  return (ref) => {
16398
- const [id, ...path67] = ref.slice(1).replace(/^[L@]/, "").split(":");
16470
+ const [id, ...path69] = ref.slice(1).replace(/^[L@]/, "").split(":");
16399
16471
  let v = rows[id];
16400
- for (const key of path67) {
16472
+ for (const key of path69) {
16401
16473
  if (v == null || typeof v !== "object") return void 0;
16402
16474
  v = v[key];
16403
16475
  }
@@ -16966,7 +17038,7 @@ function registerPrompts(program2) {
16966
17038
  }
16967
17039
 
16968
17040
  // src/commands/prs/shared.ts
16969
- import { execSync as execSync39 } from "child_process";
17041
+ import { execSync as execSync40 } from "child_process";
16970
17042
  function isGhNotInstalled(error) {
16971
17043
  if (error instanceof Error) {
16972
17044
  const msg = error.message.toLowerCase();
@@ -16984,12 +17056,12 @@ function getRepoInfo() {
16984
17056
  const preferred = getPreferredRemoteRepo();
16985
17057
  if (preferred) return preferred;
16986
17058
  const repoInfo = JSON.parse(
16987
- execSync39("gh repo view --json owner,name", { encoding: "utf8" })
17059
+ execSync40("gh repo view --json owner,name", { encoding: "utf8" })
16988
17060
  );
16989
17061
  return { org: repoInfo.owner.login, repo: repoInfo.name };
16990
17062
  }
16991
17063
  function getCurrentBranch2() {
16992
- return execSync39("git rev-parse --abbrev-ref HEAD", {
17064
+ return execSync40("git rev-parse --abbrev-ref HEAD", {
16993
17065
  encoding: "utf8"
16994
17066
  }).trim();
16995
17067
  }
@@ -16997,7 +17069,7 @@ function viewCurrentPr(fields) {
16997
17069
  const { org, repo } = getRepoInfo();
16998
17070
  const branch2 = getCurrentBranch2();
16999
17071
  return JSON.parse(
17000
- execSync39(`gh pr view ${branch2} --json ${fields} -R ${org}/${repo}`, {
17072
+ execSync40(`gh pr view ${branch2} --json ${fields} -R ${org}/${repo}`, {
17001
17073
  encoding: "utf8"
17002
17074
  })
17003
17075
  );
@@ -17081,15 +17153,15 @@ function postComment(vars) {
17081
17153
  const stdout = startLine === void 0 ? runGhGraphql(MUTATION_SINGLE, base) : runGhGraphql(MUTATION_MULTI, { ...base, startLine });
17082
17154
  assertThreadCreated(stdout);
17083
17155
  }
17084
- function comment2(path67, line, body, startLine) {
17156
+ function comment2(path69, line, body, startLine) {
17085
17157
  validateBody(body);
17086
17158
  validateLine(line);
17087
17159
  if (startLine !== void 0) validateLine(startLine);
17088
17160
  try {
17089
17161
  const prId = getCurrentPrNodeId();
17090
- postComment({ prId, body, path: path67, line, startLine });
17162
+ postComment({ prId, body, path: path69, line, startLine });
17091
17163
  const range = startLine !== void 0 ? `${startLine}-${line}` : `${line}`;
17092
- console.log(`Added review comment on ${path67}:${range}`);
17164
+ console.log(`Added review comment on ${path69}:${range}`);
17093
17165
  } catch (error) {
17094
17166
  if (isGhNotInstalled(error)) {
17095
17167
  console.error("Error: GitHub CLI (gh) is not installed.");
@@ -17299,10 +17371,10 @@ function edit(options2) {
17299
17371
  }
17300
17372
 
17301
17373
  // src/commands/prs/fixed.ts
17302
- import { execSync as execSync42 } from "child_process";
17374
+ import { execSync as execSync43 } from "child_process";
17303
17375
 
17304
17376
  // src/commands/prs/resolveCommentWithReply.ts
17305
- import { execSync as execSync41 } from "child_process";
17377
+ import { execSync as execSync42 } from "child_process";
17306
17378
  import { unlinkSync as unlinkSync14, writeFileSync as writeFileSync33 } from "fs";
17307
17379
  import { tmpdir as tmpdir5 } from "os";
17308
17380
  import { join as join50 } from "path";
@@ -17331,9 +17403,9 @@ function deleteCommentsCache(prNumber) {
17331
17403
  }
17332
17404
 
17333
17405
  // src/commands/prs/replyToComment.ts
17334
- import { execSync as execSync40 } from "child_process";
17406
+ import { execSync as execSync41 } from "child_process";
17335
17407
  function replyToComment(org, repo, prNumber, commentId, message) {
17336
- execSync40(
17408
+ execSync41(
17337
17409
  `gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, String.raw`\"`)}" -F in_reply_to=${commentId}`,
17338
17410
  { stdio: ["inherit", "pipe", "inherit"] }
17339
17411
  );
@@ -17345,7 +17417,7 @@ function resolveThread(threadId) {
17345
17417
  const queryFile = join50(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
17346
17418
  writeFileSync33(queryFile, mutation);
17347
17419
  try {
17348
- execSync41(
17420
+ execSync42(
17349
17421
  `gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
17350
17422
  { stdio: ["inherit", "pipe", "inherit"] }
17351
17423
  );
@@ -17397,7 +17469,7 @@ function resolveCommentWithReply(commentId, message) {
17397
17469
  // src/commands/prs/fixed.ts
17398
17470
  function verifySha(sha) {
17399
17471
  try {
17400
- return execSync42(`git rev-parse --verify ${sha}`, {
17472
+ return execSync43(`git rev-parse --verify ${sha}`, {
17401
17473
  encoding: "utf8"
17402
17474
  }).trim();
17403
17475
  } catch {
@@ -17411,7 +17483,7 @@ function fixed(commentId, sha) {
17411
17483
  const { org, repo } = getRepoInfo();
17412
17484
  const repoUrl = `https://github.com/${org}/${repo}`;
17413
17485
  const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
17414
- execSync42("git push", { stdio: "inherit" });
17486
+ execSync43("git push", { stdio: "inherit" });
17415
17487
  resolveCommentWithReply(commentId, message);
17416
17488
  } catch (error) {
17417
17489
  if (isGhNotInstalled(error)) {
@@ -17429,7 +17501,7 @@ import { join as join52 } from "path";
17429
17501
  import { stringify } from "yaml";
17430
17502
 
17431
17503
  // src/commands/prs/fetchThreadIds.ts
17432
- import { execSync as execSync43 } from "child_process";
17504
+ import { execSync as execSync44 } from "child_process";
17433
17505
  import { unlinkSync as unlinkSync15, writeFileSync as writeFileSync34 } from "fs";
17434
17506
  import { tmpdir as tmpdir6 } from "os";
17435
17507
  import { join as join51 } from "path";
@@ -17438,7 +17510,7 @@ function fetchThreadIds(org, repo, prNumber) {
17438
17510
  const queryFile = join51(tmpdir6(), `gh-query-${Date.now()}.graphql`);
17439
17511
  writeFileSync34(queryFile, THREAD_QUERY);
17440
17512
  try {
17441
- const result = execSync43(
17513
+ const result = execSync44(
17442
17514
  `gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
17443
17515
  { encoding: "utf8" }
17444
17516
  );
@@ -17460,9 +17532,9 @@ function fetchThreadIds(org, repo, prNumber) {
17460
17532
  }
17461
17533
 
17462
17534
  // src/commands/prs/listComments/fetchReviewComments.ts
17463
- import { execSync as execSync44 } from "child_process";
17535
+ import { execSync as execSync45 } from "child_process";
17464
17536
  function fetchJson(endpoint) {
17465
- const result = execSync44(`gh api --paginate ${endpoint}`, {
17537
+ const result = execSync45(`gh api --paginate ${endpoint}`, {
17466
17538
  encoding: "utf8"
17467
17539
  });
17468
17540
  if (!result.trim()) return [];
@@ -17601,7 +17673,7 @@ async function listComments() {
17601
17673
  }
17602
17674
 
17603
17675
  // src/commands/prs/prs/index.ts
17604
- import { execSync as execSync45 } from "child_process";
17676
+ import { execSync as execSync46 } from "child_process";
17605
17677
 
17606
17678
  // src/commands/prs/prs/displayPaginated/index.ts
17607
17679
  import enquirer9 from "enquirer";
@@ -17708,7 +17780,7 @@ async function prs(options2) {
17708
17780
  const state = options2.open ? "open" : options2.closed ? "closed" : "all";
17709
17781
  try {
17710
17782
  const { org, repo } = getRepoInfo();
17711
- const result = execSync45(
17783
+ const result = execSync46(
17712
17784
  `gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
17713
17785
  { encoding: "utf8" }
17714
17786
  );
@@ -17763,16 +17835,16 @@ function buildCreateArgs(title, body, options2) {
17763
17835
  }
17764
17836
 
17765
17837
  // src/commands/prs/readSessionPrRef.ts
17766
- import { execSync as execSync46 } from "child_process";
17838
+ import { execSync as execSync47 } from "child_process";
17767
17839
  function readSessionPrRef() {
17768
17840
  try {
17769
- const branch2 = execSync46("git rev-parse --abbrev-ref HEAD", {
17841
+ const branch2 = execSync47("git rev-parse --abbrev-ref HEAD", {
17770
17842
  encoding: "utf8",
17771
17843
  stdio: ["pipe", "pipe", "pipe"]
17772
17844
  }).trim();
17773
17845
  if (!branch2 || branch2 === "HEAD") return null;
17774
17846
  const pr = JSON.parse(
17775
- execSync46(`gh pr view ${branch2} --json number,title,url,state`, {
17847
+ execSync47(`gh pr view ${branch2} --json number,title,url,state`, {
17776
17848
  encoding: "utf8",
17777
17849
  stdio: ["pipe", "pipe", "pipe"]
17778
17850
  })
@@ -17850,7 +17922,7 @@ function reply(commentId, body) {
17850
17922
  }
17851
17923
 
17852
17924
  // src/commands/prs/wontfix.ts
17853
- import { execSync as execSync47 } from "child_process";
17925
+ import { execSync as execSync48 } from "child_process";
17854
17926
  function validateReason(reason) {
17855
17927
  const lowerReason = reason.toLowerCase();
17856
17928
  if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
@@ -17867,7 +17939,7 @@ function validateShaReferences(reason) {
17867
17939
  const invalidShas = [];
17868
17940
  for (const sha of shas) {
17869
17941
  try {
17870
- execSync47(`git cat-file -t ${sha}`, { stdio: "pipe" });
17942
+ execSync48(`git cat-file -t ${sha}`, { stdio: "pipe" });
17871
17943
  } catch {
17872
17944
  invalidShas.push(sha);
17873
17945
  }
@@ -17968,8 +18040,8 @@ function registerPrs(program2) {
17968
18040
  prsCommand.command("reply <comment-id> <body>").description("Reply to a comment thread without resolving it").action((commentId, body) => {
17969
18041
  reply(Number.parseInt(commentId, 10), body);
17970
18042
  });
17971
- prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path67, line, body) => {
17972
- comment2(path67, Number.parseInt(line, 10), body);
18043
+ prsCommand.command("comment <path> <line> <body>").description("Add a line comment to the pending review").action((path69, line, body) => {
18044
+ comment2(path69, Number.parseInt(line, 10), body);
17973
18045
  });
17974
18046
  configHelp(prsCommand, prsConfigHelp);
17975
18047
  }
@@ -18044,10 +18116,10 @@ import chalk161 from "chalk";
18044
18116
  import Enquirer2 from "enquirer";
18045
18117
 
18046
18118
  // src/commands/ravendb/searchItems.ts
18047
- import { execSync as execSync48 } from "child_process";
18119
+ import { execSync as execSync49 } from "child_process";
18048
18120
  import chalk160 from "chalk";
18049
18121
  function opExec(args) {
18050
- return execSync48(`op ${args}`, {
18122
+ return execSync49(`op ${args}`, {
18051
18123
  encoding: "utf8",
18052
18124
  stdio: ["pipe", "pipe", "pipe"]
18053
18125
  }).trim();
@@ -18199,7 +18271,7 @@ ${errorText}`
18199
18271
  }
18200
18272
 
18201
18273
  // src/commands/ravendb/resolveOpSecret.ts
18202
- import { execSync as execSync49 } from "child_process";
18274
+ import { execSync as execSync50 } from "child_process";
18203
18275
  import chalk165 from "chalk";
18204
18276
  function resolveOpSecret(reference) {
18205
18277
  if (!reference.startsWith("op://")) {
@@ -18207,7 +18279,7 @@ function resolveOpSecret(reference) {
18207
18279
  process.exit(1);
18208
18280
  }
18209
18281
  try {
18210
- return execSync49(`op read "${reference}"`, {
18282
+ return execSync50(`op read "${reference}"`, {
18211
18283
  encoding: "utf8",
18212
18284
  stdio: ["pipe", "pipe", "pipe"]
18213
18285
  }).trim();
@@ -18222,10 +18294,10 @@ function resolveOpSecret(reference) {
18222
18294
  }
18223
18295
 
18224
18296
  // src/commands/ravendb/ravenFetch.ts
18225
- async function ravenFetch(connection, path67) {
18297
+ async function ravenFetch(connection, path69) {
18226
18298
  const apiKey = resolveOpSecret(connection.apiKeyRef);
18227
18299
  let accessToken = await getAccessToken(apiKey);
18228
- const url = `${connection.url}${path67}`;
18300
+ const url = `${connection.url}${path69}`;
18229
18301
  const headers = {
18230
18302
  Authorization: `Bearer ${accessToken}`,
18231
18303
  "Content-Type": "application/json"
@@ -18329,16 +18401,16 @@ import chalk169 from "chalk";
18329
18401
  // src/commands/ravendb/buildQueryPath.ts
18330
18402
  function buildQueryPath(opts) {
18331
18403
  const db = encodeURIComponent(opts.db);
18332
- let path67;
18404
+ let path69;
18333
18405
  if (opts.collection) {
18334
- path67 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
18406
+ path69 = `/databases/${db}/indexes/dynamic/${encodeURIComponent(opts.collection)}?start=${opts.start}&pageSize=${opts.pageSize}&sort=${encodeURIComponent(opts.sort)}`;
18335
18407
  } else {
18336
- path67 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
18408
+ path69 = `/databases/${db}/queries?start=${opts.start}&pageSize=${opts.pageSize}`;
18337
18409
  }
18338
18410
  if (opts.query) {
18339
- path67 += `&query=${encodeURIComponent(opts.query)}`;
18411
+ path69 += `&query=${encodeURIComponent(opts.query)}`;
18340
18412
  }
18341
- return path67;
18413
+ return path69;
18342
18414
  }
18343
18415
 
18344
18416
  // src/commands/ravendb/fetchAllPages.ts
@@ -18347,7 +18419,7 @@ async function fetchAllPages(connection, opts) {
18347
18419
  let start3 = 0;
18348
18420
  while (true) {
18349
18421
  const effectivePageSize = opts.limit !== void 0 ? Math.min(opts.pageSize, opts.limit - allResults.length) : opts.pageSize;
18350
- const path67 = buildQueryPath({
18422
+ const path69 = buildQueryPath({
18351
18423
  db: connection.database,
18352
18424
  collection: opts.collection,
18353
18425
  start: start3,
@@ -18355,7 +18427,7 @@ async function fetchAllPages(connection, opts) {
18355
18427
  sort: opts.sort,
18356
18428
  query: opts.query
18357
18429
  });
18358
- const data = await ravenFetch(connection, path67);
18430
+ const data = await ravenFetch(connection, path69);
18359
18431
  const results = data.Results ?? [];
18360
18432
  const totalResults = data.TotalResults ?? 0;
18361
18433
  if (results.length === 0) break;
@@ -18413,7 +18485,7 @@ function registerRavendb(program2) {
18413
18485
 
18414
18486
  // src/commands/refactor/check/index.ts
18415
18487
  import { spawn as spawn5 } from "child_process";
18416
- import * as path34 from "path";
18488
+ import * as path36 from "path";
18417
18489
 
18418
18490
  // src/commands/refactor/logViolations.ts
18419
18491
  import chalk171 from "chalk";
@@ -18471,7 +18543,7 @@ Refactor check failed:
18471
18543
  }
18472
18544
 
18473
18545
  // src/commands/refactor/check/getViolations/index.ts
18474
- import { execSync as execSync50 } from "child_process";
18546
+ import { execSync as execSync51 } from "child_process";
18475
18547
  import fs25 from "fs";
18476
18548
  import { minimatch as minimatch6 } from "minimatch";
18477
18549
 
@@ -18521,7 +18593,7 @@ function getGitFiles(options2) {
18521
18593
  }
18522
18594
  const files = /* @__PURE__ */ new Set();
18523
18595
  if (options2.staged || options2.modified) {
18524
- const staged = execSync50("git diff --cached --name-only", {
18596
+ const staged = execSync51("git diff --cached --name-only", {
18525
18597
  encoding: "utf8"
18526
18598
  });
18527
18599
  for (const file of staged.trim().split("\n").filter(Boolean)) {
@@ -18529,7 +18601,7 @@ function getGitFiles(options2) {
18529
18601
  }
18530
18602
  }
18531
18603
  if (options2.unstaged || options2.modified) {
18532
- const unstaged = execSync50("git diff --name-only", { encoding: "utf8" });
18604
+ const unstaged = execSync51("git diff --name-only", { encoding: "utf8" });
18533
18605
  for (const file of unstaged.trim().split("\n").filter(Boolean)) {
18534
18606
  files.add(file);
18535
18607
  }
@@ -18590,7 +18662,7 @@ ${failed2.length} verify script(s) failed:`);
18590
18662
  async function runVerifyQuietly() {
18591
18663
  const result = findPackageJsonWithVerifyScripts(process.cwd());
18592
18664
  if (!result) return true;
18593
- const packageDir = path34.dirname(result.packageJsonPath);
18665
+ const packageDir = path36.dirname(result.packageJsonPath);
18594
18666
  const results = await Promise.all(
18595
18667
  result.verifyScripts.map((script) => runScript(script, packageDir))
18596
18668
  );
@@ -18616,7 +18688,7 @@ async function check(pattern2, options2) {
18616
18688
  }
18617
18689
 
18618
18690
  // src/commands/refactor/extract/index.ts
18619
- import path41 from "path";
18691
+ import path43 from "path";
18620
18692
  import chalk174 from "chalk";
18621
18693
 
18622
18694
  // src/commands/refactor/extract/applyExtraction.ts
@@ -19093,9 +19165,9 @@ function buildDestinationContent(functionTexts, imports, sourceRelativePath, sou
19093
19165
  }
19094
19166
 
19095
19167
  // src/commands/refactor/extract/getRelativeImportPath.ts
19096
- import path35 from "path";
19168
+ import path37 from "path";
19097
19169
  function getRelativeImportPath(from, to) {
19098
- let rel = path35.relative(path35.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
19170
+ let rel = path37.relative(path37.dirname(from), to).replace(/\.tsx?$/, "").replace(/\\/g, "/");
19099
19171
  if (!rel.startsWith(".")) rel = `./${rel}`;
19100
19172
  return rel;
19101
19173
  }
@@ -19119,9 +19191,9 @@ function findImporters(functionName, sourceFile, destPath, project) {
19119
19191
  }
19120
19192
 
19121
19193
  // src/commands/refactor/extract/resolveBarrel.ts
19122
- import path36 from "path";
19194
+ import path38 from "path";
19123
19195
  function resolveBarrel(functionName, sourcePath, destPath, project) {
19124
- const indexPath = path36.join(path36.dirname(destPath), "index.ts");
19196
+ const indexPath = path38.join(path38.dirname(destPath), "index.ts");
19125
19197
  const barrel = project.getSourceFile(indexPath);
19126
19198
  if (!barrel) return { barrel: void 0, barrelRelPath: "" };
19127
19199
  const sourceRelFromBarrel = getRelativeImportPath(indexPath, sourcePath);
@@ -19139,15 +19211,15 @@ function resolveBarrel(functionName, sourcePath, destPath, project) {
19139
19211
  }
19140
19212
 
19141
19213
  // src/commands/refactor/extract/rewriteImportPaths.ts
19142
- import path37 from "path";
19214
+ import path39 from "path";
19143
19215
  function rewriteImportPaths(imports, sourcePath, destPath) {
19144
- const sourceDir = path37.dirname(sourcePath);
19145
- const destDir = path37.dirname(destPath);
19216
+ const sourceDir = path39.dirname(sourcePath);
19217
+ const destDir = path39.dirname(destPath);
19146
19218
  return imports.map((imp) => {
19147
19219
  if (!imp.moduleSpecifier.startsWith(".")) return imp;
19148
- const absolute = path37.resolve(sourceDir, imp.moduleSpecifier);
19149
- let rel = path37.relative(destDir, absolute).replace(/\\/g, "/");
19150
- if (rel === "") rel = `../${path37.basename(absolute)}`;
19220
+ const absolute = path39.resolve(sourceDir, imp.moduleSpecifier);
19221
+ let rel = path39.relative(destDir, absolute).replace(/\\/g, "/");
19222
+ if (rel === "") rel = `../${path39.basename(absolute)}`;
19151
19223
  else if (!rel.startsWith(".")) rel = `./${rel}`;
19152
19224
  return { ...imp, moduleSpecifier: rel };
19153
19225
  });
@@ -19215,7 +19287,7 @@ function buildPlan2(functionName, sourceFile, sourcePath, destPath, project) {
19215
19287
  }
19216
19288
 
19217
19289
  // src/commands/refactor/extract/displayPlan.ts
19218
- import path38 from "path";
19290
+ import path40 from "path";
19219
19291
  import chalk172 from "chalk";
19220
19292
  function section2(title) {
19221
19293
  return `
@@ -19225,7 +19297,7 @@ function displayImporters(plan2, cwd) {
19225
19297
  if (plan2.importersToUpdate.length === 0) return;
19226
19298
  console.log(section2("Update importers:"));
19227
19299
  for (const imp of plan2.importersToUpdate) {
19228
- const rel = path38.relative(cwd, imp.file.getFilePath());
19300
+ const rel = path40.relative(cwd, imp.file.getFilePath());
19229
19301
  console.log(` ${chalk172.dim(rel)}: \u2192 import from "${imp.relPath}"`);
19230
19302
  }
19231
19303
  }
@@ -19265,16 +19337,16 @@ function displayPlan(functionName, relDest, plan2, cwd) {
19265
19337
  }
19266
19338
 
19267
19339
  // src/commands/refactor/extract/loadProjectFile.ts
19268
- import path40 from "path";
19340
+ import path42 from "path";
19269
19341
  import chalk173 from "chalk";
19270
19342
  import { Project as Project4 } from "ts-morph";
19271
19343
 
19272
19344
  // src/commands/refactor/extract/findTsConfig.ts
19273
19345
  import fs26 from "fs";
19274
- import path39 from "path";
19346
+ import path41 from "path";
19275
19347
  import { Project as Project3 } from "ts-morph";
19276
19348
  function findTsConfig(sourcePath) {
19277
- const rootConfig = path39.resolve("tsconfig.json");
19349
+ const rootConfig = path41.resolve("tsconfig.json");
19278
19350
  if (!fs26.existsSync(rootConfig)) return rootConfig;
19279
19351
  const tried = /* @__PURE__ */ new Set();
19280
19352
  const candidates = [rootConfig, ...readReferences(rootConfig)];
@@ -19283,7 +19355,7 @@ function findTsConfig(sourcePath) {
19283
19355
  tried.add(candidate);
19284
19356
  if (projectIncludes(candidate, sourcePath)) return candidate;
19285
19357
  }
19286
- const siblings = fs26.readdirSync(path39.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path39.resolve(path39.dirname(rootConfig), f));
19358
+ const siblings = fs26.readdirSync(path41.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path41.resolve(path41.dirname(rootConfig), f));
19287
19359
  for (const sibling of siblings) {
19288
19360
  if (tried.has(sibling)) continue;
19289
19361
  tried.add(sibling);
@@ -19302,10 +19374,10 @@ function readReferences(configPath) {
19302
19374
  return [];
19303
19375
  }
19304
19376
  if (!parsed.references?.length) return [];
19305
- const cwd = path39.dirname(configPath);
19377
+ const cwd = path41.dirname(configPath);
19306
19378
  return parsed.references.map((ref) => {
19307
- const refPath = path39.resolve(cwd, ref.path);
19308
- return fs26.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path39.join(refPath, "tsconfig.json") : refPath;
19379
+ const refPath = path41.resolve(cwd, ref.path);
19380
+ return fs26.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path41.join(refPath, "tsconfig.json") : refPath;
19309
19381
  }).filter((p) => fs26.existsSync(p));
19310
19382
  }
19311
19383
  function projectIncludes(configPath, sourcePath) {
@@ -19319,7 +19391,7 @@ function projectIncludes(configPath, sourcePath) {
19319
19391
 
19320
19392
  // src/commands/refactor/extract/loadProjectFile.ts
19321
19393
  function loadProjectFile(file) {
19322
- const sourcePath = path40.resolve(file);
19394
+ const sourcePath = path42.resolve(file);
19323
19395
  const tsConfigPath = findTsConfig(sourcePath);
19324
19396
  const project = new Project4({
19325
19397
  tsConfigFilePath: tsConfigPath
@@ -19334,10 +19406,10 @@ function loadProjectFile(file) {
19334
19406
 
19335
19407
  // src/commands/refactor/extract/index.ts
19336
19408
  async function extract(file, functionName, destination, options2 = {}) {
19337
- const sourcePath = path41.resolve(file);
19338
- const destPath = path41.resolve(destination);
19409
+ const sourcePath = path43.resolve(file);
19410
+ const destPath = path43.resolve(destination);
19339
19411
  const cwd = process.cwd();
19340
- const relDest = path41.relative(cwd, destPath);
19412
+ const relDest = path43.relative(cwd, destPath);
19341
19413
  const { project, sourceFile } = loadProjectFile(file);
19342
19414
  const plan2 = buildPlan2(
19343
19415
  functionName,
@@ -19385,16 +19457,16 @@ function ignore2(file) {
19385
19457
 
19386
19458
  // src/commands/refactor/rename/index.ts
19387
19459
  import fs30 from "fs";
19388
- import path46 from "path";
19460
+ import path48 from "path";
19389
19461
  import chalk178 from "chalk";
19390
19462
 
19391
19463
  // src/commands/refactor/rename/applyRename.ts
19392
19464
  import fs29 from "fs";
19393
- import path43 from "path";
19465
+ import path45 from "path";
19394
19466
  import chalk176 from "chalk";
19395
19467
 
19396
19468
  // src/commands/refactor/restructure/computeRewrites/index.ts
19397
- import path42 from "path";
19469
+ import path44 from "path";
19398
19470
 
19399
19471
  // src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
19400
19472
  import fs28 from "fs";
@@ -19448,7 +19520,7 @@ function normalizeSpecifier(rel) {
19448
19520
  );
19449
19521
  }
19450
19522
  function computeSpecifier(fromFile, toFile) {
19451
- return normalizeSpecifier(path42.relative(path42.dirname(fromFile), toFile));
19523
+ return normalizeSpecifier(path44.relative(path44.dirname(fromFile), toFile));
19452
19524
  }
19453
19525
  function isAffected(edge, moveMap) {
19454
19526
  return moveMap.has(edge.target) || moveMap.has(edge.source);
@@ -19496,20 +19568,20 @@ function applyRename(rewrites, sourcePath, destPath, cwd) {
19496
19568
  const updatedContents = applyRewrites(rewrites);
19497
19569
  for (const [file, content] of updatedContents) {
19498
19570
  fs29.writeFileSync(file, content, "utf8");
19499
- console.log(chalk176.cyan(` Updated imports in ${path43.relative(cwd, file)}`));
19571
+ console.log(chalk176.cyan(` Updated imports in ${path45.relative(cwd, file)}`));
19500
19572
  }
19501
- const destDir = path43.dirname(destPath);
19573
+ const destDir = path45.dirname(destPath);
19502
19574
  if (!fs29.existsSync(destDir)) fs29.mkdirSync(destDir, { recursive: true });
19503
19575
  fs29.renameSync(sourcePath, destPath);
19504
19576
  console.log(
19505
19577
  chalk176.white(
19506
- ` Moved ${path43.relative(cwd, sourcePath)} \u2192 ${path43.relative(cwd, destPath)}`
19578
+ ` Moved ${path45.relative(cwd, sourcePath)} \u2192 ${path45.relative(cwd, destPath)}`
19507
19579
  )
19508
19580
  );
19509
19581
  }
19510
19582
 
19511
19583
  // src/commands/refactor/restructure/buildImportGraph/index.ts
19512
- import path44 from "path";
19584
+ import path46 from "path";
19513
19585
  import ts7 from "typescript";
19514
19586
 
19515
19587
  // src/commands/refactor/restructure/buildImportGraph/getImportSpecifiers.ts
@@ -19536,7 +19608,7 @@ function loadParsedConfig(tsConfigPath) {
19536
19608
  return ts7.parseJsonConfigFileContent(
19537
19609
  configFile.config,
19538
19610
  ts7.sys,
19539
- path44.dirname(tsConfigPath)
19611
+ path46.dirname(tsConfigPath)
19540
19612
  );
19541
19613
  }
19542
19614
  function addToSetMap(map, key, value) {
@@ -19552,7 +19624,7 @@ function resolveImport(specifier, filePath, options2) {
19552
19624
  const resolved = ts7.resolveModuleName(specifier, filePath, options2, ts7.sys);
19553
19625
  const resolvedPath = resolved.resolvedModule?.resolvedFileName;
19554
19626
  if (!resolvedPath || resolvedPath.includes("node_modules")) return null;
19555
- return path44.resolve(resolvedPath);
19627
+ return path46.resolve(resolvedPath);
19556
19628
  }
19557
19629
  function buildImportGraph(candidateFiles, tsConfigPath) {
19558
19630
  const parsed = loadParsedConfig(tsConfigPath);
@@ -19561,7 +19633,7 @@ function buildImportGraph(candidateFiles, tsConfigPath) {
19561
19633
  const importedBy = /* @__PURE__ */ new Map();
19562
19634
  const imports = /* @__PURE__ */ new Map();
19563
19635
  for (const sourceFile of program2.getSourceFiles()) {
19564
- const filePath = path44.resolve(sourceFile.fileName);
19636
+ const filePath = path46.resolve(sourceFile.fileName);
19565
19637
  if (filePath.includes("node_modules")) continue;
19566
19638
  for (const specifier of getImportSpecifiers(sourceFile)) {
19567
19639
  const absTarget = resolveImport(specifier, filePath, parsed.options);
@@ -19588,13 +19660,13 @@ function computeRenameRewrites(sourcePath, destPath) {
19588
19660
  }
19589
19661
 
19590
19662
  // src/commands/refactor/rename/printRenamePreview.ts
19591
- import path45 from "path";
19663
+ import path47 from "path";
19592
19664
  import chalk177 from "chalk";
19593
19665
  function printRenamePreview(rewrites, cwd) {
19594
19666
  for (const rewrite of rewrites) {
19595
19667
  console.log(
19596
19668
  chalk177.dim(
19597
- ` ${path45.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
19669
+ ` ${path47.relative(cwd, rewrite.file)}: ${rewrite.oldSpecifier} \u2192 ${rewrite.newSpecifier}`
19598
19670
  )
19599
19671
  );
19600
19672
  }
@@ -19603,11 +19675,11 @@ function printRenamePreview(rewrites, cwd) {
19603
19675
 
19604
19676
  // src/commands/refactor/rename/index.ts
19605
19677
  async function rename(source, destination, options2 = {}) {
19606
- const sourcePath = path46.resolve(source);
19607
- const destPath = path46.resolve(destination);
19678
+ const sourcePath = path48.resolve(source);
19679
+ const destPath = path48.resolve(destination);
19608
19680
  const cwd = process.cwd();
19609
- const relSource = path46.relative(cwd, sourcePath);
19610
- const relDest = path46.relative(cwd, destPath);
19681
+ const relSource = path48.relative(cwd, sourcePath);
19682
+ const relDest = path48.relative(cwd, destPath);
19611
19683
  if (!fs30.existsSync(sourcePath)) {
19612
19684
  console.log(chalk178.red(`File not found: ${source}`));
19613
19685
  process.exit(1);
@@ -19662,12 +19734,12 @@ function findSymbol(sourceFile, symbolName) {
19662
19734
  }
19663
19735
 
19664
19736
  // src/commands/refactor/renameSymbol/groupReferences.ts
19665
- import path47 from "path";
19737
+ import path49 from "path";
19666
19738
  function groupReferences(symbol, cwd) {
19667
19739
  const refs = symbol.findReferencesAsNodes();
19668
19740
  const grouped = /* @__PURE__ */ new Map();
19669
19741
  for (const ref of refs) {
19670
- const refFile = path47.relative(cwd, ref.getSourceFile().getFilePath());
19742
+ const refFile = path49.relative(cwd, ref.getSourceFile().getFilePath());
19671
19743
  const lines = grouped.get(refFile) ?? [];
19672
19744
  if (!grouped.has(refFile)) grouped.set(refFile, lines);
19673
19745
  lines.push(ref.getStartLineNumber());
@@ -19706,16 +19778,16 @@ Renamed ${oldName} \u2192 ${newName}`));
19706
19778
  }
19707
19779
 
19708
19780
  // src/commands/refactor/restructure/index.ts
19709
- import path54 from "path";
19781
+ import path56 from "path";
19710
19782
  import chalk182 from "chalk";
19711
19783
 
19712
19784
  // src/commands/refactor/restructure/clusterDirectories.ts
19713
- import path48 from "path";
19785
+ import path50 from "path";
19714
19786
  function clusterDirectories(graph) {
19715
19787
  const dirImportedBy = /* @__PURE__ */ new Map();
19716
19788
  for (const edge of graph.edges) {
19717
- const sourceDir = path48.dirname(edge.source);
19718
- const targetDir = path48.dirname(edge.target);
19789
+ const sourceDir = path50.dirname(edge.source);
19790
+ const targetDir = path50.dirname(edge.target);
19719
19791
  if (sourceDir === targetDir) continue;
19720
19792
  if (!graph.files.has(edge.target)) continue;
19721
19793
  const existing = dirImportedBy.get(targetDir) ?? /* @__PURE__ */ new Set();
@@ -19743,20 +19815,20 @@ function clusterDirectories(graph) {
19743
19815
  return clusters;
19744
19816
  }
19745
19817
  function isAncestor(ancestor, descendant) {
19746
- const rel = path48.relative(ancestor, descendant);
19818
+ const rel = path50.relative(ancestor, descendant);
19747
19819
  return !rel.startsWith("..") && rel !== "";
19748
19820
  }
19749
19821
 
19750
19822
  // src/commands/refactor/restructure/clusterFiles.ts
19751
- import path49 from "path";
19823
+ import path51 from "path";
19752
19824
  function findRootParent(file, importedBy, visited) {
19753
19825
  const importers = importedBy.get(file);
19754
19826
  if (!importers || importers.size !== 1) return file;
19755
19827
  const parent = [...importers][0];
19756
- const parentDir = path49.dirname(parent);
19757
- const fileDir = path49.dirname(file);
19828
+ const parentDir = path51.dirname(parent);
19829
+ const fileDir = path51.dirname(file);
19758
19830
  if (parentDir !== fileDir) return file;
19759
- if (path49.basename(parent, path49.extname(parent)) === "index") return file;
19831
+ if (path51.basename(parent, path51.extname(parent)) === "index") return file;
19760
19832
  if (visited.has(parent)) return file;
19761
19833
  visited.add(parent);
19762
19834
  return findRootParent(parent, importedBy, visited);
@@ -19764,16 +19836,16 @@ function findRootParent(file, importedBy, visited) {
19764
19836
  function clusterFiles(graph) {
19765
19837
  const clusters = /* @__PURE__ */ new Map();
19766
19838
  for (const file of graph.files) {
19767
- const basename14 = path49.basename(file, path49.extname(file));
19839
+ const basename14 = path51.basename(file, path51.extname(file));
19768
19840
  if (basename14 === "index") continue;
19769
19841
  const importers = graph.importedBy.get(file);
19770
19842
  if (!importers || importers.size !== 1) continue;
19771
19843
  const parent = [...importers][0];
19772
19844
  if (!graph.files.has(parent)) continue;
19773
- const parentDir = path49.dirname(parent);
19774
- const fileDir = path49.dirname(file);
19845
+ const parentDir = path51.dirname(parent);
19846
+ const fileDir = path51.dirname(file);
19775
19847
  if (parentDir !== fileDir) continue;
19776
- const parentBasename = path49.basename(parent, path49.extname(parent));
19848
+ const parentBasename = path51.basename(parent, path51.extname(parent));
19777
19849
  if (parentBasename === "index") continue;
19778
19850
  const root = findRootParent(parent, graph.importedBy, /* @__PURE__ */ new Set([file]));
19779
19851
  if (!root || root === file) continue;
@@ -19785,10 +19857,10 @@ function clusterFiles(graph) {
19785
19857
  }
19786
19858
 
19787
19859
  // src/commands/refactor/restructure/displayPlan.ts
19788
- import path50 from "path";
19860
+ import path52 from "path";
19789
19861
  import chalk180 from "chalk";
19790
19862
  function relPath(filePath) {
19791
- return path50.relative(process.cwd(), filePath);
19863
+ return path52.relative(process.cwd(), filePath);
19792
19864
  }
19793
19865
  function displayMoves(plan2) {
19794
19866
  if (plan2.moves.length === 0) return;
@@ -19838,33 +19910,33 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
19838
19910
 
19839
19911
  // src/commands/refactor/restructure/executePlan.ts
19840
19912
  import fs31 from "fs";
19841
- import path51 from "path";
19913
+ import path53 from "path";
19842
19914
  import chalk181 from "chalk";
19843
19915
  function executePlan(plan2) {
19844
19916
  const updatedContents = applyRewrites(plan2.rewrites);
19845
19917
  for (const [file, content] of updatedContents) {
19846
19918
  fs31.writeFileSync(file, content, "utf8");
19847
19919
  console.log(
19848
- chalk181.cyan(` Rewrote imports in ${path51.relative(process.cwd(), file)}`)
19920
+ chalk181.cyan(` Rewrote imports in ${path53.relative(process.cwd(), file)}`)
19849
19921
  );
19850
19922
  }
19851
19923
  for (const dir of plan2.newDirectories) {
19852
19924
  fs31.mkdirSync(dir, { recursive: true });
19853
- console.log(chalk181.green(` Created ${path51.relative(process.cwd(), dir)}/`));
19925
+ console.log(chalk181.green(` Created ${path53.relative(process.cwd(), dir)}/`));
19854
19926
  }
19855
19927
  for (const move2 of plan2.moves) {
19856
- const targetDir = path51.dirname(move2.to);
19928
+ const targetDir = path53.dirname(move2.to);
19857
19929
  if (!fs31.existsSync(targetDir)) {
19858
19930
  fs31.mkdirSync(targetDir, { recursive: true });
19859
19931
  }
19860
19932
  fs31.renameSync(move2.from, move2.to);
19861
19933
  console.log(
19862
19934
  chalk181.white(
19863
- ` Moved ${path51.relative(process.cwd(), move2.from)} \u2192 ${path51.relative(process.cwd(), move2.to)}`
19935
+ ` Moved ${path53.relative(process.cwd(), move2.from)} \u2192 ${path53.relative(process.cwd(), move2.to)}`
19864
19936
  )
19865
19937
  );
19866
19938
  }
19867
- removeEmptyDirectories(plan2.moves.map((m) => path51.dirname(m.from)));
19939
+ removeEmptyDirectories(plan2.moves.map((m) => path53.dirname(m.from)));
19868
19940
  }
19869
19941
  function removeEmptyDirectories(dirs) {
19870
19942
  const unique = [...new Set(dirs)];
@@ -19875,7 +19947,7 @@ function removeEmptyDirectories(dirs) {
19875
19947
  fs31.rmdirSync(dir);
19876
19948
  console.log(
19877
19949
  chalk181.dim(
19878
- ` Removed empty directory ${path51.relative(process.cwd(), dir)}`
19950
+ ` Removed empty directory ${path53.relative(process.cwd(), dir)}`
19879
19951
  )
19880
19952
  );
19881
19953
  }
@@ -19883,7 +19955,7 @@ function removeEmptyDirectories(dirs) {
19883
19955
  }
19884
19956
 
19885
19957
  // src/commands/refactor/restructure/planFileMoves/index.ts
19886
- import path53 from "path";
19958
+ import path55 from "path";
19887
19959
 
19888
19960
  // src/commands/refactor/restructure/planFileMoves/shared.ts
19889
19961
  import fs32 from "fs";
@@ -19898,9 +19970,9 @@ function checkDirConflict(result, label2, dir) {
19898
19970
 
19899
19971
  // src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
19900
19972
  import fs33 from "fs";
19901
- import path52 from "path";
19973
+ import path54 from "path";
19902
19974
  function collectEntry(results, dir, entry) {
19903
- const full = path52.join(dir, entry.name);
19975
+ const full = path54.join(dir, entry.name);
19904
19976
  const items2 = entry.isDirectory() ? listFilesRecursive(full) : [full];
19905
19977
  results.push(...items2);
19906
19978
  }
@@ -19914,15 +19986,15 @@ function listFilesRecursive(dir) {
19914
19986
  }
19915
19987
  function addDirectoryFileMoves(moves, childDir, newLocation, reason) {
19916
19988
  for (const file of listFilesRecursive(childDir)) {
19917
- const rel = path52.relative(childDir, file);
19918
- moves.push({ from: file, to: path52.join(newLocation, rel), reason });
19989
+ const rel = path54.relative(childDir, file);
19990
+ moves.push({ from: file, to: path54.join(newLocation, rel), reason });
19919
19991
  }
19920
19992
  }
19921
19993
  function resolveChildDest(parentDir, childDir) {
19922
- return path52.join(parentDir, path52.basename(childDir));
19994
+ return path54.join(parentDir, path54.basename(childDir));
19923
19995
  }
19924
19996
  function childMoveReason(parentDir) {
19925
- return `Directory only imported from ${path52.basename(parentDir)}/`;
19997
+ return `Directory only imported from ${path54.basename(parentDir)}/`;
19926
19998
  }
19927
19999
  function registerDirectoryMove(result, childDir, dest, parentDir) {
19928
20000
  result.directories.push(dest);
@@ -19947,7 +20019,7 @@ function planDirectoryMoves(clusters) {
19947
20019
 
19948
20020
  // src/commands/refactor/restructure/planFileMoves/index.ts
19949
20021
  function childMoveData(child, newDir, parentBase) {
19950
- const to = path53.join(newDir, path53.basename(child));
20022
+ const to = path55.join(newDir, path55.basename(child));
19951
20023
  return { from: child, to, reason: `Only imported by ${parentBase}` };
19952
20024
  }
19953
20025
  function addChildMoves(moves, children, newDir, parentBase) {
@@ -19955,15 +20027,15 @@ function addChildMoves(moves, children, newDir, parentBase) {
19955
20027
  moves.push(childMoveData(child, newDir, parentBase));
19956
20028
  }
19957
20029
  function getBaseName(filePath) {
19958
- return path53.basename(filePath, path53.extname(filePath));
20030
+ return path55.basename(filePath, path55.extname(filePath));
19959
20031
  }
19960
20032
  function resolveClusterDir(parent) {
19961
- return path53.join(path53.dirname(parent), getBaseName(parent));
20033
+ return path55.join(path55.dirname(parent), getBaseName(parent));
19962
20034
  }
19963
20035
  function createParentMove(parent, newDir) {
19964
20036
  return {
19965
20037
  from: parent,
19966
- to: path53.join(newDir, `index${path53.extname(parent)}`),
20038
+ to: path55.join(newDir, `index${path55.extname(parent)}`),
19967
20039
  reason: `Main module of new ${getBaseName(parent)}/ directory`
19968
20040
  };
19969
20041
  }
@@ -19987,7 +20059,7 @@ function planFileMoves(clusters) {
19987
20059
 
19988
20060
  // src/commands/refactor/restructure/index.ts
19989
20061
  function buildPlan3(candidateFiles, tsConfigPath) {
19990
- const candidates = new Set(candidateFiles.map((f) => path54.resolve(f)));
20062
+ const candidates = new Set(candidateFiles.map((f) => path56.resolve(f)));
19991
20063
  const graph = buildImportGraph(candidates, tsConfigPath);
19992
20064
  const allProjectFiles = /* @__PURE__ */ new Set([
19993
20065
  ...graph.importedBy.keys(),
@@ -20010,7 +20082,7 @@ async function restructure(pattern2, options2 = {}) {
20010
20082
  console.log(chalk182.yellow("No files found matching pattern"));
20011
20083
  return;
20012
20084
  }
20013
- const tsConfigPath = path54.resolve("tsconfig.json");
20085
+ const tsConfigPath = path56.resolve("tsconfig.json");
20014
20086
  const plan2 = buildPlan3(files, tsConfigPath);
20015
20087
  if (plan2.moves.length === 0) {
20016
20088
  console.log(chalk182.green("No restructuring needed"));
@@ -20207,9 +20279,9 @@ function buildReviewPaths(repoRoot, key) {
20207
20279
  }
20208
20280
 
20209
20281
  // src/commands/review/fetchExistingComments.ts
20210
- import { execSync as execSync51 } from "child_process";
20282
+ import { execSync as execSync52 } from "child_process";
20211
20283
  function fetchRawComments(org, repo, prNumber) {
20212
- const out = execSync51(
20284
+ const out = execSync52(
20213
20285
  `gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
20214
20286
  { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 }
20215
20287
  );
@@ -20240,14 +20312,14 @@ function fetchExistingComments() {
20240
20312
  }
20241
20313
 
20242
20314
  // src/commands/review/gatherContext.ts
20243
- import { execSync as execSync54 } from "child_process";
20315
+ import { execSync as execSync55 } from "child_process";
20244
20316
 
20245
20317
  // src/commands/review/fetchPrDiff.ts
20246
- import { execSync as execSync52 } from "child_process";
20318
+ import { execSync as execSync53 } from "child_process";
20247
20319
  function fetchPrDiff(prNumber, baseSha, headSha) {
20248
20320
  const { org, repo } = getRepoInfo();
20249
20321
  try {
20250
- return execSync52(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
20322
+ return execSync53(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
20251
20323
  encoding: "utf8",
20252
20324
  maxBuffer: 256 * 1024 * 1024,
20253
20325
  stdio: ["ignore", "pipe", "pipe"]
@@ -20262,19 +20334,19 @@ function isDiffTooLarge(error) {
20262
20334
  }
20263
20335
  function fetchDiffViaGit(baseSha, headSha) {
20264
20336
  try {
20265
- execSync52(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
20337
+ execSync53(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
20266
20338
  } catch {
20267
20339
  }
20268
- return execSync52(`git diff ${baseSha}...${headSha}`, {
20340
+ return execSync53(`git diff ${baseSha}...${headSha}`, {
20269
20341
  encoding: "utf8",
20270
20342
  maxBuffer: 256 * 1024 * 1024
20271
20343
  });
20272
20344
  }
20273
20345
 
20274
20346
  // src/commands/review/fetchPrDiffInfo.ts
20275
- import { execSync as execSync53 } from "child_process";
20347
+ import { execSync as execSync54 } from "child_process";
20276
20348
  function getCurrentBranch3() {
20277
- return execSync53("git rev-parse --abbrev-ref HEAD", {
20349
+ return execSync54("git rev-parse --abbrev-ref HEAD", {
20278
20350
  encoding: "utf8"
20279
20351
  }).trim();
20280
20352
  }
@@ -20282,7 +20354,7 @@ function fetchPrDiffInfo() {
20282
20354
  const { org, repo } = getRepoInfo();
20283
20355
  const branch2 = getCurrentBranch3();
20284
20356
  const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
20285
- const raw = execSync53(
20357
+ const raw = execSync54(
20286
20358
  `gh pr list --state open --head ${branch2} --json ${fields} -R ${org}/${repo}`,
20287
20359
  {
20288
20360
  encoding: "utf8",
@@ -20307,7 +20379,7 @@ function fetchPrDiffInfo() {
20307
20379
  }
20308
20380
  function fetchPrChangedFiles(prNumber) {
20309
20381
  const { org, repo } = getRepoInfo();
20310
- const out = execSync53(
20382
+ const out = execSync54(
20311
20383
  `gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
20312
20384
  {
20313
20385
  encoding: "utf8",
@@ -20319,11 +20391,11 @@ function fetchPrChangedFiles(prNumber) {
20319
20391
 
20320
20392
  // src/commands/review/gatherContext.ts
20321
20393
  function gatherContext() {
20322
- const branch2 = execSync54("git rev-parse --abbrev-ref HEAD", {
20394
+ const branch2 = execSync55("git rev-parse --abbrev-ref HEAD", {
20323
20395
  encoding: "utf8"
20324
20396
  }).trim();
20325
- const sha = execSync54("git rev-parse HEAD", { encoding: "utf8" }).trim();
20326
- const shortSha = execSync54("git rev-parse --short=7 HEAD", {
20397
+ const sha = execSync55("git rev-parse HEAD", { encoding: "utf8" }).trim();
20398
+ const shortSha = execSync55("git rev-parse --short=7 HEAD", {
20327
20399
  encoding: "utf8"
20328
20400
  }).trim();
20329
20401
  const prInfo = fetchPrDiffInfo();
@@ -20743,8 +20815,8 @@ async function handlePostSynthesis(synthesisPath, options2) {
20743
20815
  // src/commands/review/prepareReviewDir.ts
20744
20816
  import { existsSync as existsSync43, mkdirSync as mkdirSync18, unlinkSync as unlinkSync16, writeFileSync as writeFileSync36 } from "fs";
20745
20817
  function clearReviewFiles(paths) {
20746
- for (const path67 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
20747
- if (existsSync43(path67)) unlinkSync16(path67);
20818
+ for (const path69 of [paths.claudePath, paths.codexPath, paths.synthesisPath]) {
20819
+ if (existsSync43(path69)) unlinkSync16(path69);
20748
20820
  }
20749
20821
  }
20750
20822
  function prepareReviewDir(paths, requestBody, force) {
@@ -21892,8 +21964,8 @@ import chalk190 from "chalk";
21892
21964
 
21893
21965
  // src/commands/seq/fetchSeq.ts
21894
21966
  import chalk187 from "chalk";
21895
- async function fetchSeq(conn, path67, params) {
21896
- const url = `${conn.url}${path67}?${params}`;
21967
+ async function fetchSeq(conn, path69, params) {
21968
+ const url = `${conn.url}${path69}?${params}`;
21897
21969
  const response = await fetch(url, {
21898
21970
  headers: {
21899
21971
  Accept: "application/json",
@@ -22973,7 +23045,7 @@ import { mkdirSync as mkdirSync21 } from "fs";
22973
23045
  import { join as join59 } from "path";
22974
23046
 
22975
23047
  // src/commands/voice/checkLockFile.ts
22976
- import { execSync as execSync55 } from "child_process";
23048
+ import { execSync as execSync56 } from "child_process";
22977
23049
  import { existsSync as existsSync49, mkdirSync as mkdirSync20, readFileSync as readFileSync43, writeFileSync as writeFileSync39 } from "fs";
22978
23050
  import { join as join58 } from "path";
22979
23051
  function isProcessAlive2(pid) {
@@ -23002,7 +23074,7 @@ function bootstrapVenv() {
23002
23074
  if (existsSync49(getVenvPython())) return;
23003
23075
  console.log("Setting up Python environment...");
23004
23076
  const pythonDir = getPythonDir();
23005
- execSync55(
23077
+ execSync56(
23006
23078
  `uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
23007
23079
  {
23008
23080
  stdio: "inherit",
@@ -23380,9 +23452,9 @@ function findPortFile(roamDir) {
23380
23452
  return void 0;
23381
23453
  }
23382
23454
  const candidates = entries.filter((name) => /^roam-local-api(-[^.]+)?\.port$/.test(name)).map((name) => {
23383
- const path67 = join61(roamDir, name);
23455
+ const path69 = join61(roamDir, name);
23384
23456
  try {
23385
- return { path: path67, mtimeMs: statSync8(path67).mtimeMs };
23457
+ return { path: path69, mtimeMs: statSync8(path69).mtimeMs };
23386
23458
  } catch {
23387
23459
  return void 0;
23388
23460
  }
@@ -23598,11 +23670,11 @@ function resolveParams(params, cliArgs) {
23598
23670
  }
23599
23671
 
23600
23672
  // src/commands/run/runPreCommands.ts
23601
- import { execSync as execSync56 } from "child_process";
23673
+ import { execSync as execSync57 } from "child_process";
23602
23674
  function runPreCommands(pre, cwd) {
23603
23675
  for (const cmd of pre) {
23604
23676
  try {
23605
- execSync56(cmd, { stdio: "inherit", cwd });
23677
+ execSync57(cmd, { stdio: "inherit", cwd });
23606
23678
  } catch (error) {
23607
23679
  const code = error && typeof error === "object" && "status" in error ? error.status : 1;
23608
23680
  process.exit(code);
@@ -23801,11 +23873,11 @@ function findLinkIndex() {
23801
23873
  function parseLinkArgs() {
23802
23874
  const idx = findLinkIndex();
23803
23875
  if (idx === -1) return null;
23804
- const path67 = process.argv[idx + 1];
23876
+ const path69 = process.argv[idx + 1];
23805
23877
  const rest = process.argv.slice(idx + 2);
23806
23878
  const { value: prefix2 } = extractOption(rest, "--prefix");
23807
23879
  if (!prefix2) return null;
23808
- return { path: path67, prefix: prefix2 };
23880
+ return { path: path69, prefix: prefix2 };
23809
23881
  }
23810
23882
  function hasDuplicateLink(runList, linkPath) {
23811
23883
  return runList.some(
@@ -23903,7 +23975,7 @@ function registerRun(program2) {
23903
23975
  }
23904
23976
 
23905
23977
  // src/commands/screenshot/index.ts
23906
- import { execSync as execSync57 } from "child_process";
23978
+ import { execSync as execSync58 } from "child_process";
23907
23979
  import { existsSync as existsSync54, mkdirSync as mkdirSync24, unlinkSync as unlinkSync21, writeFileSync as writeFileSync42 } from "fs";
23908
23980
  import { tmpdir as tmpdir7 } from "os";
23909
23981
  import { join as join65, resolve as resolve15 } from "path";
@@ -24046,7 +24118,7 @@ function runPowerShellScript(processName, outputPath) {
24046
24118
  const scriptPath = join65(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
24047
24119
  writeFileSync42(scriptPath, captureWindowPs1, "utf8");
24048
24120
  try {
24049
- execSync57(
24121
+ execSync58(
24050
24122
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
24051
24123
  { stdio: ["ignore", "pipe", "pipe"], encoding: "utf8" }
24052
24124
  );
@@ -24454,12 +24526,12 @@ function activeWindows(rateLimits) {
24454
24526
 
24455
24527
  // src/shared/db/recordUsagePeak.ts
24456
24528
  var WINDOWS2 = ["five_hour", "seven_day"];
24457
- async function recordUsagePeak(db, rateLimits) {
24529
+ async function recordUsagePeak(db, rateLimits, now = Math.floor(Date.now() / 1e3)) {
24458
24530
  for (const window of WINDOWS2) {
24459
24531
  const w = rateLimits[window];
24460
24532
  if (!w || typeof w.resets_at !== "number" || typeof w.used_percentage !== "number")
24461
24533
  continue;
24462
- await recordWindowPeak(db, window, w.resets_at, w.used_percentage);
24534
+ await recordWindowPeak(db, window, w.resets_at, w.used_percentage, now);
24463
24535
  }
24464
24536
  }
24465
24537
 
@@ -24521,14 +24593,14 @@ import * as pty from "node-pty";
24521
24593
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
24522
24594
  import { chmodSync, existsSync as existsSync55, statSync as statSync9 } from "fs";
24523
24595
  import { createRequire as createRequire3 } from "module";
24524
- import path55 from "path";
24596
+ import path57 from "path";
24525
24597
  var require4 = createRequire3(import.meta.url);
24526
24598
  var ensured = false;
24527
24599
  function ensureSpawnHelperExecutable() {
24528
24600
  if (ensured || process.platform !== "darwin") return;
24529
24601
  ensured = true;
24530
- const ptyRoot = path55.join(path55.dirname(require4.resolve("node-pty")), "..");
24531
- const helper = path55.join(
24602
+ const ptyRoot = path57.join(path57.dirname(require4.resolve("node-pty")), "..");
24603
+ const helper = path57.join(
24532
24604
  ptyRoot,
24533
24605
  "prebuilds",
24534
24606
  `${process.platform}-${process.arch}`,
@@ -24590,12 +24662,12 @@ import { randomUUID as randomUUID4 } from "crypto";
24590
24662
 
24591
24663
  // src/commands/sessions/daemon/readDesignSystemPrompt.ts
24592
24664
  import * as fs34 from "fs";
24593
- import * as path56 from "path";
24665
+ import * as path58 from "path";
24594
24666
  import { fileURLToPath as fileURLToPath8 } from "url";
24595
24667
  var __filename4 = fileURLToPath8(import.meta.url);
24596
- var __dirname6 = path56.dirname(__filename4);
24668
+ var __dirname6 = path58.dirname(__filename4);
24597
24669
  function readDesignSystemPrompt() {
24598
- const promptPath = path56.join(__dirname6, "..", "claude", "system-prompt.md");
24670
+ const promptPath = path58.join(__dirname6, "..", "claude", "system-prompt.md");
24599
24671
  return fs34.readFileSync(promptPath, "utf8");
24600
24672
  }
24601
24673
 
@@ -25132,8 +25204,8 @@ async function seedRunningMsFromUsage(session, notify2) {
25132
25204
  var DEBOUNCE_MS = 50;
25133
25205
  function watchActivity(session, notify2) {
25134
25206
  if (session.commandType !== "assist" || !session.cwd) return;
25135
- const path67 = activityPath(session.id);
25136
- const dir = dirname29(path67);
25207
+ const path69 = activityPath(session.id);
25208
+ const dir = dirname29(path69);
25137
25209
  try {
25138
25210
  mkdirSync25(dir, { recursive: true });
25139
25211
  } catch {
@@ -25143,7 +25215,7 @@ function watchActivity(session, notify2) {
25143
25215
  let timer = null;
25144
25216
  const read = () => {
25145
25217
  timer = null;
25146
- const activity2 = readActivity(path67);
25218
+ const activity2 = readActivity(path69);
25147
25219
  if (!activity2) return;
25148
25220
  session.activity = activity2;
25149
25221
  if (activity2.claudeSessionId)
@@ -25153,11 +25225,11 @@ function watchActivity(session, notify2) {
25153
25225
  notify2();
25154
25226
  };
25155
25227
  session.activityWatcher = watch(dir, (_event, filename) => {
25156
- if (filename && !path67.endsWith(filename)) return;
25228
+ if (filename && !path69.endsWith(filename)) return;
25157
25229
  if (timer) clearTimeout(timer);
25158
25230
  timer = setTimeout(read, DEBOUNCE_MS);
25159
25231
  });
25160
- if (existsSync56(path67)) read();
25232
+ if (existsSync56(path69)) read();
25161
25233
  }
25162
25234
  function refreshActivity(session) {
25163
25235
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -27209,16 +27281,16 @@ async function statusLine() {
27209
27281
  // src/commands/sync.ts
27210
27282
  import * as fs45 from "fs";
27211
27283
  import * as os4 from "os";
27212
- import * as path65 from "path";
27284
+ import * as path67 from "path";
27213
27285
  import { fileURLToPath as fileURLToPath9 } from "url";
27214
27286
 
27215
27287
  // src/commands/sync/syncClaudeMd.ts
27216
27288
  import * as fs39 from "fs";
27217
- import * as path57 from "path";
27289
+ import * as path59 from "path";
27218
27290
  import chalk202 from "chalk";
27219
27291
  async function syncClaudeMd(claudeDir, targetBase, options2) {
27220
- const source = path57.join(claudeDir, "CLAUDE.md");
27221
- const target = path57.join(targetBase, "CLAUDE.md");
27292
+ const source = path59.join(claudeDir, "CLAUDE.md");
27293
+ const target = path59.join(targetBase, "CLAUDE.md");
27222
27294
  const sourceContent = fs39.readFileSync(source, "utf8");
27223
27295
  if (fs39.existsSync(target)) {
27224
27296
  const targetContent = fs39.readFileSync(target, "utf8");
@@ -27243,33 +27315,33 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
27243
27315
  }
27244
27316
 
27245
27317
  // src/commands/sync/syncCodex.ts
27246
- import * as path60 from "path";
27318
+ import * as path62 from "path";
27247
27319
 
27248
27320
  // src/commands/sync/installHarnessCommands.ts
27249
27321
  import * as fs40 from "fs";
27250
- import * as path58 from "path";
27322
+ import * as path60 from "path";
27251
27323
  function installHarnessCommands(claudeDir, harness, transform) {
27252
- const commandsSource = path58.join(claudeDir, "commands");
27324
+ const commandsSource = path60.join(claudeDir, "commands");
27253
27325
  const files = fs40.readdirSync(commandsSource);
27254
27326
  let synced = 0;
27255
27327
  for (const file of files) {
27256
27328
  if (!file.endsWith(".md")) continue;
27257
27329
  const name = file.replace(/\.md$/, "");
27258
- const content = fs40.readFileSync(path58.join(commandsSource, file), "utf8");
27259
- const target = path58.join(harness.homeDir, harness.sync.commandDest(name));
27260
- fs40.mkdirSync(path58.dirname(target), { recursive: true });
27330
+ const content = fs40.readFileSync(path60.join(commandsSource, file), "utf8");
27331
+ const target = path60.join(harness.homeDir, harness.sync.commandDest(name));
27332
+ fs40.mkdirSync(path60.dirname(target), { recursive: true });
27261
27333
  fs40.writeFileSync(target, transform(name, content));
27262
27334
  synced++;
27263
27335
  }
27264
- const agentsTarget = path58.join(harness.homeDir, harness.sync.agentsFile);
27265
- fs40.mkdirSync(path58.dirname(agentsTarget), { recursive: true });
27266
- fs40.copyFileSync(path58.join(claudeDir, "CLAUDE.md"), agentsTarget);
27336
+ const agentsTarget = path60.join(harness.homeDir, harness.sync.agentsFile);
27337
+ fs40.mkdirSync(path60.dirname(agentsTarget), { recursive: true });
27338
+ fs40.copyFileSync(path60.join(claudeDir, "CLAUDE.md"), agentsTarget);
27267
27339
  return { total: files.length, synced };
27268
27340
  }
27269
27341
 
27270
27342
  // src/commands/sync/syncCodexHooks.ts
27271
27343
  import * as fs41 from "fs";
27272
- import * as path59 from "path";
27344
+ import * as path61 from "path";
27273
27345
  var BEGIN = "# >>> assist codex hooks (managed) \u2014 do not edit >>>";
27274
27346
  var END = "# <<< assist codex hooks (managed) <<<";
27275
27347
  function upsertManagedBlock(existing, body) {
@@ -27300,9 +27372,9 @@ ${rest}
27300
27372
  }
27301
27373
  function syncCodexHooks(sourcePath) {
27302
27374
  const body = fs41.readFileSync(sourcePath, "utf8");
27303
- const configPath = path59.join(harnesses.codex.homeDir, "config.toml");
27375
+ const configPath = path61.join(harnesses.codex.homeDir, "config.toml");
27304
27376
  const existing = fs41.existsSync(configPath) ? fs41.readFileSync(configPath, "utf8") : "";
27305
- fs41.mkdirSync(path59.dirname(configPath), { recursive: true });
27377
+ fs41.mkdirSync(path61.dirname(configPath), { recursive: true });
27306
27378
  fs41.writeFileSync(configPath, upsertManagedBlock(existing, body));
27307
27379
  console.log(
27308
27380
  "Registered assist codex-hook in ~/.codex/config.toml (PreToolUse, PermissionRequest)"
@@ -27334,7 +27406,7 @@ function syncCodex(claudeDir) {
27334
27406
  harnesses.codex,
27335
27407
  commandToSkill
27336
27408
  );
27337
- syncCodexHooks(path60.join(claudeDir, "..", "codex", "config.toml"));
27409
+ syncCodexHooks(path62.join(claudeDir, "..", "codex", "config.toml"));
27338
27410
  console.log(
27339
27411
  `Synced ${total} skill(s) to ~/.codex/skills and CLAUDE.md to ~/.codex/AGENTS.md`
27340
27412
  );
@@ -27342,33 +27414,33 @@ function syncCodex(claudeDir) {
27342
27414
 
27343
27415
  // src/commands/sync/syncDesign.ts
27344
27416
  import * as fs42 from "fs";
27345
- import * as path61 from "path";
27417
+ import * as path63 from "path";
27346
27418
  function syncDesign(claudeDir, targetBase) {
27347
- const systemPromptSource = path61.join(claudeDir, "system-prompt.md");
27348
- const systemPromptTarget = path61.join(targetBase, "system-prompt.md");
27419
+ const systemPromptSource = path63.join(claudeDir, "system-prompt.md");
27420
+ const systemPromptTarget = path63.join(targetBase, "system-prompt.md");
27349
27421
  fs42.copyFileSync(systemPromptSource, systemPromptTarget);
27350
27422
  console.log("Copied system-prompt.md to ~/.claude/system-prompt.md");
27351
- const skillsSource = path61.join(claudeDir, "skills");
27352
- const skillsTarget = path61.join(targetBase, "skills");
27423
+ const skillsSource = path63.join(claudeDir, "skills");
27424
+ const skillsTarget = path63.join(targetBase, "skills");
27353
27425
  fs42.mkdirSync(skillsTarget, { recursive: true });
27354
27426
  const files = fs42.readdirSync(skillsSource);
27355
27427
  for (const file of files) {
27356
27428
  fs42.copyFileSync(
27357
- path61.join(skillsSource, file),
27358
- path61.join(skillsTarget, file)
27429
+ path63.join(skillsSource, file),
27430
+ path63.join(skillsTarget, file)
27359
27431
  );
27360
27432
  }
27361
27433
  console.log(`Synced ${files.length} design skill(s) to ~/.claude/skills`);
27362
27434
  }
27363
27435
 
27364
27436
  // src/commands/sync/syncPi.ts
27365
- import * as path63 from "path";
27437
+ import * as path65 from "path";
27366
27438
 
27367
27439
  // src/commands/sync/syncPiHooks.ts
27368
27440
  import * as fs43 from "fs";
27369
- import * as path62 from "path";
27441
+ import * as path64 from "path";
27370
27442
  function piExtensionsDir() {
27371
- return path62.join(harnesses.pi.homeDir, "extensions");
27443
+ return path64.join(harnesses.pi.homeDir, "extensions");
27372
27444
  }
27373
27445
  function syncPiHooks(sourceDir) {
27374
27446
  const target = piExtensionsDir();
@@ -27376,8 +27448,8 @@ function syncPiHooks(sourceDir) {
27376
27448
  const files = fs43.readdirSync(sourceDir).filter((f) => f.endsWith(".ts"));
27377
27449
  for (const file of files) {
27378
27450
  fs43.copyFileSync(
27379
- path62.join(sourceDir, file),
27380
- path62.join(target, `assist-${file}`)
27451
+ path64.join(sourceDir, file),
27452
+ path64.join(target, `assist-${file}`)
27381
27453
  );
27382
27454
  }
27383
27455
  console.log(
@@ -27414,7 +27486,7 @@ function syncPi(claudeDir) {
27414
27486
  harnesses.pi,
27415
27487
  commandToPrompt
27416
27488
  );
27417
- syncPiHooks(path63.join(claudeDir, "..", "pi"));
27489
+ syncPiHooks(path65.join(claudeDir, "..", "pi"));
27418
27490
  console.log(
27419
27491
  `Synced ${synced} prompt(s) to ~/.pi/agent/prompts and CLAUDE.md to ~/.pi/agent/AGENTS.md`
27420
27492
  );
@@ -27422,11 +27494,11 @@ function syncPi(claudeDir) {
27422
27494
 
27423
27495
  // src/commands/sync/syncSettings.ts
27424
27496
  import * as fs44 from "fs";
27425
- import * as path64 from "path";
27497
+ import * as path66 from "path";
27426
27498
  import chalk203 from "chalk";
27427
27499
  async function syncSettings(claudeDir, targetBase, options2) {
27428
- const source = path64.join(claudeDir, "settings.json");
27429
- const target = path64.join(targetBase, "settings.json");
27500
+ const source = path66.join(claudeDir, "settings.json");
27501
+ const target = path66.join(targetBase, "settings.json");
27430
27502
  const sourceContent = fs44.readFileSync(source, "utf8");
27431
27503
  const sourceSettings = JSON.parse(sourceContent);
27432
27504
  const targetExists = fs44.existsSync(target);
@@ -27465,12 +27537,12 @@ async function syncSettings(claudeDir, targetBase, options2) {
27465
27537
 
27466
27538
  // src/commands/sync.ts
27467
27539
  var __filename5 = fileURLToPath9(import.meta.url);
27468
- var __dirname7 = path65.dirname(__filename5);
27540
+ var __dirname7 = path67.dirname(__filename5);
27469
27541
  async function sync(options2) {
27470
27542
  const config = loadConfig();
27471
27543
  const yes = options2?.yes ?? config.sync.autoConfirm;
27472
- const claudeDir = path65.join(__dirname7, "..", "claude");
27473
- const targetBase = path65.join(os4.homedir(), ".claude");
27544
+ const claudeDir = path67.join(__dirname7, "..", "claude");
27545
+ const targetBase = path67.join(os4.homedir(), ".claude");
27474
27546
  syncCommands(claudeDir, targetBase);
27475
27547
  syncDesign(claudeDir, targetBase);
27476
27548
  await syncSettings(claudeDir, targetBase, { yes });
@@ -27479,20 +27551,20 @@ async function sync(options2) {
27479
27551
  syncPi(claudeDir);
27480
27552
  }
27481
27553
  function syncCommands(claudeDir, targetBase) {
27482
- const sourceDir = path65.join(claudeDir, "commands");
27483
- const targetDir = path65.join(targetBase, "commands");
27554
+ const sourceDir = path67.join(claudeDir, "commands");
27555
+ const targetDir = path67.join(targetBase, "commands");
27484
27556
  fs45.mkdirSync(targetDir, { recursive: true });
27485
27557
  const files = fs45.readdirSync(sourceDir);
27486
27558
  for (const file of files) {
27487
- fs45.copyFileSync(path65.join(sourceDir, file), path65.join(targetDir, file));
27559
+ fs45.copyFileSync(path67.join(sourceDir, file), path67.join(targetDir, file));
27488
27560
  console.log(`Copied ${file} to ${targetDir}`);
27489
27561
  }
27490
27562
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
27491
27563
  }
27492
27564
 
27493
27565
  // src/commands/update.ts
27494
- import { execSync as execSync58 } from "child_process";
27495
- import * as path66 from "path";
27566
+ import { execSync as execSync59 } from "child_process";
27567
+ import * as path68 from "path";
27496
27568
 
27497
27569
  // src/commands/restartDaemonAfterUpdate.ts
27498
27570
  async function restartDaemonAfterUpdate() {
@@ -27511,12 +27583,12 @@ async function restartDaemonAfterUpdate() {
27511
27583
  // src/commands/update.ts
27512
27584
  function isGlobalNpmInstall(dir) {
27513
27585
  try {
27514
- const resolved = path66.resolve(dir);
27515
- if (resolved.split(path66.sep).includes("node_modules")) {
27586
+ const resolved = path68.resolve(dir);
27587
+ if (resolved.split(path68.sep).includes("node_modules")) {
27516
27588
  return true;
27517
27589
  }
27518
- const globalPrefix = execSync58("npm prefix -g", { stdio: "pipe" }).toString().trim();
27519
- return resolved.toLowerCase().startsWith(path66.resolve(globalPrefix).toLowerCase());
27590
+ const globalPrefix = execSync59("npm prefix -g", { stdio: "pipe" }).toString().trim();
27591
+ return resolved.toLowerCase().startsWith(path68.resolve(globalPrefix).toLowerCase());
27520
27592
  } catch {
27521
27593
  return false;
27522
27594
  }
@@ -27526,18 +27598,18 @@ async function update2() {
27526
27598
  console.log(`Assist is installed at: ${installDir}`);
27527
27599
  if (isGitRepo(installDir)) {
27528
27600
  console.log("Detected git repo installation, pulling latest...");
27529
- execSync58("git pull", { cwd: installDir, stdio: "inherit" });
27601
+ execSync59("git pull", { cwd: installDir, stdio: "inherit" });
27530
27602
  console.log("Installing dependencies...");
27531
- execSync58("npm i", { cwd: installDir, stdio: "inherit" });
27603
+ execSync59("npm i", { cwd: installDir, stdio: "inherit" });
27532
27604
  console.log("Building...");
27533
- execSync58("npm run build", { cwd: installDir, stdio: "inherit" });
27605
+ execSync59("npm run build", { cwd: installDir, stdio: "inherit" });
27534
27606
  console.log("Syncing commands...");
27535
- execSync58("assist sync", { stdio: "inherit" });
27607
+ execSync59("assist sync", { stdio: "inherit" });
27536
27608
  } else if (isGlobalNpmInstall(installDir)) {
27537
27609
  console.log("Detected global npm installation, updating...");
27538
- execSync58("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
27610
+ execSync59("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
27539
27611
  console.log("Syncing commands...");
27540
- execSync58("assist sync", { stdio: "inherit" });
27612
+ execSync59("assist sync", { stdio: "inherit" });
27541
27613
  } else {
27542
27614
  console.error(
27543
27615
  "Could not determine installation method. Expected a git repo or global npm install."