@staff0rd/assist 0.262.0 → 0.263.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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +359 -211
  3. package/package.json +1 -1
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.262.0",
9
+ version: "0.263.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -204,6 +204,10 @@ var assistConfigSchema = z2.strictObject({
204
204
  hardcodedColors: z2.strictObject({
205
205
  ignore: z2.array(z2.string()).default([])
206
206
  }).optional(),
207
+ commentPolicy: z2.strictObject({
208
+ ignore: z2.array(z2.string()).default([]),
209
+ markers: z2.array(z2.string()).default(["HACK:", "why:"])
210
+ }).optional(),
207
211
  restructure: z2.strictObject({
208
212
  ignore: z2.array(z2.string()).default([])
209
213
  }).optional(),
@@ -1815,24 +1819,166 @@ function lint(options2 = {}) {
1815
1819
  }
1816
1820
 
1817
1821
  // src/commands/new/registerNew/newCli/index.ts
1818
- import { execSync as execSync11 } from "child_process";
1822
+ import { execSync as execSync12 } from "child_process";
1819
1823
  import { basename, resolve as resolve5 } from "path";
1820
1824
 
1821
- // src/commands/verify/hardcodedColors.ts
1825
+ // src/commands/verify/commentPolicy/findAddedComments.ts
1822
1826
  import { execSync as execSync6 } from "child_process";
1827
+ import fs10 from "fs";
1823
1828
  import { minimatch } from "minimatch";
1829
+ import { Project as Project2 } from "ts-morph";
1830
+
1831
+ // src/commands/verify/commentPolicy/collectComments.ts
1832
+ function collectComments(sourceFile) {
1833
+ const seen = /* @__PURE__ */ new Set();
1834
+ const comments3 = [];
1835
+ const collect3 = (node) => {
1836
+ for (const range of [
1837
+ ...node.getLeadingCommentRanges(),
1838
+ ...node.getTrailingCommentRanges()
1839
+ ]) {
1840
+ const pos = range.getPos();
1841
+ if (seen.has(pos)) continue;
1842
+ seen.add(pos);
1843
+ comments3.push({ pos, text: range.getText() });
1844
+ }
1845
+ };
1846
+ collect3(sourceFile);
1847
+ sourceFile.forEachDescendant(collect3);
1848
+ return comments3;
1849
+ }
1850
+
1851
+ // src/commands/verify/commentPolicy/isCommentExempt.ts
1852
+ var MACHINE_DIRECTIVES = [
1853
+ "biome-ignore",
1854
+ "@ts-expect-error",
1855
+ "@ts-ignore",
1856
+ "@ts-nocheck",
1857
+ "eslint-disable",
1858
+ "eslint-enable",
1859
+ "prettier-ignore",
1860
+ "istanbul ignore",
1861
+ "v8 ignore",
1862
+ "c8 ignore"
1863
+ ];
1864
+ function isCommentExempt(text2, markers) {
1865
+ const lower = text2.toLowerCase();
1866
+ if (MACHINE_DIRECTIVES.some((d) => lower.includes(d))) return true;
1867
+ return markers.some((m) => lower.includes(m.toLowerCase()));
1868
+ }
1869
+
1870
+ // src/commands/verify/commentPolicy/parseDiffAddedLines.ts
1871
+ var FILE_HEADER = /^\+\+\+ (?:b\/)?(.+)$/;
1872
+ var HUNK_HEADER = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
1873
+ function parseDiffAddedLines(diff2) {
1874
+ const added = /* @__PURE__ */ new Map();
1875
+ let currentFile = null;
1876
+ let newLine = 0;
1877
+ for (const line of diff2.split("\n")) {
1878
+ const fileMatch = line.match(FILE_HEADER);
1879
+ if (fileMatch) {
1880
+ const file = fileMatch[1];
1881
+ currentFile = file === "/dev/null" ? null : file;
1882
+ continue;
1883
+ }
1884
+ const hunkMatch = line.match(HUNK_HEADER);
1885
+ if (hunkMatch) {
1886
+ newLine = Number(hunkMatch[1]);
1887
+ continue;
1888
+ }
1889
+ if (currentFile === null) continue;
1890
+ if (line.startsWith("+")) {
1891
+ let set = added.get(currentFile);
1892
+ if (!set) {
1893
+ set = /* @__PURE__ */ new Set();
1894
+ added.set(currentFile, set);
1895
+ }
1896
+ set.add(newLine);
1897
+ newLine++;
1898
+ } else if (line.startsWith("-")) {
1899
+ } else {
1900
+ newLine++;
1901
+ }
1902
+ }
1903
+ return added;
1904
+ }
1905
+
1906
+ // src/commands/verify/commentPolicy/findAddedComments.ts
1907
+ var SOURCE_EXTENSIONS = [".ts", ".tsx", ".cts", ".mts", ".js", ".jsx"];
1908
+ function toSingleLine(text2) {
1909
+ return text2.replace(/\s+/g, " ").trim();
1910
+ }
1911
+ function shouldScan(file, ignoreGlobs) {
1912
+ if (!SOURCE_EXTENSIONS.some((ext) => file.endsWith(ext))) return false;
1913
+ if (ignoreGlobs.some((glob) => minimatch(file, glob))) return false;
1914
+ return fs10.existsSync(file);
1915
+ }
1916
+ function findAddedComments(options2) {
1917
+ const diff2 = execSync6("git diff HEAD", {
1918
+ encoding: "utf-8",
1919
+ maxBuffer: 64 * 1024 * 1024
1920
+ });
1921
+ const addedLines = parseDiffAddedLines(diff2);
1922
+ const project = new Project2({
1923
+ skipAddingFilesFromTsConfig: true,
1924
+ compilerOptions: { allowJs: true }
1925
+ });
1926
+ const findings = [];
1927
+ for (const [file, lines] of addedLines) {
1928
+ if (!shouldScan(file, options2.ignoreGlobs)) continue;
1929
+ const sourceFile = project.addSourceFileAtPath(file);
1930
+ for (const { pos, text: text2 } of collectComments(sourceFile)) {
1931
+ const { line } = sourceFile.getLineAndColumnAtPos(pos);
1932
+ if (!lines.has(line)) continue;
1933
+ if (isCommentExempt(text2, options2.markers)) continue;
1934
+ findings.push({ file, line, text: toSingleLine(text2) });
1935
+ }
1936
+ }
1937
+ findings.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line);
1938
+ return findings;
1939
+ }
1940
+
1941
+ // src/commands/verify/commentPolicy/index.ts
1942
+ var DEFAULT_MARKERS = ["HACK:", "why:"];
1943
+ function commentPolicy() {
1944
+ const config = loadConfig().commentPolicy;
1945
+ const markers = config?.markers ?? DEFAULT_MARKERS;
1946
+ const ignoreGlobs = config?.ignore ?? [];
1947
+ const findings = findAddedComments({ markers, ignoreGlobs });
1948
+ if (findings.length === 0) {
1949
+ console.log("No undocumented comments on changed lines.");
1950
+ process.exit(0);
1951
+ }
1952
+ console.log("Comments added on changed lines:\n");
1953
+ for (const { file, line, text: text2 } of findings) {
1954
+ console.log(`${file}:${line} \u2192 ${text2}`);
1955
+ }
1956
+ console.log(`
1957
+ Total: ${findings.length} comment(s)`);
1958
+ console.log(
1959
+ "\nDon't comment standard logic or syntax \u2014 only unintuitive complexity or a hack."
1960
+ );
1961
+ console.log(
1962
+ `Remove each comment, or justify it inline with a ${markers.map((m) => `'${m}'`).join(" or ")} marker.`
1963
+ );
1964
+ process.exit(1);
1965
+ }
1966
+
1967
+ // src/commands/verify/hardcodedColors.ts
1968
+ import { execSync as execSync7 } from "child_process";
1969
+ import { minimatch as minimatch2 } from "minimatch";
1824
1970
  var pattern = "0x[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,6}";
