claudekit-cli 3.41.4-dev.21 → 3.41.4-dev.23

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
@@ -18683,9 +18683,10 @@ var init_safe_spinner = __esm(() => {
18683
18683
  });
18684
18684
 
18685
18685
  // src/shared/path-resolver.ts
18686
+ import { createHash as createHash3 } from "node:crypto";
18686
18687
  import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
18687
18688
  import { homedir as homedir9, platform as platform2 } from "node:os";
18688
- import { join as join11, normalize } from "node:path";
18689
+ import { join as join11, normalize, resolve as resolve3 } from "node:path";
18689
18690
  function getEnvVar(name) {
18690
18691
  const val = process.env[name];
18691
18692
  if (!val || val.trim() === "")
@@ -18875,6 +18876,20 @@ class PathResolver {
18875
18876
  static isGlobPattern(pattern) {
18876
18877
  return pattern.includes("*") || pattern.includes("?") || pattern.includes("{");
18877
18878
  }
18879
+ static computeProjectHash(projectRoot) {
18880
+ let normalized = resolve3(projectRoot).replace(/[/\\]+$/, "");
18881
+ if (process.platform === "darwin" || process.platform === "win32") {
18882
+ normalized = normalized.toLowerCase();
18883
+ }
18884
+ return createHash3("sha256").update(normalized).digest("hex").slice(0, 12);
18885
+ }
18886
+ static getPlansRegistriesDir() {
18887
+ return join11(PathResolver.getGlobalKitDir(), "plans-registries");
18888
+ }
18889
+ static getPlansRegistryPath(projectRoot) {
18890
+ const hash = PathResolver.computeProjectHash(projectRoot);
18891
+ return join11(PathResolver.getPlansRegistriesDir(), `${hash}.json`);
18892
+ }
18878
18893
  }
18879
18894
  var init_path_resolver = () => {};
18880
18895
 
@@ -18885,8 +18900,8 @@ var require_universalify = __commonJS((exports) => {
18885
18900
  if (typeof args[args.length - 1] === "function")
18886
18901
  fn.apply(this, args);
18887
18902
  else {
18888
- return new Promise((resolve3, reject) => {
18889
- args.push((err, res) => err != null ? reject(err) : resolve3(res));
18903
+ return new Promise((resolve4, reject) => {
18904
+ args.push((err, res) => err != null ? reject(err) : resolve4(res));
18890
18905
  fn.apply(this, args);
18891
18906
  });
18892
18907
  }
@@ -18959,19 +18974,19 @@ var require_fs = __commonJS((exports) => {
18959
18974
  if (typeof callback === "function") {
18960
18975
  return fs.exists(filename, callback);
18961
18976
  }
18962
- return new Promise((resolve3) => {
18963
- return fs.exists(filename, resolve3);
18977
+ return new Promise((resolve4) => {
18978
+ return fs.exists(filename, resolve4);
18964
18979
  });
18965
18980
  };
18966
18981
  exports.read = function(fd, buffer, offset, length, position, callback) {
18967
18982
  if (typeof callback === "function") {
18968
18983
  return fs.read(fd, buffer, offset, length, position, callback);
18969
18984
  }
18970
- return new Promise((resolve3, reject) => {
18985
+ return new Promise((resolve4, reject) => {
18971
18986
  fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
18972
18987
  if (err)
18973
18988
  return reject(err);
18974
- resolve3({ bytesRead, buffer: buffer2 });
18989
+ resolve4({ bytesRead, buffer: buffer2 });
18975
18990
  });
18976
18991
  });
18977
18992
  };
@@ -18979,11 +18994,11 @@ var require_fs = __commonJS((exports) => {
18979
18994
  if (typeof args[args.length - 1] === "function") {
18980
18995
  return fs.write(fd, buffer, ...args);
18981
18996
  }
18982
- return new Promise((resolve3, reject) => {
18997
+ return new Promise((resolve4, reject) => {
18983
18998
  fs.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
18984
18999
  if (err)
18985
19000
  return reject(err);
18986
- resolve3({ bytesWritten, buffer: buffer2 });
19001
+ resolve4({ bytesWritten, buffer: buffer2 });
18987
19002
  });
18988
19003
  });
18989
19004
  };
@@ -18991,11 +19006,11 @@ var require_fs = __commonJS((exports) => {
18991
19006
  if (typeof args[args.length - 1] === "function") {
18992
19007
  return fs.readv(fd, buffers, ...args);
18993
19008
  }
18994
- return new Promise((resolve3, reject) => {
19009
+ return new Promise((resolve4, reject) => {
18995
19010
  fs.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
18996
19011
  if (err)
18997
19012
  return reject(err);
18998
- resolve3({ bytesRead, buffers: buffers2 });
19013
+ resolve4({ bytesRead, buffers: buffers2 });
18999
19014
  });
19000
19015
  });
19001
19016
  };
@@ -19003,11 +19018,11 @@ var require_fs = __commonJS((exports) => {
19003
19018
  if (typeof args[args.length - 1] === "function") {
19004
19019
  return fs.writev(fd, buffers, ...args);
19005
19020
  }
19006
- return new Promise((resolve3, reject) => {
19021
+ return new Promise((resolve4, reject) => {
19007
19022
  fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
19008
19023
  if (err)
19009
19024
  return reject(err);
19010
- resolve3({ bytesWritten, buffers: buffers2 });
19025
+ resolve4({ bytesWritten, buffers: buffers2 });
19011
19026
  });
19012
19027
  });
19013
19028
  };
@@ -25604,11 +25619,11 @@ var require_raw_body = __commonJS((exports, module) => {
25604
25619
  if (done) {
25605
25620
  return readStream(stream, encoding, length, limit, wrap2(done));
25606
25621
  }
25607
- return new Promise(function executor(resolve6, reject) {
25622
+ return new Promise(function executor(resolve7, reject) {
25608
25623
  readStream(stream, encoding, length, limit, function onRead(err, buf) {
25609
25624
  if (err)
25610
25625
  return reject(err);
25611
- resolve6(buf);
25626
+ resolve7(buf);
25612
25627
  });
25613
25628
  });
25614
25629
  }
@@ -38714,7 +38729,7 @@ var require_view = __commonJS((exports, module) => {
38714
38729
  var basename5 = path2.basename;
38715
38730
  var extname2 = path2.extname;
38716
38731
  var join18 = path2.join;
38717
- var resolve6 = path2.resolve;
38732
+ var resolve7 = path2.resolve;
38718
38733
  module.exports = View;
38719
38734
  function View(name, options2) {
38720
38735
  var opts = options2 || {};
@@ -38748,7 +38763,7 @@ var require_view = __commonJS((exports, module) => {
38748
38763
  debug('lookup "%s"', name);
38749
38764
  for (var i = 0;i < roots.length && !path3; i++) {
38750
38765
  var root = roots[i];
38751
- var loc = resolve6(root, name);
38766
+ var loc = resolve7(root, name);
38752
38767
  var dir = dirname6(loc);
38753
38768
  var file = basename5(loc);
38754
38769
  path3 = this.resolve(dir, file);
@@ -40932,7 +40947,7 @@ var require_application = __commonJS((exports, module) => {
40932
40947
  var compileETag = require_utils6().compileETag;
40933
40948
  var compileQueryParser = require_utils6().compileQueryParser;
40934
40949
  var compileTrust = require_utils6().compileTrust;
40935
- var resolve6 = __require("node:path").resolve;
40950
+ var resolve7 = __require("node:path").resolve;
40936
40951
  var once = require_once();
40937
40952
  var Router = require_router();
40938
40953
  var slice = Array.prototype.slice;
@@ -40986,7 +41001,7 @@ var require_application = __commonJS((exports, module) => {
40986
41001
  this.mountpath = "/";
40987
41002
  this.locals.settings = this.settings;
40988
41003
  this.set("view", View);
40989
- this.set("views", resolve6("views"));
41004
+ this.set("views", resolve7("views"));
40990
41005
  this.set("jsonp callback name", "callback");
40991
41006
  if (env2 === "production") {
40992
41007
  this.enable("view cache");
@@ -42477,7 +42492,7 @@ var require_send = __commonJS((exports, module) => {
42477
42492
  var extname2 = path2.extname;
42478
42493
  var join18 = path2.join;
42479
42494
  var normalize3 = path2.normalize;
42480
- var resolve6 = path2.resolve;
42495
+ var resolve7 = path2.resolve;
42481
42496
  var sep4 = path2.sep;
42482
42497
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
42483
42498
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1000;
@@ -42506,7 +42521,7 @@ var require_send = __commonJS((exports, module) => {
42506
42521
  this._maxage = opts.maxAge || opts.maxage;
42507
42522
  this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
42508
42523
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
42509
- this._root = opts.root ? resolve6(opts.root) : null;
42524
+ this._root = opts.root ? resolve7(opts.root) : null;
42510
42525
  }
42511
42526
  util3.inherits(SendStream, Stream);
42512
42527
  SendStream.prototype.error = function error(status, err) {
@@ -42655,7 +42670,7 @@ var require_send = __commonJS((exports, module) => {
42655
42670
  return res;
42656
42671
  }
42657
42672
  parts = normalize3(path3).split(sep4);
42658
- path3 = resolve6(path3);
42673
+ path3 = resolve7(path3);
42659
42674
  }
42660
42675
  if (containsDotFile(parts)) {
42661
42676
  debug('%s dotfile "%s"', this._dotfiles, path3);
@@ -43058,7 +43073,7 @@ var require_response = __commonJS((exports, module) => {
43058
43073
  var cookie = require_cookie();
43059
43074
  var send = require_send();
43060
43075
  var extname2 = path2.extname;
43061
- var resolve6 = path2.resolve;
43076
+ var resolve7 = path2.resolve;
43062
43077
  var vary = require_vary();
43063
43078
  var { Buffer: Buffer2 } = __require("node:buffer");
43064
43079
  var res = Object.create(http.ServerResponse.prototype);
@@ -43267,7 +43282,7 @@ var require_response = __commonJS((exports, module) => {
43267
43282
  }
43268
43283
  opts = Object.create(opts);
43269
43284
  opts.headers = headers;
43270
- var fullPath = !opts.root ? resolve6(path3) : path3;
43285
+ var fullPath = !opts.root ? resolve7(path3) : path3;
43271
43286
  return this.sendFile(fullPath, opts, done);
43272
43287
  };
43273
43288
  res.contentType = res.type = function contentType(type) {
@@ -43528,7 +43543,7 @@ var require_serve_static = __commonJS((exports, module) => {
43528
43543
  var encodeUrl = require_encodeurl();
43529
43544
  var escapeHtml = require_escape_html();
43530
43545
  var parseUrl = require_parseurl();
43531
- var resolve6 = __require("path").resolve;
43546
+ var resolve7 = __require("path").resolve;
43532
43547
  var send = require_send();
43533
43548
  var url = __require("url");
43534
43549
  module.exports = serveStatic;
@@ -43547,7 +43562,7 @@ var require_serve_static = __commonJS((exports, module) => {
43547
43562
  throw new TypeError("option setHeaders must be function");
43548
43563
  }
43549
43564
  opts.maxage = opts.maxage || opts.maxAge || 0;
43550
- opts.root = resolve6(root);
43565
+ opts.root = resolve7(root);
43551
43566
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
43552
43567
  return function serveStatic(req, res, next) {
43553
43568
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -43758,14 +43773,14 @@ var Locked, lockedPorts, releaseOldLockedPortsIntervalMs, timeout, getLocalHosts
43758
43773
  }
43759
43774
  }
43760
43775
  return results;
43761
- }, checkAvailablePort = (options2) => new Promise((resolve6, reject) => {
43776
+ }, checkAvailablePort = (options2) => new Promise((resolve7, reject) => {
43762
43777
  const server = net.createServer();
43763
43778
  server.unref();
43764
43779
  server.on("error", reject);
43765
43780
  server.listen(options2, () => {
43766
43781
  const { port } = server.address();
43767
43782
  server.close(() => {
43768
- resolve6(port);
43783
+ resolve7(port);
43769
43784
  });
43770
43785
  });
43771
43786
  }), getAvailablePort = async (options2, hosts) => {
@@ -44338,19 +44353,19 @@ var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform3, arch, tryEac
44338
44353
  }
44339
44354
  const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
44340
44355
  if (options2.wait) {
44341
- return new Promise((resolve6, reject) => {
44356
+ return new Promise((resolve7, reject) => {
44342
44357
  subprocess.once("error", reject);
44343
44358
  subprocess.once("close", (exitCode) => {
44344
44359
  if (!options2.allowNonzeroExitCode && exitCode !== 0) {
44345
44360
  reject(new Error(`Exited with code ${exitCode}`));
44346
44361
  return;
44347
44362
  }
44348
- resolve6(subprocess);
44363
+ resolve7(subprocess);
44349
44364
  });
44350
44365
  });
44351
44366
  }
44352
44367
  if (isFallbackAttempt) {
44353
- return new Promise((resolve6, reject) => {
44368
+ return new Promise((resolve7, reject) => {
44354
44369
  subprocess.once("error", reject);
44355
44370
  subprocess.once("spawn", () => {
44356
44371
  subprocess.once("close", (exitCode) => {
@@ -44360,17 +44375,17 @@ var fallbackAttemptSymbol, __dirname2, localXdgOpenPath, platform3, arch, tryEac
44360
44375
  return;
44361
44376
  }
44362
44377
  subprocess.unref();
44363
- resolve6(subprocess);
44378
+ resolve7(subprocess);
44364
44379
  });
44365
44380
  });
44366
44381
  });
44367
44382
  }
44368
44383
  subprocess.unref();
44369
- return new Promise((resolve6, reject) => {
44384
+ return new Promise((resolve7, reject) => {
44370
44385
  subprocess.once("error", reject);
44371
44386
  subprocess.once("spawn", () => {
44372
44387
  subprocess.off("error", reject);
44373
- resolve6(subprocess);
44388
+ resolve7(subprocess);
44374
44389
  });
44375
44390
  });
44376
44391
  }, open = (target, options2) => {
@@ -46054,7 +46069,7 @@ class NodeFsHandler {
46054
46069
  this._addToNodeFs(path3, initialAdd, wh, depth + 1);
46055
46070
  }
46056
46071
  }).on(EV.ERROR, this._boundHandleError);
46057
- return new Promise((resolve7, reject) => {
46072
+ return new Promise((resolve8, reject) => {
46058
46073
  if (!stream)
46059
46074
  return reject();
46060
46075
  stream.once(STR_END, () => {
@@ -46063,7 +46078,7 @@ class NodeFsHandler {
46063
46078
  return;
46064
46079
  }
46065
46080
  const wasThrottled = throttler ? throttler.clear() : false;
46066
- resolve7(undefined);
46081
+ resolve8(undefined);
46067
46082
  previous.getChildren().filter((item) => {
46068
46083
  return item !== directory && !current.has(item);
46069
46084
  }).forEach((item) => {
@@ -47430,7 +47445,7 @@ __export(exports_projects_registry, {
47430
47445
  import { randomUUID as randomUUID2 } from "node:crypto";
47431
47446
  import { existsSync as existsSync12, statSync as statSync2 } from "node:fs";
47432
47447
  import { copyFile, mkdir as mkdir8, open as open3, readFile as readFile10, unlink as unlink5, writeFile as writeFile9 } from "node:fs/promises";
47433
- import { basename as basename7, dirname as dirname9, resolve as resolve8 } from "node:path";
47448
+ import { basename as basename7, dirname as dirname9, resolve as resolve9 } from "node:path";
47434
47449
 
47435
47450
  class ProjectsRegistryManager {
47436
47451
  static registry = null;
@@ -47548,7 +47563,7 @@ class ProjectsRegistryManager {
47548
47563
  if (projectPath.includes("..") || projectPath.startsWith("~")) {
47549
47564
  throw new Error("Invalid path: path traversal patterns not allowed");
47550
47565
  }
47551
- const absolutePath = resolve8(projectPath);
47566
+ const absolutePath = resolve9(projectPath);
47552
47567
  if (!existsSync12(absolutePath)) {
47553
47568
  throw new Error(`Path does not exist: ${absolutePath}`);
47554
47569
  }
@@ -47679,7 +47694,7 @@ class ProjectsRegistryManager {
47679
47694
  return projects;
47680
47695
  }
47681
47696
  static async isRegistered(projectPath) {
47682
- const absolutePath = resolve8(projectPath);
47697
+ const absolutePath = resolve9(projectPath);
47683
47698
  const registry = await ProjectsRegistryManager.load();
47684
47699
  return registry.projects.some((p) => p.path === absolutePath);
47685
47700
  }
@@ -47795,7 +47810,7 @@ var init_claudekit_data2 = __esm(() => {
47795
47810
  import { spawn, spawnSync } from "node:child_process";
47796
47811
  import { existsSync as existsSync14 } from "node:fs";
47797
47812
  import { homedir as homedir14 } from "node:os";
47798
- import { join as join27, resolve as resolve9, sep as sep4 } from "node:path";
47813
+ import { join as join27, resolve as resolve10, sep as sep4 } from "node:path";
47799
47814
  function getWindowsPaths(...relativePaths) {
47800
47815
  const roots = [
47801
47816
  WINDOWS_PATHS.localAppData,
@@ -48054,8 +48069,8 @@ function buildOsaScriptCommand(scriptLines, argv = []) {
48054
48069
  return { command: "osascript", args };
48055
48070
  }
48056
48071
  function isPathInsideBase(path3, base) {
48057
- const normalizedPath = resolve9(path3);
48058
- const normalizedBase = resolve9(base);
48072
+ const normalizedPath = resolve10(path3);
48073
+ const normalizedBase = resolve10(base);
48059
48074
  if (normalizedPath === normalizedBase)
48060
48075
  return true;
48061
48076
  return normalizedPath.startsWith(`${normalizedBase}${sep4}`);
@@ -48065,19 +48080,19 @@ async function isActionPathAllowed(dirPath, projectId) {
48065
48080
  const project = await ProjectsRegistryManager.getProject(projectId);
48066
48081
  if (!project)
48067
48082
  return false;
48068
- return resolve9(project.path) === dirPath;
48083
+ return resolve10(project.path) === dirPath;
48069
48084
  }
48070
48085
  if (projectId?.startsWith("discovered-")) {
48071
48086
  try {
48072
48087
  const encodedPath = projectId.slice("discovered-".length);
48073
- const discoveredPath = resolve9(Buffer.from(encodedPath, "base64url").toString("utf-8"));
48088
+ const discoveredPath = resolve10(Buffer.from(encodedPath, "base64url").toString("utf-8"));
48074
48089
  if (discoveredPath === dirPath && (isPathInsideBase(discoveredPath, process.cwd()) || isPathInsideBase(discoveredPath, homedir14()))) {
48075
48090
  return true;
48076
48091
  }
48077
48092
  } catch {}
48078
48093
  }
48079
48094
  const registeredProjects = await ProjectsRegistryManager.listProjects();
48080
- if (registeredProjects.some((project) => resolve9(project.path) === dirPath)) {
48095
+ if (registeredProjects.some((project) => resolve10(project.path) === dirPath)) {
48081
48096
  return true;
48082
48097
  }
48083
48098
  if (isPathInsideBase(dirPath, process.cwd())) {
@@ -48327,7 +48342,7 @@ function registerActionRoutes(app) {
48327
48342
  return;
48328
48343
  }
48329
48344
  const { action, path: rawPath, appId, projectId } = validation.data;
48330
- const dirPath = resolve9(rawPath);
48345
+ const dirPath = resolve10(rawPath);
48331
48346
  if (!existsSync14(dirPath)) {
48332
48347
  res.status(400).json({ error: "Path does not exist" });
48333
48348
  return;
@@ -48369,7 +48384,7 @@ function registerActionRoutes(app) {
48369
48384
  } else {
48370
48385
  commandToRun = buildLaunchCommand(dirPath);
48371
48386
  }
48372
- const spawnCwd = resolve9(commandToRun.cwd || dirPath);
48387
+ const spawnCwd = resolve10(commandToRun.cwd || dirPath);
48373
48388
  if (spawnCwd !== dirPath) {
48374
48389
  const spawnCwdAllowed = await isActionPathAllowed(spawnCwd, typeof projectId === "string" ? projectId : undefined);
48375
48390
  if (!spawnCwdAllowed) {
@@ -49580,7 +49595,7 @@ var init_ck_config_routes = __esm(() => {
49580
49595
  import { existsSync as existsSync16 } from "node:fs";
49581
49596
  import { readFile as readFile12, readdir as readdir8 } from "node:fs/promises";
49582
49597
  import { homedir as homedir16 } from "node:os";
49583
- import { basename as basename8, isAbsolute as isAbsolute5, join as join30, relative as relative6, resolve as resolve10 } from "node:path";
49598
+ import { basename as basename8, isAbsolute as isAbsolute5, join as join30, relative as relative6, resolve as resolve11 } from "node:path";
49584
49599
  async function buildCommandTree(dir, baseDir) {
49585
49600
  let dirents;
49586
49601
  try {
@@ -49645,7 +49660,7 @@ function registerCommandRoutes(app) {
49645
49660
  return;
49646
49661
  }
49647
49662
  const commandsDir = join30(homedir16(), ".claude", "commands");
49648
- const safePath = resolve10(commandsDir, rawPath);
49663
+ const safePath = resolve11(commandsDir, rawPath);
49649
49664
  const rel = relative6(commandsDir, safePath);
49650
49665
  if (rel.startsWith("..") || isAbsolute5(rel)) {
49651
49666
  res.status(403).json({ error: "Access denied" });
@@ -50752,7 +50767,7 @@ var init_hook_log_routes = __esm(() => {
50752
50767
  import { existsSync as existsSync21 } from "node:fs";
50753
50768
  import { readFile as readFile18 } from "node:fs/promises";
50754
50769
  import { homedir as homedir23 } from "node:os";
50755
- import { basename as basename11, join as join39, resolve as resolve11 } from "node:path";
50770
+ import { basename as basename11, join as join39, resolve as resolve12 } from "node:path";
50756
50771
  function parseMcpServers(raw, source, sourceLabel) {
50757
50772
  const entries = [];
50758
50773
  for (const [name, value] of Object.entries(raw)) {
@@ -50802,7 +50817,7 @@ function isSafeProjectPath(projectPath) {
50802
50817
  return false;
50803
50818
  const home6 = homedir23();
50804
50819
  try {
50805
- const resolved = resolve11(projectPath);
50820
+ const resolved = resolve12(projectPath);
50806
50821
  if (!resolved.startsWith(home6))
50807
50822
  return false;
50808
50823
  return existsSync21(resolved);
@@ -50871,7 +50886,7 @@ var init_mcp_routes = __esm(() => {
50871
50886
  // src/commands/migrate/skill-directory-installer.ts
50872
50887
  import { existsSync as existsSync22 } from "node:fs";
50873
50888
  import { cp, mkdir as mkdir10, rename as rename6, rm as rm5 } from "node:fs/promises";
50874
- import { join as join40, resolve as resolve12 } from "node:path";
50889
+ import { join as join40, resolve as resolve13 } from "node:path";
50875
50890
  async function installSkillDirectories(skills, targetProviders, options2) {
50876
50891
  const results = [];
50877
50892
  for (const provider of targetProviders) {
@@ -50900,7 +50915,7 @@ async function installSkillDirectories(skills, targetProviders, options2) {
50900
50915
  }
50901
50916
  for (const skill of skills) {
50902
50917
  const targetDir = join40(basePath, skill.name);
50903
- if (resolve12(skill.path) === resolve12(targetDir)) {
50918
+ if (resolve13(skill.path) === resolve13(targetDir)) {
50904
50919
  results.push({
50905
50920
  provider,
50906
50921
  providerDisplayName: config.displayName,
@@ -54340,7 +54355,7 @@ var init_migration_result_utils = __esm(() => {
54340
54355
  import { existsSync as existsSync27 } from "node:fs";
54341
54356
  import { readFile as readFile24, rm as rm6 } from "node:fs/promises";
54342
54357
  import { homedir as homedir26 } from "node:os";
54343
- import { basename as basename13, join as join44, resolve as resolve13 } from "node:path";
54358
+ import { basename as basename13, join as join44, resolve as resolve14 } from "node:path";
54344
54359
  function isDisallowedControlCode(codePoint) {
54345
54360
  return codePoint >= 0 && codePoint <= 8 || codePoint >= 11 && codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
54346
54361
  }
@@ -54490,8 +54505,8 @@ function parseConfigSource(input) {
54490
54505
  if (!trimmed) {
54491
54506
  return { ok: true, value: undefined };
54492
54507
  }
54493
- const projectSourcePath = resolve13(process.cwd(), "CLAUDE.md");
54494
- const globalSourcePath = resolve13(getGlobalConfigSourcePath());
54508
+ const projectSourcePath = resolve14(process.cwd(), "CLAUDE.md");
54509
+ const globalSourcePath = resolve14(getGlobalConfigSourcePath());
54495
54510
  const sourceMap = {
54496
54511
  default: undefined,
54497
54512
  global: globalSourcePath,
@@ -54502,7 +54517,7 @@ function parseConfigSource(input) {
54502
54517
  if (normalizedKey in sourceMap) {
54503
54518
  return { ok: true, value: sourceMap[normalizedKey] };
54504
54519
  }
54505
- const resolved = resolve13(trimmed);
54520
+ const resolved = resolve14(trimmed);
54506
54521
  if (resolved === globalSourcePath || resolved === projectSourcePath) {
54507
54522
  return { ok: true, value: resolved };
54508
54523
  }
@@ -54570,7 +54585,7 @@ function shouldExecuteAction(action) {
54570
54585
  }
54571
54586
  async function executePlanDeleteAction(action, options2) {
54572
54587
  const preservePaths = options2?.preservePaths ?? new Set;
54573
- const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve13(action.targetPath));
54588
+ const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve14(action.targetPath));
54574
54589
  try {
54575
54590
  if (!shouldPreserveTarget && action.targetPath && existsSync27(action.targetPath)) {
54576
54591
  await rm6(action.targetPath, { recursive: true, force: true });
@@ -55249,7 +55264,7 @@ function registerMigrationRoutes(app) {
55249
55264
  }
55250
55265
  }
55251
55266
  }
55252
- const writtenPaths = new Set(allResults.filter((r2) => r2.success && !r2.skipped && r2.path.length > 0).map((r2) => resolve13(r2.path)));
55267
+ const writtenPaths = new Set(allResults.filter((r2) => r2.success && !r2.skipped && r2.path.length > 0).map((r2) => resolve14(r2.path)));
55253
55268
  for (const deleteAction of deleteActions) {
55254
55269
  const deleteResult = await executePlanDeleteAction(deleteAction, {
55255
55270
  preservePaths: writtenPaths
@@ -55285,7 +55300,7 @@ function registerMigrationRoutes(app) {
55285
55300
  const agentSrc = getAgentSourcePath();
55286
55301
  const cmdSrc = getCommandSourcePath();
55287
55302
  const skillSrc = getSkillSourcePath();
55288
- const kitRoot = (agentSrc ? resolve13(agentSrc, "..") : null) ?? (cmdSrc ? resolve13(cmdSrc, "..") : null) ?? (skillSrc ? resolve13(skillSrc, "..") : null) ?? null;
55303
+ const kitRoot = (agentSrc ? resolve14(agentSrc, "..") : null) ?? (cmdSrc ? resolve14(cmdSrc, "..") : null) ?? (skillSrc ? resolve14(skillSrc, "..") : null) ?? null;
55289
55304
  const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
55290
55305
  if (manifest?.cliVersion) {
55291
55306
  await updateAppliedManifestVersion(manifest.cliVersion);
@@ -55673,7 +55688,7 @@ var init_plan_metadata = __esm(() => {
55673
55688
 
55674
55689
  // src/domains/plan-parser/plan-table-parser.ts
55675
55690
  import { readFileSync as readFileSync7 } from "node:fs";
55676
- import { dirname as dirname12, resolve as resolve14 } from "node:path";
55691
+ import { dirname as dirname12, resolve as resolve15 } from "node:path";
55677
55692
  function normalizeStatus(raw) {
55678
55693
  const s = raw.toLowerCase().trim();
55679
55694
  if (s.includes("complete") || s.includes("done") || s.includes("✓") || s.includes("✅")) {
@@ -55756,7 +55771,7 @@ function parseHeaderAwareTable(content, dir, options2) {
55756
55771
  hasLinks = true;
55757
55772
  linkText = linkMatch[1].trim();
55758
55773
  name = filenameToTitle(linkText);
55759
- file = resolve14(dir, linkMatch[2]);
55774
+ file = resolve15(dir, linkMatch[2]);
55760
55775
  } else {
55761
55776
  name = nameRaw.replace(/\[.*?\]\(.*?\)/g, "").trim() || `Phase ${phaseId}`;
55762
55777
  linkText = name;
@@ -55796,7 +55811,7 @@ function parseFormat1(content, dir, options2) {
55796
55811
  phaseId,
55797
55812
  name: name.trim(),
55798
55813
  status: normalizeStatus(status),
55799
- file: resolve14(dir, linkPath),
55814
+ file: resolve15(dir, linkPath),
55800
55815
  linkText: linkText.trim(),
55801
55816
  anchor
55802
55817
  });
@@ -55816,7 +55831,7 @@ function parseFormat2(content, dir, options2) {
55816
55831
  phaseId,
55817
55832
  name: name.trim(),
55818
55833
  status: normalizeStatus(status),
55819
- file: resolve14(dir, linkPath),
55834
+ file: resolve15(dir, linkPath),
55820
55835
  linkText,
55821
55836
  anchor
55822
55837
  });
@@ -55835,7 +55850,7 @@ function parseFormat2b(content, dir, options2) {
55835
55850
  phaseId,
55836
55851
  name: name.trim(),
55837
55852
  status: normalizeStatus(status),
55838
- file: resolve14(dir, linkPath),
55853
+ file: resolve15(dir, linkPath),
55839
55854
  linkText: name.trim(),
55840
55855
  anchor
55841
55856
  });
@@ -55934,7 +55949,7 @@ function parseFormat4(content, planFilePath, options2) {
55934
55949
  current = { name, status: hasCheck ? "completed" : "pending" };
55935
55950
  } else if (fileMatch && current) {
55936
55951
  const planDir = dirname12(planFilePath);
55937
- current.file = resolve14(planDir, fileMatch[1].trim());
55952
+ current.file = resolve15(planDir, fileMatch[1].trim());
55938
55953
  } else if (statusMatch && current) {
55939
55954
  current.status = normalizeStatus(statusMatch[2]);
55940
55955
  }
@@ -56000,7 +56015,7 @@ function parseFormat6(content, dir, options2) {
56000
56015
  phaseId,
56001
56016
  name: phaseName,
56002
56017
  status: checked.toLowerCase() === "x" ? "completed" : "pending",
56003
- file: resolve14(dir, linkPath),
56018
+ file: resolve15(dir, linkPath),
56004
56019
  linkText: phaseName,
56005
56020
  anchor
56006
56021
  });
@@ -56185,13 +56200,13 @@ var init_plan_scanner = () => {};
56185
56200
 
56186
56201
  // src/domains/plan-parser/plan-scope.ts
56187
56202
  import { homedir as homedir27 } from "node:os";
56188
- import { isAbsolute as isAbsolute6, join as join47, relative as relative9, resolve as resolve15 } from "node:path";
56203
+ import { isAbsolute as isAbsolute6, join as join47, relative as relative9, resolve as resolve16 } from "node:path";
56189
56204
  function resolveConfiguredDir(configuredPath, baseDir) {
56190
56205
  const trimmed = configuredPath?.trim();
56191
56206
  if (!trimmed) {
56192
56207
  return join47(baseDir, DEFAULT_PLANS_DIRNAME);
56193
56208
  }
56194
- return isAbsolute6(trimmed) ? resolve15(trimmed) : resolve15(baseDir, trimmed);
56209
+ return isAbsolute6(trimmed) ? resolve16(trimmed) : resolve16(baseDir, trimmed);
56195
56210
  }
56196
56211
  function resolveProjectPlansDir(projectRoot, config) {
56197
56212
  return resolveConfiguredDir(config?.paths?.plans, projectRoot);
@@ -56203,8 +56218,8 @@ function resolvePlanDirForScope(scope, projectRoot, config) {
56203
56218
  return scope === "global" ? resolveGlobalPlansDir(config) : resolveProjectPlansDir(projectRoot, config);
56204
56219
  }
56205
56220
  function isWithinDir(targetPath, baseDir) {
56206
- const resolvedTarget = resolve15(targetPath);
56207
- const resolvedBase = resolve15(baseDir);
56221
+ const resolvedTarget = resolve16(targetPath);
56222
+ const resolvedBase = resolve16(baseDir);
56208
56223
  const relativePath = relative9(resolvedBase, resolvedTarget);
56209
56224
  return relativePath === "" || !relativePath.startsWith("..") && relativePath !== ".." && !isAbsolute6(relativePath);
56210
56225
  }
@@ -56982,13 +56997,21 @@ var init_plan_types = __esm(() => {
56982
56997
  PlansRegistrySchema = exports_external.object({
56983
56998
  version: exports_external.literal(1),
56984
56999
  plans: exports_external.array(PlansRegistryEntrySchema),
56985
- stats: PlansRegistryStatsSchema
57000
+ stats: PlansRegistryStatsSchema,
57001
+ projectRoot: exports_external.string().optional()
56986
57002
  });
56987
57003
  });
56988
57004
 
56989
57005
  // src/domains/plan-parser/plans-registry.ts
56990
- import { existsSync as existsSync32, mkdirSync as mkdirSync3, readFileSync as readFileSync10, renameSync as renameSync2, writeFileSync as writeFileSync4 } from "node:fs";
56991
- import { dirname as dirname16, isAbsolute as isAbsolute7, join as join50, parse as parse2, relative as relative10, resolve as resolve16 } from "node:path";
57006
+ import {
57007
+ existsSync as existsSync32,
57008
+ mkdirSync as mkdirSync3,
57009
+ readFileSync as readFileSync10,
57010
+ renameSync as renameSync2,
57011
+ unlinkSync,
57012
+ writeFileSync as writeFileSync4
57013
+ } from "node:fs";
57014
+ import { dirname as dirname16, isAbsolute as isAbsolute7, join as join50, parse as parse2, relative as relative10, resolve as resolve17 } from "node:path";
56992
57015
  function createEmptyRegistry() {
56993
57016
  return {
56994
57017
  version: 1,
@@ -56996,8 +57019,54 @@ function createEmptyRegistry() {
56996
57019
  stats: { totalPlans: 0, completedPlans: 0, avgPhasesPerPlan: 0 }
56997
57020
  };
56998
57021
  }
57022
+ function deleteOldFiles(oldPath, oldBak) {
57023
+ try {
57024
+ unlinkSync(oldPath);
57025
+ } catch {}
57026
+ try {
57027
+ unlinkSync(oldBak);
57028
+ } catch {}
57029
+ }
57030
+ function migrateFromProjectLocal(cwd2, globalPath) {
57031
+ const oldPath = join50(cwd2, OLD_REGISTRY_RELATIVE);
57032
+ const oldBak = `${oldPath}.bak`;
57033
+ if (!existsSync32(oldPath))
57034
+ return;
57035
+ if (existsSync32(globalPath)) {
57036
+ deleteOldFiles(oldPath, oldBak);
57037
+ return;
57038
+ }
57039
+ try {
57040
+ const oldData = JSON.parse(readFileSync10(oldPath, "utf8"));
57041
+ if (oldData && typeof oldData === "object" && Array.isArray(oldData.plans)) {
57042
+ const migrated = {
57043
+ version: 1,
57044
+ plans: oldData.plans.map((p) => ({
57045
+ lastModified: p.created ?? new Date().toISOString(),
57046
+ tags: [],
57047
+ blockedBy: [],
57048
+ blocks: [],
57049
+ ...p
57050
+ })),
57051
+ stats: oldData.stats ?? {
57052
+ totalPlans: 0,
57053
+ completedPlans: 0,
57054
+ avgPhasesPerPlan: 0
57055
+ }
57056
+ };
57057
+ const parsed = PlansRegistrySchema.safeParse(migrated);
57058
+ if (parsed.success) {
57059
+ writeRegistry(parsed.data, cwd2);
57060
+ deleteOldFiles(oldPath, oldBak);
57061
+ return;
57062
+ }
57063
+ }
57064
+ } catch (err) {
57065
+ console.warn("[ck] plans-registry migration failed:", err instanceof Error ? err.message : err);
57066
+ }
57067
+ }
56999
57068
  function normalizeRegistryDir(cwd2, dir) {
57000
- const absoluteDir = isAbsolute7(dir) ? dir : resolve16(cwd2, dir);
57069
+ const absoluteDir = isAbsolute7(dir) ? dir : resolve17(cwd2, dir);
57001
57070
  const relativeDir = relative10(cwd2, absoluteDir) || dir;
57002
57071
  return relativeDir.replace(/\\/g, "/");
57003
57072
  }
@@ -57013,29 +57082,31 @@ function findProjectRoot(startDir) {
57013
57082
  return startDir;
57014
57083
  }
57015
57084
  function readRegistry(cwd2 = process.cwd()) {
57016
- const path5 = join50(cwd2, REGISTRY_PATH2);
57017
- if (!existsSync32(path5)) {
57085
+ const globalPath = PathResolver.getPlansRegistryPath(cwd2);
57086
+ migrateFromProjectLocal(cwd2, globalPath);
57087
+ if (!existsSync32(globalPath)) {
57018
57088
  return createEmptyRegistry();
57019
57089
  }
57020
57090
  try {
57021
- const parsed = PlansRegistrySchema.safeParse(JSON.parse(readFileSync10(path5, "utf8")));
57091
+ const parsed = PlansRegistrySchema.safeParse(JSON.parse(readFileSync10(globalPath, "utf8")));
57022
57092
  return parsed.success ? parsed.data : createEmptyRegistry();
57023
57093
  } catch {
57024
57094
  return createEmptyRegistry();
57025
57095
  }
57026
57096
  }
57027
57097
  function writeRegistry(registry, cwd2 = process.cwd()) {
57028
- const path5 = join50(cwd2, REGISTRY_PATH2);
57029
- mkdirSync3(dirname16(path5), { recursive: true });
57030
- const validated = PlansRegistrySchema.parse(registry);
57031
- if (existsSync32(path5)) {
57098
+ const globalPath = PathResolver.getPlansRegistryPath(cwd2);
57099
+ const toWrite = { ...registry, projectRoot: cwd2 };
57100
+ const validated = PlansRegistrySchema.parse(toWrite);
57101
+ mkdirSync3(dirname16(globalPath), { recursive: true });
57102
+ if (existsSync32(globalPath)) {
57032
57103
  try {
57033
- writeFileSync4(`${path5}.bak`, readFileSync10(path5));
57104
+ writeFileSync4(`${globalPath}.bak`, readFileSync10(globalPath));
57034
57105
  } catch {}
57035
57106
  }
57036
- const tempPath = `${path5}.tmp-${process.pid}-${Date.now()}`;
57107
+ const tempPath = `${globalPath}.tmp-${process.pid}-${Date.now()}`;
57037
57108
  writeFileSync4(tempPath, JSON.stringify(validated, null, 2), "utf8");
57038
- renameSync2(tempPath, path5);
57109
+ renameSync2(tempPath, globalPath);
57039
57110
  }
57040
57111
  function computeStats(plans) {
57041
57112
  const totalPlans = plans.length;
@@ -57130,8 +57201,9 @@ function updateRegistryAddPhase(options2) {
57130
57201
  }
57131
57202
  }
57132
57203
  }
57133
- var REGISTRY_PATH2 = ".claude/plans-registry.json";
57204
+ var OLD_REGISTRY_RELATIVE = ".claude/plans-registry.json";
57134
57205
  var init_plans_registry = __esm(() => {
57206
+ init_path_resolver();
57135
57207
  init_plan_types();
57136
57208
  });
57137
57209
 
@@ -57349,24 +57421,24 @@ function pLimit(concurrency) {
57349
57421
  activeCount--;
57350
57422
  resumeNext();
57351
57423
  };
57352
- const run = async (function_, resolve17, arguments_) => {
57424
+ const run = async (function_, resolve18, arguments_) => {
57353
57425
  const result = (async () => function_(...arguments_))();
57354
- resolve17(result);
57426
+ resolve18(result);
57355
57427
  try {
57356
57428
  await result;
57357
57429
  } catch {}
57358
57430
  next();
57359
57431
  };
57360
- const enqueue = (function_, resolve17, arguments_) => {
57432
+ const enqueue = (function_, resolve18, arguments_) => {
57361
57433
  new Promise((internalResolve) => {
57362
57434
  queue.enqueue(internalResolve);
57363
- }).then(run.bind(undefined, function_, resolve17, arguments_));
57435
+ }).then(run.bind(undefined, function_, resolve18, arguments_));
57364
57436
  if (activeCount < concurrency) {
57365
57437
  resumeNext();
57366
57438
  }
57367
57439
  };
57368
- const generator = (function_, ...arguments_) => new Promise((resolve17) => {
57369
- enqueue(function_, resolve17, arguments_);
57440
+ const generator = (function_, ...arguments_) => new Promise((resolve18) => {
57441
+ enqueue(function_, resolve18, arguments_);
57370
57442
  });
57371
57443
  Object.defineProperties(generator, {
57372
57444
  activeCount: {
@@ -57413,7 +57485,7 @@ var init_p_limit = __esm(() => {
57413
57485
  // src/domains/web-server/routes/plan-routes.ts
57414
57486
  import { existsSync as existsSync33, readFileSync as readFileSync11, realpathSync } from "node:fs";
57415
57487
  import { homedir as homedir28 } from "node:os";
57416
- import { basename as basename16, dirname as dirname18, join as join52, relative as relative11, resolve as resolve17, sep as sep6 } from "node:path";
57488
+ import { basename as basename16, dirname as dirname18, join as join52, relative as relative11, resolve as resolve18, sep as sep6 } from "node:path";
57417
57489
  function sanitizeError(err) {
57418
57490
  if (err instanceof Error) {
57419
57491
  if (/^(ENOENT|EACCES|EPERM|EISDIR)/.test(err.message))
@@ -57428,8 +57500,8 @@ function hasBasePrefix(targetPath, baseDir) {
57428
57500
  return targetPath === baseDir || targetPath.startsWith(basePrefix);
57429
57501
  }
57430
57502
  function isWithinBase(targetPath, baseDir) {
57431
- const resolvedTarget = resolve17(targetPath);
57432
- const resolvedBase = resolve17(baseDir);
57503
+ const resolvedTarget = resolve18(targetPath);
57504
+ const resolvedBase = resolve18(baseDir);
57433
57505
  const logicalMatch = hasBasePrefix(resolvedTarget, resolvedBase);
57434
57506
  if (existsSync33(resolvedTarget)) {
57435
57507
  try {
@@ -57513,7 +57585,7 @@ async function getAllowedRoots(projectId) {
57513
57585
  roots.push(projectPlansDir);
57514
57586
  roots.push(getGlobalPlanRoot());
57515
57587
  } catch {}
57516
- return Array.from(new Set(roots.map((root) => resolve17(root))));
57588
+ return Array.from(new Set(roots.map((root) => resolve18(root))));
57517
57589
  }
57518
57590
  async function isWithinAllowedRoots(targetPath, projectId) {
57519
57591
  const allowedRoots = await getAllowedRoots(projectId);
@@ -57535,7 +57607,7 @@ async function getSafePath(value, kind, res, projectId) {
57535
57607
  return null;
57536
57608
  }
57537
57609
  try {
57538
- return realpathSync(resolve17(value));
57610
+ return realpathSync(resolve18(value));
57539
57611
  } catch {
57540
57612
  res.status(403).json({ error: "Cannot resolve path" });
57541
57613
  return null;
@@ -57548,7 +57620,7 @@ function getPlanFilePath(value, res, projectId) {
57548
57620
  return getSafePath(value, "file", res, projectId);
57549
57621
  }
57550
57622
  function toProjectPathKey(projectPath) {
57551
- const resolvedPath = resolve17(projectPath);
57623
+ const resolvedPath = resolve18(projectPath);
57552
57624
  if (!existsSync33(resolvedPath)) {
57553
57625
  return resolvedPath;
57554
57626
  }
@@ -57672,7 +57744,7 @@ function registerPlanRoutes(app) {
57672
57744
  const seenProjectKeys = new Set;
57673
57745
  const scanTargets = [];
57674
57746
  for (const project of await ProjectsRegistryManager.listProjects()) {
57675
- if (!existsSync33(resolve17(project.path)))
57747
+ if (!existsSync33(resolve18(project.path)))
57676
57748
  continue;
57677
57749
  const projectKey = toProjectPathKey(project.path);
57678
57750
  if (projectKey === globalProjectKey || seenProjectKeys.has(projectKey))
@@ -57695,7 +57767,7 @@ function registerPlanRoutes(app) {
57695
57767
  path: project.path
57696
57768
  });
57697
57769
  }
57698
- const currentPath = resolve17(process.cwd());
57770
+ const currentPath = resolve18(process.cwd());
57699
57771
  const currentProjectKey = toProjectPathKey(currentPath);
57700
57772
  if (isCurrentProjectFallbackCandidate(currentPath, globalProjectKey) && !seenProjectKeys.has(currentProjectKey)) {
57701
57773
  scanTargets.push({
@@ -57784,7 +57856,7 @@ function registerPlanRoutes(app) {
57784
57856
  const file = await getPlanFilePath(String(req.query.file ?? ""), res, projectId);
57785
57857
  if (!file)
57786
57858
  return;
57787
- const dir = req.query.dir ? resolve17(String(req.query.dir)) : null;
57859
+ const dir = req.query.dir ? resolve18(String(req.query.dir)) : null;
57788
57860
  if (dir && (!await isWithinAllowedRoots(dir, projectId) || !isWithinBase(file, dir))) {
57789
57861
  res.status(403).json({ error: "File must stay within the selected plan directory" });
57790
57862
  return;
@@ -57916,7 +57988,7 @@ var init_project_plan_data = __esm(() => {
57916
57988
  import { existsSync as existsSync34 } from "node:fs";
57917
57989
  import { readFile as readFile25 } from "node:fs/promises";
57918
57990
  import { homedir as homedir29 } from "node:os";
57919
- import { basename as basename17, join as join53, resolve as resolve18 } from "node:path";
57991
+ import { basename as basename17, join as join53, resolve as resolve19 } from "node:path";
57920
57992
  function registerProjectRoutes(app) {
57921
57993
  app.get("/api/projects", async (req, res) => {
57922
57994
  try {
@@ -58028,7 +58100,7 @@ function registerProjectRoutes(app) {
58028
58100
  } else if (projectPath.startsWith("~\\")) {
58029
58101
  projectPath = join53(homedir29(), projectPath.slice(1));
58030
58102
  }
58031
- projectPath = resolve18(projectPath);
58103
+ projectPath = resolve19(projectPath);
58032
58104
  const homeDir = homedir29();
58033
58105
  if (projectPath.includes("..") || !projectPath.startsWith(homeDir)) {
58034
58106
  res.status(400).json({ error: "Invalid path after expansion" });
@@ -59363,15 +59435,15 @@ function migrateRegistryPaths(registry) {
59363
59435
  }
59364
59436
  async function readRegistry2() {
59365
59437
  try {
59366
- if (!existsSync37(REGISTRY_PATH3)) {
59438
+ if (!existsSync37(REGISTRY_PATH2)) {
59367
59439
  return { version: "1.0", installations: [] };
59368
59440
  }
59369
- const content = await readFile29(REGISTRY_PATH3, "utf-8");
59441
+ const content = await readFile29(REGISTRY_PATH2, "utf-8");
59370
59442
  const data = JSON.parse(content);
59371
59443
  const registry = SkillRegistrySchema.parse(data);
59372
59444
  if (migrateRegistryPaths(registry)) {
59373
59445
  try {
59374
- await writeFile12(REGISTRY_PATH3, JSON.stringify(registry, null, 2), "utf-8");
59446
+ await writeFile12(REGISTRY_PATH2, JSON.stringify(registry, null, 2), "utf-8");
59375
59447
  } catch {}
59376
59448
  }
59377
59449
  return registry;
@@ -59383,11 +59455,11 @@ async function readRegistry2() {
59383
59455
  }
59384
59456
  }
59385
59457
  async function writeRegistry2(registry) {
59386
- const dir = dirname20(REGISTRY_PATH3);
59458
+ const dir = dirname20(REGISTRY_PATH2);
59387
59459
  if (!existsSync37(dir)) {
59388
59460
  await mkdir12(dir, { recursive: true });
59389
59461
  }
59390
- await writeFile12(REGISTRY_PATH3, JSON.stringify(registry, null, 2), "utf-8");
59462
+ await writeFile12(REGISTRY_PATH2, JSON.stringify(registry, null, 2), "utf-8");
59391
59463
  }
59392
59464
  async function addInstallation(skill, agent, global3, path6, sourcePath) {
59393
59465
  const registry = await readRegistry2();
@@ -59439,11 +59511,11 @@ async function syncRegistry() {
59439
59511
  }
59440
59512
  return { removed };
59441
59513
  }
59442
- var home8, REGISTRY_PATH3, SkillInstallationSchema, SkillRegistrySchema, REGISTRY_PATH_MIGRATIONS;
59514
+ var home8, REGISTRY_PATH2, SkillInstallationSchema, SkillRegistrySchema, REGISTRY_PATH_MIGRATIONS;
59443
59515
  var init_skills_registry = __esm(() => {
59444
59516
  init_zod();
59445
59517
  home8 = homedir35();
59446
- REGISTRY_PATH3 = join58(home8, ".claudekit", "skill-registry.json");
59518
+ REGISTRY_PATH2 = join58(home8, ".claudekit", "skill-registry.json");
59447
59519
  SkillInstallationSchema = exports_external.object({
59448
59520
  skill: exports_external.string(),
59449
59521
  agent: exports_external.string(),
@@ -59475,10 +59547,10 @@ var init_skills_registry = __esm(() => {
59475
59547
  import { existsSync as existsSync38 } from "node:fs";
59476
59548
  import { cp as cp2, mkdir as mkdir13, rm as rm7, stat as stat11 } from "node:fs/promises";
59477
59549
  import { homedir as homedir36 } from "node:os";
59478
- import { dirname as dirname21, join as join59, resolve as resolve20 } from "node:path";
59550
+ import { dirname as dirname21, join as join59, resolve as resolve21 } from "node:path";
59479
59551
  function isSamePath2(path1, path22) {
59480
59552
  try {
59481
- return resolve20(path1) === resolve20(path22);
59553
+ return resolve21(path1) === resolve21(path22);
59482
59554
  } catch {
59483
59555
  return false;
59484
59556
  }
@@ -59613,10 +59685,10 @@ var init_skills_installer = __esm(() => {
59613
59685
  // src/commands/skills/skills-uninstaller.ts
59614
59686
  import { existsSync as existsSync39 } from "node:fs";
59615
59687
  import { rm as rm8 } from "node:fs/promises";
59616
- import { join as join60, resolve as resolve21 } from "node:path";
59688
+ import { join as join60, resolve as resolve22 } from "node:path";
59617
59689
  function isSamePath3(path1, path22) {
59618
59690
  try {
59619
- return resolve21(path1) === resolve21(path22);
59691
+ return resolve22(path1) === resolve22(path22);
59620
59692
  } catch {
59621
59693
  return false;
59622
59694
  }
@@ -60554,7 +60626,7 @@ var package_default;
60554
60626
  var init_package = __esm(() => {
60555
60627
  package_default = {
60556
60628
  name: "claudekit-cli",
60557
- version: "3.41.4-dev.21",
60629
+ version: "3.41.4-dev.23",
60558
60630
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
60559
60631
  type: "module",
60560
60632
  repository: {
@@ -62636,12 +62708,12 @@ async function promptKitUpdate(beta, yes, deps) {
62636
62708
  args.push("--beta");
62637
62709
  const displayCmd = `ck ${args.join(" ")}`;
62638
62710
  logger.info(`Running: ${displayCmd}`);
62639
- const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve22) => {
62711
+ const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve23) => {
62640
62712
  const child = spawn2("ck", spawnArgs, { stdio: "inherit", shell: true });
62641
- child.on("close", (code) => resolve22(code ?? 1));
62713
+ child.on("close", (code) => resolve23(code ?? 1));
62642
62714
  child.on("error", (err) => {
62643
62715
  logger.verbose(`Failed to spawn ck init: ${err.message}`);
62644
- resolve22(1);
62716
+ resolve23(1);
62645
62717
  });
62646
62718
  }));
62647
62719
  const exitCode = await spawnFn(args);
@@ -63031,7 +63103,7 @@ class ConfigVersionChecker {
63031
63103
  return null;
63032
63104
  }
63033
63105
  const delay = baseBackoff * 2 ** attempt;
63034
- await new Promise((resolve22) => setTimeout(resolve22, delay));
63106
+ await new Promise((resolve23) => setTimeout(resolve23, delay));
63035
63107
  }
63036
63108
  }
63037
63109
  return null;
@@ -63137,12 +63209,12 @@ import { readFile as readFile36 } from "node:fs/promises";
63137
63209
  import { cpus, homedir as homedir37, totalmem } from "node:os";
63138
63210
  import { join as join67 } from "node:path";
63139
63211
  function runCommand(cmd, args, fallback2) {
63140
- return new Promise((resolve22) => {
63212
+ return new Promise((resolve23) => {
63141
63213
  execFile7(cmd, args, { timeout: 5000 }, (err, stdout) => {
63142
63214
  if (err) {
63143
- resolve22(fallback2);
63215
+ resolve23(fallback2);
63144
63216
  } else {
63145
- resolve22(stdout.trim() || fallback2);
63217
+ resolve23(stdout.trim() || fallback2);
63146
63218
  }
63147
63219
  });
63148
63220
  });
@@ -63577,7 +63649,7 @@ var init_routes = __esm(() => {
63577
63649
 
63578
63650
  // src/domains/web-server/static-server.ts
63579
63651
  import { existsSync as existsSync43 } from "node:fs";
63580
- import { basename as basename19, dirname as dirname22, join as join68, resolve as resolve22 } from "node:path";
63652
+ import { basename as basename19, dirname as dirname22, join as join68, resolve as resolve23 } from "node:path";
63581
63653
  import { fileURLToPath as fileURLToPath2 } from "node:url";
63582
63654
  function addRuntimeUiCandidate(candidates, runtimePath) {
63583
63655
  if (!runtimePath) {
@@ -63587,7 +63659,7 @@ function addRuntimeUiCandidate(candidates, runtimePath) {
63587
63659
  if (!looksLikePath) {
63588
63660
  return;
63589
63661
  }
63590
- const entryDir = dirname22(resolve22(runtimePath));
63662
+ const entryDir = dirname22(resolve23(runtimePath));
63591
63663
  if (basename19(entryDir) === "dist") {
63592
63664
  candidates.add(join68(entryDir, "ui"));
63593
63665
  }
@@ -65290,7 +65362,7 @@ var require_websocket = __commonJS((exports, module) => {
65290
65362
  var http = __require("http");
65291
65363
  var net2 = __require("net");
65292
65364
  var tls = __require("tls");
65293
- var { randomBytes, createHash: createHash4 } = __require("crypto");
65365
+ var { randomBytes, createHash: createHash5 } = __require("crypto");
65294
65366
  var { Duplex, Readable: Readable2 } = __require("stream");
65295
65367
  var { URL: URL2 } = __require("url");
65296
65368
  var PerMessageDeflate = require_permessage_deflate();
@@ -65825,7 +65897,7 @@ var require_websocket = __commonJS((exports, module) => {
65825
65897
  abortHandshake(websocket, socket, "Invalid Upgrade header");
65826
65898
  return;
65827
65899
  }
65828
- const digest = createHash4("sha1").update(key + GUID).digest("base64");
65900
+ const digest = createHash5("sha1").update(key + GUID).digest("base64");
65829
65901
  if (res.headers["sec-websocket-accept"] !== digest) {
65830
65902
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
65831
65903
  return;
@@ -66198,7 +66270,7 @@ var require_websocket_server = __commonJS((exports, module) => {
66198
66270
  var EventEmitter3 = __require("events");
66199
66271
  var http = __require("http");
66200
66272
  var { Duplex } = __require("stream");
66201
- var { createHash: createHash4 } = __require("crypto");
66273
+ var { createHash: createHash5 } = __require("crypto");
66202
66274
  var extension = require_extension();
66203
66275
  var PerMessageDeflate = require_permessage_deflate();
66204
66276
  var subprotocol = require_subprotocol();
@@ -66407,7 +66479,7 @@ var require_websocket_server = __commonJS((exports, module) => {
66407
66479
  }
66408
66480
  if (this._state > RUNNING)
66409
66481
  return abortHandshake(socket, 503);
66410
- const digest = createHash4("sha1").update(key + GUID).digest("base64");
66482
+ const digest = createHash5("sha1").update(key + GUID).digest("base64");
66411
66483
  const headers = [
66412
66484
  "HTTP/1.1 101 Switching Protocols",
66413
66485
  "Upgrade: websocket",
@@ -66619,10 +66691,10 @@ async function createAppServer(options2 = {}) {
66619
66691
  wsManager = new WebSocketManager(server);
66620
66692
  fileWatcher = new FileWatcher({ wsManager });
66621
66693
  fileWatcher.start();
66622
- await new Promise((resolve23, reject) => {
66694
+ await new Promise((resolve24, reject) => {
66623
66695
  const onListening = () => {
66624
66696
  server.off("error", onError);
66625
- resolve23();
66697
+ resolve24();
66626
66698
  };
66627
66699
  const onError = (error) => {
66628
66700
  server.off("listening", onListening);
@@ -66659,16 +66731,16 @@ async function createAppServer(options2 = {}) {
66659
66731
  };
66660
66732
  }
66661
66733
  async function closeHttpServer(server) {
66662
- await new Promise((resolve23) => {
66734
+ await new Promise((resolve24) => {
66663
66735
  if (!server.listening) {
66664
- resolve23();
66736
+ resolve24();
66665
66737
  return;
66666
66738
  }
66667
66739
  server.close((err) => {
66668
66740
  if (err) {
66669
66741
  logger.debug(`Server close error: ${err.message}`);
66670
66742
  }
66671
- resolve23();
66743
+ resolve24();
66672
66744
  });
66673
66745
  });
66674
66746
  }
@@ -68404,7 +68476,7 @@ var require_picomatch2 = __commonJS((exports, module) => {
68404
68476
  import { exec as exec7, execFile as execFile8, spawn as spawn4 } from "node:child_process";
68405
68477
  import { promisify as promisify13 } from "node:util";
68406
68478
  function executeInteractiveScript(command, args, options2) {
68407
- return new Promise((resolve25, reject) => {
68479
+ return new Promise((resolve26, reject) => {
68408
68480
  const child = spawn4(command, args, {
68409
68481
  stdio: ["ignore", "inherit", "inherit"],
68410
68482
  cwd: options2?.cwd,
@@ -68425,7 +68497,7 @@ function executeInteractiveScript(command, args, options2) {
68425
68497
  } else if (code !== 0) {
68426
68498
  reject(new Error(`Command exited with code ${code}`));
68427
68499
  } else {
68428
- resolve25();
68500
+ resolve26();
68429
68501
  }
68430
68502
  });
68431
68503
  child.on("error", (error) => {
@@ -68446,7 +68518,7 @@ var init_process_executor = __esm(() => {
68446
68518
  });
68447
68519
 
68448
68520
  // src/services/package-installer/validators.ts
68449
- import { resolve as resolve25 } from "node:path";
68521
+ import { resolve as resolve26 } from "node:path";
68450
68522
  function validatePackageName(packageName) {
68451
68523
  if (!packageName || typeof packageName !== "string") {
68452
68524
  throw new Error("Package name must be a non-empty string");
@@ -68459,8 +68531,8 @@ function validatePackageName(packageName) {
68459
68531
  }
68460
68532
  }
68461
68533
  function validateScriptPath(skillsDir2, scriptPath) {
68462
- const skillsDirResolved = resolve25(skillsDir2);
68463
- const scriptPathResolved = resolve25(scriptPath);
68534
+ const skillsDirResolved = resolve26(skillsDir2);
68535
+ const scriptPathResolved = resolve26(scriptPath);
68464
68536
  const skillsDirNormalized = isWindows() ? skillsDirResolved.toLowerCase() : skillsDirResolved;
68465
68537
  const scriptPathNormalized = isWindows() ? scriptPathResolved.toLowerCase() : scriptPathResolved;
68466
68538
  if (!scriptPathNormalized.startsWith(skillsDirNormalized)) {
@@ -68721,7 +68793,7 @@ var init_opencode_installer = __esm(() => {
68721
68793
  var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CODE_PARTIAL_SUCCESS = 2;
68722
68794
 
68723
68795
  // src/services/package-installer/install-error-handler.ts
68724
- import { existsSync as existsSync54, readFileSync as readFileSync17, unlinkSync as unlinkSync2 } from "node:fs";
68796
+ import { existsSync as existsSync54, readFileSync as readFileSync17, unlinkSync as unlinkSync3 } from "node:fs";
68725
68797
  import { join as join86 } from "node:path";
68726
68798
  function parseNameReason(str2) {
68727
68799
  const colonIndex = str2.indexOf(":");
@@ -68793,7 +68865,7 @@ function displayInstallErrors(skillsDir2) {
68793
68865
  logger.info(` ${summary.remediation.pip_retry}`);
68794
68866
  }
68795
68867
  try {
68796
- unlinkSync2(summaryPath);
68868
+ unlinkSync3(summaryPath);
68797
68869
  } catch (cleanupError) {
68798
68870
  if (cleanupError.code !== "ENOENT") {
68799
68871
  logger.debug(`Failed to cleanup summary file: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`);
@@ -69290,10 +69362,10 @@ __export(exports_gemini_mcp_linker, {
69290
69362
  checkExistingGeminiConfig: () => checkExistingGeminiConfig,
69291
69363
  addGeminiToGitignore: () => addGeminiToGitignore
69292
69364
  });
69293
- import { resolve as resolve26 } from "node:path";
69365
+ import { resolve as resolve27 } from "node:path";
69294
69366
  async function linkGeminiMcpConfig(projectDir, options2 = {}) {
69295
69367
  const { skipGitignore = false, isGlobal = false } = options2;
69296
- const resolvedProjectDir = resolve26(projectDir);
69368
+ const resolvedProjectDir = resolve27(projectDir);
69297
69369
  const geminiSettingsPath = getGeminiSettingsPath(resolvedProjectDir, isGlobal);
69298
69370
  const mcpConfigPath = findMcpConfigPath(resolvedProjectDir);
69299
69371
  if (!mcpConfigPath) {
@@ -69941,7 +70013,7 @@ var require_get_stream = __commonJS((exports, module) => {
69941
70013
  };
69942
70014
  const { maxBuffer } = options2;
69943
70015
  let stream;
69944
- await new Promise((resolve28, reject) => {
70016
+ await new Promise((resolve29, reject) => {
69945
70017
  const rejectPromise = (error) => {
69946
70018
  if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
69947
70019
  error.bufferedData = stream.getBufferedValue();
@@ -69953,7 +70025,7 @@ var require_get_stream = __commonJS((exports, module) => {
69953
70025
  rejectPromise(error);
69954
70026
  return;
69955
70027
  }
69956
- resolve28();
70028
+ resolve29();
69957
70029
  });
69958
70030
  stream.on("data", () => {
69959
70031
  if (stream.getBufferedLength() > maxBuffer) {
@@ -71314,7 +71386,7 @@ var require_extract_zip = __commonJS((exports, module) => {
71314
71386
  debug("opening", this.zipPath, "with opts", this.opts);
71315
71387
  this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
71316
71388
  this.canceled = false;
71317
- return new Promise((resolve28, reject) => {
71389
+ return new Promise((resolve29, reject) => {
71318
71390
  this.zipfile.on("error", (err) => {
71319
71391
  this.canceled = true;
71320
71392
  reject(err);
@@ -71323,7 +71395,7 @@ var require_extract_zip = __commonJS((exports, module) => {
71323
71395
  this.zipfile.on("close", () => {
71324
71396
  if (!this.canceled) {
71325
71397
  debug("zip extraction complete");
71326
- resolve28();
71398
+ resolve29();
71327
71399
  }
71328
71400
  });
71329
71401
  this.zipfile.on("entry", async (entry) => {
@@ -71642,7 +71714,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
71642
71714
  }
71643
71715
  }
71644
71716
  function spawnAndCollect(command, args, cwd2) {
71645
- return new Promise((resolve42, reject) => {
71717
+ return new Promise((resolve43, reject) => {
71646
71718
  const child = spawn5(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
71647
71719
  const chunks = [];
71648
71720
  const stderrChunks = [];
@@ -71655,7 +71727,7 @@ function spawnAndCollect(command, args, cwd2) {
71655
71727
  reject(new Error(`${command} ${args[0] ?? ""} exited with code ${code2}: ${stderr}`));
71656
71728
  return;
71657
71729
  }
71658
- resolve42(Buffer.concat(chunks).toString("utf-8"));
71730
+ resolve43(Buffer.concat(chunks).toString("utf-8"));
71659
71731
  });
71660
71732
  });
71661
71733
  }
@@ -71839,7 +71911,7 @@ var init_content_validator = __esm(() => {
71839
71911
  });
71840
71912
 
71841
71913
  // src/commands/content/phases/context-cache-manager.ts
71842
- import { createHash as createHash7 } from "node:crypto";
71914
+ import { createHash as createHash8 } from "node:crypto";
71843
71915
  import { existsSync as existsSync72, mkdirSync as mkdirSync5, readFileSync as readFileSync18, readdirSync as readdirSync10, statSync as statSync13 } from "node:fs";
71844
71916
  import { rename as rename11, writeFile as writeFile35 } from "node:fs/promises";
71845
71917
  import { homedir as homedir46 } from "node:os";
@@ -71872,7 +71944,7 @@ async function saveCachedContext(repoPath, cache5) {
71872
71944
  await rename11(tmpPath, cachePath);
71873
71945
  }
71874
71946
  function computeSourceHash(repoPath) {
71875
- const hash = createHash7("sha256");
71947
+ const hash = createHash8("sha256");
71876
71948
  const paths = getDocSourcePaths(repoPath);
71877
71949
  for (const filePath of paths) {
71878
71950
  try {
@@ -71912,7 +71984,7 @@ function getDocSourcePaths(repoPath) {
71912
71984
  }
71913
71985
  function getCacheFilePath(repoPath) {
71914
71986
  const repoName = basename27(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
71915
- const pathHash = createHash7("sha256").update(repoPath).digest("hex").slice(0, 8);
71987
+ const pathHash = createHash8("sha256").update(repoPath).digest("hex").slice(0, 8);
71916
71988
  return join151(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
71917
71989
  }
71918
71990
  var CACHE_DIR, CACHE_TTL_MS4;
@@ -74181,7 +74253,7 @@ __export(exports_content_subcommands, {
74181
74253
  logsContent: () => logsContent,
74182
74254
  approveContentCmd: () => approveContentCmd
74183
74255
  });
74184
- import { existsSync as existsSync80, readFileSync as readFileSync21, unlinkSync as unlinkSync5 } from "node:fs";
74256
+ import { existsSync as existsSync80, readFileSync as readFileSync21, unlinkSync as unlinkSync6 } from "node:fs";
74185
74257
  import { homedir as homedir50 } from "node:os";
74186
74258
  import { join as join159 } from "node:path";
74187
74259
  function isDaemonRunning() {
@@ -74192,14 +74264,14 @@ function isDaemonRunning() {
74192
74264
  const pidStr = readFileSync21(lockFile, "utf-8").trim();
74193
74265
  const pid = Number.parseInt(pidStr, 10);
74194
74266
  if (Number.isNaN(pid)) {
74195
- unlinkSync5(lockFile);
74267
+ unlinkSync6(lockFile);
74196
74268
  return { running: false, pid: null };
74197
74269
  }
74198
74270
  process.kill(pid, 0);
74199
74271
  return { running: true, pid };
74200
74272
  } catch {
74201
74273
  try {
74202
- unlinkSync5(lockFile);
74274
+ unlinkSync6(lockFile);
74203
74275
  } catch {}
74204
74276
  return { running: false, pid: null };
74205
74277
  }
@@ -74294,7 +74366,7 @@ var init_content_subcommands = __esm(() => {
74294
74366
  });
74295
74367
 
74296
74368
  // src/commands/content/content-command.ts
74297
- import { existsSync as existsSync81, mkdirSync as mkdirSync9, unlinkSync as unlinkSync6, writeFileSync as writeFileSync7 } from "node:fs";
74369
+ import { existsSync as existsSync81, mkdirSync as mkdirSync9, unlinkSync as unlinkSync7, writeFileSync as writeFileSync7 } from "node:fs";
74298
74370
  import { homedir as homedir51 } from "node:os";
74299
74371
  import { join as join160 } from "node:path";
74300
74372
  async function contentCommand(options2) {
@@ -74342,7 +74414,7 @@ async function contentCommand(options2) {
74342
74414
  abortRequested = true;
74343
74415
  contentLogger.info("Shutting down gracefully...");
74344
74416
  try {
74345
- unlinkSync6(LOCK_FILE);
74417
+ unlinkSync7(LOCK_FILE);
74346
74418
  } catch {}
74347
74419
  await saveContentState(cwd2, state);
74348
74420
  closeDatabase(db);
@@ -74372,7 +74444,7 @@ async function contentCommand(options2) {
74372
74444
  const msg = err instanceof Error ? err.message : String(err);
74373
74445
  contentLogger.error(`Fatal error: ${msg}`);
74374
74446
  try {
74375
- unlinkSync6(LOCK_FILE);
74447
+ unlinkSync7(LOCK_FILE);
74376
74448
  } catch {}
74377
74449
  contentLogger.close();
74378
74450
  process.exit(1);
@@ -74457,8 +74529,8 @@ function shouldRunCleanup(lastAt) {
74457
74529
  return Date.now() - new Date(lastAt).getTime() >= 86400000;
74458
74530
  }
74459
74531
  function sleep2(ms) {
74460
- return new Promise((resolve42) => {
74461
- setTimeout(resolve42, ms);
74532
+ return new Promise((resolve43) => {
74533
+ setTimeout(resolve43, ms);
74462
74534
  });
74463
74535
  }
74464
74536
  var LOCK_DIR2, LOCK_FILE, MAX_CREATION_RETRIES = 3, MAX_PUBLISH_RETRIES_PER_CYCLE = 3, PUBLISH_RETRY_WINDOW_HOURS = 24;
@@ -75845,7 +75917,7 @@ function getPagerArgs(pagerCmd) {
75845
75917
  return [];
75846
75918
  }
75847
75919
  async function trySystemPager(content) {
75848
- return new Promise((resolve42) => {
75920
+ return new Promise((resolve43) => {
75849
75921
  const pagerCmd = process.env.PAGER || "less";
75850
75922
  const pagerArgs = getPagerArgs(pagerCmd);
75851
75923
  try {
@@ -75855,20 +75927,20 @@ async function trySystemPager(content) {
75855
75927
  });
75856
75928
  const timeout2 = setTimeout(() => {
75857
75929
  pager.kill();
75858
- resolve42(false);
75930
+ resolve43(false);
75859
75931
  }, 30000);
75860
75932
  pager.stdin.write(content);
75861
75933
  pager.stdin.end();
75862
75934
  pager.on("close", (code2) => {
75863
75935
  clearTimeout(timeout2);
75864
- resolve42(code2 === 0);
75936
+ resolve43(code2 === 0);
75865
75937
  });
75866
75938
  pager.on("error", () => {
75867
75939
  clearTimeout(timeout2);
75868
- resolve42(false);
75940
+ resolve43(false);
75869
75941
  });
75870
75942
  } catch {
75871
- resolve42(false);
75943
+ resolve43(false);
75872
75944
  }
75873
75945
  });
75874
75946
  }
@@ -75895,16 +75967,16 @@ async function basicPager(content) {
75895
75967
  break;
75896
75968
  }
75897
75969
  const remaining = lines.length - currentLine;
75898
- await new Promise((resolve42) => {
75970
+ await new Promise((resolve43) => {
75899
75971
  rl.question(`-- More (${remaining} lines) [Enter/q] --`, (answer) => {
75900
75972
  if (answer.toLowerCase() === "q") {
75901
75973
  rl.close();
75902
75974
  process.exitCode = 0;
75903
- resolve42();
75975
+ resolve43();
75904
75976
  return;
75905
75977
  }
75906
75978
  process.stdout.write("\x1B[1A\x1B[2K");
75907
- resolve42();
75979
+ resolve43();
75908
75980
  });
75909
75981
  });
75910
75982
  }
@@ -78702,7 +78774,7 @@ function showApiHelp() {
78702
78774
  }
78703
78775
  // src/services/file-operations/destructive-operation-backup-manager.ts
78704
78776
  import { readdir as readdir3, stat } from "node:fs/promises";
78705
- import { basename as basename4, join as join13, resolve as resolve4, sep as sep3 } from "node:path";
78777
+ import { basename as basename4, join as join13, resolve as resolve5, sep as sep3 } from "node:path";
78706
78778
 
78707
78779
  // src/services/file-operations/destructive-operation-backup.ts
78708
78780
  init_logger();
@@ -78710,7 +78782,7 @@ init_path_resolver();
78710
78782
  init_zod();
78711
78783
  var import_fs_extra = __toESM(require_lib(), 1);
78712
78784
  import { mkdir as mkdir4, readdir as readdir2, readlink, rename as rename2, symlink } from "node:fs/promises";
78713
- import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute2, join as join12, normalize as normalize2, resolve as resolve3, sep as sep2 } from "node:path";
78785
+ import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute2, join as join12, normalize as normalize2, resolve as resolve4, sep as sep2 } from "node:path";
78714
78786
  var SNAPSHOT_DIR = "snapshot";
78715
78787
  var MANIFEST_FILE = "manifest.json";
78716
78788
  function normalizeRelativePath(rootDir, inputPath) {
@@ -78718,21 +78790,21 @@ function normalizeRelativePath(rootDir, inputPath) {
78718
78790
  throw new Error(`Unsafe backup path: ${inputPath}`);
78719
78791
  }
78720
78792
  const normalized = normalize2(inputPath).replaceAll("\\", "/");
78721
- const resolvedRoot = resolve3(rootDir);
78722
- const resolvedPath = resolve3(rootDir, normalized);
78793
+ const resolvedRoot = resolve4(rootDir);
78794
+ const resolvedPath = resolve4(rootDir, normalized);
78723
78795
  if (normalized === ".." || normalized.startsWith("../") || !resolvedPath.startsWith(`${resolvedRoot}${sep2}`) && resolvedPath !== resolvedRoot) {
78724
78796
  throw new Error(`Path escapes installation root: ${inputPath}`);
78725
78797
  }
78726
78798
  return normalized;
78727
78799
  }
78728
78800
  function getManagedBackupRoot() {
78729
- return resolve3(PathResolver.getConfigDir(false), "backups");
78801
+ return resolve4(PathResolver.getConfigDir(false), "backups");
78730
78802
  }
78731
78803
  async function getExistingRealpath(pathToResolve) {
78732
78804
  if (await import_fs_extra.pathExists(pathToResolve)) {
78733
- return resolve3(await import_fs_extra.realpath(pathToResolve));
78805
+ return resolve4(await import_fs_extra.realpath(pathToResolve));
78734
78806
  }
78735
- return resolve3(pathToResolve);
78807
+ return resolve4(pathToResolve);
78736
78808
  }
78737
78809
  async function assertManagedBackupDir(backupDir) {
78738
78810
  const resolvedBackupDir = await getExistingRealpath(backupDir);
@@ -78777,13 +78849,13 @@ function buildTargets(sourceRoot, deletePaths, mutatePaths) {
78777
78849
  });
78778
78850
  }
78779
78851
  async function snapshotItem(sourceRoot, backupDir, target) {
78780
- const sourcePath = resolve3(sourceRoot, target.path);
78852
+ const sourcePath = resolve4(sourceRoot, target.path);
78781
78853
  if (!await import_fs_extra.pathExists(sourcePath)) {
78782
78854
  return null;
78783
78855
  }
78784
78856
  const stats = await import_fs_extra.lstat(sourcePath);
78785
78857
  if (stats.isSymbolicLink()) {
78786
- const realTargetPath = resolve3(await import_fs_extra.realpath(sourcePath));
78858
+ const realTargetPath = resolve4(await import_fs_extra.realpath(sourcePath));
78787
78859
  const resolvedSourceRoot = await getExistingRealpath(sourceRoot);
78788
78860
  if (!realTargetPath.startsWith(`${resolvedSourceRoot}${sep2}`) && realTargetPath !== resolvedSourceRoot) {
78789
78861
  throw new Error(`Symlink target escapes installation root: ${target.path}`);
@@ -78823,7 +78895,7 @@ async function copyDirectorySnapshot(sourceDir, destDir, rootDir) {
78823
78895
  const sourceEntry = join12(sourceDir, entry.name);
78824
78896
  const destEntry = join12(destDir, entry.name);
78825
78897
  if (entry.isSymbolicLink()) {
78826
- const realTargetPath = resolve3(await import_fs_extra.realpath(sourceEntry));
78898
+ const realTargetPath = resolve4(await import_fs_extra.realpath(sourceEntry));
78827
78899
  const resolvedRoot = await getExistingRealpath(rootDir);
78828
78900
  if (!realTargetPath.startsWith(`${resolvedRoot}${sep2}`) && realTargetPath !== resolvedRoot) {
78829
78901
  throw new Error(`Nested symlink target escapes installation root: ${sourceEntry}`);
@@ -78846,10 +78918,10 @@ function buildRestoreTempPath(sourcePath, suffix) {
78846
78918
  }
78847
78919
  async function assertSafeRestoreDestination(targetPath, rootDir) {
78848
78920
  const resolvedRoot = await getExistingRealpath(rootDir);
78849
- const lexicalRoot = resolve3(rootDir);
78921
+ const lexicalRoot = resolve4(rootDir);
78850
78922
  let currentPath = dirname5(targetPath);
78851
78923
  while (true) {
78852
- const resolvedCurrent = resolve3(currentPath);
78924
+ const resolvedCurrent = resolve4(currentPath);
78853
78925
  if (!resolvedCurrent.startsWith(`${lexicalRoot}${sep2}`) && resolvedCurrent !== lexicalRoot) {
78854
78926
  throw new Error(`Restore target escapes installation root: ${targetPath}`);
78855
78927
  }
@@ -78877,8 +78949,8 @@ async function copySnapshotDirectoryForRestore(snapshotDir, destDir, rootDir) {
78877
78949
  const destEntry = join12(destDir, entry.name);
78878
78950
  if (entry.isSymbolicLink()) {
78879
78951
  const linkTarget = await readlink(sourceEntry);
78880
- const resolvedTarget = resolve3(dirname5(destEntry), linkTarget);
78881
- const lexicalRoot = resolve3(rootDir);
78952
+ const resolvedTarget = resolve4(dirname5(destEntry), linkTarget);
78953
+ const lexicalRoot = resolve4(rootDir);
78882
78954
  if (!resolvedTarget.startsWith(`${lexicalRoot}${sep2}`) && resolvedTarget !== lexicalRoot) {
78883
78955
  throw new Error(`Nested restore symlink escapes installation root: ${destEntry}`);
78884
78956
  }
@@ -78953,7 +79025,7 @@ async function createDestructiveOperationBackup(request) {
78953
79025
  version: 1,
78954
79026
  operation: request.operation,
78955
79027
  createdAt: new Date().toISOString(),
78956
- sourceRoot: resolve3(request.sourceRoot),
79028
+ sourceRoot: resolve4(request.sourceRoot),
78957
79029
  scope: request.scope,
78958
79030
  kit: request.kit,
78959
79031
  items,
@@ -78977,7 +79049,7 @@ async function loadDestructiveOperationBackup(backupDir) {
78977
79049
  if (!isAbsolute2(manifest.sourceRoot)) {
78978
79050
  throw new Error(`Backup manifest source root must be absolute: ${manifest.sourceRoot}`);
78979
79051
  }
78980
- const resolvedSourceRoot = resolve3(manifest.sourceRoot);
79052
+ const resolvedSourceRoot = resolve4(manifest.sourceRoot);
78981
79053
  for (const item of manifest.items) {
78982
79054
  normalizeRelativePath(resolvedSourceRoot, item.path);
78983
79055
  const normalizedSnapshotPath = normalizeRelativePath(resolvedBackupDir, item.snapshotPath);
@@ -78997,8 +79069,8 @@ async function loadDestructiveOperationBackup(backupDir) {
78997
79069
  async function restoreDestructiveOperationBackup(backup) {
78998
79070
  const restorePlans = [];
78999
79071
  for (const item of backup.manifest.items) {
79000
- const sourcePath = resolve3(backup.manifest.sourceRoot, normalizeRelativePath(backup.manifest.sourceRoot, item.path));
79001
- const snapshotPath = resolve3(backup.backupDir, normalizeRelativePath(backup.backupDir, item.snapshotPath));
79072
+ const sourcePath = resolve4(backup.manifest.sourceRoot, normalizeRelativePath(backup.manifest.sourceRoot, item.path));
79073
+ const snapshotPath = resolve4(backup.backupDir, normalizeRelativePath(backup.backupDir, item.snapshotPath));
79002
79074
  try {
79003
79075
  await import_fs_extra.lstat(snapshotPath);
79004
79076
  } catch {
@@ -79040,7 +79112,7 @@ init_path_resolver();
79040
79112
  var import_fs_extra2 = __toESM(require_lib(), 1);
79041
79113
  var DEFAULT_DESTRUCTIVE_BACKUP_KEEP_COUNT = 10;
79042
79114
  function getBackupsRoot() {
79043
- return resolve4(PathResolver.getConfigDir(false), "backups");
79115
+ return resolve5(PathResolver.getConfigDir(false), "backups");
79044
79116
  }
79045
79117
  function validateBackupId(backupId) {
79046
79118
  if (!backupId || !/^[A-Za-z0-9._:-]+$/.test(backupId) || backupId.includes("..")) {
@@ -79050,7 +79122,7 @@ function validateBackupId(backupId) {
79050
79122
  function resolveBackupDir(backupId) {
79051
79123
  validateBackupId(backupId);
79052
79124
  const backupsRoot = getBackupsRoot();
79053
- const backupDir = resolve4(backupsRoot, backupId);
79125
+ const backupDir = resolve5(backupsRoot, backupId);
79054
79126
  if (!backupDir.startsWith(`${backupsRoot}${sep3}`) && backupDir !== backupsRoot) {
79055
79127
  throw new Error(`Backup id escapes backup root: ${backupId}`);
79056
79128
  }
@@ -79423,8 +79495,8 @@ init_logger();
79423
79495
  init_path_resolver();
79424
79496
  var import_fs_extra3 = __toESM(require_lib(), 1);
79425
79497
  var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
79426
- import { createHash as createHash3 } from "node:crypto";
79427
- import { join as join15, resolve as resolve5 } from "node:path";
79498
+ import { createHash as createHash4 } from "node:crypto";
79499
+ import { join as join15, resolve as resolve6 } from "node:path";
79428
79500
  var LOCK_OPTIONS = {
79429
79501
  realpath: false,
79430
79502
  retries: { retries: 5, minTimeout: 100, maxTimeout: 1000 },
@@ -79432,13 +79504,13 @@ var LOCK_OPTIONS = {
79432
79504
  };
79433
79505
  async function getCanonicalInstallationRoot(installationRoot) {
79434
79506
  if (await import_fs_extra3.pathExists(installationRoot)) {
79435
- return resolve5(await import_fs_extra3.realpath(installationRoot));
79507
+ return resolve6(await import_fs_extra3.realpath(installationRoot));
79436
79508
  }
79437
- return resolve5(installationRoot);
79509
+ return resolve6(installationRoot);
79438
79510
  }
79439
79511
  async function getInstallationStateLockPath(installationRoot) {
79440
79512
  const normalizedRoot = await getCanonicalInstallationRoot(installationRoot);
79441
- const hash = createHash3("sha256").update(normalizedRoot).digest("hex").slice(0, 16);
79513
+ const hash = createHash4("sha256").update(normalizedRoot).digest("hex").slice(0, 16);
79442
79514
  return join15(PathResolver.getConfigDir(false), "locks", `installation-${hash}.lock`);
79443
79515
  }
79444
79516
  async function acquireInstallationStateLock(installationRoot) {
@@ -80146,12 +80218,12 @@ async function configUICommand(options2 = {}) {
80146
80218
  console.log();
80147
80219
  console.log(import_picocolors14.default.dim(" Press Ctrl+C to stop"));
80148
80220
  console.log();
80149
- await new Promise((resolve23) => {
80221
+ await new Promise((resolve24) => {
80150
80222
  const shutdown = async () => {
80151
80223
  console.log();
80152
80224
  logger.info("Shutting down...");
80153
80225
  await server.close();
80154
- resolve23();
80226
+ resolve24();
80155
80227
  };
80156
80228
  process.on("SIGINT", shutdown);
80157
80229
  process.on("SIGTERM", shutdown);
@@ -80172,12 +80244,12 @@ async function configUICommand(options2 = {}) {
80172
80244
  }
80173
80245
  async function checkPort(port, host) {
80174
80246
  const { createServer: createServer2 } = await import("node:net");
80175
- return new Promise((resolve23) => {
80247
+ return new Promise((resolve24) => {
80176
80248
  const server = createServer2();
80177
- server.once("error", () => resolve23(false));
80249
+ server.once("error", () => resolve24(false));
80178
80250
  server.once("listening", () => {
80179
80251
  server.close();
80180
- resolve23(true);
80252
+ resolve24(true);
80181
80253
  });
80182
80254
  server.listen(port, host);
80183
80255
  });
@@ -81764,7 +81836,7 @@ init_path_resolver();
81764
81836
  import { existsSync as existsSync50 } from "node:fs";
81765
81837
  import { readFile as readFile38 } from "node:fs/promises";
81766
81838
  import { homedir as homedir38 } from "node:os";
81767
- import { dirname as dirname23, join as join75, normalize as normalize6, resolve as resolve23 } from "node:path";
81839
+ import { dirname as dirname23, join as join75, normalize as normalize6, resolve as resolve24 } from "node:path";
81768
81840
  async function checkPathRefsValid(projectDir) {
81769
81841
  const globalClaudeMd = join75(PathResolver.getGlobalKitDir(), "CLAUDE.md");
81770
81842
  const projectClaudeMd = join75(projectDir, ".claude", "CLAUDE.md");
@@ -81811,7 +81883,7 @@ async function checkPathRefsValid(projectDir) {
81811
81883
  } else if (/^[A-Za-z]:/.test(ref)) {
81812
81884
  refPath = normalize6(ref);
81813
81885
  } else {
81814
- refPath = resolve23(baseDir, ref);
81886
+ refPath = resolve24(baseDir, ref);
81815
81887
  }
81816
81888
  const normalizedPath = normalize6(refPath);
81817
81889
  const isWithinHome = normalizedPath.startsWith(home9);
@@ -82381,13 +82453,13 @@ import { spawnSync as spawnSync3 } from "node:child_process";
82381
82453
  import { existsSync as existsSync52, readFileSync as readFileSync15, statSync as statSync9, writeFileSync as writeFileSync5 } from "node:fs";
82382
82454
  import { readdir as readdir20 } from "node:fs/promises";
82383
82455
  import { homedir as homedir39, tmpdir } from "node:os";
82384
- import { join as join79, resolve as resolve24 } from "node:path";
82456
+ import { join as join79, resolve as resolve25 } from "node:path";
82385
82457
  var HOOK_CHECK_TIMEOUT_MS = 5000;
82386
82458
  var PYTHON_CHECK_TIMEOUT_MS = 3000;
82387
82459
  var MAX_LOG_FILE_SIZE_BYTES = 10 * 1024 * 1024;
82388
82460
  function getHooksDir(projectDir) {
82389
- const projectHooksDir = resolve24(projectDir, ".claude", "hooks");
82390
- const globalHooksDir = resolve24(PathResolver.getGlobalKitDir(), "hooks");
82461
+ const projectHooksDir = resolve25(projectDir, ".claude", "hooks");
82462
+ const globalHooksDir = resolve25(PathResolver.getGlobalKitDir(), "hooks");
82391
82463
  if (existsSync52(projectHooksDir))
82392
82464
  return projectHooksDir;
82393
82465
  if (existsSync52(globalHooksDir))
@@ -82395,7 +82467,7 @@ function getHooksDir(projectDir) {
82395
82467
  return null;
82396
82468
  }
82397
82469
  function isPathWithin(filePath, parentDir) {
82398
- return resolve24(filePath).startsWith(resolve24(parentDir));
82470
+ return resolve25(filePath).startsWith(resolve25(parentDir));
82399
82471
  }
82400
82472
  function getCanonicalGlobalCommandRoot() {
82401
82473
  const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
@@ -82406,22 +82478,22 @@ function getClaudeSettingsFiles(projectDir) {
82406
82478
  const globalClaudeDir = PathResolver.getGlobalKitDir();
82407
82479
  const candidates = [
82408
82480
  {
82409
- path: resolve24(projectDir, ".claude", "settings.json"),
82481
+ path: resolve25(projectDir, ".claude", "settings.json"),
82410
82482
  label: "project settings.json",
82411
82483
  root: "$CLAUDE_PROJECT_DIR"
82412
82484
  },
82413
82485
  {
82414
- path: resolve24(projectDir, ".claude", "settings.local.json"),
82486
+ path: resolve25(projectDir, ".claude", "settings.local.json"),
82415
82487
  label: "project settings.local.json",
82416
82488
  root: "$CLAUDE_PROJECT_DIR"
82417
82489
  },
82418
82490
  {
82419
- path: resolve24(globalClaudeDir, "settings.json"),
82491
+ path: resolve25(globalClaudeDir, "settings.json"),
82420
82492
  label: "global settings.json",
82421
82493
  root: getCanonicalGlobalCommandRoot()
82422
82494
  },
82423
82495
  {
82424
- path: resolve24(globalClaudeDir, "settings.local.json"),
82496
+ path: resolve25(globalClaudeDir, "settings.local.json"),
82425
82497
  label: "global settings.local.json",
82426
82498
  root: getCanonicalGlobalCommandRoot()
82427
82499
  }
@@ -84274,7 +84346,7 @@ class AutoHealer {
84274
84346
  }
84275
84347
  // src/domains/health-checks/report-generator.ts
84276
84348
  import { execSync as execSync4, spawnSync as spawnSync6 } from "node:child_process";
84277
- import { readFileSync as readFileSync16, unlinkSync, writeFileSync as writeFileSync6 } from "node:fs";
84349
+ import { readFileSync as readFileSync16, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
84278
84350
  import { tmpdir as tmpdir3 } from "node:os";
84279
84351
  import { dirname as dirname24, join as join83 } from "node:path";
84280
84352
  import { fileURLToPath as fileURLToPath4 } from "node:url";
@@ -84440,7 +84512,7 @@ class ReportGenerator {
84440
84512
  return null;
84441
84513
  } finally {
84442
84514
  try {
84443
- unlinkSync(tmpFile);
84515
+ unlinkSync2(tmpFile);
84444
84516
  } catch {}
84445
84517
  }
84446
84518
  }
@@ -84752,7 +84824,7 @@ import { isAbsolute as isAbsolute8, join as join84, normalize as normalize8, rel
84752
84824
 
84753
84825
  // src/services/file-operations/ownership-checker.ts
84754
84826
  init_metadata_migration();
84755
- import { createHash as createHash4 } from "node:crypto";
84827
+ import { createHash as createHash5 } from "node:crypto";
84756
84828
  import { createReadStream as createReadStream2 } from "node:fs";
84757
84829
  import { stat as stat12 } from "node:fs/promises";
84758
84830
  import { relative as relative13 } from "node:path";
@@ -84768,12 +84840,12 @@ async function mapWithLimit(items, fn, concurrency = DEFAULT_CONCURRENCY) {
84768
84840
  // src/services/file-operations/ownership-checker.ts
84769
84841
  class OwnershipChecker {
84770
84842
  static async calculateChecksum(filePath) {
84771
- return new Promise((resolve25, reject) => {
84772
- const hash = createHash4("sha256");
84843
+ return new Promise((resolve26, reject) => {
84844
+ const hash = createHash5("sha256");
84773
84845
  const stream = createReadStream2(filePath);
84774
84846
  stream.on("data", (chunk) => hash.update(chunk));
84775
84847
  stream.on("end", () => {
84776
- resolve25(hash.digest("hex"));
84848
+ resolve26(hash.digest("hex"));
84777
84849
  });
84778
84850
  stream.on("error", (err) => {
84779
84851
  stream.destroy();
@@ -87554,10 +87626,10 @@ init_types3();
87554
87626
  // src/domains/installation/utils/path-security.ts
87555
87627
  init_types3();
87556
87628
  import { lstatSync as lstatSync2, realpathSync as realpathSync3 } from "node:fs";
87557
- import { relative as relative15, resolve as resolve27 } from "node:path";
87629
+ import { relative as relative15, resolve as resolve28 } from "node:path";
87558
87630
  var MAX_EXTRACTION_SIZE = 500 * 1024 * 1024;
87559
87631
  function isPathSafe(basePath, targetPath) {
87560
- const resolvedBase = resolve27(basePath);
87632
+ const resolvedBase = resolve28(basePath);
87561
87633
  try {
87562
87634
  const stat14 = lstatSync2(targetPath);
87563
87635
  if (stat14.isSymbolicLink()) {
@@ -87567,7 +87639,7 @@ function isPathSafe(basePath, targetPath) {
87567
87639
  }
87568
87640
  }
87569
87641
  } catch {}
87570
- const resolvedTarget = resolve27(targetPath);
87642
+ const resolvedTarget = resolve28(targetPath);
87571
87643
  const relativePath = relative15(resolvedBase, resolvedTarget);
87572
87644
  return !relativePath.startsWith("..") && !relativePath.startsWith("/") && resolvedTarget.startsWith(resolvedBase);
87573
87645
  }
@@ -87655,7 +87727,7 @@ class FileDownloader {
87655
87727
  }
87656
87728
  if (downloadedSize !== totalSize) {
87657
87729
  fileStream.end();
87658
- await new Promise((resolve28) => fileStream.once("close", resolve28));
87730
+ await new Promise((resolve29) => fileStream.once("close", resolve29));
87659
87731
  try {
87660
87732
  rmSync2(destPath, { force: true });
87661
87733
  } catch (cleanupError) {
@@ -87669,7 +87741,7 @@ class FileDownloader {
87669
87741
  return destPath;
87670
87742
  } catch (error) {
87671
87743
  fileStream.end();
87672
- await new Promise((resolve28) => fileStream.once("close", resolve28));
87744
+ await new Promise((resolve29) => fileStream.once("close", resolve29));
87673
87745
  try {
87674
87746
  rmSync2(destPath, { force: true });
87675
87747
  } catch (cleanupError) {
@@ -87735,7 +87807,7 @@ class FileDownloader {
87735
87807
  const expectedSize = Number(response.headers.get("content-length"));
87736
87808
  if (expectedSize > 0 && downloadedSize !== expectedSize) {
87737
87809
  fileStream.end();
87738
- await new Promise((resolve28) => fileStream.once("close", resolve28));
87810
+ await new Promise((resolve29) => fileStream.once("close", resolve29));
87739
87811
  try {
87740
87812
  rmSync2(destPath, { force: true });
87741
87813
  } catch (cleanupError) {
@@ -87753,7 +87825,7 @@ class FileDownloader {
87753
87825
  return destPath;
87754
87826
  } catch (error) {
87755
87827
  fileStream.end();
87756
- await new Promise((resolve28) => fileStream.once("close", resolve28));
87828
+ await new Promise((resolve29) => fileStream.once("close", resolve29));
87757
87829
  try {
87758
87830
  rmSync2(destPath, { force: true });
87759
87831
  } catch (cleanupError) {
@@ -88352,10 +88424,10 @@ class Minipass extends EventEmitter3 {
88352
88424
  return this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
88353
88425
  }
88354
88426
  async promise() {
88355
- return new Promise((resolve28, reject) => {
88427
+ return new Promise((resolve29, reject) => {
88356
88428
  this.on(DESTROYED, () => reject(new Error("stream destroyed")));
88357
88429
  this.on("error", (er) => reject(er));
88358
- this.on("end", () => resolve28());
88430
+ this.on("end", () => resolve29());
88359
88431
  });
88360
88432
  }
88361
88433
  [Symbol.asyncIterator]() {
@@ -88374,7 +88446,7 @@ class Minipass extends EventEmitter3 {
88374
88446
  return Promise.resolve({ done: false, value: res });
88375
88447
  if (this[EOF])
88376
88448
  return stop();
88377
- let resolve28;
88449
+ let resolve29;
88378
88450
  let reject;
88379
88451
  const onerr = (er) => {
88380
88452
  this.off("data", ondata);
@@ -88388,19 +88460,19 @@ class Minipass extends EventEmitter3 {
88388
88460
  this.off("end", onend);
88389
88461
  this.off(DESTROYED, ondestroy);
88390
88462
  this.pause();
88391
- resolve28({ value, done: !!this[EOF] });
88463
+ resolve29({ value, done: !!this[EOF] });
88392
88464
  };
88393
88465
  const onend = () => {
88394
88466
  this.off("error", onerr);
88395
88467
  this.off("data", ondata);
88396
88468
  this.off(DESTROYED, ondestroy);
88397
88469
  stop();
88398
- resolve28({ done: true, value: undefined });
88470
+ resolve29({ done: true, value: undefined });
88399
88471
  };
88400
88472
  const ondestroy = () => onerr(new Error("stream destroyed"));
88401
88473
  return new Promise((res2, rej) => {
88402
88474
  reject = rej;
88403
- resolve28 = res2;
88475
+ resolve29 = res2;
88404
88476
  this.once(DESTROYED, ondestroy);
88405
88477
  this.once("error", onerr);
88406
88478
  this.once("end", onend);
@@ -89506,10 +89578,10 @@ class Minipass2 extends EventEmitter4 {
89506
89578
  return this[ENCODING2] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
89507
89579
  }
89508
89580
  async promise() {
89509
- return new Promise((resolve28, reject) => {
89581
+ return new Promise((resolve29, reject) => {
89510
89582
  this.on(DESTROYED2, () => reject(new Error("stream destroyed")));
89511
89583
  this.on("error", (er) => reject(er));
89512
- this.on("end", () => resolve28());
89584
+ this.on("end", () => resolve29());
89513
89585
  });
89514
89586
  }
89515
89587
  [Symbol.asyncIterator]() {
@@ -89528,7 +89600,7 @@ class Minipass2 extends EventEmitter4 {
89528
89600
  return Promise.resolve({ done: false, value: res });
89529
89601
  if (this[EOF2])
89530
89602
  return stop();
89531
- let resolve28;
89603
+ let resolve29;
89532
89604
  let reject;
89533
89605
  const onerr = (er) => {
89534
89606
  this.off("data", ondata);
@@ -89542,19 +89614,19 @@ class Minipass2 extends EventEmitter4 {
89542
89614
  this.off("end", onend);
89543
89615
  this.off(DESTROYED2, ondestroy);
89544
89616
  this.pause();
89545
- resolve28({ value, done: !!this[EOF2] });
89617
+ resolve29({ value, done: !!this[EOF2] });
89546
89618
  };
89547
89619
  const onend = () => {
89548
89620
  this.off("error", onerr);
89549
89621
  this.off("data", ondata);
89550
89622
  this.off(DESTROYED2, ondestroy);
89551
89623
  stop();
89552
- resolve28({ done: true, value: undefined });
89624
+ resolve29({ done: true, value: undefined });
89553
89625
  };
89554
89626
  const ondestroy = () => onerr(new Error("stream destroyed"));
89555
89627
  return new Promise((res2, rej) => {
89556
89628
  reject = rej;
89557
- resolve28 = res2;
89629
+ resolve29 = res2;
89558
89630
  this.once(DESTROYED2, ondestroy);
89559
89631
  this.once("error", onerr);
89560
89632
  this.once("end", onend);
@@ -90982,10 +91054,10 @@ class Minipass3 extends EventEmitter5 {
90982
91054
  return this[ENCODING3] ? buf.join("") : Buffer.concat(buf, buf.dataLength);
90983
91055
  }
90984
91056
  async promise() {
90985
- return new Promise((resolve28, reject) => {
91057
+ return new Promise((resolve29, reject) => {
90986
91058
  this.on(DESTROYED3, () => reject(new Error("stream destroyed")));
90987
91059
  this.on("error", (er) => reject(er));
90988
- this.on("end", () => resolve28());
91060
+ this.on("end", () => resolve29());
90989
91061
  });
90990
91062
  }
90991
91063
  [Symbol.asyncIterator]() {
@@ -91004,7 +91076,7 @@ class Minipass3 extends EventEmitter5 {
91004
91076
  return Promise.resolve({ done: false, value: res });
91005
91077
  if (this[EOF3])
91006
91078
  return stop();
91007
- let resolve28;
91079
+ let resolve29;
91008
91080
  let reject;
91009
91081
  const onerr = (er) => {
91010
91082
  this.off("data", ondata);
@@ -91018,19 +91090,19 @@ class Minipass3 extends EventEmitter5 {
91018
91090
  this.off("end", onend);
91019
91091
  this.off(DESTROYED3, ondestroy);
91020
91092
  this.pause();
91021
- resolve28({ value, done: !!this[EOF3] });
91093
+ resolve29({ value, done: !!this[EOF3] });
91022
91094
  };
91023
91095
  const onend = () => {
91024
91096
  this.off("error", onerr);
91025
91097
  this.off("data", ondata);
91026
91098
  this.off(DESTROYED3, ondestroy);
91027
91099
  stop();
91028
- resolve28({ done: true, value: undefined });
91100
+ resolve29({ done: true, value: undefined });
91029
91101
  };
91030
91102
  const ondestroy = () => onerr(new Error("stream destroyed"));
91031
91103
  return new Promise((res2, rej) => {
91032
91104
  reject = rej;
91033
- resolve28 = res2;
91105
+ resolve29 = res2;
91034
91106
  this.once(DESTROYED3, ondestroy);
91035
91107
  this.once("error", onerr);
91036
91108
  this.once("end", onend);
@@ -91801,9 +91873,9 @@ var listFile = (opt, _files) => {
91801
91873
  const parse5 = new Parser(opt);
91802
91874
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
91803
91875
  const file = opt.file;
91804
- const p = new Promise((resolve28, reject) => {
91876
+ const p = new Promise((resolve29, reject) => {
91805
91877
  parse5.on("error", reject);
91806
- parse5.on("end", resolve28);
91878
+ parse5.on("end", resolve29);
91807
91879
  fs10.stat(file, (er, stat14) => {
91808
91880
  if (er) {
91809
91881
  reject(er);
@@ -94383,9 +94455,9 @@ var extractFile = (opt, _3) => {
94383
94455
  const u = new Unpack(opt);
94384
94456
  const readSize = opt.maxReadSize || 16 * 1024 * 1024;
94385
94457
  const file = opt.file;
94386
- const p = new Promise((resolve28, reject) => {
94458
+ const p = new Promise((resolve29, reject) => {
94387
94459
  u.on("error", reject);
94388
- u.on("close", resolve28);
94460
+ u.on("close", resolve29);
94389
94461
  fs17.stat(file, (er, stat14) => {
94390
94462
  if (er) {
94391
94463
  reject(er);
@@ -94518,7 +94590,7 @@ var replaceAsync = (opt, files) => {
94518
94590
  };
94519
94591
  fs18.read(fd, headBuf, 0, 512, position, onread);
94520
94592
  };
94521
- const promise = new Promise((resolve28, reject) => {
94593
+ const promise = new Promise((resolve29, reject) => {
94522
94594
  p.on("error", reject);
94523
94595
  let flag = "r+";
94524
94596
  const onopen = (er, fd) => {
@@ -94543,7 +94615,7 @@ var replaceAsync = (opt, files) => {
94543
94615
  });
94544
94616
  p.pipe(stream);
94545
94617
  stream.on("error", reject);
94546
- stream.on("close", resolve28);
94618
+ stream.on("close", resolve29);
94547
94619
  addFilesAsync2(p, files);
94548
94620
  });
94549
94621
  });
@@ -94817,20 +94889,20 @@ class ZipExtractor {
94817
94889
  if (!isMacOS()) {
94818
94890
  return false;
94819
94891
  }
94820
- return new Promise((resolve28) => {
94892
+ return new Promise((resolve29) => {
94821
94893
  mkdir25(destDir, { recursive: true }).then(() => {
94822
94894
  execFile9("unzip", ["-o", "-q", archivePath, "-d", destDir], (error, _stdout, stderr) => {
94823
94895
  if (error) {
94824
94896
  logger.debug(`Native unzip failed: ${stderr || error.message}`);
94825
- resolve28(false);
94897
+ resolve29(false);
94826
94898
  return;
94827
94899
  }
94828
94900
  logger.debug("Native unzip succeeded");
94829
- resolve28(true);
94901
+ resolve29(true);
94830
94902
  });
94831
94903
  }).catch((err) => {
94832
94904
  logger.debug(`Failed to create directory for native unzip: ${err.message}`);
94833
- resolve28(false);
94905
+ resolve29(false);
94834
94906
  });
94835
94907
  });
94836
94908
  }
@@ -95454,8 +95526,8 @@ async function handleDownload(ctx) {
95454
95526
  import { join as join116 } from "node:path";
95455
95527
 
95456
95528
  // src/domains/installation/deletion-handler.ts
95457
- import { existsSync as existsSync58, lstatSync as lstatSync3, readdirSync as readdirSync6, rmSync as rmSync3, rmdirSync, unlinkSync as unlinkSync3 } from "node:fs";
95458
- import { dirname as dirname29, join as join102, relative as relative17, resolve as resolve29, sep as sep9 } from "node:path";
95529
+ import { existsSync as existsSync58, lstatSync as lstatSync3, readdirSync as readdirSync6, rmSync as rmSync3, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
95530
+ import { dirname as dirname29, join as join102, relative as relative17, resolve as resolve30, sep as sep9 } from "node:path";
95459
95531
 
95460
95532
  // src/services/file-operations/manifest/manifest-reader.ts
95461
95533
  init_metadata_migration();
@@ -95680,8 +95752,8 @@ function expandGlobPatterns(patterns, claudeDir3) {
95680
95752
  }
95681
95753
  var MAX_CLEANUP_ITERATIONS = 50;
95682
95754
  function cleanupEmptyDirectories(filePath, claudeDir3) {
95683
- const normalizedClaudeDir = resolve29(claudeDir3);
95684
- let currentDir = resolve29(dirname29(filePath));
95755
+ const normalizedClaudeDir = resolve30(claudeDir3);
95756
+ let currentDir = resolve30(dirname29(filePath));
95685
95757
  let iterations = 0;
95686
95758
  while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
95687
95759
  iterations++;
@@ -95690,7 +95762,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
95690
95762
  if (entries.length === 0) {
95691
95763
  rmdirSync(currentDir);
95692
95764
  logger.debug(`Removed empty directory: ${currentDir}`);
95693
- currentDir = resolve29(dirname29(currentDir));
95765
+ currentDir = resolve30(dirname29(currentDir));
95694
95766
  } else {
95695
95767
  break;
95696
95768
  }
@@ -95700,8 +95772,8 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
95700
95772
  }
95701
95773
  }
95702
95774
  function deletePath(fullPath, claudeDir3) {
95703
- const normalizedPath = resolve29(fullPath);
95704
- const normalizedClaudeDir = resolve29(claudeDir3);
95775
+ const normalizedPath = resolve30(fullPath);
95776
+ const normalizedClaudeDir = resolve30(claudeDir3);
95705
95777
  if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep9}`) && normalizedPath !== normalizedClaudeDir) {
95706
95778
  throw new Error(`Path traversal detected: ${fullPath}`);
95707
95779
  }
@@ -95710,7 +95782,7 @@ function deletePath(fullPath, claudeDir3) {
95710
95782
  if (stat17.isDirectory()) {
95711
95783
  rmSync3(fullPath, { recursive: true, force: true });
95712
95784
  } else {
95713
- unlinkSync3(fullPath);
95785
+ unlinkSync4(fullPath);
95714
95786
  cleanupEmptyDirectories(fullPath, claudeDir3);
95715
95787
  }
95716
95788
  } catch (error) {
@@ -95774,8 +95846,8 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
95774
95846
  const result = { deletedPaths: [], preservedPaths: [], errors: [] };
95775
95847
  for (const path15 of deletions) {
95776
95848
  const fullPath = join102(claudeDir3, path15);
95777
- const normalizedPath = resolve29(fullPath);
95778
- const normalizedClaudeDir = resolve29(claudeDir3);
95849
+ const normalizedPath = resolve30(fullPath);
95850
+ const normalizedClaudeDir = resolve30(claudeDir3);
95779
95851
  if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep9}`)) {
95780
95852
  logger.warning(`Skipping invalid path: ${path15}`);
95781
95853
  result.errors.push(path15);
@@ -99010,7 +99082,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
99010
99082
  init_logger();
99011
99083
  init_skip_directories();
99012
99084
  var import_fs_extra19 = __toESM(require_lib(), 1);
99013
- import { join as join111, relative as relative21, resolve as resolve30 } from "node:path";
99085
+ import { join as join111, relative as relative21, resolve as resolve31 } from "node:path";
99014
99086
 
99015
99087
  class FileScanner2 {
99016
99088
  static async getFiles(dirPath, relativeTo) {
@@ -99090,8 +99162,8 @@ class FileScanner2 {
99090
99162
  return customFiles;
99091
99163
  }
99092
99164
  static isSafePath(basePath, targetPath) {
99093
- const resolvedBase = resolve30(basePath);
99094
- const resolvedTarget = resolve30(targetPath);
99165
+ const resolvedBase = resolve31(basePath);
99166
+ const resolvedTarget = resolve31(targetPath);
99095
99167
  return resolvedTarget.startsWith(resolvedBase);
99096
99168
  }
99097
99169
  static toPosixPath(path16) {
@@ -99713,7 +99785,7 @@ init_logger();
99713
99785
  init_skip_directories();
99714
99786
  init_types3();
99715
99787
  var import_fs_extra24 = __toESM(require_lib(), 1);
99716
- import { createHash as createHash5 } from "node:crypto";
99788
+ import { createHash as createHash6 } from "node:crypto";
99717
99789
  import { readFile as readFile51, readdir as readdir32, writeFile as writeFile27 } from "node:fs/promises";
99718
99790
  import { join as join117, relative as relative22 } from "node:path";
99719
99791
 
@@ -99815,7 +99887,7 @@ class SkillsManifestManager {
99815
99887
  return skills.sort((a3, b3) => a3.name.localeCompare(b3.name));
99816
99888
  }
99817
99889
  static async hashDirectory(dirPath) {
99818
- const hash = createHash5("sha256");
99890
+ const hash = createHash6("sha256");
99819
99891
  const files = await SkillsManifestManager.getAllFiles(dirPath);
99820
99892
  files.sort();
99821
99893
  for (const file of files) {
@@ -100558,7 +100630,7 @@ import { relative as relative24 } from "node:path";
100558
100630
 
100559
100631
  // src/domains/skills/customization/hash-calculator.ts
100560
100632
  init_skip_directories();
100561
- import { createHash as createHash6 } from "node:crypto";
100633
+ import { createHash as createHash7 } from "node:crypto";
100562
100634
  import { createReadStream as createReadStream3 } from "node:fs";
100563
100635
  import { readFile as readFile52, readdir as readdir36 } from "node:fs/promises";
100564
100636
  import { join as join121, relative as relative23 } from "node:path";
@@ -100580,12 +100652,12 @@ async function getAllFiles(dirPath) {
100580
100652
  return files;
100581
100653
  }
100582
100654
  async function hashFile(filePath) {
100583
- return new Promise((resolve31, reject) => {
100584
- const hash = createHash6("sha256");
100655
+ return new Promise((resolve32, reject) => {
100656
+ const hash = createHash7("sha256");
100585
100657
  const stream = createReadStream3(filePath);
100586
100658
  stream.on("data", (chunk) => hash.update(chunk));
100587
100659
  stream.on("end", () => {
100588
- resolve31(hash.digest("hex"));
100660
+ resolve32(hash.digest("hex"));
100589
100661
  });
100590
100662
  stream.on("error", (error) => {
100591
100663
  stream.destroy();
@@ -100594,7 +100666,7 @@ async function hashFile(filePath) {
100594
100666
  });
100595
100667
  }
100596
100668
  async function hashDirectory(dirPath) {
100597
- const hash = createHash6("sha256");
100669
+ const hash = createHash7("sha256");
100598
100670
  const files = await getAllFiles(dirPath);
100599
100671
  files.sort();
100600
100672
  for (const file of files) {
@@ -101234,7 +101306,7 @@ async function handlePostInstall(ctx) {
101234
101306
  init_config_manager();
101235
101307
  init_github_client();
101236
101308
  import { mkdir as mkdir31 } from "node:fs/promises";
101237
- import { join as join129, resolve as resolve32 } from "node:path";
101309
+ import { join as join129, resolve as resolve33 } from "node:path";
101238
101310
 
101239
101311
  // src/domains/github/kit-access-checker.ts
101240
101312
  init_logger();
@@ -101364,8 +101436,8 @@ async function runPreflightChecks() {
101364
101436
 
101365
101437
  // src/domains/installation/fresh-installer.ts
101366
101438
  init_metadata_migration();
101367
- import { existsSync as existsSync60, readdirSync as readdirSync7, rmSync as rmSync4, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
101368
- import { basename as basename22, dirname as dirname33, join as join128, resolve as resolve31 } from "node:path";
101439
+ import { existsSync as existsSync60, readdirSync as readdirSync7, rmSync as rmSync4, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
101440
+ import { basename as basename22, dirname as dirname33, join as join128, resolve as resolve32 } from "node:path";
101369
101441
  init_logger();
101370
101442
  init_safe_spinner();
101371
101443
  var import_fs_extra34 = __toESM(require_lib(), 1);
@@ -101413,15 +101485,15 @@ async function analyzeFreshInstallation(claudeDir3) {
101413
101485
  };
101414
101486
  }
101415
101487
  function cleanupEmptyDirectories2(filePath, claudeDir3) {
101416
- const normalizedClaudeDir = resolve31(claudeDir3);
101417
- let currentDir = resolve31(dirname33(filePath));
101488
+ const normalizedClaudeDir = resolve32(claudeDir3);
101489
+ let currentDir = resolve32(dirname33(filePath));
101418
101490
  while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
101419
101491
  try {
101420
101492
  const entries = readdirSync7(currentDir);
101421
101493
  if (entries.length === 0) {
101422
101494
  rmdirSync2(currentDir);
101423
101495
  logger.debug(`Removed empty directory: ${currentDir}`);
101424
- currentDir = resolve31(dirname33(currentDir));
101496
+ currentDir = resolve32(dirname33(currentDir));
101425
101497
  } else {
101426
101498
  break;
101427
101499
  }
@@ -101443,7 +101515,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
101443
101515
  continue;
101444
101516
  }
101445
101517
  try {
101446
- unlinkSync4(fullPath);
101518
+ unlinkSync5(fullPath);
101447
101519
  removedFiles.push(file.path);
101448
101520
  logger.debug(`Removed: ${file.path}`);
101449
101521
  cleanupEmptyDirectories2(fullPath, claudeDir3);
@@ -101542,7 +101614,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
101542
101614
  }
101543
101615
  const metadataPath = join128(claudeDir3, "metadata.json");
101544
101616
  if (await import_fs_extra34.pathExists(metadataPath)) {
101545
- unlinkSync4(metadataPath);
101617
+ unlinkSync5(metadataPath);
101546
101618
  removedFiles.push("metadata.json");
101547
101619
  }
101548
101620
  return {
@@ -101788,7 +101860,7 @@ async function handleSelection(ctx) {
101788
101860
  }
101789
101861
  }
101790
101862
  }
101791
- const resolvedDir = resolve32(targetDir);
101863
+ const resolvedDir = resolve33(targetDir);
101792
101864
  logger.info(`Target directory: ${resolvedDir}`);
101793
101865
  if (!ctx.options.global && PathResolver.isLocalSameAsGlobal(resolvedDir)) {
101794
101866
  logger.warning("You're at HOME directory. Installing here modifies your GLOBAL ClaudeKit.");
@@ -101967,7 +102039,7 @@ async function handleSelection(ctx) {
101967
102039
  }
101968
102040
  // src/commands/init/phases/sync-handler.ts
101969
102041
  import { copyFile as copyFile8, mkdir as mkdir32, open as open5, readFile as readFile55, rename as rename8, stat as stat21, unlink as unlink11, writeFile as writeFile30 } from "node:fs/promises";
101970
- import { dirname as dirname34, join as join130, resolve as resolve33 } from "node:path";
102042
+ import { dirname as dirname34, join as join130, resolve as resolve34 } from "node:path";
101971
102043
  init_logger();
101972
102044
  init_path_resolver();
101973
102045
  var import_fs_extra36 = __toESM(require_lib(), 1);
@@ -101976,7 +102048,7 @@ async function handleSync(ctx) {
101976
102048
  if (!ctx.options.sync) {
101977
102049
  return ctx;
101978
102050
  }
101979
- const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve33(ctx.options.dir || ".");
102051
+ const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve34(ctx.options.dir || ".");
101980
102052
  const claudeDir3 = ctx.options.global ? resolvedDir : join130(resolvedDir, ".claude");
101981
102053
  if (!await import_fs_extra36.pathExists(claudeDir3)) {
101982
102054
  logger.error("Cannot sync: no .claude directory found");
@@ -102110,7 +102182,7 @@ async function acquireSyncLock(global3) {
102110
102182
  }
102111
102183
  logger.debug(`Lock stat failed: ${statError}`);
102112
102184
  }
102113
- await new Promise((resolve34) => setTimeout(resolve34, 100));
102185
+ await new Promise((resolve35) => setTimeout(resolve35, 100));
102114
102186
  continue;
102115
102187
  }
102116
102188
  throw err;
@@ -103045,7 +103117,7 @@ var import_picocolors28 = __toESM(require_picocolors(), 1);
103045
103117
  import { existsSync as existsSync61 } from "node:fs";
103046
103118
  import { readFile as readFile58, rm as rm15, unlink as unlink12 } from "node:fs/promises";
103047
103119
  import { homedir as homedir44 } from "node:os";
103048
- import { basename as basename23, join as join135, resolve as resolve34 } from "node:path";
103120
+ import { basename as basename23, join as join135, resolve as resolve35 } from "node:path";
103049
103121
  init_logger();
103050
103122
  init_agents_discovery();
103051
103123
  init_commands_discovery();
@@ -103443,7 +103515,7 @@ function shouldExecuteAction2(action) {
103443
103515
  }
103444
103516
  async function executeDeleteAction(action, options2) {
103445
103517
  const preservePaths = options2?.preservePaths ?? new Set;
103446
- const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve34(action.targetPath));
103518
+ const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve35(action.targetPath));
103447
103519
  try {
103448
103520
  if (!shouldPreserveTarget && action.targetPath && existsSync61(action.targetPath)) {
103449
103521
  await rm15(action.targetPath, { recursive: true, force: true });
@@ -103470,7 +103542,7 @@ async function executeDeleteAction(action, options2) {
103470
103542
  async function processMetadataDeletions(skillSourcePath, installGlobally) {
103471
103543
  if (!skillSourcePath)
103472
103544
  return;
103473
- const sourceMetadataPath = join135(resolve34(skillSourcePath, ".."), "metadata.json");
103545
+ const sourceMetadataPath = join135(resolve35(skillSourcePath, ".."), "metadata.json");
103474
103546
  if (!existsSync61(sourceMetadataPath))
103475
103547
  return;
103476
103548
  let sourceMetadata;
@@ -103857,7 +103929,7 @@ async function migrateCommand(options2) {
103857
103929
  }
103858
103930
  }
103859
103931
  await processMetadataDeletions(skillSource, installGlobally);
103860
- const writtenPaths = new Set(allResults.filter((result) => result.success && !result.skipped && result.path.length > 0).map((result) => resolve34(result.path)));
103932
+ const writtenPaths = new Set(allResults.filter((result) => result.success && !result.skipped && result.path.length > 0).map((result) => resolve35(result.path)));
103861
103933
  for (const deleteAction of plannedDeleteActions) {
103862
103934
  allResults.push(await executeDeleteAction(deleteAction, {
103863
103935
  preservePaths: writtenPaths
@@ -103885,7 +103957,7 @@ async function migrateCommand(options2) {
103885
103957
  }
103886
103958
  }
103887
103959
  try {
103888
- const kitRoot = (agentSource ? resolve34(agentSource, "..") : null) ?? (commandSource ? resolve34(commandSource, "..") : null) ?? (skillSource ? resolve34(skillSource, "..") : null) ?? null;
103960
+ const kitRoot = (agentSource ? resolve35(agentSource, "..") : null) ?? (commandSource ? resolve35(commandSource, "..") : null) ?? (skillSource ? resolve35(skillSource, "..") : null) ?? null;
103889
103961
  const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
103890
103962
  if (manifest?.cliVersion) {
103891
103963
  await updateAppliedManifestVersion(manifest.cliVersion);
@@ -104034,7 +104106,7 @@ var import_picocolors29 = __toESM(require_picocolors(), 1);
104034
104106
 
104035
104107
  // src/commands/new/phases/directory-setup.ts
104036
104108
  init_config_manager();
104037
- import { resolve as resolve35 } from "node:path";
104109
+ import { resolve as resolve36 } from "node:path";
104038
104110
  init_logger();
104039
104111
  init_path_resolver();
104040
104112
  init_types3();
@@ -104119,7 +104191,7 @@ async function directorySetup(validOptions, prompts) {
104119
104191
  targetDir = await prompts.getDirectory(targetDir);
104120
104192
  }
104121
104193
  }
104122
- const resolvedDir = resolve35(targetDir);
104194
+ const resolvedDir = resolve36(targetDir);
104123
104195
  logger.info(`Target directory: ${resolvedDir}`);
104124
104196
  if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
104125
104197
  logger.warning("You're creating a project at HOME directory.");
@@ -104453,7 +104525,7 @@ Please use only one download method.`);
104453
104525
  // src/commands/plan/plan-command.ts
104454
104526
  init_output_manager();
104455
104527
  import { existsSync as existsSync64, statSync as statSync11 } from "node:fs";
104456
- import { dirname as dirname38, isAbsolute as isAbsolute11, join as join140, parse as parse7, resolve as resolve39 } from "node:path";
104528
+ import { dirname as dirname38, isAbsolute as isAbsolute11, join as join140, parse as parse7, resolve as resolve40 } from "node:path";
104457
104529
 
104458
104530
  // src/commands/plan/plan-read-handlers.ts
104459
104531
  init_config();
@@ -104463,7 +104535,7 @@ init_logger();
104463
104535
  init_output_manager();
104464
104536
  var import_picocolors30 = __toESM(require_picocolors(), 1);
104465
104537
  import { existsSync as existsSync63, statSync as statSync10 } from "node:fs";
104466
- import { basename as basename24, dirname as dirname36, join as join139, relative as relative27, resolve as resolve37 } from "node:path";
104538
+ import { basename as basename24, dirname as dirname36, join as join139, relative as relative27, resolve as resolve38 } from "node:path";
104467
104539
 
104468
104540
  // src/commands/plan/plan-dependencies.ts
104469
104541
  init_config();
@@ -104521,14 +104593,14 @@ init_config();
104521
104593
  init_plan_parser();
104522
104594
  init_plan_scope();
104523
104595
  init_plans_registry();
104524
- import { isAbsolute as isAbsolute10, resolve as resolve36 } from "node:path";
104596
+ import { isAbsolute as isAbsolute10, resolve as resolve37 } from "node:path";
104525
104597
  async function getGlobalPlansDirFromCwd() {
104526
104598
  const projectRoot = findProjectRoot(process.cwd());
104527
104599
  const { config } = await CkConfigManager.loadFull(projectRoot);
104528
104600
  return resolveGlobalPlansDir(config);
104529
104601
  }
104530
104602
  function resolveTargetFromBase(target, baseDir) {
104531
- const resolvedTarget = isAbsolute10(target) ? resolve36(target) : resolve36(baseDir, target);
104603
+ const resolvedTarget = isAbsolute10(target) ? resolve37(target) : resolve37(baseDir, target);
104532
104604
  return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
104533
104605
  }
104534
104606
 
@@ -104631,7 +104703,7 @@ async function handleStatus(target, options2) {
104631
104703
  return;
104632
104704
  }
104633
104705
  const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
104634
- const t = effectiveTarget ? resolve37(effectiveTarget) : null;
104706
+ const t = effectiveTarget ? resolve38(effectiveTarget) : null;
104635
104707
  const plansDir = t && existsSync63(t) && statSync10(t).isDirectory() && !existsSync63(join139(t, "plan.md")) ? t : null;
104636
104708
  if (plansDir) {
104637
104709
  const planFiles = scanPlanDir(plansDir);
@@ -104816,7 +104888,7 @@ init_plan_parser();
104816
104888
  init_plans_registry();
104817
104889
  init_output_manager();
104818
104890
  var import_picocolors31 = __toESM(require_picocolors(), 1);
104819
- import { basename as basename25, dirname as dirname37, relative as relative28, resolve as resolve38 } from "node:path";
104891
+ import { basename as basename25, dirname as dirname37, relative as relative28, resolve as resolve39 } from "node:path";
104820
104892
  async function handleCreate(target, options2) {
104821
104893
  if (!options2.title) {
104822
104894
  output.error("[X] --title is required for create");
@@ -104848,13 +104920,13 @@ async function handleCreate(target, options2) {
104848
104920
  return;
104849
104921
  }
104850
104922
  const globalBaseDir = options2.global ? await getGlobalPlansDirFromCwd() : undefined;
104851
- const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve38(dir);
104923
+ const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve39(dir);
104852
104924
  if (globalBaseDir && !resolvedDir) {
104853
104925
  output.error("[X] Target directory must stay within the configured global plans root");
104854
104926
  process.exitCode = 1;
104855
104927
  return;
104856
104928
  }
104857
- const safeResolvedDir = resolvedDir ?? resolve38(dir);
104929
+ const safeResolvedDir = resolvedDir ?? resolve39(dir);
104858
104930
  const result = scaffoldPlan({
104859
104931
  title: options2.title,
104860
104932
  phases: phaseNames.map((name2) => ({ name: name2 })),
@@ -105030,19 +105102,19 @@ async function handleAddPhase(target, options2) {
105030
105102
  // src/commands/plan/plan-command.ts
105031
105103
  function resolveTargetPath(target, baseDir) {
105032
105104
  if (!baseDir) {
105033
- return resolve39(target);
105105
+ return resolve40(target);
105034
105106
  }
105035
105107
  if (isAbsolute11(target)) {
105036
- return resolve39(target);
105108
+ return resolve40(target);
105037
105109
  }
105038
- const cwdCandidate = resolve39(target);
105110
+ const cwdCandidate = resolve40(target);
105039
105111
  if (existsSync64(cwdCandidate)) {
105040
105112
  return cwdCandidate;
105041
105113
  }
105042
- return resolve39(baseDir, target);
105114
+ return resolve40(baseDir, target);
105043
105115
  }
105044
105116
  function resolvePlanFile(target, baseDir) {
105045
- const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve39(baseDir) : process.cwd();
105117
+ const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve40(baseDir) : process.cwd();
105046
105118
  if (existsSync64(t)) {
105047
105119
  const stat22 = statSync11(t);
105048
105120
  if (stat22.isFile())
@@ -105106,7 +105178,7 @@ async function planCommand(action, target, options2) {
105106
105178
  let resolvedTarget = target;
105107
105179
  if (resolvedAction && !knownActions.has(resolvedAction)) {
105108
105180
  const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
105109
- const existsOnDisk = !looksLikePath && existsSync64(resolve39(resolvedAction));
105181
+ const existsOnDisk = !looksLikePath && existsSync64(resolve40(resolvedAction));
105110
105182
  if (looksLikePath || existsOnDisk) {
105111
105183
  resolvedTarget = resolvedAction;
105112
105184
  resolvedAction = undefined;
@@ -105149,11 +105221,11 @@ init_logger();
105149
105221
  init_safe_prompts();
105150
105222
  var import_picocolors32 = __toESM(require_picocolors(), 1);
105151
105223
  import { existsSync as existsSync65 } from "node:fs";
105152
- import { resolve as resolve40 } from "node:path";
105224
+ import { resolve as resolve41 } from "node:path";
105153
105225
  async function handleAdd(projectPath, options2) {
105154
105226
  logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
105155
105227
  intro("Add Project");
105156
- const absolutePath = resolve40(projectPath);
105228
+ const absolutePath = resolve41(projectPath);
105157
105229
  if (!existsSync65(absolutePath)) {
105158
105230
  log.error(`Path does not exist: ${absolutePath}`);
105159
105231
  process.exitCode = 1;
@@ -106258,7 +106330,7 @@ async function detectInstallations() {
106258
106330
 
106259
106331
  // src/commands/uninstall/removal-handler.ts
106260
106332
  import { readdirSync as readdirSync9, rmSync as rmSync6 } from "node:fs";
106261
- import { basename as basename26, join as join143, resolve as resolve41, sep as sep11 } from "node:path";
106333
+ import { basename as basename26, join as join143, resolve as resolve42, sep as sep11 } from "node:path";
106262
106334
  init_logger();
106263
106335
  init_safe_prompts();
106264
106336
  init_safe_spinner();
@@ -106439,8 +106511,8 @@ async function restoreUninstallBackup(backup) {
106439
106511
  }
106440
106512
  async function isPathSafeToRemove(filePath, baseDir) {
106441
106513
  try {
106442
- const resolvedPath = resolve41(filePath);
106443
- const resolvedBase = resolve41(baseDir);
106514
+ const resolvedPath = resolve42(filePath);
106515
+ const resolvedBase = resolve42(baseDir);
106444
106516
  if (!resolvedPath.startsWith(resolvedBase + sep11) && resolvedPath !== resolvedBase) {
106445
106517
  logger.debug(`Path outside installation directory: ${filePath}`);
106446
106518
  return false;
@@ -106448,7 +106520,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
106448
106520
  const stats = await import_fs_extra41.lstat(filePath);
106449
106521
  if (stats.isSymbolicLink()) {
106450
106522
  const realPath = await import_fs_extra41.realpath(filePath);
106451
- const resolvedReal = resolve41(realPath);
106523
+ const resolvedReal = resolve42(realPath);
106452
106524
  if (!resolvedReal.startsWith(resolvedBase + sep11) && resolvedReal !== resolvedBase) {
106453
106525
  logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
106454
106526
  return false;
@@ -106911,7 +106983,7 @@ function getDisclaimerMarker() {
106911
106983
  return AI_DISCLAIMER;
106912
106984
  }
106913
106985
  function spawnAndCollect2(command, args) {
106914
- return new Promise((resolve42, reject) => {
106986
+ return new Promise((resolve43, reject) => {
106915
106987
  const child = spawn6(command, args, { stdio: ["ignore", "pipe", "pipe"] });
106916
106988
  const chunks = [];
106917
106989
  const stderrChunks = [];
@@ -106924,7 +106996,7 @@ function spawnAndCollect2(command, args) {
106924
106996
  reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
106925
106997
  return;
106926
106998
  }
106927
- resolve42(Buffer.concat(chunks).toString("utf-8"));
106999
+ resolve43(Buffer.concat(chunks).toString("utf-8"));
106928
107000
  });
106929
107001
  });
106930
107002
  }
@@ -107032,7 +107104,7 @@ function formatResponse(content, showBranding) {
107032
107104
  return disclaimer + formatted + branding;
107033
107105
  }
107034
107106
  async function postViaGh(owner, repo, issueNumber, body) {
107035
- return new Promise((resolve42, reject) => {
107107
+ return new Promise((resolve43, reject) => {
107036
107108
  const args = [
107037
107109
  "issue",
107038
107110
  "comment",
@@ -107054,7 +107126,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
107054
107126
  reject(new Error(`gh exited with code ${code2}: ${stderr}`));
107055
107127
  return;
107056
107128
  }
107057
- resolve42();
107129
+ resolve43();
107058
107130
  });
107059
107131
  });
107060
107132
  }
@@ -107172,7 +107244,7 @@ After completing the implementation:
107172
107244
  "--allowedTools",
107173
107245
  tools
107174
107246
  ];
107175
- await new Promise((resolve42, reject) => {
107247
+ await new Promise((resolve43, reject) => {
107176
107248
  const child = spawn8("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
107177
107249
  child.stdin.write(prompt);
107178
107250
  child.stdin.end();
@@ -107197,7 +107269,7 @@ After completing the implementation:
107197
107269
  reject(new Error(`Claude exited ${code2}: ${stderr.slice(0, 500)}`));
107198
107270
  return;
107199
107271
  }
107200
- resolve42();
107272
+ resolve43();
107201
107273
  });
107202
107274
  });
107203
107275
  }
@@ -107341,7 +107413,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
107341
107413
  return processedThisHour < maxPerHour;
107342
107414
  }
107343
107415
  function spawnAndCollect3(command, args) {
107344
- return new Promise((resolve42, reject) => {
107416
+ return new Promise((resolve43, reject) => {
107345
107417
  const child = spawn9(command, args, { stdio: ["ignore", "pipe", "pipe"] });
107346
107418
  const chunks = [];
107347
107419
  const stderrChunks = [];
@@ -107354,7 +107426,7 @@ function spawnAndCollect3(command, args) {
107354
107426
  reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
107355
107427
  return;
107356
107428
  }
107357
- resolve42(Buffer.concat(chunks).toString("utf-8"));
107429
+ resolve43(Buffer.concat(chunks).toString("utf-8"));
107358
107430
  });
107359
107431
  });
107360
107432
  }
@@ -107406,7 +107478,7 @@ async function invokeClaude(options2) {
107406
107478
  return collectClaudeOutput(child, options2.timeoutSec, verbose);
107407
107479
  }
107408
107480
  function collectClaudeOutput(child, timeoutSec, verbose = false) {
107409
- return new Promise((resolve42, reject) => {
107481
+ return new Promise((resolve43, reject) => {
107410
107482
  const chunks = [];
107411
107483
  const stderrChunks = [];
107412
107484
  child.stdout?.on("data", (chunk) => {
@@ -107436,7 +107508,7 @@ function collectClaudeOutput(child, timeoutSec, verbose = false) {
107436
107508
  reject(new Error(`Claude exited with code ${code2}: ${stderr}`));
107437
107509
  return;
107438
107510
  }
107439
- resolve42(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
107511
+ resolve43(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
107440
107512
  });
107441
107513
  });
107442
107514
  }
@@ -108700,7 +108772,7 @@ function formatQueueInfo(state) {
108700
108772
  return "idle";
108701
108773
  }
108702
108774
  function sleep(ms) {
108703
- return new Promise((resolve42) => setTimeout(resolve42, ms));
108775
+ return new Promise((resolve43) => setTimeout(resolve43, ms));
108704
108776
  }
108705
108777
  // src/cli/command-registry.ts
108706
108778
  init_logger();