claudekit-cli 3.41.4-dev.49 → 3.41.4-dev.50

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
@@ -51181,9 +51181,87 @@ var init_skill_directory_installer = __esm(() => {
51181
51181
 
51182
51182
  // src/commands/portable/config-discovery.ts
51183
51183
  import { existsSync as existsSync22 } from "node:fs";
51184
- import { readFile as readFile19, readdir as readdir10 } from "node:fs/promises";
51184
+ import { cp as cp2, mkdir as mkdir9, readFile as readFile19, readdir as readdir10, stat as stat7 } from "node:fs/promises";
51185
51185
  import { homedir as homedir24 } from "node:os";
51186
- import { extname as extname3, join as join36, relative as relative7, sep as sep3 } from "node:path";
51186
+ import { basename as basename10, extname as extname3, join as join36, relative as relative7, resolve as resolve11, sep as sep3 } from "node:path";
51187
+ async function copyHooksCompanionDirs(sourceDir, targetDir) {
51188
+ const result = {
51189
+ copiedDirs: [],
51190
+ copiedDotfiles: [],
51191
+ errors: []
51192
+ };
51193
+ if (resolve11(sourceDir) === resolve11(targetDir)) {
51194
+ return result;
51195
+ }
51196
+ if (!existsSync22(sourceDir)) {
51197
+ return result;
51198
+ }
51199
+ let entries;
51200
+ try {
51201
+ entries = await readdir10(sourceDir, { withFileTypes: true, encoding: "utf8" });
51202
+ } catch {
51203
+ return result;
51204
+ }
51205
+ try {
51206
+ await mkdir9(targetDir, { recursive: true });
51207
+ } catch (err) {
51208
+ result.errors.push({
51209
+ name: targetDir,
51210
+ error: err instanceof Error ? err.message : String(err)
51211
+ });
51212
+ return result;
51213
+ }
51214
+ const sourceParent = resolve11(sourceDir, "..");
51215
+ const targetParent = resolve11(targetDir, "..");
51216
+ if (sourceParent !== targetParent) {
51217
+ for (const dotfile of HOOKS_COMPANION_DOTFILES) {
51218
+ const srcPath = join36(sourceParent, dotfile);
51219
+ if (!existsSync22(srcPath))
51220
+ continue;
51221
+ const dstPath = join36(targetParent, dotfile);
51222
+ try {
51223
+ await mkdir9(targetParent, { recursive: true });
51224
+ await cp2(srcPath, dstPath, { force: true });
51225
+ result.copiedDotfiles.push(dotfile);
51226
+ } catch (err) {
51227
+ result.errors.push({
51228
+ name: dotfile,
51229
+ error: err instanceof Error ? err.message : String(err)
51230
+ });
51231
+ }
51232
+ }
51233
+ }
51234
+ for (const entry of entries) {
51235
+ if (!entry.isDirectory())
51236
+ continue;
51237
+ if (entry.name.startsWith(".") || HOOKS_SKIP_DIR_NAMES.has(entry.name))
51238
+ continue;
51239
+ const safeName = basename10(entry.name);
51240
+ if (!safeName || safeName === "." || safeName === ".." || safeName !== entry.name)
51241
+ continue;
51242
+ const srcDir = join36(sourceDir, entry.name);
51243
+ const dstDir = join36(targetDir, entry.name);
51244
+ if (resolve11(srcDir) === resolve11(dstDir))
51245
+ continue;
51246
+ try {
51247
+ const s = await stat7(srcDir);
51248
+ if (!s.isDirectory())
51249
+ continue;
51250
+ } catch {
51251
+ continue;
51252
+ }
51253
+ try {
51254
+ await cp2(srcDir, dstDir, { recursive: true, force: true });
51255
+ result.copiedDirs.push(entry.name);
51256
+ } catch (err) {
51257
+ result.errors.push({
51258
+ name: entry.name,
51259
+ error: err instanceof Error ? err.message : String(err)
51260
+ });
51261
+ }
51262
+ }
51263
+ return result;
51264
+ }
51187
51265
  function resolveSourceOrigin(sourcePath) {
51188
51266
  if (!sourcePath)
51189
51267
  return "global";
@@ -51318,11 +51396,13 @@ async function discoverPortableFiles(dir, baseDir, options2) {
51318
51396
  }
51319
51397
  return items;
51320
51398
  }
51321
- var HOOK_EXTENSIONS, SHELL_HOOK_EXTENSIONS;
51399
+ var HOOK_EXTENSIONS, SHELL_HOOK_EXTENSIONS, HOOKS_SKIP_DIR_NAMES, HOOKS_COMPANION_DOTFILES;
51322
51400
  var init_config_discovery = __esm(() => {
51323
51401
  init_kit_layout();
51324
51402
  HOOK_EXTENSIONS = new Set([".js", ".cjs", ".mjs", ".ts"]);
51325
51403
  SHELL_HOOK_EXTENSIONS = new Set([".sh", ".ps1", ".bat", ".cmd"]);
51404
+ HOOKS_SKIP_DIR_NAMES = new Set(["__tests__", "tests", ".logs", "docs"]);
51405
+ HOOKS_COMPANION_DOTFILES = new Set([".ckignore"]);
51326
51406
  });
51327
51407
 
51328
51408
  // node_modules/semver/internal/constants.js
@@ -53211,19 +53291,19 @@ var init_codex_capabilities = __esm(() => {
53211
53291
 
53212
53292
  // src/commands/portable/codex-path-safety.ts
53213
53293
  import { existsSync as existsSync23 } from "node:fs";
53214
- import { mkdir as mkdir9, realpath as realpath3 } from "node:fs/promises";
53294
+ import { mkdir as mkdir10, realpath as realpath3 } from "node:fs/promises";
53215
53295
  import { homedir as homedir25 } from "node:os";
53216
- import { dirname as dirname9, join as join37, resolve as resolve11, sep as sep4 } from "node:path";
53296
+ import { dirname as dirname9, join as join37, resolve as resolve12, sep as sep4 } from "node:path";
53217
53297
  function isPathWithinBoundary3(targetPath, boundaryPath) {
53218
- const resolvedTarget = resolve11(targetPath);
53219
- const resolvedBoundary = resolve11(boundaryPath);
53298
+ const resolvedTarget = resolve12(targetPath);
53299
+ const resolvedBoundary = resolve12(boundaryPath);
53220
53300
  return resolvedTarget === resolvedBoundary || resolvedTarget.startsWith(`${resolvedBoundary}${sep4}`);
53221
53301
  }
53222
53302
  async function resolveRealPathSafe2(path3) {
53223
53303
  try {
53224
53304
  return await realpath3(path3);
53225
53305
  } catch {
53226
- return resolve11(path3);
53306
+ return resolve12(path3);
53227
53307
  }
53228
53308
  }
53229
53309
  async function isCanonicalPathWithinBoundary2(targetPath, boundaryPath) {
@@ -53232,13 +53312,13 @@ async function isCanonicalPathWithinBoundary2(targetPath, boundaryPath) {
53232
53312
  return isPathWithinBoundary3(canonicalTarget, canonicalBoundary);
53233
53313
  }
53234
53314
  function getCodexLockPath2(targetFilePath) {
53235
- return join37(dirname9(resolve11(targetFilePath)), ".config.toml.ck-codex.lock");
53315
+ return join37(dirname9(resolve12(targetFilePath)), ".config.toml.ck-codex.lock");
53236
53316
  }
53237
53317
  async function withCodexTargetLock2(targetFilePath, operation) {
53238
- const resolvedTargetPath = resolve11(targetFilePath);
53318
+ const resolvedTargetPath = resolve12(targetFilePath);
53239
53319
  const dir = dirname9(resolvedTargetPath);
53240
53320
  if (!existsSync23(dir)) {
53241
- await mkdir9(dir, { recursive: true });
53321
+ await mkdir10(dir, { recursive: true });
53242
53322
  }
53243
53323
  const release = await import_proper_lockfile4.default.lock(dir, {
53244
53324
  realpath: false,
@@ -53269,10 +53349,10 @@ var init_codex_path_safety = __esm(() => {
53269
53349
  // src/commands/portable/codex-features-flag.ts
53270
53350
  import { existsSync as existsSync24 } from "node:fs";
53271
53351
  import { readFile as readFile20, rename as rename6, unlink as unlink6, writeFile as writeFile11 } from "node:fs/promises";
53272
- import { dirname as dirname10, resolve as resolve12 } from "node:path";
53352
+ import { dirname as dirname10, resolve as resolve13 } from "node:path";
53273
53353
  async function ensureCodexHooksFeatureFlag(configTomlPath, isGlobal = false) {
53274
- const boundary = isGlobal ? getCodexGlobalBoundary() : dirname10(resolve12(configTomlPath));
53275
- if (!await isCanonicalPathWithinBoundary2(dirname10(resolve12(configTomlPath)), boundary)) {
53354
+ const boundary = isGlobal ? getCodexGlobalBoundary() : dirname10(resolve13(configTomlPath));
53355
+ if (!await isCanonicalPathWithinBoundary2(dirname10(resolve13(configTomlPath)), boundary)) {
53276
53356
  return {
53277
53357
  status: "failed",
53278
53358
  configPath: configTomlPath,
@@ -53431,16 +53511,16 @@ ${SENTINEL_END2}`;
53431
53511
  // src/commands/portable/codex-hook-wrapper.ts
53432
53512
  import { createHash as createHash4 } from "node:crypto";
53433
53513
  import { mkdirSync, writeFileSync as writeFileSync2 } from "node:fs";
53434
- import { dirname as dirname11, join as join38, resolve as resolve13 } from "node:path";
53514
+ import { dirname as dirname11, join as join38, resolve as resolve14 } from "node:path";
53435
53515
  function wrapperFilename(originalPath) {
53436
- const abs = resolve13(originalPath);
53516
+ const abs = resolve14(originalPath);
53437
53517
  const hash = createHash4("sha256").update(abs).digest("hex").slice(0, 8);
53438
53518
  const base = abs.split(/[\\/]/).pop() ?? "hook.cjs";
53439
53519
  return `${hash}-${base}`;
53440
53520
  }
53441
53521
  function generateCodexHookWrappers(originalPaths, wrapperDir, capabilities, timeoutsByPath) {
53442
53522
  const results = [];
53443
- const resolvedWrapperDir = resolve13(wrapperDir);
53523
+ const resolvedWrapperDir = resolve14(wrapperDir);
53444
53524
  for (const originalPath of originalPaths) {
53445
53525
  const filename = wrapperFilename(originalPath);
53446
53526
  const wrapperPath = join38(resolvedWrapperDir, filename);
@@ -53455,7 +53535,7 @@ function generateCodexHookWrappers(originalPaths, wrapperDir, capabilities, time
53455
53535
  }
53456
53536
  try {
53457
53537
  mkdirSync(dirname11(wrapperPath), { recursive: true });
53458
- const resolvedPath = resolve13(originalPath);
53538
+ const resolvedPath = resolve14(originalPath);
53459
53539
  const hookTimeoutMs = timeoutsByPath?.[resolvedPath] ?? timeoutsByPath?.[originalPath];
53460
53540
  const content = buildWrapperScript(originalPath, capabilities, hookTimeoutMs);
53461
53541
  writeFileSync2(wrapperPath, content, { mode: 493 });
@@ -53729,9 +53809,9 @@ var init_gemini_hook_event_map = __esm(() => {
53729
53809
 
53730
53810
  // src/commands/portable/hooks-settings-merger.ts
53731
53811
  import { existsSync as existsSync25 } from "node:fs";
53732
- import { mkdir as mkdir10, readFile as readFile21, rename as rename7, rm as rm5, writeFile as writeFile12 } from "node:fs/promises";
53812
+ import { mkdir as mkdir11, readFile as readFile21, rename as rename7, rm as rm5, writeFile as writeFile12 } from "node:fs/promises";
53733
53813
  import { homedir as homedir27 } from "node:os";
53734
- import { basename as basename10, dirname as dirname12, join as join39, resolve as resolve14 } from "node:path";
53814
+ import { basename as basename11, dirname as dirname12, join as join39, resolve as resolve15 } from "node:path";
53735
53815
  function validateHooksSectionShape(value) {
53736
53816
  if (!value || typeof value !== "object" || Array.isArray(value)) {
53737
53817
  return "hooks must be a non-null object";
@@ -53856,7 +53936,7 @@ function extractFilenameFromCommand(command) {
53856
53936
  for (const token of tokens) {
53857
53937
  const clean = token.replace(/["']/g, "");
53858
53938
  if (/\.\w+$/.test(clean))
53859
- return basename10(clean);
53939
+ return basename11(clean);
53860
53940
  }
53861
53941
  return null;
53862
53942
  }
@@ -53882,7 +53962,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks) {
53882
53962
  const merged = deduplicateMerge(existingHooks, newHooks);
53883
53963
  existingSettings.hooks = merged;
53884
53964
  const dir = dirname12(targetSettingsPath);
53885
- await mkdir10(dir, { recursive: true });
53965
+ await mkdir11(dir, { recursive: true });
53886
53966
  const tempPath = `${targetSettingsPath}.tmp`;
53887
53967
  try {
53888
53968
  await writeFile12(tempPath, JSON.stringify(existingSettings, null, 2), "utf8");
@@ -54168,10 +54248,10 @@ async function migrateHooksSettingsForCodex(options2) {
54168
54248
  if (wr.success) {
54169
54249
  wrapperPaths.push(wr.wrapperPath);
54170
54250
  const addKey = (p) => commandSubstitutions.set(p, wr.wrapperPath);
54171
- const base = basename10(wr.originalPath);
54251
+ const base = basename11(wr.originalPath);
54172
54252
  addKey(wr.originalPath);
54173
54253
  if (sourceHooksDir) {
54174
- const sourceAbs = join39(resolve14(sourceHooksDir), base);
54254
+ const sourceAbs = join39(resolve15(sourceHooksDir), base);
54175
54255
  addKey(sourceAbs);
54176
54256
  if (sourceAbs.startsWith("/private/")) {
54177
54257
  addKey(sourceAbs.slice("/private".length));
@@ -54527,9 +54607,9 @@ function buildTypeDirectoryStates(providerConfigs, types4) {
54527
54607
  });
54528
54608
  continue;
54529
54609
  }
54530
- let stat7 = null;
54610
+ let stat8 = null;
54531
54611
  try {
54532
- stat7 = statSync5(dirPath);
54612
+ stat8 = statSync5(dirPath);
54533
54613
  } catch {
54534
54614
  results.push({
54535
54615
  provider,
@@ -54542,7 +54622,7 @@ function buildTypeDirectoryStates(providerConfigs, types4) {
54542
54622
  });
54543
54623
  continue;
54544
54624
  }
54545
- if (!stat7.isDirectory()) {
54625
+ if (!stat8.isDirectory()) {
54546
54626
  results.push({
54547
54627
  provider,
54548
54628
  type,
@@ -55397,7 +55477,7 @@ __export(exports_skills_discovery, {
55397
55477
  discoverSkillsEnriched: () => discoverSkillsEnriched,
55398
55478
  discoverSkills: () => discoverSkills
55399
55479
  });
55400
- import { readFile as readFile24, readdir as readdir11, stat as stat7 } from "node:fs/promises";
55480
+ import { readFile as readFile24, readdir as readdir11, stat as stat8 } from "node:fs/promises";
55401
55481
  import { homedir as homedir28 } from "node:os";
55402
55482
  import { dirname as dirname13, join as join40 } from "node:path";
55403
55483
  function getSkillSourcePath() {
@@ -55412,7 +55492,7 @@ function getSkillSourcePath() {
55412
55492
  async function hasSkillMd(dir) {
55413
55493
  try {
55414
55494
  const skillPath = join40(dir, "SKILL.md");
55415
- const stats = await stat7(skillPath);
55495
+ const stats = await stat8(skillPath);
55416
55496
  return stats.isFile();
55417
55497
  } catch {
55418
55498
  return false;
@@ -55629,7 +55709,7 @@ var init_migration_result_utils = __esm(() => {
55629
55709
  import { existsSync as existsSync28 } from "node:fs";
55630
55710
  import { readFile as readFile25, rm as rm6 } from "node:fs/promises";
55631
55711
  import { homedir as homedir29 } from "node:os";
55632
- import { basename as basename11, join as join41, resolve as resolve15 } from "node:path";
55712
+ import { basename as basename12, join as join41, resolve as resolve16 } from "node:path";
55633
55713
  function isDisallowedControlCode(codePoint) {
55634
55714
  return codePoint >= 0 && codePoint <= 8 || codePoint >= 11 && codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
55635
55715
  }
@@ -55779,8 +55859,8 @@ function parseConfigSource(input) {
55779
55859
  if (!trimmed) {
55780
55860
  return { ok: true, value: undefined };
55781
55861
  }
55782
- const projectSourcePath = resolve15(process.cwd(), "CLAUDE.md");
55783
- const globalSourcePath = resolve15(getGlobalConfigSourcePath());
55862
+ const projectSourcePath = resolve16(process.cwd(), "CLAUDE.md");
55863
+ const globalSourcePath = resolve16(getGlobalConfigSourcePath());
55784
55864
  const sourceMap = {
55785
55865
  default: undefined,
55786
55866
  global: globalSourcePath,
@@ -55791,7 +55871,7 @@ function parseConfigSource(input) {
55791
55871
  if (normalizedKey in sourceMap) {
55792
55872
  return { ok: true, value: sourceMap[normalizedKey] };
55793
55873
  }
55794
- const resolved = resolve15(trimmed);
55874
+ const resolved = resolve16(trimmed);
55795
55875
  if (resolved === globalSourcePath || resolved === projectSourcePath) {
55796
55876
  return { ok: true, value: resolved };
55797
55877
  }
@@ -55859,7 +55939,7 @@ function shouldExecuteAction(action) {
55859
55939
  }
55860
55940
  async function executePlanDeleteAction(action, options2) {
55861
55941
  const preservePaths = options2?.preservePaths ?? new Set;
55862
- const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve15(action.targetPath));
55942
+ const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve16(action.targetPath));
55863
55943
  try {
55864
55944
  if (!shouldPreserveTarget && action.targetPath && existsSync28(action.targetPath)) {
55865
55945
  await rm6(action.targetPath, { recursive: true, force: true });
@@ -56661,11 +56741,11 @@ function registerMigrationRoutes(app) {
56661
56741
  files: [],
56662
56742
  global: action.global
56663
56743
  };
56664
- entry.files.push(basename11(r2.path));
56744
+ entry.files.push(basename12(r2.path));
56665
56745
  successfulHookFiles2.set(provider, entry);
56666
56746
  if (r2.path.length > 0) {
56667
56747
  const absEntry = successfulHookAbsPaths2.get(provider) ?? [];
56668
- absEntry.push(resolve15(r2.path));
56748
+ absEntry.push(resolve16(r2.path));
56669
56749
  successfulHookAbsPaths2.set(provider, absEntry);
56670
56750
  }
56671
56751
  }
@@ -56700,7 +56780,7 @@ function registerMigrationRoutes(app) {
56700
56780
  }
56701
56781
  }
56702
56782
  }
56703
- const writtenPaths = new Set(allResults.filter((r2) => r2.success && !r2.skipped && r2.path.length > 0).map((r2) => resolve15(r2.path)));
56783
+ const writtenPaths = new Set(allResults.filter((r2) => r2.success && !r2.skipped && r2.path.length > 0).map((r2) => resolve16(r2.path)));
56704
56784
  for (const deleteAction of deleteActions) {
56705
56785
  const deleteResult = await executePlanDeleteAction(deleteAction, {
56706
56786
  preservePaths: writtenPaths
@@ -56728,7 +56808,7 @@ function registerMigrationRoutes(app) {
56728
56808
  });
56729
56809
  if (staleSlugs.length > 0) {
56730
56810
  const staleSlugSet = new Set(staleSlugs.map((s) => `${s}.toml`));
56731
- await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === scope && staleSlugSet.has(basename11(i.path)));
56811
+ await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === scope && staleSlugSet.has(basename12(i.path)));
56732
56812
  }
56733
56813
  }
56734
56814
  }
@@ -56736,7 +56816,7 @@ function registerMigrationRoutes(app) {
56736
56816
  const agentSrc = getAgentSourcePath();
56737
56817
  const cmdSrc = getCommandSourcePath();
56738
56818
  const skillSrc = getSkillSourcePath();
56739
- const kitRoot = (agentSrc ? resolve15(agentSrc, "..") : null) ?? (cmdSrc ? resolve15(cmdSrc, "..") : null) ?? (skillSrc ? resolve15(skillSrc, "..") : null) ?? null;
56819
+ const kitRoot = (agentSrc ? resolve16(agentSrc, "..") : null) ?? (cmdSrc ? resolve16(cmdSrc, "..") : null) ?? (skillSrc ? resolve16(skillSrc, "..") : null) ?? null;
56740
56820
  const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
56741
56821
  if (manifest?.cliVersion) {
56742
56822
  await updateAppliedManifestVersion(manifest.cliVersion);
@@ -56891,11 +56971,11 @@ function registerMigrationRoutes(app) {
56891
56971
  tagResults(batch, "hooks", hook.name);
56892
56972
  for (const result of batch.filter((entry) => entry.success && !entry.skipped)) {
56893
56973
  const existing = successfulHookFiles.get(result.provider) ?? [];
56894
- existing.push(basename11(result.path));
56974
+ existing.push(basename12(result.path));
56895
56975
  successfulHookFiles.set(result.provider, existing);
56896
56976
  if (result.path.length > 0) {
56897
56977
  const absExisting = successfulHookAbsPaths.get(result.provider) ?? [];
56898
- absExisting.push(resolve15(result.path));
56978
+ absExisting.push(resolve16(result.path));
56899
56979
  successfulHookAbsPaths.set(result.provider, absExisting);
56900
56980
  }
56901
56981
  }
@@ -57145,7 +57225,7 @@ var init_plan_metadata = __esm(() => {
57145
57225
 
57146
57226
  // src/domains/plan-parser/plan-table-parser.ts
57147
57227
  import { readFileSync as readFileSync7 } from "node:fs";
57148
- import { dirname as dirname14, resolve as resolve16 } from "node:path";
57228
+ import { dirname as dirname14, resolve as resolve17 } from "node:path";
57149
57229
  function normalizeStatus(raw) {
57150
57230
  const s = raw.toLowerCase().trim();
57151
57231
  if (s.includes("complete") || s.includes("done") || s.includes("✓") || s.includes("✅")) {
@@ -57228,7 +57308,7 @@ function parseHeaderAwareTable(content, dir, options2) {
57228
57308
  hasLinks = true;
57229
57309
  linkText = linkMatch[1].trim();
57230
57310
  name = filenameToTitle(linkText);
57231
- file = resolve16(dir, linkMatch[2]);
57311
+ file = resolve17(dir, linkMatch[2]);
57232
57312
  } else {
57233
57313
  name = nameRaw.replace(/\[.*?\]\(.*?\)/g, "").trim() || `Phase ${phaseId}`;
57234
57314
  linkText = name;
@@ -57268,7 +57348,7 @@ function parseFormat1(content, dir, options2) {
57268
57348
  phaseId,
57269
57349
  name: name.trim(),
57270
57350
  status: normalizeStatus(status),
57271
- file: resolve16(dir, linkPath),
57351
+ file: resolve17(dir, linkPath),
57272
57352
  linkText: linkText.trim(),
57273
57353
  anchor
57274
57354
  });
@@ -57288,7 +57368,7 @@ function parseFormat2(content, dir, options2) {
57288
57368
  phaseId,
57289
57369
  name: name.trim(),
57290
57370
  status: normalizeStatus(status),
57291
- file: resolve16(dir, linkPath),
57371
+ file: resolve17(dir, linkPath),
57292
57372
  linkText,
57293
57373
  anchor
57294
57374
  });
@@ -57307,7 +57387,7 @@ function parseFormat2b(content, dir, options2) {
57307
57387
  phaseId,
57308
57388
  name: name.trim(),
57309
57389
  status: normalizeStatus(status),
57310
- file: resolve16(dir, linkPath),
57390
+ file: resolve17(dir, linkPath),
57311
57391
  linkText: name.trim(),
57312
57392
  anchor
57313
57393
  });
@@ -57406,7 +57486,7 @@ function parseFormat4(content, planFilePath, options2) {
57406
57486
  current = { name, status: hasCheck ? "completed" : "pending" };
57407
57487
  } else if (fileMatch && current) {
57408
57488
  const planDir = dirname14(planFilePath);
57409
- current.file = resolve16(planDir, fileMatch[1].trim());
57489
+ current.file = resolve17(planDir, fileMatch[1].trim());
57410
57490
  } else if (statusMatch && current) {
57411
57491
  current.status = normalizeStatus(statusMatch[2]);
57412
57492
  }
@@ -57472,7 +57552,7 @@ function parseFormat6(content, dir, options2) {
57472
57552
  phaseId,
57473
57553
  name: phaseName,
57474
57554
  status: checked.toLowerCase() === "x" ? "completed" : "pending",
57475
- file: resolve16(dir, linkPath),
57555
+ file: resolve17(dir, linkPath),
57476
57556
  linkText: phaseName,
57477
57557
  anchor
57478
57558
  });
@@ -57657,13 +57737,13 @@ var init_plan_scanner = () => {};
57657
57737
 
57658
57738
  // src/domains/plan-parser/plan-scope.ts
57659
57739
  import { homedir as homedir30 } from "node:os";
57660
- import { isAbsolute as isAbsolute5, join as join44, relative as relative9, resolve as resolve17 } from "node:path";
57740
+ import { isAbsolute as isAbsolute5, join as join44, relative as relative9, resolve as resolve18 } from "node:path";
57661
57741
  function resolveConfiguredDir(configuredPath, baseDir) {
57662
57742
  const trimmed = configuredPath?.trim();
57663
57743
  if (!trimmed) {
57664
57744
  return join44(baseDir, DEFAULT_PLANS_DIRNAME);
57665
57745
  }
57666
- return isAbsolute5(trimmed) ? resolve17(trimmed) : resolve17(baseDir, trimmed);
57746
+ return isAbsolute5(trimmed) ? resolve18(trimmed) : resolve18(baseDir, trimmed);
57667
57747
  }
57668
57748
  function resolveProjectPlansDir(projectRoot, config) {
57669
57749
  return resolveConfiguredDir(config?.paths?.plans, projectRoot);
@@ -57675,8 +57755,8 @@ function resolvePlanDirForScope(scope, projectRoot, config) {
57675
57755
  return scope === "global" ? resolveGlobalPlansDir(config) : resolveProjectPlansDir(projectRoot, config);
57676
57756
  }
57677
57757
  function isWithinDir(targetPath, baseDir) {
57678
- const resolvedTarget = resolve17(targetPath);
57679
- const resolvedBase = resolve17(baseDir);
57758
+ const resolvedTarget = resolve18(targetPath);
57759
+ const resolvedBase = resolve18(baseDir);
57680
57760
  const relativePath = relative9(resolvedBase, resolvedTarget);
57681
57761
  return relativePath === "" || !relativePath.startsWith("..") && relativePath !== ".." && !isAbsolute5(relativePath);
57682
57762
  }
@@ -57806,7 +57886,7 @@ var init_timeline_builder = __esm(() => {
57806
57886
 
57807
57887
  // src/domains/plan-parser/plan-validator.ts
57808
57888
  import { existsSync as existsSync31, readFileSync as readFileSync8 } from "node:fs";
57809
- import { basename as basename12, dirname as dirname15 } from "node:path";
57889
+ import { basename as basename13, dirname as dirname15 } from "node:path";
57810
57890
  function validatePlanFile(filePath, strict = false) {
57811
57891
  const rawContent = readFileSync8(filePath, "utf8");
57812
57892
  const content = rawContent.replace(/\r\n/g, `
@@ -57850,13 +57930,13 @@ function validatePlanFile(filePath, strict = false) {
57850
57930
  }
57851
57931
  for (const phase of phases) {
57852
57932
  if (phase.file && !existsSync31(phase.file)) {
57853
- const fileBasename = basename12(phase.file);
57933
+ const fileBasename = basename13(phase.file);
57854
57934
  const refLine = lines.findIndex((l2) => l2.includes(fileBasename));
57855
57935
  issues.push({
57856
57936
  line: refLine >= 0 ? refLine + 1 : 1,
57857
57937
  severity: "warning",
57858
57938
  code: "missing-phase-file",
57859
- message: `Phase ${phase.phaseId} references '${basename12(phase.file)}' which doesn't exist`
57939
+ message: `Phase ${phase.phaseId} references '${basename13(phase.file)}' which doesn't exist`
57860
57940
  });
57861
57941
  }
57862
57942
  }
@@ -57877,7 +57957,7 @@ var init_plan_validator = __esm(() => {
57877
57957
  import { execSync } from "node:child_process";
57878
57958
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync9, writeFileSync as writeFileSync3 } from "node:fs";
57879
57959
  import { existsSync as existsSync32 } from "node:fs";
57880
- import { basename as basename13, dirname as dirname16, join as join46 } from "node:path";
57960
+ import { basename as basename14, dirname as dirname16, join as join46 } from "node:path";
57881
57961
  function phaseNameToFilename(id, name) {
57882
57962
  const numMatch = /^(\d+)([a-z]*)$/i.exec(id);
57883
57963
  const num = numMatch ? numMatch[1] : id;
@@ -58156,7 +58236,7 @@ function addPhase(planFile, name, afterId) {
58156
58236
  insertIdx = i;
58157
58237
  }
58158
58238
  if (insertIdx === -1) {
58159
- throw new Error(`Phase ID "${afterId}" not found in ${basename13(planFile)}`);
58239
+ throw new Error(`Phase ID "${afterId}" not found in ${basename14(planFile)}`);
58160
58240
  }
58161
58241
  lines.splice(insertIdx + 1, 0, newRow);
58162
58242
  updatedBody = lines.join(`
@@ -58468,7 +58548,7 @@ import {
58468
58548
  unlinkSync,
58469
58549
  writeFileSync as writeFileSync4
58470
58550
  } from "node:fs";
58471
- import { dirname as dirname18, isAbsolute as isAbsolute6, join as join47, parse as parse2, relative as relative10, resolve as resolve18 } from "node:path";
58551
+ import { dirname as dirname18, isAbsolute as isAbsolute6, join as join47, parse as parse2, relative as relative10, resolve as resolve19 } from "node:path";
58472
58552
  function createEmptyRegistry() {
58473
58553
  return {
58474
58554
  version: 1,
@@ -58523,7 +58603,7 @@ function migrateFromProjectLocal(cwd2, globalPath) {
58523
58603
  }
58524
58604
  }
58525
58605
  function normalizeRegistryDir(cwd2, dir) {
58526
- const absoluteDir = isAbsolute6(dir) ? dir : resolve18(cwd2, dir);
58606
+ const absoluteDir = isAbsolute6(dir) ? dir : resolve19(cwd2, dir);
58527
58607
  const relativeDir = relative10(cwd2, absoluteDir) || dir;
58528
58608
  return relativeDir.replace(/\\/g, "/");
58529
58609
  }
@@ -58878,24 +58958,24 @@ function pLimit(concurrency) {
58878
58958
  activeCount--;
58879
58959
  resumeNext();
58880
58960
  };
58881
- const run = async (function_, resolve19, arguments_) => {
58961
+ const run = async (function_, resolve20, arguments_) => {
58882
58962
  const result = (async () => function_(...arguments_))();
58883
- resolve19(result);
58963
+ resolve20(result);
58884
58964
  try {
58885
58965
  await result;
58886
58966
  } catch {}
58887
58967
  next();
58888
58968
  };
58889
- const enqueue = (function_, resolve19, arguments_) => {
58969
+ const enqueue = (function_, resolve20, arguments_) => {
58890
58970
  new Promise((internalResolve) => {
58891
58971
  queue.enqueue(internalResolve);
58892
- }).then(run.bind(undefined, function_, resolve19, arguments_));
58972
+ }).then(run.bind(undefined, function_, resolve20, arguments_));
58893
58973
  if (activeCount < concurrency) {
58894
58974
  resumeNext();
58895
58975
  }
58896
58976
  };
58897
- const generator = (function_, ...arguments_) => new Promise((resolve19) => {
58898
- enqueue(function_, resolve19, arguments_);
58977
+ const generator = (function_, ...arguments_) => new Promise((resolve20) => {
58978
+ enqueue(function_, resolve20, arguments_);
58899
58979
  });
58900
58980
  Object.defineProperties(generator, {
58901
58981
  activeCount: {
@@ -58942,7 +59022,7 @@ var init_p_limit = __esm(() => {
58942
59022
  // src/domains/web-server/routes/plan-routes.ts
58943
59023
  import { existsSync as existsSync34, readFileSync as readFileSync11, realpathSync } from "node:fs";
58944
59024
  import { homedir as homedir31 } from "node:os";
58945
- import { basename as basename14, dirname as dirname20, join as join49, relative as relative11, resolve as resolve19, sep as sep5 } from "node:path";
59025
+ import { basename as basename15, dirname as dirname20, join as join49, relative as relative11, resolve as resolve20, sep as sep5 } from "node:path";
58946
59026
  function sanitizeError(err) {
58947
59027
  if (err instanceof Error) {
58948
59028
  if (/^(ENOENT|EACCES|EPERM|EISDIR)/.test(err.message))
@@ -58957,8 +59037,8 @@ function hasBasePrefix(targetPath, baseDir) {
58957
59037
  return targetPath === baseDir || targetPath.startsWith(basePrefix);
58958
59038
  }
58959
59039
  function isWithinBase(targetPath, baseDir) {
58960
- const resolvedTarget = resolve19(targetPath);
58961
- const resolvedBase = resolve19(baseDir);
59040
+ const resolvedTarget = resolve20(targetPath);
59041
+ const resolvedBase = resolve20(baseDir);
58962
59042
  const logicalMatch = hasBasePrefix(resolvedTarget, resolvedBase);
58963
59043
  if (existsSync34(resolvedTarget)) {
58964
59044
  try {
@@ -59042,7 +59122,7 @@ async function getAllowedRoots(projectId) {
59042
59122
  roots.push(projectPlansDir);
59043
59123
  roots.push(getGlobalPlanRoot());
59044
59124
  } catch {}
59045
- return Array.from(new Set(roots.map((root) => resolve19(root))));
59125
+ return Array.from(new Set(roots.map((root) => resolve20(root))));
59046
59126
  }
59047
59127
  async function isWithinAllowedRoots(targetPath, projectId) {
59048
59128
  const allowedRoots = await getAllowedRoots(projectId);
@@ -59064,7 +59144,7 @@ async function getSafePath(value, kind, res, projectId) {
59064
59144
  return null;
59065
59145
  }
59066
59146
  try {
59067
- return realpathSync(resolve19(value));
59147
+ return realpathSync(resolve20(value));
59068
59148
  } catch {
59069
59149
  res.status(403).json({ error: "Cannot resolve path" });
59070
59150
  return null;
@@ -59077,7 +59157,7 @@ function getPlanFilePath(value, res, projectId) {
59077
59157
  return getSafePath(value, "file", res, projectId);
59078
59158
  }
59079
59159
  function toProjectPathKey(projectPath) {
59080
- const resolvedPath = resolve19(projectPath);
59160
+ const resolvedPath = resolve20(projectPath);
59081
59161
  if (!existsSync34(resolvedPath)) {
59082
59162
  return resolvedPath;
59083
59163
  }
@@ -59093,8 +59173,8 @@ function createDiscoveredProjectId(projectPath) {
59093
59173
  function toProjectPlanListItem(summary, plansDir) {
59094
59174
  return {
59095
59175
  file: relative11(plansDir, summary.planFile),
59096
- name: basename14(dirname20(summary.planFile)),
59097
- slug: basename14(dirname20(summary.planFile)),
59176
+ name: basename15(dirname20(summary.planFile)),
59177
+ slug: basename15(dirname20(summary.planFile)),
59098
59178
  summary: {
59099
59179
  ...summary,
59100
59180
  planDir: relative11(plansDir, summary.planDir),
@@ -59176,8 +59256,8 @@ function registerPlanRoutes(app) {
59176
59256
  const summaries = buildPlanSummaries(entries.slice(offset, offset + limit));
59177
59257
  const plans = summaries.map((summary) => ({
59178
59258
  file: relative11(process.cwd(), summary.planFile),
59179
- name: basename14(dirname20(summary.planFile)),
59180
- slug: basename14(dirname20(summary.planFile)),
59259
+ name: basename15(dirname20(summary.planFile)),
59260
+ slug: basename15(dirname20(summary.planFile)),
59181
59261
  summary: {
59182
59262
  ...summary,
59183
59263
  planDir: relative11(process.cwd(), summary.planDir),
@@ -59201,7 +59281,7 @@ function registerPlanRoutes(app) {
59201
59281
  const seenProjectKeys = new Set;
59202
59282
  const scanTargets = [];
59203
59283
  for (const project of await ProjectsRegistryManager.listProjects()) {
59204
- if (!existsSync34(resolve19(project.path)))
59284
+ if (!existsSync34(resolve20(project.path)))
59205
59285
  continue;
59206
59286
  const projectKey = toProjectPathKey(project.path);
59207
59287
  if (projectKey === globalProjectKey || seenProjectKeys.has(projectKey))
@@ -59220,16 +59300,16 @@ function registerPlanRoutes(app) {
59220
59300
  seenProjectKeys.add(projectKey);
59221
59301
  scanTargets.push({
59222
59302
  id: createDiscoveredProjectId(project.path),
59223
- name: basename14(project.path),
59303
+ name: basename15(project.path),
59224
59304
  path: project.path
59225
59305
  });
59226
59306
  }
59227
- const currentPath = resolve19(process.cwd());
59307
+ const currentPath = resolve20(process.cwd());
59228
59308
  const currentProjectKey = toProjectPathKey(currentPath);
59229
59309
  if (isCurrentProjectFallbackCandidate(currentPath, globalProjectKey) && !seenProjectKeys.has(currentProjectKey)) {
59230
59310
  scanTargets.push({
59231
59311
  id: "current",
59232
- name: basename14(currentPath),
59312
+ name: basename15(currentPath),
59233
59313
  path: currentPath
59234
59314
  });
59235
59315
  }
@@ -59313,7 +59393,7 @@ function registerPlanRoutes(app) {
59313
59393
  const file = await getPlanFilePath(String(req.query.file ?? ""), res, projectId);
59314
59394
  if (!file)
59315
59395
  return;
59316
- const dir = req.query.dir ? resolve19(String(req.query.dir)) : null;
59396
+ const dir = req.query.dir ? resolve20(String(req.query.dir)) : null;
59317
59397
  if (dir && (!await isWithinAllowedRoots(dir, projectId) || !isWithinBase(file, dir))) {
59318
59398
  res.status(403).json({ error: "File must stay within the selected plan directory" });
59319
59399
  return;
@@ -59445,7 +59525,7 @@ var init_project_plan_data = __esm(() => {
59445
59525
  import { existsSync as existsSync35 } from "node:fs";
59446
59526
  import { readFile as readFile26 } from "node:fs/promises";
59447
59527
  import { homedir as homedir32 } from "node:os";
59448
- import { basename as basename15, join as join50, resolve as resolve20 } from "node:path";
59528
+ import { basename as basename16, join as join50, resolve as resolve21 } from "node:path";
59449
59529
  function registerProjectRoutes(app) {
59450
59530
  app.get("/api/projects", async (req, res) => {
59451
59531
  try {
@@ -59471,7 +59551,7 @@ function registerProjectRoutes(app) {
59471
59551
  if (projectInfo) {
59472
59552
  const encodedPath = Buffer.from(discovered.path).toString("base64url");
59473
59553
  projectInfo.id = `discovered-${encodedPath}`;
59474
- projectInfo.name = basename15(discovered.path);
59554
+ projectInfo.name = basename16(discovered.path);
59475
59555
  projects.push(projectInfo);
59476
59556
  }
59477
59557
  }
@@ -59557,7 +59637,7 @@ function registerProjectRoutes(app) {
59557
59637
  } else if (projectPath.startsWith("~\\")) {
59558
59638
  projectPath = join50(homedir32(), projectPath.slice(1));
59559
59639
  }
59560
- projectPath = resolve20(projectPath);
59640
+ projectPath = resolve21(projectPath);
59561
59641
  const homeDir = homedir32();
59562
59642
  if (projectPath.includes("..") || !projectPath.startsWith(homeDir)) {
59563
59643
  res.status(400).json({ error: "Invalid path after expansion" });
@@ -59603,7 +59683,7 @@ function registerProjectRoutes(app) {
59603
59683
  const projectInfo = await detectAndBuildProjectInfo(projectPath2, id);
59604
59684
  if (projectInfo) {
59605
59685
  projectInfo.id = id;
59606
- projectInfo.name = basename15(projectPath2);
59686
+ projectInfo.name = basename16(projectPath2);
59607
59687
  res.json(projectInfo);
59608
59688
  return;
59609
59689
  }
@@ -59744,7 +59824,7 @@ async function detectAndBuildProjectInfo(path5, id, cachedSettings, cachedSkills
59744
59824
  const planData = includePlanData ? await buildProjectPlanData(id === "global" ? null : path5, scope) : null;
59745
59825
  return {
59746
59826
  id,
59747
- name: basename15(path5) || (id === "global" ? "Global" : "Current"),
59827
+ name: basename16(path5) || (id === "global" ? "Global" : "Current"),
59748
59828
  path: path5,
59749
59829
  hasLocalConfig,
59750
59830
  kitType: metadata.kit || null,
@@ -59784,9 +59864,9 @@ var init_project_routes = __esm(() => {
59784
59864
 
59785
59865
  // src/domains/web-server/routes/session-routes.ts
59786
59866
  import { existsSync as existsSync36 } from "node:fs";
59787
- import { readFile as readFile27, readdir as readdir12, stat as stat8 } from "node:fs/promises";
59867
+ import { readFile as readFile27, readdir as readdir12, stat as stat9 } from "node:fs/promises";
59788
59868
  import { homedir as homedir33 } from "node:os";
59789
- import { basename as basename16, join as join51 } from "node:path";
59869
+ import { basename as basename17, join as join51 } from "node:path";
59790
59870
  function toDateStr(d3) {
59791
59871
  const y3 = d3.getFullYear();
59792
59872
  const m2 = String(d3.getMonth() + 1).padStart(2, "0");
@@ -59836,7 +59916,7 @@ async function scanActivityMetrics(periodDays) {
59836
59916
  for (const sessionFile of sessionFiles) {
59837
59917
  const filePath = join51(dirPath, sessionFile);
59838
59918
  try {
59839
- const fileStat = await stat8(filePath);
59919
+ const fileStat = await stat9(filePath);
59840
59920
  const mtime = fileStat.mtime;
59841
59921
  const mtimeMs = mtime.getTime();
59842
59922
  if (mtime >= cutoff) {
@@ -59926,7 +60006,7 @@ function extractResultContent(block) {
59926
60006
  }
59927
60007
  async function parseSessionDetail(filePath, limit, offset) {
59928
60008
  const MAX_SESSION_FILE_BYTES = 50 * 1024 * 1024;
59929
- const fileStats = await stat8(filePath);
60009
+ const fileStats = await stat9(filePath);
59930
60010
  if (fileStats.size > MAX_SESSION_FILE_BYTES) {
59931
60011
  return {
59932
60012
  messages: [
@@ -60050,7 +60130,7 @@ function registerSessionRoutes(app) {
60050
60130
  const projects = [];
60051
60131
  for (const entry of entries) {
60052
60132
  const entryPath = join51(projectsDir2, entry);
60053
- const entryStat = await stat8(entryPath).catch(() => null);
60133
+ const entryStat = await stat9(entryPath).catch(() => null);
60054
60134
  if (!entryStat?.isDirectory())
60055
60135
  continue;
60056
60136
  const files = await readdir12(entryPath).catch(() => []);
@@ -60059,7 +60139,7 @@ function registerSessionRoutes(app) {
60059
60139
  continue;
60060
60140
  let lastActive = new Date(0);
60061
60141
  for (const file of jsonlFiles.slice(-5)) {
60062
- const fileStat = await stat8(join51(entryPath, file)).catch(() => null);
60142
+ const fileStat = await stat9(join51(entryPath, file)).catch(() => null);
60063
60143
  if (fileStat && fileStat.mtime > lastActive) {
60064
60144
  lastActive = fileStat.mtime;
60065
60145
  }
@@ -60073,7 +60153,7 @@ function registerSessionRoutes(app) {
60073
60153
  const encodedPath = Buffer.from(decodedPath).toString("base64url");
60074
60154
  projects.push({
60075
60155
  id: `discovered-${encodedPath}`,
60076
- name: basename16(decodedPath),
60156
+ name: basename17(decodedPath),
60077
60157
  path: decodedPath,
60078
60158
  sessionCount: jsonlFiles.length,
60079
60159
  lastActive: lastActive.toISOString()
@@ -60261,7 +60341,7 @@ var init_settings_routes = __esm(() => {
60261
60341
  });
60262
60342
 
60263
60343
  // src/domains/skills/skill-catalog-generator.ts
60264
- import { mkdir as mkdir11, readFile as readFile28, readdir as readdir13, rename as rename8, stat as stat9, writeFile as writeFile13 } from "node:fs/promises";
60344
+ import { mkdir as mkdir12, readFile as readFile28, readdir as readdir13, rename as rename8, stat as stat10, writeFile as writeFile13 } from "node:fs/promises";
60265
60345
  import { homedir as homedir35 } from "node:os";
60266
60346
  import { dirname as dirname21, join as join52, relative as relative12 } from "node:path";
60267
60347
  async function hasScripts(skillPath) {
@@ -60329,7 +60409,7 @@ class SkillCatalogGenerator {
60329
60409
  };
60330
60410
  }
60331
60411
  async write(catalog) {
60332
- await mkdir11(dirname21(CATALOG_PATH), { recursive: true });
60412
+ await mkdir12(dirname21(CATALOG_PATH), { recursive: true });
60333
60413
  const tmpPath = `${CATALOG_PATH}.tmp`;
60334
60414
  const json = JSON.stringify(catalog, null, 2);
60335
60415
  await writeFile13(tmpPath, json, "utf-8");
@@ -60360,7 +60440,7 @@ class SkillCatalogGenerator {
60360
60440
  continue;
60361
60441
  const skillMdPath = join52(skillsBasePath, entry.name, "SKILL.md");
60362
60442
  try {
60363
- const stats = await stat9(skillMdPath);
60443
+ const stats = await stat10(skillMdPath);
60364
60444
  if (stats.mtimeMs > catalogTime)
60365
60445
  return true;
60366
60446
  } catch {}
@@ -60702,11 +60782,11 @@ function hasInstallSignal2(path6) {
60702
60782
  return false;
60703
60783
  }
60704
60784
  try {
60705
- const stat10 = statSync8(path6);
60706
- if (stat10.isDirectory()) {
60785
+ const stat11 = statSync8(path6);
60786
+ if (stat11.isDirectory()) {
60707
60787
  return readdirSync6(path6).length > 0;
60708
60788
  }
60709
- if (stat10.isFile()) {
60789
+ if (stat11.isFile()) {
60710
60790
  return true;
60711
60791
  }
60712
60792
  return false;
@@ -60858,7 +60938,7 @@ var init_agents = __esm(() => {
60858
60938
 
60859
60939
  // src/commands/skills/skills-registry.ts
60860
60940
  import { existsSync as existsSync38 } from "node:fs";
60861
- import { mkdir as mkdir12, readFile as readFile30, writeFile as writeFile14 } from "node:fs/promises";
60941
+ import { mkdir as mkdir13, readFile as readFile30, writeFile as writeFile14 } from "node:fs/promises";
60862
60942
  import { homedir as homedir38 } from "node:os";
60863
60943
  import { dirname as dirname22, join as join55, sep as sep7 } from "node:path";
60864
60944
  function getCliVersion3() {
@@ -60914,7 +60994,7 @@ async function readRegistry2() {
60914
60994
  async function writeRegistry2(registry) {
60915
60995
  const dir = dirname22(REGISTRY_PATH2);
60916
60996
  if (!existsSync38(dir)) {
60917
- await mkdir12(dir, { recursive: true });
60997
+ await mkdir13(dir, { recursive: true });
60918
60998
  }
60919
60999
  await writeFile14(REGISTRY_PATH2, JSON.stringify(registry, null, 2), "utf-8");
60920
61000
  }
@@ -61002,12 +61082,12 @@ var init_skills_registry = __esm(() => {
61002
61082
 
61003
61083
  // src/commands/skills/skills-installer.ts
61004
61084
  import { existsSync as existsSync39 } from "node:fs";
61005
- import { cp as cp2, mkdir as mkdir13, rm as rm7, stat as stat10 } from "node:fs/promises";
61085
+ import { cp as cp3, mkdir as mkdir14, rm as rm7, stat as stat11 } from "node:fs/promises";
61006
61086
  import { homedir as homedir39 } from "node:os";
61007
- import { dirname as dirname23, join as join56, resolve as resolve22 } from "node:path";
61087
+ import { dirname as dirname23, join as join56, resolve as resolve23 } from "node:path";
61008
61088
  function isSamePath2(path1, path22) {
61009
61089
  try {
61010
- return resolve22(path1) === resolve22(path22);
61090
+ return resolve23(path1) === resolve23(path22);
61011
61091
  } catch {
61012
61092
  return false;
61013
61093
  }
@@ -61075,10 +61155,10 @@ async function installSkillForAgent(skill, agent, options2) {
61075
61155
  } catch {}
61076
61156
  const parentDir = dirname23(targetPath);
61077
61157
  if (!existsSync39(parentDir)) {
61078
- await mkdir13(parentDir, { recursive: true });
61158
+ await mkdir14(parentDir, { recursive: true });
61079
61159
  }
61080
61160
  if (existsSync39(targetPath)) {
61081
- const stats = await stat10(targetPath);
61161
+ const stats = await stat11(targetPath);
61082
61162
  if (stats.isFile()) {
61083
61163
  return {
61084
61164
  agent,
@@ -61089,7 +61169,7 @@ async function installSkillForAgent(skill, agent, options2) {
61089
61169
  };
61090
61170
  }
61091
61171
  }
61092
- await cp2(skill.path, targetPath, {
61172
+ await cp3(skill.path, targetPath, {
61093
61173
  recursive: true,
61094
61174
  force: true
61095
61175
  });
@@ -61142,10 +61222,10 @@ var init_skills_installer = __esm(() => {
61142
61222
  // src/commands/skills/skills-uninstaller.ts
61143
61223
  import { existsSync as existsSync40 } from "node:fs";
61144
61224
  import { rm as rm8 } from "node:fs/promises";
61145
- import { join as join57, resolve as resolve23 } from "node:path";
61225
+ import { join as join57, resolve as resolve24 } from "node:path";
61146
61226
  function isSamePath3(path1, path22) {
61147
61227
  try {
61148
- return resolve23(path1) === resolve23(path22);
61228
+ return resolve24(path1) === resolve24(path22);
61149
61229
  } catch {
61150
61230
  return false;
61151
61231
  }
@@ -61749,7 +61829,7 @@ var init_pnpm_detector = __esm(() => {
61749
61829
 
61750
61830
  // src/domains/installation/package-managers/detection-core.ts
61751
61831
  import { existsSync as existsSync41, realpathSync as realpathSync2 } from "node:fs";
61752
- import { chmod as chmod2, mkdir as mkdir14, readFile as readFile31, writeFile as writeFile15 } from "node:fs/promises";
61832
+ import { chmod as chmod2, mkdir as mkdir15, readFile as readFile31, writeFile as writeFile15 } from "node:fs/promises";
61753
61833
  import { platform as platform6 } from "node:os";
61754
61834
  import { join as join58 } from "node:path";
61755
61835
  function detectFromBinaryPath() {
@@ -61861,7 +61941,7 @@ async function saveCachedPm(pm, getVersion) {
61861
61941
  const configDir = PathResolver.getConfigDir(false);
61862
61942
  const cacheFile = join58(configDir, CACHE_FILE);
61863
61943
  if (!existsSync41(configDir)) {
61864
- await mkdir14(configDir, { recursive: true });
61944
+ await mkdir15(configDir, { recursive: true });
61865
61945
  if (platform6() !== "win32") {
61866
61946
  await chmod2(configDir, 448);
61867
61947
  }
@@ -62083,7 +62163,7 @@ var package_default;
62083
62163
  var init_package = __esm(() => {
62084
62164
  package_default = {
62085
62165
  name: "claudekit-cli",
62086
- version: "3.41.4-dev.49",
62166
+ version: "3.41.4-dev.50",
62087
62167
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
62088
62168
  type: "module",
62089
62169
  repository: {
@@ -62779,8 +62859,8 @@ async function scanClaudeKitDirectory(directoryPath) {
62779
62859
  continue;
62780
62860
  }
62781
62861
  const itemPath = join60(skillsPath, item);
62782
- const stat11 = await import_fs_extra4.readdir(itemPath).catch(() => null);
62783
- if (stat11?.includes("SKILL.md")) {
62862
+ const stat12 = await import_fs_extra4.readdir(itemPath).catch(() => null);
62863
+ if (stat12?.includes("SKILL.md")) {
62784
62864
  skillCount++;
62785
62865
  }
62786
62866
  }
@@ -63284,7 +63364,7 @@ var init_error_handler2 = __esm(() => {
63284
63364
 
63285
63365
  // src/domains/versioning/release-cache.ts
63286
63366
  import { existsSync as existsSync42 } from "node:fs";
63287
- import { mkdir as mkdir15, readFile as readFile34, unlink as unlink7, writeFile as writeFile17 } from "node:fs/promises";
63367
+ import { mkdir as mkdir16, readFile as readFile34, unlink as unlink7, writeFile as writeFile17 } from "node:fs/promises";
63288
63368
  import { join as join61 } from "node:path";
63289
63369
  var ReleaseCacheEntrySchema, ReleaseCache;
63290
63370
  var init_release_cache = __esm(() => {
@@ -63330,7 +63410,7 @@ var init_release_cache = __esm(() => {
63330
63410
  async set(key, releases) {
63331
63411
  const cacheFile = this.getCachePath(key);
63332
63412
  try {
63333
- await mkdir15(this.cacheDir, { recursive: true, mode: 448 });
63413
+ await mkdir16(this.cacheDir, { recursive: true, mode: 448 });
63334
63414
  const cacheEntry = {
63335
63415
  timestamp: Date.now(),
63336
63416
  releases
@@ -64179,12 +64259,12 @@ async function promptKitUpdate(beta, yes, deps) {
64179
64259
  args.push("--beta");
64180
64260
  const displayCmd = `ck ${args.join(" ")}`;
64181
64261
  logger.info(`Running: ${displayCmd}`);
64182
- const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve24) => {
64262
+ const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve25) => {
64183
64263
  const child = spawn2("ck", spawnArgs, { stdio: "inherit", shell: true });
64184
- child.on("close", (code) => resolve24(code ?? 1));
64264
+ child.on("close", (code) => resolve25(code ?? 1));
64185
64265
  child.on("error", (err) => {
64186
64266
  logger.verbose(`Failed to spawn ck init: ${err.message}`);
64187
- resolve24(1);
64267
+ resolve25(1);
64188
64268
  });
64189
64269
  }));
64190
64270
  const exitCode = await spawnFn(args);
@@ -64411,7 +64491,7 @@ var init_update_cli = __esm(() => {
64411
64491
  });
64412
64492
 
64413
64493
  // src/domains/sync/config-version-checker.ts
64414
- import { mkdir as mkdir16, readFile as readFile36, unlink as unlink8, writeFile as writeFile18 } from "node:fs/promises";
64494
+ import { mkdir as mkdir17, readFile as readFile36, unlink as unlink8, writeFile as writeFile18 } from "node:fs/promises";
64415
64495
  import { join as join63 } from "node:path";
64416
64496
  function parseCacheTtl() {
64417
64497
  const envValue = process.env.CK_SYNC_CACHE_TTL;
@@ -64513,7 +64593,7 @@ class ConfigVersionChecker {
64513
64593
  try {
64514
64594
  const cachePath = ConfigVersionChecker.getCacheFilePath(kitType, global3, channel);
64515
64595
  const cacheDir = PathResolver.getCacheDir(global3);
64516
- await mkdir16(cacheDir, { recursive: true });
64596
+ await mkdir17(cacheDir, { recursive: true });
64517
64597
  await writeFile18(cachePath, JSON.stringify(cache3, null, 2));
64518
64598
  } catch (error) {
64519
64599
  logger.debug(`Cache write failed: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -64574,7 +64654,7 @@ class ConfigVersionChecker {
64574
64654
  return null;
64575
64655
  }
64576
64656
  const delay = baseBackoff * 2 ** attempt;
64577
- await new Promise((resolve24) => setTimeout(resolve24, delay));
64657
+ await new Promise((resolve25) => setTimeout(resolve25, delay));
64578
64658
  }
64579
64659
  }
64580
64660
  return null;
@@ -64680,12 +64760,12 @@ import { readFile as readFile37 } from "node:fs/promises";
64680
64760
  import { cpus, homedir as homedir40, totalmem } from "node:os";
64681
64761
  import { join as join64 } from "node:path";
64682
64762
  function runCommand(cmd, args, fallback2) {
64683
- return new Promise((resolve24) => {
64763
+ return new Promise((resolve25) => {
64684
64764
  execFile8(cmd, args, { timeout: 5000 }, (err, stdout) => {
64685
64765
  if (err) {
64686
- resolve24(fallback2);
64766
+ resolve25(fallback2);
64687
64767
  } else {
64688
- resolve24(stdout.trim() || fallback2);
64768
+ resolve25(stdout.trim() || fallback2);
64689
64769
  }
64690
64770
  });
64691
64771
  });
@@ -65121,7 +65201,7 @@ var init_routes = __esm(() => {
65121
65201
 
65122
65202
  // src/domains/web-server/static-server.ts
65123
65203
  import { existsSync as existsSync44 } from "node:fs";
65124
- import { basename as basename17, dirname as dirname24, join as join65, resolve as resolve24 } from "node:path";
65204
+ import { basename as basename18, dirname as dirname24, join as join65, resolve as resolve25 } from "node:path";
65125
65205
  import { fileURLToPath as fileURLToPath2 } from "node:url";
65126
65206
  function addRuntimeUiCandidate(candidates, runtimePath) {
65127
65207
  if (!runtimePath) {
@@ -65131,8 +65211,8 @@ function addRuntimeUiCandidate(candidates, runtimePath) {
65131
65211
  if (!looksLikePath) {
65132
65212
  return;
65133
65213
  }
65134
- const entryDir = dirname24(resolve24(runtimePath));
65135
- if (basename17(entryDir) === "dist") {
65214
+ const entryDir = dirname24(resolve25(runtimePath));
65215
+ if (basename18(entryDir) === "dist") {
65136
65216
  candidates.add(join65(entryDir, "ui"));
65137
65217
  }
65138
65218
  candidates.add(join65(entryDir, "..", "dist", "ui"));
@@ -68163,10 +68243,10 @@ async function createAppServer(options2 = {}) {
68163
68243
  wsManager = new WebSocketManager(server);
68164
68244
  fileWatcher = new FileWatcher({ wsManager });
68165
68245
  fileWatcher.start();
68166
- await new Promise((resolve25, reject) => {
68246
+ await new Promise((resolve26, reject) => {
68167
68247
  const onListening = () => {
68168
68248
  server.off("error", onError);
68169
- resolve25();
68249
+ resolve26();
68170
68250
  };
68171
68251
  const onError = (error) => {
68172
68252
  server.off("listening", onListening);
@@ -68203,16 +68283,16 @@ async function createAppServer(options2 = {}) {
68203
68283
  };
68204
68284
  }
68205
68285
  async function closeHttpServer(server) {
68206
- await new Promise((resolve25) => {
68286
+ await new Promise((resolve26) => {
68207
68287
  if (!server.listening) {
68208
- resolve25();
68288
+ resolve26();
68209
68289
  return;
68210
68290
  }
68211
68291
  server.close((err) => {
68212
68292
  if (err) {
68213
68293
  logger.debug(`Server close error: ${err.message}`);
68214
68294
  }
68215
- resolve25();
68295
+ resolve26();
68216
68296
  });
68217
68297
  });
68218
68298
  }
@@ -68519,7 +68599,7 @@ var require_get_stream = __commonJS((exports, module) => {
68519
68599
  };
68520
68600
  const { maxBuffer } = options2;
68521
68601
  let stream;
68522
- await new Promise((resolve25, reject) => {
68602
+ await new Promise((resolve26, reject) => {
68523
68603
  const rejectPromise = (error) => {
68524
68604
  if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
68525
68605
  error.bufferedData = stream.getBufferedValue();
@@ -68531,7 +68611,7 @@ var require_get_stream = __commonJS((exports, module) => {
68531
68611
  rejectPromise(error);
68532
68612
  return;
68533
68613
  }
68534
- resolve25();
68614
+ resolve26();
68535
68615
  });
68536
68616
  stream.on("data", () => {
68537
68617
  if (stream.getBufferedLength() > maxBuffer) {
@@ -69892,7 +69972,7 @@ var require_extract_zip = __commonJS((exports, module) => {
69892
69972
  debug("opening", this.zipPath, "with opts", this.opts);
69893
69973
  this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
69894
69974
  this.canceled = false;
69895
- return new Promise((resolve25, reject) => {
69975
+ return new Promise((resolve26, reject) => {
69896
69976
  this.zipfile.on("error", (err) => {
69897
69977
  this.canceled = true;
69898
69978
  reject(err);
@@ -69901,7 +69981,7 @@ var require_extract_zip = __commonJS((exports, module) => {
69901
69981
  this.zipfile.on("close", () => {
69902
69982
  if (!this.canceled) {
69903
69983
  debug("zip extraction complete");
69904
- resolve25();
69984
+ resolve26();
69905
69985
  }
69906
69986
  });
69907
69987
  this.zipfile.on("entry", async (entry) => {
@@ -71678,7 +71758,7 @@ var require_picomatch2 = __commonJS((exports, module) => {
71678
71758
  import { exec as exec7, execFile as execFile10, spawn as spawn5 } from "node:child_process";
71679
71759
  import { promisify as promisify15 } from "node:util";
71680
71760
  function executeInteractiveScript(command, args, options2) {
71681
- return new Promise((resolve31, reject) => {
71761
+ return new Promise((resolve32, reject) => {
71682
71762
  const child = spawn5(command, args, {
71683
71763
  stdio: ["ignore", "inherit", "inherit"],
71684
71764
  cwd: options2?.cwd,
@@ -71699,7 +71779,7 @@ function executeInteractiveScript(command, args, options2) {
71699
71779
  } else if (code !== 0) {
71700
71780
  reject(new Error(`Command exited with code ${code}`));
71701
71781
  } else {
71702
- resolve31();
71782
+ resolve32();
71703
71783
  }
71704
71784
  });
71705
71785
  child.on("error", (error) => {
@@ -71720,7 +71800,7 @@ var init_process_executor = __esm(() => {
71720
71800
  });
71721
71801
 
71722
71802
  // src/services/package-installer/validators.ts
71723
- import { resolve as resolve31 } from "node:path";
71803
+ import { resolve as resolve32 } from "node:path";
71724
71804
  function validatePackageName(packageName) {
71725
71805
  if (!packageName || typeof packageName !== "string") {
71726
71806
  throw new Error("Package name must be a non-empty string");
@@ -71733,8 +71813,8 @@ function validatePackageName(packageName) {
71733
71813
  }
71734
71814
  }
71735
71815
  function validateScriptPath(skillsDir2, scriptPath) {
71736
- const skillsDirResolved = resolve31(skillsDir2);
71737
- const scriptPathResolved = resolve31(scriptPath);
71816
+ const skillsDirResolved = resolve32(skillsDir2);
71817
+ const scriptPathResolved = resolve32(scriptPath);
71738
71818
  const skillsDirNormalized = isWindows() ? skillsDirResolved.toLowerCase() : skillsDirResolved;
71739
71819
  const scriptPathNormalized = isWindows() ? scriptPathResolved.toLowerCase() : scriptPathResolved;
71740
71820
  if (!scriptPathNormalized.startsWith(skillsDirNormalized)) {
@@ -72360,7 +72440,7 @@ var init_skills_installer2 = __esm(() => {
72360
72440
 
72361
72441
  // src/services/package-installer/gemini-mcp/config-manager.ts
72362
72442
  import { existsSync as existsSync58 } from "node:fs";
72363
- import { mkdir as mkdir22, readFile as readFile44, writeFile as writeFile22 } from "node:fs/promises";
72443
+ import { mkdir as mkdir23, readFile as readFile44, writeFile as writeFile22 } from "node:fs/promises";
72364
72444
  import { dirname as dirname31, join as join95 } from "node:path";
72365
72445
  async function readJsonFile(filePath) {
72366
72446
  try {
@@ -72403,7 +72483,7 @@ ${geminiPattern}
72403
72483
  async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
72404
72484
  const linkDir = dirname31(geminiSettingsPath);
72405
72485
  if (!existsSync58(linkDir)) {
72406
- await mkdir22(linkDir, { recursive: true });
72486
+ await mkdir23(linkDir, { recursive: true });
72407
72487
  logger.debug(`Created directory: ${linkDir}`);
72408
72488
  }
72409
72489
  const mcpConfig = await readJsonFile(mcpConfigPath);
@@ -72519,12 +72599,12 @@ var init_validation = __esm(() => {
72519
72599
 
72520
72600
  // src/services/package-installer/gemini-mcp/linker-core.ts
72521
72601
  import { existsSync as existsSync60 } from "node:fs";
72522
- import { mkdir as mkdir23, symlink as symlink3 } from "node:fs/promises";
72602
+ import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
72523
72603
  import { dirname as dirname32, join as join97 } from "node:path";
72524
72604
  async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
72525
72605
  const linkDir = dirname32(linkPath);
72526
72606
  if (!existsSync60(linkDir)) {
72527
- await mkdir23(linkDir, { recursive: true });
72607
+ await mkdir24(linkDir, { recursive: true });
72528
72608
  logger.debug(`Created directory: ${linkDir}`);
72529
72609
  }
72530
72610
  let symlinkTarget;
@@ -72564,10 +72644,10 @@ __export(exports_gemini_mcp_linker, {
72564
72644
  checkExistingGeminiConfig: () => checkExistingGeminiConfig,
72565
72645
  addGeminiToGitignore: () => addGeminiToGitignore
72566
72646
  });
72567
- import { resolve as resolve32 } from "node:path";
72647
+ import { resolve as resolve33 } from "node:path";
72568
72648
  async function linkGeminiMcpConfig(projectDir, options2 = {}) {
72569
72649
  const { skipGitignore = false, isGlobal = false } = options2;
72570
- const resolvedProjectDir = resolve32(projectDir);
72650
+ const resolvedProjectDir = resolve33(projectDir);
72571
72651
  const geminiSettingsPath = getGeminiSettingsPath(resolvedProjectDir, isGlobal);
72572
72652
  const mcpConfigPath = findMcpConfigPath(resolvedProjectDir);
72573
72653
  if (!mcpConfigPath) {
@@ -73186,7 +73266,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
73186
73266
  }
73187
73267
  }
73188
73268
  function spawnAndCollect(command, args, cwd2) {
73189
- return new Promise((resolve48, reject) => {
73269
+ return new Promise((resolve49, reject) => {
73190
73270
  const child = spawn6(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
73191
73271
  const chunks = [];
73192
73272
  const stderrChunks = [];
@@ -73199,7 +73279,7 @@ function spawnAndCollect(command, args, cwd2) {
73199
73279
  reject(new Error(`${command} ${args[0] ?? ""} exited with code ${code2}: ${stderr}`));
73200
73280
  return;
73201
73281
  }
73202
- resolve48(Buffer.concat(chunks).toString("utf-8"));
73282
+ resolve49(Buffer.concat(chunks).toString("utf-8"));
73203
73283
  });
73204
73284
  });
73205
73285
  }
@@ -73309,8 +73389,8 @@ function countTwitterChars(text) {
73309
73389
  const withoutUrls = text.replace(urlPattern, "");
73310
73390
  let count = urlCount * 23;
73311
73391
  for (const char of withoutUrls) {
73312
- const cp4 = char.codePointAt(0) ?? 0;
73313
- if (cp4 >= 19968 && cp4 <= 40959 || cp4 >= 13312 && cp4 <= 19903 || cp4 >= 131072 && cp4 <= 173791 || cp4 >= 173824 && cp4 <= 191471 || cp4 >= 196608 && cp4 <= 205743 || cp4 >= 63744 && cp4 <= 64255 || cp4 >= 12288 && cp4 <= 12351 || cp4 >= 12352 && cp4 <= 12447 || cp4 >= 12448 && cp4 <= 12543 || cp4 >= 65280 && cp4 <= 65519) {
73392
+ const cp5 = char.codePointAt(0) ?? 0;
73393
+ if (cp5 >= 19968 && cp5 <= 40959 || cp5 >= 13312 && cp5 <= 19903 || cp5 >= 131072 && cp5 <= 173791 || cp5 >= 173824 && cp5 <= 191471 || cp5 >= 196608 && cp5 <= 205743 || cp5 >= 63744 && cp5 <= 64255 || cp5 >= 12288 && cp5 <= 12351 || cp5 >= 12352 && cp5 <= 12447 || cp5 >= 12448 && cp5 <= 12543 || cp5 >= 65280 && cp5 <= 65519) {
73314
73394
  count += 2;
73315
73395
  } else {
73316
73396
  count += 1;
@@ -73387,7 +73467,7 @@ import { createHash as createHash9 } from "node:crypto";
73387
73467
  import { existsSync as existsSync75, mkdirSync as mkdirSync5, readFileSync as readFileSync18, readdirSync as readdirSync11, statSync as statSync14 } from "node:fs";
73388
73468
  import { rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
73389
73469
  import { homedir as homedir52 } from "node:os";
73390
- import { basename as basename30, join as join158 } from "node:path";
73470
+ import { basename as basename31, join as join158 } from "node:path";
73391
73471
  function getCachedContext(repoPath) {
73392
73472
  const cachePath = getCacheFilePath(repoPath);
73393
73473
  if (!existsSync75(cachePath))
@@ -73420,8 +73500,8 @@ function computeSourceHash(repoPath) {
73420
73500
  const paths = getDocSourcePaths(repoPath);
73421
73501
  for (const filePath of paths) {
73422
73502
  try {
73423
- const stat25 = statSync14(filePath);
73424
- hash.update(`${filePath}:${stat25.mtimeMs}`);
73503
+ const stat26 = statSync14(filePath);
73504
+ hash.update(`${filePath}:${stat26.mtimeMs}`);
73425
73505
  } catch {
73426
73506
  hash.update(`${filePath}:0`);
73427
73507
  }
@@ -73455,7 +73535,7 @@ function getDocSourcePaths(repoPath) {
73455
73535
  return paths.sort();
73456
73536
  }
73457
73537
  function getCacheFilePath(repoPath) {
73458
- const repoName = basename30(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
73538
+ const repoName = basename31(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
73459
73539
  const pathHash = createHash9("sha256").update(repoPath).digest("hex").slice(0, 8);
73460
73540
  return join158(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
73461
73541
  }
@@ -74097,8 +74177,8 @@ class ContentLogger {
74097
74177
  if (this.maxBytes > 0 && this.stream) {
74098
74178
  const logPath = join161(this.logDir, `content-${this.currentDate}.log`);
74099
74179
  try {
74100
- const stat25 = statSync15(logPath);
74101
- if (stat25.size >= this.maxBytes) {
74180
+ const stat26 = statSync15(logPath);
74181
+ if (stat26.size >= this.maxBytes) {
74102
74182
  this.close();
74103
74183
  const suffix = Date.now();
74104
74184
  const rotatedPath = join161(this.logDir, `content-${this.currentDate}-${suffix}.log`);
@@ -74450,8 +74530,8 @@ function detectCompletedPlans(repo, since) {
74450
74530
  if (!existsSync80(planFile))
74451
74531
  continue;
74452
74532
  try {
74453
- const stat25 = statSync16(planFile);
74454
- if (stat25.mtimeMs < sinceMs)
74533
+ const stat26 = statSync16(planFile);
74534
+ if (stat26.mtimeMs < sinceMs)
74455
74535
  continue;
74456
74536
  const content = readFileSync20(planFile, "utf-8");
74457
74537
  const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
@@ -74467,7 +74547,7 @@ function detectCompletedPlans(repo, since) {
74467
74547
  title: `Plan completed: ${entry.name}`,
74468
74548
  body: "",
74469
74549
  author: "",
74470
- createdAt: new Date(stat25.mtimeMs).toISOString()
74550
+ createdAt: new Date(stat26.mtimeMs).toISOString()
74471
74551
  });
74472
74552
  } catch {}
74473
74553
  }
@@ -76001,8 +76081,8 @@ function shouldRunCleanup(lastAt) {
76001
76081
  return Date.now() - new Date(lastAt).getTime() >= 86400000;
76002
76082
  }
76003
76083
  function sleep2(ms) {
76004
- return new Promise((resolve48) => {
76005
- setTimeout(resolve48, ms);
76084
+ return new Promise((resolve49) => {
76085
+ setTimeout(resolve49, ms);
76006
76086
  });
76007
76087
  }
76008
76088
  var LOCK_DIR2, LOCK_FILE, MAX_CREATION_RETRIES = 3, MAX_PUBLISH_RETRIES_PER_CYCLE = 3, PUBLISH_RETRY_WINDOW_HOURS = 24;
@@ -78261,7 +78341,7 @@ function getPagerArgs(pagerCmd) {
78261
78341
  return [];
78262
78342
  }
78263
78343
  async function trySystemPager(content) {
78264
- return new Promise((resolve48) => {
78344
+ return new Promise((resolve49) => {
78265
78345
  const pagerCmd = process.env.PAGER || "less";
78266
78346
  const pagerArgs = getPagerArgs(pagerCmd);
78267
78347
  try {
@@ -78271,20 +78351,20 @@ async function trySystemPager(content) {
78271
78351
  });
78272
78352
  const timeout2 = setTimeout(() => {
78273
78353
  pager.kill();
78274
- resolve48(false);
78354
+ resolve49(false);
78275
78355
  }, 30000);
78276
78356
  pager.stdin.write(content);
78277
78357
  pager.stdin.end();
78278
78358
  pager.on("close", (code2) => {
78279
78359
  clearTimeout(timeout2);
78280
- resolve48(code2 === 0);
78360
+ resolve49(code2 === 0);
78281
78361
  });
78282
78362
  pager.on("error", () => {
78283
78363
  clearTimeout(timeout2);
78284
- resolve48(false);
78364
+ resolve49(false);
78285
78365
  });
78286
78366
  } catch {
78287
- resolve48(false);
78367
+ resolve49(false);
78288
78368
  }
78289
78369
  });
78290
78370
  }
@@ -78311,16 +78391,16 @@ async function basicPager(content) {
78311
78391
  break;
78312
78392
  }
78313
78393
  const remaining = lines.length - currentLine;
78314
- await new Promise((resolve48) => {
78394
+ await new Promise((resolve49) => {
78315
78395
  rl.question(`-- More (${remaining} lines) [Enter/q] --`, (answer) => {
78316
78396
  if (answer.toLowerCase() === "q") {
78317
78397
  rl.close();
78318
78398
  process.exitCode = 0;
78319
- resolve48();
78399
+ resolve49();
78320
78400
  return;
78321
78401
  }
78322
78402
  process.stdout.write("\x1B[1A\x1B[2K");
78323
- resolve48();
78403
+ resolve49();
78324
78404
  });
78325
78405
  });
78326
78406
  }
@@ -81189,12 +81269,12 @@ async function configUICommand(options2 = {}) {
81189
81269
  console.log();
81190
81270
  console.log(import_picocolors12.default.dim(" Press Ctrl+C to stop"));
81191
81271
  console.log();
81192
- await new Promise((resolve25) => {
81272
+ await new Promise((resolve26) => {
81193
81273
  const shutdown = async () => {
81194
81274
  console.log();
81195
81275
  logger.info("Shutting down...");
81196
81276
  await server.close();
81197
- resolve25();
81277
+ resolve26();
81198
81278
  };
81199
81279
  process.on("SIGINT", shutdown);
81200
81280
  process.on("SIGTERM", shutdown);
@@ -81215,12 +81295,12 @@ async function configUICommand(options2 = {}) {
81215
81295
  }
81216
81296
  async function checkPort(port, host) {
81217
81297
  const { createServer: createServer2 } = await import("node:net");
81218
- return new Promise((resolve25) => {
81298
+ return new Promise((resolve26) => {
81219
81299
  const server = createServer2();
81220
- server.once("error", () => resolve25(false));
81300
+ server.once("error", () => resolve26(false));
81221
81301
  server.once("listening", () => {
81222
81302
  server.close();
81223
- resolve25(true);
81303
+ resolve26(true);
81224
81304
  });
81225
81305
  server.listen(port, host);
81226
81306
  });
@@ -81401,11 +81481,11 @@ async function fetchDesktopReleaseManifest(opts, fetchFn = globalThis.fetch) {
81401
81481
  import { existsSync as existsSync45 } from "node:fs";
81402
81482
 
81403
81483
  // src/domains/desktop/desktop-install-metadata.ts
81404
- import { basename as basename18, dirname as dirname26, join as join67 } from "node:path";
81484
+ import { basename as basename19, dirname as dirname26, join as join67 } from "node:path";
81405
81485
  init_desktop();
81406
81486
  var import_fs_extra6 = __toESM(require_lib3(), 1);
81407
81487
  function getDesktopDownloadMetadataPath(downloadPath) {
81408
- return join67(dirname26(downloadPath), `${basename18(downloadPath)}.metadata.json`);
81488
+ return join67(dirname26(downloadPath), `${basename19(downloadPath)}.metadata.json`);
81409
81489
  }
81410
81490
  async function readMetadataAt(metadataPath, options2 = {}) {
81411
81491
  const pathExistsFn = options2.pathExistsFn || import_fs_extra6.pathExists;
@@ -81448,7 +81528,7 @@ async function clearDesktopInstallMetadata(options2 = {}) {
81448
81528
  }
81449
81529
 
81450
81530
  // src/domains/desktop/desktop-installed-artifact-validator.ts
81451
- import { readFile as readFile38, stat as stat11 } from "node:fs/promises";
81531
+ import { readFile as readFile38, stat as stat12 } from "node:fs/promises";
81452
81532
  import { join as join68 } from "node:path";
81453
81533
  function escapeRegExp2(value) {
81454
81534
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -81470,7 +81550,7 @@ async function readInstalledDesktopArtifactVersion(binaryPath, options2 = {}) {
81470
81550
  async function validateInstalledDesktopArtifact(binaryPath, metadata, options2 = {}) {
81471
81551
  const platform7 = options2.platform || process.platform;
81472
81552
  const readFileFn = options2.readFileFn || readFile38;
81473
- const statFn = options2.statFn || stat11;
81553
+ const statFn = options2.statFn || stat12;
81474
81554
  try {
81475
81555
  if (platform7 === "linux" || platform7 === "win32") {
81476
81556
  const fileStat = await statFn(binaryPath);
@@ -81497,7 +81577,7 @@ async function validateInstalledDesktopArtifact(binaryPath, metadata, options2 =
81497
81577
  import { execFile as execFile9 } from "node:child_process";
81498
81578
  import { chmod as chmod3, mkdtemp, readdir as readdir16, rename as rename9 } from "node:fs/promises";
81499
81579
  import { tmpdir } from "node:os";
81500
- import { basename as basename19, dirname as dirname27, join as join69 } from "node:path";
81580
+ import { basename as basename20, dirname as dirname27, join as join69 } from "node:path";
81501
81581
  import { promisify as promisify10 } from "node:util";
81502
81582
  init_logger();
81503
81583
  var import_fs_extra7 = __toESM(require_lib3(), 1);
@@ -81555,8 +81635,8 @@ async function installDesktopBinary(downloadPath, options2 = {}) {
81555
81635
  await execFileAsync6("xattr", ["-dr", "com.apple.quarantine", path6]);
81556
81636
  });
81557
81637
  const stagingDir = await mkdtemp(join69(tmpdir(), "ck-desktop-app-"));
81558
- const stagedInstallPath = join69(dirname27(targetPath), `${basename19(targetPath)}.new`);
81559
- const backupInstallPath = join69(dirname27(targetPath), `${basename19(targetPath)}.backup`);
81638
+ const stagedInstallPath = join69(dirname27(targetPath), `${basename20(targetPath)}.new`);
81639
+ const backupInstallPath = join69(dirname27(targetPath), `${basename20(targetPath)}.backup`);
81560
81640
  let swappedInstall = false;
81561
81641
  try {
81562
81642
  await extractZipFn(downloadPath, { dir: stagingDir });
@@ -81589,7 +81669,7 @@ async function installDesktopBinary(downloadPath, options2 = {}) {
81589
81669
  return targetPath;
81590
81670
  }
81591
81671
  if (platform7 === "linux") {
81592
- const backupInstallPath = join69(dirname27(targetPath), `${basename19(targetPath)}.backup`);
81672
+ const backupInstallPath = join69(dirname27(targetPath), `${basename20(targetPath)}.backup`);
81593
81673
  try {
81594
81674
  await import_fs_extra7.remove(backupInstallPath);
81595
81675
  if (await import_fs_extra7.pathExists(targetPath)) {
@@ -81613,7 +81693,7 @@ async function installDesktopBinary(downloadPath, options2 = {}) {
81613
81693
  return targetPath;
81614
81694
  }
81615
81695
  if (platform7 === "win32") {
81616
- const backupInstallPath = join69(dirname27(targetPath), `${basename19(targetPath)}.backup`);
81696
+ const backupInstallPath = join69(dirname27(targetPath), `${basename20(targetPath)}.backup`);
81617
81697
  try {
81618
81698
  await import_fs_extra7.remove(backupInstallPath);
81619
81699
  if (await import_fs_extra7.pathExists(targetPath)) {
@@ -81642,7 +81722,7 @@ async function installDesktopBinary(downloadPath, options2 = {}) {
81642
81722
  init_logger();
81643
81723
  init_output_manager();
81644
81724
  import { createWriteStream as createWriteStream2, rmSync } from "node:fs";
81645
- import { mkdir as mkdir17 } from "node:fs/promises";
81725
+ import { mkdir as mkdir18 } from "node:fs/promises";
81646
81726
  import { join as join70 } from "node:path";
81647
81727
 
81648
81728
  // src/shared/progress-bar.ts
@@ -81808,20 +81888,20 @@ init_types3();
81808
81888
  // src/domains/installation/utils/path-security.ts
81809
81889
  init_types3();
81810
81890
  import { lstatSync, realpathSync as realpathSync3 } from "node:fs";
81811
- import { relative as relative13, resolve as resolve25 } from "node:path";
81891
+ import { relative as relative13, resolve as resolve26 } from "node:path";
81812
81892
  var MAX_EXTRACTION_SIZE = 500 * 1024 * 1024;
81813
81893
  function isPathSafe(basePath, targetPath) {
81814
- const resolvedBase = resolve25(basePath);
81894
+ const resolvedBase = resolve26(basePath);
81815
81895
  try {
81816
- const stat12 = lstatSync(targetPath);
81817
- if (stat12.isSymbolicLink()) {
81896
+ const stat13 = lstatSync(targetPath);
81897
+ if (stat13.isSymbolicLink()) {
81818
81898
  const realTarget = realpathSync3(targetPath);
81819
81899
  if (!realTarget.startsWith(resolvedBase)) {
81820
81900
  return false;
81821
81901
  }
81822
81902
  }
81823
81903
  } catch {}
81824
- const resolvedTarget = resolve25(targetPath);
81904
+ const resolvedTarget = resolve26(targetPath);
81825
81905
  const relativePath = relative13(resolvedBase, resolvedTarget);
81826
81906
  return !relativePath.startsWith("..") && !relativePath.startsWith("/") && resolvedTarget.startsWith(resolvedBase);
81827
81907
  }
@@ -81854,7 +81934,7 @@ class FileDownloader {
81854
81934
  async downloadAsset(asset, destDir) {
81855
81935
  try {
81856
81936
  const destPath = join70(destDir, asset.name);
81857
- await mkdir17(destDir, { recursive: true });
81937
+ await mkdir18(destDir, { recursive: true });
81858
81938
  output.info(`Downloading ${asset.name} (${formatBytes(asset.size)})...`);
81859
81939
  logger.verbose("Download details", {
81860
81940
  url: asset.browser_download_url,
@@ -81909,7 +81989,7 @@ class FileDownloader {
81909
81989
  }
81910
81990
  if (downloadedSize !== totalSize) {
81911
81991
  fileStream.end();
81912
- await new Promise((resolve26) => fileStream.once("close", resolve26));
81992
+ await new Promise((resolve27) => fileStream.once("close", resolve27));
81913
81993
  try {
81914
81994
  rmSync(destPath, { force: true });
81915
81995
  } catch (cleanupError) {
@@ -81923,7 +82003,7 @@ class FileDownloader {
81923
82003
  return destPath;
81924
82004
  } catch (error) {
81925
82005
  fileStream.end();
81926
- await new Promise((resolve26) => fileStream.once("close", resolve26));
82006
+ await new Promise((resolve27) => fileStream.once("close", resolve27));
81927
82007
  try {
81928
82008
  rmSync(destPath, { force: true });
81929
82009
  } catch (cleanupError) {
@@ -81939,7 +82019,7 @@ class FileDownloader {
81939
82019
  async downloadFile(params) {
81940
82020
  const { url, name, size, destDir, token } = params;
81941
82021
  const destPath = join70(destDir, name);
81942
- await mkdir17(destDir, { recursive: true });
82022
+ await mkdir18(destDir, { recursive: true });
81943
82023
  output.info(`Downloading ${name}${size ? ` (${formatBytes(size)})` : ""}...`);
81944
82024
  const headers = {};
81945
82025
  if (token && url.includes("api.github.com")) {
@@ -81989,7 +82069,7 @@ class FileDownloader {
81989
82069
  const expectedSize = Number(response.headers.get("content-length"));
81990
82070
  if (expectedSize > 0 && downloadedSize !== expectedSize) {
81991
82071
  fileStream.end();
81992
- await new Promise((resolve26) => fileStream.once("close", resolve26));
82072
+ await new Promise((resolve27) => fileStream.once("close", resolve27));
81993
82073
  try {
81994
82074
  rmSync(destPath, { force: true });
81995
82075
  } catch (cleanupError) {
@@ -82007,7 +82087,7 @@ class FileDownloader {
82007
82087
  return destPath;
82008
82088
  } catch (error) {
82009
82089
  fileStream.end();
82010
- await new Promise((resolve26) => fileStream.once("close", resolve26));
82090
+ await new Promise((resolve27) => fileStream.once("close", resolve27));
82011
82091
  try {
82012
82092
  rmSync(destPath, { force: true });
82013
82093
  } catch (cleanupError) {
@@ -82302,16 +82382,16 @@ function registerAppCommand(cli) {
82302
82382
  });
82303
82383
  }
82304
82384
  // src/services/file-operations/destructive-operation-backup-manager.ts
82305
- import { readdir as readdir18, stat as stat12 } from "node:fs/promises";
82306
- import { basename as basename21, join as join72, resolve as resolve27, sep as sep9 } from "node:path";
82385
+ import { readdir as readdir18, stat as stat13 } from "node:fs/promises";
82386
+ import { basename as basename22, join as join72, resolve as resolve28, sep as sep9 } from "node:path";
82307
82387
 
82308
82388
  // src/services/file-operations/destructive-operation-backup.ts
82309
82389
  init_logger();
82310
82390
  init_path_resolver();
82311
82391
  init_zod();
82312
82392
  var import_fs_extra9 = __toESM(require_lib3(), 1);
82313
- import { mkdir as mkdir18, readdir as readdir17, readlink, rename as rename10, symlink } from "node:fs/promises";
82314
- import { basename as basename20, dirname as dirname28, isAbsolute as isAbsolute7, join as join71, normalize as normalize4, resolve as resolve26, sep as sep8 } from "node:path";
82393
+ import { mkdir as mkdir19, readdir as readdir17, readlink, rename as rename10, symlink } from "node:fs/promises";
82394
+ import { basename as basename21, dirname as dirname28, isAbsolute as isAbsolute7, join as join71, normalize as normalize4, resolve as resolve27, sep as sep8 } from "node:path";
82315
82395
  var SNAPSHOT_DIR = "snapshot";
82316
82396
  var MANIFEST_FILE = "manifest.json";
82317
82397
  function normalizeRelativePath(rootDir, inputPath) {
@@ -82319,21 +82399,21 @@ function normalizeRelativePath(rootDir, inputPath) {
82319
82399
  throw new Error(`Unsafe backup path: ${inputPath}`);
82320
82400
  }
82321
82401
  const normalized = normalize4(inputPath).replaceAll("\\", "/");
82322
- const resolvedRoot = resolve26(rootDir);
82323
- const resolvedPath = resolve26(rootDir, normalized);
82402
+ const resolvedRoot = resolve27(rootDir);
82403
+ const resolvedPath = resolve27(rootDir, normalized);
82324
82404
  if (normalized === ".." || normalized.startsWith("../") || !resolvedPath.startsWith(`${resolvedRoot}${sep8}`) && resolvedPath !== resolvedRoot) {
82325
82405
  throw new Error(`Path escapes installation root: ${inputPath}`);
82326
82406
  }
82327
82407
  return normalized;
82328
82408
  }
82329
82409
  function getManagedBackupRoot() {
82330
- return resolve26(PathResolver.getConfigDir(false), "backups");
82410
+ return resolve27(PathResolver.getConfigDir(false), "backups");
82331
82411
  }
82332
82412
  async function getExistingRealpath(pathToResolve) {
82333
82413
  if (await import_fs_extra9.pathExists(pathToResolve)) {
82334
- return resolve26(await import_fs_extra9.realpath(pathToResolve));
82414
+ return resolve27(await import_fs_extra9.realpath(pathToResolve));
82335
82415
  }
82336
- return resolve26(pathToResolve);
82416
+ return resolve27(pathToResolve);
82337
82417
  }
82338
82418
  async function assertManagedBackupDir(backupDir) {
82339
82419
  const resolvedBackupDir = await getExistingRealpath(backupDir);
@@ -82378,13 +82458,13 @@ function buildTargets(sourceRoot, deletePaths, mutatePaths) {
82378
82458
  });
82379
82459
  }
82380
82460
  async function snapshotItem(sourceRoot, backupDir, target) {
82381
- const sourcePath = resolve26(sourceRoot, target.path);
82461
+ const sourcePath = resolve27(sourceRoot, target.path);
82382
82462
  if (!await import_fs_extra9.pathExists(sourcePath)) {
82383
82463
  return null;
82384
82464
  }
82385
82465
  const stats = await import_fs_extra9.lstat(sourcePath);
82386
82466
  if (stats.isSymbolicLink()) {
82387
- const realTargetPath = resolve26(await import_fs_extra9.realpath(sourcePath));
82467
+ const realTargetPath = resolve27(await import_fs_extra9.realpath(sourcePath));
82388
82468
  const resolvedSourceRoot = await getExistingRealpath(sourceRoot);
82389
82469
  if (!realTargetPath.startsWith(`${resolvedSourceRoot}${sep8}`) && realTargetPath !== resolvedSourceRoot) {
82390
82470
  throw new Error(`Symlink target escapes installation root: ${target.path}`);
@@ -82392,7 +82472,7 @@ async function snapshotItem(sourceRoot, backupDir, target) {
82392
82472
  const snapshotPath2 = join71(SNAPSHOT_DIR, target.path);
82393
82473
  const snapshotFullPath2 = join71(backupDir, snapshotPath2);
82394
82474
  const linkTarget = await readlink(sourcePath);
82395
- await mkdir18(dirname28(snapshotFullPath2), { recursive: true });
82475
+ await mkdir19(dirname28(snapshotFullPath2), { recursive: true });
82396
82476
  await symlink(linkTarget, snapshotFullPath2);
82397
82477
  return {
82398
82478
  path: target.path,
@@ -82404,7 +82484,7 @@ async function snapshotItem(sourceRoot, backupDir, target) {
82404
82484
  const kind = stats.isDirectory() ? "directory" : "file";
82405
82485
  const snapshotPath = join71(SNAPSHOT_DIR, target.path);
82406
82486
  const snapshotFullPath = join71(backupDir, snapshotPath);
82407
- await mkdir18(dirname28(snapshotFullPath), { recursive: true });
82487
+ await mkdir19(dirname28(snapshotFullPath), { recursive: true });
82408
82488
  if (kind === "directory") {
82409
82489
  await copyDirectorySnapshot(sourcePath, snapshotFullPath, sourceRoot);
82410
82490
  } else {
@@ -82418,13 +82498,13 @@ async function snapshotItem(sourceRoot, backupDir, target) {
82418
82498
  };
82419
82499
  }
82420
82500
  async function copyDirectorySnapshot(sourceDir, destDir, rootDir) {
82421
- await mkdir18(destDir, { recursive: true });
82501
+ await mkdir19(destDir, { recursive: true });
82422
82502
  const entries = await readdir17(sourceDir, { withFileTypes: true });
82423
82503
  for (const entry of entries) {
82424
82504
  const sourceEntry = join71(sourceDir, entry.name);
82425
82505
  const destEntry = join71(destDir, entry.name);
82426
82506
  if (entry.isSymbolicLink()) {
82427
- const realTargetPath = resolve26(await import_fs_extra9.realpath(sourceEntry));
82507
+ const realTargetPath = resolve27(await import_fs_extra9.realpath(sourceEntry));
82428
82508
  const resolvedRoot = await getExistingRealpath(rootDir);
82429
82509
  if (!realTargetPath.startsWith(`${resolvedRoot}${sep8}`) && realTargetPath !== resolvedRoot) {
82430
82510
  throw new Error(`Nested symlink target escapes installation root: ${sourceEntry}`);
@@ -82443,14 +82523,14 @@ async function copyDirectorySnapshot(sourceDir, destDir, rootDir) {
82443
82523
  }
82444
82524
  function buildRestoreTempPath(sourcePath, suffix) {
82445
82525
  const random = Math.random().toString(36).slice(2, 8);
82446
- return join71(dirname28(sourcePath), `.ck-${suffix}-${basename20(sourcePath)}-${Date.now()}-${random}`);
82526
+ return join71(dirname28(sourcePath), `.ck-${suffix}-${basename21(sourcePath)}-${Date.now()}-${random}`);
82447
82527
  }
82448
82528
  async function assertSafeRestoreDestination(targetPath, rootDir) {
82449
82529
  const resolvedRoot = await getExistingRealpath(rootDir);
82450
- const lexicalRoot = resolve26(rootDir);
82530
+ const lexicalRoot = resolve27(rootDir);
82451
82531
  let currentPath = dirname28(targetPath);
82452
82532
  while (true) {
82453
- const resolvedCurrent = resolve26(currentPath);
82533
+ const resolvedCurrent = resolve27(currentPath);
82454
82534
  if (!resolvedCurrent.startsWith(`${lexicalRoot}${sep8}`) && resolvedCurrent !== lexicalRoot) {
82455
82535
  throw new Error(`Restore target escapes installation root: ${targetPath}`);
82456
82536
  }
@@ -82471,15 +82551,15 @@ async function assertSafeRestoreDestination(targetPath, rootDir) {
82471
82551
  }
82472
82552
  }
82473
82553
  async function copySnapshotDirectoryForRestore(snapshotDir, destDir, rootDir) {
82474
- await mkdir18(destDir, { recursive: true });
82554
+ await mkdir19(destDir, { recursive: true });
82475
82555
  const entries = await readdir17(snapshotDir, { withFileTypes: true });
82476
82556
  for (const entry of entries) {
82477
82557
  const sourceEntry = join71(snapshotDir, entry.name);
82478
82558
  const destEntry = join71(destDir, entry.name);
82479
82559
  if (entry.isSymbolicLink()) {
82480
82560
  const linkTarget = await readlink(sourceEntry);
82481
- const resolvedTarget = resolve26(dirname28(destEntry), linkTarget);
82482
- const lexicalRoot = resolve26(rootDir);
82561
+ const resolvedTarget = resolve27(dirname28(destEntry), linkTarget);
82562
+ const lexicalRoot = resolve27(rootDir);
82483
82563
  if (!resolvedTarget.startsWith(`${lexicalRoot}${sep8}`) && resolvedTarget !== lexicalRoot) {
82484
82564
  throw new Error(`Nested restore symlink escapes installation root: ${destEntry}`);
82485
82565
  }
@@ -82496,7 +82576,7 @@ async function copySnapshotDirectoryForRestore(snapshotDir, destDir, rootDir) {
82496
82576
  }
82497
82577
  }
82498
82578
  async function stageRestorePlan(plan, rootDir) {
82499
- await mkdir18(dirname28(plan.restoreTempPath), { recursive: true });
82579
+ await mkdir19(dirname28(plan.restoreTempPath), { recursive: true });
82500
82580
  const snapshotStats = await import_fs_extra9.lstat(plan.snapshotPath);
82501
82581
  if (snapshotStats.isSymbolicLink()) {
82502
82582
  await symlink(await readlink(plan.snapshotPath), plan.restoreTempPath);
@@ -82542,7 +82622,7 @@ async function createDestructiveOperationBackup(request) {
82542
82622
  const manifestPath = join71(backupDir, MANIFEST_FILE);
82543
82623
  const targets = buildTargets(request.sourceRoot, request.deletePaths, request.mutatePaths ?? []);
82544
82624
  try {
82545
- await mkdir18(join71(backupDir, SNAPSHOT_DIR), { recursive: true });
82625
+ await mkdir19(join71(backupDir, SNAPSHOT_DIR), { recursive: true });
82546
82626
  const items = [];
82547
82627
  for (const target of targets) {
82548
82628
  const snapshot = await snapshotItem(request.sourceRoot, backupDir, target);
@@ -82554,7 +82634,7 @@ async function createDestructiveOperationBackup(request) {
82554
82634
  version: 1,
82555
82635
  operation: request.operation,
82556
82636
  createdAt: new Date().toISOString(),
82557
- sourceRoot: resolve26(request.sourceRoot),
82637
+ sourceRoot: resolve27(request.sourceRoot),
82558
82638
  scope: request.scope,
82559
82639
  kit: request.kit,
82560
82640
  items,
@@ -82578,7 +82658,7 @@ async function loadDestructiveOperationBackup(backupDir) {
82578
82658
  if (!isAbsolute7(manifest.sourceRoot)) {
82579
82659
  throw new Error(`Backup manifest source root must be absolute: ${manifest.sourceRoot}`);
82580
82660
  }
82581
- const resolvedSourceRoot = resolve26(manifest.sourceRoot);
82661
+ const resolvedSourceRoot = resolve27(manifest.sourceRoot);
82582
82662
  for (const item of manifest.items) {
82583
82663
  normalizeRelativePath(resolvedSourceRoot, item.path);
82584
82664
  const normalizedSnapshotPath = normalizeRelativePath(resolvedBackupDir, item.snapshotPath);
@@ -82598,8 +82678,8 @@ async function loadDestructiveOperationBackup(backupDir) {
82598
82678
  async function restoreDestructiveOperationBackup(backup) {
82599
82679
  const restorePlans = [];
82600
82680
  for (const item of backup.manifest.items) {
82601
- const sourcePath = resolve26(backup.manifest.sourceRoot, normalizeRelativePath(backup.manifest.sourceRoot, item.path));
82602
- const snapshotPath = resolve26(backup.backupDir, normalizeRelativePath(backup.backupDir, item.snapshotPath));
82681
+ const sourcePath = resolve27(backup.manifest.sourceRoot, normalizeRelativePath(backup.manifest.sourceRoot, item.path));
82682
+ const snapshotPath = resolve27(backup.backupDir, normalizeRelativePath(backup.backupDir, item.snapshotPath));
82603
82683
  try {
82604
82684
  await import_fs_extra9.lstat(snapshotPath);
82605
82685
  } catch {
@@ -82641,7 +82721,7 @@ init_path_resolver();
82641
82721
  var import_fs_extra10 = __toESM(require_lib3(), 1);
82642
82722
  var DEFAULT_DESTRUCTIVE_BACKUP_KEEP_COUNT = 10;
82643
82723
  function getBackupsRoot() {
82644
- return resolve27(PathResolver.getConfigDir(false), "backups");
82724
+ return resolve28(PathResolver.getConfigDir(false), "backups");
82645
82725
  }
82646
82726
  function validateBackupId(backupId) {
82647
82727
  if (!backupId || !/^[A-Za-z0-9._:-]+$/.test(backupId) || backupId.includes("..")) {
@@ -82651,7 +82731,7 @@ function validateBackupId(backupId) {
82651
82731
  function resolveBackupDir(backupId) {
82652
82732
  validateBackupId(backupId);
82653
82733
  const backupsRoot = getBackupsRoot();
82654
- const backupDir = resolve27(backupsRoot, backupId);
82734
+ const backupDir = resolve28(backupsRoot, backupId);
82655
82735
  if (!backupDir.startsWith(`${backupsRoot}${sep9}`) && backupDir !== backupsRoot) {
82656
82736
  throw new Error(`Backup id escapes backup root: ${backupId}`);
82657
82737
  }
@@ -82670,7 +82750,7 @@ async function getDirectorySize(dirPath) {
82670
82750
  continue;
82671
82751
  }
82672
82752
  if (entry.isFile()) {
82673
- size += (await stat12(fullPath)).size;
82753
+ size += (await stat13(fullPath)).size;
82674
82754
  }
82675
82755
  }
82676
82756
  return size;
@@ -82681,7 +82761,7 @@ async function listBackupDirs() {
82681
82761
  return [];
82682
82762
  }
82683
82763
  const entries = await readdir18(backupsRoot, { withFileTypes: true });
82684
- return entries.filter((entry) => entry.isDirectory()).map((entry) => join72(backupsRoot, entry.name)).sort((left, right) => basename21(right).localeCompare(basename21(left)));
82764
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => join72(backupsRoot, entry.name)).sort((left, right) => basename22(right).localeCompare(basename22(left)));
82685
82765
  }
82686
82766
  function sortBackupSummaries(left, right) {
82687
82767
  if (left.valid && right.valid) {
@@ -82694,7 +82774,7 @@ function sortBackupSummaries(left, right) {
82694
82774
  return right.id.localeCompare(left.id);
82695
82775
  }
82696
82776
  async function summarizeBackup(backupDir) {
82697
- const id = basename21(backupDir);
82777
+ const id = basename22(backupDir);
82698
82778
  const sizeBytes = await getDirectorySize(backupDir).catch(() => 0);
82699
82779
  try {
82700
82780
  const backup = await loadDestructiveOperationBackup(backupDir);
@@ -82750,7 +82830,7 @@ async function pruneDestructiveOperationBackups(options2) {
82750
82830
  const keptIds = [];
82751
82831
  let targets;
82752
82832
  if (options2?.all) {
82753
- targets = backupDirs.filter((backupDir) => !exclude.has(basename21(backupDir)));
82833
+ targets = backupDirs.filter((backupDir) => !exclude.has(basename22(backupDir)));
82754
82834
  } else if (options2?.backupIds?.length) {
82755
82835
  targets = options2.backupIds.map(resolveBackupDir);
82756
82836
  } else {
@@ -82761,7 +82841,7 @@ async function pruneDestructiveOperationBackups(options2) {
82761
82841
  keptIds.push(...[...keepIds]);
82762
82842
  }
82763
82843
  for (const backupDir of targets) {
82764
- const backupId = basename21(backupDir);
82844
+ const backupId = basename22(backupDir);
82765
82845
  if (!await import_fs_extra10.pathExists(backupDir)) {
82766
82846
  continue;
82767
82847
  }
@@ -82771,7 +82851,7 @@ async function pruneDestructiveOperationBackups(options2) {
82771
82851
  if (!options2?.all && !options2?.backupIds?.length) {
82772
82852
  const deleted = new Set(deletedIds);
82773
82853
  for (const backupDir of backupDirs) {
82774
- const backupId = basename21(backupDir);
82854
+ const backupId = basename22(backupDir);
82775
82855
  if (!deleted.has(backupId) && !keptIds.includes(backupId)) {
82776
82856
  keptIds.push(backupId);
82777
82857
  }
@@ -82865,7 +82945,7 @@ async function handleBackupsList(options2) {
82865
82945
  // src/shared/process-lock.ts
82866
82946
  init_logger();
82867
82947
  var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
82868
- import { mkdir as mkdir19 } from "node:fs/promises";
82948
+ import { mkdir as mkdir20 } from "node:fs/promises";
82869
82949
  import os5 from "node:os";
82870
82950
  import { join as join73 } from "node:path";
82871
82951
  var LOCK_CONFIGS = {
@@ -82897,7 +82977,7 @@ function registerCleanupHandlers() {
82897
82977
  }
82898
82978
  async function ensureLocksDir() {
82899
82979
  const lockDir = getLocksDir();
82900
- await mkdir19(lockDir, { recursive: true });
82980
+ await mkdir20(lockDir, { recursive: true });
82901
82981
  }
82902
82982
  function getLockPaths(lockName) {
82903
82983
  const resource = join73(getLocksDir(), `${lockName}.lock`);
@@ -83025,7 +83105,7 @@ init_path_resolver();
83025
83105
  var import_fs_extra11 = __toESM(require_lib3(), 1);
83026
83106
  var import_proper_lockfile6 = __toESM(require_proper_lockfile(), 1);
83027
83107
  import { createHash as createHash5 } from "node:crypto";
83028
- import { join as join74, resolve as resolve28 } from "node:path";
83108
+ import { join as join74, resolve as resolve29 } from "node:path";
83029
83109
  var LOCK_OPTIONS = {
83030
83110
  realpath: false,
83031
83111
  retries: { retries: 5, minTimeout: 100, maxTimeout: 1000 },
@@ -83033,9 +83113,9 @@ var LOCK_OPTIONS = {
83033
83113
  };
83034
83114
  async function getCanonicalInstallationRoot(installationRoot) {
83035
83115
  if (await import_fs_extra11.pathExists(installationRoot)) {
83036
- return resolve28(await import_fs_extra11.realpath(installationRoot));
83116
+ return resolve29(await import_fs_extra11.realpath(installationRoot));
83037
83117
  }
83038
- return resolve28(installationRoot);
83118
+ return resolve29(installationRoot);
83039
83119
  }
83040
83120
  async function getInstallationStateLockPath(installationRoot) {
83041
83121
  const normalizedRoot = await getCanonicalInstallationRoot(installationRoot);
@@ -84855,9 +84935,9 @@ function checkClaudeMdFile(path6, name, id) {
84855
84935
  };
84856
84936
  }
84857
84937
  try {
84858
- const stat13 = statSync9(path6);
84859
- const sizeKB = (stat13.size / 1024).toFixed(1);
84860
- if (stat13.size === 0) {
84938
+ const stat14 = statSync9(path6);
84939
+ const sizeKB = (stat14.size / 1024).toFixed(1);
84940
+ if (stat14.size === 0) {
84861
84941
  return {
84862
84942
  id,
84863
84943
  name,
@@ -85252,7 +85332,7 @@ init_path_resolver();
85252
85332
  import { existsSync as existsSync53 } from "node:fs";
85253
85333
  import { readFile as readFile40 } from "node:fs/promises";
85254
85334
  import { homedir as homedir42 } from "node:os";
85255
- import { dirname as dirname29, join as join82, normalize as normalize6, resolve as resolve29 } from "node:path";
85335
+ import { dirname as dirname29, join as join82, normalize as normalize6, resolve as resolve30 } from "node:path";
85256
85336
  async function checkPathRefsValid(projectDir) {
85257
85337
  const globalClaudeMd = join82(PathResolver.getGlobalKitDir(), "CLAUDE.md");
85258
85338
  const projectClaudeMd = join82(projectDir, ".claude", "CLAUDE.md");
@@ -85299,7 +85379,7 @@ async function checkPathRefsValid(projectDir) {
85299
85379
  } else if (/^[A-Za-z]:/.test(ref)) {
85300
85380
  refPath = normalize6(ref);
85301
85381
  } else {
85302
- refPath = resolve29(baseDir, ref);
85382
+ refPath = resolve30(baseDir, ref);
85303
85383
  }
85304
85384
  const normalizedPath = normalize6(refPath);
85305
85385
  const isWithinHome = normalizedPath.startsWith(home9);
@@ -85869,13 +85949,13 @@ import { spawnSync as spawnSync3 } from "node:child_process";
85869
85949
  import { existsSync as existsSync55, readFileSync as readFileSync15, statSync as statSync10, writeFileSync as writeFileSync5 } from "node:fs";
85870
85950
  import { readdir as readdir21 } from "node:fs/promises";
85871
85951
  import { homedir as homedir43, tmpdir as tmpdir2 } from "node:os";
85872
- import { join as join86, resolve as resolve30 } from "node:path";
85952
+ import { join as join86, resolve as resolve31 } from "node:path";
85873
85953
  var HOOK_CHECK_TIMEOUT_MS = 5000;
85874
85954
  var PYTHON_CHECK_TIMEOUT_MS = 3000;
85875
85955
  var MAX_LOG_FILE_SIZE_BYTES = 10 * 1024 * 1024;
85876
85956
  function getHooksDir(projectDir) {
85877
- const projectHooksDir = resolve30(projectDir, ".claude", "hooks");
85878
- const globalHooksDir = resolve30(PathResolver.getGlobalKitDir(), "hooks");
85957
+ const projectHooksDir = resolve31(projectDir, ".claude", "hooks");
85958
+ const globalHooksDir = resolve31(PathResolver.getGlobalKitDir(), "hooks");
85879
85959
  if (existsSync55(projectHooksDir))
85880
85960
  return projectHooksDir;
85881
85961
  if (existsSync55(globalHooksDir))
@@ -85883,7 +85963,7 @@ function getHooksDir(projectDir) {
85883
85963
  return null;
85884
85964
  }
85885
85965
  function isPathWithin(filePath, parentDir) {
85886
- return resolve30(filePath).startsWith(resolve30(parentDir));
85966
+ return resolve31(filePath).startsWith(resolve31(parentDir));
85887
85967
  }
85888
85968
  function getCanonicalGlobalCommandRoot() {
85889
85969
  const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
@@ -85894,22 +85974,22 @@ function getClaudeSettingsFiles(projectDir) {
85894
85974
  const globalClaudeDir = PathResolver.getGlobalKitDir();
85895
85975
  const candidates = [
85896
85976
  {
85897
- path: resolve30(projectDir, ".claude", "settings.json"),
85977
+ path: resolve31(projectDir, ".claude", "settings.json"),
85898
85978
  label: "project settings.json",
85899
85979
  root: "$CLAUDE_PROJECT_DIR"
85900
85980
  },
85901
85981
  {
85902
- path: resolve30(projectDir, ".claude", "settings.local.json"),
85982
+ path: resolve31(projectDir, ".claude", "settings.local.json"),
85903
85983
  label: "project settings.local.json",
85904
85984
  root: "$CLAUDE_PROJECT_DIR"
85905
85985
  },
85906
85986
  {
85907
- path: resolve30(globalClaudeDir, "settings.json"),
85987
+ path: resolve31(globalClaudeDir, "settings.json"),
85908
85988
  label: "global settings.json",
85909
85989
  root: getCanonicalGlobalCommandRoot()
85910
85990
  },
85911
85991
  {
85912
- path: resolve30(globalClaudeDir, "settings.local.json"),
85992
+ path: resolve31(globalClaudeDir, "settings.local.json"),
85913
85993
  label: "global settings.local.json",
85914
85994
  root: getCanonicalGlobalCommandRoot()
85915
85995
  }
@@ -86402,7 +86482,7 @@ function resolveHookScriptPath(scriptPath, projectDir) {
86402
86482
  if (resolved.startsWith(".claude/") || resolved === ".claude") {
86403
86483
  resolved = join86(projectDir, resolved);
86404
86484
  }
86405
- return resolve30(resolved);
86485
+ return resolve31(resolved);
86406
86486
  }
86407
86487
  function collectMissingHookReferences(settings, settingsFile, projectDir) {
86408
86488
  if (!settings.hooks)
@@ -87441,7 +87521,7 @@ import { platform as platform8 } from "node:os";
87441
87521
  // src/domains/health-checks/platform/environment-checker.ts
87442
87522
  init_environment();
87443
87523
  init_path_resolver();
87444
- import { constants as constants3, access as access4, mkdir as mkdir20, readFile as readFile42, unlink as unlink10, writeFile as writeFile20 } from "node:fs/promises";
87524
+ import { constants as constants3, access as access4, mkdir as mkdir21, readFile as readFile42, unlink as unlink10, writeFile as writeFile20 } from "node:fs/promises";
87445
87525
  import { arch as arch2, homedir as homedir44, platform as platform7 } from "node:os";
87446
87526
  import { join as join88, normalize as normalize7 } from "node:path";
87447
87527
  function shouldSkipExpensiveOperations4() {
@@ -87536,7 +87616,7 @@ async function checkGlobalDirAccess() {
87536
87616
  }
87537
87617
  const testFile = join88(globalDir, ".ck-doctor-access-test");
87538
87618
  try {
87539
- await mkdir20(globalDir, { recursive: true });
87619
+ await mkdir21(globalDir, { recursive: true });
87540
87620
  await writeFile20(testFile, "test", "utf-8");
87541
87621
  const content = await readFile42(testFile, "utf-8");
87542
87622
  await unlink10(testFile);
@@ -87611,7 +87691,7 @@ async function checkWSLBoundary() {
87611
87691
 
87612
87692
  // src/domains/health-checks/platform/windows-checker.ts
87613
87693
  init_path_resolver();
87614
- import { mkdir as mkdir21, symlink as symlink2, unlink as unlink11, writeFile as writeFile21 } from "node:fs/promises";
87694
+ import { mkdir as mkdir22, symlink as symlink2, unlink as unlink11, writeFile as writeFile21 } from "node:fs/promises";
87615
87695
  import { join as join89 } from "node:path";
87616
87696
  async function checkLongPathSupport() {
87617
87697
  if (shouldSkipExpensiveOperations4()) {
@@ -87667,7 +87747,7 @@ async function checkSymlinkSupport() {
87667
87747
  const target = join89(testDir, ".ck-symlink-test-target");
87668
87748
  const link = join89(testDir, ".ck-symlink-test-link");
87669
87749
  try {
87670
- await mkdir21(testDir, { recursive: true });
87750
+ await mkdir22(testDir, { recursive: true });
87671
87751
  await writeFile21(target, "test", "utf-8");
87672
87752
  await symlink2(target, link);
87673
87753
  await unlink11(link);
@@ -88430,14 +88510,14 @@ init_github_client();
88430
88510
  init_config_version_checker();
88431
88511
 
88432
88512
  // src/domains/sync/sync-engine.ts
88433
- import { lstat as lstat4, readFile as readFile43, readlink as readlink2, realpath as realpath6, stat as stat14 } from "node:fs/promises";
88513
+ import { lstat as lstat4, readFile as readFile43, readlink as readlink2, realpath as realpath6, stat as stat15 } from "node:fs/promises";
88434
88514
  import { isAbsolute as isAbsolute8, join as join91, normalize as normalize8, relative as relative15 } from "node:path";
88435
88515
 
88436
88516
  // src/services/file-operations/ownership-checker.ts
88437
88517
  init_metadata_migration();
88438
88518
  import { createHash as createHash6 } from "node:crypto";
88439
88519
  import { createReadStream as createReadStream2 } from "node:fs";
88440
- import { stat as stat13 } from "node:fs/promises";
88520
+ import { stat as stat14 } from "node:fs/promises";
88441
88521
  import { relative as relative14 } from "node:path";
88442
88522
 
88443
88523
  // src/shared/concurrent-file-ops.ts
@@ -88451,12 +88531,12 @@ async function mapWithLimit(items, fn, concurrency = DEFAULT_CONCURRENCY) {
88451
88531
  // src/services/file-operations/ownership-checker.ts
88452
88532
  class OwnershipChecker {
88453
88533
  static async calculateChecksum(filePath) {
88454
- return new Promise((resolve31, reject) => {
88534
+ return new Promise((resolve32, reject) => {
88455
88535
  const hash = createHash6("sha256");
88456
88536
  const stream = createReadStream2(filePath);
88457
88537
  stream.on("data", (chunk) => hash.update(chunk));
88458
88538
  stream.on("end", () => {
88459
- resolve31(hash.digest("hex"));
88539
+ resolve32(hash.digest("hex"));
88460
88540
  });
88461
88541
  stream.on("error", (err) => {
88462
88542
  stream.destroy();
@@ -88466,7 +88546,7 @@ class OwnershipChecker {
88466
88546
  }
88467
88547
  static async checkOwnership(filePath, metadata, claudeDir3) {
88468
88548
  try {
88469
- await stat13(filePath);
88549
+ await stat14(filePath);
88470
88550
  } catch {
88471
88551
  return { path: filePath, ownership: "user", exists: false };
88472
88552
  }
@@ -89741,7 +89821,7 @@ class SyncEngine {
89741
89821
  continue;
89742
89822
  }
89743
89823
  try {
89744
- await stat14(upstreamPath);
89824
+ await stat15(upstreamPath);
89745
89825
  } catch {
89746
89826
  plan.skipped.push(file);
89747
89827
  continue;
@@ -89755,7 +89835,7 @@ class SyncEngine {
89755
89835
  continue;
89756
89836
  }
89757
89837
  try {
89758
- await stat14(localPath);
89838
+ await stat15(localPath);
89759
89839
  } catch {
89760
89840
  plan.autoUpdate.push(file);
89761
89841
  continue;
@@ -91051,7 +91131,7 @@ init_github_client();
91051
91131
  init_environment();
91052
91132
  init_logger();
91053
91133
  init_safe_spinner();
91054
- import { mkdir as mkdir28, stat as stat17 } from "node:fs/promises";
91134
+ import { mkdir as mkdir29, stat as stat18 } from "node:fs/promises";
91055
91135
  import { tmpdir as tmpdir5 } from "node:os";
91056
91136
  import { join as join105 } from "node:path";
91057
91137
 
@@ -91105,7 +91185,7 @@ async function validateExtraction(extractDir) {
91105
91185
 
91106
91186
  // src/domains/installation/extraction/tar-extractor.ts
91107
91187
  init_logger();
91108
- import { copyFile as copyFile5, mkdir as mkdir26, readdir as readdir24, rm as rm10, stat as stat15 } from "node:fs/promises";
91188
+ import { copyFile as copyFile5, mkdir as mkdir27, readdir as readdir24, rm as rm10, stat as stat16 } from "node:fs/promises";
91109
91189
  import { join as join103 } from "node:path";
91110
91190
 
91111
91191
  // node_modules/@isaacs/fs-minipass/dist/esm/index.js
@@ -91654,10 +91734,10 @@ class Minipass extends EventEmitter3 {
91654
91734
  return this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
91655
91735
  }
91656
91736
  async promise() {
91657
- return new Promise((resolve33, reject) => {
91737
+ return new Promise((resolve34, reject) => {
91658
91738
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
91659
91739
  this.on("error", (er) => reject(er));
91660
- this.on("end", () => resolve33());
91740
+ this.on("end", () => resolve34());
91661
91741
  });
91662
91742
  }
91663
91743
  [Symbol.asyncIterator]() {
@@ -91676,7 +91756,7 @@ class Minipass extends EventEmitter3 {
91676
91756
  return Promise.resolve({ done: false, value: res });
91677
91757
  if (this[EOF])
91678
91758
  return stop();
91679
- let resolve33;
91759
+ let resolve34;
91680
91760
  let reject;
91681
91761
  const onerr = (er) => {
91682
91762
  this.off("data", ondata);
@@ -91690,19 +91770,19 @@ class Minipass extends EventEmitter3 {
91690
91770
  this.off("end", onend);
91691
91771
  this.off(DESTROYED, ondestroy);
91692
91772
  this.pause();
91693
- resolve33({ value, done: !!this[EOF] });
91773
+ resolve34({ value, done: !!this[EOF] });
91694
91774
  };
91695
91775
  const onend = () => {
91696
91776
  this.off("error", onerr);
91697
91777
  this.off("data", ondata);
91698
91778
  this.off(DESTROYED, ondestroy);
91699
91779
  stop();
91700
- resolve33({ done: true, value: undefined });
91780
+ resolve34({ done: true, value: undefined });
91701
91781
  };
91702
91782
  const ondestroy = () => onerr(new Error("stream destroyed"));
91703
91783
  return new Promise((res2, rej) => {
91704
91784
  reject = rej;
91705
- resolve33 = res2;
91785
+ resolve34 = res2;
91706
91786
  this.once(DESTROYED, ondestroy);
91707
91787
  this.once("error", onerr);
91708
91788
  this.once("end", onend);
@@ -92808,10 +92888,10 @@ class Minipass2 extends EventEmitter4 {
92808
92888
  return this[ENCODING2] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
92809
92889
  }
92810
92890
  async promise() {
92811
- return new Promise((resolve33, reject) => {
92891
+ return new Promise((resolve34, reject) => {
92812
92892
  this.on(DESTROYED2, () => reject(new Error("stream destroyed")));
92813
92893
  this.on("error", (er) => reject(er));
92814
- this.on("end", () => resolve33());
92894
+ this.on("end", () => resolve34());
92815
92895
  });
92816
92896
  }
92817
92897
  [Symbol.asyncIterator]() {
@@ -92830,7 +92910,7 @@ class Minipass2 extends EventEmitter4 {
92830
92910
  return Promise.resolve({ done: false, value: res });
92831
92911
  if (this[EOF2])
92832
92912
  return stop();
92833
- let resolve33;
92913
+ let resolve34;
92834
92914
  let reject;
92835
92915
  const onerr = (er) => {
92836
92916
  this.off("data", ondata);
@@ -92844,19 +92924,19 @@ class Minipass2 extends EventEmitter4 {
92844
92924
  this.off("end", onend);
92845
92925
  this.off(DESTROYED2, ondestroy);
92846
92926
  this.pause();
92847
- resolve33({ value, done: !!this[EOF2] });
92927
+ resolve34({ value, done: !!this[EOF2] });
92848
92928
  };
92849
92929
  const onend = () => {
92850
92930
  this.off("error", onerr);
92851
92931
  this.off("data", ondata);
92852
92932
  this.off(DESTROYED2, ondestroy);
92853
92933
  stop();
92854
- resolve33({ done: true, value: undefined });
92934
+ resolve34({ done: true, value: undefined });
92855
92935
  };
92856
92936
  const ondestroy = () => onerr(new Error("stream destroyed"));
92857
92937
  return new Promise((res2, rej) => {
92858
92938
  reject = rej;
92859
- resolve33 = res2;
92939
+ resolve34 = res2;
92860
92940
  this.once(DESTROYED2, ondestroy);
92861
92941
  this.once("error", onerr);
92862
92942
  this.once("end", onend);
@@ -93629,7 +93709,7 @@ var NULLS = new Array(156).join("\x00");
93629
93709
  var encString = (buf, off, size, str2) => str2 === undefined ? false : (buf.write(str2 + NULLS, off, size, "utf8"), str2.length !== Buffer.byteLength(str2) || str2.length > size);
93630
93710
 
93631
93711
  // node_modules/tar/dist/esm/pax.js
93632
- import { basename as basename22 } from "node:path";
93712
+ import { basename as basename23 } from "node:path";
93633
93713
  class Pax {
93634
93714
  atime;
93635
93715
  mtime;
@@ -93678,7 +93758,7 @@ class Pax {
93678
93758
  buf[i] = 0;
93679
93759
  }
93680
93760
  new Header({
93681
- path: ("PaxHeader/" + basename22(this.path ?? "")).slice(0, 99),
93761
+ path: ("PaxHeader/" + basename23(this.path ?? "")).slice(0, 99),
93682
93762
  mode: this.mode || 420,
93683
93763
  uid: this.uid,
93684
93764
  gid: this.gid,
@@ -94284,10 +94364,10 @@ class Minipass3 extends EventEmitter5 {
94284
94364
  return this[ENCODING3] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
94285
94365
  }
94286
94366
  async promise() {
94287
- return new Promise((resolve33, reject) => {
94367
+ return new Promise((resolve34, reject) => {
94288
94368
  this.on(DESTROYED3, () => reject(new Error("stream destroyed")));
94289
94369
  this.on("error", (er) => reject(er));
94290
- this.on("end", () => resolve33());
94370
+ this.on("end", () => resolve34());
94291
94371
  });
94292
94372
  }
94293
94373
  [Symbol.asyncIterator]() {
@@ -94306,7 +94386,7 @@ class Minipass3 extends EventEmitter5 {
94306
94386
  return Promise.resolve({ done: false, value: res });
94307
94387
  if (this[EOF3])
94308
94388
  return stop();
94309
- let resolve33;
94389
+ let resolve34;
94310
94390
  let reject;
94311
94391
  const onerr = (er) => {
94312
94392
  this.off("data", ondata);
@@ -94320,19 +94400,19 @@ class Minipass3 extends EventEmitter5 {
94320
94400
  this.off("end", onend);
94321
94401
  this.off(DESTROYED3, ondestroy);
94322
94402
  this.pause();
94323
- resolve33({ value, done: !!this[EOF3] });
94403
+ resolve34({ value, done: !!this[EOF3] });
94324
94404
  };
94325
94405
  const onend = () => {
94326
94406
  this.off("error", onerr);
94327
94407
  this.off("data", ondata);
94328
94408
  this.off(DESTROYED3, ondestroy);
94329
94409
  stop();
94330
- resolve33({ done: true, value: undefined });
94410
+ resolve34({ done: true, value: undefined });
94331
94411
  };
94332
94412
  const ondestroy = () => onerr(new Error("stream destroyed"));
94333
94413
  return new Promise((res2, rej) => {
94334
94414
  reject = rej;
94335
- resolve33 = res2;
94415
+ resolve34 = res2;
94336
94416
  this.once(DESTROYED3, ondestroy);
94337
94417
  this.once("error", onerr);
94338
94418
  this.once("end", onend);
@@ -95073,16 +95153,16 @@ var listFileSync = (opt) => {
95073
95153
  let fd;
95074
95154
  try {
95075
95155
  fd = fs10.openSync(file, "r");
95076
- const stat15 = fs10.fstatSync(fd);
95156
+ const stat16 = fs10.fstatSync(fd);
95077
95157
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
95078
- if (stat15.size < readSize) {
95079
- const buf = Buffer.allocUnsafe(stat15.size);
95080
- const read = fs10.readSync(fd, buf, 0, stat15.size, 0);
95158
+ if (stat16.size < readSize) {
95159
+ const buf = Buffer.allocUnsafe(stat16.size);
95160
+ const read = fs10.readSync(fd, buf, 0, stat16.size, 0);
95081
95161
  p.end(read === buf.byteLength ? buf : buf.subarray(0, read));
95082
95162
  } else {
95083
95163
  let pos2 = 0;
95084
95164
  const buf = Buffer.allocUnsafe(readSize);
95085
- while (pos2 < stat15.size) {
95165
+ while (pos2 < stat16.size) {
95086
95166
  const bytesRead = fs10.readSync(fd, buf, 0, readSize, pos2);
95087
95167
  if (bytesRead === 0)
95088
95168
  break;
@@ -95103,16 +95183,16 @@ var listFile = (opt, _files) => {
95103
95183
  const parse5 = new Parser(opt);
95104
95184
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
95105
95185
  const file = opt.file;
95106
- const p = new Promise((resolve33, reject) => {
95186
+ const p = new Promise((resolve34, reject) => {
95107
95187
  parse5.on("error", reject);
95108
- parse5.on("end", resolve33);
95109
- fs10.stat(file, (er, stat15) => {
95188
+ parse5.on("end", resolve34);
95189
+ fs10.stat(file, (er, stat16) => {
95110
95190
  if (er) {
95111
95191
  reject(er);
95112
95192
  } else {
95113
95193
  const stream = new ReadStream(file, {
95114
95194
  readSize,
95115
- size: stat15.size
95195
+ size: stat16.size
95116
95196
  });
95117
95197
  stream.on("error", reject);
95118
95198
  stream.pipe(parse5);
@@ -95296,21 +95376,21 @@ class WriteEntry extends Minipass3 {
95296
95376
  return super.emit(ev, ...data);
95297
95377
  }
95298
95378
  [LSTAT]() {
95299
- fs11.lstat(this.absolute, (er, stat15) => {
95379
+ fs11.lstat(this.absolute, (er, stat16) => {
95300
95380
  if (er) {
95301
95381
  return this.emit("error", er);
95302
95382
  }
95303
- this[ONLSTAT](stat15);
95383
+ this[ONLSTAT](stat16);
95304
95384
  });
95305
95385
  }
95306
- [ONLSTAT](stat15) {
95307
- this.statCache.set(this.absolute, stat15);
95308
- this.stat = stat15;
95309
- if (!stat15.isFile()) {
95310
- stat15.size = 0;
95386
+ [ONLSTAT](stat16) {
95387
+ this.statCache.set(this.absolute, stat16);
95388
+ this.stat = stat16;
95389
+ if (!stat16.isFile()) {
95390
+ stat16.size = 0;
95311
95391
  }
95312
- this.type = getType(stat15);
95313
- this.emit("stat", stat15);
95392
+ this.type = getType(stat16);
95393
+ this.emit("stat", stat16);
95314
95394
  this[PROCESS]();
95315
95395
  }
95316
95396
  [PROCESS]() {
@@ -95743,7 +95823,7 @@ class WriteEntryTar extends Minipass3 {
95743
95823
  return this;
95744
95824
  }
95745
95825
  }
95746
- var getType = (stat15) => stat15.isFile() ? "File" : stat15.isDirectory() ? "Directory" : stat15.isSymbolicLink() ? "SymbolicLink" : "Unsupported";
95826
+ var getType = (stat16) => stat16.isFile() ? "File" : stat16.isDirectory() ? "Directory" : stat16.isSymbolicLink() ? "SymbolicLink" : "Unsupported";
95747
95827
 
95748
95828
  // node_modules/yallist/dist/esm/index.js
95749
95829
  class Yallist {
@@ -96302,21 +96382,21 @@ class Pack extends Minipass3 {
96302
96382
  [STAT](job) {
96303
96383
  job.pending = true;
96304
96384
  this[JOBS] += 1;
96305
- const stat15 = this.follow ? "stat" : "lstat";
96306
- fs12[stat15](job.absolute, (er, stat16) => {
96385
+ const stat16 = this.follow ? "stat" : "lstat";
96386
+ fs12[stat16](job.absolute, (er, stat17) => {
96307
96387
  job.pending = false;
96308
96388
  this[JOBS] -= 1;
96309
96389
  if (er) {
96310
96390
  this.emit("error", er);
96311
96391
  } else {
96312
- this[ONSTAT](job, stat16);
96392
+ this[ONSTAT](job, stat17);
96313
96393
  }
96314
96394
  });
96315
96395
  }
96316
- [ONSTAT](job, stat15) {
96317
- this.statCache.set(job.absolute, stat15);
96318
- job.stat = stat15;
96319
- if (!this.filter(job.path, stat15)) {
96396
+ [ONSTAT](job, stat16) {
96397
+ this.statCache.set(job.absolute, stat16);
96398
+ job.stat = stat16;
96399
+ if (!this.filter(job.path, stat16)) {
96320
96400
  job.ignore = true;
96321
96401
  }
96322
96402
  this[PROCESS2]();
@@ -96492,8 +96572,8 @@ class PackSync extends Pack {
96492
96572
  pause() {}
96493
96573
  resume() {}
96494
96574
  [STAT](job) {
96495
- const stat15 = this.follow ? "statSync" : "lstatSync";
96496
- this[ONSTAT](job, fs12[stat15](job.absolute));
96575
+ const stat16 = this.follow ? "statSync" : "lstatSync";
96576
+ this[ONSTAT](job, fs12[stat16](job.absolute));
96497
96577
  }
96498
96578
  [READDIR](job) {
96499
96579
  this[ONREADDIR](job, fs12.readdirSync(job.absolute));
@@ -96735,7 +96815,7 @@ var checkCwd = (dir, cb) => {
96735
96815
  cb(er);
96736
96816
  });
96737
96817
  };
96738
- var mkdir24 = (dir, opt, cb) => {
96818
+ var mkdir25 = (dir, opt, cb) => {
96739
96819
  dir = normalizeWindowsPath(dir);
96740
96820
  const umask = opt.umask ?? 18;
96741
96821
  const mode = opt.mode | 448;
@@ -97258,7 +97338,7 @@ class Unpack extends Parser {
97258
97338
  }
97259
97339
  }
97260
97340
  [MKDIR](dir, mode, cb) {
97261
- mkdir24(normalizeWindowsPath(dir), {
97341
+ mkdir25(normalizeWindowsPath(dir), {
97262
97342
  uid: this.uid,
97263
97343
  gid: this.gid,
97264
97344
  processUid: this.processUid,
@@ -97673,11 +97753,11 @@ class UnpackSync extends Unpack {
97673
97753
  var extractFileSync = (opt) => {
97674
97754
  const u = new UnpackSync(opt);
97675
97755
  const file = opt.file;
97676
- const stat15 = fs17.statSync(file);
97756
+ const stat16 = fs17.statSync(file);
97677
97757
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
97678
97758
  const stream = new ReadStreamSync(file, {
97679
97759
  readSize,
97680
- size: stat15.size
97760
+ size: stat16.size
97681
97761
  });
97682
97762
  stream.pipe(u);
97683
97763
  };
@@ -97685,16 +97765,16 @@ var extractFile = (opt, _3) => {
97685
97765
  const u = new Unpack(opt);
97686
97766
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
97687
97767
  const file = opt.file;
97688
- const p = new Promise((resolve33, reject) => {
97768
+ const p = new Promise((resolve34, reject) => {
97689
97769
  u.on("error", reject);
97690
- u.on("close", resolve33);
97691
- fs17.stat(file, (er, stat15) => {
97770
+ u.on("close", resolve34);
97771
+ fs17.stat(file, (er, stat16) => {
97692
97772
  if (er) {
97693
97773
  reject(er);
97694
97774
  } else {
97695
97775
  const stream = new ReadStream(file, {
97696
97776
  readSize,
97697
- size: stat15.size
97777
+ size: stat16.size
97698
97778
  });
97699
97779
  stream.on("error", reject);
97700
97780
  stream.pipe(u);
@@ -97820,7 +97900,7 @@ var replaceAsync = (opt, files) => {
97820
97900
  };
97821
97901
  fs18.read(fd, headBuf, 0, 512, position, onread);
97822
97902
  };
97823
- const promise = new Promise((resolve33, reject) => {
97903
+ const promise = new Promise((resolve34, reject) => {
97824
97904
  p.on("error", reject);
97825
97905
  let flag = "r+";
97826
97906
  const onopen = (er, fd) => {
@@ -97845,7 +97925,7 @@ var replaceAsync = (opt, files) => {
97845
97925
  });
97846
97926
  p.pipe(stream);
97847
97927
  stream.on("error", reject);
97848
- stream.on("close", resolve33);
97928
+ stream.on("close", resolve34);
97849
97929
  addFilesAsync2(p, files);
97850
97930
  });
97851
97931
  });
@@ -97909,7 +97989,7 @@ var mtimeFilter = (opt) => {
97909
97989
  if (!opt.mtimeCache) {
97910
97990
  opt.mtimeCache = new Map;
97911
97991
  }
97912
- opt.filter = filter ? (path14, stat15) => filter(path14, stat15) && !((opt.mtimeCache?.get(path14) ?? stat15.mtime ?? 0) > (stat15.mtime ?? 0)) : (path14, stat15) => !((opt.mtimeCache?.get(path14) ?? stat15.mtime ?? 0) > (stat15.mtime ?? 0));
97992
+ opt.filter = filter ? (path14, stat16) => filter(path14, stat16) && !((opt.mtimeCache?.get(path14) ?? stat16.mtime ?? 0) > (stat16.mtime ?? 0)) : (path14, stat16) => !((opt.mtimeCache?.get(path14) ?? stat16.mtime ?? 0) > (stat16.mtime ?? 0));
97913
97993
  };
97914
97994
  // src/domains/installation/utils/archive-utils.ts
97915
97995
  init_types3();
@@ -97974,7 +98054,7 @@ function decodeFilePath(path14) {
97974
98054
  // src/domains/installation/utils/file-utils.ts
97975
98055
  init_logger();
97976
98056
  init_types3();
97977
- import { copyFile as copyFile4, lstat as lstat5, mkdir as mkdir25, readdir as readdir23 } from "node:fs/promises";
98057
+ import { copyFile as copyFile4, lstat as lstat5, mkdir as mkdir26, readdir as readdir23 } from "node:fs/promises";
97978
98058
  import { join as join102, relative as relative16 } from "node:path";
97979
98059
  async function withRetry(fn, retries = 3) {
97980
98060
  for (let i = 0;i < retries; i++) {
@@ -97994,7 +98074,7 @@ var isRetryable = (e2) => {
97994
98074
  };
97995
98075
  var delay = (ms) => new Promise((r2) => setTimeout(r2, ms));
97996
98076
  async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTracker) {
97997
- await mkdir25(destDir, { recursive: true });
98077
+ await mkdir26(destDir, { recursive: true });
97998
98078
  const entries = await readdir23(sourceDir, { encoding: "utf8" });
97999
98079
  for (const entry of entries) {
98000
98080
  const sourcePath = join102(sourceDir, entry);
@@ -98022,7 +98102,7 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
98022
98102
  }
98023
98103
  }
98024
98104
  async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
98025
- await mkdir25(destDir, { recursive: true });
98105
+ await mkdir26(destDir, { recursive: true });
98026
98106
  const entries = await readdir23(sourceDir, { encoding: "utf8" });
98027
98107
  for (const entry of entries) {
98028
98108
  const sourcePath = join102(sourceDir, entry);
@@ -98054,7 +98134,7 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
98054
98134
  class TarExtractor {
98055
98135
  async extract(archivePath, destDir, shouldExclude, sizeTracker) {
98056
98136
  const tempExtractDir = `${destDir}-temp`;
98057
- await mkdir26(tempExtractDir, { recursive: true });
98137
+ await mkdir27(tempExtractDir, { recursive: true });
98058
98138
  try {
98059
98139
  await extract({
98060
98140
  file: archivePath,
@@ -98075,7 +98155,7 @@ class TarExtractor {
98075
98155
  if (entries.length === 1) {
98076
98156
  const rootEntry = entries[0];
98077
98157
  const rootPath = join103(tempExtractDir, rootEntry);
98078
- const rootStat = await stat15(rootPath);
98158
+ const rootStat = await stat16(rootPath);
98079
98159
  if (rootStat.isDirectory()) {
98080
98160
  const rootContents = await readdir24(rootPath, { encoding: "utf8" });
98081
98161
  logger.debug(`Root directory '${rootEntry}' contains: ${rootContents.join(", ")}`);
@@ -98089,7 +98169,7 @@ class TarExtractor {
98089
98169
  await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
98090
98170
  }
98091
98171
  } else {
98092
- await mkdir26(destDir, { recursive: true });
98172
+ await mkdir27(destDir, { recursive: true });
98093
98173
  await copyFile5(rootPath, join103(destDir, rootEntry));
98094
98174
  }
98095
98175
  } else {
@@ -98112,33 +98192,33 @@ init_environment();
98112
98192
  init_logger();
98113
98193
  var import_extract_zip = __toESM(require_extract_zip(), 1);
98114
98194
  import { execFile as execFile11 } from "node:child_process";
98115
- import { copyFile as copyFile6, mkdir as mkdir27, readdir as readdir25, rm as rm11, stat as stat16 } from "node:fs/promises";
98195
+ import { copyFile as copyFile6, mkdir as mkdir28, readdir as readdir25, rm as rm11, stat as stat17 } from "node:fs/promises";
98116
98196
  import { join as join104 } from "node:path";
98117
98197
  class ZipExtractor {
98118
98198
  async tryNativeUnzip(archivePath, destDir) {
98119
98199
  if (!isMacOS()) {
98120
98200
  return false;
98121
98201
  }
98122
- return new Promise((resolve33) => {
98123
- mkdir27(destDir, { recursive: true }).then(() => {
98202
+ return new Promise((resolve34) => {
98203
+ mkdir28(destDir, { recursive: true }).then(() => {
98124
98204
  execFile11("unzip", ["-o", "-q", archivePath, "-d", destDir], (error, _stdout, stderr) => {
98125
98205
  if (error) {
98126
98206
  logger.debug(`Native unzip failed: ${stderr || error.message}`);
98127
- resolve33(false);
98207
+ resolve34(false);
98128
98208
  return;
98129
98209
  }
98130
98210
  logger.debug("Native unzip succeeded");
98131
- resolve33(true);
98211
+ resolve34(true);
98132
98212
  });
98133
98213
  }).catch((err) => {
98134
98214
  logger.debug(`Failed to create directory for native unzip: ${err.message}`);
98135
- resolve33(false);
98215
+ resolve34(false);
98136
98216
  });
98137
98217
  });
98138
98218
  }
98139
98219
  async extract(archivePath, destDir, shouldExclude, sizeTracker) {
98140
98220
  const tempExtractDir = `${destDir}-temp`;
98141
- await mkdir27(tempExtractDir, { recursive: true });
98221
+ await mkdir28(tempExtractDir, { recursive: true });
98142
98222
  try {
98143
98223
  const nativeSuccess = await this.tryNativeUnzip(archivePath, tempExtractDir);
98144
98224
  if (!nativeSuccess) {
@@ -98162,7 +98242,7 @@ class ZipExtractor {
98162
98242
  if (entries.length === 1) {
98163
98243
  const rootEntry = entries[0];
98164
98244
  const rootPath = join104(tempExtractDir, rootEntry);
98165
- const rootStat = await stat16(rootPath);
98245
+ const rootStat = await stat17(rootPath);
98166
98246
  if (rootStat.isDirectory()) {
98167
98247
  const rootContents = await readdir25(rootPath, { encoding: "utf8" });
98168
98248
  logger.debug(`Root directory '${rootEntry}' contains: ${rootContents.join(", ")}`);
@@ -98176,7 +98256,7 @@ class ZipExtractor {
98176
98256
  await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
98177
98257
  }
98178
98258
  } else {
98179
- await mkdir27(destDir, { recursive: true });
98259
+ await mkdir28(destDir, { recursive: true });
98180
98260
  await copyFile6(rootPath, join104(destDir, rootEntry));
98181
98261
  }
98182
98262
  } else {
@@ -98237,7 +98317,7 @@ class DownloadManager {
98237
98317
  return this.fileDownloader.downloadFile(params);
98238
98318
  }
98239
98319
  async extractArchive(archivePath, destDir, archiveType) {
98240
- const archiveStats = await stat17(archivePath);
98320
+ const archiveStats = await stat18(archivePath);
98241
98321
  if (archiveStats.size > MAX_ARCHIVE_SIZE) {
98242
98322
  throw new ExtractionError(`Archive exceeds ${formatBytes(MAX_ARCHIVE_SIZE)} limit: ${formatBytes(archiveStats.size)}`);
98243
98323
  }
@@ -98251,7 +98331,7 @@ class DownloadManager {
98251
98331
  try {
98252
98332
  this.sizeTracker.reset();
98253
98333
  const detectedType = archiveType || detectArchiveType(archivePath);
98254
- await mkdir28(destDir, { recursive: true });
98334
+ await mkdir29(destDir, { recursive: true });
98255
98335
  if (detectedType === "tar.gz") {
98256
98336
  await this.tarExtractor.extract(archivePath, destDir, this.shouldExclude, this.sizeTracker);
98257
98337
  } else if (detectedType === "zip") {
@@ -98278,7 +98358,7 @@ class DownloadManager {
98278
98358
  const counter = DownloadManager.tempDirCounter++;
98279
98359
  const primaryTempDir = join105(tmpdir5(), `claudekit-${timestamp}-${counter}`);
98280
98360
  try {
98281
- await mkdir28(primaryTempDir, { recursive: true });
98361
+ await mkdir29(primaryTempDir, { recursive: true });
98282
98362
  logger.debug(`Created temp directory: ${primaryTempDir}`);
98283
98363
  registerTempDir(primaryTempDir);
98284
98364
  return primaryTempDir;
@@ -98295,7 +98375,7 @@ Solutions:
98295
98375
  }
98296
98376
  const fallbackTempDir = join105(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
98297
98377
  try {
98298
- await mkdir28(fallbackTempDir, { recursive: true });
98378
+ await mkdir29(fallbackTempDir, { recursive: true });
98299
98379
  logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
98300
98380
  logger.warning(`Using fallback temp directory: ${fallbackTempDir}
98301
98381
  (OS temp directory was not accessible)`);
@@ -98341,8 +98421,8 @@ function buildReleaseAllowlist(layout) {
98341
98421
  async function ensureLayoutSourceDir(projectRoot, layout, strict) {
98342
98422
  const sourceDir = path14.join(projectRoot, layout.sourceDir);
98343
98423
  try {
98344
- const stat18 = await fs19.promises.stat(sourceDir);
98345
- if (!stat18.isDirectory()) {
98424
+ const stat19 = await fs19.promises.stat(sourceDir);
98425
+ if (!stat19.isDirectory()) {
98346
98426
  throw new Error(`Expected source directory "${layout.sourceDir}" exists but is not a directory.`);
98347
98427
  }
98348
98428
  return sourceDir;
@@ -98535,8 +98615,8 @@ async function useLocalKitPath(kitPath) {
98535
98615
  output.section("Using local kit");
98536
98616
  const absolutePath = path14.resolve(kitPath);
98537
98617
  try {
98538
- const stat18 = await fs19.promises.stat(absolutePath);
98539
- if (!stat18.isDirectory()) {
98618
+ const stat19 = await fs19.promises.stat(absolutePath);
98619
+ if (!stat19.isDirectory()) {
98540
98620
  throw new Error(`--kit-path must point to a directory, not a file.
98541
98621
 
98542
98622
  Provided path: ${absolutePath}
@@ -98569,8 +98649,8 @@ Please verify the path exists and is accessible.`);
98569
98649
  }
98570
98650
  const claudeDir3 = path14.join(kitRoot, layout.runtimeDir);
98571
98651
  try {
98572
- const stat18 = await fs19.promises.stat(claudeDir3);
98573
- if (!stat18.isDirectory()) {
98652
+ const stat19 = await fs19.promises.stat(claudeDir3);
98653
+ if (!stat19.isDirectory()) {
98574
98654
  logger.warning(`Warning: ${claudeDir3} exists but is not a directory.
98575
98655
  This may not be a valid ClaudeKit installation.`);
98576
98656
  }
@@ -98604,15 +98684,15 @@ async function extractLocalArchive(archivePath, exclude) {
98604
98684
  const absolutePath = path14.resolve(archivePath);
98605
98685
  validateArchiveFormat(absolutePath);
98606
98686
  try {
98607
- const stat18 = await fs19.promises.stat(absolutePath);
98608
- if (!stat18.isFile()) {
98687
+ const stat19 = await fs19.promises.stat(absolutePath);
98688
+ if (!stat19.isFile()) {
98609
98689
  throw new Error(`--archive must point to a file, not a directory.
98610
98690
 
98611
98691
  Provided path: ${absolutePath}
98612
98692
 
98613
98693
  If you meant to use an extracted kit directory, use --kit-path instead.`);
98614
98694
  }
98615
- if (stat18.size === 0) {
98695
+ if (stat19.size === 0) {
98616
98696
  throw new Error(`Archive file is empty: ${absolutePath}
98617
98697
 
98618
98698
  The file exists but contains no data. Please verify the archive is not corrupted.`);
@@ -98757,7 +98837,7 @@ import { join as join122 } from "node:path";
98757
98837
 
98758
98838
  // src/domains/installation/deletion-handler.ts
98759
98839
  import { existsSync as existsSync61, lstatSync as lstatSync3, readdirSync as readdirSync7, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
98760
- import { dirname as dirname35, join as join108, relative as relative17, resolve as resolve34, sep as sep10 } from "node:path";
98840
+ import { dirname as dirname35, join as join108, relative as relative17, resolve as resolve35, sep as sep10 } from "node:path";
98761
98841
 
98762
98842
  // src/services/file-operations/manifest/manifest-reader.ts
98763
98843
  init_metadata_migration();
@@ -98982,8 +99062,8 @@ function expandGlobPatterns(patterns, claudeDir3) {
98982
99062
  }
98983
99063
  var MAX_CLEANUP_ITERATIONS = 50;
98984
99064
  function cleanupEmptyDirectories(filePath, claudeDir3) {
98985
- const normalizedClaudeDir = resolve34(claudeDir3);
98986
- let currentDir = resolve34(dirname35(filePath));
99065
+ const normalizedClaudeDir = resolve35(claudeDir3);
99066
+ let currentDir = resolve35(dirname35(filePath));
98987
99067
  let iterations = 0;
98988
99068
  while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
98989
99069
  iterations++;
@@ -98992,7 +99072,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
98992
99072
  if (entries.length === 0) {
98993
99073
  rmdirSync(currentDir);
98994
99074
  logger.debug(`Removed empty directory: ${currentDir}`);
98995
- currentDir = resolve34(dirname35(currentDir));
99075
+ currentDir = resolve35(dirname35(currentDir));
98996
99076
  } else {
98997
99077
  break;
98998
99078
  }
@@ -99002,14 +99082,14 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
99002
99082
  }
99003
99083
  }
99004
99084
  function deletePath(fullPath, claudeDir3) {
99005
- const normalizedPath = resolve34(fullPath);
99006
- const normalizedClaudeDir = resolve34(claudeDir3);
99085
+ const normalizedPath = resolve35(fullPath);
99086
+ const normalizedClaudeDir = resolve35(claudeDir3);
99007
99087
  if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep10}`) && normalizedPath !== normalizedClaudeDir) {
99008
99088
  throw new Error(`Path traversal detected: ${fullPath}`);
99009
99089
  }
99010
99090
  try {
99011
- const stat18 = lstatSync3(fullPath);
99012
- if (stat18.isDirectory()) {
99091
+ const stat19 = lstatSync3(fullPath);
99092
+ if (stat19.isDirectory()) {
99013
99093
  rmSync2(fullPath, { recursive: true, force: true });
99014
99094
  } else {
99015
99095
  unlinkSync4(fullPath);
@@ -99076,8 +99156,8 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
99076
99156
  const result = { deletedPaths: [], preservedPaths: [], errors: [] };
99077
99157
  for (const path15 of deletions) {
99078
99158
  const fullPath = join108(claudeDir3, path15);
99079
- const normalizedPath = resolve34(fullPath);
99080
- const normalizedClaudeDir = resolve34(claudeDir3);
99159
+ const normalizedPath = resolve35(fullPath);
99160
+ const normalizedClaudeDir = resolve35(claudeDir3);
99081
99161
  if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep10}`)) {
99082
99162
  logger.warning(`Skipping invalid path: ${path15}`);
99083
99163
  result.errors.push(path15);
@@ -99118,7 +99198,7 @@ var import_ignore3 = __toESM(require_ignore(), 1);
99118
99198
  import { dirname as dirname38, join as join112, relative as relative19 } from "node:path";
99119
99199
 
99120
99200
  // src/domains/installation/selective-merger.ts
99121
- import { stat as stat18 } from "node:fs/promises";
99201
+ import { stat as stat19 } from "node:fs/promises";
99122
99202
  init_logger();
99123
99203
  var import_semver3 = __toESM(require_semver2(), 1);
99124
99204
 
@@ -99143,7 +99223,7 @@ class SelectiveMerger {
99143
99223
  async shouldCopyFile(destPath, relativePath) {
99144
99224
  let destStat;
99145
99225
  try {
99146
- destStat = await stat18(destPath);
99226
+ destStat = await stat19(destPath);
99147
99227
  } catch {
99148
99228
  if (this.claudeDir && this.installingKit) {
99149
99229
  const installed = await findFileInInstalledKits(this.claudeDir, relativePath, this.installingKit);
@@ -100791,7 +100871,7 @@ import { dirname as dirname37, join as join111 } from "node:path";
100791
100871
  // src/domains/config/installed-settings-tracker.ts
100792
100872
  init_shared();
100793
100873
  import { existsSync as existsSync62 } from "node:fs";
100794
- import { mkdir as mkdir29, readFile as readFile47, writeFile as writeFile24 } from "node:fs/promises";
100874
+ import { mkdir as mkdir30, readFile as readFile47, writeFile as writeFile24 } from "node:fs/promises";
100795
100875
  import { dirname as dirname36, join as join110 } from "node:path";
100796
100876
  var CK_JSON_FILE = ".ck.json";
100797
100877
 
@@ -100843,7 +100923,7 @@ class InstalledSettingsTracker {
100843
100923
  data.kits[this.kitName] = {};
100844
100924
  }
100845
100925
  data.kits[this.kitName].installedSettings = settings;
100846
- await mkdir29(dirname36(ckJsonPath), { recursive: true });
100926
+ await mkdir30(dirname36(ckJsonPath), { recursive: true });
100847
100927
  await writeFile24(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
100848
100928
  logger.debug(`Saved installed settings to ${ckJsonPath}`);
100849
100929
  } catch (error) {
@@ -101647,7 +101727,7 @@ class FileMerger {
101647
101727
  }
101648
101728
 
101649
101729
  // src/domains/migration/legacy-migration.ts
101650
- import { readdir as readdir27, stat as stat19 } from "node:fs/promises";
101730
+ import { readdir as readdir27, stat as stat20 } from "node:fs/promises";
101651
101731
  import { join as join116, relative as relative20 } from "node:path";
101652
101732
  // src/services/file-operations/manifest/manifest-tracker.ts
101653
101733
  import { join as join115 } from "node:path";
@@ -102078,7 +102158,7 @@ class LegacyMigration {
102078
102158
  const fullPath = join116(dir, entry);
102079
102159
  let stats;
102080
102160
  try {
102081
- stats = await stat19(fullPath);
102161
+ stats = await stat20(fullPath);
102082
102162
  } catch (err) {
102083
102163
  const error = err;
102084
102164
  if (error.code === "ENOENT") {
@@ -102312,7 +102392,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
102312
102392
  init_logger();
102313
102393
  init_skip_directories();
102314
102394
  var import_fs_extra22 = __toESM(require_lib3(), 1);
102315
- import { join as join117, relative as relative21, resolve as resolve35 } from "node:path";
102395
+ import { join as join117, relative as relative21, resolve as resolve36 } from "node:path";
102316
102396
 
102317
102397
  class FileScanner2 {
102318
102398
  static async getFiles(dirPath, relativeTo) {
@@ -102392,8 +102472,8 @@ class FileScanner2 {
102392
102472
  return customFiles;
102393
102473
  }
102394
102474
  static isSafePath(basePath, targetPath) {
102395
- const resolvedBase = resolve35(basePath);
102396
- const resolvedTarget = resolve35(targetPath);
102475
+ const resolvedBase = resolve36(basePath);
102476
+ const resolvedTarget = resolve36(targetPath);
102397
102477
  return resolvedTarget.startsWith(resolvedBase);
102398
102478
  }
102399
102479
  static toPosixPath(path16) {
@@ -102404,7 +102484,7 @@ class FileScanner2 {
102404
102484
  // src/services/transformers/commands-prefix/prefix-applier.ts
102405
102485
  init_logger();
102406
102486
  var import_fs_extra23 = __toESM(require_lib3(), 1);
102407
- import { lstat as lstat8, mkdir as mkdir30, readdir as readdir30, stat as stat20 } from "node:fs/promises";
102487
+ import { lstat as lstat8, mkdir as mkdir31, readdir as readdir30, stat as stat21 } from "node:fs/promises";
102408
102488
  import { join as join119 } from "node:path";
102409
102489
 
102410
102490
  // src/services/transformers/commands-prefix/content-transformer.ts
@@ -102562,7 +102642,7 @@ async function applyPrefix(extractDir) {
102562
102642
  }
102563
102643
  if (entries.length === 1 && entries[0] === "ck") {
102564
102644
  const ckDir2 = join119(commandsDir, "ck");
102565
- const ckStat = await stat20(ckDir2);
102645
+ const ckStat = await stat21(ckDir2);
102566
102646
  if (ckStat.isDirectory()) {
102567
102647
  logger.verbose("Commands already have /ck: prefix, skipping");
102568
102648
  return;
@@ -102570,9 +102650,9 @@ async function applyPrefix(extractDir) {
102570
102650
  }
102571
102651
  await import_fs_extra23.copy(commandsDir, backupDir);
102572
102652
  logger.verbose("Created backup of commands directory");
102573
- await mkdir30(tempDir, { recursive: true });
102653
+ await mkdir31(tempDir, { recursive: true });
102574
102654
  const ckDir = join119(tempDir, "ck");
102575
- await mkdir30(ckDir, { recursive: true });
102655
+ await mkdir31(ckDir, { recursive: true });
102576
102656
  let processedCount = 0;
102577
102657
  for (const entry of entries) {
102578
102658
  const sourcePath = join119(commandsDir, entry);
@@ -103433,7 +103513,7 @@ import { join as join129 } from "node:path";
103433
103513
 
103434
103514
  // src/domains/skills/migrator/migration-executor.ts
103435
103515
  init_logger();
103436
- import { copyFile as copyFile7, mkdir as mkdir31, readdir as readdir35, rm as rm12 } from "node:fs/promises";
103516
+ import { copyFile as copyFile7, mkdir as mkdir32, readdir as readdir35, rm as rm12 } from "node:fs/promises";
103437
103517
  import { join as join125 } from "node:path";
103438
103518
  var import_fs_extra30 = __toESM(require_lib3(), 1);
103439
103519
 
@@ -103596,7 +103676,7 @@ Detected changes:`;
103596
103676
 
103597
103677
  // src/domains/skills/migrator/migration-executor.ts
103598
103678
  async function copySkillDirectory(sourceDir, destDir) {
103599
- await mkdir31(destDir, { recursive: true });
103679
+ await mkdir32(destDir, { recursive: true });
103600
103680
  const entries = await readdir35(sourceDir, { withFileTypes: true });
103601
103681
  for (const entry of entries) {
103602
103682
  const sourcePath = join125(sourceDir, entry.name);
@@ -103616,7 +103696,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
103616
103696
  const preserved = [];
103617
103697
  const errors2 = [];
103618
103698
  const tempDir = join125(currentSkillsDir, "..", ".skills-migration-temp");
103619
- await mkdir31(tempDir, { recursive: true });
103699
+ await mkdir32(tempDir, { recursive: true });
103620
103700
  try {
103621
103701
  for (const mapping of mappings) {
103622
103702
  try {
@@ -103638,7 +103718,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
103638
103718
  const category = mapping.category;
103639
103719
  const targetPath = category ? join125(tempDir, category, skillName) : join125(tempDir, skillName);
103640
103720
  if (category) {
103641
- await mkdir31(join125(tempDir, category), { recursive: true });
103721
+ await mkdir32(join125(tempDir, category), { recursive: true });
103642
103722
  }
103643
103723
  await copySkillDirectory(currentSkillPath, targetPath);
103644
103724
  migrated.push(skillName);
@@ -103657,7 +103737,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
103657
103737
  }
103658
103738
  }
103659
103739
  await rm12(currentSkillsDir, { recursive: true, force: true });
103660
- await mkdir31(currentSkillsDir, { recursive: true });
103740
+ await mkdir32(currentSkillsDir, { recursive: true });
103661
103741
  await copySkillDirectory(tempDir, currentSkillsDir);
103662
103742
  await rm12(tempDir, { recursive: true, force: true });
103663
103743
  return { migrated, preserved, errors: errors2 };
@@ -103704,8 +103784,8 @@ function validateMigrationPath(path16, paramName) {
103704
103784
  init_logger();
103705
103785
  init_types3();
103706
103786
  var import_fs_extra31 = __toESM(require_lib3(), 1);
103707
- import { copyFile as copyFile8, mkdir as mkdir32, readdir as readdir36, rm as rm13, stat as stat21 } from "node:fs/promises";
103708
- import { basename as basename23, join as join126, normalize as normalize9 } from "node:path";
103787
+ import { copyFile as copyFile8, mkdir as mkdir33, readdir as readdir36, rm as rm13, stat as stat22 } from "node:fs/promises";
103788
+ import { basename as basename24, join as join126, normalize as normalize9 } from "node:path";
103709
103789
  function validatePath2(path16, paramName) {
103710
103790
  if (!path16 || typeof path16 !== "string") {
103711
103791
  throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
@@ -103734,7 +103814,7 @@ class SkillsBackupManager {
103734
103814
  const backupDir = parentDir ? join126(parentDir, backupDirName) : join126(skillsDir2, "..", backupDirName);
103735
103815
  logger.info(`Creating backup at: ${backupDir}`);
103736
103816
  try {
103737
- await mkdir32(backupDir, { recursive: true });
103817
+ await mkdir33(backupDir, { recursive: true });
103738
103818
  await SkillsBackupManager.copyDirectory(skillsDir2, backupDir);
103739
103819
  logger.success("Backup created successfully");
103740
103820
  return backupDir;
@@ -103756,7 +103836,7 @@ class SkillsBackupManager {
103756
103836
  if (await import_fs_extra31.pathExists(targetDir)) {
103757
103837
  await rm13(targetDir, { recursive: true, force: true });
103758
103838
  }
103759
- await mkdir32(targetDir, { recursive: true });
103839
+ await mkdir33(targetDir, { recursive: true });
103760
103840
  await SkillsBackupManager.copyDirectory(backupDir, targetDir);
103761
103841
  logger.success("Backup restored successfully");
103762
103842
  } catch (error) {
@@ -103816,7 +103896,7 @@ class SkillsBackupManager {
103816
103896
  continue;
103817
103897
  }
103818
103898
  if (entry.isDirectory()) {
103819
- await mkdir32(destPath, { recursive: true });
103899
+ await mkdir33(destPath, { recursive: true });
103820
103900
  await SkillsBackupManager.copyDirectory(sourcePath, destPath);
103821
103901
  } else if (entry.isFile()) {
103822
103902
  await copyFile8(sourcePath, destPath);
@@ -103834,14 +103914,14 @@ class SkillsBackupManager {
103834
103914
  if (entry.isDirectory()) {
103835
103915
  size += await SkillsBackupManager.getDirectorySize(fullPath);
103836
103916
  } else if (entry.isFile()) {
103837
- const stats = await stat21(fullPath);
103917
+ const stats = await stat22(fullPath);
103838
103918
  size += stats.size;
103839
103919
  }
103840
103920
  }
103841
103921
  return size;
103842
103922
  }
103843
103923
  static extractBackupTimestamp(backupPath) {
103844
- const dirName = basename23(backupPath);
103924
+ const dirName = basename24(backupPath);
103845
103925
  if (!dirName.startsWith(SkillsBackupManager.BACKUP_PREFIX)) {
103846
103926
  return null;
103847
103927
  }
@@ -103882,12 +103962,12 @@ async function getAllFiles(dirPath) {
103882
103962
  return files;
103883
103963
  }
103884
103964
  async function hashFile(filePath) {
103885
- return new Promise((resolve36, reject) => {
103965
+ return new Promise((resolve37, reject) => {
103886
103966
  const hash = createHash8("sha256");
103887
103967
  const stream = createReadStream3(filePath);
103888
103968
  stream.on("data", (chunk) => hash.update(chunk));
103889
103969
  stream.on("end", () => {
103890
- resolve36(hash.digest("hex"));
103970
+ resolve37(hash.digest("hex"));
103891
103971
  });
103892
103972
  stream.on("error", (error) => {
103893
103973
  stream.destroy();
@@ -104230,7 +104310,7 @@ async function handleMigration(ctx) {
104230
104310
  return ctx;
104231
104311
  }
104232
104312
  // src/commands/init/phases/opencode-handler.ts
104233
- import { cp as cp3, readdir as readdir40, rm as rm14 } from "node:fs/promises";
104313
+ import { cp as cp4, readdir as readdir40, rm as rm14 } from "node:fs/promises";
104234
104314
  import { join as join132 } from "node:path";
104235
104315
 
104236
104316
  // src/services/transformers/opencode-path-transformer.ts
@@ -104363,7 +104443,7 @@ async function handleOpenCode(ctx) {
104363
104443
  continue;
104364
104444
  }
104365
104445
  }
104366
- await cp3(sourcePath, targetPath, { recursive: true });
104446
+ await cp4(sourcePath, targetPath, { recursive: true });
104367
104447
  logger.verbose(`Copied: ${entry.name}`);
104368
104448
  }
104369
104449
  await rm14(openCodeSource, { recursive: true, force: true });
@@ -104535,8 +104615,8 @@ async function handlePostInstall(ctx) {
104535
104615
  // src/commands/init/phases/selection-handler.ts
104536
104616
  init_config_manager();
104537
104617
  init_github_client();
104538
- import { mkdir as mkdir33 } from "node:fs/promises";
104539
- import { join as join135, resolve as resolve37 } from "node:path";
104618
+ import { mkdir as mkdir34 } from "node:fs/promises";
104619
+ import { join as join135, resolve as resolve38 } from "node:path";
104540
104620
 
104541
104621
  // src/domains/github/kit-access-checker.ts
104542
104622
  init_logger();
@@ -104667,7 +104747,7 @@ async function runPreflightChecks() {
104667
104747
  // src/domains/installation/fresh-installer.ts
104668
104748
  init_metadata_migration();
104669
104749
  import { existsSync as existsSync63, readdirSync as readdirSync8, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
104670
- import { basename as basename24, dirname as dirname39, join as join134, resolve as resolve36 } from "node:path";
104750
+ import { basename as basename25, dirname as dirname39, join as join134, resolve as resolve37 } from "node:path";
104671
104751
  init_logger();
104672
104752
  init_safe_spinner();
104673
104753
  var import_fs_extra37 = __toESM(require_lib3(), 1);
@@ -104715,15 +104795,15 @@ async function analyzeFreshInstallation(claudeDir3) {
104715
104795
  };
104716
104796
  }
104717
104797
  function cleanupEmptyDirectories2(filePath, claudeDir3) {
104718
- const normalizedClaudeDir = resolve36(claudeDir3);
104719
- let currentDir = resolve36(dirname39(filePath));
104798
+ const normalizedClaudeDir = resolve37(claudeDir3);
104799
+ let currentDir = resolve37(dirname39(filePath));
104720
104800
  while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
104721
104801
  try {
104722
104802
  const entries = readdirSync8(currentDir);
104723
104803
  if (entries.length === 0) {
104724
104804
  rmdirSync2(currentDir);
104725
104805
  logger.debug(`Removed empty directory: ${currentDir}`);
104726
- currentDir = resolve36(dirname39(currentDir));
104806
+ currentDir = resolve37(dirname39(currentDir));
104727
104807
  } else {
104728
104808
  break;
104729
104809
  }
@@ -104881,7 +104961,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
104881
104961
  mutatePaths: backupTargets.mutatePaths,
104882
104962
  scope: "claude"
104883
104963
  });
104884
- await cleanupOldDestructiveOperationBackups(undefined, basename24(backup.backupDir));
104964
+ await cleanupOldDestructiveOperationBackups(undefined, basename25(backup.backupDir));
104885
104965
  backupSpinner.succeed(`Recovery backup saved to ${backup.backupDir}`);
104886
104966
  } catch (error) {
104887
104967
  backupSpinner.fail("Failed to create recovery backup");
@@ -105090,7 +105170,7 @@ async function handleSelection(ctx) {
105090
105170
  }
105091
105171
  }
105092
105172
  }
105093
- const resolvedDir = resolve37(targetDir);
105173
+ const resolvedDir = resolve38(targetDir);
105094
105174
  logger.info(`Target directory: ${resolvedDir}`);
105095
105175
  if (!ctx.options.global && PathResolver.isLocalSameAsGlobal(resolvedDir)) {
105096
105176
  logger.warning("You're at HOME directory. Installing here modifies your GLOBAL ClaudeKit.");
@@ -105114,7 +105194,7 @@ async function handleSelection(ctx) {
105114
105194
  }
105115
105195
  if (!await import_fs_extra38.pathExists(resolvedDir)) {
105116
105196
  if (ctx.options.global) {
105117
- await mkdir33(resolvedDir, { recursive: true });
105197
+ await mkdir34(resolvedDir, { recursive: true });
105118
105198
  logger.info(`Created global directory: ${resolvedDir}`);
105119
105199
  } else {
105120
105200
  logger.error(`Directory does not exist: ${resolvedDir}`);
@@ -105268,8 +105348,8 @@ async function handleSelection(ctx) {
105268
105348
  };
105269
105349
  }
105270
105350
  // src/commands/init/phases/sync-handler.ts
105271
- import { copyFile as copyFile9, mkdir as mkdir34, open as open5, readFile as readFile57, rename as rename11, stat as stat22, unlink as unlink12, writeFile as writeFile32 } from "node:fs/promises";
105272
- import { dirname as dirname40, join as join136, resolve as resolve38 } from "node:path";
105351
+ import { copyFile as copyFile9, mkdir as mkdir35, open as open5, readFile as readFile57, rename as rename11, stat as stat23, unlink as unlink12, writeFile as writeFile32 } from "node:fs/promises";
105352
+ import { dirname as dirname40, join as join136, resolve as resolve39 } from "node:path";
105273
105353
  init_logger();
105274
105354
  init_path_resolver();
105275
105355
  var import_fs_extra39 = __toESM(require_lib3(), 1);
@@ -105278,7 +105358,7 @@ async function handleSync(ctx) {
105278
105358
  if (!ctx.options.sync) {
105279
105359
  return ctx;
105280
105360
  }
105281
- const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve38(ctx.options.dir || ".");
105361
+ const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve39(ctx.options.dir || ".");
105282
105362
  const claudeDir3 = ctx.options.global ? resolvedDir : join136(resolvedDir, ".claude");
105283
105363
  if (!await import_fs_extra39.pathExists(claudeDir3)) {
105284
105364
  logger.error("Cannot sync: no .claude directory found");
@@ -105388,7 +105468,7 @@ async function acquireSyncLock(global3) {
105388
105468
  const lockPath = join136(cacheDir, ".sync-lock");
105389
105469
  const startTime = Date.now();
105390
105470
  const lockTimeout = getLockTimeout();
105391
- await mkdir34(dirname40(lockPath), { recursive: true });
105471
+ await mkdir35(dirname40(lockPath), { recursive: true });
105392
105472
  while (Date.now() - startTime < lockTimeout) {
105393
105473
  try {
105394
105474
  const handle = await open5(lockPath, "wx");
@@ -105399,7 +105479,7 @@ async function acquireSyncLock(global3) {
105399
105479
  } catch (err) {
105400
105480
  if (err.code === "EEXIST") {
105401
105481
  try {
105402
- const lockStat = await stat22(lockPath);
105482
+ const lockStat = await stat23(lockPath);
105403
105483
  const lockAge = Math.abs(Date.now() - lockStat.mtimeMs);
105404
105484
  if (lockAge > STALE_LOCK_THRESHOLD_MS) {
105405
105485
  logger.warning(`Removing stale sync lock (age: ${Math.round(lockAge / 1000)}s)`);
@@ -105412,7 +105492,7 @@ async function acquireSyncLock(global3) {
105412
105492
  }
105413
105493
  logger.debug(`Lock stat failed: ${statError}`);
105414
105494
  }
105415
- await new Promise((resolve39) => setTimeout(resolve39, 100));
105495
+ await new Promise((resolve40) => setTimeout(resolve40, 100));
105416
105496
  continue;
105417
105497
  }
105418
105498
  throw err;
@@ -105468,7 +105548,7 @@ async function executeSyncMerge(ctx) {
105468
105548
  const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
105469
105549
  const targetDir = join136(targetPath, "..");
105470
105550
  try {
105471
- await mkdir34(targetDir, { recursive: true });
105551
+ await mkdir35(targetDir, { recursive: true });
105472
105552
  } catch (mkdirError) {
105473
105553
  const errCode = mkdirError.code;
105474
105554
  if (errCode === "ENOSPC") {
@@ -105631,14 +105711,14 @@ function displaySyncPlan(plan) {
105631
105711
  console.log(import_picocolors26.default.dim("─".repeat(40)));
105632
105712
  }
105633
105713
  async function createBackup(claudeDir3, files, backupDir) {
105634
- await mkdir34(backupDir, { recursive: true });
105714
+ await mkdir35(backupDir, { recursive: true });
105635
105715
  for (const file of files) {
105636
105716
  try {
105637
105717
  const sourcePath = await validateSyncPath(claudeDir3, file.path);
105638
105718
  if (await import_fs_extra39.pathExists(sourcePath)) {
105639
105719
  const targetPath = await validateSyncPath(backupDir, file.path);
105640
105720
  const targetDir = join136(targetPath, "..");
105641
- await mkdir34(targetDir, { recursive: true });
105721
+ await mkdir35(targetDir, { recursive: true });
105642
105722
  await copyFile9(sourcePath, targetPath);
105643
105723
  }
105644
105724
  } catch (error) {
@@ -106055,8 +106135,8 @@ function transformContent(content, options2 = {}) {
106055
106135
  }
106056
106136
  function shouldTransformFile3(filename) {
106057
106137
  const ext2 = extname6(filename).toLowerCase();
106058
- const basename25 = filename.split("/").pop() || filename;
106059
- return TRANSFORMABLE_EXTENSIONS3.has(ext2) || ALWAYS_TRANSFORM_FILES.has(basename25);
106138
+ const basename26 = filename.split("/").pop() || filename;
106139
+ return TRANSFORMABLE_EXTENSIONS3.has(ext2) || ALWAYS_TRANSFORM_FILES.has(basename26);
106060
106140
  }
106061
106141
  async function transformPathsForGlobalInstall(directory, options2 = {}) {
106062
106142
  let filesTransformed = 0;
@@ -106337,13 +106417,13 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
106337
106417
  import { existsSync as existsSync64 } from "node:fs";
106338
106418
  import { readFile as readFile61, rm as rm16, unlink as unlink13 } from "node:fs/promises";
106339
106419
  import { homedir as homedir50 } from "node:os";
106340
- import { basename as basename26, join as join142, resolve as resolve40 } from "node:path";
106420
+ import { basename as basename27, join as join142, resolve as resolve41 } from "node:path";
106341
106421
  init_logger();
106342
106422
 
106343
106423
  // src/ui/ck-cli-design/tokens.ts
106344
106424
  var import_picocolors27 = __toESM(require_picocolors(), 1);
106345
106425
  import { homedir as homedir48, platform as platform16 } from "node:os";
106346
- import { resolve as resolve39, win32 as win323 } from "node:path";
106426
+ import { resolve as resolve40, win32 as win323 } from "node:path";
106347
106427
  var PANEL_MIN_WIDTH = 60;
106348
106428
  var PANEL_MAX_WIDTH = 72;
106349
106429
  var DEFAULT_WIDTH = PANEL_MAX_WIDTH;
@@ -106513,7 +106593,7 @@ function formatCdHint(value, currentPlatform = platform16()) {
106513
106593
  const absolutePath2 = win323.resolve(value);
106514
106594
  return `cd /d "${absolutePath2}"`;
106515
106595
  }
106516
- const absolutePath = resolve39(value);
106596
+ const absolutePath = resolve40(value);
106517
106597
  const displayPath = formatDisplayPath(absolutePath);
106518
106598
  if (displayPath.includes(" ")) {
106519
106599
  return `cd "${displayPath}"`;
@@ -106809,7 +106889,7 @@ init_model_taxonomy();
106809
106889
  init_logger();
106810
106890
  init_dist2();
106811
106891
  init_model_taxonomy();
106812
- import { mkdir as mkdir35, readFile as readFile60, writeFile as writeFile35 } from "node:fs/promises";
106892
+ import { mkdir as mkdir36, readFile as readFile60, writeFile as writeFile35 } from "node:fs/promises";
106813
106893
  import { homedir as homedir49 } from "node:os";
106814
106894
  import { dirname as dirname41, join as join141 } from "node:path";
106815
106895
  function getOpenCodeConfigPath(options2) {
@@ -106913,7 +106993,7 @@ async function ensureOpenCodeModel(options2) {
106913
106993
  }
106914
106994
  }
106915
106995
  const next = { ...existing ?? {}, model: chosenModel };
106916
- await mkdir35(dirname41(configPath), { recursive: true });
106996
+ await mkdir36(dirname41(configPath), { recursive: true });
106917
106997
  await writeFile35(configPath, `${JSON.stringify(next, null, 2)}
106918
106998
  `, "utf-8");
106919
106999
  return {
@@ -106926,7 +107006,7 @@ async function ensureOpenCodeModel(options2) {
106926
107006
 
106927
107007
  // src/commands/portable/plan-display.ts
106928
107008
  var import_picocolors28 = __toESM(require_picocolors(), 1);
106929
- import { basename as basename25, dirname as dirname42, extname as extname7 } from "node:path";
107009
+ import { basename as basename26, dirname as dirname42, extname as extname7 } from "node:path";
106930
107010
  var DEFAULT_MAX_PLAN_GROUP_ITEMS = 20;
106931
107011
  var TYPE_ORDER = [
106932
107012
  "agent",
@@ -107162,7 +107242,7 @@ function normalizeWhereDestination(path16, portableType) {
107162
107242
  return dirname42(path16);
107163
107243
  }
107164
107244
  if (portableType === "rules") {
107165
- const fileName = basename25(path16).toLowerCase();
107245
+ const fileName = basename26(path16).toLowerCase();
107166
107246
  if (fileName === "agents.md" || fileName === "gemini.md" || fileName === ".goosehints" || fileName === "custom_modes.yaml" || fileName === "custom_modes.yml") {
107167
107247
  return path16;
107168
107248
  }
@@ -107636,7 +107716,7 @@ function shouldExecuteAction2(action) {
107636
107716
  }
107637
107717
  async function executeDeleteAction(action, options2) {
107638
107718
  const preservePaths = options2?.preservePaths ?? new Set;
107639
- const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve40(action.targetPath));
107719
+ const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve41(action.targetPath));
107640
107720
  try {
107641
107721
  if (!shouldPreserveTarget && action.targetPath && existsSync64(action.targetPath)) {
107642
107722
  await rm16(action.targetPath, { recursive: true, force: true });
@@ -107669,7 +107749,7 @@ async function executeDeleteAction(action, options2) {
107669
107749
  async function processMetadataDeletions(skillSourcePath, installGlobally) {
107670
107750
  if (!skillSourcePath)
107671
107751
  return;
107672
- const sourceMetadataPath = join142(resolve40(skillSourcePath, ".."), "metadata.json");
107752
+ const sourceMetadataPath = join142(resolve41(skillSourcePath, ".."), "metadata.json");
107673
107753
  if (!existsSync64(sourceMetadataPath))
107674
107754
  return;
107675
107755
  let sourceMetadata;
@@ -108080,15 +108160,15 @@ async function migrateCommand(options2) {
108080
108160
  allResults.push(...taskResults);
108081
108161
  for (const result of taskResults.filter((entry) => entry.success && !entry.skipped)) {
108082
108162
  if (result.path.length > 0) {
108083
- writtenPaths.add(resolve40(result.path));
108163
+ writtenPaths.add(resolve41(result.path));
108084
108164
  }
108085
108165
  if (task.type === "hooks") {
108086
108166
  const existing = successfulHookFiles.get(task.provider) ?? [];
108087
- existing.push(basename26(result.path));
108167
+ existing.push(basename27(result.path));
108088
108168
  successfulHookFiles.set(task.provider, existing);
108089
108169
  if (result.path.length > 0) {
108090
108170
  const absExisting = successfulHookAbsPaths.get(task.provider) ?? [];
108091
- absExisting.push(resolve40(result.path));
108171
+ absExisting.push(resolve41(result.path));
108092
108172
  successfulHookAbsPaths.set(task.provider, absExisting);
108093
108173
  }
108094
108174
  }
@@ -108111,6 +108191,31 @@ async function migrateCommand(options2) {
108111
108191
  postProgressWarnings.push(`Could not update opencode.json model (${err instanceof Error ? err.message : String(err)}). Agents may fail with ProviderModelNotFoundError until a model is set.`);
108112
108192
  }
108113
108193
  }
108194
+ if (hooksSource && successfulHookFiles.size > 0) {
108195
+ for (const hooksProvider of successfulHookFiles.keys()) {
108196
+ const providerCfg = providers[hooksProvider];
108197
+ const targetHooksDir = installGlobally ? providerCfg.hooks?.globalPath : providerCfg.hooks?.projectPath;
108198
+ if (!targetHooksDir)
108199
+ continue;
108200
+ const companionResult = await copyHooksCompanionDirs(hooksSource, targetHooksDir);
108201
+ if (companionResult.errors.length > 0) {
108202
+ for (const e2 of companionResult.errors) {
108203
+ postProgressWarnings.push(`Hook companion copy warning (${e2.name}): ${e2.error}`);
108204
+ }
108205
+ }
108206
+ logger.verbose(`[migrate] Copied hook companions to ${hooksProvider}: dirs=[${companionResult.copiedDirs.join(",")}] dotfiles=[${companionResult.copiedDotfiles.join(",")}]`);
108207
+ const companionParts = [];
108208
+ if (companionResult.copiedDirs.length > 0) {
108209
+ companionParts.push(`${companionResult.copiedDirs.join(", ")}`);
108210
+ }
108211
+ if (companionResult.copiedDotfiles.length > 0) {
108212
+ companionParts.push(companionResult.copiedDotfiles.join(", "));
108213
+ }
108214
+ if (companionParts.length > 0) {
108215
+ f2.info(import_picocolors30.default.dim(`Copied hook companions to ${hooksProvider}: ${companionParts.join(" + ")}`));
108216
+ }
108217
+ }
108218
+ }
108114
108219
  for (const [hooksProvider, files] of successfulHookFiles) {
108115
108220
  if (files.length === 0)
108116
108221
  continue;
@@ -108156,14 +108261,14 @@ async function migrateCommand(options2) {
108156
108261
  });
108157
108262
  if (staleSlugs.length > 0) {
108158
108263
  const staleSlugSet = new Set(staleSlugs.map((s) => `${s}.toml`));
108159
- const removed = await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === installGlobally && staleSlugSet.has(basename26(i.path)));
108264
+ const removed = await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === installGlobally && staleSlugSet.has(basename27(i.path)));
108160
108265
  for (const entry of removed) {
108161
108266
  logger.verbose(`[migrate] Cleaned stale registry entry: ${entry.item} (${provider})`);
108162
108267
  }
108163
108268
  }
108164
108269
  }
108165
108270
  try {
108166
- const kitRoot = (agentSource ? resolve40(agentSource, "..") : null) ?? (commandSource ? resolve40(commandSource, "..") : null) ?? (skillSource ? resolve40(skillSource, "..") : null) ?? null;
108271
+ const kitRoot = (agentSource ? resolve41(agentSource, "..") : null) ?? (commandSource ? resolve41(commandSource, "..") : null) ?? (skillSource ? resolve41(skillSource, "..") : null) ?? null;
108167
108272
  const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
108168
108273
  if (manifest?.cliVersion) {
108169
108274
  await updateAppliedManifestVersion(manifest.cliVersion);
@@ -108216,8 +108321,8 @@ async function rollbackResults(results) {
108216
108321
  try {
108217
108322
  if (result.overwritten)
108218
108323
  continue;
108219
- const stat23 = await import("node:fs/promises").then((fs20) => fs20.stat(result.path));
108220
- if (stat23.isDirectory()) {
108324
+ const stat24 = await import("node:fs/promises").then((fs20) => fs20.stat(result.path));
108325
+ if (stat24.isDirectory()) {
108221
108326
  await rm16(result.path, { recursive: true, force: true });
108222
108327
  } else {
108223
108328
  await unlink13(result.path);
@@ -108358,7 +108463,7 @@ var import_picocolors31 = __toESM(require_picocolors(), 1);
108358
108463
 
108359
108464
  // src/commands/new/phases/directory-setup.ts
108360
108465
  init_config_manager();
108361
- import { resolve as resolve41 } from "node:path";
108466
+ import { resolve as resolve42 } from "node:path";
108362
108467
  init_logger();
108363
108468
  init_path_resolver();
108364
108469
  init_types3();
@@ -108443,7 +108548,7 @@ async function directorySetup(validOptions, prompts) {
108443
108548
  targetDir = await prompts.getDirectory(targetDir);
108444
108549
  }
108445
108550
  }
108446
- const resolvedDir = resolve41(targetDir);
108551
+ const resolvedDir = resolve42(targetDir);
108447
108552
  logger.info(`Target directory: ${resolvedDir}`);
108448
108553
  if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
108449
108554
  logger.warning("You're creating a project at HOME directory.");
@@ -108777,7 +108882,7 @@ Please use only one download method.`);
108777
108882
  // src/commands/plan/plan-command.ts
108778
108883
  init_output_manager();
108779
108884
  import { existsSync as existsSync67, statSync as statSync12 } from "node:fs";
108780
- import { dirname as dirname46, isAbsolute as isAbsolute11, join as join147, parse as parse7, resolve as resolve45 } from "node:path";
108885
+ import { dirname as dirname46, isAbsolute as isAbsolute11, join as join147, parse as parse7, resolve as resolve46 } from "node:path";
108781
108886
 
108782
108887
  // src/commands/plan/plan-read-handlers.ts
108783
108888
  init_config();
@@ -108787,7 +108892,7 @@ init_logger();
108787
108892
  init_output_manager();
108788
108893
  var import_picocolors32 = __toESM(require_picocolors(), 1);
108789
108894
  import { existsSync as existsSync66, statSync as statSync11 } from "node:fs";
108790
- import { basename as basename27, dirname as dirname44, join as join146, relative as relative27, resolve as resolve43 } from "node:path";
108895
+ import { basename as basename28, dirname as dirname44, join as join146, relative as relative27, resolve as resolve44 } from "node:path";
108791
108896
 
108792
108897
  // src/commands/plan/plan-dependencies.ts
108793
108898
  init_config();
@@ -108845,14 +108950,14 @@ init_config();
108845
108950
  init_plan_parser();
108846
108951
  init_plan_scope();
108847
108952
  init_plans_registry();
108848
- import { isAbsolute as isAbsolute10, resolve as resolve42 } from "node:path";
108953
+ import { isAbsolute as isAbsolute10, resolve as resolve43 } from "node:path";
108849
108954
  async function getGlobalPlansDirFromCwd() {
108850
108955
  const projectRoot = findProjectRoot(process.cwd());
108851
108956
  const { config } = await CkConfigManager.loadFull(projectRoot);
108852
108957
  return resolveGlobalPlansDir(config);
108853
108958
  }
108854
108959
  function resolveTargetFromBase(target, baseDir) {
108855
- const resolvedTarget = isAbsolute10(target) ? resolve42(target) : resolve42(baseDir, target);
108960
+ const resolvedTarget = isAbsolute10(target) ? resolve43(target) : resolve43(baseDir, target);
108856
108961
  return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
108857
108962
  }
108858
108963
 
@@ -108885,7 +108990,7 @@ async function handleParse(target, options2) {
108885
108990
  console.log(JSON.stringify({ file: relative27(process.cwd(), planFile), frontmatter, phases }, null, 2));
108886
108991
  return;
108887
108992
  }
108888
- const title = typeof frontmatter.title === "string" ? frontmatter.title : basename27(dirname44(planFile));
108993
+ const title = typeof frontmatter.title === "string" ? frontmatter.title : basename28(dirname44(planFile));
108889
108994
  console.log();
108890
108995
  console.log(import_picocolors32.default.bold(` Plan: ${title}`));
108891
108996
  console.log(` File: ${planFile}`);
@@ -108955,7 +109060,7 @@ async function handleStatus(target, options2) {
108955
109060
  return;
108956
109061
  }
108957
109062
  const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
108958
- const t = effectiveTarget ? resolve43(effectiveTarget) : null;
109063
+ const t = effectiveTarget ? resolve44(effectiveTarget) : null;
108959
109064
  const plansDir = t && existsSync66(t) && statSync11(t).isDirectory() && !existsSync66(join146(t, "plan.md")) ? t : null;
108960
109065
  if (plansDir) {
108961
109066
  const planFiles = scanPlanDir(plansDir);
@@ -108996,7 +109101,7 @@ async function handleStatus(target, options2) {
108996
109101
  const blockedBy2 = await resolvePlanDependencies(s.blockedBy, pf, { preloadedConfig });
108997
109102
  const blocks2 = await resolvePlanDependencies(s.blocks, pf, { preloadedConfig });
108998
109103
  const bar = progressBar(s.completed, s.totalPhases);
108999
- const title2 = s.title ?? basename27(dirname44(pf));
109104
+ const title2 = s.title ?? basename28(dirname44(pf));
109000
109105
  console.log(` ${import_picocolors32.default.bold(title2)}`);
109001
109106
  console.log(` ${bar}`);
109002
109107
  if (s.inProgress > 0)
@@ -109015,7 +109120,7 @@ async function handleStatus(target, options2) {
109015
109120
  }
109016
109121
  console.log();
109017
109122
  } catch {
109018
- console.log(` [X] Failed to read: ${basename27(dirname44(pf))}`);
109123
+ console.log(` [X] Failed to read: ${basename28(dirname44(pf))}`);
109019
109124
  console.log();
109020
109125
  }
109021
109126
  }
@@ -109042,7 +109147,7 @@ async function handleStatus(target, options2) {
109042
109147
  console.log(JSON.stringify({ ...summary, dependencyStatus: { blockedBy, blocks } }, null, 2));
109043
109148
  return;
109044
109149
  }
109045
- const title = summary.title ?? basename27(dirname44(planFile));
109150
+ const title = summary.title ?? basename28(dirname44(planFile));
109046
109151
  console.log();
109047
109152
  console.log(import_picocolors32.default.bold(` ${title}`));
109048
109153
  if (summary.status)
@@ -109140,7 +109245,7 @@ init_plan_parser();
109140
109245
  init_plans_registry();
109141
109246
  init_output_manager();
109142
109247
  var import_picocolors33 = __toESM(require_picocolors(), 1);
109143
- import { basename as basename28, dirname as dirname45, relative as relative28, resolve as resolve44 } from "node:path";
109248
+ import { basename as basename29, dirname as dirname45, relative as relative28, resolve as resolve45 } from "node:path";
109144
109249
  async function handleCreate(target, options2) {
109145
109250
  if (!options2.title) {
109146
109251
  output.error("[X] --title is required for create");
@@ -109172,13 +109277,13 @@ async function handleCreate(target, options2) {
109172
109277
  return;
109173
109278
  }
109174
109279
  const globalBaseDir = options2.global ? await getGlobalPlansDirFromCwd() : undefined;
109175
- const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve44(dir);
109280
+ const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve45(dir);
109176
109281
  if (globalBaseDir && !resolvedDir) {
109177
109282
  output.error("[X] Target directory must stay within the configured global plans root");
109178
109283
  process.exitCode = 1;
109179
109284
  return;
109180
109285
  }
109181
- const safeResolvedDir = resolvedDir ?? resolve44(dir);
109286
+ const safeResolvedDir = resolvedDir ?? resolve45(dir);
109182
109287
  const result = scaffoldPlan({
109183
109288
  title: options2.title,
109184
109289
  phases: phaseNames.map((name2) => ({ name: name2 })),
@@ -109216,7 +109321,7 @@ async function handleCreate(target, options2) {
109216
109321
  console.log(` Directory: ${safeResolvedDir}`);
109217
109322
  console.log(` Phases: ${result.phaseFiles.length}`);
109218
109323
  for (const f3 of result.phaseFiles) {
109219
- console.log(` [ ] ${basename28(f3)}`);
109324
+ console.log(` [ ] ${basename29(f3)}`);
109220
109325
  }
109221
109326
  console.log();
109222
109327
  }
@@ -109354,22 +109459,22 @@ async function handleAddPhase(target, options2) {
109354
109459
  // src/commands/plan/plan-command.ts
109355
109460
  function resolveTargetPath(target, baseDir) {
109356
109461
  if (!baseDir) {
109357
- return resolve45(target);
109462
+ return resolve46(target);
109358
109463
  }
109359
109464
  if (isAbsolute11(target)) {
109360
- return resolve45(target);
109465
+ return resolve46(target);
109361
109466
  }
109362
- const cwdCandidate = resolve45(target);
109467
+ const cwdCandidate = resolve46(target);
109363
109468
  if (existsSync67(cwdCandidate)) {
109364
109469
  return cwdCandidate;
109365
109470
  }
109366
- return resolve45(baseDir, target);
109471
+ return resolve46(baseDir, target);
109367
109472
  }
109368
109473
  function resolvePlanFile(target, baseDir) {
109369
- const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve45(baseDir) : process.cwd();
109474
+ const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve46(baseDir) : process.cwd();
109370
109475
  if (existsSync67(t)) {
109371
- const stat23 = statSync12(t);
109372
- if (stat23.isFile())
109476
+ const stat24 = statSync12(t);
109477
+ if (stat24.isFile())
109373
109478
  return t;
109374
109479
  const candidate = join147(t, "plan.md");
109375
109480
  if (existsSync67(candidate))
@@ -109430,7 +109535,7 @@ async function planCommand(action, target, options2) {
109430
109535
  let resolvedTarget = target;
109431
109536
  if (resolvedAction && !knownActions.has(resolvedAction)) {
109432
109537
  const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
109433
- const existsOnDisk = !looksLikePath && existsSync67(resolve45(resolvedAction));
109538
+ const existsOnDisk = !looksLikePath && existsSync67(resolve46(resolvedAction));
109434
109539
  if (looksLikePath || existsOnDisk) {
109435
109540
  resolvedTarget = resolvedAction;
109436
109541
  resolvedAction = undefined;
@@ -109473,11 +109578,11 @@ init_logger();
109473
109578
  init_safe_prompts();
109474
109579
  var import_picocolors34 = __toESM(require_picocolors(), 1);
109475
109580
  import { existsSync as existsSync68 } from "node:fs";
109476
- import { resolve as resolve46 } from "node:path";
109581
+ import { resolve as resolve47 } from "node:path";
109477
109582
  async function handleAdd(projectPath, options2) {
109478
109583
  logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
109479
109584
  intro("Add Project");
109480
- const absolutePath = resolve46(projectPath);
109585
+ const absolutePath = resolve47(projectPath);
109481
109586
  if (!existsSync68(absolutePath)) {
109482
109587
  log.error(`Path does not exist: ${absolutePath}`);
109483
109588
  process.exitCode = 1;
@@ -110582,7 +110687,7 @@ async function detectInstallations() {
110582
110687
 
110583
110688
  // src/commands/uninstall/removal-handler.ts
110584
110689
  import { readdirSync as readdirSync10, rmSync as rmSync5 } from "node:fs";
110585
- import { basename as basename29, join as join150, resolve as resolve47, sep as sep12 } from "node:path";
110690
+ import { basename as basename30, join as join150, resolve as resolve48, sep as sep12 } from "node:path";
110586
110691
  init_logger();
110587
110692
  init_safe_prompts();
110588
110693
  init_safe_spinner();
@@ -110763,8 +110868,8 @@ async function restoreUninstallBackup(backup) {
110763
110868
  }
110764
110869
  async function isPathSafeToRemove(filePath, baseDir) {
110765
110870
  try {
110766
- const resolvedPath = resolve47(filePath);
110767
- const resolvedBase = resolve47(baseDir);
110871
+ const resolvedPath = resolve48(filePath);
110872
+ const resolvedBase = resolve48(baseDir);
110768
110873
  if (!resolvedPath.startsWith(resolvedBase + sep12) && resolvedPath !== resolvedBase) {
110769
110874
  logger.debug(`Path outside installation directory: ${filePath}`);
110770
110875
  return false;
@@ -110772,7 +110877,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
110772
110877
  const stats = await import_fs_extra44.lstat(filePath);
110773
110878
  if (stats.isSymbolicLink()) {
110774
110879
  const realPath = await import_fs_extra44.realpath(filePath);
110775
- const resolvedReal = resolve47(realPath);
110880
+ const resolvedReal = resolve48(realPath);
110776
110881
  if (!resolvedReal.startsWith(resolvedBase + sep12) && resolvedReal !== resolvedBase) {
110777
110882
  logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
110778
110883
  return false;
@@ -110818,7 +110923,7 @@ async function removeInstallations(installations, options2) {
110818
110923
  scope: installation.type,
110819
110924
  kit: options2.kit
110820
110925
  });
110821
- await cleanupOldDestructiveOperationBackups(undefined, basename29(backup.backupDir));
110926
+ await cleanupOldDestructiveOperationBackups(undefined, basename30(backup.backupDir));
110822
110927
  backupSpinner.succeed(`Recovery backup saved to ${backup.backupDir}`);
110823
110928
  } catch (error) {
110824
110929
  backupSpinner.fail("Failed to create recovery backup");
@@ -111235,7 +111340,7 @@ function getDisclaimerMarker() {
111235
111340
  return AI_DISCLAIMER;
111236
111341
  }
111237
111342
  function spawnAndCollect2(command, args) {
111238
- return new Promise((resolve48, reject) => {
111343
+ return new Promise((resolve49, reject) => {
111239
111344
  const child = spawn7(command, args, { stdio: ["ignore", "pipe", "pipe"] });
111240
111345
  const chunks = [];
111241
111346
  const stderrChunks = [];
@@ -111248,7 +111353,7 @@ function spawnAndCollect2(command, args) {
111248
111353
  reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
111249
111354
  return;
111250
111355
  }
111251
- resolve48(Buffer.concat(chunks).toString("utf-8"));
111356
+ resolve49(Buffer.concat(chunks).toString("utf-8"));
111252
111357
  });
111253
111358
  });
111254
111359
  }
@@ -111356,7 +111461,7 @@ function formatResponse(content, showBranding) {
111356
111461
  return disclaimer + formatted + branding;
111357
111462
  }
111358
111463
  async function postViaGh(owner, repo, issueNumber, body) {
111359
- return new Promise((resolve48, reject) => {
111464
+ return new Promise((resolve49, reject) => {
111360
111465
  const args = [
111361
111466
  "issue",
111362
111467
  "comment",
@@ -111378,7 +111483,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
111378
111483
  reject(new Error(`gh exited with code ${code2}: ${stderr}`));
111379
111484
  return;
111380
111485
  }
111381
- resolve48();
111486
+ resolve49();
111382
111487
  });
111383
111488
  });
111384
111489
  }
@@ -111496,7 +111601,7 @@ After completing the implementation:
111496
111601
  "--allowedTools",
111497
111602
  tools
111498
111603
  ];
111499
- await new Promise((resolve48, reject) => {
111604
+ await new Promise((resolve49, reject) => {
111500
111605
  const child = spawn9("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
111501
111606
  child.stdin.write(prompt);
111502
111607
  child.stdin.end();
@@ -111521,7 +111626,7 @@ After completing the implementation:
111521
111626
  reject(new Error(`Claude exited ${code2}: ${stderr.slice(0, 500)}`));
111522
111627
  return;
111523
111628
  }
111524
- resolve48();
111629
+ resolve49();
111525
111630
  });
111526
111631
  });
111527
111632
  }
@@ -111665,7 +111770,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
111665
111770
  return processedThisHour < maxPerHour;
111666
111771
  }
111667
111772
  function spawnAndCollect3(command, args) {
111668
- return new Promise((resolve48, reject) => {
111773
+ return new Promise((resolve49, reject) => {
111669
111774
  const child = spawn10(command, args, { stdio: ["ignore", "pipe", "pipe"] });
111670
111775
  const chunks = [];
111671
111776
  const stderrChunks = [];
@@ -111678,13 +111783,13 @@ function spawnAndCollect3(command, args) {
111678
111783
  reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
111679
111784
  return;
111680
111785
  }
111681
- resolve48(Buffer.concat(chunks).toString("utf-8"));
111786
+ resolve49(Buffer.concat(chunks).toString("utf-8"));
111682
111787
  });
111683
111788
  });
111684
111789
  }
111685
111790
 
111686
111791
  // src/commands/watch/phases/issue-processor.ts
111687
- import { mkdir as mkdir36, writeFile as writeFile37 } from "node:fs/promises";
111792
+ import { mkdir as mkdir37, writeFile as writeFile37 } from "node:fs/promises";
111688
111793
  import { join as join153 } from "node:path";
111689
111794
 
111690
111795
  // src/commands/watch/phases/approval-detector.ts
@@ -111730,7 +111835,7 @@ async function invokeClaude(options2) {
111730
111835
  return collectClaudeOutput(child, options2.timeoutSec, verbose);
111731
111836
  }
111732
111837
  function collectClaudeOutput(child, timeoutSec, verbose = false) {
111733
- return new Promise((resolve48, reject) => {
111838
+ return new Promise((resolve49, reject) => {
111734
111839
  const chunks = [];
111735
111840
  const stderrChunks = [];
111736
111841
  child.stdout?.on("data", (chunk) => {
@@ -111760,7 +111865,7 @@ function collectClaudeOutput(child, timeoutSec, verbose = false) {
111760
111865
  reject(new Error(`Claude exited with code ${code2}: ${stderr}`));
111761
111866
  return;
111762
111867
  }
111763
- resolve48(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
111868
+ resolve49(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
111764
111869
  });
111765
111870
  });
111766
111871
  }
@@ -112062,7 +112167,7 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
112062
112167
  }
112063
112168
 
112064
112169
  // src/commands/watch/phases/plan-dir-finder.ts
112065
- import { readdir as readdir44, stat as stat23 } from "node:fs/promises";
112170
+ import { readdir as readdir44, stat as stat24 } from "node:fs/promises";
112066
112171
  import { join as join152 } from "node:path";
112067
112172
  async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
112068
112173
  const plansRoot = join152(cwd2, "plans");
@@ -112075,13 +112180,13 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
112075
112180
  if (entry === "watch" || entry === "reports" || entry === "visuals")
112076
112181
  continue;
112077
112182
  const dirPath = join152(plansRoot, entry);
112078
- const dirStat = await stat23(dirPath);
112183
+ const dirStat = await stat24(dirPath);
112079
112184
  if (!dirStat.isDirectory())
112080
112185
  continue;
112081
112186
  if (dirStat.mtimeMs < tenMinAgo)
112082
112187
  continue;
112083
112188
  try {
112084
- await stat23(join152(dirPath, "plan.md"));
112189
+ await stat24(join152(dirPath, "plan.md"));
112085
112190
  } catch {
112086
112191
  continue;
112087
112192
  }
@@ -112317,7 +112422,7 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
112317
112422
  } else {
112318
112423
  try {
112319
112424
  const planDir = join153(projectDir, "plans", "watch");
112320
- await mkdir36(planDir, { recursive: true });
112425
+ await mkdir37(planDir, { recursive: true });
112321
112426
  const planFilePath = join153(planDir, `issue-${issue.number}-plan.md`);
112322
112427
  await writeFile37(planFilePath, planResult.planText, "utf-8");
112323
112428
  state.activeIssues[numStr].planPath = planFilePath;
@@ -112464,7 +112569,7 @@ init_ck_config_manager();
112464
112569
  init_file_io();
112465
112570
  init_logger();
112466
112571
  import { existsSync as existsSync70 } from "node:fs";
112467
- import { mkdir as mkdir37, readFile as readFile64 } from "node:fs/promises";
112572
+ import { mkdir as mkdir38, readFile as readFile64 } from "node:fs/promises";
112468
112573
  import { dirname as dirname48 } from "node:path";
112469
112574
  var PROCESSED_ISSUES_CAP = 500;
112470
112575
  async function readCkJson(projectDir) {
@@ -112497,7 +112602,7 @@ async function saveWatchState(projectDir, state) {
112497
112602
  const configPath = CkConfigManager.getProjectConfigPath(projectDir);
112498
112603
  const configDir = dirname48(configPath);
112499
112604
  if (!existsSync70(configDir)) {
112500
- await mkdir37(configDir, { recursive: true });
112605
+ await mkdir38(configDir, { recursive: true });
112501
112606
  }
112502
112607
  const raw2 = await readCkJson(projectDir);
112503
112608
  const watchRaw = raw2.watch ?? {};
@@ -112624,7 +112729,7 @@ async function processImplementationQueue(state, config, setup, options2, watchL
112624
112729
  init_logger();
112625
112730
  import { spawnSync as spawnSync7 } from "node:child_process";
112626
112731
  import { existsSync as existsSync71 } from "node:fs";
112627
- import { readdir as readdir45, stat as stat24 } from "node:fs/promises";
112732
+ import { readdir as readdir45, stat as stat25 } from "node:fs/promises";
112628
112733
  import { join as join154 } from "node:path";
112629
112734
  async function scanForRepos(parentDir) {
112630
112735
  const repos = [];
@@ -112633,7 +112738,7 @@ async function scanForRepos(parentDir) {
112633
112738
  if (entry.startsWith("."))
112634
112739
  continue;
112635
112740
  const fullPath = join154(parentDir, entry);
112636
- const entryStat = await stat24(fullPath);
112741
+ const entryStat = await stat25(fullPath);
112637
112742
  if (!entryStat.isDirectory())
112638
112743
  continue;
112639
112744
  const gitDir = join154(fullPath, ".git");
@@ -112712,7 +112817,7 @@ init_logger();
112712
112817
  init_path_resolver();
112713
112818
  import { createWriteStream as createWriteStream3, statSync as statSync13 } from "node:fs";
112714
112819
  import { existsSync as existsSync73 } from "node:fs";
112715
- import { mkdir as mkdir38, rename as rename13 } from "node:fs/promises";
112820
+ import { mkdir as mkdir39, rename as rename13 } from "node:fs/promises";
112716
112821
  import { join as join156 } from "node:path";
112717
112822
 
112718
112823
  class WatchLogger {
@@ -112727,7 +112832,7 @@ class WatchLogger {
112727
112832
  async init() {
112728
112833
  try {
112729
112834
  if (!existsSync73(this.logDir)) {
112730
- await mkdir38(this.logDir, { recursive: true });
112835
+ await mkdir39(this.logDir, { recursive: true });
112731
112836
  }
112732
112837
  const dateStr = formatDate(new Date);
112733
112838
  this.logPath = join156(this.logDir, `watch-${dateStr}.log`);
@@ -113024,7 +113129,7 @@ function formatQueueInfo(state) {
113024
113129
  return "idle";
113025
113130
  }
113026
113131
  function sleep(ms) {
113027
- return new Promise((resolve48) => setTimeout(resolve48, ms));
113132
+ return new Promise((resolve49) => setTimeout(resolve49, ms));
113028
113133
  }
113029
113134
  // src/cli/command-registry.ts
113030
113135
  init_logger();
@@ -113185,7 +113290,7 @@ init_types3();
113185
113290
  init_logger();
113186
113291
  init_path_resolver();
113187
113292
  import { existsSync as existsSync85 } from "node:fs";
113188
- import { mkdir as mkdir39, readFile as readFile66, writeFile as writeFile40 } from "node:fs/promises";
113293
+ import { mkdir as mkdir40, readFile as readFile66, writeFile as writeFile40 } from "node:fs/promises";
113189
113294
  import { join as join168 } from "node:path";
113190
113295
 
113191
113296
  class VersionCacheManager {
@@ -113220,7 +113325,7 @@ class VersionCacheManager {
113220
113325
  const cacheDir = PathResolver.getCacheDir(false);
113221
113326
  try {
113222
113327
  if (!existsSync85(cacheDir)) {
113223
- await mkdir39(cacheDir, { recursive: true, mode: 448 });
113328
+ await mkdir40(cacheDir, { recursive: true, mode: 448 });
113224
113329
  }
113225
113330
  await writeFile40(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
113226
113331
  logger.debug(`Version check cache saved to ${cacheFile}`);