claudekit-cli 4.3.1-dev.2 → 4.3.1-dev.4

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
@@ -53891,22 +53891,29 @@ async function detectCodexCapabilities() {
53891
53891
  if (process.env.CK_CODEX_COMPAT === "strict") {
53892
53892
  return CODEX_CAPABILITY_TABLE[CODEX_CAPABILITY_TABLE.length - 1];
53893
53893
  }
53894
- try {
53895
- const { stdout } = await execFileAsync5("codex", ["--version"], {
53896
- timeout: 5000,
53897
- encoding: "utf8"
53898
- });
53899
- const raw = stdout.trim();
53894
+ const binaryCandidates = process.platform === "win32" ? ["codex.exe", "codex"] : ["codex"];
53895
+ let rawStdout = null;
53896
+ for (const bin of binaryCandidates) {
53897
+ try {
53898
+ const { stdout } = await execFileAsync5(bin, ["--version"], {
53899
+ timeout: 5000,
53900
+ encoding: "utf8"
53901
+ });
53902
+ rawStdout = stdout;
53903
+ break;
53904
+ } catch {}
53905
+ }
53906
+ if (rawStdout !== null) {
53907
+ const raw = rawStdout.trim();
53900
53908
  const version = raw.replace(/^(codex\s+)?v?/i, "").trim();
53901
53909
  const match = findCapabilitiesForVersion(version);
53902
53910
  if (match)
53903
53911
  return match;
53904
53912
  logger.warning(`[!] Codex version ${version} not found in ck capability table; using most-restrictive baseline. Set CK_CODEX_COMPAT=optimistic to use newest known capabilities instead.`);
53905
53913
  return process.env.CK_CODEX_COMPAT === "optimistic" ? CODEX_CAPABILITY_TABLE[0] : FALLBACK_CAPABILITIES;
53906
- } catch {
53907
- logger.warning("[!] Could not detect Codex version; using most-restrictive capability baseline. Set CK_CODEX_COMPAT=optimistic to use newest known capabilities instead.");
53908
- return process.env.CK_CODEX_COMPAT === "optimistic" ? CODEX_CAPABILITY_TABLE[0] : FALLBACK_CAPABILITIES;
53909
53914
  }
53915
+ logger.warning("[!] Could not detect Codex version; using most-restrictive capability baseline. Set CK_CODEX_COMPAT=optimistic to use newest known capabilities instead.");
53916
+ return process.env.CK_CODEX_COMPAT === "optimistic" ? CODEX_CAPABILITY_TABLE[0] : FALLBACK_CAPABILITIES;
53910
53917
  }
53911
53918
  function findCapabilitiesForVersion(version) {
53912
53919
  const exact = CODEX_CAPABILITY_TABLE.find((entry) => entry.version === version);
@@ -54269,11 +54276,12 @@ function buildWrapperScript(originalPath, capabilities, hookTimeoutMs) {
54269
54276
  const escapedOriginalPath = JSON.stringify(originalPath);
54270
54277
  const scrubRulesJson = JSON.stringify(scrubRules);
54271
54278
  const effectiveTimeout = hookTimeoutMs ?? 30000;
54272
- return `#!/usr/bin/env node
54273
- // AUTO-GENERATED by claudekit ck migrate — DO NOT EDIT
54279
+ return `// AUTO-GENERATED by claudekit ck migrate — DO NOT EDIT
54274
54280
  // Codex hook compatibility wrapper for:
54275
54281
  // ${originalPath}
54276
54282
  //
54283
+ // INVOCATION: always call as \`node "<this-file>"\` — no shebang (Windows portability).
54284
+ // The hooks.json command field must prefix this wrapper with \`node\`.
54277
54285
  // This wrapper spawns the original hook, sanitizes its JSON output
54278
54286
  // to remove fields that Codex does not support, then re-emits to stdout.
54279
54287
  // To regenerate: run \`ck migrate\` again.
@@ -54486,24 +54494,45 @@ function scrubHookEntry(entry, event, capabilities, pathRewrite) {
54486
54494
  function rewriteCommandPath(command, pathRewrite) {
54487
54495
  if (pathRewrite.commandSubstitutions && pathRewrite.commandSubstitutions.size > 0) {
54488
54496
  const home3 = homedir26();
54497
+ const homeForward = home3.replace(/\\/g, "/");
54498
+ const normalizeSlashesStr = (s) => s.replace(/\\/g, "/");
54489
54499
  for (const [originalAbsPath, wrapperAbsPath] of pathRewrite.commandSubstitutions) {
54490
- const candidates = new Set([
54491
- originalAbsPath,
54492
- originalAbsPath.replace(home3, "$HOME"),
54493
- originalAbsPath.replace(home3, "~")
54494
- ]);
54500
+ const originalAbsForward = normalizeSlashesStr(originalAbsPath);
54501
+ let relFromHome = null;
54502
+ if (originalAbsForward.startsWith(`${homeForward}/`)) {
54503
+ relFromHome = originalAbsForward.slice(homeForward.length + 1);
54504
+ } else if (originalAbsForward === homeForward) {
54505
+ relFromHome = "";
54506
+ }
54507
+ const candidates = [
54508
+ originalAbsForward,
54509
+ originalAbsPath
54510
+ ];
54511
+ if (relFromHome !== null && relFromHome !== "") {
54512
+ candidates.push(`$HOME/${relFromHome}`);
54513
+ candidates.push(`~/${relFromHome}`);
54514
+ candidates.push(`%USERPROFILE%/${relFromHome}`);
54515
+ candidates.push(`\${HOME}/${relFromHome}`);
54516
+ }
54517
+ const commandNorm = normalizeSlashesStr(command);
54495
54518
  for (const candidate of candidates) {
54496
- if (command.includes(candidate)) {
54497
- return command.replaceAll(candidate, wrapperAbsPath);
54519
+ const candidateNorm = normalizeSlashesStr(candidate);
54520
+ if (commandNorm.includes(candidateNorm)) {
54521
+ const wrapperForward = normalizeSlashesStr(wrapperAbsPath);
54522
+ return commandNorm.replaceAll(candidateNorm, wrapperForward);
54498
54523
  }
54499
54524
  }
54500
54525
  }
54501
54526
  }
54502
- const src = pathRewrite.sourceDir.endsWith("/") ? pathRewrite.sourceDir : `${pathRewrite.sourceDir}/`;
54503
- const tgt = pathRewrite.targetDir.endsWith("/") ? pathRewrite.targetDir : `${pathRewrite.targetDir}/`;
54527
+ const normalizeSlashes = (s) => s.replace(/\\/g, "/");
54528
+ const src = normalizeSlashes(pathRewrite.sourceDir.endsWith("/") || pathRewrite.sourceDir.endsWith("\\") ? pathRewrite.sourceDir : `${pathRewrite.sourceDir}/`);
54529
+ const tgt = normalizeSlashes(pathRewrite.targetDir.endsWith("/") || pathRewrite.targetDir.endsWith("\\") ? pathRewrite.targetDir : `${pathRewrite.targetDir}/`);
54504
54530
  if (src === tgt)
54505
54531
  return command;
54506
- return command.replaceAll(src, tgt);
54532
+ const normalizedCommand = normalizeSlashes(command);
54533
+ if (!normalizedCommand.includes(src))
54534
+ return command;
54535
+ return normalizedCommand.replaceAll(src, tgt);
54507
54536
  }
54508
54537
  var init_claude_to_codex_hooks = () => {};
54509
54538
 
@@ -54932,17 +54961,6 @@ async function migrateHooksSettingsForCodex(options2) {
54932
54961
  installedHookAbsolutePaths,
54933
54962
  global: isGlobal
54934
54963
  } = options2;
54935
- if (process.platform === "win32") {
54936
- return {
54937
- status: "skipped-windows",
54938
- success: true,
54939
- backupPath: null,
54940
- hooksRegistered: 0,
54941
- message: "[!] Codex hook installation skipped: Codex CLI hooks are temporarily disabled on Windows.",
54942
- sourceSettingsPath: null,
54943
- targetSettingsPath: null
54944
- };
54945
- }
54946
54964
  if (installedHookFiles.length === 0) {
54947
54965
  return {
54948
54966
  status: "no-installed-files",
@@ -63340,7 +63358,7 @@ var package_default;
63340
63358
  var init_package = __esm(() => {
63341
63359
  package_default = {
63342
63360
  name: "claudekit-cli",
63343
- version: "4.3.1-dev.2",
63361
+ version: "4.3.1-dev.4",
63344
63362
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
63345
63363
  type: "module",
63346
63364
  repository: {
@@ -75879,7 +75897,7 @@ __export(exports_worktree_manager, {
75879
75897
  createWorktree: () => createWorktree,
75880
75898
  cleanupAllWorktrees: () => cleanupAllWorktrees
75881
75899
  });
75882
- import { existsSync as existsSync71 } from "node:fs";
75900
+ import { existsSync as existsSync72 } from "node:fs";
75883
75901
  import { readFile as readFile67, writeFile as writeFile38 } from "node:fs/promises";
75884
75902
  import { join as join153 } from "node:path";
75885
75903
  async function createWorktree(projectDir, issueNumber, baseBranch) {
@@ -75945,7 +75963,7 @@ async function cleanupAllWorktrees(projectDir) {
75945
75963
  async function ensureGitignore(projectDir) {
75946
75964
  const gitignorePath = join153(projectDir, ".gitignore");
75947
75965
  try {
75948
- const content = existsSync71(gitignorePath) ? await readFile67(gitignorePath, "utf-8") : "";
75966
+ const content = existsSync72(gitignorePath) ? await readFile67(gitignorePath, "utf-8") : "";
75949
75967
  if (!content.includes(".worktrees")) {
75950
75968
  const newContent = content.endsWith(`
75951
75969
  `) ? `${content}.worktrees/
@@ -76047,13 +76065,13 @@ var init_content_validator = __esm(() => {
76047
76065
 
76048
76066
  // src/commands/content/phases/context-cache-manager.ts
76049
76067
  import { createHash as createHash9 } from "node:crypto";
76050
- import { existsSync as existsSync77, mkdirSync as mkdirSync5, readFileSync as readFileSync18, readdirSync as readdirSync11, statSync as statSync14 } from "node:fs";
76068
+ import { existsSync as existsSync78, mkdirSync as mkdirSync5, readFileSync as readFileSync18, readdirSync as readdirSync12, statSync as statSync14 } from "node:fs";
76051
76069
  import { rename as rename16, writeFile as writeFile40 } from "node:fs/promises";
76052
- import { homedir as homedir54 } from "node:os";
76053
- import { basename as basename33, join as join160 } from "node:path";
76070
+ import { homedir as homedir55 } from "node:os";
76071
+ import { basename as basename34, join as join160 } from "node:path";
76054
76072
  function getCachedContext(repoPath) {
76055
76073
  const cachePath = getCacheFilePath(repoPath);
76056
- if (!existsSync77(cachePath))
76074
+ if (!existsSync78(cachePath))
76057
76075
  return null;
76058
76076
  try {
76059
76077
  const raw2 = readFileSync18(cachePath, "utf-8");
@@ -76070,7 +76088,7 @@ function getCachedContext(repoPath) {
76070
76088
  }
76071
76089
  }
76072
76090
  async function saveCachedContext(repoPath, cache5) {
76073
- if (!existsSync77(CACHE_DIR)) {
76091
+ if (!existsSync78(CACHE_DIR)) {
76074
76092
  mkdirSync5(CACHE_DIR, { recursive: true });
76075
76093
  }
76076
76094
  const cachePath = getCacheFilePath(repoPath);
@@ -76094,9 +76112,9 @@ function computeSourceHash(repoPath) {
76094
76112
  function getDocSourcePaths(repoPath) {
76095
76113
  const paths = [];
76096
76114
  const docsDir = join160(repoPath, "docs");
76097
- if (existsSync77(docsDir)) {
76115
+ if (existsSync78(docsDir)) {
76098
76116
  try {
76099
- const files = readdirSync11(docsDir);
76117
+ const files = readdirSync12(docsDir);
76100
76118
  for (const f3 of files) {
76101
76119
  if (f3.endsWith(".md"))
76102
76120
  paths.push(join160(docsDir, f3));
@@ -76104,12 +76122,12 @@ function getDocSourcePaths(repoPath) {
76104
76122
  } catch {}
76105
76123
  }
76106
76124
  const readme = join160(repoPath, "README.md");
76107
- if (existsSync77(readme))
76125
+ if (existsSync78(readme))
76108
76126
  paths.push(readme);
76109
76127
  const stylesDir = join160(repoPath, "assets", "writing-styles");
76110
- if (existsSync77(stylesDir)) {
76128
+ if (existsSync78(stylesDir)) {
76111
76129
  try {
76112
- const files = readdirSync11(stylesDir);
76130
+ const files = readdirSync12(stylesDir);
76113
76131
  for (const f3 of files) {
76114
76132
  paths.push(join160(stylesDir, f3));
76115
76133
  }
@@ -76118,13 +76136,13 @@ function getDocSourcePaths(repoPath) {
76118
76136
  return paths.sort();
76119
76137
  }
76120
76138
  function getCacheFilePath(repoPath) {
76121
- const repoName = basename33(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
76139
+ const repoName = basename34(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
76122
76140
  const pathHash = createHash9("sha256").update(repoPath).digest("hex").slice(0, 8);
76123
76141
  return join160(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
76124
76142
  }
76125
76143
  var CACHE_DIR, CACHE_TTL_MS5;
76126
76144
  var init_context_cache_manager = __esm(() => {
76127
- CACHE_DIR = join160(homedir54(), ".claudekit", "cache");
76145
+ CACHE_DIR = join160(homedir55(), ".claudekit", "cache");
76128
76146
  CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
76129
76147
  });
76130
76148
 
@@ -76304,7 +76322,7 @@ function extractContentFromResponse(response) {
76304
76322
 
76305
76323
  // src/commands/content/phases/docs-summarizer.ts
76306
76324
  import { execSync as execSync7 } from "node:child_process";
76307
- import { existsSync as existsSync78, readFileSync as readFileSync19, readdirSync as readdirSync12 } from "node:fs";
76325
+ import { existsSync as existsSync79, readFileSync as readFileSync19, readdirSync as readdirSync13 } from "node:fs";
76308
76326
  import { join as join161 } from "node:path";
76309
76327
  async function summarizeProjectDocs(repoPath, contentLogger) {
76310
76328
  const rawContent = collectRawDocs(repoPath);
@@ -76349,7 +76367,7 @@ async function summarizeProjectDocs(repoPath, contentLogger) {
76349
76367
  function collectRawDocs(repoPath) {
76350
76368
  let totalChars = 0;
76351
76369
  const readCapped = (filePath, maxChars) => {
76352
- if (!existsSync78(filePath))
76370
+ if (!existsSync79(filePath))
76353
76371
  return "";
76354
76372
  if (totalChars >= MAX_RAW_CONTENT_CHARS)
76355
76373
  return "";
@@ -76360,9 +76378,9 @@ function collectRawDocs(repoPath) {
76360
76378
  };
76361
76379
  const docsContent = [];
76362
76380
  const docsDir = join161(repoPath, "docs");
76363
- if (existsSync78(docsDir)) {
76381
+ if (existsSync79(docsDir)) {
76364
76382
  try {
76365
- const files = readdirSync12(docsDir).filter((f3) => f3.endsWith(".md")).sort();
76383
+ const files = readdirSync13(docsDir).filter((f3) => f3.endsWith(".md")).sort();
76366
76384
  for (const f3 of files) {
76367
76385
  const content = readCapped(join161(docsDir, f3), 5000);
76368
76386
  if (content) {
@@ -76384,9 +76402,9 @@ ${content}`);
76384
76402
  }
76385
76403
  let styles3 = "";
76386
76404
  const stylesDir = join161(repoPath, "assets", "writing-styles");
76387
- if (existsSync78(stylesDir)) {
76405
+ if (existsSync79(stylesDir)) {
76388
76406
  try {
76389
- const files = readdirSync12(stylesDir).slice(0, 3);
76407
+ const files = readdirSync13(stylesDir).slice(0, 3);
76390
76408
  styles3 = files.map((f3) => readCapped(join161(stylesDir, f3), 1000)).filter(Boolean).join(`
76391
76409
 
76392
76410
  `);
@@ -76577,12 +76595,12 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
76577
76595
 
76578
76596
  // src/commands/content/phases/photo-generator.ts
76579
76597
  import { execSync as execSync8 } from "node:child_process";
76580
- import { existsSync as existsSync79, mkdirSync as mkdirSync6, readdirSync as readdirSync13 } from "node:fs";
76581
- import { homedir as homedir55 } from "node:os";
76598
+ import { existsSync as existsSync80, mkdirSync as mkdirSync6, readdirSync as readdirSync14 } from "node:fs";
76599
+ import { homedir as homedir56 } from "node:os";
76582
76600
  import { join as join162 } from "node:path";
76583
76601
  async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
76584
- const mediaDir = join162(config.contentDir.replace(/^~/, homedir55()), "media", String(contentId));
76585
- if (!existsSync79(mediaDir)) {
76602
+ const mediaDir = join162(config.contentDir.replace(/^~/, homedir56()), "media", String(contentId));
76603
+ if (!existsSync80(mediaDir)) {
76586
76604
  mkdirSync6(mediaDir, { recursive: true });
76587
76605
  }
76588
76606
  const prompt = buildPhotoPrompt(context, platform18);
@@ -76598,11 +76616,11 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
76598
76616
  const parsed = parseClaudeJsonOutput(result);
76599
76617
  if (parsed && typeof parsed === "object" && "imagePath" in parsed) {
76600
76618
  const imagePath = String(parsed.imagePath);
76601
- if (existsSync79(imagePath)) {
76619
+ if (existsSync80(imagePath)) {
76602
76620
  return { path: imagePath, ...dimensions, format: "png" };
76603
76621
  }
76604
76622
  }
76605
- const files = readdirSync13(mediaDir);
76623
+ const files = readdirSync14(mediaDir);
76606
76624
  const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
76607
76625
  if (imageFile) {
76608
76626
  const ext2 = imageFile.split(".").pop() ?? "png";
@@ -76694,8 +76712,8 @@ var init_content_creator = __esm(() => {
76694
76712
  });
76695
76713
 
76696
76714
  // src/commands/content/phases/content-logger.ts
76697
- import { createWriteStream as createWriteStream4, existsSync as existsSync80, mkdirSync as mkdirSync7, statSync as statSync15 } from "node:fs";
76698
- import { homedir as homedir56 } from "node:os";
76715
+ import { createWriteStream as createWriteStream4, existsSync as existsSync81, mkdirSync as mkdirSync7, statSync as statSync15 } from "node:fs";
76716
+ import { homedir as homedir57 } from "node:os";
76699
76717
  import { join as join163 } from "node:path";
76700
76718
 
76701
76719
  class ContentLogger {
@@ -76704,11 +76722,11 @@ class ContentLogger {
76704
76722
  logDir;
76705
76723
  maxBytes;
76706
76724
  constructor(maxBytes = 0) {
76707
- this.logDir = join163(homedir56(), ".claudekit", "logs");
76725
+ this.logDir = join163(homedir57(), ".claudekit", "logs");
76708
76726
  this.maxBytes = maxBytes;
76709
76727
  }
76710
76728
  init() {
76711
- if (!existsSync80(this.logDir)) {
76729
+ if (!existsSync81(this.logDir)) {
76712
76730
  mkdirSync7(this.logDir, { recursive: true });
76713
76731
  }
76714
76732
  this.rotateIfNeeded();
@@ -76801,8 +76819,8 @@ function openDatabase(dbPath) {
76801
76819
  var init_sqlite_client = () => {};
76802
76820
 
76803
76821
  // src/commands/content/phases/db-manager.ts
76804
- import { existsSync as existsSync81, mkdirSync as mkdirSync8 } from "node:fs";
76805
- import { dirname as dirname49 } from "node:path";
76822
+ import { existsSync as existsSync82, mkdirSync as mkdirSync8 } from "node:fs";
76823
+ import { dirname as dirname50 } from "node:path";
76806
76824
  function initDatabase(dbPath) {
76807
76825
  ensureParentDir(dbPath);
76808
76826
  const db = openDatabase(dbPath);
@@ -76823,8 +76841,8 @@ function runRetentionCleanup(db, retentionDays = 90) {
76823
76841
  db.prepare("DELETE FROM git_events WHERE processed = 1 AND created_at < ?").run(cutoff);
76824
76842
  }
76825
76843
  function ensureParentDir(dbPath) {
76826
- const dir = dirname49(dbPath);
76827
- if (dir && !existsSync81(dir)) {
76844
+ const dir = dirname50(dbPath);
76845
+ if (dir && !existsSync82(dir)) {
76828
76846
  mkdirSync8(dir, { recursive: true });
76829
76847
  }
76830
76848
  }
@@ -76989,7 +77007,7 @@ function isNoiseCommit(title, author) {
76989
77007
 
76990
77008
  // src/commands/content/phases/change-detector.ts
76991
77009
  import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
76992
- import { existsSync as existsSync82, readFileSync as readFileSync20, readdirSync as readdirSync14, statSync as statSync16 } from "node:fs";
77010
+ import { existsSync as existsSync83, readFileSync as readFileSync20, readdirSync as readdirSync15, statSync as statSync16 } from "node:fs";
76993
77011
  import { join as join164 } from "node:path";
76994
77012
  function detectCommits(repo, since) {
76995
77013
  try {
@@ -77100,17 +77118,17 @@ function detectTags(repo, since) {
77100
77118
  }
77101
77119
  function detectCompletedPlans(repo, since) {
77102
77120
  const plansDir = join164(repo.path, "plans");
77103
- if (!existsSync82(plansDir))
77121
+ if (!existsSync83(plansDir))
77104
77122
  return [];
77105
77123
  const sinceMs = new Date(since).getTime();
77106
77124
  const events = [];
77107
77125
  try {
77108
- const entries = readdirSync14(plansDir, { withFileTypes: true });
77126
+ const entries = readdirSync15(plansDir, { withFileTypes: true });
77109
77127
  for (const entry of entries) {
77110
77128
  if (!entry.isDirectory())
77111
77129
  continue;
77112
77130
  const planFile = join164(plansDir, entry.name, "plan.md");
77113
- if (!existsSync82(planFile))
77131
+ if (!existsSync83(planFile))
77114
77132
  continue;
77115
77133
  try {
77116
77134
  const stat26 = statSync16(planFile);
@@ -77186,7 +77204,7 @@ function classifyCommit(event) {
77186
77204
 
77187
77205
  // src/commands/content/phases/repo-discoverer.ts
77188
77206
  import { execSync as execSync11 } from "node:child_process";
77189
- import { readdirSync as readdirSync15 } from "node:fs";
77207
+ import { readdirSync as readdirSync16 } from "node:fs";
77190
77208
  import { join as join165 } from "node:path";
77191
77209
  function discoverRepos2(cwd2) {
77192
77210
  const repos = [];
@@ -77196,7 +77214,7 @@ function discoverRepos2(cwd2) {
77196
77214
  repos.push(info);
77197
77215
  }
77198
77216
  try {
77199
- const entries = readdirSync15(cwd2, { withFileTypes: true });
77217
+ const entries = readdirSync16(cwd2, { withFileTypes: true });
77200
77218
  for (const entry of entries) {
77201
77219
  if (!entry.isDirectory() || entry.name.startsWith("."))
77202
77220
  continue;
@@ -78178,7 +78196,7 @@ var init_platform_setup_x = __esm(() => {
78178
78196
  });
78179
78197
 
78180
78198
  // src/commands/content/phases/setup-wizard.ts
78181
- import { existsSync as existsSync83 } from "node:fs";
78199
+ import { existsSync as existsSync84 } from "node:fs";
78182
78200
  import { join as join167 } from "node:path";
78183
78201
  async function runSetupWizard2(cwd2, contentLogger) {
78184
78202
  console.log();
@@ -78247,8 +78265,8 @@ async function showRepoSummary(cwd2) {
78247
78265
  function detectBrandAssets(cwd2, contentLogger) {
78248
78266
  const repos = discoverRepos2(cwd2);
78249
78267
  for (const repo of repos) {
78250
- const hasGuidelines = existsSync83(join167(repo.path, "docs", "brand-guidelines.md"));
78251
- const hasStyles = existsSync83(join167(repo.path, "assets", "writing-styles"));
78268
+ const hasGuidelines = existsSync84(join167(repo.path, "docs", "brand-guidelines.md"));
78269
+ const hasStyles = existsSync84(join167(repo.path, "assets", "writing-styles"));
78252
78270
  if (!hasGuidelines) {
78253
78271
  f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
78254
78272
  contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
@@ -78314,13 +78332,13 @@ var init_setup_wizard = __esm(() => {
78314
78332
  });
78315
78333
 
78316
78334
  // src/commands/content/content-review-commands.ts
78317
- import { existsSync as existsSync84 } from "node:fs";
78318
- import { homedir as homedir57 } from "node:os";
78335
+ import { existsSync as existsSync85 } from "node:fs";
78336
+ import { homedir as homedir58 } from "node:os";
78319
78337
  async function queueContent() {
78320
78338
  const cwd2 = process.cwd();
78321
78339
  const config = await loadContentConfig(cwd2);
78322
- const dbPath = config.dbPath.replace(/^~/, homedir57());
78323
- if (!existsSync84(dbPath)) {
78340
+ const dbPath = config.dbPath.replace(/^~/, homedir58());
78341
+ if (!existsSync85(dbPath)) {
78324
78342
  logger.info("No content database found. Run 'ck content setup' first.");
78325
78343
  return;
78326
78344
  }
@@ -78346,7 +78364,7 @@ async function queueContent() {
78346
78364
  async function approveContentCmd(id) {
78347
78365
  const cwd2 = process.cwd();
78348
78366
  const config = await loadContentConfig(cwd2);
78349
- const dbPath = config.dbPath.replace(/^~/, homedir57());
78367
+ const dbPath = config.dbPath.replace(/^~/, homedir58());
78350
78368
  const db = initDatabase(dbPath);
78351
78369
  try {
78352
78370
  approveContent(db, Number.parseInt(id, 10));
@@ -78358,7 +78376,7 @@ async function approveContentCmd(id) {
78358
78376
  async function rejectContentCmd(id, reason) {
78359
78377
  const cwd2 = process.cwd();
78360
78378
  const config = await loadContentConfig(cwd2);
78361
- const dbPath = config.dbPath.replace(/^~/, homedir57());
78379
+ const dbPath = config.dbPath.replace(/^~/, homedir58());
78362
78380
  const db = initDatabase(dbPath);
78363
78381
  try {
78364
78382
  rejectContent(db, Number.parseInt(id, 10), reason);
@@ -78388,12 +78406,12 @@ __export(exports_content_subcommands, {
78388
78406
  logsContent: () => logsContent,
78389
78407
  approveContentCmd: () => approveContentCmd
78390
78408
  });
78391
- import { existsSync as existsSync85, readFileSync as readFileSync21, unlinkSync as unlinkSync6 } from "node:fs";
78392
- import { homedir as homedir58 } from "node:os";
78409
+ import { existsSync as existsSync86, readFileSync as readFileSync21, unlinkSync as unlinkSync6 } from "node:fs";
78410
+ import { homedir as homedir59 } from "node:os";
78393
78411
  import { join as join168 } from "node:path";
78394
78412
  function isDaemonRunning() {
78395
78413
  const lockFile = join168(LOCK_DIR, `${LOCK_NAME2}.lock`);
78396
- if (!existsSync85(lockFile))
78414
+ if (!existsSync86(lockFile))
78397
78415
  return { running: false, pid: null };
78398
78416
  try {
78399
78417
  const pidStr = readFileSync21(lockFile, "utf-8").trim();
@@ -78425,7 +78443,7 @@ async function startContent(options2) {
78425
78443
  }
78426
78444
  async function stopContent() {
78427
78445
  const lockFile = join168(LOCK_DIR, `${LOCK_NAME2}.lock`);
78428
- if (!existsSync85(lockFile)) {
78446
+ if (!existsSync86(lockFile)) {
78429
78447
  logger.info("Content daemon is not running.");
78430
78448
  return;
78431
78449
  }
@@ -78463,10 +78481,10 @@ async function statusContent() {
78463
78481
  } catch {}
78464
78482
  }
78465
78483
  async function logsContent(options2) {
78466
- const logDir = join168(homedir58(), ".claudekit", "logs");
78484
+ const logDir = join168(homedir59(), ".claudekit", "logs");
78467
78485
  const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
78468
78486
  const logPath = join168(logDir, `content-${dateStr}.log`);
78469
- if (!existsSync85(logPath)) {
78487
+ if (!existsSync86(logPath)) {
78470
78488
  logger.info("No content logs found for today.");
78471
78489
  return;
78472
78490
  }
@@ -78497,12 +78515,12 @@ var init_content_subcommands = __esm(() => {
78497
78515
  init_setup_wizard();
78498
78516
  init_state_manager();
78499
78517
  init_content_review_commands();
78500
- LOCK_DIR = join168(homedir58(), ".claudekit", "locks");
78518
+ LOCK_DIR = join168(homedir59(), ".claudekit", "locks");
78501
78519
  });
78502
78520
 
78503
78521
  // src/commands/content/content-command.ts
78504
- import { existsSync as existsSync86, mkdirSync as mkdirSync9, unlinkSync as unlinkSync7, writeFileSync as writeFileSync7 } from "node:fs";
78505
- import { homedir as homedir59 } from "node:os";
78522
+ import { existsSync as existsSync87, mkdirSync as mkdirSync9, unlinkSync as unlinkSync7, writeFileSync as writeFileSync7 } from "node:fs";
78523
+ import { homedir as homedir60 } from "node:os";
78506
78524
  import { join as join169 } from "node:path";
78507
78525
  async function contentCommand(options2) {
78508
78526
  const cwd2 = process.cwd();
@@ -78532,10 +78550,10 @@ async function contentCommand(options2) {
78532
78550
  }
78533
78551
  contentLogger.info("Setup complete. Starting daemon...");
78534
78552
  }
78535
- if (!existsSync86(LOCK_DIR2))
78553
+ if (!existsSync87(LOCK_DIR2))
78536
78554
  mkdirSync9(LOCK_DIR2, { recursive: true });
78537
78555
  writeFileSync7(LOCK_FILE, String(process.pid), "utf-8");
78538
- const dbPath = config.dbPath.replace(/^~/, homedir59());
78556
+ const dbPath = config.dbPath.replace(/^~/, homedir60());
78539
78557
  const db = initDatabase(dbPath);
78540
78558
  contentLogger.info(`Database initialised at ${dbPath}`);
78541
78559
  const adapters = initializeAdapters(config);
@@ -78681,7 +78699,7 @@ var init_content_command = __esm(() => {
78681
78699
  init_publisher();
78682
78700
  init_review_manager();
78683
78701
  init_state_manager();
78684
- LOCK_DIR2 = join169(homedir59(), ".claudekit", "locks");
78702
+ LOCK_DIR2 = join169(homedir60(), ".claudekit", "locks");
78685
78703
  LOCK_FILE = join169(LOCK_DIR2, "ck-content.lock");
78686
78704
  });
78687
78705
 
@@ -100752,7 +100770,7 @@ init_logger();
100752
100770
  init_types3();
100753
100771
  var import_fs_extra15 = __toESM(require_lib(), 1);
100754
100772
  var import_ignore3 = __toESM(require_ignore(), 1);
100755
- import { dirname as dirname37, join as join110, relative as relative23 } from "node:path";
100773
+ import { dirname as dirname38, join as join110, relative as relative23 } from "node:path";
100756
100774
 
100757
100775
  // src/domains/installation/selective-merger.ts
100758
100776
  import { stat as stat18 } from "node:fs/promises";
@@ -102422,8 +102440,8 @@ class FileScanner {
102422
102440
 
102423
102441
  // src/domains/installation/merger/settings-processor.ts
102424
102442
  import { execSync as execSync5 } from "node:child_process";
102425
- import { homedir as homedir45 } from "node:os";
102426
- import { dirname as dirname36, join as join109 } from "node:path";
102443
+ import { homedir as homedir46 } from "node:os";
102444
+ import { dirname as dirname37, join as join109 } from "node:path";
102427
102445
 
102428
102446
  // src/domains/config/installed-settings-tracker.ts
102429
102447
  init_shared();
@@ -102520,6 +102538,136 @@ class InstalledSettingsTracker {
102520
102538
 
102521
102539
  // src/domains/installation/merger/settings-processor.ts
102522
102540
  init_settings_merger();
102541
+
102542
+ // src/domains/installation/merger/zombie-wirings-pruner.ts
102543
+ import { existsSync as existsSync65, readdirSync as readdirSync8 } from "node:fs";
102544
+ import { homedir as homedir45 } from "node:os";
102545
+ import { basename as basename26, dirname as dirname36, isAbsolute as isAbsolute12, resolve as resolve41, sep as sep13 } from "node:path";
102546
+ function pruneZombieEngineerWirings(settings, hookDir) {
102547
+ const pruned = [];
102548
+ if (!existsSync65(hookDir)) {
102549
+ return { settings, pruned };
102550
+ }
102551
+ const hookFiles = readdirSync8(hookDir);
102552
+ const hasHookFiles = hookFiles.some((f3) => f3.endsWith(".cjs") || f3.endsWith(".sh"));
102553
+ if (!hasHookFiles) {
102554
+ return { settings, pruned };
102555
+ }
102556
+ if (!settings.hooks) {
102557
+ return { settings, pruned };
102558
+ }
102559
+ const eventKeysToDelete = [];
102560
+ const events = settings.hooks;
102561
+ for (const eventName of Object.keys(events)) {
102562
+ const groups = events[eventName];
102563
+ const keptGroups = [];
102564
+ for (const group of groups) {
102565
+ if (!("hooks" in group) || !Array.isArray(group.hooks)) {
102566
+ const entry = group;
102567
+ if (shouldPruneEntry(entry, hookDir, pruned)) {
102568
+ continue;
102569
+ }
102570
+ keptGroups.push(group);
102571
+ continue;
102572
+ }
102573
+ const keptHooks = group.hooks.filter((h2) => {
102574
+ return !shouldPruneEntry(h2, hookDir, pruned);
102575
+ });
102576
+ if (keptHooks.length > 0) {
102577
+ keptGroups.push({ ...group, hooks: keptHooks });
102578
+ }
102579
+ }
102580
+ if (keptGroups.length > 0) {
102581
+ events[eventName] = keptGroups;
102582
+ } else {
102583
+ eventKeysToDelete.push(eventName);
102584
+ }
102585
+ }
102586
+ for (const key of eventKeysToDelete) {
102587
+ delete events[key];
102588
+ }
102589
+ return { settings, pruned };
102590
+ }
102591
+ function shouldPruneEntry(entry, hookDir, pruned) {
102592
+ if (entry._origin !== "engineer")
102593
+ return false;
102594
+ const filePath = extractHookFilePath(entry.command, hookDir);
102595
+ if (!filePath)
102596
+ return false;
102597
+ if (existsSync65(filePath))
102598
+ return false;
102599
+ pruned.push(basename26(filePath));
102600
+ return true;
102601
+ }
102602
+ function extractHookFilePath(command, hookDir) {
102603
+ if (!command)
102604
+ return null;
102605
+ if (/&&|\|\||;|(?<!["|'])\|(?!["|'])/.test(command))
102606
+ return null;
102607
+ const home5 = homedir45().replace(/\\/g, "/");
102608
+ const hookDirNorm = hookDir.replace(/\\/g, "/");
102609
+ function resolveEnvPath(prefix, rest) {
102610
+ const normRest = rest.replace(/\\/g, "/");
102611
+ let resolved;
102612
+ if (prefix === "$HOME" || prefix === "${HOME}" || prefix === "%USERPROFILE%") {
102613
+ resolved = `${home5}/${normRest}`;
102614
+ } else if (prefix === "$CLAUDE_PROJECT_DIR" || prefix === "%CLAUDE_PROJECT_DIR%") {
102615
+ const projectRoot = dirname36(dirname36(hookDirNorm));
102616
+ resolved = `${projectRoot}/${normRest}`;
102617
+ } else {
102618
+ resolved = `${prefix}/${normRest}`;
102619
+ }
102620
+ return resolved;
102621
+ }
102622
+ if (/^bash\s/.test(command)) {
102623
+ const bashMatch = command.match(/^bash\s+["']([^"']+\.sh)["']/);
102624
+ if (bashMatch) {
102625
+ const rawPath = bashMatch[1].replace(/\\/g, "/");
102626
+ const resolved = isAbsolute12(rawPath) || /^[A-Za-z]:[\\/]/.test(rawPath) ? rawPath : resolve41(hookDir, rawPath);
102627
+ return process.platform === "win32" ? resolved.replace(/\//g, sep13) : resolved;
102628
+ }
102629
+ return null;
102630
+ }
102631
+ if (!/(?:^|\s)node\s/.test(command))
102632
+ return null;
102633
+ const varOnlyQuoted = command.match(/(?:^|\s)node\s+["'](\$\w+|\$\{\w+\}|%\w+%)["'][/\\](\.claude[/\\]\S+)/);
102634
+ if (varOnlyQuoted) {
102635
+ const [, envVar, rest] = varOnlyQuoted;
102636
+ const resolved = resolveEnvPath(envVar, rest);
102637
+ return process.platform === "win32" ? resolved.replace(/\//g, sep13) : resolved;
102638
+ }
102639
+ const quotedMatch = command.match(/(?:^|\s)node\s+["']([^"']+)["']/);
102640
+ if (quotedMatch) {
102641
+ const rawArg = quotedMatch[1].trim().replace(/\\/g, "/");
102642
+ const envPrefixMatch = rawArg.match(/^(\$HOME|\$\{HOME\}|%USERPROFILE%|\$CLAUDE_PROJECT_DIR|%CLAUDE_PROJECT_DIR%)[/\\](.*)/);
102643
+ if (envPrefixMatch) {
102644
+ const resolved = resolveEnvPath(envPrefixMatch[1], envPrefixMatch[2]);
102645
+ return process.platform === "win32" ? resolved.replace(/\//g, sep13) : resolved;
102646
+ }
102647
+ const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
102648
+ if (isAbsolute12(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
102649
+ return process.platform === "win32" ? tildeResolved.replace(/\//g, sep13) : tildeResolved;
102650
+ }
102651
+ return resolve41(hookDir, tildeResolved);
102652
+ }
102653
+ const unquotedMatch = command.match(/(?:^|\s)node\s+(\S+\.(?:cjs|sh|mjs|js))/);
102654
+ if (unquotedMatch) {
102655
+ const rawArg = unquotedMatch[1].replace(/\\/g, "/");
102656
+ const envPrefixMatch = rawArg.match(/^(\$HOME|\$\{HOME\}|%USERPROFILE%|\$CLAUDE_PROJECT_DIR|%CLAUDE_PROJECT_DIR%)[/\\](.*)/);
102657
+ if (envPrefixMatch) {
102658
+ const resolved = resolveEnvPath(envPrefixMatch[1], envPrefixMatch[2]);
102659
+ return process.platform === "win32" ? resolved.replace(/\//g, sep13) : resolved;
102660
+ }
102661
+ const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
102662
+ if (isAbsolute12(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
102663
+ return process.platform === "win32" ? tildeResolved.replace(/\//g, sep13) : tildeResolved;
102664
+ }
102665
+ return resolve41(hookDir, tildeResolved);
102666
+ }
102667
+ return null;
102668
+ }
102669
+
102670
+ // src/domains/installation/merger/settings-processor.ts
102523
102671
  init_command_normalizer();
102524
102672
  init_logger();
102525
102673
  init_path_resolver();
@@ -102536,6 +102684,7 @@ class SettingsProcessor {
102536
102684
  installingKit;
102537
102685
  cachedVersion = undefined;
102538
102686
  deletionPatterns = [];
102687
+ zombiePrunerHookDir = null;
102539
102688
  setGlobalFlag(isGlobal) {
102540
102689
  this.isGlobal = isGlobal;
102541
102690
  }
@@ -102556,6 +102705,9 @@ class SettingsProcessor {
102556
102705
  setDeletions(deletions) {
102557
102706
  this.deletionPatterns = deletions;
102558
102707
  }
102708
+ setZombiePrunerHookDir(hookDir) {
102709
+ this.zombiePrunerHookDir = hookDir;
102710
+ }
102559
102711
  initTracker() {
102560
102712
  if (this.projectDir) {
102561
102713
  this.tracker = new InstalledSettingsTracker(this.projectDir, this.isGlobal, this.kitName);
@@ -102666,6 +102818,12 @@ class SettingsProcessor {
102666
102818
  if (hooksPruned > 0) {
102667
102819
  logger.info(`Pruned ${hooksPruned} stale hook(s) referencing deleted files`);
102668
102820
  }
102821
+ if (this.zombiePrunerHookDir) {
102822
+ const { pruned: zombiePruned } = pruneZombieEngineerWirings(mergeResult.merged, this.zombiePrunerHookDir);
102823
+ if (zombiePruned.length > 0) {
102824
+ logger.info(`Pruned ${zombiePruned.length} zombie hook entries: ${zombiePruned.join(", ")}`);
102825
+ }
102826
+ }
102669
102827
  await SettingsMerger.writeSettingsFile(destFile, mergeResult.merged);
102670
102828
  logger.success("Merged settings.json (user customizations preserved)");
102671
102829
  await this.injectTeamHooksIfSupported(destFile, mergeResult.merged);
@@ -102911,7 +103069,7 @@ class SettingsProcessor {
102911
103069
  return false;
102912
103070
  }
102913
103071
  const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
102914
- const defaultGlobalDir = join109(homedir45(), ".claude").replace(/\\/g, "/");
103072
+ const defaultGlobalDir = join109(homedir46(), ".claude").replace(/\\/g, "/");
102915
103073
  return configuredGlobalDir !== defaultGlobalDir;
102916
103074
  }
102917
103075
  getClaudeCommandRoot() {
@@ -102931,7 +103089,7 @@ class SettingsProcessor {
102931
103089
  return true;
102932
103090
  }
102933
103091
  async repairSiblingSettingsLocal(destFile) {
102934
- const settingsLocalPath = join109(dirname36(destFile), "settings.local.json");
103092
+ const settingsLocalPath = join109(dirname37(destFile), "settings.local.json");
102935
103093
  if (settingsLocalPath === destFile || !await import_fs_extra14.pathExists(settingsLocalPath)) {
102936
103094
  return;
102937
103095
  }
@@ -103071,6 +103229,9 @@ class CopyExecutor {
103071
103229
  setKitName(kit) {
103072
103230
  this.settingsProcessor.setKitName(kit);
103073
103231
  }
103232
+ setZombiePrunerHookDir(hookDir) {
103233
+ this.settingsProcessor.setZombiePrunerHookDir(hookDir);
103234
+ }
103074
103235
  setManifest(manifest) {
103075
103236
  this.selectiveMerger = manifest ? new SelectiveMerger(manifest) : null;
103076
103237
  if (manifest && this.selectiveMerger?.hasManifest()) {
@@ -103191,10 +103352,10 @@ class CopyExecutor {
103191
103352
  }
103192
103353
  trackInstalledFile(relativePath) {
103193
103354
  this.installedFiles.add(relativePath);
103194
- let dir = dirname37(relativePath);
103355
+ let dir = dirname38(relativePath);
103195
103356
  while (dir && dir !== "." && dir !== "/") {
103196
103357
  this.installedDirectories.add(`${dir}/`);
103197
- dir = dirname37(dir);
103358
+ dir = dirname38(dir);
103198
103359
  }
103199
103360
  }
103200
103361
  }
@@ -103240,6 +103401,9 @@ class FileMerger {
103240
103401
  setDeletions(deletions) {
103241
103402
  this.copyExecutor.setDeletions(deletions);
103242
103403
  }
103404
+ setZombiePrunerHookDir(hookDir) {
103405
+ this.copyExecutor.setZombiePrunerHookDir(hookDir);
103406
+ }
103243
103407
  setManifest(manifest) {
103244
103408
  this.copyExecutor.setManifest(manifest);
103245
103409
  }
@@ -103951,7 +104115,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
103951
104115
  init_logger();
103952
104116
  init_skip_directories();
103953
104117
  var import_fs_extra19 = __toESM(require_lib(), 1);
103954
- import { join as join115, relative as relative25, resolve as resolve41 } from "node:path";
104118
+ import { join as join115, relative as relative25, resolve as resolve43 } from "node:path";
103955
104119
 
103956
104120
  class FileScanner2 {
103957
104121
  static async getFiles(dirPath, relativeTo) {
@@ -104031,8 +104195,8 @@ class FileScanner2 {
104031
104195
  return customFiles;
104032
104196
  }
104033
104197
  static isSafePath(basePath, targetPath) {
104034
- const resolvedBase = resolve41(basePath);
104035
- const resolvedTarget = resolve41(targetPath);
104198
+ const resolvedBase = resolve43(basePath);
104199
+ const resolvedTarget = resolve43(targetPath);
104036
104200
  return resolvedTarget.startsWith(resolvedBase);
104037
104201
  }
104038
104202
  static toPosixPath(path16) {
@@ -104553,6 +104717,7 @@ async function handleMerge(ctx) {
104553
104717
  merger.setForceOverwriteSettings(ctx.options.forceOverwriteSettings);
104554
104718
  merger.setProjectDir(ctx.resolvedDir);
104555
104719
  merger.setKitName(ctx.kit.name);
104720
+ merger.setZombiePrunerHookDir(join120(ctx.claudeDir, "hooks"));
104556
104721
  if (ctx.kitType) {
104557
104722
  merger.setMultiKitContext(ctx.claudeDir, ctx.kitType);
104558
104723
  }
@@ -105343,7 +105508,7 @@ init_logger();
105343
105508
  init_types3();
105344
105509
  var import_fs_extra28 = __toESM(require_lib(), 1);
105345
105510
  import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir36, rm as rm14, stat as stat21 } from "node:fs/promises";
105346
- import { basename as basename26, join as join124, normalize as normalize9 } from "node:path";
105511
+ import { basename as basename27, join as join124, normalize as normalize9 } from "node:path";
105347
105512
  function validatePath2(path16, paramName) {
105348
105513
  if (!path16 || typeof path16 !== "string") {
105349
105514
  throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
@@ -105479,7 +105644,7 @@ class SkillsBackupManager {
105479
105644
  return size;
105480
105645
  }
105481
105646
  static extractBackupTimestamp(backupPath) {
105482
- const dirName = basename26(backupPath);
105647
+ const dirName = basename27(backupPath);
105483
105648
  if (!dirName.startsWith(SkillsBackupManager.BACKUP_PREFIX)) {
105484
105649
  return null;
105485
105650
  }
@@ -105520,12 +105685,12 @@ async function getAllFiles(dirPath) {
105520
105685
  return files;
105521
105686
  }
105522
105687
  async function hashFile(filePath) {
105523
- return new Promise((resolve43, reject) => {
105688
+ return new Promise((resolve44, reject) => {
105524
105689
  const hash = createHash8("sha256");
105525
105690
  const stream = createReadStream2(filePath);
105526
105691
  stream.on("data", (chunk) => hash.update(chunk));
105527
105692
  stream.on("end", () => {
105528
- resolve43(hash.digest("hex"));
105693
+ resolve44(hash.digest("hex"));
105529
105694
  });
105530
105695
  stream.on("error", (error) => {
105531
105696
  stream.destroy();
@@ -106174,7 +106339,7 @@ async function handlePostInstall(ctx) {
106174
106339
  init_config_manager();
106175
106340
  init_github_client();
106176
106341
  import { mkdir as mkdir36 } from "node:fs/promises";
106177
- import { join as join134, resolve as resolve46 } from "node:path";
106342
+ import { join as join134, resolve as resolve47 } from "node:path";
106178
106343
 
106179
106344
  // src/domains/github/kit-access-checker.ts
106180
106345
  init_error2();
@@ -106343,8 +106508,8 @@ async function runPreflightChecks() {
106343
106508
 
106344
106509
  // src/domains/installation/fresh-installer.ts
106345
106510
  init_metadata_migration();
106346
- import { existsSync as existsSync65, readdirSync as readdirSync8, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
106347
- import { basename as basename27, dirname as dirname38, join as join132, resolve as resolve43 } from "node:path";
106511
+ import { existsSync as existsSync66, readdirSync as readdirSync9, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
106512
+ import { basename as basename28, dirname as dirname39, join as join132, resolve as resolve45 } from "node:path";
106348
106513
  init_logger();
106349
106514
  init_safe_spinner();
106350
106515
  var import_fs_extra34 = __toESM(require_lib(), 1);
@@ -106396,15 +106561,15 @@ async function analyzeFreshInstallation(claudeDir3) {
106396
106561
  };
106397
106562
  }
106398
106563
  function cleanupEmptyDirectories2(filePath, claudeDir3) {
106399
- const normalizedClaudeDir = resolve43(claudeDir3);
106400
- let currentDir = resolve43(dirname38(filePath));
106564
+ const normalizedClaudeDir = resolve45(claudeDir3);
106565
+ let currentDir = resolve45(dirname39(filePath));
106401
106566
  while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
106402
106567
  try {
106403
- const entries = readdirSync8(currentDir);
106568
+ const entries = readdirSync9(currentDir);
106404
106569
  if (entries.length === 0) {
106405
106570
  rmdirSync2(currentDir);
106406
106571
  logger.debug(`Removed empty directory: ${currentDir}`);
106407
- currentDir = resolve43(dirname38(currentDir));
106572
+ currentDir = resolve45(dirname39(currentDir));
106408
106573
  } else {
106409
106574
  break;
106410
106575
  }
@@ -106427,7 +106592,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
106427
106592
  }
106428
106593
  for (const file of filesToRemove) {
106429
106594
  const fullPath = join132(claudeDir3, file.path);
106430
- if (!existsSync65(fullPath)) {
106595
+ if (!existsSync66(fullPath)) {
106431
106596
  continue;
106432
106597
  }
106433
106598
  try {
@@ -106485,8 +106650,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
106485
106650
  mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
106486
106651
  };
106487
106652
  }
106488
- const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync65(join132(claudeDir3, subdir)));
106489
- if (existsSync65(join132(claudeDir3, "metadata.json"))) {
106653
+ const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync66(join132(claudeDir3, subdir)));
106654
+ if (existsSync66(join132(claudeDir3, "metadata.json"))) {
106490
106655
  deletePaths.push("metadata.json");
106491
106656
  }
106492
106657
  return {
@@ -106555,7 +106720,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
106555
106720
  mutatePaths: backupTargets.mutatePaths,
106556
106721
  scope: "claude"
106557
106722
  });
106558
- await cleanupOldDestructiveOperationBackups(undefined, basename27(backup.backupDir));
106723
+ await cleanupOldDestructiveOperationBackups(undefined, basename28(backup.backupDir));
106559
106724
  backupSpinner.succeed(`Recovery backup saved to ${backup.backupDir}`);
106560
106725
  } catch (error) {
106561
106726
  backupSpinner.fail("Failed to create recovery backup");
@@ -106593,8 +106758,8 @@ async function handleFreshInstallation(claudeDir3, prompts) {
106593
106758
  // src/domains/installation/global-kit-legacy-repair.ts
106594
106759
  var import_fs_extra35 = __toESM(require_lib(), 1);
106595
106760
  import { cp as cp5, mkdir as mkdir35, readdir as readdir41, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
106596
- import { homedir as homedir46 } from "node:os";
106597
- import { dirname as dirname39, join as join133, normalize as normalize11, resolve as resolve45 } from "node:path";
106761
+ import { homedir as homedir47 } from "node:os";
106762
+ import { dirname as dirname40, join as join133, normalize as normalize11, resolve as resolve46 } from "node:path";
106598
106763
  var LEGACY_KIT_MARKERS = [
106599
106764
  "metadata.json",
106600
106765
  ".ck.json",
@@ -106620,7 +106785,7 @@ function uniqueNormalizedPaths(paths) {
106620
106785
  const seen = new Set;
106621
106786
  const result = [];
106622
106787
  for (const path16 of paths) {
106623
- const normalized = normalize11(resolve45(path16));
106788
+ const normalized = normalize11(resolve46(path16));
106624
106789
  if (seen.has(normalized))
106625
106790
  continue;
106626
106791
  seen.add(normalized);
@@ -106628,7 +106793,7 @@ function uniqueNormalizedPaths(paths) {
106628
106793
  }
106629
106794
  return result;
106630
106795
  }
106631
- function getLegacyWindowsGlobalKitDirCandidates(env2 = process.env, homeDir = homedir46()) {
106796
+ function getLegacyWindowsGlobalKitDirCandidates(env2 = process.env, homeDir = homedir47()) {
106632
106797
  const candidates = [];
106633
106798
  const localAppData = safeEnvPath(env2.LOCALAPPDATA);
106634
106799
  const appData = safeEnvPath(env2.APPDATA);
@@ -106685,8 +106850,8 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
106685
106850
  if (safeEnvPath(env2.CLAUDE_CONFIG_DIR)) {
106686
106851
  return { status: "skipped", reason: "custom-global-dir", candidateDirs: [] };
106687
106852
  }
106688
- const targetDir = normalize11(resolve45(options2.targetDir));
106689
- const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(resolve45(candidate)) !== targetDir);
106853
+ const targetDir = normalize11(resolve46(options2.targetDir));
106854
+ const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(resolve46(candidate)) !== targetDir);
106690
106855
  const legacyDirs = [];
106691
106856
  for (const candidate of candidateDirs) {
106692
106857
  if (await hasKitMarkers(candidate)) {
@@ -106707,7 +106872,7 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
106707
106872
  if (targetExists) {
106708
106873
  await rm16(targetDir, { recursive: true, force: true });
106709
106874
  }
106710
- await mkdir35(dirname39(targetDir), { recursive: true });
106875
+ await mkdir35(dirname40(targetDir), { recursive: true });
106711
106876
  await moveDirectory(legacyDir, targetDir);
106712
106877
  return { status: "repaired", reason: "repaired", legacyDir, candidateDirs };
106713
106878
  }
@@ -106909,7 +107074,7 @@ async function handleSelection(ctx) {
106909
107074
  }
106910
107075
  }
106911
107076
  }
106912
- const resolvedDir = resolve46(targetDir);
107077
+ const resolvedDir = resolve47(targetDir);
106913
107078
  if (ctx.options.global) {
106914
107079
  try {
106915
107080
  const repairResult = await repairLegacyWindowsGlobalKitDir({ targetDir: resolvedDir });
@@ -107106,7 +107271,7 @@ async function handleSelection(ctx) {
107106
107271
  }
107107
107272
  // src/commands/init/phases/sync-handler.ts
107108
107273
  import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile59, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile33 } from "node:fs/promises";
107109
- import { dirname as dirname40, join as join135, resolve as resolve47 } from "node:path";
107274
+ import { dirname as dirname41, join as join135, resolve as resolve48 } from "node:path";
107110
107275
  init_logger();
107111
107276
  init_path_resolver();
107112
107277
  var import_fs_extra37 = __toESM(require_lib(), 1);
@@ -107115,7 +107280,7 @@ async function handleSync(ctx) {
107115
107280
  if (!ctx.options.sync) {
107116
107281
  return ctx;
107117
107282
  }
107118
- const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve47(ctx.options.dir || ".");
107283
+ const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve48(ctx.options.dir || ".");
107119
107284
  const claudeDir3 = ctx.options.global ? resolvedDir : join135(resolvedDir, ".claude");
107120
107285
  if (!await import_fs_extra37.pathExists(claudeDir3)) {
107121
107286
  logger.error("Cannot sync: no .claude directory found");
@@ -107225,7 +107390,7 @@ async function acquireSyncLock(global3) {
107225
107390
  const lockPath = join135(cacheDir, ".sync-lock");
107226
107391
  const startTime = Date.now();
107227
107392
  const lockTimeout = getLockTimeout();
107228
- await mkdir37(dirname40(lockPath), { recursive: true });
107393
+ await mkdir37(dirname41(lockPath), { recursive: true });
107229
107394
  while (Date.now() - startTime < lockTimeout) {
107230
107395
  try {
107231
107396
  const handle = await open5(lockPath, "wx");
@@ -107761,7 +107926,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
107761
107926
  // src/services/transformers/global-path-transformer.ts
107762
107927
  init_logger();
107763
107928
  import { readFile as readFile61, readdir as readdir43, writeFile as writeFile35 } from "node:fs/promises";
107764
- import { homedir as homedir47, platform as platform15 } from "node:os";
107929
+ import { homedir as homedir48, platform as platform15 } from "node:os";
107765
107930
  import { extname as extname6, join as join138 } from "node:path";
107766
107931
  var IS_WINDOWS3 = platform15() === "win32";
107767
107932
  var HOME_PREFIX = "$HOME";
@@ -107772,7 +107937,7 @@ function normalizeInstallPath(path16) {
107772
107937
  return path16.replace(/\\/g, "/").replace(/\/+$/, "");
107773
107938
  }
107774
107939
  function getDefaultGlobalClaudeDir() {
107775
- return normalizeInstallPath(join138(homedir47(), ".claude"));
107940
+ return normalizeInstallPath(join138(homedir48(), ".claude"));
107776
107941
  }
107777
107942
  function getCustomGlobalClaudeDir(targetClaudeDir) {
107778
107943
  if (!targetClaudeDir)
@@ -107892,8 +108057,8 @@ function transformContent(content, options2 = {}) {
107892
108057
  }
107893
108058
  function shouldTransformFile3(filename) {
107894
108059
  const ext2 = extname6(filename).toLowerCase();
107895
- const basename28 = filename.split("/").pop() || filename;
107896
- return TRANSFORMABLE_EXTENSIONS3.has(ext2) || ALWAYS_TRANSFORM_FILES.has(basename28);
108060
+ const basename29 = filename.split("/").pop() || filename;
108061
+ return TRANSFORMABLE_EXTENSIONS3.has(ext2) || ALWAYS_TRANSFORM_FILES.has(basename29);
107897
108062
  }
107898
108063
  async function transformPathsForGlobalInstall(directory, options2 = {}) {
107899
108064
  let filesTransformed = 0;
@@ -108171,16 +108336,16 @@ async function initCommand(options2) {
108171
108336
  // src/commands/migrate/migrate-command.ts
108172
108337
  init_dist2();
108173
108338
  var import_picocolors30 = __toESM(require_picocolors(), 1);
108174
- import { existsSync as existsSync66 } from "node:fs";
108339
+ import { existsSync as existsSync67 } from "node:fs";
108175
108340
  import { readFile as readFile65, rm as rm18, unlink as unlink14 } from "node:fs/promises";
108176
- import { homedir as homedir52 } from "node:os";
108177
- import { basename as basename29, join as join143, resolve as resolve49 } from "node:path";
108341
+ import { homedir as homedir53 } from "node:os";
108342
+ import { basename as basename30, join as join143, resolve as resolve50 } from "node:path";
108178
108343
  init_logger();
108179
108344
 
108180
108345
  // src/ui/ck-cli-design/tokens.ts
108181
108346
  var import_picocolors27 = __toESM(require_picocolors(), 1);
108182
- import { homedir as homedir48, platform as platform16 } from "node:os";
108183
- import { resolve as resolve48, win32 as win322 } from "node:path";
108347
+ import { homedir as homedir49, platform as platform16 } from "node:os";
108348
+ import { resolve as resolve49, win32 as win322 } from "node:path";
108184
108349
  var PANEL_MIN_WIDTH = 60;
108185
108350
  var PANEL_MAX_WIDTH = 72;
108186
108351
  var DEFAULT_WIDTH = PANEL_MAX_WIDTH;
@@ -108337,7 +108502,7 @@ function wrapText(value, width) {
108337
108502
  }
108338
108503
  function formatDisplayPath(value) {
108339
108504
  const normalized = value.replace(/\\/g, "/");
108340
- const home5 = homedir48().replace(/\\/g, "/");
108505
+ const home5 = homedir49().replace(/\\/g, "/");
108341
108506
  if (normalized === home5)
108342
108507
  return "~";
108343
108508
  if (normalized.startsWith(`${home5}/`)) {
@@ -108350,7 +108515,7 @@ function formatCdHint(value, currentPlatform = platform16()) {
108350
108515
  const absolutePath2 = win322.resolve(value);
108351
108516
  return `cd /d "${absolutePath2}"`;
108352
108517
  }
108353
- const absolutePath = resolve48(value);
108518
+ const absolutePath = resolve49(value);
108354
108519
  const displayPath = formatDisplayPath(absolutePath);
108355
108520
  if (displayPath.includes(" ")) {
108356
108521
  return `cd "${displayPath}"`;
@@ -108651,13 +108816,13 @@ init_logger();
108651
108816
  init_dist2();
108652
108817
  init_model_taxonomy();
108653
108818
  import { mkdir as mkdir39, readFile as readFile64, writeFile as writeFile37 } from "node:fs/promises";
108654
- import { homedir as homedir51 } from "node:os";
108655
- import { dirname as dirname41, join as join142 } from "node:path";
108819
+ import { homedir as homedir52 } from "node:os";
108820
+ import { dirname as dirname42, join as join142 } from "node:path";
108656
108821
 
108657
108822
  // src/commands/portable/models-dev-cache.ts
108658
108823
  init_logger();
108659
108824
  import { mkdir as mkdir38, readFile as readFile62, rename as rename14, writeFile as writeFile36 } from "node:fs/promises";
108660
- import { homedir as homedir49 } from "node:os";
108825
+ import { homedir as homedir50 } from "node:os";
108661
108826
  import { join as join140 } from "node:path";
108662
108827
 
108663
108828
  class ModelsDevUnavailableError extends Error {
@@ -108670,7 +108835,7 @@ var MODELS_DEV_URL = "https://models.dev/api.json";
108670
108835
  var CACHE_TTL_MS3 = 24 * 60 * 60 * 1000;
108671
108836
  var FETCH_TIMEOUT_MS = 1e4;
108672
108837
  function defaultCacheDir() {
108673
- return join140(homedir49(), ".config", "claudekit", "cache");
108838
+ return join140(homedir50(), ".config", "claudekit", "cache");
108674
108839
  }
108675
108840
  function cacheFilePath(cacheDir) {
108676
108841
  return join140(cacheDir, "models-dev.json");
@@ -108750,7 +108915,7 @@ async function getModelsDevCatalog(opts = {}) {
108750
108915
  // src/commands/portable/opencode-model-discovery.ts
108751
108916
  init_logger();
108752
108917
  import { readFile as readFile63 } from "node:fs/promises";
108753
- import { homedir as homedir50, platform as platform17 } from "node:os";
108918
+ import { homedir as homedir51, platform as platform17 } from "node:os";
108754
108919
  import { join as join141 } from "node:path";
108755
108920
  function resolveOpenCodeAuthPath(homeDir) {
108756
108921
  if (platform17() === "win32") {
@@ -108796,7 +108961,7 @@ function pickGenericModel(models) {
108796
108961
  return sorted[0] ?? null;
108797
108962
  }
108798
108963
  async function resolveOpenCodeDefaultModel(opts = {}) {
108799
- const home5 = opts.homeDir ?? homedir50();
108964
+ const home5 = opts.homeDir ?? homedir51();
108800
108965
  const authedProviders = await readAuthedProviders(home5);
108801
108966
  if (authedProviders.length === 0) {
108802
108967
  return { ok: false, reason: "no-auth", authedProviders: [] };
@@ -108860,7 +109025,7 @@ function messageForReason(reason) {
108860
109025
  }
108861
109026
  function getOpenCodeConfigPath(options2) {
108862
109027
  if (options2.global) {
108863
- return join142(options2.homeDir ?? homedir51(), ".config", "opencode", "opencode.json");
109028
+ return join142(options2.homeDir ?? homedir52(), ".config", "opencode", "opencode.json");
108864
109029
  }
108865
109030
  return join142(options2.cwd ?? process.cwd(), "opencode.json");
108866
109031
  }
@@ -109005,7 +109170,7 @@ async function ensureOpenCodeModel(options2) {
109005
109170
  }
109006
109171
  const chosenModel2 = response2.action === "custom" ? response2.value : suggestion2.model;
109007
109172
  const next2 = { ...existing, model: chosenModel2 };
109008
- await mkdir39(dirname41(configPath), { recursive: true });
109173
+ await mkdir39(dirname42(configPath), { recursive: true });
109009
109174
  await writeFile37(configPath, `${JSON.stringify(next2, null, 2)}
109010
109175
  `, "utf-8");
109011
109176
  return { path: configPath, action: "added", model: chosenModel2, reason: suggestion2.reason };
@@ -109016,7 +109181,7 @@ async function ensureOpenCodeModel(options2) {
109016
109181
  throw new OpenCodeAuthRequiredError(suggestion.failure);
109017
109182
  }
109018
109183
  const next2 = { ...existing ?? {}, model: suggestion.model };
109019
- await mkdir39(dirname41(configPath), { recursive: true });
109184
+ await mkdir39(dirname42(configPath), { recursive: true });
109020
109185
  await writeFile37(configPath, `${JSON.stringify(next2, null, 2)}
109021
109186
  `, "utf-8");
109022
109187
  return {
@@ -109038,7 +109203,7 @@ async function ensureOpenCodeModel(options2) {
109038
109203
  }
109039
109204
  const chosenModel = response.action === "custom" ? response.value : suggestion.ok ? suggestion.model : "";
109040
109205
  const next = { ...existing ?? {}, model: chosenModel };
109041
- await mkdir39(dirname41(configPath), { recursive: true });
109206
+ await mkdir39(dirname42(configPath), { recursive: true });
109042
109207
  await writeFile37(configPath, `${JSON.stringify(next, null, 2)}
109043
109208
  `, "utf-8");
109044
109209
  return {
@@ -109051,7 +109216,7 @@ async function ensureOpenCodeModel(options2) {
109051
109216
 
109052
109217
  // src/commands/portable/plan-display.ts
109053
109218
  var import_picocolors28 = __toESM(require_picocolors(), 1);
109054
- import { basename as basename28, dirname as dirname42, extname as extname7 } from "node:path";
109219
+ import { basename as basename29, dirname as dirname43, extname as extname7 } from "node:path";
109055
109220
  var DEFAULT_MAX_PLAN_GROUP_ITEMS = 20;
109056
109221
  var TYPE_ORDER = [
109057
109222
  "agent",
@@ -109277,21 +109442,21 @@ function collectPlannedWhereLines(plan) {
109277
109442
  return destinations.map((destination) => `${formatDisplayPath(destination)} -> ${formatCdHint(resolveCdTarget(destination))}`);
109278
109443
  }
109279
109444
  function resolveCdTarget(destination) {
109280
- return extname7(destination).length > 0 ? dirname42(destination) : destination;
109445
+ return extname7(destination).length > 0 ? dirname43(destination) : destination;
109281
109446
  }
109282
109447
  function normalizeWhereDestination(path16, portableType) {
109283
109448
  if (portableType === "agent" || portableType === "command" || portableType === "skill") {
109284
- return dirname42(path16);
109449
+ return dirname43(path16);
109285
109450
  }
109286
109451
  if (portableType === "hooks") {
109287
- return dirname42(path16);
109452
+ return dirname43(path16);
109288
109453
  }
109289
109454
  if (portableType === "rules") {
109290
- const fileName = basename28(path16).toLowerCase();
109455
+ const fileName = basename29(path16).toLowerCase();
109291
109456
  if (fileName === "agents.md" || fileName === "gemini.md" || fileName === ".goosehints" || fileName === "custom_modes.yaml" || fileName === "custom_modes.yml") {
109292
109457
  return path16;
109293
109458
  }
109294
- return dirname42(path16);
109459
+ return dirname43(path16);
109295
109460
  }
109296
109461
  return path16;
109297
109462
  }
@@ -109812,9 +109977,9 @@ function shouldExecuteAction2(action) {
109812
109977
  }
109813
109978
  async function executeDeleteAction(action, options2) {
109814
109979
  const preservePaths = options2?.preservePaths ?? new Set;
109815
- const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve49(action.targetPath));
109980
+ const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve50(action.targetPath));
109816
109981
  try {
109817
- if (!shouldPreserveTarget && action.targetPath && existsSync66(action.targetPath)) {
109982
+ if (!shouldPreserveTarget && action.targetPath && existsSync67(action.targetPath)) {
109818
109983
  await rm18(action.targetPath, { recursive: true, force: true });
109819
109984
  }
109820
109985
  await removePortableInstallation(action.item, action.type, action.provider, action.global, action.targetPath ? { path: action.targetPath } : undefined);
@@ -109845,8 +110010,8 @@ async function executeDeleteAction(action, options2) {
109845
110010
  async function processMetadataDeletions(skillSourcePath, installGlobally) {
109846
110011
  if (!skillSourcePath)
109847
110012
  return;
109848
- const sourceMetadataPath = join143(resolve49(skillSourcePath, ".."), "metadata.json");
109849
- if (!existsSync66(sourceMetadataPath))
110013
+ const sourceMetadataPath = join143(resolve50(skillSourcePath, ".."), "metadata.json");
110014
+ if (!existsSync67(sourceMetadataPath))
109850
110015
  return;
109851
110016
  let sourceMetadata;
109852
110017
  try {
@@ -109858,8 +110023,8 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
109858
110023
  }
109859
110024
  if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
109860
110025
  return;
109861
- const claudeDir3 = installGlobally ? join143(homedir52(), ".claude") : join143(process.cwd(), ".claude");
109862
- if (!existsSync66(claudeDir3))
110026
+ const claudeDir3 = installGlobally ? join143(homedir53(), ".claude") : join143(process.cwd(), ".claude");
110027
+ if (!existsSync67(claudeDir3))
109863
110028
  return;
109864
110029
  try {
109865
110030
  const result = await handleDeletions(sourceMetadata, claudeDir3, inferKitTypeFromSourceMetadata(sourceMetadata));
@@ -109987,7 +110152,7 @@ async function migrateCommand(options2) {
109987
110152
  let installGlobally = requestedGlobal;
109988
110153
  if (options2.global === undefined && !options2.yes) {
109989
110154
  const projectTarget = join143(process.cwd(), ".claude");
109990
- const globalTarget = join143(homedir52(), ".claude");
110155
+ const globalTarget = join143(homedir53(), ".claude");
109991
110156
  const scopeChoice = await ie({
109992
110157
  message: "Installation scope",
109993
110158
  options: [
@@ -110060,7 +110225,7 @@ async function migrateCommand(options2) {
110060
110225
  }).join(`
110061
110226
  `));
110062
110227
  if (sourceGlobalOnly) {
110063
- f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join143(homedir52(), ".claude"))}`));
110228
+ f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join143(homedir53(), ".claude"))}`));
110064
110229
  } else {
110065
110230
  f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
110066
110231
  }
@@ -110151,7 +110316,7 @@ async function migrateCommand(options2) {
110151
110316
  const interactive = process.stdout.isTTY && !options2.yes;
110152
110317
  const conflictActions = plan.actions.filter((a3) => a3.action === "conflict");
110153
110318
  for (const action of conflictActions) {
110154
- if (!action.diff && action.targetPath && existsSync66(action.targetPath)) {
110319
+ if (!action.diff && action.targetPath && existsSync67(action.targetPath)) {
110155
110320
  try {
110156
110321
  const targetContent = await readFile65(action.targetPath, "utf-8");
110157
110322
  const sourceItem = effectiveAgents.find((a3) => a3.name === action.item) || effectiveCommands.find((c2) => c2.name === action.item) || (effectiveConfigItem?.name === action.item ? effectiveConfigItem : null) || effectiveRuleItems.find((r2) => r2.name === action.item) || effectiveHookItems.find((h2) => h2.name === action.item);
@@ -110266,18 +110431,18 @@ async function migrateCommand(options2) {
110266
110431
  const recordSuccessfulWrites = (task, taskResults) => {
110267
110432
  for (const result of taskResults.filter((entry) => entry.success && !entry.skipped)) {
110268
110433
  if (result.path.length > 0) {
110269
- writtenPaths.add(resolve49(result.path));
110434
+ writtenPaths.add(resolve50(result.path));
110270
110435
  }
110271
110436
  if (task.type === "hooks") {
110272
110437
  const existing = successfulHookFiles.get(task.provider) ?? {
110273
110438
  files: [],
110274
110439
  global: task.global
110275
110440
  };
110276
- existing.files.push(basename29(result.path));
110441
+ existing.files.push(basename30(result.path));
110277
110442
  successfulHookFiles.set(task.provider, existing);
110278
110443
  if (result.path.length > 0) {
110279
110444
  const absExisting = successfulHookAbsPaths.get(task.provider) ?? [];
110280
- absExisting.push(resolve49(result.path));
110445
+ absExisting.push(resolve50(result.path));
110281
110446
  successfulHookAbsPaths.set(task.provider, absExisting);
110282
110447
  }
110283
110448
  }
@@ -110411,7 +110576,7 @@ async function migrateCommand(options2) {
110411
110576
  });
110412
110577
  if (staleSlugs.length > 0) {
110413
110578
  const staleSlugSet = new Set(staleSlugs.map((s) => `${s}.toml`));
110414
- const removed = await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === scope2 && staleSlugSet.has(basename29(i.path)));
110579
+ const removed = await removeInstallationsByFilter((i) => i.type === "agent" && i.provider === provider && i.global === scope2 && staleSlugSet.has(basename30(i.path)));
110415
110580
  for (const entry of removed) {
110416
110581
  logger.verbose(`[migrate] Cleaned stale registry entry: ${entry.item} (${provider})`);
110417
110582
  }
@@ -110419,7 +110584,7 @@ async function migrateCommand(options2) {
110419
110584
  }
110420
110585
  }
110421
110586
  try {
110422
- const kitRoot = (agentSource ? resolve49(agentSource, "..") : null) ?? (commandSource ? resolve49(commandSource, "..") : null) ?? (skillSource ? resolve49(skillSource, "..") : null) ?? null;
110587
+ const kitRoot = (agentSource ? resolve50(agentSource, "..") : null) ?? (commandSource ? resolve50(commandSource, "..") : null) ?? (skillSource ? resolve50(skillSource, "..") : null) ?? null;
110423
110588
  const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
110424
110589
  if (manifest?.cliVersion) {
110425
110590
  await updateAppliedManifestVersion(manifest.cliVersion);
@@ -110467,7 +110632,7 @@ async function migrateCommand(options2) {
110467
110632
  async function rollbackResults(results) {
110468
110633
  const rolledBackPaths = new Set;
110469
110634
  for (const result of results) {
110470
- if (!result.path || !existsSync66(result.path))
110635
+ if (!result.path || !existsSync67(result.path))
110471
110636
  continue;
110472
110637
  try {
110473
110638
  if (result.overwritten)
@@ -110616,7 +110781,7 @@ var import_picocolors31 = __toESM(require_picocolors(), 1);
110616
110781
 
110617
110782
  // src/commands/new/phases/directory-setup.ts
110618
110783
  init_config_manager();
110619
- import { resolve as resolve50 } from "node:path";
110784
+ import { resolve as resolve51 } from "node:path";
110620
110785
  init_logger();
110621
110786
  init_path_resolver();
110622
110787
  init_types3();
@@ -110701,7 +110866,7 @@ async function directorySetup(validOptions, prompts) {
110701
110866
  targetDir = await prompts.getDirectory(targetDir);
110702
110867
  }
110703
110868
  }
110704
- const resolvedDir = resolve50(targetDir);
110869
+ const resolvedDir = resolve51(targetDir);
110705
110870
  logger.info(`Target directory: ${resolvedDir}`);
110706
110871
  if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
110707
110872
  logger.warning("You're creating a project at HOME directory.");
@@ -111034,8 +111199,8 @@ Please use only one download method.`);
111034
111199
  }
111035
111200
  // src/commands/plan/plan-command.ts
111036
111201
  init_output_manager();
111037
- import { existsSync as existsSync69, statSync as statSync12 } from "node:fs";
111038
- import { dirname as dirname46, isAbsolute as isAbsolute13, join as join148, parse as parse7, resolve as resolve54 } from "node:path";
111202
+ import { existsSync as existsSync70, statSync as statSync12 } from "node:fs";
111203
+ import { dirname as dirname47, isAbsolute as isAbsolute14, join as join148, parse as parse7, resolve as resolve55 } from "node:path";
111039
111204
 
111040
111205
  // src/commands/plan/plan-read-handlers.ts
111041
111206
  init_config();
@@ -111044,19 +111209,19 @@ init_plans_registry();
111044
111209
  init_logger();
111045
111210
  init_output_manager();
111046
111211
  var import_picocolors32 = __toESM(require_picocolors(), 1);
111047
- import { existsSync as existsSync68, statSync as statSync11 } from "node:fs";
111048
- import { basename as basename30, dirname as dirname44, join as join147, relative as relative31, resolve as resolve52 } from "node:path";
111212
+ import { existsSync as existsSync69, statSync as statSync11 } from "node:fs";
111213
+ import { basename as basename31, dirname as dirname45, join as join147, relative as relative31, resolve as resolve53 } from "node:path";
111049
111214
 
111050
111215
  // src/commands/plan/plan-dependencies.ts
111051
111216
  init_config();
111052
111217
  init_plan_parser();
111053
111218
  init_plans_registry();
111054
- import { existsSync as existsSync67 } from "node:fs";
111055
- import { dirname as dirname43, join as join146 } from "node:path";
111219
+ import { existsSync as existsSync68 } from "node:fs";
111220
+ import { dirname as dirname44, join as join146 } from "node:path";
111056
111221
  async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
111057
111222
  if (references.length === 0)
111058
111223
  return [];
111059
- const currentPlanDir = dirname43(currentPlanFile);
111224
+ const currentPlanDir = dirname44(currentPlanFile);
111060
111225
  const projectRoot = findProjectRoot(currentPlanDir);
111061
111226
  const config = options2.preloadedConfig ?? (await CkConfigManager.loadFull(projectRoot)).config;
111062
111227
  const defaultScope = inferPlanScopeForDir(currentPlanDir, config);
@@ -111074,7 +111239,7 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
111074
111239
  const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
111075
111240
  const planFile = join146(scopeRoot, planId, "plan.md");
111076
111241
  const isSelfReference = planFile === currentPlanFile;
111077
- if (!existsSync67(planFile)) {
111242
+ if (!existsSync68(planFile)) {
111078
111243
  return {
111079
111244
  reference,
111080
111245
  scope,
@@ -111103,14 +111268,14 @@ init_config();
111103
111268
  init_plan_parser();
111104
111269
  init_plan_scope();
111105
111270
  init_plans_registry();
111106
- import { isAbsolute as isAbsolute12, resolve as resolve51 } from "node:path";
111271
+ import { isAbsolute as isAbsolute13, resolve as resolve52 } from "node:path";
111107
111272
  async function getGlobalPlansDirFromCwd() {
111108
111273
  const projectRoot = findProjectRoot(process.cwd());
111109
111274
  const { config } = await CkConfigManager.loadFull(projectRoot);
111110
111275
  return resolveGlobalPlansDir(config);
111111
111276
  }
111112
111277
  function resolveTargetFromBase(target, baseDir) {
111113
- const resolvedTarget = isAbsolute12(target) ? resolve51(target) : resolve51(baseDir, target);
111278
+ const resolvedTarget = isAbsolute13(target) ? resolve52(target) : resolve52(baseDir, target);
111114
111279
  return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
111115
111280
  }
111116
111281
 
@@ -111143,7 +111308,7 @@ async function handleParse(target, options2) {
111143
111308
  console.log(JSON.stringify({ file: relative31(process.cwd(), planFile), frontmatter, phases }, null, 2));
111144
111309
  return;
111145
111310
  }
111146
- const title = typeof frontmatter.title === "string" ? frontmatter.title : basename30(dirname44(planFile));
111311
+ const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(dirname45(planFile));
111147
111312
  console.log();
111148
111313
  console.log(import_picocolors32.default.bold(` Plan: ${title}`));
111149
111314
  console.log(` File: ${planFile}`);
@@ -111213,8 +111378,8 @@ async function handleStatus(target, options2) {
111213
111378
  return;
111214
111379
  }
111215
111380
  const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
111216
- const t = effectiveTarget ? resolve52(effectiveTarget) : null;
111217
- const plansDir = t && existsSync68(t) && statSync11(t).isDirectory() && !existsSync68(join147(t, "plan.md")) ? t : null;
111381
+ const t = effectiveTarget ? resolve53(effectiveTarget) : null;
111382
+ const plansDir = t && existsSync69(t) && statSync11(t).isDirectory() && !existsSync69(join147(t, "plan.md")) ? t : null;
111218
111383
  if (plansDir) {
111219
111384
  const planFiles = scanPlanDir(plansDir);
111220
111385
  if (planFiles.length === 0) {
@@ -111254,7 +111419,7 @@ async function handleStatus(target, options2) {
111254
111419
  const blockedBy2 = await resolvePlanDependencies(s.blockedBy, pf, { preloadedConfig });
111255
111420
  const blocks2 = await resolvePlanDependencies(s.blocks, pf, { preloadedConfig });
111256
111421
  const bar = progressBar(s.completed, s.totalPhases);
111257
- const title2 = s.title ?? basename30(dirname44(pf));
111422
+ const title2 = s.title ?? basename31(dirname45(pf));
111258
111423
  console.log(` ${import_picocolors32.default.bold(title2)}`);
111259
111424
  console.log(` ${bar}`);
111260
111425
  if (s.inProgress > 0)
@@ -111273,7 +111438,7 @@ async function handleStatus(target, options2) {
111273
111438
  }
111274
111439
  console.log();
111275
111440
  } catch {
111276
- console.log(` [X] Failed to read: ${basename30(dirname44(pf))}`);
111441
+ console.log(` [X] Failed to read: ${basename31(dirname45(pf))}`);
111277
111442
  console.log();
111278
111443
  }
111279
111444
  }
@@ -111300,7 +111465,7 @@ async function handleStatus(target, options2) {
111300
111465
  console.log(JSON.stringify({ ...summary, dependencyStatus: { blockedBy, blocks } }, null, 2));
111301
111466
  return;
111302
111467
  }
111303
- const title = summary.title ?? basename30(dirname44(planFile));
111468
+ const title = summary.title ?? basename31(dirname45(planFile));
111304
111469
  console.log();
111305
111470
  console.log(import_picocolors32.default.bold(` ${title}`));
111306
111471
  if (summary.status)
@@ -111363,7 +111528,7 @@ async function handleKanban(target, options2) {
111363
111528
  process.exitCode = 1;
111364
111529
  return;
111365
111530
  }
111366
- const route = `/plans?dir=${encodeURIComponent(dirname44(dirname44(planFile)))}&view=kanban`;
111531
+ const route = `/plans?dir=${encodeURIComponent(dirname45(dirname45(planFile)))}&view=kanban`;
111367
111532
  const url = `http://localhost:${server.port}${route}`;
111368
111533
  console.log();
111369
111534
  console.log(import_picocolors32.default.bold(" ClaudeKit Dashboard — Plans"));
@@ -111398,7 +111563,7 @@ init_plan_parser();
111398
111563
  init_plans_registry();
111399
111564
  init_output_manager();
111400
111565
  var import_picocolors33 = __toESM(require_picocolors(), 1);
111401
- import { basename as basename31, dirname as dirname45, relative as relative32, resolve as resolve53 } from "node:path";
111566
+ import { basename as basename32, dirname as dirname46, relative as relative32, resolve as resolve54 } from "node:path";
111402
111567
  function quoteReadTarget(filePath) {
111403
111568
  return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
111404
111569
  }
@@ -111441,13 +111606,13 @@ async function handleCreate(target, options2) {
111441
111606
  return;
111442
111607
  }
111443
111608
  const globalBaseDir = options2.global ? await getGlobalPlansDirFromCwd() : undefined;
111444
- const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve53(dir);
111609
+ const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve54(dir);
111445
111610
  if (globalBaseDir && !resolvedDir) {
111446
111611
  output.error("[X] Target directory must stay within the configured global plans root");
111447
111612
  process.exitCode = 1;
111448
111613
  return;
111449
111614
  }
111450
- const safeResolvedDir = resolvedDir ?? resolve53(dir);
111615
+ const safeResolvedDir = resolvedDir ?? resolve54(dir);
111451
111616
  const result = scaffoldPlan({
111452
111617
  title: options2.title,
111453
111618
  phases: phaseNames.map((name2) => ({ name: name2 })),
@@ -111485,7 +111650,7 @@ async function handleCreate(target, options2) {
111485
111650
  console.log(` Directory: ${safeResolvedDir}`);
111486
111651
  console.log(` Phases: ${result.phaseFiles.length}`);
111487
111652
  for (const f3 of result.phaseFiles) {
111488
- console.log(` [ ] ${basename31(f3)}`);
111653
+ console.log(` [ ] ${basename32(f3)}`);
111489
111654
  }
111490
111655
  for (const line of buildPlanCreateReadReminder(result.planFile, result.phaseFiles)) {
111491
111656
  console.log(line);
@@ -111512,7 +111677,7 @@ async function handleCheck(target, options2) {
111512
111677
  process.exitCode = 1;
111513
111678
  return;
111514
111679
  }
111515
- const planDir = dirname45(planFile);
111680
+ const planDir = dirname46(planFile);
111516
111681
  let planStatus = "pending";
111517
111682
  try {
111518
111683
  const projectRoot = findProjectRoot(planDir);
@@ -111561,7 +111726,7 @@ async function handleUncheck(target, options2) {
111561
111726
  process.exitCode = 1;
111562
111727
  return;
111563
111728
  }
111564
- const planDir = dirname45(planFile);
111729
+ const planDir = dirname46(planFile);
111565
111730
  try {
111566
111731
  const projectRoot = findProjectRoot(planDir);
111567
111732
  const summary = buildPlanSummary(planFile);
@@ -111600,7 +111765,7 @@ async function handleAddPhase(target, options2) {
111600
111765
  try {
111601
111766
  const result = addPhase(planFile, target, options2.after);
111602
111767
  try {
111603
- const planDir = dirname45(planFile);
111768
+ const planDir = dirname46(planFile);
111604
111769
  const projectRoot = findProjectRoot(planDir);
111605
111770
  updateRegistryAddPhase({
111606
111771
  planDir,
@@ -111626,25 +111791,25 @@ async function handleAddPhase(target, options2) {
111626
111791
  // src/commands/plan/plan-command.ts
111627
111792
  function resolveTargetPath(target, baseDir) {
111628
111793
  if (!baseDir) {
111629
- return resolve54(target);
111794
+ return resolve55(target);
111630
111795
  }
111631
- if (isAbsolute13(target)) {
111632
- return resolve54(target);
111796
+ if (isAbsolute14(target)) {
111797
+ return resolve55(target);
111633
111798
  }
111634
- const cwdCandidate = resolve54(target);
111635
- if (existsSync69(cwdCandidate)) {
111799
+ const cwdCandidate = resolve55(target);
111800
+ if (existsSync70(cwdCandidate)) {
111636
111801
  return cwdCandidate;
111637
111802
  }
111638
- return resolve54(baseDir, target);
111803
+ return resolve55(baseDir, target);
111639
111804
  }
111640
111805
  function resolvePlanFile(target, baseDir) {
111641
- const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve54(baseDir) : process.cwd();
111642
- if (existsSync69(t)) {
111806
+ const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve55(baseDir) : process.cwd();
111807
+ if (existsSync70(t)) {
111643
111808
  const stat24 = statSync12(t);
111644
111809
  if (stat24.isFile())
111645
111810
  return t;
111646
111811
  const candidate = join148(t, "plan.md");
111647
- if (existsSync69(candidate))
111812
+ if (existsSync70(candidate))
111648
111813
  return candidate;
111649
111814
  }
111650
111815
  if (!target && !baseDir) {
@@ -111652,9 +111817,9 @@ function resolvePlanFile(target, baseDir) {
111652
111817
  const root = parse7(dir).root;
111653
111818
  while (dir !== root) {
111654
111819
  const candidate = join148(dir, "plan.md");
111655
- if (existsSync69(candidate))
111820
+ if (existsSync70(candidate))
111656
111821
  return candidate;
111657
- dir = dirname46(dir);
111822
+ dir = dirname47(dir);
111658
111823
  }
111659
111824
  }
111660
111825
  return null;
@@ -111702,7 +111867,7 @@ async function planCommand(action, target, options2) {
111702
111867
  let resolvedTarget = target;
111703
111868
  if (resolvedAction && !knownActions.has(resolvedAction)) {
111704
111869
  const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
111705
- const existsOnDisk = !looksLikePath && existsSync69(resolve54(resolvedAction));
111870
+ const existsOnDisk = !looksLikePath && existsSync70(resolve55(resolvedAction));
111706
111871
  if (looksLikePath || existsOnDisk) {
111707
111872
  resolvedTarget = resolvedAction;
111708
111873
  resolvedAction = undefined;
@@ -111744,13 +111909,13 @@ init_claudekit_data2();
111744
111909
  init_logger();
111745
111910
  init_safe_prompts();
111746
111911
  var import_picocolors34 = __toESM(require_picocolors(), 1);
111747
- import { existsSync as existsSync70 } from "node:fs";
111748
- import { resolve as resolve55 } from "node:path";
111912
+ import { existsSync as existsSync71 } from "node:fs";
111913
+ import { resolve as resolve56 } from "node:path";
111749
111914
  async function handleAdd(projectPath, options2) {
111750
111915
  logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
111751
111916
  intro("Add Project");
111752
- const absolutePath = resolve55(projectPath);
111753
- if (!existsSync70(absolutePath)) {
111917
+ const absolutePath = resolve56(projectPath);
111918
+ if (!existsSync71(absolutePath)) {
111754
111919
  log.error(`Path does not exist: ${absolutePath}`);
111755
111920
  process.exitCode = 1;
111756
111921
  return;
@@ -112173,7 +112338,7 @@ import { readFile as readFile66 } from "node:fs/promises";
112173
112338
  import { join as join150 } from "node:path";
112174
112339
 
112175
112340
  // src/commands/skills/installed-skills-inventory.ts
112176
- import { join as join149, resolve as resolve56 } from "node:path";
112341
+ import { join as join149, resolve as resolve57 } from "node:path";
112177
112342
  init_path_resolver();
112178
112343
  var SCOPE_SORT_ORDER = {
112179
112344
  project: 0,
@@ -112181,8 +112346,8 @@ var SCOPE_SORT_ORDER = {
112181
112346
  };
112182
112347
  async function getActiveClaudeSkillInstallations(options2 = {}) {
112183
112348
  const projectDir = options2.projectDir ?? process.cwd();
112184
- const globalDir = resolve56(options2.globalDir ?? PathResolver.getGlobalKitDir());
112185
- const projectClaudeDir = resolve56(projectDir, ".claude");
112349
+ const globalDir = resolve57(options2.globalDir ?? PathResolver.getGlobalKitDir());
112350
+ const projectClaudeDir = resolve57(projectDir, ".claude");
112186
112351
  const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
112187
112352
  const [projectSkills, globalSkills] = await Promise.all([
112188
112353
  projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join149(projectClaudeDir, "skills")),
@@ -112928,8 +113093,8 @@ async function detectInstallations() {
112928
113093
  }
112929
113094
 
112930
113095
  // src/commands/uninstall/removal-handler.ts
112931
- import { readdirSync as readdirSync10, rmSync as rmSync5 } from "node:fs";
112932
- import { basename as basename32, join as join152, resolve as resolve57, sep as sep13 } from "node:path";
113096
+ import { readdirSync as readdirSync11, rmSync as rmSync5 } from "node:fs";
113097
+ import { basename as basename33, join as join152, resolve as resolve58, sep as sep14 } from "node:path";
112933
113098
  init_logger();
112934
113099
  init_safe_prompts();
112935
113100
  init_safe_spinner();
@@ -112937,8 +113102,8 @@ var import_fs_extra42 = __toESM(require_lib(), 1);
112937
113102
 
112938
113103
  // src/commands/uninstall/analysis-handler.ts
112939
113104
  init_metadata_migration();
112940
- import { readdirSync as readdirSync9, rmSync as rmSync4 } from "node:fs";
112941
- import { dirname as dirname47, join as join151 } from "node:path";
113105
+ import { readdirSync as readdirSync10, rmSync as rmSync4 } from "node:fs";
113106
+ import { dirname as dirname48, join as join151 } from "node:path";
112942
113107
  init_logger();
112943
113108
  init_safe_prompts();
112944
113109
  var import_fs_extra41 = __toESM(require_lib(), 1);
@@ -112960,15 +113125,15 @@ function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
112960
113125
  }
112961
113126
  async function cleanupEmptyDirectories3(filePath, installationRoot) {
112962
113127
  let cleaned = 0;
112963
- let currentDir = dirname47(filePath);
113128
+ let currentDir = dirname48(filePath);
112964
113129
  while (currentDir !== installationRoot && currentDir.startsWith(installationRoot)) {
112965
113130
  try {
112966
- const entries = readdirSync9(currentDir);
113131
+ const entries = readdirSync10(currentDir);
112967
113132
  if (entries.length === 0) {
112968
113133
  rmSync4(currentDir, { recursive: true });
112969
113134
  cleaned++;
112970
113135
  logger.debug(`Removed empty directory: ${currentDir}`);
112971
- currentDir = dirname47(currentDir);
113136
+ currentDir = dirname48(currentDir);
112972
113137
  } else {
112973
113138
  break;
112974
113139
  }
@@ -113113,17 +113278,17 @@ async function restoreUninstallBackup(backup) {
113113
113278
  }
113114
113279
  async function isPathSafeToRemove(filePath, baseDir) {
113115
113280
  try {
113116
- const resolvedPath = resolve57(filePath);
113117
- const resolvedBase = resolve57(baseDir);
113118
- if (!resolvedPath.startsWith(resolvedBase + sep13) && resolvedPath !== resolvedBase) {
113281
+ const resolvedPath = resolve58(filePath);
113282
+ const resolvedBase = resolve58(baseDir);
113283
+ if (!resolvedPath.startsWith(resolvedBase + sep14) && resolvedPath !== resolvedBase) {
113119
113284
  logger.debug(`Path outside installation directory: ${filePath}`);
113120
113285
  return false;
113121
113286
  }
113122
113287
  const stats = await import_fs_extra42.lstat(filePath);
113123
113288
  if (stats.isSymbolicLink()) {
113124
113289
  const realPath = await import_fs_extra42.realpath(filePath);
113125
- const resolvedReal = resolve57(realPath);
113126
- if (!resolvedReal.startsWith(resolvedBase + sep13) && resolvedReal !== resolvedBase) {
113290
+ const resolvedReal = resolve58(realPath);
113291
+ if (!resolvedReal.startsWith(resolvedBase + sep14) && resolvedReal !== resolvedBase) {
113127
113292
  logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
113128
113293
  return false;
113129
113294
  }
@@ -113168,7 +113333,7 @@ async function removeInstallations(installations, options2) {
113168
113333
  scope: installation.type,
113169
113334
  kit: options2.kit
113170
113335
  });
113171
- await cleanupOldDestructiveOperationBackups(undefined, basename32(backup.backupDir));
113336
+ await cleanupOldDestructiveOperationBackups(undefined, basename33(backup.backupDir));
113172
113337
  backupSpinner.succeed(`Recovery backup saved to ${backup.backupDir}`);
113173
113338
  } catch (error) {
113174
113339
  backupSpinner.fail("Failed to create recovery backup");
@@ -113207,7 +113372,7 @@ async function removeInstallations(installations, options2) {
113207
113372
  }
113208
113373
  }
113209
113374
  try {
113210
- const remaining = readdirSync10(installation.path);
113375
+ const remaining = readdirSync11(installation.path);
113211
113376
  if (remaining.length === 0) {
113212
113377
  rmSync5(installation.path, { recursive: true });
113213
113378
  logger.debug(`Removed empty installation directory: ${installation.path}`);
@@ -113589,7 +113754,7 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
113589
113754
 
113590
113755
  // src/commands/watch/watch-command.ts
113591
113756
  init_logger();
113592
- import { existsSync as existsSync76 } from "node:fs";
113757
+ import { existsSync as existsSync77 } from "node:fs";
113593
113758
  import { rm as rm19 } from "node:fs/promises";
113594
113759
  import { join as join159 } from "node:path";
113595
113760
  var import_picocolors41 = __toESM(require_picocolors(), 1);
@@ -114888,14 +115053,14 @@ function cleanExpiredIssues(state, ttlDays) {
114888
115053
  init_ck_config_manager();
114889
115054
  init_file_io();
114890
115055
  init_logger();
114891
- import { existsSync as existsSync72 } from "node:fs";
115056
+ import { existsSync as existsSync73 } from "node:fs";
114892
115057
  import { mkdir as mkdir41, readFile as readFile68 } from "node:fs/promises";
114893
- import { dirname as dirname48 } from "node:path";
115058
+ import { dirname as dirname49 } from "node:path";
114894
115059
  var PROCESSED_ISSUES_CAP = 500;
114895
115060
  async function readCkJson(projectDir) {
114896
115061
  const configPath = CkConfigManager.getProjectConfigPath(projectDir);
114897
115062
  try {
114898
- if (!existsSync72(configPath))
115063
+ if (!existsSync73(configPath))
114899
115064
  return {};
114900
115065
  const content = await readFile68(configPath, "utf-8");
114901
115066
  return JSON.parse(content);
@@ -114920,8 +115085,8 @@ async function loadWatchState(projectDir) {
114920
115085
  }
114921
115086
  async function saveWatchState(projectDir, state) {
114922
115087
  const configPath = CkConfigManager.getProjectConfigPath(projectDir);
114923
- const configDir = dirname48(configPath);
114924
- if (!existsSync72(configDir)) {
115088
+ const configDir = dirname49(configPath);
115089
+ if (!existsSync73(configDir)) {
114925
115090
  await mkdir41(configDir, { recursive: true });
114926
115091
  }
114927
115092
  const raw2 = await readCkJson(projectDir);
@@ -115048,7 +115213,7 @@ async function processImplementationQueue(state, config, setup, options2, watchL
115048
115213
  // src/commands/watch/phases/repo-scanner.ts
115049
115214
  init_logger();
115050
115215
  import { spawnSync as spawnSync7 } from "node:child_process";
115051
- import { existsSync as existsSync73 } from "node:fs";
115216
+ import { existsSync as existsSync74 } from "node:fs";
115052
115217
  import { readdir as readdir46, stat as stat25 } from "node:fs/promises";
115053
115218
  import { join as join156 } from "node:path";
115054
115219
  async function scanForRepos(parentDir) {
@@ -115062,7 +115227,7 @@ async function scanForRepos(parentDir) {
115062
115227
  if (!entryStat.isDirectory())
115063
115228
  continue;
115064
115229
  const gitDir = join156(fullPath, ".git");
115065
- if (!existsSync73(gitDir))
115230
+ if (!existsSync74(gitDir))
115066
115231
  continue;
115067
115232
  const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
115068
115233
  encoding: "utf-8",
@@ -115086,8 +115251,8 @@ async function scanForRepos(parentDir) {
115086
115251
  // src/commands/watch/phases/setup-validator.ts
115087
115252
  init_logger();
115088
115253
  import { spawnSync as spawnSync8 } from "node:child_process";
115089
- import { existsSync as existsSync74 } from "node:fs";
115090
- import { homedir as homedir53 } from "node:os";
115254
+ import { existsSync as existsSync75 } from "node:fs";
115255
+ import { homedir as homedir54 } from "node:os";
115091
115256
  import { join as join157 } from "node:path";
115092
115257
  async function validateSetup(cwd2) {
115093
115258
  const workDir = cwd2 ?? process.cwd();
@@ -115119,8 +115284,8 @@ Run this command from a directory with a GitHub remote.`);
115119
115284
  } catch {
115120
115285
  throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
115121
115286
  }
115122
- const skillsPath = join157(homedir53(), ".claude", "skills");
115123
- const skillsAvailable = existsSync74(skillsPath);
115287
+ const skillsPath = join157(homedir54(), ".claude", "skills");
115288
+ const skillsAvailable = existsSync75(skillsPath);
115124
115289
  if (!skillsAvailable) {
115125
115290
  logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
115126
115291
  }
@@ -115136,7 +115301,7 @@ Run this command from a directory with a GitHub remote.`);
115136
115301
  init_logger();
115137
115302
  init_path_resolver();
115138
115303
  import { createWriteStream as createWriteStream3, statSync as statSync13 } from "node:fs";
115139
- import { existsSync as existsSync75 } from "node:fs";
115304
+ import { existsSync as existsSync76 } from "node:fs";
115140
115305
  import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
115141
115306
  import { join as join158 } from "node:path";
115142
115307
 
@@ -115151,7 +115316,7 @@ class WatchLogger {
115151
115316
  }
115152
115317
  async init() {
115153
115318
  try {
115154
- if (!existsSync75(this.logDir)) {
115319
+ if (!existsSync76(this.logDir)) {
115155
115320
  await mkdir42(this.logDir, { recursive: true });
115156
115321
  }
115157
115322
  const dateStr = formatDate(new Date);
@@ -115337,7 +115502,7 @@ async function watchCommand(options2) {
115337
115502
  }
115338
115503
  async function discoverRepos(options2, watchLog) {
115339
115504
  const cwd2 = process.cwd();
115340
- const isGitRepo = existsSync76(join159(cwd2, ".git"));
115505
+ const isGitRepo = existsSync77(join159(cwd2, ".git"));
115341
115506
  if (options2.force) {
115342
115507
  await forceRemoveLock(watchLog);
115343
115508
  }
@@ -115594,7 +115759,7 @@ function registerCommands(cli) {
115594
115759
  // src/cli/version-display.ts
115595
115760
  init_package();
115596
115761
  init_config_version_checker();
115597
- import { existsSync as existsSync88, readFileSync as readFileSync22 } from "node:fs";
115762
+ import { existsSync as existsSync89, readFileSync as readFileSync22 } from "node:fs";
115598
115763
  import { join as join171 } from "node:path";
115599
115764
 
115600
115765
  // src/domains/versioning/version-checker.ts
@@ -115608,7 +115773,7 @@ init_types3();
115608
115773
  // src/domains/versioning/version-cache.ts
115609
115774
  init_logger();
115610
115775
  init_path_resolver();
115611
- import { existsSync as existsSync87 } from "node:fs";
115776
+ import { existsSync as existsSync88 } from "node:fs";
115612
115777
  import { mkdir as mkdir43, readFile as readFile70, writeFile as writeFile42 } from "node:fs/promises";
115613
115778
  import { join as join170 } from "node:path";
115614
115779
 
@@ -115622,7 +115787,7 @@ class VersionCacheManager {
115622
115787
  static async load() {
115623
115788
  const cacheFile = VersionCacheManager.getCacheFile();
115624
115789
  try {
115625
- if (!existsSync87(cacheFile)) {
115790
+ if (!existsSync88(cacheFile)) {
115626
115791
  logger.debug("Version check cache not found");
115627
115792
  return null;
115628
115793
  }
@@ -115643,7 +115808,7 @@ class VersionCacheManager {
115643
115808
  const cacheFile = VersionCacheManager.getCacheFile();
115644
115809
  const cacheDir = PathResolver.getCacheDir(false);
115645
115810
  try {
115646
- if (!existsSync87(cacheDir)) {
115811
+ if (!existsSync88(cacheDir)) {
115647
115812
  await mkdir43(cacheDir, { recursive: true, mode: 448 });
115648
115813
  }
115649
115814
  await writeFile42(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
@@ -115665,7 +115830,7 @@ class VersionCacheManager {
115665
115830
  static async clear() {
115666
115831
  const cacheFile = VersionCacheManager.getCacheFile();
115667
115832
  try {
115668
- if (existsSync87(cacheFile)) {
115833
+ if (existsSync88(cacheFile)) {
115669
115834
  const fs20 = await import("node:fs/promises");
115670
115835
  await fs20.unlink(cacheFile);
115671
115836
  logger.debug("Version check cache cleared");
@@ -115932,7 +116097,7 @@ async function displayVersion() {
115932
116097
  const prefix = PathResolver.getPathPrefix(false);
115933
116098
  const localMetadataPath = prefix ? join171(process.cwd(), prefix, "metadata.json") : join171(process.cwd(), "metadata.json");
115934
116099
  const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
115935
- if (!isLocalSameAsGlobal && existsSync88(localMetadataPath)) {
116100
+ if (!isLocalSameAsGlobal && existsSync89(localMetadataPath)) {
115936
116101
  try {
115937
116102
  const rawMetadata = JSON.parse(readFileSync22(localMetadataPath, "utf-8"));
115938
116103
  const metadata = MetadataSchema.parse(rawMetadata);
@@ -115946,7 +116111,7 @@ async function displayVersion() {
115946
116111
  logger.verbose("Failed to parse local metadata.json", { error });
115947
116112
  }
115948
116113
  }
115949
- if (existsSync88(globalMetadataPath)) {
116114
+ if (existsSync89(globalMetadataPath)) {
115950
116115
  try {
115951
116116
  const rawMetadata = JSON.parse(readFileSync22(globalMetadataPath, "utf-8"));
115952
116117
  const metadata = MetadataSchema.parse(rawMetadata);