claudekit-cli 3.13.1 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +678 -595
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14524,7 +14524,7 @@ var updateCommandHelp;
14524
14524
  var init_update_command_help = __esm(() => {
14525
14525
  updateCommandHelp = {
14526
14526
  name: "update",
14527
- description: "Update ClaudeKit CLI to the latest version",
14527
+ description: "Update ClaudeKit CLI tool only (not kit content)",
14528
14528
  usage: "ck update [options]",
14529
14529
  examples: [
14530
14530
  {
@@ -14587,7 +14587,7 @@ var init_update_command_help = __esm(() => {
14587
14587
  sections: [
14588
14588
  {
14589
14589
  title: "Note",
14590
- content: "'ck update' now only updates the ClaudeKit CLI itself. To update a kit installation, use 'ck init'."
14590
+ content: "'ck update' updates the CLI tool only. To update kit content (skills, commands, workflows), use 'ck init' for local or 'ck init -g' for global."
14591
14591
  }
14592
14592
  ]
14593
14593
  };
@@ -14674,22 +14674,22 @@ function padEnd(text, width) {
14674
14674
  const padding = Math.max(0, width - visibleLength);
14675
14675
  return text + " ".repeat(padding);
14676
14676
  }
14677
- var import_picocolors21, NO_COLOR, isColorSupported, identity = (text) => text, colors, defaultTheme;
14677
+ var import_picocolors23, NO_COLOR, isColorSupported, identity = (text) => text, colors, defaultTheme;
14678
14678
  var init_help_colors = __esm(() => {
14679
- import_picocolors21 = __toESM(require_picocolors(), 1);
14679
+ import_picocolors23 = __toESM(require_picocolors(), 1);
14680
14680
  NO_COLOR = process.env.NO_COLOR !== undefined;
14681
14681
  isColorSupported = !NO_COLOR && Boolean(process.stdout.isTTY);
14682
14682
  colors = {
14683
- banner: isColorSupported ? import_picocolors21.default.cyan : identity,
14684
- command: isColorSupported ? import_picocolors21.default.bold : identity,
14685
- heading: isColorSupported ? import_picocolors21.default.yellow : identity,
14686
- flag: isColorSupported ? import_picocolors21.default.green : identity,
14687
- description: isColorSupported ? import_picocolors21.default.gray : identity,
14688
- example: isColorSupported ? import_picocolors21.default.blue : identity,
14689
- warning: isColorSupported ? import_picocolors21.default.yellow : identity,
14690
- error: isColorSupported ? import_picocolors21.default.red : identity,
14691
- muted: isColorSupported ? import_picocolors21.default.dim : identity,
14692
- success: isColorSupported ? import_picocolors21.default.green : identity
14683
+ banner: isColorSupported ? import_picocolors23.default.cyan : identity,
14684
+ command: isColorSupported ? import_picocolors23.default.bold : identity,
14685
+ heading: isColorSupported ? import_picocolors23.default.yellow : identity,
14686
+ flag: isColorSupported ? import_picocolors23.default.green : identity,
14687
+ description: isColorSupported ? import_picocolors23.default.gray : identity,
14688
+ example: isColorSupported ? import_picocolors23.default.blue : identity,
14689
+ warning: isColorSupported ? import_picocolors23.default.yellow : identity,
14690
+ error: isColorSupported ? import_picocolors23.default.red : identity,
14691
+ muted: isColorSupported ? import_picocolors23.default.dim : identity,
14692
+ success: isColorSupported ? import_picocolors23.default.green : identity
14693
14693
  };
14694
14694
  defaultTheme = {
14695
14695
  banner: colors.banner,
@@ -34348,8 +34348,25 @@ class ConfigManager {
34348
34348
  if (!existsSync15(configDir)) {
34349
34349
  await mkdir16(configDir, { recursive: true });
34350
34350
  }
34351
+ let existingConfig = {};
34352
+ if (existsSync15(configPath)) {
34353
+ try {
34354
+ const content = await readFile16(configPath, "utf-8");
34355
+ existingConfig = JSON.parse(content);
34356
+ } catch (error) {
34357
+ logger.debug(`Could not parse existing config, starting fresh: ${error instanceof Error ? error.message : "Unknown error"}`);
34358
+ }
34359
+ }
34351
34360
  const validFolders = FoldersConfigSchema.parse(folders);
34352
- await writeFile13(configPath, JSON.stringify({ paths: validFolders }, null, 2), "utf-8");
34361
+ const existingPaths = existingConfig.paths && typeof existingConfig.paths === "object" ? existingConfig.paths : {};
34362
+ const mergedConfig = {
34363
+ ...existingConfig,
34364
+ paths: {
34365
+ ...existingPaths,
34366
+ ...validFolders
34367
+ }
34368
+ };
34369
+ await writeFile13(configPath, JSON.stringify(mergedConfig, null, 2), "utf-8");
34353
34370
  logger.debug(`Project config saved to ${configPath}`);
34354
34371
  } catch (error) {
34355
34372
  throw new Error(`Failed to save project config: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -35375,6 +35392,7 @@ Protected files (.env, etc.) were not modified.`;
35375
35392
  // src/commands/new/new-command.ts
35376
35393
  init_logger();
35377
35394
  init_types2();
35395
+ var import_picocolors15 = __toESM(require_picocolors(), 1);
35378
35396
 
35379
35397
  // src/commands/new/phases/directory-setup.ts
35380
35398
  import { resolve as resolve8 } from "node:path";
@@ -35651,6 +35669,7 @@ async function newCommand(options) {
35651
35669
  if (ctx.cancelled)
35652
35670
  return;
35653
35671
  prompts.outro(`✨ Project created successfully at ${ctx.resolvedDir}`);
35672
+ log.info(`${import_picocolors15.default.dim("Tip:")} To update later: ${import_picocolors15.default.cyan("ck update")} (CLI) + ${import_picocolors15.default.cyan("ck init")} (kit content)`);
35654
35673
  } catch (error) {
35655
35674
  logger.error(error instanceof Error ? error.message : "Unknown error occurred");
35656
35675
  process.exit(1);
@@ -35659,7 +35678,7 @@ async function newCommand(options) {
35659
35678
  // src/commands/uninstall/uninstall-command.ts
35660
35679
  init_logger();
35661
35680
  init_types2();
35662
- var import_picocolors16 = __toESM(require_picocolors(), 1);
35681
+ var import_picocolors17 = __toESM(require_picocolors(), 1);
35663
35682
 
35664
35683
  // src/commands/uninstall/installation-detector.ts
35665
35684
  var import_fs_extra32 = __toESM(require_lib(), 1);
@@ -35693,7 +35712,7 @@ var import_fs_extra33 = __toESM(require_lib(), 1);
35693
35712
  import { readdirSync, rmSync } from "node:fs";
35694
35713
  import { dirname as dirname8, join as join63 } from "node:path";
35695
35714
  init_logger();
35696
- var import_picocolors15 = __toESM(require_picocolors(), 1);
35715
+ var import_picocolors16 = __toESM(require_picocolors(), 1);
35697
35716
  function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
35698
35717
  if (ownership === "ck") {
35699
35718
  return { action: "delete", reason: deleteReason };
@@ -35784,27 +35803,27 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
35784
35803
  }
35785
35804
  function displayDryRunPreview(analysis, installationType) {
35786
35805
  console.log("");
35787
- log.info(import_picocolors15.default.bold(`DRY RUN - Preview for ${installationType} installation:`));
35806
+ log.info(import_picocolors16.default.bold(`DRY RUN - Preview for ${installationType} installation:`));
35788
35807
  console.log("");
35789
35808
  if (analysis.toDelete.length > 0) {
35790
- console.log(import_picocolors15.default.red(import_picocolors15.default.bold(`Files to DELETE (${analysis.toDelete.length}):`)));
35809
+ console.log(import_picocolors16.default.red(import_picocolors16.default.bold(`Files to DELETE (${analysis.toDelete.length}):`)));
35791
35810
  const showDelete = analysis.toDelete.slice(0, 10);
35792
35811
  for (const item of showDelete) {
35793
- console.log(` ${import_picocolors15.default.red("✖")} ${item.path}`);
35812
+ console.log(` ${import_picocolors16.default.red("✖")} ${item.path}`);
35794
35813
  }
35795
35814
  if (analysis.toDelete.length > 10) {
35796
- console.log(import_picocolors15.default.gray(` ... and ${analysis.toDelete.length - 10} more`));
35815
+ console.log(import_picocolors16.default.gray(` ... and ${analysis.toDelete.length - 10} more`));
35797
35816
  }
35798
35817
  console.log("");
35799
35818
  }
35800
35819
  if (analysis.toPreserve.length > 0) {
35801
- console.log(import_picocolors15.default.green(import_picocolors15.default.bold(`Files to PRESERVE (${analysis.toPreserve.length}):`)));
35820
+ console.log(import_picocolors16.default.green(import_picocolors16.default.bold(`Files to PRESERVE (${analysis.toPreserve.length}):`)));
35802
35821
  const showPreserve = analysis.toPreserve.slice(0, 10);
35803
35822
  for (const item of showPreserve) {
35804
- console.log(` ${import_picocolors15.default.green("✓")} ${item.path} ${import_picocolors15.default.gray(`(${item.reason})`)}`);
35823
+ console.log(` ${import_picocolors16.default.green("✓")} ${item.path} ${import_picocolors16.default.gray(`(${item.reason})`)}`);
35805
35824
  }
35806
35825
  if (analysis.toPreserve.length > 10) {
35807
- console.log(import_picocolors15.default.gray(` ... and ${analysis.toPreserve.length - 10} more`));
35826
+ console.log(import_picocolors16.default.gray(` ... and ${analysis.toPreserve.length - 10} more`));
35808
35827
  }
35809
35828
  console.log("");
35810
35829
  }
@@ -35952,10 +35971,10 @@ async function uninstallCommand(options) {
35952
35971
  }
35953
35972
  displayInstallations(installations, scope);
35954
35973
  if (validOptions.kit) {
35955
- log.info(import_picocolors16.default.cyan(`Kit-scoped uninstall: ${validOptions.kit} kit only`));
35974
+ log.info(import_picocolors17.default.cyan(`Kit-scoped uninstall: ${validOptions.kit} kit only`));
35956
35975
  }
35957
35976
  if (validOptions.dryRun) {
35958
- log.info(import_picocolors16.default.yellow("DRY RUN MODE - No files will be deleted"));
35977
+ log.info(import_picocolors17.default.yellow("DRY RUN MODE - No files will be deleted"));
35959
35978
  await removeInstallations(installations, {
35960
35979
  dryRun: true,
35961
35980
  forceOverwrite: validOptions.forceOverwrite,
@@ -35965,8 +35984,8 @@ async function uninstallCommand(options) {
35965
35984
  return;
35966
35985
  }
35967
35986
  if (validOptions.forceOverwrite) {
35968
- log.warn(`${import_picocolors16.default.yellow(import_picocolors16.default.bold("FORCE MODE ENABLED"))}
35969
- ${import_picocolors16.default.yellow("User modifications will be permanently deleted!")}`);
35987
+ log.warn(`${import_picocolors17.default.yellow(import_picocolors17.default.bold("FORCE MODE ENABLED"))}
35988
+ ${import_picocolors17.default.yellow("User modifications will be permanently deleted!")}`);
35970
35989
  }
35971
35990
  if (!validOptions.yes) {
35972
35991
  const kitLabel = validOptions.kit ? ` (${validOptions.kit} kit only)` : "";
@@ -36127,206 +36146,534 @@ class NpmRegistryClient {
36127
36146
  }
36128
36147
  }
36129
36148
 
36130
- // src/commands/update-cli.ts
36131
- init_logger();
36132
- init_types2();
36133
- init_types2();
36149
+ // src/domains/versioning/checking/version-utils.ts
36134
36150
  var import_compare_versions2 = __toESM(require_umd(), 1);
36135
- // package.json
36136
- var package_default = {
36137
- name: "claudekit-cli",
36138
- version: "3.13.1",
36139
- description: "CLI tool for bootstrapping and updating ClaudeKit projects",
36140
- type: "module",
36141
- repository: {
36142
- type: "git",
36143
- url: "git+https://github.com/mrgoonie/claudekit-cli.git"
36144
- },
36145
- publishConfig: {
36146
- access: "public",
36147
- registry: "https://registry.npmjs.org"
36148
- },
36149
- bin: {
36150
- ck: "bin/ck.js"
36151
- },
36152
- files: [
36153
- "bin/ck.js",
36154
- "dist/index.js"
36155
- ],
36156
- scripts: {
36157
- dev: "bun run src/index.ts",
36158
- build: "bun build src/index.ts --outdir dist --target node --external @octokit/rest",
36159
- compile: "bun build src/index.ts --compile --outfile ck",
36160
- "compile:binary": "bun build src/index.ts --compile --outfile bin/ck",
36161
- "compile:binaries": "node scripts/build-all-binaries.js",
36162
- "check-version-sync": "node scripts/check-binary-version-sync.js",
36163
- "build:platform-binaries": "bun run scripts/build-platform-binaries.js",
36164
- test: "bun test",
36165
- "test:watch": "bun test --watch",
36166
- "test:quick": "./scripts/dev-quick-start.sh test",
36167
- lint: "biome check .",
36168
- "lint:fix": "biome check --fix .",
36169
- "lint:fix-unsafe": "biome check --fix --unsafe .",
36170
- format: "biome format --write .",
36171
- typecheck: "tsc --noEmit",
36172
- "dev:quick": "./scripts/dev-quick-start.sh",
36173
- "dev:all": "./scripts/dev-quick-start.sh all",
36174
- metrics: "bun run scripts/workflow-metrics.ts",
36175
- "install:hooks": "./.githooks/install.sh"
36176
- },
36177
- keywords: [
36178
- "cli",
36179
- "claudekit",
36180
- "boilerplate",
36181
- "bootstrap",
36182
- "template"
36183
- ],
36184
- author: "ClaudeKit",
36185
- license: "MIT",
36186
- engines: {
36187
- bun: ">=1.3.2",
36188
- node: ">=18.0.0"
36189
- },
36190
- dependencies: {
36191
- "@clack/prompts": "^0.7.0",
36192
- "@octokit/rest": "^22.0.0",
36193
- cac: "^6.7.14",
36194
- "cli-progress": "^3.12.0",
36195
- "compare-versions": "^6.1.1",
36196
- "extract-zip": "^2.0.1",
36197
- "fs-extra": "^11.2.0",
36198
- ignore: "^5.3.2",
36199
- minimatch: "^10.1.1",
36200
- ora: "^8.0.0",
36201
- "p-limit": "^7.2.0",
36202
- picocolors: "^1.1.1",
36203
- "proper-lockfile": "^4.1.2",
36204
- tar: "^7.4.3",
36205
- tmp: "^0.2.3",
36206
- zod: "^3.23.8"
36207
- },
36208
- devDependencies: {
36209
- "@biomejs/biome": "^1.9.4",
36210
- "@semantic-release/changelog": "^6.0.3",
36211
- "@semantic-release/git": "^10.0.1",
36212
- "@types/bun": "latest",
36213
- "@types/cli-progress": "^3.11.6",
36214
- "@types/fs-extra": "^11.0.4",
36215
- "@types/node": "^22.10.1",
36216
- "@types/proper-lockfile": "^4.1.4",
36217
- "@types/tar": "^6.1.13",
36218
- "@types/tmp": "^0.2.6",
36219
- "semantic-release": "^24.2.0",
36220
- typescript: "^5.7.2"
36151
+ function isUpdateCheckDisabled() {
36152
+ return process.env.NO_UPDATE_NOTIFIER === "1" || process.env.NO_UPDATE_NOTIFIER === "true" || !process.stdout.isTTY;
36153
+ }
36154
+ function normalizeVersion(version) {
36155
+ return version.replace(/^v/, "");
36156
+ }
36157
+ function isNewerVersion(currentVersion, latestVersion) {
36158
+ try {
36159
+ const current = normalizeVersion(currentVersion);
36160
+ const latest = normalizeVersion(latestVersion);
36161
+ return import_compare_versions2.compareVersions(latest, current) > 0;
36162
+ } catch {
36163
+ return false;
36221
36164
  }
36222
- };
36223
-
36224
- // src/commands/update-cli.ts
36225
- var execAsync7 = promisify7(exec7);
36165
+ }
36166
+ // src/domains/versioning/checking/kit-version-checker.ts
36167
+ init_logger();
36168
+ init_types2();
36226
36169
 
36227
- class CliUpdateError extends ClaudeKitError {
36228
- constructor(message) {
36229
- super(message, "CLI_UPDATE_ERROR");
36230
- this.name = "CliUpdateError";
36170
+ // src/domains/versioning/version-cache.ts
36171
+ init_logger();
36172
+ import { existsSync as existsSync16 } from "node:fs";
36173
+ import { mkdir as mkdir18, readFile as readFile20, writeFile as writeFile17 } from "node:fs/promises";
36174
+ import { join as join65 } from "node:path";
36175
+ class VersionCacheManager {
36176
+ static CACHE_FILENAME = "version-check.json";
36177
+ static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
36178
+ static getCacheFile() {
36179
+ const cacheDir = PathResolver.getCacheDir(false);
36180
+ return join65(cacheDir, VersionCacheManager.CACHE_FILENAME);
36231
36181
  }
36232
- }
36233
- var PACKAGE_NAME = "claudekit-cli";
36234
- async function updateCliCommand(options) {
36235
- const s = de();
36236
- intro("[>] ClaudeKit CLI - Update");
36237
- try {
36238
- const opts = UpdateCliOptionsSchema.parse(options);
36239
- const currentVersion = package_default.version;
36240
- logger.info(`Current CLI version: ${currentVersion}`);
36241
- s.start("Detecting package manager...");
36242
- const pm = await PackageManagerDetector.detect();
36243
- const pmVersion = await PackageManagerDetector.getVersion(pm);
36244
- s.stop(`Using ${PackageManagerDetector.getDisplayName(pm)}${pmVersion ? ` v${pmVersion}` : ""}`);
36245
- logger.verbose(`Detected package manager: ${pm}`);
36246
- s.start("Checking for updates...");
36247
- let targetVersion = null;
36248
- if (opts.release && opts.release !== "latest") {
36249
- const exists = await NpmRegistryClient.versionExists(PACKAGE_NAME, opts.release, opts.registry);
36250
- if (!exists) {
36251
- s.stop("Version not found");
36252
- throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run 'ck versions' to see available versions.`);
36182
+ static async load() {
36183
+ const cacheFile = VersionCacheManager.getCacheFile();
36184
+ try {
36185
+ if (!existsSync16(cacheFile)) {
36186
+ logger.debug("Version check cache not found");
36187
+ return null;
36253
36188
  }
36254
- targetVersion = opts.release;
36255
- s.stop(`Target version: ${targetVersion}`);
36256
- } else if (opts.beta) {
36257
- targetVersion = await NpmRegistryClient.getBetaVersion(PACKAGE_NAME, opts.registry);
36258
- if (!targetVersion) {
36259
- s.stop("No beta version available");
36260
- logger.warning("No beta version found. Using latest stable version instead.");
36261
- targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME, opts.registry);
36262
- } else {
36263
- s.stop(`Latest beta version: ${targetVersion}`);
36189
+ const content = await readFile20(cacheFile, "utf-8");
36190
+ const cache2 = JSON.parse(content);
36191
+ if (!cache2.lastCheck || !cache2.currentVersion || !cache2.latestVersion) {
36192
+ logger.debug("Invalid cache structure, ignoring");
36193
+ return null;
36264
36194
  }
36265
- } else {
36266
- targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME, opts.registry);
36267
- s.stop(`Latest version: ${targetVersion || "unknown"}`);
36268
- }
36269
- if (!targetVersion) {
36270
- throw new CliUpdateError(`Failed to fetch version information from npm registry. Check your internet connection and try again. Manual update: ${PackageManagerDetector.getUpdateCommand(pm, PACKAGE_NAME)}`);
36271
- }
36272
- const comparison = import_compare_versions2.compareVersions(currentVersion, targetVersion);
36273
- if (comparison === 0) {
36274
- outro(`[+] Already on the latest version (${currentVersion})`);
36275
- return;
36276
- }
36277
- if (comparison > 0 && !opts.release) {
36278
- outro(`[+] Current version (${currentVersion}) is newer than latest (${targetVersion})`);
36279
- return;
36280
- }
36281
- const isUpgrade = comparison < 0;
36282
- const changeType = isUpgrade ? "upgrade" : "downgrade";
36283
- logger.info(`${isUpgrade ? "[^]" : "[v]"} ${changeType}: ${currentVersion} -> ${targetVersion}`);
36284
- if (opts.check) {
36285
- note(`Update available: ${currentVersion} -> ${targetVersion}
36286
-
36287
- Run 'ck update' to install`, "Update Check");
36288
- outro("Check complete");
36289
- return;
36195
+ logger.debug(`Version check cache loaded: ${JSON.stringify(cache2)}`);
36196
+ return cache2;
36197
+ } catch (error) {
36198
+ logger.debug(`Failed to load version check cache: ${error}`);
36199
+ return null;
36290
36200
  }
36291
- if (!opts.yes) {
36292
- const shouldUpdate = await se({
36293
- message: `${isUpgrade ? "Update" : "Downgrade"} CLI from ${currentVersion} to ${targetVersion}?`
36294
- });
36295
- if (lD(shouldUpdate) || !shouldUpdate) {
36296
- outro("Update cancelled");
36297
- return;
36201
+ }
36202
+ static async save(cache2) {
36203
+ const cacheFile = VersionCacheManager.getCacheFile();
36204
+ const cacheDir = PathResolver.getCacheDir(false);
36205
+ try {
36206
+ if (!existsSync16(cacheDir)) {
36207
+ await mkdir18(cacheDir, { recursive: true, mode: 448 });
36298
36208
  }
36209
+ await writeFile17(cacheFile, JSON.stringify(cache2, null, 2), "utf-8");
36210
+ logger.debug(`Version check cache saved to ${cacheFile}`);
36211
+ } catch (error) {
36212
+ logger.debug(`Failed to save version check cache: ${error}`);
36299
36213
  }
36300
- const updateCmd = PackageManagerDetector.getUpdateCommand(pm, PACKAGE_NAME, targetVersion);
36301
- logger.info(`Running: ${updateCmd}`);
36302
- s.start("Updating CLI...");
36214
+ }
36215
+ static isCacheValid(cache2) {
36216
+ if (!cache2)
36217
+ return false;
36218
+ const now = Date.now();
36219
+ const age = now - cache2.lastCheck;
36220
+ const isValid2 = age < VersionCacheManager.CACHE_TTL_MS;
36221
+ const ageDays = (age / 1000 / 60 / 60 / 24).toFixed(1);
36222
+ logger.debug(`Cache validity check: age=${ageDays} days, valid=${isValid2}`);
36223
+ return isValid2;
36224
+ }
36225
+ static async clear() {
36226
+ const cacheFile = VersionCacheManager.getCacheFile();
36303
36227
  try {
36304
- await execAsync7(updateCmd, {
36305
- timeout: 120000
36306
- });
36307
- s.stop("Update completed");
36308
- } catch (error) {
36309
- s.stop("Update failed");
36310
- const errorMessage = error instanceof Error ? error.message : "Unknown error";
36311
- if (errorMessage.includes("EACCES") || errorMessage.includes("EPERM") || errorMessage.includes("permission") || errorMessage.includes("Access is denied")) {
36312
- throw new CliUpdateError(`Permission denied. Try: sudo ${updateCmd}
36313
-
36314
- Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally`);
36228
+ if (existsSync16(cacheFile)) {
36229
+ const fs12 = await import("node:fs/promises");
36230
+ await fs12.unlink(cacheFile);
36231
+ logger.debug("Version check cache cleared");
36315
36232
  }
36316
- throw new CliUpdateError(`Update failed: ${errorMessage}
36317
-
36318
- Manual update: ${updateCmd}`);
36233
+ } catch (error) {
36234
+ logger.debug(`Failed to clear version check cache: ${error}`);
36319
36235
  }
36320
- s.start("Verifying installation...");
36321
- try {
36236
+ }
36237
+ }
36238
+
36239
+ // src/domains/versioning/checking/kit-version-checker.ts
36240
+ async function fetchLatestRelease(currentVersion) {
36241
+ try {
36242
+ const githubClient = new GitHubClient;
36243
+ const kit = AVAILABLE_KITS.engineer;
36244
+ const timeoutPromise = new Promise((_3, reject) => setTimeout(() => reject(new Error("Timeout")), 5000));
36245
+ const releasePromise = githubClient.getLatestRelease(kit);
36246
+ const release = await Promise.race([releasePromise, timeoutPromise]);
36247
+ const latestVersion = release.tag_name;
36248
+ const updateAvailable = isNewerVersion(currentVersion, latestVersion);
36249
+ const releaseUrl = `https://github.com/${kit.owner}/${kit.repo}/releases/tag/${latestVersion}`;
36250
+ logger.debug(`Fetched latest release: current=${currentVersion}, latest=${latestVersion}, updateAvailable=${updateAvailable}`);
36251
+ return {
36252
+ currentVersion,
36253
+ latestVersion,
36254
+ updateAvailable,
36255
+ releaseUrl
36256
+ };
36257
+ } catch (error) {
36258
+ logger.debug(`Failed to fetch latest release: ${error}`);
36259
+ return null;
36260
+ }
36261
+ }
36262
+
36263
+ class VersionChecker {
36264
+ static async check(currentVersion) {
36265
+ if (isUpdateCheckDisabled()) {
36266
+ logger.debug("Update check disabled by environment");
36267
+ return null;
36268
+ }
36269
+ const cache2 = await VersionCacheManager.load();
36270
+ if (cache2 && VersionCacheManager.isCacheValid(cache2) && cache2.currentVersion === currentVersion) {
36271
+ logger.debug("Using cached version check result");
36272
+ return {
36273
+ currentVersion: cache2.currentVersion,
36274
+ latestVersion: cache2.latestVersion,
36275
+ updateAvailable: cache2.updateAvailable,
36276
+ releaseUrl: cache2.latestUrl
36277
+ };
36278
+ }
36279
+ logger.debug("Cache expired or invalid, fetching latest release");
36280
+ const result = await fetchLatestRelease(currentVersion);
36281
+ if (result) {
36282
+ await VersionCacheManager.save({
36283
+ lastCheck: Date.now(),
36284
+ currentVersion: result.currentVersion,
36285
+ latestVersion: result.latestVersion,
36286
+ latestUrl: result.releaseUrl,
36287
+ updateAvailable: result.updateAvailable
36288
+ });
36289
+ }
36290
+ return result;
36291
+ }
36292
+ }
36293
+ // src/domains/versioning/checking/cli-version-checker.ts
36294
+ init_logger();
36295
+ var import_compare_versions3 = __toESM(require_umd(), 1);
36296
+ var PACKAGE_NAME = "claudekit-cli";
36297
+
36298
+ class CliVersionChecker {
36299
+ static async check(currentVersion) {
36300
+ if (isUpdateCheckDisabled()) {
36301
+ logger.debug("CLI update check disabled by environment");
36302
+ return null;
36303
+ }
36304
+ try {
36305
+ const latestVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME);
36306
+ if (!latestVersion) {
36307
+ logger.debug("Failed to fetch latest CLI version from npm");
36308
+ return null;
36309
+ }
36310
+ const current = normalizeVersion(currentVersion);
36311
+ const latest = normalizeVersion(latestVersion);
36312
+ const updateAvailable = import_compare_versions3.compareVersions(latest, current) > 0;
36313
+ logger.debug(`CLI version check: current=${current}, latest=${latest}, updateAvailable=${updateAvailable}`);
36314
+ return {
36315
+ currentVersion: current,
36316
+ latestVersion: latest,
36317
+ updateAvailable,
36318
+ releaseUrl: `https://www.npmjs.com/package/${PACKAGE_NAME}`
36319
+ };
36320
+ } catch (error) {
36321
+ logger.debug(`CLI version check failed: ${error}`);
36322
+ return null;
36323
+ }
36324
+ }
36325
+ }
36326
+ // src/domains/versioning/checking/notification-display.ts
36327
+ var import_picocolors18 = __toESM(require_picocolors(), 1);
36328
+ function createNotificationBox(borderColor, boxWidth) {
36329
+ const contentWidth = boxWidth - 2;
36330
+ const topBorder = borderColor(`╭${"─".repeat(contentWidth)}╮`);
36331
+ const bottomBorder = borderColor(`╰${"─".repeat(contentWidth)}╯`);
36332
+ const emptyLine = borderColor("│") + " ".repeat(contentWidth) + borderColor("│");
36333
+ const padLine = (text, visibleLen) => {
36334
+ const len = visibleLen ?? text.length;
36335
+ const displayText = len > contentWidth ? `${text.slice(0, contentWidth - 3)}...` : text;
36336
+ const actualLen = visibleLen ?? displayText.length;
36337
+ const totalPadding = contentWidth - actualLen;
36338
+ const leftPadding = Math.max(0, Math.floor(totalPadding / 2));
36339
+ const rightPadding = Math.max(0, totalPadding - leftPadding);
36340
+ return borderColor("│") + " ".repeat(leftPadding) + displayText + " ".repeat(rightPadding) + borderColor("│");
36341
+ };
36342
+ return { topBorder, bottomBorder, emptyLine, padLine };
36343
+ }
36344
+ function displayKitNotification(result, options = {}) {
36345
+ if (!result.updateAvailable)
36346
+ return;
36347
+ const { currentVersion, latestVersion } = result;
36348
+ const { isGlobal = false } = options;
36349
+ const displayCurrent = normalizeVersion(currentVersion);
36350
+ const displayLatest = normalizeVersion(latestVersion);
36351
+ const boxWidth = 52;
36352
+ const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.cyan, boxWidth);
36353
+ const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ Kit Update Available"));
36354
+ const headerLen = "⬆ Kit Update Available".length;
36355
+ const versionText = `${import_picocolors18.default.dim(displayCurrent)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(displayLatest))}`;
36356
+ const versionLen = displayCurrent.length + 3 + displayLatest.length;
36357
+ const updateCmd = isGlobal ? "ck init -g" : "ck init";
36358
+ const commandText = `Run: ${import_picocolors18.default.cyan(import_picocolors18.default.bold(updateCmd))}`;
36359
+ const commandLen = `Run: ${updateCmd}`.length;
36360
+ console.log("");
36361
+ console.log(topBorder);
36362
+ console.log(emptyLine);
36363
+ console.log(padLine(headerText, headerLen));
36364
+ console.log(padLine(versionText, versionLen));
36365
+ console.log(emptyLine);
36366
+ console.log(padLine(commandText, commandLen));
36367
+ console.log(emptyLine);
36368
+ console.log(bottomBorder);
36369
+ console.log("");
36370
+ }
36371
+ function displayCliNotification(result) {
36372
+ if (!result.updateAvailable)
36373
+ return;
36374
+ const { currentVersion, latestVersion } = result;
36375
+ const boxWidth = 52;
36376
+ const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.magenta, boxWidth);
36377
+ const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ CLI Update Available"));
36378
+ const headerLen = "⬆ CLI Update Available".length;
36379
+ const versionText = `${import_picocolors18.default.dim(currentVersion)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(latestVersion))}`;
36380
+ const versionLen = currentVersion.length + 3 + latestVersion.length;
36381
+ const commandText = `Run: ${import_picocolors18.default.magenta(import_picocolors18.default.bold("ck update"))}`;
36382
+ const commandLen = "Run: ck update".length;
36383
+ console.log("");
36384
+ console.log(topBorder);
36385
+ console.log(emptyLine);
36386
+ console.log(padLine(headerText, headerLen));
36387
+ console.log(padLine(versionText, versionLen));
36388
+ console.log(emptyLine);
36389
+ console.log(padLine(commandText, commandLen));
36390
+ console.log(emptyLine);
36391
+ console.log(bottomBorder);
36392
+ console.log("");
36393
+ }
36394
+ // src/domains/versioning/version-checker.ts
36395
+ class VersionChecker2 {
36396
+ static async check(currentVersion) {
36397
+ return VersionChecker.check(currentVersion);
36398
+ }
36399
+ static displayNotification(result, options = {}) {
36400
+ displayKitNotification(result, options);
36401
+ }
36402
+ }
36403
+
36404
+ class CliVersionChecker2 {
36405
+ static async check(currentVersion) {
36406
+ return CliVersionChecker.check(currentVersion);
36407
+ }
36408
+ static displayNotification(result) {
36409
+ displayCliNotification(result);
36410
+ }
36411
+ }
36412
+
36413
+ // src/commands/update-cli.ts
36414
+ init_logger();
36415
+ init_types2();
36416
+ init_types2();
36417
+ var import_compare_versions4 = __toESM(require_umd(), 1);
36418
+ var import_picocolors19 = __toESM(require_picocolors(), 1);
36419
+ // package.json
36420
+ var package_default = {
36421
+ name: "claudekit-cli",
36422
+ version: "3.14.0",
36423
+ description: "CLI tool for bootstrapping and updating ClaudeKit projects",
36424
+ type: "module",
36425
+ repository: {
36426
+ type: "git",
36427
+ url: "git+https://github.com/mrgoonie/claudekit-cli.git"
36428
+ },
36429
+ publishConfig: {
36430
+ access: "public",
36431
+ registry: "https://registry.npmjs.org"
36432
+ },
36433
+ bin: {
36434
+ ck: "bin/ck.js"
36435
+ },
36436
+ files: [
36437
+ "bin/ck.js",
36438
+ "dist/index.js"
36439
+ ],
36440
+ scripts: {
36441
+ dev: "bun run src/index.ts",
36442
+ build: "bun build src/index.ts --outdir dist --target node --external @octokit/rest",
36443
+ compile: "bun build src/index.ts --compile --outfile ck",
36444
+ "compile:binary": "bun build src/index.ts --compile --outfile bin/ck",
36445
+ "compile:binaries": "node scripts/build-all-binaries.js",
36446
+ "check-version-sync": "node scripts/check-binary-version-sync.js",
36447
+ "build:platform-binaries": "bun run scripts/build-platform-binaries.js",
36448
+ test: "bun test",
36449
+ "test:watch": "bun test --watch",
36450
+ "test:quick": "./scripts/dev-quick-start.sh test",
36451
+ lint: "biome check .",
36452
+ "lint:fix": "biome check --fix .",
36453
+ "lint:fix-unsafe": "biome check --fix --unsafe .",
36454
+ format: "biome format --write .",
36455
+ typecheck: "tsc --noEmit",
36456
+ "dev:quick": "./scripts/dev-quick-start.sh",
36457
+ "dev:all": "./scripts/dev-quick-start.sh all",
36458
+ metrics: "bun run scripts/workflow-metrics.ts",
36459
+ "install:hooks": "./.githooks/install.sh"
36460
+ },
36461
+ keywords: [
36462
+ "cli",
36463
+ "claudekit",
36464
+ "boilerplate",
36465
+ "bootstrap",
36466
+ "template"
36467
+ ],
36468
+ author: "ClaudeKit",
36469
+ license: "MIT",
36470
+ engines: {
36471
+ bun: ">=1.3.2",
36472
+ node: ">=18.0.0"
36473
+ },
36474
+ dependencies: {
36475
+ "@clack/prompts": "^0.7.0",
36476
+ "@octokit/rest": "^22.0.0",
36477
+ cac: "^6.7.14",
36478
+ "cli-progress": "^3.12.0",
36479
+ "compare-versions": "^6.1.1",
36480
+ "extract-zip": "^2.0.1",
36481
+ "fs-extra": "^11.2.0",
36482
+ ignore: "^5.3.2",
36483
+ minimatch: "^10.1.1",
36484
+ ora: "^8.0.0",
36485
+ "p-limit": "^7.2.0",
36486
+ picocolors: "^1.1.1",
36487
+ "proper-lockfile": "^4.1.2",
36488
+ tar: "^7.4.3",
36489
+ tmp: "^0.2.3",
36490
+ zod: "^3.23.8"
36491
+ },
36492
+ devDependencies: {
36493
+ "@biomejs/biome": "^1.9.4",
36494
+ "@semantic-release/changelog": "^6.0.3",
36495
+ "@semantic-release/git": "^10.0.1",
36496
+ "@types/bun": "latest",
36497
+ "@types/cli-progress": "^3.11.6",
36498
+ "@types/fs-extra": "^11.0.4",
36499
+ "@types/node": "^22.10.1",
36500
+ "@types/proper-lockfile": "^4.1.4",
36501
+ "@types/tar": "^6.1.13",
36502
+ "@types/tmp": "^0.2.6",
36503
+ "semantic-release": "^24.2.0",
36504
+ typescript: "^5.7.2"
36505
+ }
36506
+ };
36507
+
36508
+ // src/commands/update-cli.ts
36509
+ var execAsync7 = promisify7(exec7);
36510
+
36511
+ class CliUpdateError extends ClaudeKitError {
36512
+ constructor(message) {
36513
+ super(message, "CLI_UPDATE_ERROR");
36514
+ this.name = "CliUpdateError";
36515
+ }
36516
+ }
36517
+ var PACKAGE_NAME2 = "claudekit-cli";
36518
+ var KIT_UPDATE_REMINDER_HEADER = "Note: 'ck update' only updates the CLI tool itself.";
36519
+ async function displayKitUpdateReminder() {
36520
+ try {
36521
+ const setup = await getClaudeKitSetup();
36522
+ const hasLocal = !!setup.project.metadata;
36523
+ const hasGlobal = !!setup.global.metadata;
36524
+ const localVersion = setup.project.metadata?.version;
36525
+ const globalVersion = setup.global.metadata?.version;
36526
+ const versionsToCheck = new Set;
36527
+ if (localVersion)
36528
+ versionsToCheck.add(localVersion);
36529
+ if (globalVersion)
36530
+ versionsToCheck.add(globalVersion);
36531
+ const versionCheckResults = new Map;
36532
+ if (versionsToCheck.size > 0) {
36533
+ const checkPromises = [...versionsToCheck].map(async (version) => {
36534
+ const result = await VersionChecker2.check(version).catch(() => null);
36535
+ return { version, result };
36536
+ });
36537
+ const results = await Promise.all(checkPromises);
36538
+ for (const { version, result } of results) {
36539
+ versionCheckResults.set(version, result);
36540
+ }
36541
+ }
36542
+ const cmdLocal = "ck init";
36543
+ const cmdGlobal = "ck init -g";
36544
+ const maxCmdLen = Math.max(cmdLocal.length, cmdGlobal.length);
36545
+ const pad = (cmd) => cmd.padEnd(maxCmdLen);
36546
+ const lines = [];
36547
+ lines.push(import_picocolors19.default.yellow(KIT_UPDATE_REMINDER_HEADER));
36548
+ lines.push("");
36549
+ lines.push("To update your ClaudeKit content (skills, commands, workflows):");
36550
+ if (hasLocal && localVersion) {
36551
+ lines.push(` ${import_picocolors19.default.cyan(pad(cmdLocal))} Update local project (v${localVersion})`);
36552
+ const localCheck = versionCheckResults.get(localVersion);
36553
+ if (localCheck?.updateAvailable) {
36554
+ const indent = " ".repeat(maxCmdLen + 4);
36555
+ lines.push(`${indent}${import_picocolors19.default.green(`→ v${localCheck.latestVersion} available!`)}`);
36556
+ }
36557
+ } else {
36558
+ lines.push(` ${import_picocolors19.default.cyan(pad(cmdLocal))} Initialize in current project`);
36559
+ }
36560
+ if (hasGlobal && globalVersion) {
36561
+ lines.push(` ${import_picocolors19.default.cyan(pad(cmdGlobal))} Update global ~/.claude (v${globalVersion})`);
36562
+ const globalCheck = versionCheckResults.get(globalVersion);
36563
+ if (globalCheck?.updateAvailable) {
36564
+ const indent = " ".repeat(maxCmdLen + 4);
36565
+ lines.push(`${indent}${import_picocolors19.default.green(`→ v${globalCheck.latestVersion} available!`)}`);
36566
+ }
36567
+ } else {
36568
+ lines.push(` ${import_picocolors19.default.cyan(pad(cmdGlobal))} Initialize global ~/.claude`);
36569
+ }
36570
+ logger.info("");
36571
+ log.info(lines.join(`
36572
+ `));
36573
+ } catch (error) {
36574
+ logger.verbose(`Failed to display kit update reminder: ${error instanceof Error ? error.message : "unknown error"}`);
36575
+ }
36576
+ }
36577
+ async function updateCliCommand(options) {
36578
+ const s = de();
36579
+ intro("[>] ClaudeKit CLI - Update");
36580
+ try {
36581
+ const opts = UpdateCliOptionsSchema.parse(options);
36582
+ const currentVersion = package_default.version;
36583
+ logger.info(`Current CLI version: ${currentVersion}`);
36584
+ s.start("Detecting package manager...");
36585
+ const pm = await PackageManagerDetector.detect();
36586
+ const pmVersion = await PackageManagerDetector.getVersion(pm);
36587
+ s.stop(`Using ${PackageManagerDetector.getDisplayName(pm)}${pmVersion ? ` v${pmVersion}` : ""}`);
36588
+ logger.verbose(`Detected package manager: ${pm}`);
36589
+ s.start("Checking for updates...");
36590
+ let targetVersion = null;
36591
+ if (opts.release && opts.release !== "latest") {
36592
+ const exists = await NpmRegistryClient.versionExists(PACKAGE_NAME2, opts.release, opts.registry);
36593
+ if (!exists) {
36594
+ s.stop("Version not found");
36595
+ throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run 'ck versions' to see available versions.`);
36596
+ }
36597
+ targetVersion = opts.release;
36598
+ s.stop(`Target version: ${targetVersion}`);
36599
+ } else if (opts.beta) {
36600
+ targetVersion = await NpmRegistryClient.getBetaVersion(PACKAGE_NAME2, opts.registry);
36601
+ if (!targetVersion) {
36602
+ s.stop("No beta version available");
36603
+ logger.warning("No beta version found. Using latest stable version instead.");
36604
+ targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME2, opts.registry);
36605
+ } else {
36606
+ s.stop(`Latest beta version: ${targetVersion}`);
36607
+ }
36608
+ } else {
36609
+ targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME2, opts.registry);
36610
+ s.stop(`Latest version: ${targetVersion || "unknown"}`);
36611
+ }
36612
+ if (!targetVersion) {
36613
+ throw new CliUpdateError(`Failed to fetch version information from npm registry. Check your internet connection and try again. Manual update: ${PackageManagerDetector.getUpdateCommand(pm, PACKAGE_NAME2)}`);
36614
+ }
36615
+ const comparison = import_compare_versions4.compareVersions(currentVersion, targetVersion);
36616
+ if (comparison === 0) {
36617
+ outro(`[+] Already on the latest CLI version (${currentVersion})`);
36618
+ await displayKitUpdateReminder();
36619
+ return;
36620
+ }
36621
+ if (comparison > 0 && !opts.release) {
36622
+ outro(`[+] Current version (${currentVersion}) is newer than latest (${targetVersion})`);
36623
+ return;
36624
+ }
36625
+ const isUpgrade = comparison < 0;
36626
+ const changeType = isUpgrade ? "upgrade" : "downgrade";
36627
+ logger.info(`${isUpgrade ? "[^]" : "[v]"} ${changeType}: ${currentVersion} -> ${targetVersion}`);
36628
+ if (opts.check) {
36629
+ note(`CLI update available: ${currentVersion} -> ${targetVersion}
36630
+
36631
+ Run 'ck update' to install`, "Update Check");
36632
+ await displayKitUpdateReminder();
36633
+ outro("Check complete");
36634
+ return;
36635
+ }
36636
+ if (!opts.yes) {
36637
+ const shouldUpdate = await se({
36638
+ message: `${isUpgrade ? "Update" : "Downgrade"} CLI from ${currentVersion} to ${targetVersion}?`
36639
+ });
36640
+ if (lD(shouldUpdate) || !shouldUpdate) {
36641
+ outro("Update cancelled");
36642
+ return;
36643
+ }
36644
+ }
36645
+ const updateCmd = PackageManagerDetector.getUpdateCommand(pm, PACKAGE_NAME2, targetVersion);
36646
+ logger.info(`Running: ${updateCmd}`);
36647
+ s.start("Updating CLI...");
36648
+ try {
36649
+ await execAsync7(updateCmd, {
36650
+ timeout: 120000
36651
+ });
36652
+ s.stop("Update completed");
36653
+ } catch (error) {
36654
+ s.stop("Update failed");
36655
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
36656
+ if (errorMessage.includes("EACCES") || errorMessage.includes("EPERM") || errorMessage.includes("permission") || errorMessage.includes("Access is denied")) {
36657
+ throw new CliUpdateError(`Permission denied. Try: sudo ${updateCmd}
36658
+
36659
+ Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally`);
36660
+ }
36661
+ throw new CliUpdateError(`Update failed: ${errorMessage}
36662
+
36663
+ Manual update: ${updateCmd}`);
36664
+ }
36665
+ s.start("Verifying installation...");
36666
+ try {
36322
36667
  const { stdout } = await execAsync7("ck --version", { timeout: 5000 });
36323
36668
  const newVersionMatch = stdout.match(/CLI Version:\s*(\S+)/);
36324
36669
  const newVersion = newVersionMatch ? newVersionMatch[1] : targetVersion;
36325
36670
  s.stop(`Installed version: ${newVersion}`);
36326
36671
  outro(`[+] Successfully updated ClaudeKit CLI to ${newVersion}`);
36672
+ await displayKitUpdateReminder();
36327
36673
  } catch {
36328
36674
  s.stop("Verification completed");
36329
36675
  outro(`[+] Update completed. Please restart your terminal to use CLI ${targetVersion}`);
36676
+ await displayKitUpdateReminder();
36330
36677
  }
36331
36678
  } catch (error) {
36332
36679
  if (error instanceof CliUpdateError) {
@@ -36342,7 +36689,7 @@ Manual update: ${updateCmd}`);
36342
36689
  // src/commands/version.ts
36343
36690
  init_logger();
36344
36691
  init_types2();
36345
- var import_picocolors17 = __toESM(require_picocolors(), 1);
36692
+ var import_picocolors20 = __toESM(require_picocolors(), 1);
36346
36693
  function formatRelativeTime(dateString) {
36347
36694
  if (!dateString)
36348
36695
  return "Unknown";
@@ -36364,402 +36711,136 @@ function formatRelativeTime(dateString) {
36364
36711
  }
36365
36712
  function displayKitReleases(kitName, releases) {
36366
36713
  console.log(`
36367
- ${import_picocolors17.default.bold(import_picocolors17.default.cyan(kitName))} - Available Versions:
36714
+ ${import_picocolors20.default.bold(import_picocolors20.default.cyan(kitName))} - Available Versions:
36368
36715
  `);
36369
36716
  if (releases.length === 0) {
36370
- console.log(import_picocolors17.default.dim(" No releases found"));
36717
+ console.log(import_picocolors20.default.dim(" No releases found"));
36371
36718
  return;
36372
36719
  }
36373
36720
  for (const release of releases) {
36374
- const version = import_picocolors17.default.green(release.tag_name);
36721
+ const version = import_picocolors20.default.green(release.tag_name);
36375
36722
  const name2 = release.name || "No title";
36376
36723
  const publishedAt = formatRelativeTime(release.published_at);
36377
- const assetCount = release.assets.length;
36378
- const badges = [];
36379
- if (release.prerelease)
36380
- badges.push(import_picocolors17.default.yellow("[prerelease]"));
36381
- if (release.draft)
36382
- badges.push(import_picocolors17.default.gray("[draft]"));
36383
- const badgeStr = badges.length > 0 ? ` ${badges.join(" ")}` : "";
36384
- const versionPart = version.padEnd(20);
36385
- const namePart = name2.length > 40 ? `${name2.slice(0, 37)}...` : name2.padEnd(40);
36386
- const timePart = import_picocolors17.default.dim(publishedAt.padEnd(20));
36387
- const assetPart = import_picocolors17.default.dim(`(${assetCount} ${assetCount === 1 ? "asset" : "assets"})`);
36388
- console.log(` ${versionPart} ${namePart} ${timePart} ${assetPart}${badgeStr}`);
36389
- }
36390
- console.log(import_picocolors17.default.dim(`
36391
- Showing ${releases.length} ${releases.length === 1 ? "release" : "releases"}`));
36392
- }
36393
- async function versionCommand(options) {
36394
- const prompts2 = new PromptsManager;
36395
- prompts2.intro("\uD83D\uDCE6 ClaudeKit - Available Versions");
36396
- try {
36397
- const validOptions = VersionCommandOptionsSchema.parse(options);
36398
- const kitsToFetch = validOptions.kit ? [validOptions.kit] : Object.keys(AVAILABLE_KITS);
36399
- const github = new GitHubClient;
36400
- const limit = validOptions.limit || 30;
36401
- const releasePromises = kitsToFetch.map(async (kitType) => {
36402
- const kitConfig = AVAILABLE_KITS[kitType];
36403
- try {
36404
- const releases = await github.listReleases(kitConfig, limit);
36405
- const filteredReleases = validOptions.all ? releases : releases.filter((r2) => !r2.draft && !r2.prerelease);
36406
- return {
36407
- kitType,
36408
- kitConfig,
36409
- releases: filteredReleases,
36410
- error: null
36411
- };
36412
- } catch (error) {
36413
- return {
36414
- kitType,
36415
- kitConfig,
36416
- releases: [],
36417
- error: error instanceof Error ? error.message : "Unknown error"
36418
- };
36419
- }
36420
- });
36421
- const results = await Promise.all(releasePromises);
36422
- for (const result of results) {
36423
- if (result.error) {
36424
- console.log(`
36425
- ${import_picocolors17.default.bold(import_picocolors17.default.cyan(result.kitConfig.name))} - ${import_picocolors17.default.red("Error")}`);
36426
- console.log(import_picocolors17.default.dim(` ${result.error}`));
36427
- } else {
36428
- displayKitReleases(result.kitConfig.name, result.releases);
36429
- }
36430
- }
36431
- prompts2.outro("✨ Done");
36432
- } catch (error) {
36433
- logger.error(error instanceof Error ? error.message : "Unknown error occurred");
36434
- process.exit(1);
36435
- }
36436
- }
36437
-
36438
- // src/cli/command-registry.ts
36439
- init_logger();
36440
- function registerCommands(cli) {
36441
- cli.command("new", "Bootstrap a new ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use (engineer, marketing)").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--force", "Overwrite existing files without confirmation").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--opencode", "Install OpenCode CLI package (non-interactive mode)").option("--gemini", "Install Google Gemini CLI package (non-interactive mode)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").action(async (options) => {
36442
- if (options.exclude && !Array.isArray(options.exclude)) {
36443
- options.exclude = [options.exclude];
36444
- }
36445
- await newCommand(options);
36446
- });
36447
- cli.command("init", "Initialize or update ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use (engineer, marketing)").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--only <pattern>", "Include only files matching glob pattern (can be used multiple times)").option("-g, --global", "Use platform-specific user configuration directory").option("--fresh", "Completely remove .claude directory before downloading (requires confirmation)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--dry-run", "Preview changes without applying them (requires --prefix)").option("--force-overwrite", "Override ownership protections and delete user-modified files (requires --prefix)").option("--force-overwrite-settings", "Fully replace settings.json instead of selective merge (destroys user customizations)").option("--skip-setup", "Skip interactive configuration wizard").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").action(async (options) => {
36448
- if (options.exclude && !Array.isArray(options.exclude)) {
36449
- options.exclude = [options.exclude];
36450
- }
36451
- if (options.only && !Array.isArray(options.only)) {
36452
- options.only = [options.only];
36453
- }
36454
- await initCommand(options);
36455
- });
36456
- cli.command("update", "Update ClaudeKit CLI to the latest version").option("-r, --release <version>", "Update to a specific version").option("--check", "Check for updates without installing").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--beta", "Update to the latest beta version").option("--registry <url>", "Custom npm registry URL").option("--kit <kit>", "[DEPRECATED] Use 'ck init --kit <kit>' instead").option("-g, --global", "[DEPRECATED] Use 'ck init --global' instead").action(async (options) => {
36457
- if (options.kit || options.global) {
36458
- console.log();
36459
- const deprecatedFlags = [options.kit && "--kit", options.global && "--global"].filter(Boolean).join(" and ");
36460
- logger.warning(`The ${deprecatedFlags} option${options.kit && options.global ? "s are" : " is"} no longer supported with 'ck update'`);
36461
- console.log();
36462
- console.log(" 'ck update' now only updates the ClaudeKit CLI itself.");
36463
- console.log();
36464
- console.log(" To update a kit installation, use:");
36465
- const suggestedCmd = ["ck init"];
36466
- if (options.kit)
36467
- suggestedCmd.push(`--kit ${options.kit}`);
36468
- if (options.global)
36469
- suggestedCmd.push("--global");
36470
- console.log(` ${suggestedCmd.join(" ")}`);
36471
- console.log();
36472
- process.exit(0);
36473
- }
36474
- try {
36475
- await updateCliCommand(options);
36476
- } catch (error) {
36477
- process.exit(1);
36478
- }
36479
- });
36480
- cli.command("versions", "List available versions of ClaudeKit repositories").option("--kit <kit>", "Filter by specific kit (engineer, marketing)").option("--limit <limit>", "Number of releases to show (default: 30)").option("--all", "Show all releases including prereleases").action(async (options) => {
36481
- await versionCommand(options);
36482
- });
36483
- cli.command("doctor", "Comprehensive health check for ClaudeKit").option("--report", "Generate shareable diagnostic report").option("--fix", "Auto-fix all fixable issues").option("--check-only", "CI mode: no prompts, exit 1 on failures").option("--json", "Output JSON format").option("--full", "Include extended priority checks (slower)").action(async (options) => {
36484
- await doctorCommand(options);
36485
- });
36486
- cli.command("uninstall", "Remove ClaudeKit installations").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("-l, --local", "Uninstall only local installation (current project)").option("-g, --global", "Uninstall only global installation (~/.claude/)").option("-A, --all", "Uninstall from both local and global locations").option("-k, --kit <type>", "Uninstall specific kit only (engineer, marketing)").option("--dry-run", "Preview what would be removed without deleting").option("--force-overwrite", "Delete even user-modified files (requires confirmation)").action(async (options) => {
36487
- await uninstallCommand(options);
36488
- });
36489
- cli.command("easter-egg", "\uD83E\uDD5A Roll for a random discount code (Code Hunt 2025)").action(async () => {
36490
- await easterEggCommand();
36491
- });
36492
- }
36493
-
36494
- // src/cli/version-display.ts
36495
- import { existsSync as existsSync17, readFileSync as readFileSync5 } from "node:fs";
36496
- import { join as join66 } from "node:path";
36497
-
36498
- // src/domains/versioning/checking/version-utils.ts
36499
- var import_compare_versions3 = __toESM(require_umd(), 1);
36500
- function isUpdateCheckDisabled() {
36501
- return process.env.NO_UPDATE_NOTIFIER === "1" || process.env.NO_UPDATE_NOTIFIER === "true" || !process.stdout.isTTY;
36502
- }
36503
- function normalizeVersion(version) {
36504
- return version.replace(/^v/, "");
36505
- }
36506
- function isNewerVersion(currentVersion, latestVersion) {
36507
- try {
36508
- const current = normalizeVersion(currentVersion);
36509
- const latest = normalizeVersion(latestVersion);
36510
- return import_compare_versions3.compareVersions(latest, current) > 0;
36511
- } catch {
36512
- return false;
36513
- }
36514
- }
36515
- // src/domains/versioning/checking/kit-version-checker.ts
36516
- init_logger();
36517
- init_types2();
36518
-
36519
- // src/domains/versioning/version-cache.ts
36520
- init_logger();
36521
- import { existsSync as existsSync16 } from "node:fs";
36522
- import { mkdir as mkdir18, readFile as readFile20, writeFile as writeFile17 } from "node:fs/promises";
36523
- import { join as join65 } from "node:path";
36524
- class VersionCacheManager {
36525
- static CACHE_FILENAME = "version-check.json";
36526
- static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
36527
- static getCacheFile() {
36528
- const cacheDir = PathResolver.getCacheDir(false);
36529
- return join65(cacheDir, VersionCacheManager.CACHE_FILENAME);
36530
- }
36531
- static async load() {
36532
- const cacheFile = VersionCacheManager.getCacheFile();
36533
- try {
36534
- if (!existsSync16(cacheFile)) {
36535
- logger.debug("Version check cache not found");
36536
- return null;
36537
- }
36538
- const content = await readFile20(cacheFile, "utf-8");
36539
- const cache2 = JSON.parse(content);
36540
- if (!cache2.lastCheck || !cache2.currentVersion || !cache2.latestVersion) {
36541
- logger.debug("Invalid cache structure, ignoring");
36542
- return null;
36543
- }
36544
- logger.debug(`Version check cache loaded: ${JSON.stringify(cache2)}`);
36545
- return cache2;
36546
- } catch (error) {
36547
- logger.debug(`Failed to load version check cache: ${error}`);
36548
- return null;
36549
- }
36550
- }
36551
- static async save(cache2) {
36552
- const cacheFile = VersionCacheManager.getCacheFile();
36553
- const cacheDir = PathResolver.getCacheDir(false);
36554
- try {
36555
- if (!existsSync16(cacheDir)) {
36556
- await mkdir18(cacheDir, { recursive: true, mode: 448 });
36557
- }
36558
- await writeFile17(cacheFile, JSON.stringify(cache2, null, 2), "utf-8");
36559
- logger.debug(`Version check cache saved to ${cacheFile}`);
36560
- } catch (error) {
36561
- logger.debug(`Failed to save version check cache: ${error}`);
36562
- }
36563
- }
36564
- static isCacheValid(cache2) {
36565
- if (!cache2)
36566
- return false;
36567
- const now = Date.now();
36568
- const age = now - cache2.lastCheck;
36569
- const isValid2 = age < VersionCacheManager.CACHE_TTL_MS;
36570
- const ageDays = (age / 1000 / 60 / 60 / 24).toFixed(1);
36571
- logger.debug(`Cache validity check: age=${ageDays} days, valid=${isValid2}`);
36572
- return isValid2;
36573
- }
36574
- static async clear() {
36575
- const cacheFile = VersionCacheManager.getCacheFile();
36576
- try {
36577
- if (existsSync16(cacheFile)) {
36578
- const fs12 = await import("node:fs/promises");
36579
- await fs12.unlink(cacheFile);
36580
- logger.debug("Version check cache cleared");
36581
- }
36582
- } catch (error) {
36583
- logger.debug(`Failed to clear version check cache: ${error}`);
36584
- }
36724
+ const assetCount = release.assets.length;
36725
+ const badges = [];
36726
+ if (release.prerelease)
36727
+ badges.push(import_picocolors20.default.yellow("[prerelease]"));
36728
+ if (release.draft)
36729
+ badges.push(import_picocolors20.default.gray("[draft]"));
36730
+ const badgeStr = badges.length > 0 ? ` ${badges.join(" ")}` : "";
36731
+ const versionPart = version.padEnd(20);
36732
+ const namePart = name2.length > 40 ? `${name2.slice(0, 37)}...` : name2.padEnd(40);
36733
+ const timePart = import_picocolors20.default.dim(publishedAt.padEnd(20));
36734
+ const assetPart = import_picocolors20.default.dim(`(${assetCount} ${assetCount === 1 ? "asset" : "assets"})`);
36735
+ console.log(` ${versionPart} ${namePart} ${timePart} ${assetPart}${badgeStr}`);
36585
36736
  }
36737
+ console.log(import_picocolors20.default.dim(`
36738
+ Showing ${releases.length} ${releases.length === 1 ? "release" : "releases"}`));
36586
36739
  }
36587
-
36588
- // src/domains/versioning/checking/kit-version-checker.ts
36589
- async function fetchLatestRelease(currentVersion) {
36740
+ async function versionCommand(options) {
36741
+ const prompts2 = new PromptsManager;
36742
+ prompts2.intro("\uD83D\uDCE6 ClaudeKit - Available Versions");
36590
36743
  try {
36591
- const githubClient = new GitHubClient;
36592
- const kit = AVAILABLE_KITS.engineer;
36593
- const timeoutPromise = new Promise((_3, reject) => setTimeout(() => reject(new Error("Timeout")), 5000));
36594
- const releasePromise = githubClient.getLatestRelease(kit);
36595
- const release = await Promise.race([releasePromise, timeoutPromise]);
36596
- const latestVersion = release.tag_name;
36597
- const updateAvailable = isNewerVersion(currentVersion, latestVersion);
36598
- const releaseUrl = `https://github.com/${kit.owner}/${kit.repo}/releases/tag/${latestVersion}`;
36599
- logger.debug(`Fetched latest release: current=${currentVersion}, latest=${latestVersion}, updateAvailable=${updateAvailable}`);
36600
- return {
36601
- currentVersion,
36602
- latestVersion,
36603
- updateAvailable,
36604
- releaseUrl
36605
- };
36744
+ const validOptions = VersionCommandOptionsSchema.parse(options);
36745
+ const kitsToFetch = validOptions.kit ? [validOptions.kit] : Object.keys(AVAILABLE_KITS);
36746
+ const github = new GitHubClient;
36747
+ const limit = validOptions.limit || 30;
36748
+ const releasePromises = kitsToFetch.map(async (kitType) => {
36749
+ const kitConfig = AVAILABLE_KITS[kitType];
36750
+ try {
36751
+ const releases = await github.listReleases(kitConfig, limit);
36752
+ const filteredReleases = validOptions.all ? releases : releases.filter((r2) => !r2.draft && !r2.prerelease);
36753
+ return {
36754
+ kitType,
36755
+ kitConfig,
36756
+ releases: filteredReleases,
36757
+ error: null
36758
+ };
36759
+ } catch (error) {
36760
+ return {
36761
+ kitType,
36762
+ kitConfig,
36763
+ releases: [],
36764
+ error: error instanceof Error ? error.message : "Unknown error"
36765
+ };
36766
+ }
36767
+ });
36768
+ const results = await Promise.all(releasePromises);
36769
+ for (const result of results) {
36770
+ if (result.error) {
36771
+ console.log(`
36772
+ ${import_picocolors20.default.bold(import_picocolors20.default.cyan(result.kitConfig.name))} - ${import_picocolors20.default.red("Error")}`);
36773
+ console.log(import_picocolors20.default.dim(` ${result.error}`));
36774
+ } else {
36775
+ displayKitReleases(result.kitConfig.name, result.releases);
36776
+ }
36777
+ }
36778
+ prompts2.outro("✨ Done");
36606
36779
  } catch (error) {
36607
- logger.debug(`Failed to fetch latest release: ${error}`);
36608
- return null;
36780
+ logger.error(error instanceof Error ? error.message : "Unknown error occurred");
36781
+ process.exit(1);
36609
36782
  }
36610
36783
  }
36611
36784
 
36612
- class VersionChecker {
36613
- static async check(currentVersion) {
36614
- if (isUpdateCheckDisabled()) {
36615
- logger.debug("Update check disabled by environment");
36616
- return null;
36785
+ // src/cli/command-registry.ts
36786
+ init_logger();
36787
+ function registerCommands(cli) {
36788
+ cli.command("new", "Bootstrap a new ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use (engineer, marketing)").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--force", "Overwrite existing files without confirmation").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--opencode", "Install OpenCode CLI package (non-interactive mode)").option("--gemini", "Install Google Gemini CLI package (non-interactive mode)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").action(async (options) => {
36789
+ if (options.exclude && !Array.isArray(options.exclude)) {
36790
+ options.exclude = [options.exclude];
36617
36791
  }
36618
- const cache2 = await VersionCacheManager.load();
36619
- if (cache2 && VersionCacheManager.isCacheValid(cache2) && cache2.currentVersion === currentVersion) {
36620
- logger.debug("Using cached version check result");
36621
- return {
36622
- currentVersion: cache2.currentVersion,
36623
- latestVersion: cache2.latestVersion,
36624
- updateAvailable: cache2.updateAvailable,
36625
- releaseUrl: cache2.latestUrl
36626
- };
36792
+ await newCommand(options);
36793
+ });
36794
+ cli.command("init", "Initialize or update ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use (engineer, marketing)").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--only <pattern>", "Include only files matching glob pattern (can be used multiple times)").option("-g, --global", "Use platform-specific user configuration directory").option("--fresh", "Completely remove .claude directory before downloading (requires confirmation)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--dry-run", "Preview changes without applying them (requires --prefix)").option("--force-overwrite", "Override ownership protections and delete user-modified files (requires --prefix)").option("--force-overwrite-settings", "Fully replace settings.json instead of selective merge (destroys user customizations)").option("--skip-setup", "Skip interactive configuration wizard").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").action(async (options) => {
36795
+ if (options.exclude && !Array.isArray(options.exclude)) {
36796
+ options.exclude = [options.exclude];
36627
36797
  }
36628
- logger.debug("Cache expired or invalid, fetching latest release");
36629
- const result = await fetchLatestRelease(currentVersion);
36630
- if (result) {
36631
- await VersionCacheManager.save({
36632
- lastCheck: Date.now(),
36633
- currentVersion: result.currentVersion,
36634
- latestVersion: result.latestVersion,
36635
- latestUrl: result.releaseUrl,
36636
- updateAvailable: result.updateAvailable
36637
- });
36798
+ if (options.only && !Array.isArray(options.only)) {
36799
+ options.only = [options.only];
36638
36800
  }
36639
- return result;
36640
- }
36641
- }
36642
- // src/domains/versioning/checking/cli-version-checker.ts
36643
- init_logger();
36644
- var import_compare_versions4 = __toESM(require_umd(), 1);
36645
- var PACKAGE_NAME2 = "claudekit-cli";
36646
-
36647
- class CliVersionChecker {
36648
- static async check(currentVersion) {
36649
- if (isUpdateCheckDisabled()) {
36650
- logger.debug("CLI update check disabled by environment");
36651
- return null;
36801
+ await initCommand(options);
36802
+ });
36803
+ cli.command("update", "Update ClaudeKit CLI to the latest version").option("-r, --release <version>", "Update to a specific version").option("--check", "Check for updates without installing").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--beta", "Update to the latest beta version").option("--registry <url>", "Custom npm registry URL").option("--kit <kit>", "[DEPRECATED] Use 'ck init --kit <kit>' instead").option("-g, --global", "[DEPRECATED] Use 'ck init --global' instead").action(async (options) => {
36804
+ if (options.kit || options.global) {
36805
+ console.log();
36806
+ const deprecatedFlags = [options.kit && "--kit", options.global && "--global"].filter(Boolean).join(" and ");
36807
+ logger.warning(`The ${deprecatedFlags} option${options.kit && options.global ? "s are" : " is"} no longer supported with 'ck update'`);
36808
+ console.log();
36809
+ console.log(" 'ck update' now only updates the ClaudeKit CLI itself.");
36810
+ console.log();
36811
+ console.log(" To update a kit installation, use:");
36812
+ const suggestedCmd = ["ck init"];
36813
+ if (options.kit)
36814
+ suggestedCmd.push(`--kit ${options.kit}`);
36815
+ if (options.global)
36816
+ suggestedCmd.push("--global");
36817
+ console.log(` ${suggestedCmd.join(" ")}`);
36818
+ console.log();
36819
+ process.exit(0);
36652
36820
  }
36653
36821
  try {
36654
- const latestVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME2);
36655
- if (!latestVersion) {
36656
- logger.debug("Failed to fetch latest CLI version from npm");
36657
- return null;
36658
- }
36659
- const current = normalizeVersion(currentVersion);
36660
- const latest = normalizeVersion(latestVersion);
36661
- const updateAvailable = import_compare_versions4.compareVersions(latest, current) > 0;
36662
- logger.debug(`CLI version check: current=${current}, latest=${latest}, updateAvailable=${updateAvailable}`);
36663
- return {
36664
- currentVersion: current,
36665
- latestVersion: latest,
36666
- updateAvailable,
36667
- releaseUrl: `https://www.npmjs.com/package/${PACKAGE_NAME2}`
36668
- };
36822
+ await updateCliCommand(options);
36669
36823
  } catch (error) {
36670
- logger.debug(`CLI version check failed: ${error}`);
36671
- return null;
36824
+ process.exit(1);
36672
36825
  }
36673
- }
36674
- }
36675
- // src/domains/versioning/checking/notification-display.ts
36676
- var import_picocolors18 = __toESM(require_picocolors(), 1);
36677
- function createNotificationBox(borderColor, boxWidth) {
36678
- const contentWidth = boxWidth - 2;
36679
- const topBorder = borderColor(`╭${"─".repeat(contentWidth)}╮`);
36680
- const bottomBorder = borderColor(`╰${"".repeat(contentWidth)}╯`);
36681
- const emptyLine = borderColor("│") + " ".repeat(contentWidth) + borderColor("│");
36682
- const padLine = (text, visibleLen) => {
36683
- const len = visibleLen ?? text.length;
36684
- const displayText = len > contentWidth ? `${text.slice(0, contentWidth - 3)}...` : text;
36685
- const actualLen = visibleLen ?? displayText.length;
36686
- const totalPadding = contentWidth - actualLen;
36687
- const leftPadding = Math.max(0, Math.floor(totalPadding / 2));
36688
- const rightPadding = Math.max(0, totalPadding - leftPadding);
36689
- return borderColor("│") + " ".repeat(leftPadding) + displayText + " ".repeat(rightPadding) + borderColor("│");
36690
- };
36691
- return { topBorder, bottomBorder, emptyLine, padLine };
36692
- }
36693
- function displayKitNotification(result, options = {}) {
36694
- if (!result.updateAvailable)
36695
- return;
36696
- const { currentVersion, latestVersion } = result;
36697
- const { isGlobal = false } = options;
36698
- const displayCurrent = normalizeVersion(currentVersion);
36699
- const displayLatest = normalizeVersion(latestVersion);
36700
- const boxWidth = 52;
36701
- const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.cyan, boxWidth);
36702
- const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ Kit Update Available"));
36703
- const headerLen = "⬆ Kit Update Available".length;
36704
- const versionText = `${import_picocolors18.default.dim(displayCurrent)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(displayLatest))}`;
36705
- const versionLen = displayCurrent.length + 3 + displayLatest.length;
36706
- const updateCmd = isGlobal ? "ck init -g" : "ck init";
36707
- const commandText = `Run: ${import_picocolors18.default.cyan(import_picocolors18.default.bold(updateCmd))}`;
36708
- const commandLen = `Run: ${updateCmd}`.length;
36709
- console.log("");
36710
- console.log(topBorder);
36711
- console.log(emptyLine);
36712
- console.log(padLine(headerText, headerLen));
36713
- console.log(padLine(versionText, versionLen));
36714
- console.log(emptyLine);
36715
- console.log(padLine(commandText, commandLen));
36716
- console.log(emptyLine);
36717
- console.log(bottomBorder);
36718
- console.log("");
36719
- }
36720
- function displayCliNotification(result) {
36721
- if (!result.updateAvailable)
36722
- return;
36723
- const { currentVersion, latestVersion } = result;
36724
- const boxWidth = 52;
36725
- const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.magenta, boxWidth);
36726
- const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ CLI Update Available"));
36727
- const headerLen = "⬆ CLI Update Available".length;
36728
- const versionText = `${import_picocolors18.default.dim(currentVersion)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(latestVersion))}`;
36729
- const versionLen = currentVersion.length + 3 + latestVersion.length;
36730
- const commandText = `Run: ${import_picocolors18.default.magenta(import_picocolors18.default.bold("ck update"))}`;
36731
- const commandLen = "Run: ck update".length;
36732
- console.log("");
36733
- console.log(topBorder);
36734
- console.log(emptyLine);
36735
- console.log(padLine(headerText, headerLen));
36736
- console.log(padLine(versionText, versionLen));
36737
- console.log(emptyLine);
36738
- console.log(padLine(commandText, commandLen));
36739
- console.log(emptyLine);
36740
- console.log(bottomBorder);
36741
- console.log("");
36742
- }
36743
- // src/domains/versioning/version-checker.ts
36744
- class VersionChecker2 {
36745
- static async check(currentVersion) {
36746
- return VersionChecker.check(currentVersion);
36747
- }
36748
- static displayNotification(result, options = {}) {
36749
- displayKitNotification(result, options);
36750
- }
36751
- }
36752
-
36753
- class CliVersionChecker2 {
36754
- static async check(currentVersion) {
36755
- return CliVersionChecker.check(currentVersion);
36756
- }
36757
- static displayNotification(result) {
36758
- displayCliNotification(result);
36759
- }
36826
+ });
36827
+ cli.command("versions", "List available versions of ClaudeKit repositories").option("--kit <kit>", "Filter by specific kit (engineer, marketing)").option("--limit <limit>", "Number of releases to show (default: 30)").option("--all", "Show all releases including prereleases").action(async (options) => {
36828
+ await versionCommand(options);
36829
+ });
36830
+ cli.command("doctor", "Comprehensive health check for ClaudeKit").option("--report", "Generate shareable diagnostic report").option("--fix", "Auto-fix all fixable issues").option("--check-only", "CI mode: no prompts, exit 1 on failures").option("--json", "Output JSON format").option("--full", "Include extended priority checks (slower)").action(async (options) => {
36831
+ await doctorCommand(options);
36832
+ });
36833
+ cli.command("uninstall", "Remove ClaudeKit installations").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("-l, --local", "Uninstall only local installation (current project)").option("-g, --global", "Uninstall only global installation (~/.claude/)").option("-A, --all", "Uninstall from both local and global locations").option("-k, --kit <type>", "Uninstall specific kit only (engineer, marketing)").option("--dry-run", "Preview what would be removed without deleting").option("--force-overwrite", "Delete even user-modified files (requires confirmation)").action(async (options) => {
36834
+ await uninstallCommand(options);
36835
+ });
36836
+ cli.command("easter-egg", "\uD83E\uDD5A Roll for a random discount code (Code Hunt 2025)").action(async () => {
36837
+ await easterEggCommand();
36838
+ });
36760
36839
  }
36761
36840
 
36762
36841
  // src/cli/version-display.ts
36842
+ import { existsSync as existsSync17, readFileSync as readFileSync5 } from "node:fs";
36843
+ import { join as join66 } from "node:path";
36763
36844
  init_logger();
36764
36845
  init_types2();
36765
36846
  var packageVersion = package_default.version;
@@ -36806,6 +36887,8 @@ async function displayVersion() {
36806
36887
  }
36807
36888
  if (!foundAnyKit) {
36808
36889
  console.log("No ClaudeKit installation found");
36890
+ console.log(`
36891
+ To get started: ck new (local project) or ck init -g (global)`);
36809
36892
  }
36810
36893
  try {
36811
36894
  const cliUpdateCheck = await CliVersionChecker2.check(packageVersion);
@@ -36832,7 +36915,7 @@ function getPackageVersion2() {
36832
36915
 
36833
36916
  // src/shared/logger.ts
36834
36917
  init_output_manager();
36835
- var import_picocolors19 = __toESM(require_picocolors(), 1);
36918
+ var import_picocolors21 = __toESM(require_picocolors(), 1);
36836
36919
  import { createWriteStream as createWriteStream3 } from "node:fs";
36837
36920
 
36838
36921
  class Logger2 {
@@ -36841,23 +36924,23 @@ class Logger2 {
36841
36924
  exitHandlerRegistered = false;
36842
36925
  info(message) {
36843
36926
  const symbols = output.getSymbols();
36844
- console.log(import_picocolors19.default.blue(symbols.info), message);
36927
+ console.log(import_picocolors21.default.blue(symbols.info), message);
36845
36928
  }
36846
36929
  success(message) {
36847
36930
  const symbols = output.getSymbols();
36848
- console.log(import_picocolors19.default.green(symbols.success), message);
36931
+ console.log(import_picocolors21.default.green(symbols.success), message);
36849
36932
  }
36850
36933
  warning(message) {
36851
36934
  const symbols = output.getSymbols();
36852
- console.log(import_picocolors19.default.yellow(symbols.warning), message);
36935
+ console.log(import_picocolors21.default.yellow(symbols.warning), message);
36853
36936
  }
36854
36937
  error(message) {
36855
36938
  const symbols = output.getSymbols();
36856
- console.error(import_picocolors19.default.red(symbols.error), message);
36939
+ console.error(import_picocolors21.default.red(symbols.error), message);
36857
36940
  }
36858
36941
  debug(message) {
36859
36942
  if (process.env.DEBUG) {
36860
- console.log(import_picocolors19.default.gray("[DEBUG]"), message);
36943
+ console.log(import_picocolors21.default.gray("[DEBUG]"), message);
36861
36944
  }
36862
36945
  }
36863
36946
  verbose(message, context) {
@@ -36866,7 +36949,7 @@ class Logger2 {
36866
36949
  const timestamp = this.getTimestamp();
36867
36950
  const sanitizedMessage = this.sanitize(message);
36868
36951
  const formattedContext = context ? this.formatContext(context) : "";
36869
- const logLine = `${timestamp} ${import_picocolors19.default.gray("[VERBOSE]")} ${sanitizedMessage}${formattedContext}`;
36952
+ const logLine = `${timestamp} ${import_picocolors21.default.gray("[VERBOSE]")} ${sanitizedMessage}${formattedContext}`;
36870
36953
  console.error(logLine);
36871
36954
  if (this.logFileStream) {
36872
36955
  const plainLogLine = `${timestamp} [VERBOSE] ${sanitizedMessage}${formattedContext}`;
@@ -36969,7 +37052,7 @@ var logger3 = new Logger2;
36969
37052
 
36970
37053
  // src/shared/output-manager.ts
36971
37054
  init_terminal_utils();
36972
- var import_picocolors20 = __toESM(require_picocolors(), 1);
37055
+ var import_picocolors22 = __toESM(require_picocolors(), 1);
36973
37056
  var SYMBOLS2 = {
36974
37057
  unicode: {
36975
37058
  prompt: "◇",
@@ -37048,7 +37131,7 @@ class OutputManager2 {
37048
37131
  if (this.config.quiet)
37049
37132
  return;
37050
37133
  const symbol = this.getSymbols().success;
37051
- console.log(import_picocolors20.default.green(`${symbol} ${message}`));
37134
+ console.log(import_picocolors22.default.green(`${symbol} ${message}`));
37052
37135
  }
37053
37136
  error(message, data) {
37054
37137
  if (this.config.json) {
@@ -37056,7 +37139,7 @@ class OutputManager2 {
37056
37139
  return;
37057
37140
  }
37058
37141
  const symbol = this.getSymbols().error;
37059
- console.error(import_picocolors20.default.red(`${symbol} ${message}`));
37142
+ console.error(import_picocolors22.default.red(`${symbol} ${message}`));
37060
37143
  }
37061
37144
  warning(message, data) {
37062
37145
  if (this.config.json) {
@@ -37066,7 +37149,7 @@ class OutputManager2 {
37066
37149
  if (this.config.quiet)
37067
37150
  return;
37068
37151
  const symbol = this.getSymbols().warning;
37069
- console.log(import_picocolors20.default.yellow(`${symbol} ${message}`));
37152
+ console.log(import_picocolors22.default.yellow(`${symbol} ${message}`));
37070
37153
  }
37071
37154
  info(message, data) {
37072
37155
  if (this.config.json) {
@@ -37076,7 +37159,7 @@ class OutputManager2 {
37076
37159
  if (this.config.quiet)
37077
37160
  return;
37078
37161
  const symbol = this.getSymbols().info;
37079
- console.log(import_picocolors20.default.blue(`${symbol} ${message}`));
37162
+ console.log(import_picocolors22.default.blue(`${symbol} ${message}`));
37080
37163
  }
37081
37164
  verbose(message, data) {
37082
37165
  if (!this.config.verbose)
@@ -37085,7 +37168,7 @@ class OutputManager2 {
37085
37168
  this.addJsonEntry({ type: "info", message, data });
37086
37169
  return;
37087
37170
  }
37088
- console.log(import_picocolors20.default.dim(` ${message}`));
37171
+ console.log(import_picocolors22.default.dim(` ${message}`));
37089
37172
  }
37090
37173
  indent(message) {
37091
37174
  if (this.config.json)
@@ -37110,7 +37193,7 @@ class OutputManager2 {
37110
37193
  return;
37111
37194
  const symbols = this.getSymbols();
37112
37195
  console.log();
37113
- console.log(import_picocolors20.default.bold(import_picocolors20.default.cyan(`${symbols.line} ${title}`)));
37196
+ console.log(import_picocolors22.default.bold(import_picocolors22.default.cyan(`${symbols.line} ${title}`)));
37114
37197
  }
37115
37198
  addJsonEntry(entry) {
37116
37199
  this.jsonBuffer.push({