1825
1971
  function hardcodedColors() {
1826
1972
  const ignoreGlobs = loadConfig().hardcodedColors?.ignore ?? [];
1827
1973
  try {
1828
- const output = execSync6(`grep -rEnH '${pattern}' src/`, {
1974
+ const output = execSync7(`grep -rEnH '${pattern}' src/`, {
1829
1975
  encoding: "utf-8"
1830
1976
  });
1831
1977
  const lines = output.trim().split("\n").filter((line) => {
1832
1978
  const match = line.match(/^(.+?):\d+:/);
1833
1979
  if (!match) return true;
1834
1980
  const file = match[1];
1835
- return !ignoreGlobs.some((glob) => minimatch(file, glob));
1981
+ return !ignoreGlobs.some((glob) => minimatch2(file, glob));
1836
1982
  });
1837
1983
  if (lines.length === 0) {
1838
1984
  console.log("No hardcoded colors found.");
@@ -2001,10 +2147,10 @@ function list() {
2001
2147
  }
2002
2148
 
2003
2149
  // src/commands/verify/noVenv.ts
2004
- import { execSync as execSync7 } from "child_process";
2150
+ import { execSync as execSync8 } from "child_process";
2005
2151
  function noVenv() {
2006
2152
  try {
2007
- const output = execSync7(
2153
+ const output = execSync8(
2008
2154
  "find . -type d -name venv -not -path '*/node_modules/*'",
2009
2155
  {
2010
2156
  encoding: "utf-8"
@@ -2033,12 +2179,12 @@ Total: ${folders.length} venv folder(s)`);
2033
2179
  }
2034
2180
 
2035
2181
  // src/commands/verify/run/filterByChangedFiles.ts
2036
- import { minimatch as minimatch2 } from "minimatch";
2182
+ import { minimatch as minimatch3 } from "minimatch";
2037
2183
 
2038
2184
  // src/commands/verify/run/getChangedFiles.ts
2039
- import { execSync as execSync8 } from "child_process";
2185
+ import { execSync as execSync9 } from "child_process";
2040
2186
  function getChangedFiles() {
2041
- const output = execSync8("git diff --name-only HEAD", {
2187
+ const output = execSync9("git diff --name-only HEAD", {
2042
2188
  encoding: "utf-8"
2043
2189
  }).trim();
2044
2190
  if (output === "") return [];
@@ -2054,7 +2200,7 @@ function filterByChangedFiles(entries) {
2054
2200
  const { filter } = entry;
2055
2201
  if (!filter) return true;
2056
2202
  if (changedFiles.length === 0) return false;
2057
- return changedFiles.some((file) => minimatch2(file, filter));
2203
+ return changedFiles.some((file) => minimatch3(file, filter));
2058
2204
  });
2059
2205
  }
2060
2206
 
@@ -2209,25 +2355,25 @@ async function run(options2 = {}) {
2209
2355
  }
2210
2356
 
2211
2357
  // src/commands/new/registerNew/initGit.ts
2212
- import { execSync as execSync9 } from "child_process";
2358
+ import { execSync as execSync10 } from "child_process";
2213
2359
  import { writeFileSync as writeFileSync7 } from "fs";
2214
2360
  function initGit() {
2215
2361
  console.log("Initializing git repository...");
2216
- execSync9("git init", { stdio: "inherit" });
2362
+ execSync10("git init", { stdio: "inherit" });
2217
2363
  writeFileSync7(".gitignore", "dist\nnode_modules\n");
2218
2364
  }
2219
2365
 
2220
2366
  // src/commands/new/registerNew/newCli/initPackageJson.ts
2221
- import { execSync as execSync10 } from "child_process";
2367
+ import { execSync as execSync11 } from "child_process";
2222
2368
  function initPackageJson(name) {
2223
2369
  console.log("Initializing package.json...");
2224
- execSync10("npm init -y", { stdio: "inherit" });
2370
+ execSync11("npm init -y", { stdio: "inherit" });
2225
2371
  console.log("Configuring package.json...");
2226
- execSync10("npm pkg delete main", { stdio: "inherit" });
2227
- execSync10("npm pkg set type=module", { stdio: "inherit" });
2228
- execSync10(`npm pkg set bin.${name}=./dist/index.js`, { stdio: "inherit" });
2229
- execSync10("npm pkg set scripts.build=tsup", { stdio: "inherit" });
2230
- execSync10('npm pkg set scripts.start="node dist/index.js"', {
2372
+ execSync11("npm pkg delete main", { stdio: "inherit" });
2373
+ execSync11("npm pkg set type=module", { stdio: "inherit" });
2374
+ execSync11(`npm pkg set bin.${name}=./dist/index.js`, { stdio: "inherit" });
2375
+ execSync11("npm pkg set scripts.build=tsup", { stdio: "inherit" });
2376
+ execSync11('npm pkg set scripts.start="node dist/index.js"', {
2231
2377
  stdio: "inherit"
2232
2378
  });
2233
2379
  }
@@ -2292,8 +2438,8 @@ async function newCli() {
2292
2438
  initGit();
2293
2439
  initPackageJson(name);
2294
2440
  console.log("Installing dependencies...");
2295
- execSync11("npm install commander", { stdio: "inherit" });
2296
- execSync11("npm install -D tsup typescript @types/node", {
2441
+ execSync12("npm install commander", { stdio: "inherit" });
2442
+ execSync12("npm install -D tsup typescript @types/node", {
2297
2443
  stdio: "inherit"
2298
2444
  });
2299
2445
  writeCliTemplate(name);
@@ -2302,11 +2448,11 @@ async function newCli() {
2302
2448
  }
2303
2449
 
2304
2450
  // src/commands/new/registerNew/newProject.ts
2305
- import { execSync as execSync13 } from "child_process";
2451
+ import { execSync as execSync14 } from "child_process";
2306
2452
  import { existsSync as existsSync12, readFileSync as readFileSync8, writeFileSync as writeFileSync10 } from "fs";
2307
2453
 
2308
2454
  // src/commands/deploy/init/index.ts
2309
- import { execSync as execSync12 } from "child_process";
2455
+ import { execSync as execSync13 } from "child_process";
2310
2456
  import chalk24 from "chalk";
2311
2457
  import enquirer3 from "enquirer";
2312
2458
 
@@ -2359,7 +2505,7 @@ Created ${WORKFLOW_PATH}`));
2359
2505
  // src/commands/deploy/init/index.ts
2360
2506
  async function ensureNetlifyCli() {
2361
2507
  try {
2362
- execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
2508
+ execSync13("netlify sites:create --disable-linking", { stdio: "inherit" });
2363
2509
  } catch (error) {
2364
2510
  if (!(error instanceof Error) || !error.message.includes("command not found"))
2365
2511
  throw error;
@@ -2374,9 +2520,9 @@ async function ensureNetlifyCli() {
2374
2520
  process.exit(1);
2375
2521
  }
2376
2522
  console.log(chalk24.dim("\nInstalling netlify-cli...\n"));
2377
- execSync12("npm install -g netlify-cli", { stdio: "inherit" });
2523
+ execSync13("npm install -g netlify-cli", { stdio: "inherit" });
2378
2524
  console.log();
2379
- execSync12("netlify sites:create --disable-linking", { stdio: "inherit" });
2525
+ execSync13("netlify sites:create --disable-linking", { stdio: "inherit" });
2380
2526
  }
2381
2527
  }
2382
2528
  function printSetupInstructions() {
@@ -2419,7 +2565,7 @@ async function init5() {
2419
2565
  // src/commands/new/registerNew/newProject.ts
2420
2566
  async function newProject() {
2421
2567
  console.log("Initializing Vite with react-ts template...");
2422
- execSync13("npm create vite@latest . -- --template react-ts", {
2568
+ execSync14("npm create vite@latest . -- --template react-ts", {
2423
2569
  stdio: "inherit"
2424
2570
  });
2425
2571
  initGit();
@@ -2493,7 +2639,7 @@ function detectPlatform() {
2493
2639
 
2494
2640
  // src/commands/notify/showNotification/showWindowsNotificationFromWsl.ts
2495
2641
  import { spawn as spawn2 } from "child_process";
2496
- import fs10 from "fs";
2642
+ import fs11 from "fs";
2497
2643
  import { createRequire } from "module";
2498
2644
  import path17 from "path";
2499
2645
  var require2 = createRequire(import.meta.url);
@@ -2505,7 +2651,7 @@ function showWindowsNotificationFromWsl(options2) {
2505
2651
  const { title, message, sound } = options2;
2506
2652
  const snoreToastPath = getSnoreToastPath();
2507
2653
  try {
2508
- fs10.chmodSync(snoreToastPath, 493);
2654
+ fs11.chmodSync(snoreToastPath, 493);
2509
2655
  } catch {
2510
2656
  }
2511
2657
  const args = ["-t", title, "-m", message];
@@ -2611,11 +2757,11 @@ function activityChart(data, range) {
2611
2757
  }
2612
2758
 
2613
2759
  // src/commands/activity/fetchCommitsPerDay.ts
2614
- import { execSync as execSync14 } from "child_process";
2760
+ import { execSync as execSync15 } from "child_process";
2615
2761
  function fetchContributions(from, to) {
2616
2762
  const query = `{ viewer { contributionsCollection(from: "${from}T00:00:00Z", to: "${to}T23:59:59Z") { contributionCalendar { weeks { contributionDays { date contributionCount } } } } } }`;
2617
2763
  const jq = ".data.viewer.contributionsCollection.contributionCalendar.weeks[].contributionDays[]";
2618
- const raw = execSync14(`gh api graphql -f query='${query}' --jq '${jq}'`, {
2764
+ const raw = execSync15(`gh api graphql -f query='${query}' --jq '${jq}'`, {
2619
2765
  encoding: "utf-8"
2620
2766
  }).trim();
2621
2767
  if (!raw) return [];
@@ -2681,13 +2827,13 @@ import chalk36 from "chalk";
2681
2827
  import enquirer5 from "enquirer";
2682
2828
 
2683
2829
  // src/shared/pullIfConfigured.ts
2684
- import { execSync as execSync15 } from "child_process";
2830
+ import { execSync as execSync16 } from "child_process";
2685
2831
  import chalk25 from "chalk";
2686
2832
  function pullIfConfigured() {
2687
2833
  const config = loadConfig();
2688
2834
  if (!config.commit?.pull) return;
2689
2835
  try {
2690
- execSync15("git pull --ff-only", { stdio: "inherit" });
2836
+ execSync16("git pull --ff-only", { stdio: "inherit" });
2691
2837
  } catch {
2692
2838
  console.error(chalk25.red("git pull --ff-only failed; aborting."));
2693
2839
  process.exit(1);
@@ -2898,11 +3044,11 @@ function backupLocalBacklogFiles(dir) {
2898
3044
  }
2899
3045
 
2900
3046
  // src/commands/backlog/gitPullBacklog.ts
2901
- import { execSync as execSync16 } from "child_process";
3047
+ import { execSync as execSync17 } from "child_process";
2902
3048
  import chalk29 from "chalk";
2903
3049
  function gitPullBacklog(dir) {
2904
3050
  try {
2905
- execSync16("git pull --ff-only", {
3051
+ execSync17("git pull --ff-only", {
2906
3052
  cwd: dir,
2907
3053
  stdio: ["pipe", "pipe", "pipe"]
2908
3054
  });
@@ -3255,7 +3401,7 @@ function findBacklogUp(startDir) {
3255
3401
  }
3256
3402
 
3257
3403
  // src/commands/backlog/getCurrentOrigin.ts
3258
- import { execSync as execSync17 } from "child_process";
3404
+ import { execSync as execSync18 } from "child_process";
3259
3405
  function stripLeadingSlashes(path53) {
3260
3406
  return path53.replace(/^\/+/, "");
3261
3407
  }
@@ -3277,7 +3423,7 @@ function normalizeOrigin(raw) {
3277
3423
  }
3278
3424
  function tryGit(cwd, args) {
3279
3425
  try {
3280
- const out = execSync17(`git ${args}`, {
3426
+ const out = execSync18(`git ${args}`, {
3281
3427
  cwd,
3282
3428
  encoding: "utf-8",
3283
3429
  stdio: ["pipe", "pipe", "pipe"]
@@ -4074,7 +4220,7 @@ function printComments(item) {
4074
4220
  import { WebSocketServer } from "ws";
4075
4221
 
4076
4222
  // src/shared/getInstallDir.ts
4077
- import { execSync as execSync18 } from "child_process";
4223
+ import { execSync as execSync19 } from "child_process";
4078
4224
  import { dirname as dirname15, resolve as resolve6 } from "path";
4079
4225
  import { fileURLToPath as fileURLToPath3 } from "url";
4080
4226
  var __filename2 = fileURLToPath3(import.meta.url);
@@ -4084,7 +4230,7 @@ function getInstallDir() {
4084
4230
  }
4085
4231
  function isGitRepo(dir) {
4086
4232
  try {
4087
- const result = execSync18("git rev-parse --show-toplevel", {
4233
+ const result = execSync19("git rev-parse --show-toplevel", {
4088
4234
  cwd: dir,
4089
4235
  stdio: "pipe"
4090
4236
  }).toString().trim();
@@ -4598,7 +4744,7 @@ function getHtml() {
4598
4744
  }
4599
4745
 
4600
4746
  // src/commands/prs/getPreferredRemoteRepo.ts
4601
- import { execSync as execSync19 } from "child_process";
4747
+ import { execSync as execSync20 } from "child_process";
4602
4748
  var GITHUB_URL_PATTERN = /(?:git@github\.com:|https:\/\/github\.com\/)([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
4603
4749
  function parseGitHubUrl(url) {
4604
4750
  const match = url.match(GITHUB_URL_PATTERN);
@@ -4607,7 +4753,7 @@ function parseGitHubUrl(url) {
4607
4753
  }
4608
4754
  function tryGetRemoteUrl(remote, cwd) {
4609
4755
  try {
4610
- return execSync19(`git remote get-url ${remote}`, {
4756
+ return execSync20(`git remote get-url ${remote}`, {
4611
4757
  encoding: "utf-8",
4612
4758
  stdio: ["pipe", "pipe", "pipe"],
4613
4759
  cwd
@@ -4618,7 +4764,7 @@ function tryGetRemoteUrl(remote, cwd) {
4618
4764
  }
4619
4765
  function getCurrentBranchRemote(cwd) {
4620
4766
  try {
4621
- const ref = execSync19(
4767
+ const ref = execSync20(
4622
4768
  "git rev-parse --abbrev-ref --symbolic-full-name @{u}",
4623
4769
  { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], cwd }
4624
4770
  ).trim();
@@ -4630,7 +4776,7 @@ function getCurrentBranchRemote(cwd) {
4630
4776
  }
4631
4777
  function listRemotes(cwd) {
4632
4778
  try {
4633
- return execSync19("git remote", {
4779
+ return execSync20("git remote", {
4634
4780
  encoding: "utf-8",
4635
4781
  stdio: ["pipe", "pipe", "pipe"],
4636
4782
  cwd
@@ -6950,7 +7096,7 @@ import { homedir as homedir8 } from "os";
6950
7096
  import { join as join21 } from "path";
6951
7097
 
6952
7098
  // src/shared/checkCliAvailable.ts
6953
- import { execSync as execSync20 } from "child_process";
7099
+ import { execSync as execSync21 } from "child_process";
6954
7100
  function checkCliAvailable(cli) {
6955
7101
  const binary = cli.split(/\s+/)[0];
6956
7102
  const opts = {
@@ -6958,11 +7104,11 @@ function checkCliAvailable(cli) {
6958
7104
  stdio: ["ignore", "pipe", "pipe"]
6959
7105
  };
6960
7106
  try {
6961
- execSync20(`command -v ${binary}`, opts);
7107
+ execSync21(`command -v ${binary}`, opts);
6962
7108
  return true;
6963
7109
  } catch {
6964
7110
  try {
6965
- execSync20(`where ${binary}`, opts);
7111
+ execSync21(`where ${binary}`, opts);
6966
7112
  return true;
6967
7113
  } catch {
6968
7114
  return false;
@@ -7379,27 +7525,27 @@ import chalk85 from "chalk";
7379
7525
  import chalk80 from "chalk";
7380
7526
 
7381
7527
  // src/commands/complexity/shared/index.ts
7382
- import fs12 from "fs";
7528
+ import fs13 from "fs";
7383
7529
  import path19 from "path";
7384
7530
  import chalk79 from "chalk";
7385
7531
  import ts5 from "typescript";
7386
7532
 
7387
7533
  // src/commands/complexity/findSourceFiles.ts
7388
- import fs11 from "fs";
7534
+ import fs12 from "fs";
7389
7535
  import path18 from "path";
7390
- import { minimatch as minimatch3 } from "minimatch";
7536
+ import { minimatch as minimatch4 } from "minimatch";
7391
7537
  function applyIgnoreGlobs(files) {
7392
7538
  const { complexity } = loadConfig();
7393
7539
  return files.filter(
7394
- (f) => !complexity.ignore.some((glob) => minimatch3(f, glob))
7540
+ (f) => !complexity.ignore.some((glob) => minimatch4(f, glob))
7395
7541
  );
7396
7542
  }
7397
7543
  function walk(dir, results) {
7398
- if (!fs11.existsSync(dir)) {
7544
+ if (!fs12.existsSync(dir)) {
7399
7545
  return;
7400
7546
  }
7401
7547
  const extensions = [".ts", ".tsx"];
7402
- const entries = fs11.readdirSync(dir, { withFileTypes: true });
7548
+ const entries = fs12.readdirSync(dir, { withFileTypes: true });
7403
7549
  for (const entry of entries) {
7404
7550
  const fullPath = path18.join(dir, entry.name);
7405
7551
  if (entry.isDirectory()) {
@@ -7415,17 +7561,17 @@ function findSourceFiles2(pattern2, baseDir = ".") {
7415
7561
  const results = [];
7416
7562
  if (pattern2.includes("*")) {
7417
7563
  walk(baseDir, results);
7418
- return applyIgnoreGlobs(results.filter((f) => minimatch3(f, pattern2)));
7564
+ return applyIgnoreGlobs(results.filter((f) => minimatch4(f, pattern2)));
7419
7565
  }
7420
- if (fs11.existsSync(pattern2) && fs11.statSync(pattern2).isFile()) {
7566
+ if (fs12.existsSync(pattern2) && fs12.statSync(pattern2).isFile()) {
7421
7567
  return [pattern2];
7422
7568
  }
7423
- if (fs11.existsSync(pattern2) && fs11.statSync(pattern2).isDirectory()) {
7569
+ if (fs12.existsSync(pattern2) && fs12.statSync(pattern2).isDirectory()) {
7424
7570
  walk(pattern2, results);
7425
7571
  return applyIgnoreGlobs(results);
7426
7572
  }
7427
7573
  walk(baseDir, results);
7428
- return applyIgnoreGlobs(results.filter((f) => minimatch3(f, pattern2)));
7574
+ return applyIgnoreGlobs(results.filter((f) => minimatch4(f, pattern2)));
7429
7575
  }
7430
7576
 
7431
7577
  // src/commands/complexity/shared/getNodeName.ts
@@ -7615,7 +7761,7 @@ function countSloc(content) {
7615
7761
 
7616
7762
  // src/commands/complexity/shared/index.ts
7617
7763
  function createSourceFromFile(filePath) {
7618
- const content = fs12.readFileSync(filePath, "utf-8");
7764
+ const content = fs13.readFileSync(filePath, "utf-8");
7619
7765
  return ts5.createSourceFile(
7620
7766
  path19.basename(filePath),
7621
7767
  content,
@@ -7709,7 +7855,7 @@ Analyzed ${results.length} functions across ${files.length} files`
7709
7855
  }
7710
7856
 
7711
7857
  // src/commands/complexity/maintainability/index.ts
7712
- import fs13 from "fs";
7858
+ import fs14 from "fs";
7713
7859
 
7714
7860
  // src/commands/complexity/maintainability/displayMaintainabilityResults.ts
7715
7861
  import chalk82 from "chalk";
@@ -7758,7 +7904,7 @@ function calculateMaintainabilityIndex(halsteadVolume, cyclomaticComplexity, slo
7758
7904
  function collectFileMetrics(files) {
7759
7905
  const fileMetrics = /* @__PURE__ */ new Map();
7760
7906
  for (const file of files) {
7761
- const content = fs13.readFileSync(file, "utf-8");
7907
+ const content = fs14.readFileSync(file, "utf-8");
7762
7908
  fileMetrics.set(file, { sloc: countSloc(content), functions: [] });
7763
7909
  }
7764
7910
  forEachFunction(files, (file, _name, node) => {
@@ -7797,14 +7943,14 @@ async function maintainability(pattern2 = "**/*.ts", options2 = {}) {
7797
7943
  }
7798
7944
 
7799
7945
  // src/commands/complexity/sloc.ts
7800
- import fs14 from "fs";
7946
+ import fs15 from "fs";
7801
7947
  import chalk84 from "chalk";
7802
7948
  async function sloc(pattern2 = "**/*.ts", options2 = {}) {
7803
7949
  withSourceFiles(pattern2, (files) => {
7804
7950
  const results = [];
7805
7951
  let hasViolation = false;
7806
7952
  for (const file of files) {
7807
- const content = fs14.readFileSync(file, "utf-8");
7953
+ const content = fs15.readFileSync(file, "utf-8");
7808
7954
  const lines = countSloc(content);
7809
7955
  results.push({ file, lines });
7810
7956
  if (options2.threshold !== void 0 && lines > options2.threshold) {
@@ -8082,7 +8228,7 @@ function loadBlogSkipDays(repoName) {
8082
8228
  }
8083
8229
 
8084
8230
  // src/commands/devlog/shared.ts
8085
- import { execSync as execSync21 } from "child_process";
8231
+ import { execSync as execSync22 } from "child_process";
8086
8232
  import chalk89 from "chalk";
8087
8233
 
8088
8234
  // src/shared/getRepoName.ts
@@ -8174,7 +8320,7 @@ function loadAllDevlogLatestDates() {
8174
8320
  // src/commands/devlog/shared.ts
8175
8321
  function getCommitFiles(hash) {
8176
8322
  try {
8177
- const output = execSync21(`git show --name-only --format="" ${hash}`, {
8323
+ const output = execSync22(`git show --name-only --format="" ${hash}`, {
8178
8324
  encoding: "utf-8"
8179
8325
  });
8180
8326
  return output.trim().split("\n").filter(Boolean);
@@ -8270,11 +8416,11 @@ function list3(options2) {
8270
8416
  }
8271
8417
 
8272
8418
  // src/commands/devlog/getLastVersionInfo.ts
8273
- import { execFileSync as execFileSync2, execSync as execSync22 } from "child_process";
8419
+ import { execFileSync as execFileSync2, execSync as execSync23 } from "child_process";
8274
8420
  import semver from "semver";
8275
8421
  function getVersionAtCommit(hash) {
8276
8422
  try {
8277
- const content = execSync22(`git show ${hash}:package.json`, {
8423
+ const content = execSync23(`git show ${hash}:package.json`, {
8278
8424
  encoding: "utf-8"
8279
8425
  });
8280
8426
  const pkg = JSON.parse(content);
@@ -8447,7 +8593,7 @@ function next2(options2) {
8447
8593
  }
8448
8594
 
8449
8595
  // src/commands/devlog/repos/index.ts
8450
- import { execSync as execSync23 } from "child_process";
8596
+ import { execSync as execSync24 } from "child_process";
8451
8597
 
8452
8598
  // src/commands/devlog/repos/printReposTable.ts
8453
8599
  import chalk93 from "chalk";
@@ -8482,7 +8628,7 @@ function getStatus(lastPush, lastDevlog) {
8482
8628
  return lastDevlog < lastPush ? "outdated" : "ok";
8483
8629
  }
8484
8630
  function fetchRepos(days, all) {
8485
- const json = execSync23(
8631
+ const json = execSync24(
8486
8632
  "gh repo list staff0rd --json name,pushedAt,isArchived --limit 200",
8487
8633
  { encoding: "utf-8" }
8488
8634
  );
@@ -8842,7 +8988,7 @@ async function deps(csprojPath, options2) {
8842
8988
  }
8843
8989
 
8844
8990
  // src/commands/dotnet/getChangedCsFiles.ts
8845
- import { execSync as execSync24 } from "child_process";
8991
+ import { execSync as execSync25 } from "child_process";
8846
8992
  var SCOPE_ALL = "all";
8847
8993
  var SCOPE_BASE = "base:";
8848
8994
  var SCOPE_COMMIT = "commit:";
@@ -8866,7 +9012,7 @@ function getChangedCsFiles(scope) {
8866
9012
  } else {
8867
9013
  cmd = "git diff --name-only HEAD";
8868
9014
  }
8869
- const output = execSync24(cmd, { encoding: "utf-8" }).trim();
9015
+ const output = execSync25(cmd, { encoding: "utf-8" }).trim();
8870
9016
  if (output === "") return [];
8871
9017
  return output.split("\n").filter((f) => f.toLowerCase().endsWith(".cs"));
8872
9018
  }
@@ -9064,14 +9210,14 @@ function parseInspectReport(json) {
9064
9210
  }
9065
9211
 
9066
9212
  // src/commands/dotnet/runInspectCode.ts
9067
- import { execSync as execSync25 } from "child_process";
9213
+ import { execSync as execSync26 } from "child_process";
9068
9214
  import { existsSync as existsSync29, readFileSync as readFileSync24, unlinkSync as unlinkSync6 } from "fs";
9069
9215
  import { tmpdir as tmpdir3 } from "os";
9070
9216
  import path25 from "path";
9071
9217
  import chalk103 from "chalk";
9072
9218
  function assertJbInstalled() {
9073
9219
  try {
9074
- execSync25("jb inspectcode --version", { stdio: "pipe" });
9220
+ execSync26("jb inspectcode --version", { stdio: "pipe" });
9075
9221
  } catch {
9076
9222
  console.error(chalk103.red("jb is not installed. Install with:"));
9077
9223
  console.error(
@@ -9085,7 +9231,7 @@ function runInspectCode(slnPath, include, swea) {
9085
9231
  const includeFlag = include ? ` --include="${include}"` : "";
9086
9232
  const sweaFlag = swea ? " --swea" : "";
9087
9233
  try {
9088
- execSync25(
9234
+ execSync26(
9089
9235
  `jb inspectcode "${slnPath}" -o="${reportPath}"${includeFlag}${sweaFlag} --verbosity=OFF`,
9090
9236
  { stdio: "pipe" }
9091
9237
  );
@@ -9106,7 +9252,7 @@ function runInspectCode(slnPath, include, swea) {
9106
9252
  }
9107
9253
 
9108
9254
  // src/commands/dotnet/runRoslynInspect.ts
9109
- import { execSync as execSync26 } from "child_process";
9255
+ import { execSync as execSync27 } from "child_process";
9110
9256
  import chalk104 from "chalk";
9111
9257
  function resolveMsbuildPath() {
9112
9258
  const { run: run4 } = loadConfig();
@@ -9117,7 +9263,7 @@ function resolveMsbuildPath() {
9117
9263
  function assertMsbuildInstalled() {
9118
9264
  const msbuild = resolveMsbuildPath();
9119
9265
  try {
9120
- execSync26(`"${msbuild}" -version`, { stdio: "pipe" });
9266
+ execSync27(`"${msbuild}" -version`, { stdio: "pipe" });
9121
9267
  } catch {
9122
9268
  console.error(chalk104.red(`msbuild not found at: ${msbuild}`));
9123
9269
  console.error(
@@ -9143,7 +9289,7 @@ function runRoslynInspect(slnPath) {
9143
9289
  const msbuild = resolveMsbuildPath();
9144
9290
  let output;
9145
9291
  try {
9146
- output = execSync26(
9292
+ output = execSync27(
9147
9293
  `"${msbuild}" "${slnPath}" -t:Build -v:minimal -maxcpucount -p:EnforceCodeStyleInBuild=true -p:RunAnalyzersDuringBuild=true 2>&1`,
9148
9294
  { encoding: "utf-8", stdio: "pipe", maxBuffer: 50 * 1024 * 1024 }
9149
9295
  );
@@ -9502,7 +9648,7 @@ function resolveLoadOptions(options2) {
9502
9648
  import { execFileSync as execFileSync4 } from "child_process";
9503
9649
 
9504
9650
  // src/commands/sessions/summarise/iterateUserEntries.ts
9505
- import * as fs15 from "fs";
9651
+ import * as fs16 from "fs";
9506
9652
 
9507
9653
  // src/commands/sessions/summarise/parseUserLine.ts
9508
9654
  function parseUserLine(line) {
@@ -9533,7 +9679,7 @@ function parseUserLine(line) {
9533
9679
  function* iterateUserEntries(filePath) {
9534
9680
  let content;
9535
9681
  try {
9536
- content = fs15.readFileSync(filePath, "utf8");
9682
+ content = fs16.readFileSync(filePath, "utf8");
9537
9683
  } catch {
9538
9684
  return;
9539
9685
  }
@@ -9705,12 +9851,12 @@ function adfToText(doc) {
9705
9851
  }
9706
9852
 
9707
9853
  // src/commands/jira/fetchIssue.ts
9708
- import { execSync as execSync27 } from "child_process";
9854
+ import { execSync as execSync28 } from "child_process";
9709
9855
  import chalk108 from "chalk";
9710
9856
  function fetchIssue(issueKey, fields) {
9711
9857
  let result;
9712
9858
  try {
9713
- result = execSync27(
9859
+ result = execSync28(
9714
9860
  `acli jira workitem view ${issueKey} -f ${fields} --json`,
9715
9861
  { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
9716
9862
  );
@@ -9756,7 +9902,7 @@ function acceptanceCriteria(issueKey) {
9756
9902
  }
9757
9903
 
9758
9904
  // src/commands/jira/jiraAuth.ts
9759
- import { execSync as execSync28 } from "child_process";
9905
+ import { execSync as execSync29 } from "child_process";
9760
9906
 
9761
9907
  // src/shared/loadJson.ts
9762
9908
  import { existsSync as existsSync32, mkdirSync as mkdirSync10, readFileSync as readFileSync27, writeFileSync as writeFileSync20 } from "fs";
@@ -9820,7 +9966,7 @@ async function jiraAuth() {
9820
9966
  console.error("All fields are required.");
9821
9967
  process.exit(1);
9822
9968
  }
9823
- execSync28(`acli jira auth login --site ${site} --email "${email}" --token`, {
9969
+ execSync29(`acli jira auth login --site ${site} --email "${email}" --token`, {
9824
9970
  encoding: "utf-8",
9825
9971
  input: token,
9826
9972
  stdio: ["pipe", "inherit", "inherit"]
@@ -10302,7 +10448,7 @@ function registerPrompts(program2) {
10302
10448
  }
10303
10449
 
10304
10450
  // src/commands/prs/shared.ts
10305
- import { execSync as execSync29 } from "child_process";
10451
+ import { execSync as execSync30 } from "child_process";
10306
10452
  function isGhNotInstalled(error) {
10307
10453
  if (error instanceof Error) {
10308
10454
  const msg = error.message.toLowerCase();
@@ -10320,12 +10466,12 @@ function getRepoInfo() {
10320
10466
  const preferred = getPreferredRemoteRepo();
10321
10467
  if (preferred) return preferred;
10322
10468
  const repoInfo = JSON.parse(
10323
- execSync29("gh repo view --json owner,name", { encoding: "utf-8" })
10469
+ execSync30("gh repo view --json owner,name", { encoding: "utf-8" })
10324
10470
  );
10325
10471
  return { org: repoInfo.owner.login, repo: repoInfo.name };
10326
10472
  }
10327
10473
  function getCurrentBranch() {
10328
- return execSync29("git rev-parse --abbrev-ref HEAD", {
10474
+ return execSync30("git rev-parse --abbrev-ref HEAD", {
10329
10475
  encoding: "utf-8"
10330
10476
  }).trim();
10331
10477
  }
@@ -10333,7 +10479,7 @@ function viewCurrentPr(fields) {
10333
10479
  const { org, repo } = getRepoInfo();
10334
10480
  const branch = getCurrentBranch();
10335
10481
  return JSON.parse(
10336
- execSync29(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
10482
+ execSync30(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
10337
10483
  encoding: "utf-8"
10338
10484
  })
10339
10485
  );
@@ -10415,7 +10561,7 @@ function comment2(path53, line, body, startLine) {
10415
10561
  }
10416
10562
 
10417
10563
  // src/commands/prs/create.ts
10418
- import { execSync as execSync30 } from "child_process";
10564
+ import { execSync as execSync31 } from "child_process";
10419
10565
 
10420
10566
  // src/commands/prs/buildCreateArgs.ts
10421
10567
  function buildCreateArgs(title, body, options2) {
@@ -10470,17 +10616,17 @@ function create(options2) {
10470
10616
  validatePrContent(options2.title, options2.body);
10471
10617
  const args = buildCreateArgs(options2.title, options2.body, options2);
10472
10618
  try {
10473
- execSync30(args.join(" "), { stdio: "inherit" });
10619
+ execSync31(args.join(" "), { stdio: "inherit" });
10474
10620
  } catch (_error) {
10475
10621
  process.exit(1);
10476
10622
  }
10477
10623
  }
10478
10624
 
10479
10625
  // src/commands/prs/fixed.ts
10480
- import { execSync as execSync32 } from "child_process";
10626
+ import { execSync as execSync33 } from "child_process";
10481
10627
 
10482
10628
  // src/commands/prs/resolveCommentWithReply.ts
10483
- import { execSync as execSync31 } from "child_process";
10629
+ import { execSync as execSync32 } from "child_process";
10484
10630
  import { unlinkSync as unlinkSync9, writeFileSync as writeFileSync22 } from "fs";
10485
10631
  import { tmpdir as tmpdir5 } from "os";
10486
10632
  import { join as join33 } from "path";
@@ -10510,7 +10656,7 @@ function deleteCommentsCache(prNumber) {
10510
10656
 
10511
10657
  // src/commands/prs/resolveCommentWithReply.ts
10512
10658
  function replyToComment(org, repo, prNumber, commentId, message) {
10513
- execSync31(
10659
+ execSync32(
10514
10660
  `gh api repos/${org}/${repo}/pulls/${prNumber}/comments -f body="${message.replace(/"/g, '\\"')}" -F in_reply_to=${commentId}`,
10515
10661
  { stdio: ["inherit", "pipe", "inherit"] }
10516
10662
  );
@@ -10520,7 +10666,7 @@ function resolveThread(threadId) {
10520
10666
  const queryFile = join33(tmpdir5(), `gh-mutation-${Date.now()}.graphql`);
10521
10667
  writeFileSync22(queryFile, mutation);
10522
10668
  try {
10523
- execSync31(
10669
+ execSync32(
10524
10670
  `gh api graphql -F query=@${queryFile} -f threadId="${threadId}"`,
10525
10671
  { stdio: ["inherit", "pipe", "inherit"] }
10526
10672
  );
@@ -10572,7 +10718,7 @@ function resolveCommentWithReply(commentId, message) {
10572
10718
  // src/commands/prs/fixed.ts
10573
10719
  function verifySha(sha) {
10574
10720
  try {
10575
- return execSync32(`git rev-parse --verify ${sha}`, {
10721
+ return execSync33(`git rev-parse --verify ${sha}`, {
10576
10722
  encoding: "utf-8"
10577
10723
  }).trim();
10578
10724
  } catch {
@@ -10586,7 +10732,7 @@ function fixed(commentId, sha) {
10586
10732
  const { org, repo } = getRepoInfo();
10587
10733
  const repoUrl = `https://github.com/${org}/${repo}`;
10588
10734
  const message = `Fixed in [${fullSha}](${repoUrl}/commit/${fullSha})`;
10589
- execSync32("git push", { stdio: "inherit" });
10735
+ execSync33("git push", { stdio: "inherit" });
10590
10736
  resolveCommentWithReply(commentId, message);
10591
10737
  } catch (error) {
10592
10738
  if (isGhNotInstalled(error)) {
@@ -10604,7 +10750,7 @@ import { join as join35 } from "path";
10604
10750
  import { stringify } from "yaml";
10605
10751
 
10606
10752
  // src/commands/prs/fetchThreadIds.ts
10607
- import { execSync as execSync33 } from "child_process";
10753
+ import { execSync as execSync34 } from "child_process";
10608
10754
  import { unlinkSync as unlinkSync10, writeFileSync as writeFileSync23 } from "fs";
10609
10755
  import { tmpdir as tmpdir6 } from "os";
10610
10756
  import { join as join34 } from "path";
@@ -10613,7 +10759,7 @@ function fetchThreadIds(org, repo, prNumber) {
10613
10759
  const queryFile = join34(tmpdir6(), `gh-query-${Date.now()}.graphql`);
10614
10760
  writeFileSync23(queryFile, THREAD_QUERY);
10615
10761
  try {
10616
- const result = execSync33(
10762
+ const result = execSync34(
10617
10763
  `gh api graphql -F query=@${queryFile} -F owner="${org}" -F repo="${repo}" -F prNumber=${prNumber}`,
10618
10764
  { encoding: "utf-8" }
10619
10765
  );
@@ -10635,9 +10781,9 @@ function fetchThreadIds(org, repo, prNumber) {
10635
10781
  }
10636
10782
 
10637
10783
  // src/commands/prs/listComments/fetchReviewComments.ts
10638
- import { execSync as execSync34 } from "child_process";
10784
+ import { execSync as execSync35 } from "child_process";
10639
10785
  function fetchJson(endpoint) {
10640
- const result = execSync34(`gh api --paginate ${endpoint}`, {
10786
+ const result = execSync35(`gh api --paginate ${endpoint}`, {
10641
10787
  encoding: "utf-8"
10642
10788
  });
10643
10789
  if (!result.trim()) return [];
@@ -10776,7 +10922,7 @@ async function listComments() {
10776
10922
  }
10777
10923
 
10778
10924
  // src/commands/prs/prs/index.ts
10779
- import { execSync as execSync35 } from "child_process";
10925
+ import { execSync as execSync36 } from "child_process";
10780
10926
 
10781
10927
  // src/commands/prs/prs/displayPaginated/index.ts
10782
10928
  import enquirer9 from "enquirer";
@@ -10883,7 +11029,7 @@ async function prs(options2) {
10883
11029
  const state = options2.open ? "open" : options2.closed ? "closed" : "all";
10884
11030
  try {
10885
11031
  const { org, repo } = getRepoInfo();
10886
- const result = execSync35(
11032
+ const result = execSync36(
10887
11033
  `gh pr list --state ${state} --json number,title,url,author,createdAt,mergedAt,closedAt,state,changedFiles --limit 100 -R ${org}/${repo}`,
10888
11034
  { encoding: "utf-8" }
10889
11035
  );
@@ -10906,7 +11052,7 @@ async function prs(options2) {
10906
11052
  }
10907
11053
 
10908
11054
  // src/commands/prs/wontfix.ts
10909
- import { execSync as execSync36 } from "child_process";
11055
+ import { execSync as execSync37 } from "child_process";
10910
11056
  function validateReason(reason) {
10911
11057
  const lowerReason = reason.toLowerCase();
10912
11058
  if (lowerReason.includes("claude") || lowerReason.includes("opus")) {
@@ -10923,7 +11069,7 @@ function validateShaReferences(reason) {
10923
11069
  const invalidShas = [];
10924
11070
  for (const sha of shas) {
10925
11071
  try {
10926
- execSync36(`git cat-file -t ${sha}`, { stdio: "pipe" });
11072
+ execSync37(`git cat-file -t ${sha}`, { stdio: "pipe" });
10927
11073
  } catch {
10928
11074
  invalidShas.push(sha);
10929
11075
  }
@@ -11058,10 +11204,10 @@ import chalk122 from "chalk";
11058
11204
  import Enquirer2 from "enquirer";
11059
11205
 
11060
11206
  // src/commands/ravendb/searchItems.ts
11061
- import { execSync as execSync37 } from "child_process";
11207
+ import { execSync as execSync38 } from "child_process";
11062
11208
  import chalk121 from "chalk";
11063
11209
  function opExec(args) {
11064
- return execSync37(`op ${args}`, {
11210
+ return execSync38(`op ${args}`, {
11065
11211
  encoding: "utf-8",
11066
11212
  stdio: ["pipe", "pipe", "pipe"]
11067
11213
  }).trim();
@@ -11213,7 +11359,7 @@ ${errorText}`
11213
11359
  }
11214
11360
 
11215
11361
  // src/commands/ravendb/resolveOpSecret.ts
11216
- import { execSync as execSync38 } from "child_process";
11362
+ import { execSync as execSync39 } from "child_process";
11217
11363
  import chalk126 from "chalk";
11218
11364
  function resolveOpSecret(reference) {
11219
11365
  if (!reference.startsWith("op://")) {
@@ -11221,7 +11367,7 @@ function resolveOpSecret(reference) {
11221
11367
  process.exit(1);
11222
11368
  }
11223
11369
  try {
11224
- return execSync38(`op read "${reference}"`, {
11370
+ return execSync39(`op read "${reference}"`, {
11225
11371
  encoding: "utf-8",
11226
11372
  stdio: ["pipe", "pipe", "pipe"]
11227
11373
  }).trim();
@@ -11470,18 +11616,18 @@ Refactor check failed:
11470
11616
  }
11471
11617
 
11472
11618
  // src/commands/refactor/check/getViolations/index.ts
11473
- import { execSync as execSync39 } from "child_process";
11474
- import fs17 from "fs";
11475
- import { minimatch as minimatch4 } from "minimatch";
11619
+ import { execSync as execSync40 } from "child_process";
11620
+ import fs18 from "fs";
11621
+ import { minimatch as minimatch5 } from "minimatch";
11476
11622
 
11477
11623
  // src/commands/refactor/check/getViolations/getIgnoredFiles.ts
11478
- import fs16 from "fs";
11624
+ import fs17 from "fs";
11479
11625
  var REFACTOR_YML_PATH = "refactor.yml";
11480
11626
  function parseRefactorYml() {
11481
- if (!fs16.existsSync(REFACTOR_YML_PATH)) {
11627
+ if (!fs17.existsSync(REFACTOR_YML_PATH)) {
11482
11628
  return [];
11483
11629
  }
11484
- const content = fs16.readFileSync(REFACTOR_YML_PATH, "utf-8");
11630
+ const content = fs17.readFileSync(REFACTOR_YML_PATH, "utf-8");
11485
11631
  const entries = [];
11486
11632
  const lines = content.split("\n");
11487
11633
  let currentEntry = {};
@@ -11511,7 +11657,7 @@ function getIgnoredFiles() {
11511
11657
 
11512
11658
  // src/commands/refactor/check/getViolations/index.ts
11513
11659
  function countLines(filePath) {
11514
- const content = fs17.readFileSync(filePath, "utf-8");
11660
+ const content = fs18.readFileSync(filePath, "utf-8");
11515
11661
  return content.split("\n").length;
11516
11662
  }
11517
11663
  function getGitFiles(options2) {
@@ -11520,7 +11666,7 @@ function getGitFiles(options2) {
11520
11666
  }
11521
11667
  const files = /* @__PURE__ */ new Set();
11522
11668
  if (options2.staged || options2.modified) {
11523
- const staged = execSync39("git diff --cached --name-only", {
11669
+ const staged = execSync40("git diff --cached --name-only", {
11524
11670
  encoding: "utf-8"
11525
11671
  });
11526
11672
  for (const file of staged.trim().split("\n").filter(Boolean)) {
@@ -11528,7 +11674,7 @@ function getGitFiles(options2) {
11528
11674
  }
11529
11675
  }
11530
11676
  if (options2.unstaged || options2.modified) {
11531
- const unstaged = execSync39("git diff --name-only", { encoding: "utf-8" });
11677
+ const unstaged = execSync40("git diff --name-only", { encoding: "utf-8" });
11532
11678
  for (const file of unstaged.trim().split("\n").filter(Boolean)) {
11533
11679
  files.add(file);
11534
11680
  }
@@ -11540,7 +11686,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
11540
11686
  const ignoredFiles = getIgnoredFiles();
11541
11687
  const gitFiles = getGitFiles(options2);
11542
11688
  if (pattern2) {
11543
- sourceFiles = sourceFiles.filter((f) => minimatch4(f, pattern2));
11689
+ sourceFiles = sourceFiles.filter((f) => minimatch5(f, pattern2));
11544
11690
  }
11545
11691
  if (gitFiles) {
11546
11692
  sourceFiles = sourceFiles.filter((f) => gitFiles.has(f));
@@ -12242,15 +12388,15 @@ function displayPlan(functionName, relDest, plan2, cwd) {
12242
12388
  // src/commands/refactor/extract/loadProjectFile.ts
12243
12389
  import path32 from "path";
12244
12390
  import chalk134 from "chalk";
12245
- import { Project as Project3 } from "ts-morph";
12391
+ import { Project as Project4 } from "ts-morph";
12246
12392
 
12247
12393
  // src/commands/refactor/extract/findTsConfig.ts
12248
- import fs18 from "fs";
12394
+ import fs19 from "fs";
12249
12395
  import path31 from "path";
12250
- import { Project as Project2 } from "ts-morph";
12396
+ import { Project as Project3 } from "ts-morph";
12251
12397
  function findTsConfig(sourcePath) {
12252
12398
  const rootConfig = path31.resolve("tsconfig.json");
12253
- if (!fs18.existsSync(rootConfig)) return rootConfig;
12399
+ if (!fs19.existsSync(rootConfig)) return rootConfig;
12254
12400
  const tried = /* @__PURE__ */ new Set();
12255
12401
  const candidates = [rootConfig, ...readReferences(rootConfig)];
12256
12402
  for (const candidate of candidates) {
@@ -12258,7 +12404,7 @@ function findTsConfig(sourcePath) {
12258
12404
  tried.add(candidate);
12259
12405
  if (projectIncludes(candidate, sourcePath)) return candidate;
12260
12406
  }
12261
- const siblings = fs18.readdirSync(path31.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path31.resolve(path31.dirname(rootConfig), f));
12407
+ const siblings = fs19.readdirSync(path31.dirname(rootConfig)).filter((f) => /^tsconfig.*\.json$/.test(f)).map((f) => path31.resolve(path31.dirname(rootConfig), f));
12262
12408
  for (const sibling of siblings) {
12263
12409
  if (tried.has(sibling)) continue;
12264
12410
  tried.add(sibling);
@@ -12267,8 +12413,8 @@ function findTsConfig(sourcePath) {
12267
12413
  return rootConfig;
12268
12414
  }
12269
12415
  function readReferences(configPath) {
12270
- if (!fs18.existsSync(configPath)) return [];
12271
- const raw = fs18.readFileSync(configPath, "utf-8");
12416
+ if (!fs19.existsSync(configPath)) return [];
12417
+ const raw = fs19.readFileSync(configPath, "utf-8");
12272
12418
  const stripped = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
12273
12419
  let parsed;
12274
12420
  try {
@@ -12280,12 +12426,12 @@ function readReferences(configPath) {
12280
12426
  const cwd = path31.dirname(configPath);
12281
12427
  return parsed.references.map((ref) => {
12282
12428
  const refPath = path31.resolve(cwd, ref.path);
12283
- return fs18.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path31.join(refPath, "tsconfig.json") : refPath;
12284
- }).filter((p) => fs18.existsSync(p));
12429
+ return fs19.statSync(refPath, { throwIfNoEntry: false })?.isDirectory() ? path31.join(refPath, "tsconfig.json") : refPath;
12430
+ }).filter((p) => fs19.existsSync(p));
12285
12431
  }
12286
12432
  function projectIncludes(configPath, sourcePath) {
12287
12433
  try {
12288
- const project = new Project2({ tsConfigFilePath: configPath });
12434
+ const project = new Project3({ tsConfigFilePath: configPath });
12289
12435
  return !!project.getSourceFile(sourcePath);
12290
12436
  } catch {
12291
12437
  return false;
@@ -12296,7 +12442,7 @@ function projectIncludes(configPath, sourcePath) {
12296
12442
  function loadProjectFile(file) {
12297
12443
  const sourcePath = path32.resolve(file);
12298
12444
  const tsConfigPath = findTsConfig(sourcePath);
12299
- const project = new Project3({
12445
+ const project = new Project4({
12300
12446
  tsConfigFilePath: tsConfigPath
12301
12447
  });
12302
12448
  const sourceFile = project.getSourceFile(sourcePath);
@@ -12331,25 +12477,25 @@ async function extract(file, functionName, destination, options2 = {}) {
12331
12477
  }
12332
12478
 
12333
12479
  // src/commands/refactor/ignore.ts
12334
- import fs19 from "fs";
12480
+ import fs20 from "fs";
12335
12481
  import chalk136 from "chalk";
12336
12482
  var REFACTOR_YML_PATH2 = "refactor.yml";
12337
12483
  function ignore(file) {
12338
- if (!fs19.existsSync(file)) {
12484
+ if (!fs20.existsSync(file)) {
12339
12485
  console.error(chalk136.red(`Error: File does not exist: ${file}`));
12340
12486
  process.exit(1);
12341
12487
  }
12342
- const content = fs19.readFileSync(file, "utf-8");
12488
+ const content = fs20.readFileSync(file, "utf-8");
12343
12489
  const lineCount = content.split("\n").length;
12344
12490
  const maxLines = lineCount + 10;
12345
12491
  const entry = `- file: ${file}
12346
12492
  maxLines: ${maxLines}
12347
12493
  `;
12348
- if (fs19.existsSync(REFACTOR_YML_PATH2)) {
12349
- const existing = fs19.readFileSync(REFACTOR_YML_PATH2, "utf-8");
12350
- fs19.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
12494
+ if (fs20.existsSync(REFACTOR_YML_PATH2)) {
12495
+ const existing = fs20.readFileSync(REFACTOR_YML_PATH2, "utf-8");
12496
+ fs20.writeFileSync(REFACTOR_YML_PATH2, existing + entry);
12351
12497
  } else {
12352
- fs19.writeFileSync(REFACTOR_YML_PATH2, entry);
12498
+ fs20.writeFileSync(REFACTOR_YML_PATH2, entry);
12353
12499
  }
12354
12500
  console.log(
12355
12501
  chalk136.green(
@@ -12597,7 +12743,7 @@ function clusterFiles(graph) {
12597
12743
  import path39 from "path";
12598
12744
 
12599
12745
  // src/commands/refactor/restructure/computeRewrites/applyRewrites.ts
12600
- import fs20 from "fs";
12746
+ import fs21 from "fs";
12601
12747
  function getOrCreateList(map, key) {
12602
12748
  const list4 = map.get(key) ?? [];
12603
12749
  if (!map.has(key)) map.set(key, list4);
@@ -12616,7 +12762,7 @@ function rewriteSpecifier(content, oldSpecifier, newSpecifier) {
12616
12762
  return content.replace(pattern2, `$1${newSpecifier}$2`);
12617
12763
  }
12618
12764
  function applyFileRewrites(file, fileRewrites) {
12619
- let content = fs20.readFileSync(file, "utf-8");
12765
+ let content = fs21.readFileSync(file, "utf-8");
12620
12766
  for (const { oldSpecifier, newSpecifier } of fileRewrites) {
12621
12767
  content = rewriteSpecifier(content, oldSpecifier, newSpecifier);
12622
12768
  }
@@ -12744,27 +12890,27 @@ Summary: ${plan2.moves.length} file(s) moved, ${plan2.rewrites.length} imports r
12744
12890
  }
12745
12891
 
12746
12892
  // src/commands/refactor/restructure/executePlan.ts
12747
- import fs21 from "fs";
12893
+ import fs22 from "fs";
12748
12894
  import path41 from "path";
12749
12895
  import chalk140 from "chalk";
12750
12896
  function executePlan(plan2) {
12751
12897
  const updatedContents = applyRewrites(plan2.rewrites);
12752
12898
  for (const [file, content] of updatedContents) {
12753
- fs21.writeFileSync(file, content, "utf-8");
12899
+ fs22.writeFileSync(file, content, "utf-8");
12754
12900
  console.log(
12755
12901
  chalk140.cyan(` Rewrote imports in ${path41.relative(process.cwd(), file)}`)
12756
12902
  );
12757
12903
  }
12758
12904
  for (const dir of plan2.newDirectories) {
12759
- fs21.mkdirSync(dir, { recursive: true });
12905
+ fs22.mkdirSync(dir, { recursive: true });
12760
12906
  console.log(chalk140.green(` Created ${path41.relative(process.cwd(), dir)}/`));
12761
12907
  }
12762
12908
  for (const move of plan2.moves) {
12763
12909
  const targetDir = path41.dirname(move.to);
12764
- if (!fs21.existsSync(targetDir)) {
12765
- fs21.mkdirSync(targetDir, { recursive: true });
12910
+ if (!fs22.existsSync(targetDir)) {
12911
+ fs22.mkdirSync(targetDir, { recursive: true });
12766
12912
  }
12767
- fs21.renameSync(move.from, move.to);
12913
+ fs22.renameSync(move.from, move.to);
12768
12914
  console.log(
12769
12915
  chalk140.white(
12770
12916
  ` Moved ${path41.relative(process.cwd(), move.from)} \u2192 ${path41.relative(process.cwd(), move.to)}`
@@ -12776,10 +12922,10 @@ function executePlan(plan2) {
12776
12922
  function removeEmptyDirectories(dirs) {
12777
12923
  const unique = [...new Set(dirs)];
12778
12924
  for (const dir of unique) {
12779
- if (!fs21.existsSync(dir)) continue;
12780
- const entries = fs21.readdirSync(dir);
12925
+ if (!fs22.existsSync(dir)) continue;
12926
+ const entries = fs22.readdirSync(dir);
12781
12927
  if (entries.length === 0) {
12782
- fs21.rmdirSync(dir);
12928
+ fs22.rmdirSync(dir);
12783
12929
  console.log(
12784
12930
  chalk140.dim(
12785
12931
  ` Removed empty directory ${path41.relative(process.cwd(), dir)}`
@@ -12793,18 +12939,18 @@ function removeEmptyDirectories(dirs) {
12793
12939
  import path43 from "path";
12794
12940
 
12795
12941
  // src/commands/refactor/restructure/planFileMoves/shared.ts
12796
- import fs22 from "fs";
12942
+ import fs23 from "fs";
12797
12943
  function emptyResult() {
12798
12944
  return { moves: [], directories: [], warnings: [] };
12799
12945
  }
12800
12946
  function checkDirConflict(result, label2, dir) {
12801
- if (!fs22.existsSync(dir)) return false;
12947
+ if (!fs23.existsSync(dir)) return false;
12802
12948
  result.warnings.push(`Skipping ${label2}: directory ${dir} already exists`);
12803
12949
  return true;
12804
12950
  }
12805
12951
 
12806
12952
  // src/commands/refactor/restructure/planFileMoves/planDirectoryMoves.ts
12807
- import fs23 from "fs";
12953
+ import fs24 from "fs";
12808
12954
  import path42 from "path";
12809
12955
  function collectEntry(results, dir, entry) {
12810
12956
  const full = path42.join(dir, entry.name);
@@ -12812,9 +12958,9 @@ function collectEntry(results, dir, entry) {
12812
12958
  results.push(...items2);
12813
12959
  }
12814
12960
  function listFilesRecursive(dir) {
12815
- if (!fs23.existsSync(dir)) return [];
12961
+ if (!fs24.existsSync(dir)) return [];
12816
12962
  const results = [];
12817
- for (const entry of fs23.readdirSync(dir, { withFileTypes: true })) {
12963
+ for (const entry of fs24.readdirSync(dir, { withFileTypes: true })) {
12818
12964
  collectEntry(results, dir, entry);
12819
12965
  }
12820
12966
  return results;
@@ -13093,9 +13239,9 @@ function ensureReviewsIgnored(repoRoot) {
13093
13239
  }
13094
13240
 
13095
13241
  // src/commands/review/fetchExistingComments.ts
13096
- import { execSync as execSync40 } from "child_process";
13242
+ import { execSync as execSync41 } from "child_process";
13097
13243
  function fetchRawComments(org, repo, prNumber) {
13098
- const out = execSync40(
13244
+ const out = execSync41(
13099
13245
  `gh api --paginate repos/${org}/${repo}/pulls/${prNumber}/comments`,
13100
13246
  { encoding: "utf-8", maxBuffer: 64 * 1024 * 1024 }
13101
13247
  );
@@ -13126,14 +13272,14 @@ function fetchExistingComments() {
13126
13272
  }
13127
13273
 
13128
13274
  // src/commands/review/gatherContext.ts
13129
- import { execSync as execSync43 } from "child_process";
13275
+ import { execSync as execSync44 } from "child_process";
13130
13276
 
13131
13277
  // src/commands/review/fetchPrDiff.ts
13132
- import { execSync as execSync41 } from "child_process";
13278
+ import { execSync as execSync42 } from "child_process";
13133
13279
  function fetchPrDiff(prNumber, baseSha, headSha) {
13134
13280
  const { org, repo } = getRepoInfo();
13135
13281
  try {
13136
- return execSync41(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
13282
+ return execSync42(`gh pr diff ${prNumber} -R ${org}/${repo}`, {
13137
13283
  encoding: "utf-8",
13138
13284
  maxBuffer: 256 * 1024 * 1024,
13139
13285
  stdio: ["ignore", "pipe", "pipe"]
@@ -13148,19 +13294,19 @@ function isDiffTooLarge(error) {
13148
13294
  }
13149
13295
  function fetchDiffViaGit(baseSha, headSha) {
13150
13296
  try {
13151
- execSync41(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
13297
+ execSync42(`git fetch origin ${baseSha} ${headSha}`, { stdio: "ignore" });
13152
13298
  } catch {
13153
13299
  }
13154
- return execSync41(`git diff ${baseSha}...${headSha}`, {
13300
+ return execSync42(`git diff ${baseSha}...${headSha}`, {
13155
13301
  encoding: "utf-8",
13156
13302
  maxBuffer: 256 * 1024 * 1024
13157
13303
  });
13158
13304
  }
13159
13305
 
13160
13306
  // src/commands/review/fetchPrDiffInfo.ts
13161
- import { execSync as execSync42 } from "child_process";
13307
+ import { execSync as execSync43 } from "child_process";
13162
13308
  function getCurrentBranch2() {
13163
- return execSync42("git rev-parse --abbrev-ref HEAD", {
13309
+ return execSync43("git rev-parse --abbrev-ref HEAD", {
13164
13310
  encoding: "utf-8"
13165
13311
  }).trim();
13166
13312
  }
@@ -13170,7 +13316,7 @@ function fetchPrDiffInfo() {
13170
13316
  const fields = "number,baseRefName,baseRefOid,headRefName,headRefOid";
13171
13317
  let raw;
13172
13318
  try {
13173
- raw = execSync42(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
13319
+ raw = execSync43(`gh pr view ${branch} --json ${fields} -R ${org}/${repo}`, {
13174
13320
  encoding: "utf-8",
13175
13321
  stdio: ["ignore", "pipe", "pipe"]
13176
13322
  });
@@ -13194,7 +13340,7 @@ function fetchPrDiffInfo() {
13194
13340
  }
13195
13341
  function fetchPrChangedFiles(prNumber) {
13196
13342
  const { org, repo } = getRepoInfo();
13197
- const out = execSync42(
13343
+ const out = execSync43(
13198
13344
  `gh api repos/${org}/${repo}/pulls/${prNumber}/files --paginate --jq ".[].filename"`,
13199
13345
  {
13200
13346
  encoding: "utf-8",
@@ -13206,11 +13352,11 @@ function fetchPrChangedFiles(prNumber) {
13206
13352
 
13207
13353
  // src/commands/review/gatherContext.ts
13208
13354
  function gatherContext() {
13209
- const branch = execSync43("git rev-parse --abbrev-ref HEAD", {
13355
+ const branch = execSync44("git rev-parse --abbrev-ref HEAD", {
13210
13356
  encoding: "utf-8"
13211
13357
  }).trim();
13212
- const sha = execSync43("git rev-parse HEAD", { encoding: "utf-8" }).trim();
13213
- const shortSha = execSync43("git rev-parse --short=7 HEAD", {
13358
+ const sha = execSync44("git rev-parse HEAD", { encoding: "utf-8" }).trim();
13359
+ const shortSha = execSync44("git rev-parse --short=7 HEAD", {
13214
13360
  encoding: "utf-8"
13215
13361
  }).trim();
13216
13362
  const prInfo = fetchPrDiffInfo();
@@ -15887,6 +16033,7 @@ function registerVerify(program2) {
15887
16033
  "Write scripts to package.json instead of assist.yml"
15888
16034
  ).action(init2);
15889
16035
  verifyCommand.command("hardcoded-colors").description("Check for hardcoded hex colors in src/").action(hardcodedColors);
16036
+ verifyCommand.command("comment-policy").description("Check for undocumented comments added on changed lines").action(commentPolicy);
15890
16037
  verifyCommand.command("no-venv").description("Check that no venv folders exist in the repo").action(noVenv);
15891
16038
  }
15892
16039
 
@@ -15961,7 +16108,7 @@ import { mkdirSync as mkdirSync17 } from "fs";
15961
16108
  import { join as join47 } from "path";
15962
16109
 
15963
16110
  // src/commands/voice/checkLockFile.ts
15964
- import { execSync as execSync44 } from "child_process";
16111
+ import { execSync as execSync45 } from "child_process";
15965
16112
  import { existsSync as existsSync45, mkdirSync as mkdirSync16, readFileSync as readFileSync36, writeFileSync as writeFileSync29 } from "fs";
15966
16113
  import { join as join46 } from "path";
15967
16114
  function isProcessAlive2(pid) {
@@ -15990,7 +16137,7 @@ function bootstrapVenv() {
15990
16137
  if (existsSync45(getVenvPython())) return;
15991
16138
  console.log("Setting up Python environment...");
15992
16139
  const pythonDir = getPythonDir();
15993
- execSync44(
16140
+ execSync45(
15994
16141
  `uv sync --project "${pythonDir}" --extra runtime --no-install-project`,
15995
16142
  {
15996
16143
  stdio: "inherit",
@@ -16157,11 +16304,11 @@ import { randomBytes } from "crypto";
16157
16304
  import chalk156 from "chalk";
16158
16305
 
16159
16306
  // src/lib/openBrowser.ts
16160
- import { execSync as execSync45 } from "child_process";
16307
+ import { execSync as execSync46 } from "child_process";
16161
16308
  function tryExec(commands) {
16162
16309
  for (const cmd of commands) {
16163
16310
  try {
16164
- execSync45(cmd);
16311
+ execSync46(cmd);
16165
16312
  return true;
16166
16313
  } catch {
16167
16314
  }
@@ -16511,11 +16658,11 @@ function resolveParams(params, cliArgs) {
16511
16658
  }
16512
16659
 
16513
16660
  // src/commands/run/runPreCommands.ts
16514
- import { execSync as execSync46 } from "child_process";
16661
+ import { execSync as execSync47 } from "child_process";
16515
16662
  function runPreCommands(pre, cwd) {
16516
16663
  for (const cmd of pre) {
16517
16664
  try {
16518
- execSync46(cmd, { stdio: "inherit", cwd });
16665
+ execSync47(cmd, { stdio: "inherit", cwd });
16519
16666
  } catch (err) {
16520
16667
  const code = err && typeof err === "object" && "status" in err ? err.status : 1;
16521
16668
  process.exit(code);
@@ -16799,7 +16946,7 @@ function registerRun(program2) {
16799
16946
  }
16800
16947
 
16801
16948
  // src/commands/screenshot/index.ts
16802
- import { execSync as execSync47 } from "child_process";
16949
+ import { execSync as execSync48 } from "child_process";
16803
16950
  import { existsSync as existsSync50, mkdirSync as mkdirSync20, unlinkSync as unlinkSync16, writeFileSync as writeFileSync32 } from "fs";
16804
16951
  import { tmpdir as tmpdir7 } from "os";
16805
16952
  import { join as join53, resolve as resolve13 } from "path";
@@ -16942,7 +17089,7 @@ function runPowerShellScript(processName, outputPath) {
16942
17089
  const scriptPath = join53(tmpdir7(), `assist-screenshot-${Date.now()}.ps1`);
16943
17090
  writeFileSync32(scriptPath, captureWindowPs1, "utf-8");
16944
17091
  try {
16945
- execSync47(
17092
+ execSync48(
16946
17093
  `powershell -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}" -ProcessName "${processName}" -OutputPath "${outputPath}"`,
16947
17094
  { stdio: ["ignore", "pipe", "pipe"], encoding: "utf-8" }
16948
17095
  );
@@ -17137,12 +17284,12 @@ function daemonLog(message) {
17137
17284
  }
17138
17285
 
17139
17286
  // src/commands/sessions/shared/discoverSessions.ts
17140
- import * as fs25 from "fs";
17287
+ import * as fs26 from "fs";
17141
17288
  import * as os from "os";
17142
17289
  import * as path46 from "path";
17143
17290
 
17144
17291
  // src/commands/sessions/shared/parseSessionFile.ts
17145
- import * as fs24 from "fs";
17292
+ import * as fs25 from "fs";
17146
17293
  import * as path45 from "path";
17147
17294
 
17148
17295
  // src/commands/sessions/shared/extractSessionMeta.ts
@@ -17182,13 +17329,13 @@ function extractName(entry) {
17182
17329
  async function parseSessionFile(filePath) {
17183
17330
  let handle;
17184
17331
  try {
17185
- handle = await fs24.promises.open(filePath, "r");
17332
+ handle = await fs25.promises.open(filePath, "r");
17186
17333
  const buf = Buffer.alloc(16384);
17187
17334
  const { bytesRead } = await handle.read(buf, 0, buf.length, 0);
17188
17335
  const lines = buf.toString("utf8", 0, bytesRead).split("\n").filter(Boolean);
17189
17336
  const meta = extractSessionMeta(lines);
17190
17337
  if (!meta.sessionId) return null;
17191
- const timestamp = meta.timestamp || (await fs24.promises.stat(filePath)).mtime.toISOString();
17338
+ const timestamp = meta.timestamp || (await fs25.promises.stat(filePath)).mtime.toISOString();
17192
17339
  const project = meta.cwd ? path45.basename(meta.cwd) : dirNameToProject(filePath);
17193
17340
  return {
17194
17341
  sessionId: meta.sessionId,
@@ -17214,7 +17361,7 @@ async function discoverSessionJsonlPaths() {
17214
17361
  const projectsDir = path46.join(os.homedir(), ".claude", "projects");
17215
17362
  let projectDirs;
17216
17363
  try {
17217
- projectDirs = await fs25.promises.readdir(projectsDir);
17364
+ projectDirs = await fs26.promises.readdir(projectsDir);
17218
17365
  } catch {
17219
17366
  return [];
17220
17367
  }
@@ -17224,7 +17371,7 @@ async function discoverSessionJsonlPaths() {
17224
17371
  const dirPath = path46.join(projectsDir, dirName);
17225
17372
  let entries;
17226
17373
  try {
17227
- entries = await fs25.promises.readdir(dirPath);
17374
+ entries = await fs26.promises.readdir(dirPath);
17228
17375
  } catch {
17229
17376
  return;
17230
17377
  }
@@ -17663,7 +17810,7 @@ function shutdownSessions(sessions) {
17663
17810
  }
17664
17811
 
17665
17812
  // src/commands/sessions/daemon/discoverClaudeSessionId.ts
17666
- import * as fs26 from "fs";
17813
+ import * as fs27 from "fs";
17667
17814
  import * as path48 from "path";
17668
17815
  var POLL_MS = 3e3;
17669
17816
  async function discoverClaudeSessionId(options2) {
@@ -17687,7 +17834,7 @@ async function findNewSessionId(options2) {
17687
17834
  }
17688
17835
  async function isCreatedSince(filePath, sinceMs) {
17689
17836
  try {
17690
- const stat = await fs26.promises.stat(filePath);
17837
+ const stat = await fs27.promises.stat(filePath);
17691
17838
  return (stat.birthtimeMs || stat.mtimeMs) >= sinceMs;
17692
17839
  } catch {
17693
17840
  return false;
@@ -17740,6 +17887,7 @@ function dismissSession(sessions, id) {
17740
17887
  clearIdle(s);
17741
17888
  s.activityWatcher?.close();
17742
17889
  removeActivity(s.id);
17890
+ if (s.activity?.itemId != null) releaseLock(s.activity.itemId);
17743
17891
  sessions.delete(id);
17744
17892
  return true;
17745
17893
  }
@@ -18064,17 +18212,17 @@ function registerDaemon(program2) {
18064
18212
  }
18065
18213
 
18066
18214
  // src/commands/sessions/summarise/index.ts
18067
- import * as fs29 from "fs";
18215
+ import * as fs30 from "fs";
18068
18216
  import chalk158 from "chalk";
18069
18217
 
18070
18218
  // src/commands/sessions/summarise/shared.ts
18071
- import * as fs27 from "fs";
18219
+ import * as fs28 from "fs";
18072
18220
  function writeSummary(jsonlPath2, summary) {
18073
- fs27.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
18221
+ fs28.writeFileSync(summaryPathFor(jsonlPath2), `${summary.trim()}
18074
18222
  `, "utf8");
18075
18223
  }
18076
18224
  function hasSummary(jsonlPath2) {
18077
- return fs27.existsSync(summaryPathFor(jsonlPath2));
18225
+ return fs28.existsSync(summaryPathFor(jsonlPath2));
18078
18226
  }
18079
18227
  function summaryPathFor(jsonlPath2) {
18080
18228
  return jsonlPath2.replace(/\.jsonl$/, ".summary");
@@ -18084,17 +18232,17 @@ function summaryPathFor(jsonlPath2) {
18084
18232
  import { execFileSync as execFileSync10 } from "child_process";
18085
18233
 
18086
18234
  // src/commands/sessions/summarise/iterateUserMessages.ts
18087
- import * as fs28 from "fs";
18235
+ import * as fs29 from "fs";
18088
18236
  function* iterateUserMessages(filePath, maxBytes = 65536) {
18089
18237
  let content;
18090
18238
  try {
18091
- const fd = fs28.openSync(filePath, "r");
18239
+ const fd = fs29.openSync(filePath, "r");
18092
18240
  try {
18093
18241
  const buf = Buffer.alloc(maxBytes);
18094
- const bytesRead = fs28.readSync(fd, buf, 0, buf.length, 0);
18242
+ const bytesRead = fs29.readSync(fd, buf, 0, buf.length, 0);
18095
18243
  content = buf.toString("utf8", 0, bytesRead);
18096
18244
  } finally {
18097
- fs28.closeSync(fd);
18245
+ fs29.closeSync(fd);
18098
18246
  }
18099
18247
  } catch {
18100
18248
  return;
@@ -18214,7 +18362,7 @@ function selectCandidates(files, options2) {
18214
18362
  const candidates = options2.force ? files : files.filter((f) => !hasSummary(f));
18215
18363
  candidates.sort((a, b) => {
18216
18364
  try {
18217
- return fs29.statSync(b).mtimeMs - fs29.statSync(a).mtimeMs;
18365
+ return fs30.statSync(b).mtimeMs - fs30.statSync(a).mtimeMs;
18218
18366
  } catch {
18219
18367
  return 0;
18220
18368
  }
@@ -18328,21 +18476,21 @@ async function statusLine() {
18328
18476
  }
18329
18477
 
18330
18478
  // src/commands/sync.ts
18331
- import * as fs32 from "fs";
18479
+ import * as fs33 from "fs";
18332
18480
  import * as os2 from "os";
18333
18481
  import * as path51 from "path";
18334
18482
  import { fileURLToPath as fileURLToPath7 } from "url";
18335
18483
 
18336
18484
  // src/commands/sync/syncClaudeMd.ts
18337
- import * as fs30 from "fs";
18485
+ import * as fs31 from "fs";
18338
18486
  import * as path49 from "path";
18339
18487
  import chalk161 from "chalk";
18340
18488
  async function syncClaudeMd(claudeDir, targetBase, options2) {
18341
18489
  const source = path49.join(claudeDir, "CLAUDE.md");
18342
18490
  const target = path49.join(targetBase, "CLAUDE.md");
18343
- const sourceContent = fs30.readFileSync(source, "utf-8");
18344
- if (fs30.existsSync(target)) {
18345
- const targetContent = fs30.readFileSync(target, "utf-8");
18491
+ const sourceContent = fs31.readFileSync(source, "utf-8");
18492
+ if (fs31.existsSync(target)) {
18493
+ const targetContent = fs31.readFileSync(target, "utf-8");
18346
18494
  if (sourceContent !== targetContent) {
18347
18495
  console.log(
18348
18496
  chalk161.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
@@ -18359,21 +18507,21 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
18359
18507
  }
18360
18508
  }
18361
18509
  }
18362
- fs30.copyFileSync(source, target);
18510
+ fs31.copyFileSync(source, target);
18363
18511
  console.log("Copied CLAUDE.md to ~/.claude/CLAUDE.md");
18364
18512
  }
18365
18513
 
18366
18514
  // src/commands/sync/syncSettings.ts
18367
- import * as fs31 from "fs";
18515
+ import * as fs32 from "fs";
18368
18516
  import * as path50 from "path";
18369
18517
  import chalk162 from "chalk";
18370
18518
  async function syncSettings(claudeDir, targetBase, options2) {
18371
18519
  const source = path50.join(claudeDir, "settings.json");
18372
18520
  const target = path50.join(targetBase, "settings.json");
18373
- const sourceContent = fs31.readFileSync(source, "utf-8");
18521
+ const sourceContent = fs32.readFileSync(source, "utf-8");
18374
18522
  const mergedContent = JSON.stringify(JSON.parse(sourceContent), null, " ");
18375
- if (fs31.existsSync(target)) {
18376
- const targetContent = fs31.readFileSync(target, "utf-8");
18523
+ if (fs32.existsSync(target)) {
18524
+ const targetContent = fs32.readFileSync(target, "utf-8");
18377
18525
  const normalizedTarget = JSON.stringify(
18378
18526
  JSON.parse(targetContent),
18379
18527
  null,
@@ -18399,7 +18547,7 @@ async function syncSettings(claudeDir, targetBase, options2) {
18399
18547
  }
18400
18548
  }
18401
18549
  }
18402
- fs31.writeFileSync(target, mergedContent);
18550
+ fs32.writeFileSync(target, mergedContent);
18403
18551
  console.log("Copied settings.json to ~/.claude/settings.json");
18404
18552
  }
18405
18553
 
@@ -18418,17 +18566,17 @@ async function sync(options2) {
18418
18566
  function syncCommands(claudeDir, targetBase) {
18419
18567
  const sourceDir = path51.join(claudeDir, "commands");
18420
18568
  const targetDir = path51.join(targetBase, "commands");
18421
- fs32.mkdirSync(targetDir, { recursive: true });
18422
- const files = fs32.readdirSync(sourceDir);
18569
+ fs33.mkdirSync(targetDir, { recursive: true });
18570
+ const files = fs33.readdirSync(sourceDir);
18423
18571
  for (const file of files) {
18424
- fs32.copyFileSync(path51.join(sourceDir, file), path51.join(targetDir, file));
18572
+ fs33.copyFileSync(path51.join(sourceDir, file), path51.join(targetDir, file));
18425
18573
  console.log(`Copied ${file} to ${targetDir}`);
18426
18574
  }
18427
18575
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
18428
18576
  }
18429
18577
 
18430
18578
  // src/commands/update.ts
18431
- import { execSync as execSync48 } from "child_process";
18579
+ import { execSync as execSync49 } from "child_process";
18432
18580
  import * as path52 from "path";
18433
18581
  function isGlobalNpmInstall(dir) {
18434
18582
  try {
@@ -18436,7 +18584,7 @@ function isGlobalNpmInstall(dir) {
18436
18584
  if (resolved.split(path52.sep).includes("node_modules")) {
18437
18585
  return true;
18438
18586
  }
18439
- const globalPrefix = execSync48("npm prefix -g", { stdio: "pipe" }).toString().trim();
18587
+ const globalPrefix = execSync49("npm prefix -g", { stdio: "pipe" }).toString().trim();
18440
18588
  return resolved.toLowerCase().startsWith(path52.resolve(globalPrefix).toLowerCase());
18441
18589
  } catch {
18442
18590
  return false;
@@ -18447,18 +18595,18 @@ async function update2() {
18447
18595
  console.log(`Assist is installed at: ${installDir}`);
18448
18596
  if (isGitRepo(installDir)) {
18449
18597
  console.log("Detected git repo installation, pulling latest...");
18450
- execSync48("git pull", { cwd: installDir, stdio: "inherit" });
18598
+ execSync49("git pull", { cwd: installDir, stdio: "inherit" });
18451
18599
  console.log("Installing dependencies...");
18452
- execSync48("npm i", { cwd: installDir, stdio: "inherit" });
18600
+ execSync49("npm i", { cwd: installDir, stdio: "inherit" });
18453
18601
  console.log("Building...");
18454
- execSync48("npm run build", { cwd: installDir, stdio: "inherit" });
18602
+ execSync49("npm run build", { cwd: installDir, stdio: "inherit" });
18455
18603
  console.log("Syncing commands...");
18456
- execSync48("assist sync", { stdio: "inherit" });
18604
+ execSync49("assist sync", { stdio: "inherit" });
18457
18605
  } else if (isGlobalNpmInstall(installDir)) {
18458
18606
  console.log("Detected global npm installation, updating...");
18459
- execSync48("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
18607
+ execSync49("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
18460
18608
  console.log("Syncing commands...");
18461
- execSync48("assist sync", { stdio: "inherit" });
18609
+ execSync49("assist sync", { stdio: "inherit" });
18462
18610
  } else {
18463
18611
  console.error(
18464
18612
  "Could not determine installation method. Expected a git repo or global npm install."