claudekit-cli 4.3.1-dev.7 → 4.3.1-dev.9

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
@@ -55181,8 +55181,7 @@ var init_generated_context_hooks = __esm(() => {
55181
55181
  "session-state.cjs",
55182
55182
  "subagent-init.cjs",
55183
55183
  "team-context-inject.cjs",
55184
- "usage-context-awareness.cjs",
55185
- "usage-quota-cache-refresh.cjs"
55184
+ "usage-context-awareness.cjs"
55186
55185
  ]);
55187
55186
  });
55188
55187
 
@@ -63358,7 +63357,7 @@ var package_default;
63358
63357
  var init_package = __esm(() => {
63359
63358
  package_default = {
63360
63359
  name: "claudekit-cli",
63361
- version: "4.3.1-dev.7",
63360
+ version: "4.3.1-dev.9",
63362
63361
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
63363
63362
  type: "module",
63364
63363
  repository: {
@@ -63852,6 +63851,20 @@ import { existsSync as existsSync44, readFileSync as readFileSync12, statSync as
63852
63851
  import { readdir as readdir17 } from "node:fs/promises";
63853
63852
  import { homedir as homedir40, tmpdir } from "node:os";
63854
63853
  import { join as join64, resolve as resolve32 } from "node:path";
63854
+ function resolveDoctorCkExecutable(platformName = process.platform) {
63855
+ return platformName === "win32" ? "ck.cmd" : "ck";
63856
+ }
63857
+ function parseDoctorCliVersionOutput(output2) {
63858
+ if (!output2.trim()) {
63859
+ return null;
63860
+ }
63861
+ const labeledMatch = output2.match(/CLI Version:\s*v?(\d+\.\d+\.\d+(?:-[^\s]+)?)/);
63862
+ if (labeledMatch?.[1]) {
63863
+ return labeledMatch[1];
63864
+ }
63865
+ const bareMatch = output2.trim().match(/^v?(\d+\.\d+\.\d+(?:-[^\s]+)?)/);
63866
+ return bareMatch?.[1] ?? null;
63867
+ }
63855
63868
  function getHooksDir(projectDir) {
63856
63869
  const projectHooksDir = resolve32(projectDir, ".claude", "hooks");
63857
63870
  const globalHooksDir = resolve32(PathResolver.getGlobalKitDir(), "hooks");
@@ -64880,15 +64893,15 @@ async function checkHookLogs(projectDir) {
64880
64893
  }
64881
64894
  async function checkCliVersion() {
64882
64895
  try {
64883
- const versionResult = spawnSync3("ck", ["-V"], {
64896
+ const versionResult = spawnSync3(resolveDoctorCkExecutable(), ["-V"], {
64884
64897
  timeout: HOOK_CHECK_TIMEOUT_MS,
64885
64898
  encoding: "utf-8"
64886
64899
  });
64887
- let installedVersion = "unknown";
64900
+ let installedVersion = null;
64888
64901
  if (versionResult.status === 0 && versionResult.stdout) {
64889
- installedVersion = versionResult.stdout.trim();
64902
+ installedVersion = parseDoctorCliVersionOutput(versionResult.stdout);
64890
64903
  }
64891
- if (installedVersion === "unknown") {
64904
+ if (!installedVersion) {
64892
64905
  return {
64893
64906
  id: "cli-version",
64894
64907
  name: "CLI Version",
@@ -66539,6 +66552,9 @@ var init_github_client = __esm(() => {
66539
66552
 
66540
66553
  // src/commands/update/post-update-handler.ts
66541
66554
  import { exec as exec2, spawn as spawn2 } from "node:child_process";
66555
+ import { existsSync as existsSync46 } from "node:fs";
66556
+ import { readdir as readdir19 } from "node:fs/promises";
66557
+ import { builtinModules } from "node:module";
66542
66558
  import { join as join68 } from "node:path";
66543
66559
  import { promisify as promisify9 } from "node:util";
66544
66560
  function selectKitForUpdate(params) {
@@ -66631,6 +66647,32 @@ async function fetchLatestReleaseTag(kit, beta) {
66631
66647
  return null;
66632
66648
  }
66633
66649
  }
66650
+ async function findMissingHookDependencies(claudeDir3) {
66651
+ const hooksDir = join68(claudeDir3, "hooks");
66652
+ if (!existsSync46(hooksDir))
66653
+ return [];
66654
+ const files = await readdir19(hooksDir);
66655
+ const cjsFiles = files.filter((file) => file.endsWith(".cjs"));
66656
+ const missing = [];
66657
+ const nodeBuiltins = new Set([
66658
+ ...builtinModules,
66659
+ ...builtinModules.map((name) => `node:${name}`)
66660
+ ]);
66661
+ for (const file of cjsFiles) {
66662
+ const content = await import_fs_extra8.readFile(join68(hooksDir, file), "utf8");
66663
+ const requireRegex = /require\(['"]([^'"]+)['"]\)/g;
66664
+ for (let match = requireRegex.exec(content);match; match = requireRegex.exec(content)) {
66665
+ const depPath = match[1];
66666
+ if (!depPath || nodeBuiltins.has(depPath) || !depPath.startsWith("."))
66667
+ continue;
66668
+ const resolvedPath = join68(hooksDir, depPath);
66669
+ const exists = existsSync46(resolvedPath) || HOOK_DEPENDENCY_EXTENSIONS.some((ext) => existsSync46(resolvedPath + ext)) || existsSync46(join68(resolvedPath, "index.js")) || existsSync46(join68(resolvedPath, "index.cjs")) || existsSync46(join68(resolvedPath, "index.mjs"));
66670
+ if (!exists)
66671
+ missing.push(`${file}: ${depPath}`);
66672
+ }
66673
+ }
66674
+ return missing;
66675
+ }
66634
66676
  async function promptKitUpdate(beta, yes, deps) {
66635
66677
  try {
66636
66678
  const execFn = deps?.execAsyncFn ?? execAsync2;
@@ -66638,6 +66680,7 @@ async function promptKitUpdate(beta, yes, deps) {
66638
66680
  const confirmFn = deps?.confirmFn ?? se;
66639
66681
  const isCancelFn = deps?.isCancelFn ?? lD;
66640
66682
  const getSetupFn = deps?.getSetupFn ?? getClaudeKitSetup;
66683
+ const findMissingHookDepsFn = deps?.findMissingHookDependenciesFn ?? findMissingHookDependencies;
66641
66684
  const setup = await getSetupFn();
66642
66685
  const hasLocal = !!setup.project.metadata;
66643
66686
  const hasGlobal = !!setup.global.metadata;
@@ -66661,19 +66704,32 @@ async function promptKitUpdate(beta, yes, deps) {
66661
66704
  const getTagFn = deps?.getLatestReleaseTagFn ?? fetchLatestReleaseTag;
66662
66705
  const latestTag = await getTagFn(selection.kit, beta || isBetaInstalled);
66663
66706
  if (latestTag && versionsMatch(kitVersion, latestTag)) {
66664
- logger.success(`Already at latest version (${selection.kit}@${kitVersion}), skipping reinstall`);
66665
66707
  alreadyAtLatest = true;
66666
66708
  } else if (latestTag) {
66667
66709
  logger.info(`Kit update available: ${kitVersion} -> ${latestTag}`);
66668
66710
  }
66669
66711
  }
66712
+ if (alreadyAtLatest) {
66713
+ try {
66714
+ const claudeDir3 = selection.isGlobal ? setup.global.path : setup.project.path;
66715
+ const missingHookDeps = claudeDir3 ? await findMissingHookDepsFn(claudeDir3) : [];
66716
+ if (missingHookDeps.length > 0) {
66717
+ logger.warning(`Detected ${missingHookDeps.length} missing hook dependency(ies); reinstalling kit content`);
66718
+ alreadyAtLatest = false;
66719
+ }
66720
+ } catch (error) {
66721
+ logger.verbose(`Hook dependency self-heal check skipped: ${error instanceof Error ? error.message : "unknown"}`);
66722
+ }
66723
+ }
66670
66724
  let autoInit = false;
66671
66725
  try {
66672
66726
  const ckConfig = await loadFullConfigFn(null);
66673
66727
  autoInit = ckConfig.config.updatePipeline?.autoInitAfterUpdate ?? false;
66674
66728
  } catch {}
66675
- if (alreadyAtLatest && !autoInit)
66729
+ if (alreadyAtLatest && !autoInit) {
66730
+ logger.success(`Already at latest version (${selection.kit}@${kitVersion}), skipping reinstall`);
66676
66731
  return;
66732
+ }
66677
66733
  if (!yes && !autoInit) {
66678
66734
  logger.info("");
66679
66735
  const shouldUpdate = await confirmFn({ message: promptMessage });
@@ -66859,7 +66915,7 @@ async function promptMigrateUpdate(deps) {
66859
66915
  logger.verbose(`Migrate step skipped: ${error instanceof Error ? error.message : "unknown"}`);
66860
66916
  }
66861
66917
  }
66862
- var import_fs_extra8, execAsync2, SAFE_PROVIDER_NAME;
66918
+ var import_fs_extra8, execAsync2, SAFE_PROVIDER_NAME, HOOK_DEPENDENCY_EXTENSIONS;
66863
66919
  var init_post_update_handler = __esm(() => {
66864
66920
  init_ck_config_manager();
66865
66921
  init_hook_health_checker();
@@ -66873,6 +66929,7 @@ var init_post_update_handler = __esm(() => {
66873
66929
  import_fs_extra8 = __toESM(require_lib(), 1);
66874
66930
  execAsync2 = promisify9(exec2);
66875
66931
  SAFE_PROVIDER_NAME = /^[a-z0-9-]+$/;
66932
+ HOOK_DEPENDENCY_EXTENSIONS = [".js", ".cjs", ".mjs", ".json"];
66876
66933
  });
66877
66934
 
66878
66935
  // src/commands/update-cli.ts
@@ -67268,7 +67325,7 @@ var init_config_version_checker = __esm(() => {
67268
67325
  // src/domains/web-server/routes/system-routes.ts
67269
67326
  import { spawn as spawn3 } from "node:child_process";
67270
67327
  import { execFile as execFile8 } from "node:child_process";
67271
- import { existsSync as existsSync46 } from "node:fs";
67328
+ import { existsSync as existsSync47 } from "node:fs";
67272
67329
  import { readFile as readFile38 } from "node:fs/promises";
67273
67330
  import { cpus, homedir as homedir41, totalmem } from "node:os";
67274
67331
  import { join as join70 } from "node:path";
@@ -67557,7 +67614,7 @@ async function getPackageJson() {
67557
67614
  async function getKitMetadata2(kitName) {
67558
67615
  try {
67559
67616
  const metadataPath = join70(PathResolver.getGlobalKitDir(), "metadata.json");
67560
- if (!existsSync46(metadataPath))
67617
+ if (!existsSync47(metadataPath))
67561
67618
  return null;
67562
67619
  const content = await readFile38(metadataPath, "utf-8");
67563
67620
  const metadata = JSON.parse(content);
@@ -67713,14 +67770,14 @@ var init_routes = __esm(() => {
67713
67770
  });
67714
67771
 
67715
67772
  // src/domains/web-server/static-server.ts
67716
- import { existsSync as existsSync47 } from "node:fs";
67773
+ import { existsSync as existsSync48 } from "node:fs";
67717
67774
  import { basename as basename23, dirname as dirname27, join as join71, resolve as resolve33 } from "node:path";
67718
67775
  import { fileURLToPath as fileURLToPath2 } from "node:url";
67719
67776
  function addRuntimeUiCandidate(candidates, runtimePath) {
67720
67777
  if (!runtimePath) {
67721
67778
  return;
67722
67779
  }
67723
- const looksLikePath = runtimePath.includes("/") || runtimePath.includes("\\") || existsSync47(runtimePath);
67780
+ const looksLikePath = runtimePath.includes("/") || runtimePath.includes("\\") || existsSync48(runtimePath);
67724
67781
  if (!looksLikePath) {
67725
67782
  return;
67726
67783
  }
@@ -67737,7 +67794,7 @@ function resolveUiDistPath() {
67737
67794
  candidates.add(join71(process.cwd(), "dist", "ui"));
67738
67795
  candidates.add(join71(process.cwd(), "src", "ui", "dist"));
67739
67796
  for (const path6 of candidates) {
67740
- if (existsSync47(join71(path6, "index.html"))) {
67797
+ if (existsSync48(join71(path6, "index.html"))) {
67741
67798
  return path6;
67742
67799
  }
67743
67800
  }
@@ -67745,7 +67802,7 @@ function resolveUiDistPath() {
67745
67802
  }
67746
67803
  function serveStatic(app) {
67747
67804
  const uiDistPath = resolveUiDistPath();
67748
- if (!existsSync47(uiDistPath)) {
67805
+ if (!existsSync48(uiDistPath)) {
67749
67806
  logger.warning(`UI dist not found at ${uiDistPath}. Run 'bun run ui:build' first.`);
67750
67807
  app.use((req, res, next) => {
67751
67808
  if (req.path.startsWith("/api/")) {
@@ -72858,7 +72915,7 @@ var init_opencode_installer = __esm(() => {
72858
72915
  var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CODE_PARTIAL_SUCCESS = 2;
72859
72916
 
72860
72917
  // src/services/package-installer/install-error-handler.ts
72861
- import { existsSync as existsSync59, readFileSync as readFileSync17, unlinkSync as unlinkSync3 } from "node:fs";
72918
+ import { existsSync as existsSync60, readFileSync as readFileSync17, unlinkSync as unlinkSync3 } from "node:fs";
72862
72919
  import { join as join90 } from "node:path";
72863
72920
  function parseNameReason(str2) {
72864
72921
  const colonIndex = str2.indexOf(":");
@@ -72923,7 +72980,7 @@ function getSystemPackageCommands(summary, systemFailures) {
72923
72980
  }
72924
72981
  function displayInstallErrors(skillsDir2) {
72925
72982
  const summaryPath = join90(skillsDir2, ".install-error-summary.json");
72926
- if (!existsSync59(summaryPath)) {
72983
+ if (!existsSync60(summaryPath)) {
72927
72984
  logger.error("Skills installation failed. Run with --verbose for details.");
72928
72985
  return;
72929
72986
  }
@@ -73022,7 +73079,7 @@ async function checkNeedsSudoPackages() {
73022
73079
  }
73023
73080
  function hasInstallState(skillsDir2) {
73024
73081
  const stateFilePath = join90(skillsDir2, ".install-state.json");
73025
- return existsSync59(stateFilePath);
73082
+ return existsSync60(stateFilePath);
73026
73083
  }
73027
73084
  var WHICH_COMMAND_TIMEOUT_MS = 5000, WINDOWS_SYSTEM_PACKAGES, SYSTEM_TOOL_KEYS, WINDOWS_RSVG_COMMANDS;
73028
73085
  var init_install_error_handler = __esm(() => {
@@ -73061,7 +73118,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
73061
73118
  };
73062
73119
  }
73063
73120
  try {
73064
- const { existsSync: existsSync60 } = await import("node:fs");
73121
+ const { existsSync: existsSync61 } = await import("node:fs");
73065
73122
  const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
73066
73123
  const platform9 = process.platform;
73067
73124
  const scriptName = platform9 === "win32" ? "install.ps1" : "install.sh";
@@ -73077,7 +73134,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
73077
73134
  error: `Path validation failed: ${errorMessage}`
73078
73135
  };
73079
73136
  }
73080
- if (!existsSync60(scriptPath)) {
73137
+ if (!existsSync61(scriptPath)) {
73081
73138
  logger.warning(`Skills installation script not found: ${scriptPath}`);
73082
73139
  logger.info("");
73083
73140
  logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
@@ -73293,7 +73350,7 @@ var init_skills_installer2 = __esm(() => {
73293
73350
  });
73294
73351
 
73295
73352
  // src/services/package-installer/gemini-mcp/config-manager.ts
73296
- import { existsSync as existsSync60 } from "node:fs";
73353
+ import { existsSync as existsSync61 } from "node:fs";
73297
73354
  import { mkdir as mkdir23, readFile as readFile47, writeFile as writeFile23 } from "node:fs/promises";
73298
73355
  import { dirname as dirname30, join as join92 } from "node:path";
73299
73356
  async function readJsonFile(filePath) {
@@ -73311,7 +73368,7 @@ async function addGeminiToGitignore(projectDir) {
73311
73368
  const geminiPattern = ".gemini/";
73312
73369
  try {
73313
73370
  let content = "";
73314
- if (existsSync60(gitignorePath)) {
73371
+ if (existsSync61(gitignorePath)) {
73315
73372
  content = await readFile47(gitignorePath, "utf-8");
73316
73373
  const lines = content.split(`
73317
73374
  `).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
@@ -73336,7 +73393,7 @@ ${geminiPattern}
73336
73393
  }
73337
73394
  async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
73338
73395
  const linkDir = dirname30(geminiSettingsPath);
73339
- if (!existsSync60(linkDir)) {
73396
+ if (!existsSync61(linkDir)) {
73340
73397
  await mkdir23(linkDir, { recursive: true });
73341
73398
  logger.debug(`Created directory: ${linkDir}`);
73342
73399
  }
@@ -73397,7 +73454,7 @@ var init_config_manager2 = __esm(() => {
73397
73454
  });
73398
73455
 
73399
73456
  // src/services/package-installer/gemini-mcp/validation.ts
73400
- import { existsSync as existsSync61, lstatSync, readlinkSync } from "node:fs";
73457
+ import { existsSync as existsSync62, lstatSync, readlinkSync } from "node:fs";
73401
73458
  import { homedir as homedir44 } from "node:os";
73402
73459
  import { join as join93 } from "node:path";
73403
73460
  function getGlobalMcpConfigPath() {
@@ -73408,12 +73465,12 @@ function getLocalMcpConfigPath(projectDir) {
73408
73465
  }
73409
73466
  function findMcpConfigPath(projectDir) {
73410
73467
  const localPath = getLocalMcpConfigPath(projectDir);
73411
- if (existsSync61(localPath)) {
73468
+ if (existsSync62(localPath)) {
73412
73469
  logger.debug(`Found local MCP config: ${localPath}`);
73413
73470
  return localPath;
73414
73471
  }
73415
73472
  const globalPath = getGlobalMcpConfigPath();
73416
- if (existsSync61(globalPath)) {
73473
+ if (existsSync62(globalPath)) {
73417
73474
  logger.debug(`Found global MCP config: ${globalPath}`);
73418
73475
  return globalPath;
73419
73476
  }
@@ -73428,7 +73485,7 @@ function getGeminiSettingsPath(projectDir, isGlobal) {
73428
73485
  }
73429
73486
  function checkExistingGeminiConfig(projectDir, isGlobal = false) {
73430
73487
  const geminiSettingsPath = getGeminiSettingsPath(projectDir, isGlobal);
73431
- if (!existsSync61(geminiSettingsPath)) {
73488
+ if (!existsSync62(geminiSettingsPath)) {
73432
73489
  return { exists: false, isSymlink: false, settingsPath: geminiSettingsPath };
73433
73490
  }
73434
73491
  try {
@@ -73452,12 +73509,12 @@ var init_validation = __esm(() => {
73452
73509
  });
73453
73510
 
73454
73511
  // src/services/package-installer/gemini-mcp/linker-core.ts
73455
- import { existsSync as existsSync62 } from "node:fs";
73512
+ import { existsSync as existsSync63 } from "node:fs";
73456
73513
  import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
73457
73514
  import { dirname as dirname31, join as join94 } from "node:path";
73458
73515
  async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
73459
73516
  const linkDir = dirname31(linkPath);
73460
- if (!existsSync62(linkDir)) {
73517
+ if (!existsSync63(linkDir)) {
73461
73518
  await mkdir24(linkDir, { recursive: true });
73462
73519
  logger.debug(`Created directory: ${linkDir}`);
73463
73520
  }
@@ -75880,7 +75937,7 @@ __export(exports_worktree_manager, {
75880
75937
  createWorktree: () => createWorktree,
75881
75938
  cleanupAllWorktrees: () => cleanupAllWorktrees
75882
75939
  });
75883
- import { existsSync as existsSync72 } from "node:fs";
75940
+ import { existsSync as existsSync73 } from "node:fs";
75884
75941
  import { readFile as readFile67, writeFile as writeFile38 } from "node:fs/promises";
75885
75942
  import { join as join153 } from "node:path";
75886
75943
  async function createWorktree(projectDir, issueNumber, baseBranch) {
@@ -75946,7 +76003,7 @@ async function cleanupAllWorktrees(projectDir) {
75946
76003
  async function ensureGitignore(projectDir) {
75947
76004
  const gitignorePath = join153(projectDir, ".gitignore");
75948
76005
  try {
75949
- const content = existsSync72(gitignorePath) ? await readFile67(gitignorePath, "utf-8") : "";
76006
+ const content = existsSync73(gitignorePath) ? await readFile67(gitignorePath, "utf-8") : "";
75950
76007
  if (!content.includes(".worktrees")) {
75951
76008
  const newContent = content.endsWith(`
75952
76009
  `) ? `${content}.worktrees/
@@ -76048,13 +76105,13 @@ var init_content_validator = __esm(() => {
76048
76105
 
76049
76106
  // src/commands/content/phases/context-cache-manager.ts
76050
76107
  import { createHash as createHash9 } from "node:crypto";
76051
- import { existsSync as existsSync78, mkdirSync as mkdirSync5, readFileSync as readFileSync18, readdirSync as readdirSync12, statSync as statSync14 } from "node:fs";
76108
+ import { existsSync as existsSync79, mkdirSync as mkdirSync5, readFileSync as readFileSync18, readdirSync as readdirSync12, statSync as statSync14 } from "node:fs";
76052
76109
  import { rename as rename16, writeFile as writeFile40 } from "node:fs/promises";
76053
76110
  import { homedir as homedir55 } from "node:os";
76054
76111
  import { basename as basename34, join as join160 } from "node:path";
76055
76112
  function getCachedContext(repoPath) {
76056
76113
  const cachePath = getCacheFilePath(repoPath);
76057
- if (!existsSync78(cachePath))
76114
+ if (!existsSync79(cachePath))
76058
76115
  return null;
76059
76116
  try {
76060
76117
  const raw2 = readFileSync18(cachePath, "utf-8");
@@ -76071,7 +76128,7 @@ function getCachedContext(repoPath) {
76071
76128
  }
76072
76129
  }
76073
76130
  async function saveCachedContext(repoPath, cache5) {
76074
- if (!existsSync78(CACHE_DIR)) {
76131
+ if (!existsSync79(CACHE_DIR)) {
76075
76132
  mkdirSync5(CACHE_DIR, { recursive: true });
76076
76133
  }
76077
76134
  const cachePath = getCacheFilePath(repoPath);
@@ -76095,7 +76152,7 @@ function computeSourceHash(repoPath) {
76095
76152
  function getDocSourcePaths(repoPath) {
76096
76153
  const paths = [];
76097
76154
  const docsDir = join160(repoPath, "docs");
76098
- if (existsSync78(docsDir)) {
76155
+ if (existsSync79(docsDir)) {
76099
76156
  try {
76100
76157
  const files = readdirSync12(docsDir);
76101
76158
  for (const f3 of files) {
@@ -76105,10 +76162,10 @@ function getDocSourcePaths(repoPath) {
76105
76162
  } catch {}
76106
76163
  }
76107
76164
  const readme = join160(repoPath, "README.md");
76108
- if (existsSync78(readme))
76165
+ if (existsSync79(readme))
76109
76166
  paths.push(readme);
76110
76167
  const stylesDir = join160(repoPath, "assets", "writing-styles");
76111
- if (existsSync78(stylesDir)) {
76168
+ if (existsSync79(stylesDir)) {
76112
76169
  try {
76113
76170
  const files = readdirSync12(stylesDir);
76114
76171
  for (const f3 of files) {
@@ -76305,7 +76362,7 @@ function extractContentFromResponse(response) {
76305
76362
 
76306
76363
  // src/commands/content/phases/docs-summarizer.ts
76307
76364
  import { execSync as execSync7 } from "node:child_process";
76308
- import { existsSync as existsSync79, readFileSync as readFileSync19, readdirSync as readdirSync13 } from "node:fs";
76365
+ import { existsSync as existsSync80, readFileSync as readFileSync19, readdirSync as readdirSync13 } from "node:fs";
76309
76366
  import { join as join161 } from "node:path";
76310
76367
  async function summarizeProjectDocs(repoPath, contentLogger) {
76311
76368
  const rawContent = collectRawDocs(repoPath);
@@ -76350,7 +76407,7 @@ async function summarizeProjectDocs(repoPath, contentLogger) {
76350
76407
  function collectRawDocs(repoPath) {
76351
76408
  let totalChars = 0;
76352
76409
  const readCapped = (filePath, maxChars) => {
76353
- if (!existsSync79(filePath))
76410
+ if (!existsSync80(filePath))
76354
76411
  return "";
76355
76412
  if (totalChars >= MAX_RAW_CONTENT_CHARS)
76356
76413
  return "";
@@ -76361,7 +76418,7 @@ function collectRawDocs(repoPath) {
76361
76418
  };
76362
76419
  const docsContent = [];
76363
76420
  const docsDir = join161(repoPath, "docs");
76364
- if (existsSync79(docsDir)) {
76421
+ if (existsSync80(docsDir)) {
76365
76422
  try {
76366
76423
  const files = readdirSync13(docsDir).filter((f3) => f3.endsWith(".md")).sort();
76367
76424
  for (const f3 of files) {
@@ -76385,7 +76442,7 @@ ${content}`);
76385
76442
  }
76386
76443
  let styles3 = "";
76387
76444
  const stylesDir = join161(repoPath, "assets", "writing-styles");
76388
- if (existsSync79(stylesDir)) {
76445
+ if (existsSync80(stylesDir)) {
76389
76446
  try {
76390
76447
  const files = readdirSync13(stylesDir).slice(0, 3);
76391
76448
  styles3 = files.map((f3) => readCapped(join161(stylesDir, f3), 1000)).filter(Boolean).join(`
@@ -76578,12 +76635,12 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
76578
76635
 
76579
76636
  // src/commands/content/phases/photo-generator.ts
76580
76637
  import { execSync as execSync8 } from "node:child_process";
76581
- import { existsSync as existsSync80, mkdirSync as mkdirSync6, readdirSync as readdirSync14 } from "node:fs";
76638
+ import { existsSync as existsSync81, mkdirSync as mkdirSync6, readdirSync as readdirSync14 } from "node:fs";
76582
76639
  import { homedir as homedir56 } from "node:os";
76583
76640
  import { join as join162 } from "node:path";
76584
76641
  async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
76585
76642
  const mediaDir = join162(config.contentDir.replace(/^~/, homedir56()), "media", String(contentId));
76586
- if (!existsSync80(mediaDir)) {
76643
+ if (!existsSync81(mediaDir)) {
76587
76644
  mkdirSync6(mediaDir, { recursive: true });
76588
76645
  }
76589
76646
  const prompt = buildPhotoPrompt(context, platform18);
@@ -76599,7 +76656,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
76599
76656
  const parsed = parseClaudeJsonOutput(result);
76600
76657
  if (parsed && typeof parsed === "object" && "imagePath" in parsed) {
76601
76658
  const imagePath = String(parsed.imagePath);
76602
- if (existsSync80(imagePath)) {
76659
+ if (existsSync81(imagePath)) {
76603
76660
  return { path: imagePath, ...dimensions, format: "png" };
76604
76661
  }
76605
76662
  }
@@ -76695,7 +76752,7 @@ var init_content_creator = __esm(() => {
76695
76752
  });
76696
76753
 
76697
76754
  // src/commands/content/phases/content-logger.ts
76698
- import { createWriteStream as createWriteStream4, existsSync as existsSync81, mkdirSync as mkdirSync7, statSync as statSync15 } from "node:fs";
76755
+ import { createWriteStream as createWriteStream4, existsSync as existsSync82, mkdirSync as mkdirSync7, statSync as statSync15 } from "node:fs";
76699
76756
  import { homedir as homedir57 } from "node:os";
76700
76757
  import { join as join163 } from "node:path";
76701
76758
 
@@ -76709,7 +76766,7 @@ class ContentLogger {
76709
76766
  this.maxBytes = maxBytes;
76710
76767
  }
76711
76768
  init() {
76712
- if (!existsSync81(this.logDir)) {
76769
+ if (!existsSync82(this.logDir)) {
76713
76770
  mkdirSync7(this.logDir, { recursive: true });
76714
76771
  }
76715
76772
  this.rotateIfNeeded();
@@ -76802,7 +76859,7 @@ function openDatabase(dbPath) {
76802
76859
  var init_sqlite_client = () => {};
76803
76860
 
76804
76861
  // src/commands/content/phases/db-manager.ts
76805
- import { existsSync as existsSync82, mkdirSync as mkdirSync8 } from "node:fs";
76862
+ import { existsSync as existsSync83, mkdirSync as mkdirSync8 } from "node:fs";
76806
76863
  import { dirname as dirname50 } from "node:path";
76807
76864
  function initDatabase(dbPath) {
76808
76865
  ensureParentDir(dbPath);
@@ -76825,7 +76882,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
76825
76882
  }
76826
76883
  function ensureParentDir(dbPath) {
76827
76884
  const dir = dirname50(dbPath);
76828
- if (dir && !existsSync82(dir)) {
76885
+ if (dir && !existsSync83(dir)) {
76829
76886
  mkdirSync8(dir, { recursive: true });
76830
76887
  }
76831
76888
  }
@@ -76990,7 +77047,7 @@ function isNoiseCommit(title, author) {
76990
77047
 
76991
77048
  // src/commands/content/phases/change-detector.ts
76992
77049
  import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
76993
- import { existsSync as existsSync83, readFileSync as readFileSync20, readdirSync as readdirSync15, statSync as statSync16 } from "node:fs";
77050
+ import { existsSync as existsSync84, readFileSync as readFileSync20, readdirSync as readdirSync15, statSync as statSync16 } from "node:fs";
76994
77051
  import { join as join164 } from "node:path";
76995
77052
  function detectCommits(repo, since) {
76996
77053
  try {
@@ -77101,7 +77158,7 @@ function detectTags(repo, since) {
77101
77158
  }
77102
77159
  function detectCompletedPlans(repo, since) {
77103
77160
  const plansDir = join164(repo.path, "plans");
77104
- if (!existsSync83(plansDir))
77161
+ if (!existsSync84(plansDir))
77105
77162
  return [];
77106
77163
  const sinceMs = new Date(since).getTime();
77107
77164
  const events = [];
@@ -77111,7 +77168,7 @@ function detectCompletedPlans(repo, since) {
77111
77168
  if (!entry.isDirectory())
77112
77169
  continue;
77113
77170
  const planFile = join164(plansDir, entry.name, "plan.md");
77114
- if (!existsSync83(planFile))
77171
+ if (!existsSync84(planFile))
77115
77172
  continue;
77116
77173
  try {
77117
77174
  const stat26 = statSync16(planFile);
@@ -78179,7 +78236,7 @@ var init_platform_setup_x = __esm(() => {
78179
78236
  });
78180
78237
 
78181
78238
  // src/commands/content/phases/setup-wizard.ts
78182
- import { existsSync as existsSync84 } from "node:fs";
78239
+ import { existsSync as existsSync85 } from "node:fs";
78183
78240
  import { join as join167 } from "node:path";
78184
78241
  async function runSetupWizard2(cwd2, contentLogger) {
78185
78242
  console.log();
@@ -78248,8 +78305,8 @@ async function showRepoSummary(cwd2) {
78248
78305
  function detectBrandAssets(cwd2, contentLogger) {
78249
78306
  const repos = discoverRepos2(cwd2);
78250
78307
  for (const repo of repos) {
78251
- const hasGuidelines = existsSync84(join167(repo.path, "docs", "brand-guidelines.md"));
78252
- const hasStyles = existsSync84(join167(repo.path, "assets", "writing-styles"));
78308
+ const hasGuidelines = existsSync85(join167(repo.path, "docs", "brand-guidelines.md"));
78309
+ const hasStyles = existsSync85(join167(repo.path, "assets", "writing-styles"));
78253
78310
  if (!hasGuidelines) {
78254
78311
  f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
78255
78312
  contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
@@ -78315,13 +78372,13 @@ var init_setup_wizard = __esm(() => {
78315
78372
  });
78316
78373
 
78317
78374
  // src/commands/content/content-review-commands.ts
78318
- import { existsSync as existsSync85 } from "node:fs";
78375
+ import { existsSync as existsSync86 } from "node:fs";
78319
78376
  import { homedir as homedir58 } from "node:os";
78320
78377
  async function queueContent() {
78321
78378
  const cwd2 = process.cwd();
78322
78379
  const config = await loadContentConfig(cwd2);
78323
78380
  const dbPath = config.dbPath.replace(/^~/, homedir58());
78324
- if (!existsSync85(dbPath)) {
78381
+ if (!existsSync86(dbPath)) {
78325
78382
  logger.info("No content database found. Run 'ck content setup' first.");
78326
78383
  return;
78327
78384
  }
@@ -78389,12 +78446,12 @@ __export(exports_content_subcommands, {
78389
78446
  logsContent: () => logsContent,
78390
78447
  approveContentCmd: () => approveContentCmd
78391
78448
  });
78392
- import { existsSync as existsSync86, readFileSync as readFileSync21, unlinkSync as unlinkSync6 } from "node:fs";
78449
+ import { existsSync as existsSync87, readFileSync as readFileSync21, unlinkSync as unlinkSync6 } from "node:fs";
78393
78450
  import { homedir as homedir59 } from "node:os";
78394
78451
  import { join as join168 } from "node:path";
78395
78452
  function isDaemonRunning() {
78396
78453
  const lockFile = join168(LOCK_DIR, `${LOCK_NAME2}.lock`);
78397
- if (!existsSync86(lockFile))
78454
+ if (!existsSync87(lockFile))
78398
78455
  return { running: false, pid: null };
78399
78456
  try {
78400
78457
  const pidStr = readFileSync21(lockFile, "utf-8").trim();
@@ -78426,7 +78483,7 @@ async function startContent(options2) {
78426
78483
  }
78427
78484
  async function stopContent() {
78428
78485
  const lockFile = join168(LOCK_DIR, `${LOCK_NAME2}.lock`);
78429
- if (!existsSync86(lockFile)) {
78486
+ if (!existsSync87(lockFile)) {
78430
78487
  logger.info("Content daemon is not running.");
78431
78488
  return;
78432
78489
  }
@@ -78467,7 +78524,7 @@ async function logsContent(options2) {
78467
78524
  const logDir = join168(homedir59(), ".claudekit", "logs");
78468
78525
  const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
78469
78526
  const logPath = join168(logDir, `content-${dateStr}.log`);
78470
- if (!existsSync86(logPath)) {
78527
+ if (!existsSync87(logPath)) {
78471
78528
  logger.info("No content logs found for today.");
78472
78529
  return;
78473
78530
  }
@@ -78502,7 +78559,7 @@ var init_content_subcommands = __esm(() => {
78502
78559
  });
78503
78560
 
78504
78561
  // src/commands/content/content-command.ts
78505
- import { existsSync as existsSync87, mkdirSync as mkdirSync9, unlinkSync as unlinkSync7, writeFileSync as writeFileSync7 } from "node:fs";
78562
+ import { existsSync as existsSync88, mkdirSync as mkdirSync9, unlinkSync as unlinkSync7, writeFileSync as writeFileSync7 } from "node:fs";
78506
78563
  import { homedir as homedir60 } from "node:os";
78507
78564
  import { join as join169 } from "node:path";
78508
78565
  async function contentCommand(options2) {
@@ -78533,7 +78590,7 @@ async function contentCommand(options2) {
78533
78590
  }
78534
78591
  contentLogger.info("Setup complete. Starting daemon...");
78535
78592
  }
78536
- if (!existsSync87(LOCK_DIR2))
78593
+ if (!existsSync88(LOCK_DIR2))
78537
78594
  mkdirSync9(LOCK_DIR2, { recursive: true });
78538
78595
  writeFileSync7(LOCK_FILE, String(process.pid), "utf-8");
78539
78596
  const dbPath = config.dbPath.replace(/^~/, homedir60());
@@ -86620,7 +86677,7 @@ async function checkCliInstallMethod() {
86620
86677
  };
86621
86678
  }
86622
86679
  // src/domains/health-checks/checkers/claude-md-checker.ts
86623
- import { existsSync as existsSync49, statSync as statSync10 } from "node:fs";
86680
+ import { existsSync as existsSync50, statSync as statSync10 } from "node:fs";
86624
86681
  import { join as join72 } from "node:path";
86625
86682
  function checkClaudeMd(setup, projectDir) {
86626
86683
  const results = [];
@@ -86633,7 +86690,7 @@ function checkClaudeMd(setup, projectDir) {
86633
86690
  return results;
86634
86691
  }
86635
86692
  function checkClaudeMdFile(path6, name, id) {
86636
- if (!existsSync49(path6)) {
86693
+ if (!existsSync50(path6)) {
86637
86694
  return {
86638
86695
  id,
86639
86696
  name,
@@ -86686,11 +86743,11 @@ function checkClaudeMdFile(path6, name, id) {
86686
86743
  }
86687
86744
  }
86688
86745
  // src/domains/health-checks/checkers/active-plan-checker.ts
86689
- import { existsSync as existsSync50, readFileSync as readFileSync15 } from "node:fs";
86746
+ import { existsSync as existsSync51, readFileSync as readFileSync15 } from "node:fs";
86690
86747
  import { join as join73 } from "node:path";
86691
86748
  function checkActivePlan(projectDir) {
86692
86749
  const activePlanPath = join73(projectDir, ".claude", "active-plan");
86693
- if (!existsSync50(activePlanPath)) {
86750
+ if (!existsSync51(activePlanPath)) {
86694
86751
  return {
86695
86752
  id: "ck-active-plan",
86696
86753
  name: "Active Plan",
@@ -86704,7 +86761,7 @@ function checkActivePlan(projectDir) {
86704
86761
  try {
86705
86762
  const targetPath = readFileSync15(activePlanPath, "utf-8").trim();
86706
86763
  const fullPath = join73(projectDir, targetPath);
86707
- if (!existsSync50(fullPath)) {
86764
+ if (!existsSync51(fullPath)) {
86708
86765
  return {
86709
86766
  id: "ck-active-plan",
86710
86767
  name: "Active Plan",
@@ -86740,7 +86797,7 @@ function checkActivePlan(projectDir) {
86740
86797
  }
86741
86798
  }
86742
86799
  // src/domains/health-checks/checkers/skills-checker.ts
86743
- import { existsSync as existsSync51 } from "node:fs";
86800
+ import { existsSync as existsSync52 } from "node:fs";
86744
86801
  import { join as join74 } from "node:path";
86745
86802
  function checkSkillsScripts(setup) {
86746
86803
  const results = [];
@@ -86748,7 +86805,7 @@ function checkSkillsScripts(setup) {
86748
86805
  const scriptName = platform7 === "win32" ? "install.ps1" : "install.sh";
86749
86806
  if (setup.global.path) {
86750
86807
  const globalScriptPath = join74(setup.global.path, "skills", scriptName);
86751
- const hasGlobalScript = existsSync51(globalScriptPath);
86808
+ const hasGlobalScript = existsSync52(globalScriptPath);
86752
86809
  results.push({
86753
86810
  id: "ck-global-skills-script",
86754
86811
  name: "Global Skills Script",
@@ -86763,7 +86820,7 @@ function checkSkillsScripts(setup) {
86763
86820
  }
86764
86821
  if (setup.project.metadata) {
86765
86822
  const projectScriptPath = join74(setup.project.path, "skills", scriptName);
86766
- const hasProjectScript = existsSync51(projectScriptPath);
86823
+ const hasProjectScript = existsSync52(projectScriptPath);
86767
86824
  results.push({
86768
86825
  id: "ck-project-skills-script",
86769
86826
  name: "Project Skills Script",
@@ -86803,12 +86860,12 @@ import { join as join76, resolve as resolve34 } from "node:path";
86803
86860
 
86804
86861
  // src/domains/health-checks/checkers/skill-budget-scanner.ts
86805
86862
  var import_gray_matter11 = __toESM(require_gray_matter(), 1);
86806
- import { existsSync as existsSync52 } from "node:fs";
86807
- import { readFile as readFile39, readdir as readdir19 } from "node:fs/promises";
86863
+ import { existsSync as existsSync53 } from "node:fs";
86864
+ import { readFile as readFile39, readdir as readdir20 } from "node:fs/promises";
86808
86865
  import { basename as basename24, join as join75, relative as relative16 } from "node:path";
86809
86866
  var SKIP_DIRS5 = new Set([".git", ".venv", "__pycache__", "node_modules", "scripts", "common"]);
86810
86867
  async function scanSkills2(skillsDir2) {
86811
- if (!existsSync52(skillsDir2))
86868
+ if (!existsSync53(skillsDir2))
86812
86869
  return [];
86813
86870
  const skillDirs = await findSkillDirs(skillsDir2);
86814
86871
  const skills = [];
@@ -86833,14 +86890,14 @@ async function scanSkills2(skillsDir2) {
86833
86890
  async function findSkillDirs(dir) {
86834
86891
  let entries;
86835
86892
  try {
86836
- entries = await readdir19(dir, { withFileTypes: true });
86893
+ entries = await readdir20(dir, { withFileTypes: true });
86837
86894
  } catch {
86838
86895
  return [];
86839
86896
  }
86840
86897
  const results = [];
86841
86898
  for (const entry of entries) {
86842
86899
  const child = join75(dir, entry.name);
86843
- if (existsSync52(join75(child, "SKILL.md"))) {
86900
+ if (existsSync53(join75(child, "SKILL.md"))) {
86844
86901
  results.push(child);
86845
86902
  continue;
86846
86903
  }
@@ -86858,7 +86915,7 @@ function normalizeSkillId(rawName, fallbackId) {
86858
86915
 
86859
86916
  // src/domains/health-checks/checkers/skill-budget-settings.ts
86860
86917
  init_settings_merger();
86861
- import { existsSync as existsSync53 } from "node:fs";
86918
+ import { existsSync as existsSync54 } from "node:fs";
86862
86919
  import { mkdir as mkdir20, readFile as readFile40 } from "node:fs/promises";
86863
86920
  var CONTEXT_FLOOR_TOKENS = 200000;
86864
86921
  var CHARS_PER_TOKEN = 4;
@@ -86867,7 +86924,7 @@ var CK_RECOMMENDED_MAX_DESC_CHARS = 512;
86867
86924
  var RECOMMENDED_DESC_CHARS = 200;
86868
86925
  var LISTING_OVERHEAD_PER_SKILL = 4;
86869
86926
  async function readProjectSettings(settingsPath) {
86870
- if (!existsSync53(settingsPath))
86927
+ if (!existsSync54(settingsPath))
86871
86928
  return { exists: false, settings: null };
86872
86929
  try {
86873
86930
  const parsed = JSON.parse(await readFile40(settingsPath, "utf8"));
@@ -87176,8 +87233,8 @@ async function checkGlobalDirWritable() {
87176
87233
  }
87177
87234
  // src/domains/health-checks/checkers/hooks-checker.ts
87178
87235
  init_path_resolver();
87179
- import { existsSync as existsSync54 } from "node:fs";
87180
- import { readdir as readdir20 } from "node:fs/promises";
87236
+ import { existsSync as existsSync55 } from "node:fs";
87237
+ import { readdir as readdir21 } from "node:fs/promises";
87181
87238
  import { join as join78 } from "node:path";
87182
87239
 
87183
87240
  // src/domains/health-checks/utils/path-normalizer.ts
@@ -87193,12 +87250,12 @@ init_shared2();
87193
87250
  async function checkHooksExist(projectDir) {
87194
87251
  const globalHooksDir = join78(PathResolver.getGlobalKitDir(), "hooks");
87195
87252
  const projectHooksDir = join78(projectDir, ".claude", "hooks");
87196
- const globalExists = existsSync54(globalHooksDir);
87197
- const projectExists = existsSync54(projectHooksDir);
87253
+ const globalExists = existsSync55(globalHooksDir);
87254
+ const projectExists = existsSync55(projectHooksDir);
87198
87255
  let hookCount = 0;
87199
87256
  const checkedFiles = new Set;
87200
87257
  if (globalExists) {
87201
- const files = await readdir20(globalHooksDir, { withFileTypes: false });
87258
+ const files = await readdir21(globalHooksDir, { withFileTypes: false });
87202
87259
  const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
87203
87260
  hooks.forEach((hook) => {
87204
87261
  const fullPath = join78(globalHooksDir, hook);
@@ -87208,7 +87265,7 @@ async function checkHooksExist(projectDir) {
87208
87265
  const normalizedGlobal = normalizePath2(globalHooksDir);
87209
87266
  const normalizedProject = normalizePath2(projectHooksDir);
87210
87267
  if (projectExists && normalizedProject !== normalizedGlobal) {
87211
- const files = await readdir20(projectHooksDir, { withFileTypes: false });
87268
+ const files = await readdir21(projectHooksDir, { withFileTypes: false });
87212
87269
  const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
87213
87270
  hooks.forEach((hook) => {
87214
87271
  const fullPath = join78(projectHooksDir, hook);
@@ -87241,13 +87298,13 @@ async function checkHooksExist(projectDir) {
87241
87298
  // src/domains/health-checks/checkers/settings-checker.ts
87242
87299
  init_logger();
87243
87300
  init_path_resolver();
87244
- import { existsSync as existsSync55 } from "node:fs";
87301
+ import { existsSync as existsSync56 } from "node:fs";
87245
87302
  import { readFile as readFile41 } from "node:fs/promises";
87246
87303
  import { join as join79 } from "node:path";
87247
87304
  async function checkSettingsValid(projectDir) {
87248
87305
  const globalSettings = join79(PathResolver.getGlobalKitDir(), "settings.json");
87249
87306
  const projectSettings = join79(projectDir, ".claude", "settings.json");
87250
- const settingsPath = existsSync55(globalSettings) ? globalSettings : existsSync55(projectSettings) ? projectSettings : null;
87307
+ const settingsPath = existsSync56(globalSettings) ? globalSettings : existsSync56(projectSettings) ? projectSettings : null;
87251
87308
  if (!settingsPath) {
87252
87309
  return {
87253
87310
  id: "ck-settings-valid",
@@ -87316,14 +87373,14 @@ async function checkSettingsValid(projectDir) {
87316
87373
  // src/domains/health-checks/checkers/path-refs-checker.ts
87317
87374
  init_logger();
87318
87375
  init_path_resolver();
87319
- import { existsSync as existsSync56 } from "node:fs";
87376
+ import { existsSync as existsSync57 } from "node:fs";
87320
87377
  import { readFile as readFile42 } from "node:fs/promises";
87321
87378
  import { homedir as homedir42 } from "node:os";
87322
87379
  import { dirname as dirname28, join as join80, normalize as normalize6, resolve as resolve35 } from "node:path";
87323
87380
  async function checkPathRefsValid(projectDir) {
87324
87381
  const globalClaudeMd = join80(PathResolver.getGlobalKitDir(), "CLAUDE.md");
87325
87382
  const projectClaudeMd = join80(projectDir, ".claude", "CLAUDE.md");
87326
- const claudeMdPath = existsSync56(globalClaudeMd) ? globalClaudeMd : existsSync56(projectClaudeMd) ? projectClaudeMd : null;
87383
+ const claudeMdPath = existsSync57(globalClaudeMd) ? globalClaudeMd : existsSync57(projectClaudeMd) ? projectClaudeMd : null;
87327
87384
  if (!claudeMdPath) {
87328
87385
  return {
87329
87386
  id: "ck-path-refs-valid",
@@ -87376,7 +87433,7 @@ async function checkPathRefsValid(projectDir) {
87376
87433
  logger.verbose("Skipping potentially unsafe path reference", { ref, refPath });
87377
87434
  continue;
87378
87435
  }
87379
- if (!existsSync56(normalizedPath)) {
87436
+ if (!existsSync57(normalizedPath)) {
87380
87437
  broken.push(ref);
87381
87438
  }
87382
87439
  }
@@ -87415,8 +87472,8 @@ async function checkPathRefsValid(projectDir) {
87415
87472
  }
87416
87473
  }
87417
87474
  // src/domains/health-checks/checkers/config-completeness-checker.ts
87418
- import { existsSync as existsSync57 } from "node:fs";
87419
- import { readdir as readdir21 } from "node:fs/promises";
87475
+ import { existsSync as existsSync58 } from "node:fs";
87476
+ import { readdir as readdir22 } from "node:fs/promises";
87420
87477
  import { join as join81 } from "node:path";
87421
87478
  async function checkProjectConfigCompleteness(setup, projectDir) {
87422
87479
  const baseResult = {
@@ -87455,15 +87512,15 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
87455
87512
  const requiredDirs = ["agents", "commands", "skills"];
87456
87513
  const missingDirs = [];
87457
87514
  for (const dir of requiredDirs) {
87458
- if (!existsSync57(join81(projectClaudeDir, dir))) {
87515
+ if (!existsSync58(join81(projectClaudeDir, dir))) {
87459
87516
  missingDirs.push(dir);
87460
87517
  }
87461
87518
  }
87462
- const hasRulesOrWorkflows = existsSync57(join81(projectClaudeDir, "rules")) || existsSync57(join81(projectClaudeDir, "workflows"));
87519
+ const hasRulesOrWorkflows = existsSync58(join81(projectClaudeDir, "rules")) || existsSync58(join81(projectClaudeDir, "workflows"));
87463
87520
  if (!hasRulesOrWorkflows) {
87464
87521
  missingDirs.push("rules");
87465
87522
  }
87466
- const files = await readdir21(projectClaudeDir).catch(() => []);
87523
+ const files = await readdir22(projectClaudeDir).catch(() => []);
87467
87524
  const hasOnlyClaudeMd = files.length === 1 && files.includes("CLAUDE.md");
87468
87525
  const totalRequired = requiredDirs.length + 1;
87469
87526
  if (hasOnlyClaudeMd || missingDirs.length === totalRequired) {
@@ -89519,13 +89576,7 @@ async function doctorCommand(options2 = {}) {
89519
89576
  if (!json && !report) {
89520
89577
  intro("ClaudeKit Health Check");
89521
89578
  }
89522
- const runner = new CheckRunner(runnerOptions);
89523
- runner.registerChecker(new SystemChecker);
89524
- runner.registerChecker(new ClaudekitChecker);
89525
- runner.registerChecker(new AuthChecker);
89526
- runner.registerChecker(new PlatformChecker);
89527
- runner.registerChecker(new NetworkChecker);
89528
- runner.registerChecker(new GitHubReachabilityChecker);
89579
+ const runner = createDoctorRunner(runnerOptions);
89529
89580
  const summary = await runner.run();
89530
89581
  if (json) {
89531
89582
  const generator = new ReportGenerator;
@@ -89544,21 +89595,31 @@ async function doctorCommand(options2 = {}) {
89544
89595
  return;
89545
89596
  }
89546
89597
  const renderer = new DoctorUIRenderer({ verbose: runnerOptions.verbose });
89547
- renderer.renderResults(summary);
89548
89598
  if (fix) {
89549
89599
  const healer = new AutoHealer;
89550
89600
  try {
89551
89601
  const healSummary = await healer.healAll(summary.checks);
89552
89602
  renderer.renderHealingSummary(healSummary);
89553
- if (healSummary.failed === 0 && healSummary.succeeded > 0) {
89554
- outro("All fixable issues resolved!");
89555
- return;
89603
+ const finalSummary = healSummary.succeeded > 0 ? await createDoctorRunner(runnerOptions).run() : summary;
89604
+ renderer.renderResults(finalSummary);
89605
+ if (checkOnly && finalSummary.failed > 0) {
89606
+ process.exitCode = 1;
89607
+ }
89608
+ if (healSummary.failed > 0) {
89609
+ process.exitCode = 1;
89610
+ outro(`${healSummary.failed} auto-fix attempt(s) failed`);
89611
+ } else if (finalSummary.failed === 0) {
89612
+ outro(healSummary.succeeded > 0 ? "All fixable issues resolved!" : "All checks passed!");
89613
+ } else {
89614
+ outro(`${finalSummary.failed} issue(s) remain after auto-heal`);
89556
89615
  }
89616
+ return;
89557
89617
  } catch (error) {
89558
89618
  logger.error(`Auto-fix failed: ${error instanceof Error ? error.message : "Unknown error"}`);
89559
89619
  process.exitCode = 1;
89560
89620
  }
89561
89621
  }
89622
+ renderer.renderResults(summary);
89562
89623
  if (checkOnly && summary.failed > 0) {
89563
89624
  process.exitCode = 1;
89564
89625
  }
@@ -89582,6 +89643,16 @@ async function doctorCommand(options2 = {}) {
89582
89643
  outro(`${summary.failed} issue(s) found`);
89583
89644
  }
89584
89645
  }
89646
+ function createDoctorRunner(options2) {
89647
+ const runner = new CheckRunner(options2);
89648
+ runner.registerChecker(new SystemChecker);
89649
+ runner.registerChecker(new ClaudekitChecker);
89650
+ runner.registerChecker(new AuthChecker);
89651
+ runner.registerChecker(new PlatformChecker);
89652
+ runner.registerChecker(new NetworkChecker);
89653
+ runner.registerChecker(new GitHubReachabilityChecker);
89654
+ return runner;
89655
+ }
89585
89656
 
89586
89657
  // src/commands/easter-egg.ts
89587
89658
  init_logger();
@@ -92665,11 +92736,11 @@ class FileDownloader {
92665
92736
  init_logger();
92666
92737
  init_types3();
92667
92738
  import { constants as constants4 } from "node:fs";
92668
- import { access as access5, readdir as readdir22 } from "node:fs/promises";
92739
+ import { access as access5, readdir as readdir23 } from "node:fs/promises";
92669
92740
  import { join as join98 } from "node:path";
92670
92741
  async function validateExtraction(extractDir) {
92671
92742
  try {
92672
- const entries = await readdir22(extractDir, { encoding: "utf8" });
92743
+ const entries = await readdir23(extractDir, { encoding: "utf8" });
92673
92744
  logger.debug(`Extracted files: ${entries.join(", ")}`);
92674
92745
  if (entries.length === 0) {
92675
92746
  throw new ExtractionError("Extraction resulted in no files");
@@ -92699,7 +92770,7 @@ async function validateExtraction(extractDir) {
92699
92770
 
92700
92771
  // src/domains/installation/extraction/tar-extractor.ts
92701
92772
  init_logger();
92702
- import { copyFile as copyFile4, mkdir as mkdir28, readdir as readdir24, rm as rm11, stat as stat15 } from "node:fs/promises";
92773
+ import { copyFile as copyFile4, mkdir as mkdir28, readdir as readdir25, rm as rm11, stat as stat15 } from "node:fs/promises";
92703
92774
  import { join as join101 } from "node:path";
92704
92775
 
92705
92776
  // node_modules/@isaacs/fs-minipass/dist/esm/index.js
@@ -99568,7 +99639,7 @@ function decodeFilePath(path14) {
99568
99639
  // src/domains/installation/utils/file-utils.ts
99569
99640
  init_logger();
99570
99641
  init_types3();
99571
- import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as readdir23 } from "node:fs/promises";
99642
+ import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as readdir24 } from "node:fs/promises";
99572
99643
  import { join as join100, relative as relative20 } from "node:path";
99573
99644
  async function withRetry(fn, retries = 3) {
99574
99645
  for (let i = 0;i < retries; i++) {
@@ -99589,7 +99660,7 @@ var isRetryable = (e2) => {
99589
99660
  var delay = (ms) => new Promise((r2) => setTimeout(r2, ms));
99590
99661
  async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTracker) {
99591
99662
  await mkdir27(destDir, { recursive: true });
99592
- const entries = await readdir23(sourceDir, { encoding: "utf8" });
99663
+ const entries = await readdir24(sourceDir, { encoding: "utf8" });
99593
99664
  for (const entry of entries) {
99594
99665
  const sourcePath = join100(sourceDir, entry);
99595
99666
  const destPath = join100(destDir, entry);
@@ -99617,7 +99688,7 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
99617
99688
  }
99618
99689
  async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
99619
99690
  await mkdir27(destDir, { recursive: true });
99620
- const entries = await readdir23(sourceDir, { encoding: "utf8" });
99691
+ const entries = await readdir24(sourceDir, { encoding: "utf8" });
99621
99692
  for (const entry of entries) {
99622
99693
  const sourcePath = join100(sourceDir, entry);
99623
99694
  const destPath = join100(destDir, entry);
@@ -99664,14 +99735,14 @@ class TarExtractor {
99664
99735
  }
99665
99736
  });
99666
99737
  logger.debug(`Extracted TAR.GZ to temp: ${tempExtractDir}`);
99667
- const entries = await readdir24(tempExtractDir, { encoding: "utf8" });
99738
+ const entries = await readdir25(tempExtractDir, { encoding: "utf8" });
99668
99739
  logger.debug(`Root entries: ${entries.join(", ")}`);
99669
99740
  if (entries.length === 1) {
99670
99741
  const rootEntry = entries[0];
99671
99742
  const rootPath = join101(tempExtractDir, rootEntry);
99672
99743
  const rootStat = await stat15(rootPath);
99673
99744
  if (rootStat.isDirectory()) {
99674
- const rootContents = await readdir24(rootPath, { encoding: "utf8" });
99745
+ const rootContents = await readdir25(rootPath, { encoding: "utf8" });
99675
99746
  logger.debug(`Root directory '${rootEntry}' contains: ${rootContents.join(", ")}`);
99676
99747
  const isWrapper = isWrapperDirectory(rootEntry);
99677
99748
  logger.debug(`Is wrapper directory: ${isWrapper}`);
@@ -99705,7 +99776,7 @@ class TarExtractor {
99705
99776
  init_logger();
99706
99777
  var import_extract_zip = __toESM(require_extract_zip(), 1);
99707
99778
  import { execFile as execFile10 } from "node:child_process";
99708
- import { copyFile as copyFile5, mkdir as mkdir29, readdir as readdir25, rm as rm12, stat as stat16 } from "node:fs/promises";
99779
+ import { copyFile as copyFile5, mkdir as mkdir29, readdir as readdir26, rm as rm12, stat as stat16 } from "node:fs/promises";
99709
99780
  import { join as join102 } from "node:path";
99710
99781
  import { promisify as promisify15 } from "node:util";
99711
99782
 
@@ -99794,14 +99865,14 @@ class ZipExtractor {
99794
99865
  logger.verbose(`Extracted ${extractedCount} files`);
99795
99866
  }
99796
99867
  logger.debug(`Extracted ZIP to temp: ${tempExtractDir}`);
99797
- const entries = await readdir25(tempExtractDir, { encoding: "utf8" });
99868
+ const entries = await readdir26(tempExtractDir, { encoding: "utf8" });
99798
99869
  logger.debug(`Root entries: ${entries.join(", ")}`);
99799
99870
  if (entries.length === 1) {
99800
99871
  const rootEntry = entries[0];
99801
99872
  const rootPath = join102(tempExtractDir, rootEntry);
99802
99873
  const rootStat = await stat16(rootPath);
99803
99874
  if (rootStat.isDirectory()) {
99804
- const rootContents = await readdir25(rootPath, { encoding: "utf8" });
99875
+ const rootContents = await readdir26(rootPath, { encoding: "utf8" });
99805
99876
  logger.debug(`Root directory '${rootEntry}' contains: ${rootContents.join(", ")}`);
99806
99877
  const isWrapper = isWrapperDirectory(rootEntry);
99807
99878
  logger.debug(`Is wrapper directory: ${isWrapper}`);
@@ -100395,7 +100466,7 @@ async function handleDownload(ctx) {
100395
100466
  import { join as join120 } from "node:path";
100396
100467
 
100397
100468
  // src/domains/installation/deletion-handler.ts
100398
- import { existsSync as existsSync63, lstatSync as lstatSync3, readdirSync as readdirSync7, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
100469
+ import { existsSync as existsSync64, lstatSync as lstatSync3, readdirSync as readdirSync7, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
100399
100470
  import { dirname as dirname34, join as join106, relative as relative21, resolve as resolve40, sep as sep11 } from "node:path";
100400
100471
 
100401
100472
  // src/services/file-operations/manifest/manifest-reader.ts
@@ -100586,7 +100657,7 @@ function shouldDeletePath(path15, metadata, kitType) {
100586
100657
  }
100587
100658
  function collectFilesRecursively(dir, baseDir) {
100588
100659
  const results = [];
100589
- if (!existsSync63(dir))
100660
+ if (!existsSync64(dir))
100590
100661
  return results;
100591
100662
  try {
100592
100663
  const entries = readdirSync7(dir, { withFileTypes: true });
@@ -100727,7 +100798,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
100727
100798
  logger.verbose(`Preserved user file: ${path15}`);
100728
100799
  continue;
100729
100800
  }
100730
- if (existsSync63(fullPath)) {
100801
+ if (existsSync64(fullPath)) {
100731
100802
  try {
100732
100803
  deletePath(fullPath, claudeDir3);
100733
100804
  result.deletedPaths.push(path15);
@@ -102429,7 +102500,7 @@ import { dirname as dirname37, join as join109 } from "node:path";
102429
102500
 
102430
102501
  // src/domains/config/installed-settings-tracker.ts
102431
102502
  init_shared();
102432
- import { existsSync as existsSync64 } from "node:fs";
102503
+ import { existsSync as existsSync65 } from "node:fs";
102433
102504
  import { mkdir as mkdir31, readFile as readFile50, writeFile as writeFile25 } from "node:fs/promises";
102434
102505
  import { dirname as dirname35, join as join108 } from "node:path";
102435
102506
  var CK_JSON_FILE = ".ck.json";
@@ -102451,7 +102522,7 @@ class InstalledSettingsTracker {
102451
102522
  }
102452
102523
  async loadInstalledSettings() {
102453
102524
  const ckJsonPath = this.getCkJsonPath();
102454
- if (!existsSync64(ckJsonPath)) {
102525
+ if (!existsSync65(ckJsonPath)) {
102455
102526
  return { hooks: [], mcpServers: [] };
102456
102527
  }
102457
102528
  try {
@@ -102471,7 +102542,7 @@ class InstalledSettingsTracker {
102471
102542
  const ckJsonPath = this.getCkJsonPath();
102472
102543
  try {
102473
102544
  let data = {};
102474
- if (existsSync64(ckJsonPath)) {
102545
+ if (existsSync65(ckJsonPath)) {
102475
102546
  const content = await readFile50(ckJsonPath, "utf-8");
102476
102547
  data = JSON.parse(content);
102477
102548
  }
@@ -102524,12 +102595,12 @@ class InstalledSettingsTracker {
102524
102595
  init_settings_merger();
102525
102596
 
102526
102597
  // src/domains/installation/merger/zombie-wirings-pruner.ts
102527
- import { existsSync as existsSync65, readdirSync as readdirSync8 } from "node:fs";
102598
+ import { existsSync as existsSync66, readdirSync as readdirSync8 } from "node:fs";
102528
102599
  import { homedir as homedir45 } from "node:os";
102529
102600
  import { basename as basename26, dirname as dirname36, isAbsolute as isAbsolute12, resolve as resolve41, sep as sep13 } from "node:path";
102530
102601
  function pruneZombieEngineerWirings(settings, hookDir) {
102531
102602
  const pruned = [];
102532
- if (!existsSync65(hookDir)) {
102603
+ if (!existsSync66(hookDir)) {
102533
102604
  return { settings, pruned };
102534
102605
  }
102535
102606
  const hookFiles = readdirSync8(hookDir);
@@ -102582,7 +102653,7 @@ function shouldPruneEntry(entry, hookDir, pruned) {
102582
102653
  const filePath = extractHookFilePath(entry.command, hookDir);
102583
102654
  if (!filePath)
102584
102655
  return false;
102585
- if (existsSync65(filePath))
102656
+ if (existsSync66(filePath))
102586
102657
  return false;
102587
102658
  pruned.push(basename26(filePath));
102588
102659
  return true;
@@ -103444,7 +103515,7 @@ class FileMerger {
103444
103515
  }
103445
103516
 
103446
103517
  // src/domains/migration/legacy-migration.ts
103447
- import { readdir as readdir27, stat as stat19 } from "node:fs/promises";
103518
+ import { readdir as readdir28, stat as stat19 } from "node:fs/promises";
103448
103519
  import { join as join114, relative as relative24 } from "node:path";
103449
103520
  // src/services/file-operations/manifest/manifest-tracker.ts
103450
103521
  import { join as join113 } from "node:path";
@@ -103855,7 +103926,7 @@ class LegacyMigration {
103855
103926
  const files = [];
103856
103927
  let entries;
103857
103928
  try {
103858
- entries = await readdir27(dir);
103929
+ entries = await readdir28(dir);
103859
103930
  } catch (err) {
103860
103931
  const error = err;
103861
103932
  if (error.code === "ENOENT") {
@@ -104201,12 +104272,12 @@ class FileScanner2 {
104201
104272
  // src/services/transformers/commands-prefix/prefix-applier.ts
104202
104273
  init_logger();
104203
104274
  var import_fs_extra20 = __toESM(require_lib(), 1);
104204
- import { lstat as lstat10, mkdir as mkdir32, readdir as readdir30, stat as stat20 } from "node:fs/promises";
104275
+ import { lstat as lstat10, mkdir as mkdir32, readdir as readdir31, stat as stat20 } from "node:fs/promises";
104205
104276
  import { join as join117 } from "node:path";
104206
104277
 
104207
104278
  // src/services/transformers/commands-prefix/content-transformer.ts
104208
104279
  init_logger();
104209
- import { readFile as readFile54, readdir as readdir29, writeFile as writeFile29 } from "node:fs/promises";
104280
+ import { readFile as readFile54, readdir as readdir30, writeFile as writeFile29 } from "node:fs/promises";
104210
104281
  import { join as join116 } from "node:path";
104211
104282
  var TRANSFORMABLE_EXTENSIONS = new Set([
104212
104283
  ".md",
@@ -104265,7 +104336,7 @@ async function transformCommandReferences(directory, options2 = {}) {
104265
104336
  let filesTransformed = 0;
104266
104337
  let totalReplacements = 0;
104267
104338
  async function processDirectory(dir) {
104268
- const entries = await readdir29(dir, { withFileTypes: true });
104339
+ const entries = await readdir30(dir, { withFileTypes: true });
104269
104340
  for (const entry of entries) {
104270
104341
  const fullPath = join116(dir, entry.name);
104271
104342
  if (entry.isDirectory()) {
@@ -104351,7 +104422,7 @@ async function applyPrefix(extractDir) {
104351
104422
  const backupDir = join117(extractDir, ".commands-backup");
104352
104423
  const tempDir = join117(extractDir, ".commands-prefix-temp");
104353
104424
  try {
104354
- const entries = await readdir30(commandsDir);
104425
+ const entries = await readdir31(commandsDir);
104355
104426
  if (entries.length === 0) {
104356
104427
  logger.verbose("Commands directory is empty, skipping prefix application");
104357
104428
  return;
@@ -104432,19 +104503,19 @@ async function applyPrefix(extractDir) {
104432
104503
 
104433
104504
  // src/services/transformers/commands-prefix/prefix-cleaner.ts
104434
104505
  init_metadata_migration();
104435
- import { lstat as lstat12, readdir as readdir32 } from "node:fs/promises";
104506
+ import { lstat as lstat12, readdir as readdir33 } from "node:fs/promises";
104436
104507
  import { join as join119 } from "node:path";
104437
104508
  init_logger();
104438
104509
  var import_fs_extra22 = __toESM(require_lib(), 1);
104439
104510
 
104440
104511
  // src/services/transformers/commands-prefix/file-processor.ts
104441
- import { lstat as lstat11, readdir as readdir31 } from "node:fs/promises";
104512
+ import { lstat as lstat11, readdir as readdir32 } from "node:fs/promises";
104442
104513
  import { join as join118 } from "node:path";
104443
104514
  init_logger();
104444
104515
  var import_fs_extra21 = __toESM(require_lib(), 1);
104445
104516
  async function scanDirectoryFiles(dir) {
104446
104517
  const files = [];
104447
- const entries = await readdir31(dir);
104518
+ const entries = await readdir32(dir);
104448
104519
  for (const entry of entries) {
104449
104520
  const fullPath = join118(dir, entry);
104450
104521
  const stats = await lstat11(fullPath);
@@ -104610,7 +104681,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
104610
104681
  if (options2.kitType) {
104611
104682
  logger.verbose(`Kit-aware cleanup: only cleaning files owned by '${options2.kitType}'`);
104612
104683
  }
104613
- const entries = await readdir32(commandsDir);
104684
+ const entries = await readdir33(commandsDir);
104614
104685
  if (entries.length === 0) {
104615
104686
  logger.verbose("Commands directory is empty");
104616
104687
  return result;
@@ -104813,7 +104884,7 @@ init_skip_directories();
104813
104884
  init_types3();
104814
104885
  var import_fs_extra24 = __toESM(require_lib(), 1);
104815
104886
  import { createHash as createHash7 } from "node:crypto";
104816
- import { readFile as readFile56, readdir as readdir33, writeFile as writeFile30 } from "node:fs/promises";
104887
+ import { readFile as readFile56, readdir as readdir34, writeFile as writeFile30 } from "node:fs/promises";
104817
104888
  import { join as join121, relative as relative26 } from "node:path";
104818
104889
 
104819
104890
  class SkillsManifestManager {
@@ -104858,14 +104929,14 @@ class SkillsManifestManager {
104858
104929
  }
104859
104930
  }
104860
104931
  static async detectStructure(skillsDir2) {
104861
- const entries = await readdir33(skillsDir2, { withFileTypes: true });
104932
+ const entries = await readdir34(skillsDir2, { withFileTypes: true });
104862
104933
  const dirs = entries.filter((entry) => entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith("."));
104863
104934
  if (dirs.length === 0) {
104864
104935
  return "flat";
104865
104936
  }
104866
104937
  for (const dir of dirs.slice(0, 3)) {
104867
104938
  const dirPath = join121(skillsDir2, dir.name);
104868
- const subEntries = await readdir33(dirPath, { withFileTypes: true });
104939
+ const subEntries = await readdir34(dirPath, { withFileTypes: true });
104869
104940
  const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
104870
104941
  if (hasSubdirs) {
104871
104942
  return "categorized";
@@ -104880,7 +104951,7 @@ class SkillsManifestManager {
104880
104951
  static async scanSkills(skillsDir2, structure) {
104881
104952
  const skills = [];
104882
104953
  if (structure === "flat") {
104883
- const entries = await readdir33(skillsDir2, { withFileTypes: true });
104954
+ const entries = await readdir34(skillsDir2, { withFileTypes: true });
104884
104955
  for (const entry of entries) {
104885
104956
  if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
104886
104957
  const skillPath = join121(skillsDir2, entry.name);
@@ -104892,11 +104963,11 @@ class SkillsManifestManager {
104892
104963
  }
104893
104964
  }
104894
104965
  } else {
104895
- const categories = await readdir33(skillsDir2, { withFileTypes: true });
104966
+ const categories = await readdir34(skillsDir2, { withFileTypes: true });
104896
104967
  for (const category of categories) {
104897
104968
  if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
104898
104969
  const categoryPath = join121(skillsDir2, category.name);
104899
- const skillEntries = await readdir33(categoryPath, { withFileTypes: true });
104970
+ const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
104900
104971
  for (const skillEntry of skillEntries) {
104901
104972
  if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
104902
104973
  const skillPath = join121(categoryPath, skillEntry.name);
@@ -104927,7 +104998,7 @@ class SkillsManifestManager {
104927
104998
  }
104928
104999
  static async getAllFiles(dirPath) {
104929
105000
  const files = [];
104930
- const entries = await readdir33(dirPath, { withFileTypes: true });
105001
+ const entries = await readdir34(dirPath, { withFileTypes: true });
104931
105002
  for (const entry of entries) {
104932
105003
  const fullPath = join121(dirPath, entry.name);
104933
105004
  if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
@@ -105050,13 +105121,13 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
105050
105121
 
105051
105122
  // src/domains/skills/detection/script-detector.ts
105052
105123
  var import_fs_extra25 = __toESM(require_lib(), 1);
105053
- import { readdir as readdir34 } from "node:fs/promises";
105124
+ import { readdir as readdir35 } from "node:fs/promises";
105054
105125
  import { join as join122 } from "node:path";
105055
105126
  async function scanDirectory(skillsDir2) {
105056
105127
  if (!await import_fs_extra25.pathExists(skillsDir2)) {
105057
105128
  return ["flat", []];
105058
105129
  }
105059
- const entries = await readdir34(skillsDir2, { withFileTypes: true });
105130
+ const entries = await readdir35(skillsDir2, { withFileTypes: true });
105060
105131
  const dirs = entries.filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith("."));
105061
105132
  if (dirs.length === 0) {
105062
105133
  return ["flat", []];
@@ -105065,12 +105136,12 @@ async function scanDirectory(skillsDir2) {
105065
105136
  const allSkills = [];
105066
105137
  for (const dir of dirs) {
105067
105138
  const dirPath = join122(skillsDir2, dir.name);
105068
- const subEntries = await readdir34(dirPath, { withFileTypes: true });
105139
+ const subEntries = await readdir35(dirPath, { withFileTypes: true });
105069
105140
  const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
105070
105141
  if (subdirs.length > 0) {
105071
105142
  for (const subdir of subdirs.slice(0, 3)) {
105072
105143
  const subdirPath = join122(dirPath, subdir.name);
105073
- const subdirFiles = await readdir34(subdirPath, { withFileTypes: true });
105144
+ const subdirFiles = await readdir35(subdirPath, { withFileTypes: true });
105074
105145
  const hasSkillMarker = subdirFiles.some((file) => file.isFile() && (file.name === "skill.md" || file.name === "README.md" || file.name === "readme.md" || file.name === "config.json" || file.name === "package.json"));
105075
105146
  if (hasSkillMarker) {
105076
105147
  totalSkillLikeCount++;
@@ -105230,7 +105301,7 @@ import { join as join127 } from "node:path";
105230
105301
 
105231
105302
  // src/domains/skills/migrator/migration-executor.ts
105232
105303
  init_logger();
105233
- import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir35, rm as rm13 } from "node:fs/promises";
105304
+ import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir36, rm as rm13 } from "node:fs/promises";
105234
105305
  import { join as join123 } from "node:path";
105235
105306
  var import_fs_extra27 = __toESM(require_lib(), 1);
105236
105307
 
@@ -105394,7 +105465,7 @@ Detected changes:`;
105394
105465
  // src/domains/skills/migrator/migration-executor.ts
105395
105466
  async function copySkillDirectory(sourceDir, destDir) {
105396
105467
  await mkdir33(destDir, { recursive: true });
105397
- const entries = await readdir35(sourceDir, { withFileTypes: true });
105468
+ const entries = await readdir36(sourceDir, { withFileTypes: true });
105398
105469
  for (const entry of entries) {
105399
105470
  const sourcePath = join123(sourceDir, entry.name);
105400
105471
  const destPath = join123(destDir, entry.name);
@@ -105501,7 +105572,7 @@ function validateMigrationPath(path16, paramName) {
105501
105572
  init_logger();
105502
105573
  init_types3();
105503
105574
  var import_fs_extra28 = __toESM(require_lib(), 1);
105504
- import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir36, rm as rm14, stat as stat21 } from "node:fs/promises";
105575
+ import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir37, rm as rm14, stat as stat21 } from "node:fs/promises";
105505
105576
  import { basename as basename27, join as join124, normalize as normalize9 } from "node:path";
105506
105577
  function validatePath2(path16, paramName) {
105507
105578
  if (!path16 || typeof path16 !== "string") {
@@ -105578,7 +105649,7 @@ class SkillsBackupManager {
105578
105649
  return [];
105579
105650
  }
105580
105651
  try {
105581
- const entries = await readdir36(parentDir, { withFileTypes: true });
105652
+ const entries = await readdir37(parentDir, { withFileTypes: true });
105582
105653
  const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join124(parentDir, entry.name));
105583
105654
  backups.sort().reverse();
105584
105655
  return backups;
@@ -105605,7 +105676,7 @@ class SkillsBackupManager {
105605
105676
  return await SkillsBackupManager.getDirectorySize(backupDir);
105606
105677
  }
105607
105678
  static async copyDirectory(sourceDir, destDir) {
105608
- const entries = await readdir36(sourceDir, { withFileTypes: true });
105679
+ const entries = await readdir37(sourceDir, { withFileTypes: true });
105609
105680
  for (const entry of entries) {
105610
105681
  const sourcePath = join124(sourceDir, entry.name);
105611
105682
  const destPath = join124(destDir, entry.name);
@@ -105622,7 +105693,7 @@ class SkillsBackupManager {
105622
105693
  }
105623
105694
  static async getDirectorySize(dirPath) {
105624
105695
  let size = 0;
105625
- const entries = await readdir36(dirPath, { withFileTypes: true });
105696
+ const entries = await readdir37(dirPath, { withFileTypes: true });
105626
105697
  for (const entry of entries) {
105627
105698
  const fullPath = join124(dirPath, entry.name);
105628
105699
  if (entry.isSymbolicLink()) {
@@ -105659,11 +105730,11 @@ import { relative as relative28 } from "node:path";
105659
105730
  init_skip_directories();
105660
105731
  import { createHash as createHash8 } from "node:crypto";
105661
105732
  import { createReadStream as createReadStream2 } from "node:fs";
105662
- import { readFile as readFile57, readdir as readdir37 } from "node:fs/promises";
105733
+ import { readFile as readFile57, readdir as readdir38 } from "node:fs/promises";
105663
105734
  import { join as join125, relative as relative27 } from "node:path";
105664
105735
  async function getAllFiles(dirPath) {
105665
105736
  const files = [];
105666
- const entries = await readdir37(dirPath, { withFileTypes: true });
105737
+ const entries = await readdir38(dirPath, { withFileTypes: true });
105667
105738
  for (const entry of entries) {
105668
105739
  const fullPath = join125(dirPath, entry.name);
105669
105740
  if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
@@ -105791,7 +105862,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
105791
105862
  // src/domains/skills/customization/scan-reporter.ts
105792
105863
  init_types3();
105793
105864
  var import_fs_extra30 = __toESM(require_lib(), 1);
105794
- import { readdir as readdir38 } from "node:fs/promises";
105865
+ import { readdir as readdir39 } from "node:fs/promises";
105795
105866
  import { join as join126, normalize as normalize10 } from "node:path";
105796
105867
  function validatePath3(path16, paramName) {
105797
105868
  if (!path16 || typeof path16 !== "string") {
@@ -105808,19 +105879,19 @@ async function scanSkillsDirectory(skillsDir2) {
105808
105879
  if (!await import_fs_extra30.pathExists(skillsDir2)) {
105809
105880
  return ["flat", []];
105810
105881
  }
105811
- const entries = await readdir38(skillsDir2, { withFileTypes: true });
105882
+ const entries = await readdir39(skillsDir2, { withFileTypes: true });
105812
105883
  const dirs = entries.filter((entry) => entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith("."));
105813
105884
  if (dirs.length === 0) {
105814
105885
  return ["flat", []];
105815
105886
  }
105816
105887
  const firstDirPath = join126(skillsDir2, dirs[0].name);
105817
- const subEntries = await readdir38(firstDirPath, { withFileTypes: true });
105888
+ const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
105818
105889
  const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
105819
105890
  if (subdirs.length > 0) {
105820
105891
  let skillLikeCount = 0;
105821
105892
  for (const subdir of subdirs.slice(0, 3)) {
105822
105893
  const subdirPath = join126(firstDirPath, subdir.name);
105823
- const subdirFiles = await readdir38(subdirPath, { withFileTypes: true });
105894
+ const subdirFiles = await readdir39(subdirPath, { withFileTypes: true });
105824
105895
  const hasSkillMarker = subdirFiles.some((file) => file.isFile() && (file.name === "skill.md" || file.name === "README.md" || file.name === "readme.md" || file.name === "config.json" || file.name === "package.json"));
105825
105896
  if (hasSkillMarker) {
105826
105897
  skillLikeCount++;
@@ -105830,7 +105901,7 @@ async function scanSkillsDirectory(skillsDir2) {
105830
105901
  const skills = [];
105831
105902
  for (const dir of dirs) {
105832
105903
  const categoryPath = join126(skillsDir2, dir.name);
105833
- const skillDirs = await readdir38(categoryPath, { withFileTypes: true });
105904
+ const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
105834
105905
  skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
105835
105906
  }
105836
105907
  return ["categorized", skills];
@@ -105843,7 +105914,7 @@ async function findSkillPath(skillsDir2, skillName) {
105843
105914
  if (await import_fs_extra30.pathExists(flatPath)) {
105844
105915
  return { path: flatPath, category: undefined };
105845
105916
  }
105846
- const entries = await readdir38(skillsDir2, { withFileTypes: true });
105917
+ const entries = await readdir39(skillsDir2, { withFileTypes: true });
105847
105918
  for (const entry of entries) {
105848
105919
  if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
105849
105920
  continue;
@@ -106027,12 +106098,12 @@ async function handleMigration(ctx) {
106027
106098
  return ctx;
106028
106099
  }
106029
106100
  // src/commands/init/phases/opencode-handler.ts
106030
- import { cp as cp4, readdir as readdir40, rm as rm15 } from "node:fs/promises";
106101
+ import { cp as cp4, readdir as readdir41, rm as rm15 } from "node:fs/promises";
106031
106102
  import { join as join130 } from "node:path";
106032
106103
 
106033
106104
  // src/services/transformers/opencode-path-transformer.ts
106034
106105
  init_logger();
106035
- import { readFile as readFile58, readdir as readdir39, writeFile as writeFile31 } from "node:fs/promises";
106106
+ import { readFile as readFile58, readdir as readdir40, writeFile as writeFile31 } from "node:fs/promises";
106036
106107
  import { platform as platform14 } from "node:os";
106037
106108
  import { extname as extname5, join as join129 } from "node:path";
106038
106109
  var IS_WINDOWS2 = platform14() === "win32";
@@ -106093,7 +106164,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
106093
106164
  let totalChanges = 0;
106094
106165
  let filesSkipped = 0;
106095
106166
  async function processDirectory2(dir) {
106096
- const entries = await readdir39(dir, { withFileTypes: true });
106167
+ const entries = await readdir40(dir, { withFileTypes: true });
106097
106168
  for (const entry of entries) {
106098
106169
  const fullPath = join129(dir, entry.name);
106099
106170
  if (entry.isDirectory()) {
@@ -106150,7 +106221,7 @@ async function handleOpenCode(ctx) {
106150
106221
  logger.success(`Transformed ${transformResult.totalChanges} OpenCode path(s) in ${transformResult.filesTransformed} file(s)`);
106151
106222
  }
106152
106223
  await import_fs_extra32.ensureDir(targetDir);
106153
- const entries = await readdir40(openCodeSource, { withFileTypes: true });
106224
+ const entries = await readdir41(openCodeSource, { withFileTypes: true });
106154
106225
  for (const entry of entries) {
106155
106226
  const sourcePath = join130(openCodeSource, entry.name);
106156
106227
  const targetPath = join130(targetDir, entry.name);
@@ -106502,7 +106573,7 @@ async function runPreflightChecks() {
106502
106573
 
106503
106574
  // src/domains/installation/fresh-installer.ts
106504
106575
  init_metadata_migration();
106505
- import { existsSync as existsSync66, readdirSync as readdirSync9, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
106576
+ import { existsSync as existsSync67, readdirSync as readdirSync9, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
106506
106577
  import { basename as basename28, dirname as dirname39, join as join132, resolve as resolve45 } from "node:path";
106507
106578
  init_logger();
106508
106579
  init_safe_spinner();
@@ -106586,7 +106657,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
106586
106657
  }
106587
106658
  for (const file of filesToRemove) {
106588
106659
  const fullPath = join132(claudeDir3, file.path);
106589
- if (!existsSync66(fullPath)) {
106660
+ if (!existsSync67(fullPath)) {
106590
106661
  continue;
106591
106662
  }
106592
106663
  try {
@@ -106644,8 +106715,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
106644
106715
  mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
106645
106716
  };
106646
106717
  }
106647
- const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync66(join132(claudeDir3, subdir)));
106648
- if (existsSync66(join132(claudeDir3, "metadata.json"))) {
106718
+ const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync67(join132(claudeDir3, subdir)));
106719
+ if (existsSync67(join132(claudeDir3, "metadata.json"))) {
106649
106720
  deletePaths.push("metadata.json");
106650
106721
  }
106651
106722
  return {
@@ -106751,7 +106822,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
106751
106822
 
106752
106823
  // src/domains/installation/global-kit-legacy-repair.ts
106753
106824
  var import_fs_extra35 = __toESM(require_lib(), 1);
106754
- import { cp as cp5, mkdir as mkdir35, readdir as readdir41, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
106825
+ import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
106755
106826
  import { homedir as homedir47 } from "node:os";
106756
106827
  import { dirname as dirname40, join as join133, normalize as normalize11, resolve as resolve46 } from "node:path";
106757
106828
  var LEGACY_KIT_MARKERS = [
@@ -106822,7 +106893,7 @@ async function hasKitMarkers(dir) {
106822
106893
  async function isEmptyDirectory(dir) {
106823
106894
  if (!await isDirectory(dir))
106824
106895
  return false;
106825
- return (await readdir41(dir)).length === 0;
106896
+ return (await readdir42(dir)).length === 0;
106826
106897
  }
106827
106898
  async function moveDirectory(source, target) {
106828
106899
  try {
@@ -107730,7 +107801,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
107730
107801
  // src/services/transformers/folder-transform/path-replacer.ts
107731
107802
  init_logger();
107732
107803
  init_types3();
107733
- import { readFile as readFile60, readdir as readdir42, writeFile as writeFile34 } from "node:fs/promises";
107804
+ import { readFile as readFile60, readdir as readdir43, writeFile as writeFile34 } from "node:fs/promises";
107734
107805
  import { join as join137, relative as relative30 } from "node:path";
107735
107806
  var TRANSFORMABLE_FILE_PATTERNS = [
107736
107807
  ".md",
@@ -107782,7 +107853,7 @@ function compileReplacements(replacements) {
107782
107853
  async function transformFileContents(dir, compiledReplacements, options2) {
107783
107854
  let filesChanged = 0;
107784
107855
  let replacementsCount = 0;
107785
- const entries = await readdir42(dir, { withFileTypes: true });
107856
+ const entries = await readdir43(dir, { withFileTypes: true });
107786
107857
  for (const entry of entries) {
107787
107858
  const fullPath = join137(dir, entry.name);
107788
107859
  if (entry.isDirectory()) {
@@ -107919,7 +107990,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
107919
107990
 
107920
107991
  // src/services/transformers/global-path-transformer.ts
107921
107992
  init_logger();
107922
- import { readFile as readFile61, readdir as readdir43, writeFile as writeFile35 } from "node:fs/promises";
107993
+ import { readFile as readFile61, readdir as readdir44, writeFile as writeFile35 } from "node:fs/promises";
107923
107994
  import { homedir as homedir48, platform as platform15 } from "node:os";
107924
107995
  import { extname as extname6, join as join138 } from "node:path";
107925
107996
  var IS_WINDOWS3 = platform15() === "win32";
@@ -108060,7 +108131,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
108060
108131
  let filesSkipped = 0;
108061
108132
  const skippedFiles = [];
108062
108133
  async function processDirectory2(dir) {
108063
- const entries = await readdir43(dir, { withFileTypes: true });
108134
+ const entries = await readdir44(dir, { withFileTypes: true });
108064
108135
  for (const entry of entries) {
108065
108136
  const fullPath = join138(dir, entry.name);
108066
108137
  if (entry.isDirectory()) {
@@ -108346,7 +108417,7 @@ async function initCommand(options2) {
108346
108417
  // src/commands/migrate/migrate-command.ts
108347
108418
  init_dist2();
108348
108419
  var import_picocolors30 = __toESM(require_picocolors(), 1);
108349
- import { existsSync as existsSync67 } from "node:fs";
108420
+ import { existsSync as existsSync68 } from "node:fs";
108350
108421
  import { readFile as readFile65, rm as rm18, unlink as unlink14 } from "node:fs/promises";
108351
108422
  import { homedir as homedir53 } from "node:os";
108352
108423
  import { basename as basename30, join as join143, resolve as resolve50 } from "node:path";
@@ -109989,7 +110060,7 @@ async function executeDeleteAction(action, options2) {
109989
110060
  const preservePaths = options2?.preservePaths ?? new Set;
109990
110061
  const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve50(action.targetPath));
109991
110062
  try {
109992
- if (!shouldPreserveTarget && action.targetPath && existsSync67(action.targetPath)) {
110063
+ if (!shouldPreserveTarget && action.targetPath && existsSync68(action.targetPath)) {
109993
110064
  await rm18(action.targetPath, { recursive: true, force: true });
109994
110065
  }
109995
110066
  await removePortableInstallation(action.item, action.type, action.provider, action.global, action.targetPath ? { path: action.targetPath } : undefined);
@@ -110021,7 +110092,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
110021
110092
  if (!skillSourcePath)
110022
110093
  return;
110023
110094
  const sourceMetadataPath = join143(resolve50(skillSourcePath, ".."), "metadata.json");
110024
- if (!existsSync67(sourceMetadataPath))
110095
+ if (!existsSync68(sourceMetadataPath))
110025
110096
  return;
110026
110097
  let sourceMetadata;
110027
110098
  try {
@@ -110034,7 +110105,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
110034
110105
  if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
110035
110106
  return;
110036
110107
  const claudeDir3 = installGlobally ? join143(homedir53(), ".claude") : join143(process.cwd(), ".claude");
110037
- if (!existsSync67(claudeDir3))
110108
+ if (!existsSync68(claudeDir3))
110038
110109
  return;
110039
110110
  try {
110040
110111
  const result = await handleDeletions(sourceMetadata, claudeDir3, inferKitTypeFromSourceMetadata(sourceMetadata));
@@ -110326,7 +110397,7 @@ async function migrateCommand(options2) {
110326
110397
  const interactive = process.stdout.isTTY && !options2.yes;
110327
110398
  const conflictActions = plan.actions.filter((a3) => a3.action === "conflict");
110328
110399
  for (const action of conflictActions) {
110329
- if (!action.diff && action.targetPath && existsSync67(action.targetPath)) {
110400
+ if (!action.diff && action.targetPath && existsSync68(action.targetPath)) {
110330
110401
  try {
110331
110402
  const targetContent = await readFile65(action.targetPath, "utf-8");
110332
110403
  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);
@@ -110642,7 +110713,7 @@ async function migrateCommand(options2) {
110642
110713
  async function rollbackResults(results) {
110643
110714
  const rolledBackPaths = new Set;
110644
110715
  for (const result of results) {
110645
- if (!result.path || !existsSync67(result.path))
110716
+ if (!result.path || !existsSync68(result.path))
110646
110717
  continue;
110647
110718
  try {
110648
110719
  if (result.overwritten)
@@ -111209,7 +111280,7 @@ Please use only one download method.`);
111209
111280
  }
111210
111281
  // src/commands/plan/plan-command.ts
111211
111282
  init_output_manager();
111212
- import { existsSync as existsSync70, statSync as statSync12 } from "node:fs";
111283
+ import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
111213
111284
  import { dirname as dirname47, isAbsolute as isAbsolute14, join as join148, parse as parse7, resolve as resolve55 } from "node:path";
111214
111285
 
111215
111286
  // src/commands/plan/plan-read-handlers.ts
@@ -111219,14 +111290,14 @@ init_plans_registry();
111219
111290
  init_logger();
111220
111291
  init_output_manager();
111221
111292
  var import_picocolors32 = __toESM(require_picocolors(), 1);
111222
- import { existsSync as existsSync69, statSync as statSync11 } from "node:fs";
111293
+ import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
111223
111294
  import { basename as basename31, dirname as dirname45, join as join147, relative as relative31, resolve as resolve53 } from "node:path";
111224
111295
 
111225
111296
  // src/commands/plan/plan-dependencies.ts
111226
111297
  init_config();
111227
111298
  init_plan_parser();
111228
111299
  init_plans_registry();
111229
- import { existsSync as existsSync68 } from "node:fs";
111300
+ import { existsSync as existsSync69 } from "node:fs";
111230
111301
  import { dirname as dirname44, join as join146 } from "node:path";
111231
111302
  async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
111232
111303
  if (references.length === 0)
@@ -111249,7 +111320,7 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
111249
111320
  const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
111250
111321
  const planFile = join146(scopeRoot, planId, "plan.md");
111251
111322
  const isSelfReference = planFile === currentPlanFile;
111252
- if (!existsSync68(planFile)) {
111323
+ if (!existsSync69(planFile)) {
111253
111324
  return {
111254
111325
  reference,
111255
111326
  scope,
@@ -111389,7 +111460,7 @@ async function handleStatus(target, options2) {
111389
111460
  }
111390
111461
  const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
111391
111462
  const t = effectiveTarget ? resolve53(effectiveTarget) : null;
111392
- const plansDir = t && existsSync69(t) && statSync11(t).isDirectory() && !existsSync69(join147(t, "plan.md")) ? t : null;
111463
+ const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(join147(t, "plan.md")) ? t : null;
111393
111464
  if (plansDir) {
111394
111465
  const planFiles = scanPlanDir(plansDir);
111395
111466
  if (planFiles.length === 0) {
@@ -111807,19 +111878,19 @@ function resolveTargetPath(target, baseDir) {
111807
111878
  return resolve55(target);
111808
111879
  }
111809
111880
  const cwdCandidate = resolve55(target);
111810
- if (existsSync70(cwdCandidate)) {
111881
+ if (existsSync71(cwdCandidate)) {
111811
111882
  return cwdCandidate;
111812
111883
  }
111813
111884
  return resolve55(baseDir, target);
111814
111885
  }
111815
111886
  function resolvePlanFile(target, baseDir) {
111816
111887
  const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve55(baseDir) : process.cwd();
111817
- if (existsSync70(t)) {
111888
+ if (existsSync71(t)) {
111818
111889
  const stat24 = statSync12(t);
111819
111890
  if (stat24.isFile())
111820
111891
  return t;
111821
111892
  const candidate = join148(t, "plan.md");
111822
- if (existsSync70(candidate))
111893
+ if (existsSync71(candidate))
111823
111894
  return candidate;
111824
111895
  }
111825
111896
  if (!target && !baseDir) {
@@ -111827,7 +111898,7 @@ function resolvePlanFile(target, baseDir) {
111827
111898
  const root = parse7(dir).root;
111828
111899
  while (dir !== root) {
111829
111900
  const candidate = join148(dir, "plan.md");
111830
- if (existsSync70(candidate))
111901
+ if (existsSync71(candidate))
111831
111902
  return candidate;
111832
111903
  dir = dirname47(dir);
111833
111904
  }
@@ -111877,7 +111948,7 @@ async function planCommand(action, target, options2) {
111877
111948
  let resolvedTarget = target;
111878
111949
  if (resolvedAction && !knownActions.has(resolvedAction)) {
111879
111950
  const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
111880
- const existsOnDisk = !looksLikePath && existsSync70(resolve55(resolvedAction));
111951
+ const existsOnDisk = !looksLikePath && existsSync71(resolve55(resolvedAction));
111881
111952
  if (looksLikePath || existsOnDisk) {
111882
111953
  resolvedTarget = resolvedAction;
111883
111954
  resolvedAction = undefined;
@@ -111919,13 +111990,13 @@ init_claudekit_data2();
111919
111990
  init_logger();
111920
111991
  init_safe_prompts();
111921
111992
  var import_picocolors34 = __toESM(require_picocolors(), 1);
111922
- import { existsSync as existsSync71 } from "node:fs";
111993
+ import { existsSync as existsSync72 } from "node:fs";
111923
111994
  import { resolve as resolve56 } from "node:path";
111924
111995
  async function handleAdd(projectPath, options2) {
111925
111996
  logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
111926
111997
  intro("Add Project");
111927
111998
  const absolutePath = resolve56(projectPath);
111928
- if (!existsSync71(absolutePath)) {
111999
+ if (!existsSync72(absolutePath)) {
111929
112000
  log.error(`Path does not exist: ${absolutePath}`);
111930
112001
  process.exitCode = 1;
111931
112002
  return;
@@ -113764,7 +113835,7 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
113764
113835
 
113765
113836
  // src/commands/watch/watch-command.ts
113766
113837
  init_logger();
113767
- import { existsSync as existsSync77 } from "node:fs";
113838
+ import { existsSync as existsSync78 } from "node:fs";
113768
113839
  import { rm as rm19 } from "node:fs/promises";
113769
113840
  import { join as join159 } from "node:path";
113770
113841
  var import_picocolors41 = __toESM(require_picocolors(), 1);
@@ -114662,12 +114733,12 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
114662
114733
  }
114663
114734
 
114664
114735
  // src/commands/watch/phases/plan-dir-finder.ts
114665
- import { readdir as readdir45, stat as stat24 } from "node:fs/promises";
114736
+ import { readdir as readdir46, stat as stat24 } from "node:fs/promises";
114666
114737
  import { join as join154 } from "node:path";
114667
114738
  async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
114668
114739
  const plansRoot = join154(cwd2, "plans");
114669
114740
  try {
114670
- const entries = await readdir45(plansRoot);
114741
+ const entries = await readdir46(plansRoot);
114671
114742
  const tenMinAgo = Date.now() - 10 * 60 * 1000;
114672
114743
  const issueStr = String(issueNumber);
114673
114744
  const candidates = [];
@@ -115063,14 +115134,14 @@ function cleanExpiredIssues(state, ttlDays) {
115063
115134
  init_ck_config_manager();
115064
115135
  init_file_io();
115065
115136
  init_logger();
115066
- import { existsSync as existsSync73 } from "node:fs";
115137
+ import { existsSync as existsSync74 } from "node:fs";
115067
115138
  import { mkdir as mkdir41, readFile as readFile68 } from "node:fs/promises";
115068
115139
  import { dirname as dirname49 } from "node:path";
115069
115140
  var PROCESSED_ISSUES_CAP = 500;
115070
115141
  async function readCkJson(projectDir) {
115071
115142
  const configPath = CkConfigManager.getProjectConfigPath(projectDir);
115072
115143
  try {
115073
- if (!existsSync73(configPath))
115144
+ if (!existsSync74(configPath))
115074
115145
  return {};
115075
115146
  const content = await readFile68(configPath, "utf-8");
115076
115147
  return JSON.parse(content);
@@ -115096,7 +115167,7 @@ async function loadWatchState(projectDir) {
115096
115167
  async function saveWatchState(projectDir, state) {
115097
115168
  const configPath = CkConfigManager.getProjectConfigPath(projectDir);
115098
115169
  const configDir = dirname49(configPath);
115099
- if (!existsSync73(configDir)) {
115170
+ if (!existsSync74(configDir)) {
115100
115171
  await mkdir41(configDir, { recursive: true });
115101
115172
  }
115102
115173
  const raw2 = await readCkJson(projectDir);
@@ -115223,12 +115294,12 @@ async function processImplementationQueue(state, config, setup, options2, watchL
115223
115294
  // src/commands/watch/phases/repo-scanner.ts
115224
115295
  init_logger();
115225
115296
  import { spawnSync as spawnSync7 } from "node:child_process";
115226
- import { existsSync as existsSync74 } from "node:fs";
115227
- import { readdir as readdir46, stat as stat25 } from "node:fs/promises";
115297
+ import { existsSync as existsSync75 } from "node:fs";
115298
+ import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
115228
115299
  import { join as join156 } from "node:path";
115229
115300
  async function scanForRepos(parentDir) {
115230
115301
  const repos = [];
115231
- const entries = await readdir46(parentDir);
115302
+ const entries = await readdir47(parentDir);
115232
115303
  for (const entry of entries) {
115233
115304
  if (entry.startsWith("."))
115234
115305
  continue;
@@ -115237,7 +115308,7 @@ async function scanForRepos(parentDir) {
115237
115308
  if (!entryStat.isDirectory())
115238
115309
  continue;
115239
115310
  const gitDir = join156(fullPath, ".git");
115240
- if (!existsSync74(gitDir))
115311
+ if (!existsSync75(gitDir))
115241
115312
  continue;
115242
115313
  const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
115243
115314
  encoding: "utf-8",
@@ -115261,7 +115332,7 @@ async function scanForRepos(parentDir) {
115261
115332
  // src/commands/watch/phases/setup-validator.ts
115262
115333
  init_logger();
115263
115334
  import { spawnSync as spawnSync8 } from "node:child_process";
115264
- import { existsSync as existsSync75 } from "node:fs";
115335
+ import { existsSync as existsSync76 } from "node:fs";
115265
115336
  import { homedir as homedir54 } from "node:os";
115266
115337
  import { join as join157 } from "node:path";
115267
115338
  async function validateSetup(cwd2) {
@@ -115295,7 +115366,7 @@ Run this command from a directory with a GitHub remote.`);
115295
115366
  throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
115296
115367
  }
115297
115368
  const skillsPath = join157(homedir54(), ".claude", "skills");
115298
- const skillsAvailable = existsSync75(skillsPath);
115369
+ const skillsAvailable = existsSync76(skillsPath);
115299
115370
  if (!skillsAvailable) {
115300
115371
  logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
115301
115372
  }
@@ -115311,7 +115382,7 @@ Run this command from a directory with a GitHub remote.`);
115311
115382
  init_logger();
115312
115383
  init_path_resolver();
115313
115384
  import { createWriteStream as createWriteStream3, statSync as statSync13 } from "node:fs";
115314
- import { existsSync as existsSync76 } from "node:fs";
115385
+ import { existsSync as existsSync77 } from "node:fs";
115315
115386
  import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
115316
115387
  import { join as join158 } from "node:path";
115317
115388
 
@@ -115326,7 +115397,7 @@ class WatchLogger {
115326
115397
  }
115327
115398
  async init() {
115328
115399
  try {
115329
- if (!existsSync76(this.logDir)) {
115400
+ if (!existsSync77(this.logDir)) {
115330
115401
  await mkdir42(this.logDir, { recursive: true });
115331
115402
  }
115332
115403
  const dateStr = formatDate(new Date);
@@ -115512,7 +115583,7 @@ async function watchCommand(options2) {
115512
115583
  }
115513
115584
  async function discoverRepos(options2, watchLog) {
115514
115585
  const cwd2 = process.cwd();
115515
- const isGitRepo = existsSync77(join159(cwd2, ".git"));
115586
+ const isGitRepo = existsSync78(join159(cwd2, ".git"));
115516
115587
  if (options2.force) {
115517
115588
  await forceRemoveLock(watchLog);
115518
115589
  }
@@ -115769,7 +115840,7 @@ function registerCommands(cli) {
115769
115840
  // src/cli/version-display.ts
115770
115841
  init_package();
115771
115842
  init_config_version_checker();
115772
- import { existsSync as existsSync89, readFileSync as readFileSync22 } from "node:fs";
115843
+ import { existsSync as existsSync90, readFileSync as readFileSync22 } from "node:fs";
115773
115844
  import { join as join171 } from "node:path";
115774
115845
 
115775
115846
  // src/domains/versioning/version-checker.ts
@@ -115783,7 +115854,7 @@ init_types3();
115783
115854
  // src/domains/versioning/version-cache.ts
115784
115855
  init_logger();
115785
115856
  init_path_resolver();
115786
- import { existsSync as existsSync88 } from "node:fs";
115857
+ import { existsSync as existsSync89 } from "node:fs";
115787
115858
  import { mkdir as mkdir43, readFile as readFile70, writeFile as writeFile42 } from "node:fs/promises";
115788
115859
  import { join as join170 } from "node:path";
115789
115860
 
@@ -115797,7 +115868,7 @@ class VersionCacheManager {
115797
115868
  static async load() {
115798
115869
  const cacheFile = VersionCacheManager.getCacheFile();
115799
115870
  try {
115800
- if (!existsSync88(cacheFile)) {
115871
+ if (!existsSync89(cacheFile)) {
115801
115872
  logger.debug("Version check cache not found");
115802
115873
  return null;
115803
115874
  }
@@ -115818,7 +115889,7 @@ class VersionCacheManager {
115818
115889
  const cacheFile = VersionCacheManager.getCacheFile();
115819
115890
  const cacheDir = PathResolver.getCacheDir(false);
115820
115891
  try {
115821
- if (!existsSync88(cacheDir)) {
115892
+ if (!existsSync89(cacheDir)) {
115822
115893
  await mkdir43(cacheDir, { recursive: true, mode: 448 });
115823
115894
  }
115824
115895
  await writeFile42(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
@@ -115840,7 +115911,7 @@ class VersionCacheManager {
115840
115911
  static async clear() {
115841
115912
  const cacheFile = VersionCacheManager.getCacheFile();
115842
115913
  try {
115843
- if (existsSync88(cacheFile)) {
115914
+ if (existsSync89(cacheFile)) {
115844
115915
  const fs20 = await import("node:fs/promises");
115845
115916
  await fs20.unlink(cacheFile);
115846
115917
  logger.debug("Version check cache cleared");
@@ -116107,7 +116178,7 @@ async function displayVersion() {
116107
116178
  const prefix = PathResolver.getPathPrefix(false);
116108
116179
  const localMetadataPath = prefix ? join171(process.cwd(), prefix, "metadata.json") : join171(process.cwd(), "metadata.json");
116109
116180
  const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
116110
- if (!isLocalSameAsGlobal && existsSync89(localMetadataPath)) {
116181
+ if (!isLocalSameAsGlobal && existsSync90(localMetadataPath)) {
116111
116182
  try {
116112
116183
  const rawMetadata = JSON.parse(readFileSync22(localMetadataPath, "utf-8"));
116113
116184
  const metadata = MetadataSchema.parse(rawMetadata);
@@ -116121,7 +116192,7 @@ async function displayVersion() {
116121
116192
  logger.verbose("Failed to parse local metadata.json", { error });
116122
116193
  }
116123
116194
  }
116124
- if (existsSync89(globalMetadataPath)) {
116195
+ if (existsSync90(globalMetadataPath)) {
116125
116196
  try {
116126
116197
  const rawMetadata = JSON.parse(readFileSync22(globalMetadataPath, "utf-8"));
116127
116198
  const metadata = MetadataSchema.parse(rawMetadata);