claudekit-cli 3.13.2 → 3.15.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.
- package/dist/index.js +714 -564
- 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
|
|
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'
|
|
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
|
|
14677
|
+
var import_picocolors23, NO_COLOR, isColorSupported, identity = (text) => text, colors, defaultTheme;
|
|
14678
14678
|
var init_help_colors = __esm(() => {
|
|
14679
|
-
|
|
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 ?
|
|
14684
|
-
command: isColorSupported ?
|
|
14685
|
-
heading: isColorSupported ?
|
|
14686
|
-
flag: isColorSupported ?
|
|
14687
|
-
description: isColorSupported ?
|
|
14688
|
-
example: isColorSupported ?
|
|
14689
|
-
warning: isColorSupported ?
|
|
14690
|
-
error: isColorSupported ?
|
|
14691
|
-
muted: isColorSupported ?
|
|
14692
|
-
success: isColorSupported ?
|
|
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,
|
|
@@ -34480,10 +34480,40 @@ async function generateEnvFile(targetDir, values) {
|
|
|
34480
34480
|
"# See .env.example for all available options",
|
|
34481
34481
|
""
|
|
34482
34482
|
];
|
|
34483
|
+
const geminiKeys = [];
|
|
34484
|
+
const otherValues = [];
|
|
34483
34485
|
for (const [key, value] of Object.entries(values)) {
|
|
34484
34486
|
if (value) {
|
|
34487
|
+
if (key.startsWith("GEMINI_API_KEY")) {
|
|
34488
|
+
geminiKeys.push([key, value]);
|
|
34489
|
+
} else {
|
|
34490
|
+
otherValues.push([key, value]);
|
|
34491
|
+
}
|
|
34492
|
+
}
|
|
34493
|
+
}
|
|
34494
|
+
if (geminiKeys.length > 0) {
|
|
34495
|
+
if (geminiKeys.length > 1) {
|
|
34496
|
+
lines.push("# Gemini API Keys (rotation enabled)");
|
|
34497
|
+
lines.push("# Keys auto-rotate on rate limit (429/RESOURCE_EXHAUSTED)");
|
|
34498
|
+
}
|
|
34499
|
+
geminiKeys.sort((a3, b3) => {
|
|
34500
|
+
const getKeyNumber = (key) => {
|
|
34501
|
+
if (key === "GEMINI_API_KEY")
|
|
34502
|
+
return 1;
|
|
34503
|
+
const match2 = key.match(/^GEMINI_API_KEY_(\d+)$/);
|
|
34504
|
+
return match2 ? Number.parseInt(match2[1], 10) : 999;
|
|
34505
|
+
};
|
|
34506
|
+
return getKeyNumber(a3[0]) - getKeyNumber(b3[0]);
|
|
34507
|
+
});
|
|
34508
|
+
for (const [key, value] of geminiKeys) {
|
|
34485
34509
|
lines.push(`${key}=${value}`);
|
|
34486
34510
|
}
|
|
34511
|
+
if (otherValues.length > 0) {
|
|
34512
|
+
lines.push("");
|
|
34513
|
+
}
|
|
34514
|
+
}
|
|
34515
|
+
for (const [key, value] of otherValues) {
|
|
34516
|
+
lines.push(`${key}=${value}`);
|
|
34487
34517
|
}
|
|
34488
34518
|
const envPath = join53(targetDir, ".env");
|
|
34489
34519
|
await import_fs_extra25.writeFile(envPath, `${lines.join(`
|
|
@@ -34627,10 +34657,64 @@ async function runSetupWizard(options) {
|
|
|
34627
34657
|
values[config.key] = result;
|
|
34628
34658
|
}
|
|
34629
34659
|
}
|
|
34660
|
+
if (values.GEMINI_API_KEY) {
|
|
34661
|
+
const additionalKeys = await promptForAdditionalGeminiKeys(values.GEMINI_API_KEY);
|
|
34662
|
+
for (let i = 0;i < additionalKeys.length; i++) {
|
|
34663
|
+
values[`GEMINI_API_KEY_${i + 2}`] = additionalKeys[i];
|
|
34664
|
+
}
|
|
34665
|
+
const totalKeys = 1 + additionalKeys.length;
|
|
34666
|
+
if (totalKeys > 1) {
|
|
34667
|
+
f2.success(`✓ Configured ${totalKeys} Gemini API keys for rotation`);
|
|
34668
|
+
}
|
|
34669
|
+
}
|
|
34630
34670
|
await generateEnvFile(targetDir, values);
|
|
34631
34671
|
f2.success(`Configuration saved to ${join54(targetDir, ".env")}`);
|
|
34632
34672
|
return true;
|
|
34633
34673
|
}
|
|
34674
|
+
async function promptForAdditionalGeminiKeys(primaryKey) {
|
|
34675
|
+
const additionalKeys = [];
|
|
34676
|
+
const allKeys = new Set([primaryKey]);
|
|
34677
|
+
const wantMore = await se({
|
|
34678
|
+
message: "Add additional API keys for rotation? (recommended for high usage)",
|
|
34679
|
+
initialValue: false
|
|
34680
|
+
});
|
|
34681
|
+
if (lD(wantMore) || !wantMore) {
|
|
34682
|
+
return additionalKeys;
|
|
34683
|
+
}
|
|
34684
|
+
let keyNumber = 2;
|
|
34685
|
+
const maxKeys = 10;
|
|
34686
|
+
while (keyNumber <= maxKeys) {
|
|
34687
|
+
const result = await te({
|
|
34688
|
+
message: `Gemini API Key #${keyNumber} (press Enter to finish)`,
|
|
34689
|
+
placeholder: "AIza... or leave empty to finish",
|
|
34690
|
+
validate: (value) => {
|
|
34691
|
+
if (!value)
|
|
34692
|
+
return;
|
|
34693
|
+
const trimmed = value.trim();
|
|
34694
|
+
if (!trimmed)
|
|
34695
|
+
return;
|
|
34696
|
+
if (!validateApiKey(trimmed, VALIDATION_PATTERNS.GEMINI_API_KEY)) {
|
|
34697
|
+
return "Invalid format. Gemini keys start with 'AIza' and are 39 characters.";
|
|
34698
|
+
}
|
|
34699
|
+
if (allKeys.has(trimmed)) {
|
|
34700
|
+
return "This key was already added. Please enter a different key.";
|
|
34701
|
+
}
|
|
34702
|
+
return;
|
|
34703
|
+
}
|
|
34704
|
+
});
|
|
34705
|
+
if (lD(result)) {
|
|
34706
|
+
break;
|
|
34707
|
+
}
|
|
34708
|
+
if (!result || result.trim() === "") {
|
|
34709
|
+
break;
|
|
34710
|
+
}
|
|
34711
|
+
const trimmedKey = result.trim();
|
|
34712
|
+
additionalKeys.push(trimmedKey);
|
|
34713
|
+
allKeys.add(trimmedKey);
|
|
34714
|
+
keyNumber++;
|
|
34715
|
+
}
|
|
34716
|
+
return additionalKeys;
|
|
34717
|
+
}
|
|
34634
34718
|
|
|
34635
34719
|
// src/commands/init/phases/post-install-handler.ts
|
|
34636
34720
|
init_logger();
|
|
@@ -35392,6 +35476,7 @@ Protected files (.env, etc.) were not modified.`;
|
|
|
35392
35476
|
// src/commands/new/new-command.ts
|
|
35393
35477
|
init_logger();
|
|
35394
35478
|
init_types2();
|
|
35479
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
35395
35480
|
|
|
35396
35481
|
// src/commands/new/phases/directory-setup.ts
|
|
35397
35482
|
import { resolve as resolve8 } from "node:path";
|
|
@@ -35668,6 +35753,7 @@ async function newCommand(options) {
|
|
|
35668
35753
|
if (ctx.cancelled)
|
|
35669
35754
|
return;
|
|
35670
35755
|
prompts.outro(`✨ Project created successfully at ${ctx.resolvedDir}`);
|
|
35756
|
+
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)`);
|
|
35671
35757
|
} catch (error) {
|
|
35672
35758
|
logger.error(error instanceof Error ? error.message : "Unknown error occurred");
|
|
35673
35759
|
process.exit(1);
|
|
@@ -35676,7 +35762,7 @@ async function newCommand(options) {
|
|
|
35676
35762
|
// src/commands/uninstall/uninstall-command.ts
|
|
35677
35763
|
init_logger();
|
|
35678
35764
|
init_types2();
|
|
35679
|
-
var
|
|
35765
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
35680
35766
|
|
|
35681
35767
|
// src/commands/uninstall/installation-detector.ts
|
|
35682
35768
|
var import_fs_extra32 = __toESM(require_lib(), 1);
|
|
@@ -35710,7 +35796,7 @@ var import_fs_extra33 = __toESM(require_lib(), 1);
|
|
|
35710
35796
|
import { readdirSync, rmSync } from "node:fs";
|
|
35711
35797
|
import { dirname as dirname8, join as join63 } from "node:path";
|
|
35712
35798
|
init_logger();
|
|
35713
|
-
var
|
|
35799
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
35714
35800
|
function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
|
|
35715
35801
|
if (ownership === "ck") {
|
|
35716
35802
|
return { action: "delete", reason: deleteReason };
|
|
@@ -35801,27 +35887,27 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
35801
35887
|
}
|
|
35802
35888
|
function displayDryRunPreview(analysis, installationType) {
|
|
35803
35889
|
console.log("");
|
|
35804
|
-
log.info(
|
|
35890
|
+
log.info(import_picocolors16.default.bold(`DRY RUN - Preview for ${installationType} installation:`));
|
|
35805
35891
|
console.log("");
|
|
35806
35892
|
if (analysis.toDelete.length > 0) {
|
|
35807
|
-
console.log(
|
|
35893
|
+
console.log(import_picocolors16.default.red(import_picocolors16.default.bold(`Files to DELETE (${analysis.toDelete.length}):`)));
|
|
35808
35894
|
const showDelete = analysis.toDelete.slice(0, 10);
|
|
35809
35895
|
for (const item of showDelete) {
|
|
35810
|
-
console.log(` ${
|
|
35896
|
+
console.log(` ${import_picocolors16.default.red("✖")} ${item.path}`);
|
|
35811
35897
|
}
|
|
35812
35898
|
if (analysis.toDelete.length > 10) {
|
|
35813
|
-
console.log(
|
|
35899
|
+
console.log(import_picocolors16.default.gray(` ... and ${analysis.toDelete.length - 10} more`));
|
|
35814
35900
|
}
|
|
35815
35901
|
console.log("");
|
|
35816
35902
|
}
|
|
35817
35903
|
if (analysis.toPreserve.length > 0) {
|
|
35818
|
-
console.log(
|
|
35904
|
+
console.log(import_picocolors16.default.green(import_picocolors16.default.bold(`Files to PRESERVE (${analysis.toPreserve.length}):`)));
|
|
35819
35905
|
const showPreserve = analysis.toPreserve.slice(0, 10);
|
|
35820
35906
|
for (const item of showPreserve) {
|
|
35821
|
-
console.log(` ${
|
|
35907
|
+
console.log(` ${import_picocolors16.default.green("✓")} ${item.path} ${import_picocolors16.default.gray(`(${item.reason})`)}`);
|
|
35822
35908
|
}
|
|
35823
35909
|
if (analysis.toPreserve.length > 10) {
|
|
35824
|
-
console.log(
|
|
35910
|
+
console.log(import_picocolors16.default.gray(` ... and ${analysis.toPreserve.length - 10} more`));
|
|
35825
35911
|
}
|
|
35826
35912
|
console.log("");
|
|
35827
35913
|
}
|
|
@@ -35969,10 +36055,10 @@ async function uninstallCommand(options) {
|
|
|
35969
36055
|
}
|
|
35970
36056
|
displayInstallations(installations, scope);
|
|
35971
36057
|
if (validOptions.kit) {
|
|
35972
|
-
log.info(
|
|
36058
|
+
log.info(import_picocolors17.default.cyan(`Kit-scoped uninstall: ${validOptions.kit} kit only`));
|
|
35973
36059
|
}
|
|
35974
36060
|
if (validOptions.dryRun) {
|
|
35975
|
-
log.info(
|
|
36061
|
+
log.info(import_picocolors17.default.yellow("DRY RUN MODE - No files will be deleted"));
|
|
35976
36062
|
await removeInstallations(installations, {
|
|
35977
36063
|
dryRun: true,
|
|
35978
36064
|
forceOverwrite: validOptions.forceOverwrite,
|
|
@@ -35982,8 +36068,8 @@ async function uninstallCommand(options) {
|
|
|
35982
36068
|
return;
|
|
35983
36069
|
}
|
|
35984
36070
|
if (validOptions.forceOverwrite) {
|
|
35985
|
-
log.warn(`${
|
|
35986
|
-
${
|
|
36071
|
+
log.warn(`${import_picocolors17.default.yellow(import_picocolors17.default.bold("FORCE MODE ENABLED"))}
|
|
36072
|
+
${import_picocolors17.default.yellow("User modifications will be permanently deleted!")}`);
|
|
35987
36073
|
}
|
|
35988
36074
|
if (!validOptions.yes) {
|
|
35989
36075
|
const kitLabel = validOptions.kit ? ` (${validOptions.kit} kit only)` : "";
|
|
@@ -36144,165 +36230,491 @@ class NpmRegistryClient {
|
|
|
36144
36230
|
}
|
|
36145
36231
|
}
|
|
36146
36232
|
|
|
36147
|
-
// src/
|
|
36148
|
-
init_logger();
|
|
36149
|
-
init_types2();
|
|
36150
|
-
init_types2();
|
|
36233
|
+
// src/domains/versioning/checking/version-utils.ts
|
|
36151
36234
|
var import_compare_versions2 = __toESM(require_umd(), 1);
|
|
36152
|
-
|
|
36153
|
-
|
|
36154
|
-
|
|
36155
|
-
|
|
36156
|
-
|
|
36157
|
-
|
|
36158
|
-
|
|
36159
|
-
|
|
36160
|
-
|
|
36161
|
-
|
|
36162
|
-
|
|
36163
|
-
|
|
36164
|
-
|
|
36165
|
-
},
|
|
36166
|
-
bin: {
|
|
36167
|
-
ck: "bin/ck.js"
|
|
36168
|
-
},
|
|
36169
|
-
files: [
|
|
36170
|
-
"bin/ck.js",
|
|
36171
|
-
"dist/index.js"
|
|
36172
|
-
],
|
|
36173
|
-
scripts: {
|
|
36174
|
-
dev: "bun run src/index.ts",
|
|
36175
|
-
build: "bun build src/index.ts --outdir dist --target node --external @octokit/rest",
|
|
36176
|
-
compile: "bun build src/index.ts --compile --outfile ck",
|
|
36177
|
-
"compile:binary": "bun build src/index.ts --compile --outfile bin/ck",
|
|
36178
|
-
"compile:binaries": "node scripts/build-all-binaries.js",
|
|
36179
|
-
"check-version-sync": "node scripts/check-binary-version-sync.js",
|
|
36180
|
-
"build:platform-binaries": "bun run scripts/build-platform-binaries.js",
|
|
36181
|
-
test: "bun test",
|
|
36182
|
-
"test:watch": "bun test --watch",
|
|
36183
|
-
"test:quick": "./scripts/dev-quick-start.sh test",
|
|
36184
|
-
lint: "biome check .",
|
|
36185
|
-
"lint:fix": "biome check --fix .",
|
|
36186
|
-
"lint:fix-unsafe": "biome check --fix --unsafe .",
|
|
36187
|
-
format: "biome format --write .",
|
|
36188
|
-
typecheck: "tsc --noEmit",
|
|
36189
|
-
"dev:quick": "./scripts/dev-quick-start.sh",
|
|
36190
|
-
"dev:all": "./scripts/dev-quick-start.sh all",
|
|
36191
|
-
metrics: "bun run scripts/workflow-metrics.ts",
|
|
36192
|
-
"install:hooks": "./.githooks/install.sh"
|
|
36193
|
-
},
|
|
36194
|
-
keywords: [
|
|
36195
|
-
"cli",
|
|
36196
|
-
"claudekit",
|
|
36197
|
-
"boilerplate",
|
|
36198
|
-
"bootstrap",
|
|
36199
|
-
"template"
|
|
36200
|
-
],
|
|
36201
|
-
author: "ClaudeKit",
|
|
36202
|
-
license: "MIT",
|
|
36203
|
-
engines: {
|
|
36204
|
-
bun: ">=1.3.2",
|
|
36205
|
-
node: ">=18.0.0"
|
|
36206
|
-
},
|
|
36207
|
-
dependencies: {
|
|
36208
|
-
"@clack/prompts": "^0.7.0",
|
|
36209
|
-
"@octokit/rest": "^22.0.0",
|
|
36210
|
-
cac: "^6.7.14",
|
|
36211
|
-
"cli-progress": "^3.12.0",
|
|
36212
|
-
"compare-versions": "^6.1.1",
|
|
36213
|
-
"extract-zip": "^2.0.1",
|
|
36214
|
-
"fs-extra": "^11.2.0",
|
|
36215
|
-
ignore: "^5.3.2",
|
|
36216
|
-
minimatch: "^10.1.1",
|
|
36217
|
-
ora: "^8.0.0",
|
|
36218
|
-
"p-limit": "^7.2.0",
|
|
36219
|
-
picocolors: "^1.1.1",
|
|
36220
|
-
"proper-lockfile": "^4.1.2",
|
|
36221
|
-
tar: "^7.4.3",
|
|
36222
|
-
tmp: "^0.2.3",
|
|
36223
|
-
zod: "^3.23.8"
|
|
36224
|
-
},
|
|
36225
|
-
devDependencies: {
|
|
36226
|
-
"@biomejs/biome": "^1.9.4",
|
|
36227
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
36228
|
-
"@semantic-release/git": "^10.0.1",
|
|
36229
|
-
"@types/bun": "latest",
|
|
36230
|
-
"@types/cli-progress": "^3.11.6",
|
|
36231
|
-
"@types/fs-extra": "^11.0.4",
|
|
36232
|
-
"@types/node": "^22.10.1",
|
|
36233
|
-
"@types/proper-lockfile": "^4.1.4",
|
|
36234
|
-
"@types/tar": "^6.1.13",
|
|
36235
|
-
"@types/tmp": "^0.2.6",
|
|
36236
|
-
"semantic-release": "^24.2.0",
|
|
36237
|
-
typescript: "^5.7.2"
|
|
36235
|
+
function isUpdateCheckDisabled() {
|
|
36236
|
+
return process.env.NO_UPDATE_NOTIFIER === "1" || process.env.NO_UPDATE_NOTIFIER === "true" || !process.stdout.isTTY;
|
|
36237
|
+
}
|
|
36238
|
+
function normalizeVersion(version) {
|
|
36239
|
+
return version.replace(/^v/, "");
|
|
36240
|
+
}
|
|
36241
|
+
function isNewerVersion(currentVersion, latestVersion) {
|
|
36242
|
+
try {
|
|
36243
|
+
const current = normalizeVersion(currentVersion);
|
|
36244
|
+
const latest = normalizeVersion(latestVersion);
|
|
36245
|
+
return import_compare_versions2.compareVersions(latest, current) > 0;
|
|
36246
|
+
} catch {
|
|
36247
|
+
return false;
|
|
36238
36248
|
}
|
|
36239
|
-
}
|
|
36240
|
-
|
|
36241
|
-
|
|
36242
|
-
|
|
36249
|
+
}
|
|
36250
|
+
// src/domains/versioning/checking/kit-version-checker.ts
|
|
36251
|
+
init_logger();
|
|
36252
|
+
init_types2();
|
|
36243
36253
|
|
|
36244
|
-
|
|
36245
|
-
|
|
36246
|
-
|
|
36247
|
-
|
|
36254
|
+
// src/domains/versioning/version-cache.ts
|
|
36255
|
+
init_logger();
|
|
36256
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
36257
|
+
import { mkdir as mkdir18, readFile as readFile20, writeFile as writeFile17 } from "node:fs/promises";
|
|
36258
|
+
import { join as join65 } from "node:path";
|
|
36259
|
+
class VersionCacheManager {
|
|
36260
|
+
static CACHE_FILENAME = "version-check.json";
|
|
36261
|
+
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
36262
|
+
static getCacheFile() {
|
|
36263
|
+
const cacheDir = PathResolver.getCacheDir(false);
|
|
36264
|
+
return join65(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
36248
36265
|
}
|
|
36249
|
-
|
|
36250
|
-
|
|
36251
|
-
|
|
36252
|
-
|
|
36253
|
-
|
|
36254
|
-
|
|
36255
|
-
const opts = UpdateCliOptionsSchema.parse(options);
|
|
36256
|
-
const currentVersion = package_default.version;
|
|
36257
|
-
logger.info(`Current CLI version: ${currentVersion}`);
|
|
36258
|
-
s.start("Detecting package manager...");
|
|
36259
|
-
const pm = await PackageManagerDetector.detect();
|
|
36260
|
-
const pmVersion = await PackageManagerDetector.getVersion(pm);
|
|
36261
|
-
s.stop(`Using ${PackageManagerDetector.getDisplayName(pm)}${pmVersion ? ` v${pmVersion}` : ""}`);
|
|
36262
|
-
logger.verbose(`Detected package manager: ${pm}`);
|
|
36263
|
-
s.start("Checking for updates...");
|
|
36264
|
-
let targetVersion = null;
|
|
36265
|
-
if (opts.release && opts.release !== "latest") {
|
|
36266
|
-
const exists = await NpmRegistryClient.versionExists(PACKAGE_NAME, opts.release, opts.registry);
|
|
36267
|
-
if (!exists) {
|
|
36268
|
-
s.stop("Version not found");
|
|
36269
|
-
throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run 'ck versions' to see available versions.`);
|
|
36266
|
+
static async load() {
|
|
36267
|
+
const cacheFile = VersionCacheManager.getCacheFile();
|
|
36268
|
+
try {
|
|
36269
|
+
if (!existsSync16(cacheFile)) {
|
|
36270
|
+
logger.debug("Version check cache not found");
|
|
36271
|
+
return null;
|
|
36270
36272
|
}
|
|
36271
|
-
|
|
36272
|
-
|
|
36273
|
-
|
|
36274
|
-
|
|
36275
|
-
|
|
36276
|
-
s.stop("No beta version available");
|
|
36277
|
-
logger.warning("No beta version found. Using latest stable version instead.");
|
|
36278
|
-
targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME, opts.registry);
|
|
36279
|
-
} else {
|
|
36280
|
-
s.stop(`Latest beta version: ${targetVersion}`);
|
|
36273
|
+
const content = await readFile20(cacheFile, "utf-8");
|
|
36274
|
+
const cache2 = JSON.parse(content);
|
|
36275
|
+
if (!cache2.lastCheck || !cache2.currentVersion || !cache2.latestVersion) {
|
|
36276
|
+
logger.debug("Invalid cache structure, ignoring");
|
|
36277
|
+
return null;
|
|
36281
36278
|
}
|
|
36282
|
-
|
|
36283
|
-
|
|
36284
|
-
|
|
36285
|
-
|
|
36286
|
-
|
|
36287
|
-
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)}`);
|
|
36279
|
+
logger.debug(`Version check cache loaded: ${JSON.stringify(cache2)}`);
|
|
36280
|
+
return cache2;
|
|
36281
|
+
} catch (error) {
|
|
36282
|
+
logger.debug(`Failed to load version check cache: ${error}`);
|
|
36283
|
+
return null;
|
|
36288
36284
|
}
|
|
36289
|
-
|
|
36290
|
-
|
|
36291
|
-
|
|
36292
|
-
|
|
36285
|
+
}
|
|
36286
|
+
static async save(cache2) {
|
|
36287
|
+
const cacheFile = VersionCacheManager.getCacheFile();
|
|
36288
|
+
const cacheDir = PathResolver.getCacheDir(false);
|
|
36289
|
+
try {
|
|
36290
|
+
if (!existsSync16(cacheDir)) {
|
|
36291
|
+
await mkdir18(cacheDir, { recursive: true, mode: 448 });
|
|
36292
|
+
}
|
|
36293
|
+
await writeFile17(cacheFile, JSON.stringify(cache2, null, 2), "utf-8");
|
|
36294
|
+
logger.debug(`Version check cache saved to ${cacheFile}`);
|
|
36295
|
+
} catch (error) {
|
|
36296
|
+
logger.debug(`Failed to save version check cache: ${error}`);
|
|
36293
36297
|
}
|
|
36294
|
-
|
|
36295
|
-
|
|
36296
|
-
|
|
36298
|
+
}
|
|
36299
|
+
static isCacheValid(cache2) {
|
|
36300
|
+
if (!cache2)
|
|
36301
|
+
return false;
|
|
36302
|
+
const now = Date.now();
|
|
36303
|
+
const age = now - cache2.lastCheck;
|
|
36304
|
+
const isValid2 = age < VersionCacheManager.CACHE_TTL_MS;
|
|
36305
|
+
const ageDays = (age / 1000 / 60 / 60 / 24).toFixed(1);
|
|
36306
|
+
logger.debug(`Cache validity check: age=${ageDays} days, valid=${isValid2}`);
|
|
36307
|
+
return isValid2;
|
|
36308
|
+
}
|
|
36309
|
+
static async clear() {
|
|
36310
|
+
const cacheFile = VersionCacheManager.getCacheFile();
|
|
36311
|
+
try {
|
|
36312
|
+
if (existsSync16(cacheFile)) {
|
|
36313
|
+
const fs12 = await import("node:fs/promises");
|
|
36314
|
+
await fs12.unlink(cacheFile);
|
|
36315
|
+
logger.debug("Version check cache cleared");
|
|
36316
|
+
}
|
|
36317
|
+
} catch (error) {
|
|
36318
|
+
logger.debug(`Failed to clear version check cache: ${error}`);
|
|
36297
36319
|
}
|
|
36298
|
-
|
|
36299
|
-
|
|
36300
|
-
logger.info(`${isUpgrade ? "[^]" : "[v]"} ${changeType}: ${currentVersion} -> ${targetVersion}`);
|
|
36301
|
-
if (opts.check) {
|
|
36302
|
-
note(`Update available: ${currentVersion} -> ${targetVersion}
|
|
36320
|
+
}
|
|
36321
|
+
}
|
|
36303
36322
|
|
|
36304
|
-
|
|
36305
|
-
|
|
36323
|
+
// src/domains/versioning/checking/kit-version-checker.ts
|
|
36324
|
+
async function fetchLatestRelease(currentVersion) {
|
|
36325
|
+
try {
|
|
36326
|
+
const githubClient = new GitHubClient;
|
|
36327
|
+
const kit = AVAILABLE_KITS.engineer;
|
|
36328
|
+
const timeoutPromise = new Promise((_3, reject) => setTimeout(() => reject(new Error("Timeout")), 5000));
|
|
36329
|
+
const releasePromise = githubClient.getLatestRelease(kit);
|
|
36330
|
+
const release = await Promise.race([releasePromise, timeoutPromise]);
|
|
36331
|
+
const latestVersion = release.tag_name;
|
|
36332
|
+
const updateAvailable = isNewerVersion(currentVersion, latestVersion);
|
|
36333
|
+
const releaseUrl = `https://github.com/${kit.owner}/${kit.repo}/releases/tag/${latestVersion}`;
|
|
36334
|
+
logger.debug(`Fetched latest release: current=${currentVersion}, latest=${latestVersion}, updateAvailable=${updateAvailable}`);
|
|
36335
|
+
return {
|
|
36336
|
+
currentVersion,
|
|
36337
|
+
latestVersion,
|
|
36338
|
+
updateAvailable,
|
|
36339
|
+
releaseUrl
|
|
36340
|
+
};
|
|
36341
|
+
} catch (error) {
|
|
36342
|
+
logger.debug(`Failed to fetch latest release: ${error}`);
|
|
36343
|
+
return null;
|
|
36344
|
+
}
|
|
36345
|
+
}
|
|
36346
|
+
|
|
36347
|
+
class VersionChecker {
|
|
36348
|
+
static async check(currentVersion) {
|
|
36349
|
+
if (isUpdateCheckDisabled()) {
|
|
36350
|
+
logger.debug("Update check disabled by environment");
|
|
36351
|
+
return null;
|
|
36352
|
+
}
|
|
36353
|
+
const cache2 = await VersionCacheManager.load();
|
|
36354
|
+
if (cache2 && VersionCacheManager.isCacheValid(cache2) && cache2.currentVersion === currentVersion) {
|
|
36355
|
+
logger.debug("Using cached version check result");
|
|
36356
|
+
return {
|
|
36357
|
+
currentVersion: cache2.currentVersion,
|
|
36358
|
+
latestVersion: cache2.latestVersion,
|
|
36359
|
+
updateAvailable: cache2.updateAvailable,
|
|
36360
|
+
releaseUrl: cache2.latestUrl
|
|
36361
|
+
};
|
|
36362
|
+
}
|
|
36363
|
+
logger.debug("Cache expired or invalid, fetching latest release");
|
|
36364
|
+
const result = await fetchLatestRelease(currentVersion);
|
|
36365
|
+
if (result) {
|
|
36366
|
+
await VersionCacheManager.save({
|
|
36367
|
+
lastCheck: Date.now(),
|
|
36368
|
+
currentVersion: result.currentVersion,
|
|
36369
|
+
latestVersion: result.latestVersion,
|
|
36370
|
+
latestUrl: result.releaseUrl,
|
|
36371
|
+
updateAvailable: result.updateAvailable
|
|
36372
|
+
});
|
|
36373
|
+
}
|
|
36374
|
+
return result;
|
|
36375
|
+
}
|
|
36376
|
+
}
|
|
36377
|
+
// src/domains/versioning/checking/cli-version-checker.ts
|
|
36378
|
+
init_logger();
|
|
36379
|
+
var import_compare_versions3 = __toESM(require_umd(), 1);
|
|
36380
|
+
var PACKAGE_NAME = "claudekit-cli";
|
|
36381
|
+
|
|
36382
|
+
class CliVersionChecker {
|
|
36383
|
+
static async check(currentVersion) {
|
|
36384
|
+
if (isUpdateCheckDisabled()) {
|
|
36385
|
+
logger.debug("CLI update check disabled by environment");
|
|
36386
|
+
return null;
|
|
36387
|
+
}
|
|
36388
|
+
try {
|
|
36389
|
+
const latestVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME);
|
|
36390
|
+
if (!latestVersion) {
|
|
36391
|
+
logger.debug("Failed to fetch latest CLI version from npm");
|
|
36392
|
+
return null;
|
|
36393
|
+
}
|
|
36394
|
+
const current = normalizeVersion(currentVersion);
|
|
36395
|
+
const latest = normalizeVersion(latestVersion);
|
|
36396
|
+
const updateAvailable = import_compare_versions3.compareVersions(latest, current) > 0;
|
|
36397
|
+
logger.debug(`CLI version check: current=${current}, latest=${latest}, updateAvailable=${updateAvailable}`);
|
|
36398
|
+
return {
|
|
36399
|
+
currentVersion: current,
|
|
36400
|
+
latestVersion: latest,
|
|
36401
|
+
updateAvailable,
|
|
36402
|
+
releaseUrl: `https://www.npmjs.com/package/${PACKAGE_NAME}`
|
|
36403
|
+
};
|
|
36404
|
+
} catch (error) {
|
|
36405
|
+
logger.debug(`CLI version check failed: ${error}`);
|
|
36406
|
+
return null;
|
|
36407
|
+
}
|
|
36408
|
+
}
|
|
36409
|
+
}
|
|
36410
|
+
// src/domains/versioning/checking/notification-display.ts
|
|
36411
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
36412
|
+
function createNotificationBox(borderColor, boxWidth) {
|
|
36413
|
+
const contentWidth = boxWidth - 2;
|
|
36414
|
+
const topBorder = borderColor(`╭${"─".repeat(contentWidth)}╮`);
|
|
36415
|
+
const bottomBorder = borderColor(`╰${"─".repeat(contentWidth)}╯`);
|
|
36416
|
+
const emptyLine = borderColor("│") + " ".repeat(contentWidth) + borderColor("│");
|
|
36417
|
+
const padLine = (text, visibleLen) => {
|
|
36418
|
+
const len = visibleLen ?? text.length;
|
|
36419
|
+
const displayText = len > contentWidth ? `${text.slice(0, contentWidth - 3)}...` : text;
|
|
36420
|
+
const actualLen = visibleLen ?? displayText.length;
|
|
36421
|
+
const totalPadding = contentWidth - actualLen;
|
|
36422
|
+
const leftPadding = Math.max(0, Math.floor(totalPadding / 2));
|
|
36423
|
+
const rightPadding = Math.max(0, totalPadding - leftPadding);
|
|
36424
|
+
return borderColor("│") + " ".repeat(leftPadding) + displayText + " ".repeat(rightPadding) + borderColor("│");
|
|
36425
|
+
};
|
|
36426
|
+
return { topBorder, bottomBorder, emptyLine, padLine };
|
|
36427
|
+
}
|
|
36428
|
+
function displayKitNotification(result, options = {}) {
|
|
36429
|
+
if (!result.updateAvailable)
|
|
36430
|
+
return;
|
|
36431
|
+
const { currentVersion, latestVersion } = result;
|
|
36432
|
+
const { isGlobal = false } = options;
|
|
36433
|
+
const displayCurrent = normalizeVersion(currentVersion);
|
|
36434
|
+
const displayLatest = normalizeVersion(latestVersion);
|
|
36435
|
+
const boxWidth = 52;
|
|
36436
|
+
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.cyan, boxWidth);
|
|
36437
|
+
const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ Kit Update Available"));
|
|
36438
|
+
const headerLen = "⬆ Kit Update Available".length;
|
|
36439
|
+
const versionText = `${import_picocolors18.default.dim(displayCurrent)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(displayLatest))}`;
|
|
36440
|
+
const versionLen = displayCurrent.length + 3 + displayLatest.length;
|
|
36441
|
+
const updateCmd = isGlobal ? "ck init -g" : "ck init";
|
|
36442
|
+
const commandText = `Run: ${import_picocolors18.default.cyan(import_picocolors18.default.bold(updateCmd))}`;
|
|
36443
|
+
const commandLen = `Run: ${updateCmd}`.length;
|
|
36444
|
+
console.log("");
|
|
36445
|
+
console.log(topBorder);
|
|
36446
|
+
console.log(emptyLine);
|
|
36447
|
+
console.log(padLine(headerText, headerLen));
|
|
36448
|
+
console.log(padLine(versionText, versionLen));
|
|
36449
|
+
console.log(emptyLine);
|
|
36450
|
+
console.log(padLine(commandText, commandLen));
|
|
36451
|
+
console.log(emptyLine);
|
|
36452
|
+
console.log(bottomBorder);
|
|
36453
|
+
console.log("");
|
|
36454
|
+
}
|
|
36455
|
+
function displayCliNotification(result) {
|
|
36456
|
+
if (!result.updateAvailable)
|
|
36457
|
+
return;
|
|
36458
|
+
const { currentVersion, latestVersion } = result;
|
|
36459
|
+
const boxWidth = 52;
|
|
36460
|
+
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.magenta, boxWidth);
|
|
36461
|
+
const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ CLI Update Available"));
|
|
36462
|
+
const headerLen = "⬆ CLI Update Available".length;
|
|
36463
|
+
const versionText = `${import_picocolors18.default.dim(currentVersion)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(latestVersion))}`;
|
|
36464
|
+
const versionLen = currentVersion.length + 3 + latestVersion.length;
|
|
36465
|
+
const commandText = `Run: ${import_picocolors18.default.magenta(import_picocolors18.default.bold("ck update"))}`;
|
|
36466
|
+
const commandLen = "Run: ck update".length;
|
|
36467
|
+
console.log("");
|
|
36468
|
+
console.log(topBorder);
|
|
36469
|
+
console.log(emptyLine);
|
|
36470
|
+
console.log(padLine(headerText, headerLen));
|
|
36471
|
+
console.log(padLine(versionText, versionLen));
|
|
36472
|
+
console.log(emptyLine);
|
|
36473
|
+
console.log(padLine(commandText, commandLen));
|
|
36474
|
+
console.log(emptyLine);
|
|
36475
|
+
console.log(bottomBorder);
|
|
36476
|
+
console.log("");
|
|
36477
|
+
}
|
|
36478
|
+
// src/domains/versioning/version-checker.ts
|
|
36479
|
+
class VersionChecker2 {
|
|
36480
|
+
static async check(currentVersion) {
|
|
36481
|
+
return VersionChecker.check(currentVersion);
|
|
36482
|
+
}
|
|
36483
|
+
static displayNotification(result, options = {}) {
|
|
36484
|
+
displayKitNotification(result, options);
|
|
36485
|
+
}
|
|
36486
|
+
}
|
|
36487
|
+
|
|
36488
|
+
class CliVersionChecker2 {
|
|
36489
|
+
static async check(currentVersion) {
|
|
36490
|
+
return CliVersionChecker.check(currentVersion);
|
|
36491
|
+
}
|
|
36492
|
+
static displayNotification(result) {
|
|
36493
|
+
displayCliNotification(result);
|
|
36494
|
+
}
|
|
36495
|
+
}
|
|
36496
|
+
|
|
36497
|
+
// src/commands/update-cli.ts
|
|
36498
|
+
init_logger();
|
|
36499
|
+
init_types2();
|
|
36500
|
+
init_types2();
|
|
36501
|
+
var import_compare_versions4 = __toESM(require_umd(), 1);
|
|
36502
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
36503
|
+
// package.json
|
|
36504
|
+
var package_default = {
|
|
36505
|
+
name: "claudekit-cli",
|
|
36506
|
+
version: "3.15.0",
|
|
36507
|
+
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
36508
|
+
type: "module",
|
|
36509
|
+
repository: {
|
|
36510
|
+
type: "git",
|
|
36511
|
+
url: "git+https://github.com/mrgoonie/claudekit-cli.git"
|
|
36512
|
+
},
|
|
36513
|
+
publishConfig: {
|
|
36514
|
+
access: "public",
|
|
36515
|
+
registry: "https://registry.npmjs.org"
|
|
36516
|
+
},
|
|
36517
|
+
bin: {
|
|
36518
|
+
ck: "bin/ck.js"
|
|
36519
|
+
},
|
|
36520
|
+
files: [
|
|
36521
|
+
"bin/ck.js",
|
|
36522
|
+
"dist/index.js"
|
|
36523
|
+
],
|
|
36524
|
+
scripts: {
|
|
36525
|
+
dev: "bun run src/index.ts",
|
|
36526
|
+
build: "bun build src/index.ts --outdir dist --target node --external @octokit/rest",
|
|
36527
|
+
compile: "bun build src/index.ts --compile --outfile ck",
|
|
36528
|
+
"compile:binary": "bun build src/index.ts --compile --outfile bin/ck",
|
|
36529
|
+
"compile:binaries": "node scripts/build-all-binaries.js",
|
|
36530
|
+
"check-version-sync": "node scripts/check-binary-version-sync.js",
|
|
36531
|
+
"build:platform-binaries": "bun run scripts/build-platform-binaries.js",
|
|
36532
|
+
test: "bun test",
|
|
36533
|
+
"test:watch": "bun test --watch",
|
|
36534
|
+
"test:quick": "./scripts/dev-quick-start.sh test",
|
|
36535
|
+
lint: "biome check .",
|
|
36536
|
+
"lint:fix": "biome check --fix .",
|
|
36537
|
+
"lint:fix-unsafe": "biome check --fix --unsafe .",
|
|
36538
|
+
format: "biome format --write .",
|
|
36539
|
+
typecheck: "tsc --noEmit",
|
|
36540
|
+
"dev:quick": "./scripts/dev-quick-start.sh",
|
|
36541
|
+
"dev:all": "./scripts/dev-quick-start.sh all",
|
|
36542
|
+
metrics: "bun run scripts/workflow-metrics.ts",
|
|
36543
|
+
"install:hooks": "./.githooks/install.sh"
|
|
36544
|
+
},
|
|
36545
|
+
keywords: [
|
|
36546
|
+
"cli",
|
|
36547
|
+
"claudekit",
|
|
36548
|
+
"boilerplate",
|
|
36549
|
+
"bootstrap",
|
|
36550
|
+
"template"
|
|
36551
|
+
],
|
|
36552
|
+
author: "ClaudeKit",
|
|
36553
|
+
license: "MIT",
|
|
36554
|
+
engines: {
|
|
36555
|
+
bun: ">=1.3.2",
|
|
36556
|
+
node: ">=18.0.0"
|
|
36557
|
+
},
|
|
36558
|
+
dependencies: {
|
|
36559
|
+
"@clack/prompts": "^0.7.0",
|
|
36560
|
+
"@octokit/rest": "^22.0.0",
|
|
36561
|
+
cac: "^6.7.14",
|
|
36562
|
+
"cli-progress": "^3.12.0",
|
|
36563
|
+
"compare-versions": "^6.1.1",
|
|
36564
|
+
"extract-zip": "^2.0.1",
|
|
36565
|
+
"fs-extra": "^11.2.0",
|
|
36566
|
+
ignore: "^5.3.2",
|
|
36567
|
+
minimatch: "^10.1.1",
|
|
36568
|
+
ora: "^8.0.0",
|
|
36569
|
+
"p-limit": "^7.2.0",
|
|
36570
|
+
picocolors: "^1.1.1",
|
|
36571
|
+
"proper-lockfile": "^4.1.2",
|
|
36572
|
+
tar: "^7.4.3",
|
|
36573
|
+
tmp: "^0.2.3",
|
|
36574
|
+
zod: "^3.23.8"
|
|
36575
|
+
},
|
|
36576
|
+
devDependencies: {
|
|
36577
|
+
"@biomejs/biome": "^1.9.4",
|
|
36578
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
36579
|
+
"@semantic-release/git": "^10.0.1",
|
|
36580
|
+
"@types/bun": "latest",
|
|
36581
|
+
"@types/cli-progress": "^3.11.6",
|
|
36582
|
+
"@types/fs-extra": "^11.0.4",
|
|
36583
|
+
"@types/node": "^22.10.1",
|
|
36584
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
36585
|
+
"@types/tar": "^6.1.13",
|
|
36586
|
+
"@types/tmp": "^0.2.6",
|
|
36587
|
+
"semantic-release": "^24.2.0",
|
|
36588
|
+
typescript: "^5.7.2"
|
|
36589
|
+
}
|
|
36590
|
+
};
|
|
36591
|
+
|
|
36592
|
+
// src/commands/update-cli.ts
|
|
36593
|
+
var execAsync7 = promisify7(exec7);
|
|
36594
|
+
|
|
36595
|
+
class CliUpdateError extends ClaudeKitError {
|
|
36596
|
+
constructor(message) {
|
|
36597
|
+
super(message, "CLI_UPDATE_ERROR");
|
|
36598
|
+
this.name = "CliUpdateError";
|
|
36599
|
+
}
|
|
36600
|
+
}
|
|
36601
|
+
var PACKAGE_NAME2 = "claudekit-cli";
|
|
36602
|
+
var KIT_UPDATE_REMINDER_HEADER = "Note: 'ck update' only updates the CLI tool itself.";
|
|
36603
|
+
async function displayKitUpdateReminder() {
|
|
36604
|
+
try {
|
|
36605
|
+
const setup = await getClaudeKitSetup();
|
|
36606
|
+
const hasLocal = !!setup.project.metadata;
|
|
36607
|
+
const hasGlobal = !!setup.global.metadata;
|
|
36608
|
+
const localVersion = setup.project.metadata?.version;
|
|
36609
|
+
const globalVersion = setup.global.metadata?.version;
|
|
36610
|
+
const versionsToCheck = new Set;
|
|
36611
|
+
if (localVersion)
|
|
36612
|
+
versionsToCheck.add(localVersion);
|
|
36613
|
+
if (globalVersion)
|
|
36614
|
+
versionsToCheck.add(globalVersion);
|
|
36615
|
+
const versionCheckResults = new Map;
|
|
36616
|
+
if (versionsToCheck.size > 0) {
|
|
36617
|
+
const checkPromises = [...versionsToCheck].map(async (version) => {
|
|
36618
|
+
const result = await VersionChecker2.check(version).catch(() => null);
|
|
36619
|
+
return { version, result };
|
|
36620
|
+
});
|
|
36621
|
+
const results = await Promise.all(checkPromises);
|
|
36622
|
+
for (const { version, result } of results) {
|
|
36623
|
+
versionCheckResults.set(version, result);
|
|
36624
|
+
}
|
|
36625
|
+
}
|
|
36626
|
+
const cmdLocal = "ck init";
|
|
36627
|
+
const cmdGlobal = "ck init -g";
|
|
36628
|
+
const maxCmdLen = Math.max(cmdLocal.length, cmdGlobal.length);
|
|
36629
|
+
const pad = (cmd) => cmd.padEnd(maxCmdLen);
|
|
36630
|
+
const lines = [];
|
|
36631
|
+
lines.push(import_picocolors19.default.yellow(KIT_UPDATE_REMINDER_HEADER));
|
|
36632
|
+
lines.push("");
|
|
36633
|
+
lines.push("To update your ClaudeKit content (skills, commands, workflows):");
|
|
36634
|
+
if (hasLocal && localVersion) {
|
|
36635
|
+
lines.push(` ${import_picocolors19.default.cyan(pad(cmdLocal))} Update local project (v${localVersion})`);
|
|
36636
|
+
const localCheck = versionCheckResults.get(localVersion);
|
|
36637
|
+
if (localCheck?.updateAvailable) {
|
|
36638
|
+
const indent = " ".repeat(maxCmdLen + 4);
|
|
36639
|
+
lines.push(`${indent}${import_picocolors19.default.green(`→ v${localCheck.latestVersion} available!`)}`);
|
|
36640
|
+
}
|
|
36641
|
+
} else {
|
|
36642
|
+
lines.push(` ${import_picocolors19.default.cyan(pad(cmdLocal))} Initialize in current project`);
|
|
36643
|
+
}
|
|
36644
|
+
if (hasGlobal && globalVersion) {
|
|
36645
|
+
lines.push(` ${import_picocolors19.default.cyan(pad(cmdGlobal))} Update global ~/.claude (v${globalVersion})`);
|
|
36646
|
+
const globalCheck = versionCheckResults.get(globalVersion);
|
|
36647
|
+
if (globalCheck?.updateAvailable) {
|
|
36648
|
+
const indent = " ".repeat(maxCmdLen + 4);
|
|
36649
|
+
lines.push(`${indent}${import_picocolors19.default.green(`→ v${globalCheck.latestVersion} available!`)}`);
|
|
36650
|
+
}
|
|
36651
|
+
} else {
|
|
36652
|
+
lines.push(` ${import_picocolors19.default.cyan(pad(cmdGlobal))} Initialize global ~/.claude`);
|
|
36653
|
+
}
|
|
36654
|
+
logger.info("");
|
|
36655
|
+
log.info(lines.join(`
|
|
36656
|
+
`));
|
|
36657
|
+
} catch (error) {
|
|
36658
|
+
logger.verbose(`Failed to display kit update reminder: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
36659
|
+
}
|
|
36660
|
+
}
|
|
36661
|
+
async function updateCliCommand(options) {
|
|
36662
|
+
const s = de();
|
|
36663
|
+
intro("[>] ClaudeKit CLI - Update");
|
|
36664
|
+
try {
|
|
36665
|
+
const opts = UpdateCliOptionsSchema.parse(options);
|
|
36666
|
+
const currentVersion = package_default.version;
|
|
36667
|
+
logger.info(`Current CLI version: ${currentVersion}`);
|
|
36668
|
+
s.start("Detecting package manager...");
|
|
36669
|
+
const pm = await PackageManagerDetector.detect();
|
|
36670
|
+
const pmVersion = await PackageManagerDetector.getVersion(pm);
|
|
36671
|
+
s.stop(`Using ${PackageManagerDetector.getDisplayName(pm)}${pmVersion ? ` v${pmVersion}` : ""}`);
|
|
36672
|
+
logger.verbose(`Detected package manager: ${pm}`);
|
|
36673
|
+
s.start("Checking for updates...");
|
|
36674
|
+
let targetVersion = null;
|
|
36675
|
+
if (opts.release && opts.release !== "latest") {
|
|
36676
|
+
const exists = await NpmRegistryClient.versionExists(PACKAGE_NAME2, opts.release, opts.registry);
|
|
36677
|
+
if (!exists) {
|
|
36678
|
+
s.stop("Version not found");
|
|
36679
|
+
throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run 'ck versions' to see available versions.`);
|
|
36680
|
+
}
|
|
36681
|
+
targetVersion = opts.release;
|
|
36682
|
+
s.stop(`Target version: ${targetVersion}`);
|
|
36683
|
+
} else if (opts.beta) {
|
|
36684
|
+
targetVersion = await NpmRegistryClient.getBetaVersion(PACKAGE_NAME2, opts.registry);
|
|
36685
|
+
if (!targetVersion) {
|
|
36686
|
+
s.stop("No beta version available");
|
|
36687
|
+
logger.warning("No beta version found. Using latest stable version instead.");
|
|
36688
|
+
targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME2, opts.registry);
|
|
36689
|
+
} else {
|
|
36690
|
+
s.stop(`Latest beta version: ${targetVersion}`);
|
|
36691
|
+
}
|
|
36692
|
+
} else {
|
|
36693
|
+
targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME2, opts.registry);
|
|
36694
|
+
s.stop(`Latest version: ${targetVersion || "unknown"}`);
|
|
36695
|
+
}
|
|
36696
|
+
if (!targetVersion) {
|
|
36697
|
+
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)}`);
|
|
36698
|
+
}
|
|
36699
|
+
const comparison = import_compare_versions4.compareVersions(currentVersion, targetVersion);
|
|
36700
|
+
if (comparison === 0) {
|
|
36701
|
+
outro(`[+] Already on the latest CLI version (${currentVersion})`);
|
|
36702
|
+
await displayKitUpdateReminder();
|
|
36703
|
+
return;
|
|
36704
|
+
}
|
|
36705
|
+
if (comparison > 0 && !opts.release) {
|
|
36706
|
+
outro(`[+] Current version (${currentVersion}) is newer than latest (${targetVersion})`);
|
|
36707
|
+
return;
|
|
36708
|
+
}
|
|
36709
|
+
const isUpgrade = comparison < 0;
|
|
36710
|
+
const changeType = isUpgrade ? "upgrade" : "downgrade";
|
|
36711
|
+
logger.info(`${isUpgrade ? "[^]" : "[v]"} ${changeType}: ${currentVersion} -> ${targetVersion}`);
|
|
36712
|
+
if (opts.check) {
|
|
36713
|
+
note(`CLI update available: ${currentVersion} -> ${targetVersion}
|
|
36714
|
+
|
|
36715
|
+
Run 'ck update' to install`, "Update Check");
|
|
36716
|
+
await displayKitUpdateReminder();
|
|
36717
|
+
outro("Check complete");
|
|
36306
36718
|
return;
|
|
36307
36719
|
}
|
|
36308
36720
|
if (!opts.yes) {
|
|
@@ -36314,7 +36726,7 @@ Run 'ck update' to install`, "Update Check");
|
|
|
36314
36726
|
return;
|
|
36315
36727
|
}
|
|
36316
36728
|
}
|
|
36317
|
-
const updateCmd = PackageManagerDetector.getUpdateCommand(pm,
|
|
36729
|
+
const updateCmd = PackageManagerDetector.getUpdateCommand(pm, PACKAGE_NAME2, targetVersion);
|
|
36318
36730
|
logger.info(`Running: ${updateCmd}`);
|
|
36319
36731
|
s.start("Updating CLI...");
|
|
36320
36732
|
try {
|
|
@@ -36341,9 +36753,11 @@ Manual update: ${updateCmd}`);
|
|
|
36341
36753
|
const newVersion = newVersionMatch ? newVersionMatch[1] : targetVersion;
|
|
36342
36754
|
s.stop(`Installed version: ${newVersion}`);
|
|
36343
36755
|
outro(`[+] Successfully updated ClaudeKit CLI to ${newVersion}`);
|
|
36756
|
+
await displayKitUpdateReminder();
|
|
36344
36757
|
} catch {
|
|
36345
36758
|
s.stop("Verification completed");
|
|
36346
36759
|
outro(`[+] Update completed. Please restart your terminal to use CLI ${targetVersion}`);
|
|
36760
|
+
await displayKitUpdateReminder();
|
|
36347
36761
|
}
|
|
36348
36762
|
} catch (error) {
|
|
36349
36763
|
if (error instanceof CliUpdateError) {
|
|
@@ -36359,7 +36773,7 @@ Manual update: ${updateCmd}`);
|
|
|
36359
36773
|
// src/commands/version.ts
|
|
36360
36774
|
init_logger();
|
|
36361
36775
|
init_types2();
|
|
36362
|
-
var
|
|
36776
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
36363
36777
|
function formatRelativeTime(dateString) {
|
|
36364
36778
|
if (!dateString)
|
|
36365
36779
|
return "Unknown";
|
|
@@ -36381,402 +36795,136 @@ function formatRelativeTime(dateString) {
|
|
|
36381
36795
|
}
|
|
36382
36796
|
function displayKitReleases(kitName, releases) {
|
|
36383
36797
|
console.log(`
|
|
36384
|
-
${
|
|
36798
|
+
${import_picocolors20.default.bold(import_picocolors20.default.cyan(kitName))} - Available Versions:
|
|
36385
36799
|
`);
|
|
36386
36800
|
if (releases.length === 0) {
|
|
36387
|
-
console.log(
|
|
36801
|
+
console.log(import_picocolors20.default.dim(" No releases found"));
|
|
36388
36802
|
return;
|
|
36389
36803
|
}
|
|
36390
36804
|
for (const release of releases) {
|
|
36391
|
-
const version =
|
|
36805
|
+
const version = import_picocolors20.default.green(release.tag_name);
|
|
36392
36806
|
const name2 = release.name || "No title";
|
|
36393
36807
|
const publishedAt = formatRelativeTime(release.published_at);
|
|
36394
|
-
const assetCount = release.assets.length;
|
|
36395
|
-
const badges = [];
|
|
36396
|
-
if (release.prerelease)
|
|
36397
|
-
badges.push(
|
|
36398
|
-
if (release.draft)
|
|
36399
|
-
badges.push(
|
|
36400
|
-
const badgeStr = badges.length > 0 ? ` ${badges.join(" ")}` : "";
|
|
36401
|
-
const versionPart = version.padEnd(20);
|
|
36402
|
-
const namePart = name2.length > 40 ? `${name2.slice(0, 37)}...` : name2.padEnd(40);
|
|
36403
|
-
const timePart =
|
|
36404
|
-
const assetPart =
|
|
36405
|
-
console.log(` ${versionPart} ${namePart} ${timePart} ${assetPart}${badgeStr}`);
|
|
36406
|
-
}
|
|
36407
|
-
console.log(import_picocolors17.default.dim(`
|
|
36408
|
-
Showing ${releases.length} ${releases.length === 1 ? "release" : "releases"}`));
|
|
36409
|
-
}
|
|
36410
|
-
async function versionCommand(options) {
|
|
36411
|
-
const prompts2 = new PromptsManager;
|
|
36412
|
-
prompts2.intro("\uD83D\uDCE6 ClaudeKit - Available Versions");
|
|
36413
|
-
try {
|
|
36414
|
-
const validOptions = VersionCommandOptionsSchema.parse(options);
|
|
36415
|
-
const kitsToFetch = validOptions.kit ? [validOptions.kit] : Object.keys(AVAILABLE_KITS);
|
|
36416
|
-
const github = new GitHubClient;
|
|
36417
|
-
const limit = validOptions.limit || 30;
|
|
36418
|
-
const releasePromises = kitsToFetch.map(async (kitType) => {
|
|
36419
|
-
const kitConfig = AVAILABLE_KITS[kitType];
|
|
36420
|
-
try {
|
|
36421
|
-
const releases = await github.listReleases(kitConfig, limit);
|
|
36422
|
-
const filteredReleases = validOptions.all ? releases : releases.filter((r2) => !r2.draft && !r2.prerelease);
|
|
36423
|
-
return {
|
|
36424
|
-
kitType,
|
|
36425
|
-
kitConfig,
|
|
36426
|
-
releases: filteredReleases,
|
|
36427
|
-
error: null
|
|
36428
|
-
};
|
|
36429
|
-
} catch (error) {
|
|
36430
|
-
return {
|
|
36431
|
-
kitType,
|
|
36432
|
-
kitConfig,
|
|
36433
|
-
releases: [],
|
|
36434
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
36435
|
-
};
|
|
36436
|
-
}
|
|
36437
|
-
});
|
|
36438
|
-
const results = await Promise.all(releasePromises);
|
|
36439
|
-
for (const result of results) {
|
|
36440
|
-
if (result.error) {
|
|
36441
|
-
console.log(`
|
|
36442
|
-
${import_picocolors17.default.bold(import_picocolors17.default.cyan(result.kitConfig.name))} - ${import_picocolors17.default.red("Error")}`);
|
|
36443
|
-
console.log(import_picocolors17.default.dim(` ${result.error}`));
|
|
36444
|
-
} else {
|
|
36445
|
-
displayKitReleases(result.kitConfig.name, result.releases);
|
|
36446
|
-
}
|
|
36447
|
-
}
|
|
36448
|
-
prompts2.outro("✨ Done");
|
|
36449
|
-
} catch (error) {
|
|
36450
|
-
logger.error(error instanceof Error ? error.message : "Unknown error occurred");
|
|
36451
|
-
process.exit(1);
|
|
36452
|
-
}
|
|
36453
|
-
}
|
|
36454
|
-
|
|
36455
|
-
// src/cli/command-registry.ts
|
|
36456
|
-
init_logger();
|
|
36457
|
-
function registerCommands(cli) {
|
|
36458
|
-
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) => {
|
|
36459
|
-
if (options.exclude && !Array.isArray(options.exclude)) {
|
|
36460
|
-
options.exclude = [options.exclude];
|
|
36461
|
-
}
|
|
36462
|
-
await newCommand(options);
|
|
36463
|
-
});
|
|
36464
|
-
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) => {
|
|
36465
|
-
if (options.exclude && !Array.isArray(options.exclude)) {
|
|
36466
|
-
options.exclude = [options.exclude];
|
|
36467
|
-
}
|
|
36468
|
-
if (options.only && !Array.isArray(options.only)) {
|
|
36469
|
-
options.only = [options.only];
|
|
36470
|
-
}
|
|
36471
|
-
await initCommand(options);
|
|
36472
|
-
});
|
|
36473
|
-
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) => {
|
|
36474
|
-
if (options.kit || options.global) {
|
|
36475
|
-
console.log();
|
|
36476
|
-
const deprecatedFlags = [options.kit && "--kit", options.global && "--global"].filter(Boolean).join(" and ");
|
|
36477
|
-
logger.warning(`The ${deprecatedFlags} option${options.kit && options.global ? "s are" : " is"} no longer supported with 'ck update'`);
|
|
36478
|
-
console.log();
|
|
36479
|
-
console.log(" 'ck update' now only updates the ClaudeKit CLI itself.");
|
|
36480
|
-
console.log();
|
|
36481
|
-
console.log(" To update a kit installation, use:");
|
|
36482
|
-
const suggestedCmd = ["ck init"];
|
|
36483
|
-
if (options.kit)
|
|
36484
|
-
suggestedCmd.push(`--kit ${options.kit}`);
|
|
36485
|
-
if (options.global)
|
|
36486
|
-
suggestedCmd.push("--global");
|
|
36487
|
-
console.log(` ${suggestedCmd.join(" ")}`);
|
|
36488
|
-
console.log();
|
|
36489
|
-
process.exit(0);
|
|
36490
|
-
}
|
|
36491
|
-
try {
|
|
36492
|
-
await updateCliCommand(options);
|
|
36493
|
-
} catch (error) {
|
|
36494
|
-
process.exit(1);
|
|
36495
|
-
}
|
|
36496
|
-
});
|
|
36497
|
-
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) => {
|
|
36498
|
-
await versionCommand(options);
|
|
36499
|
-
});
|
|
36500
|
-
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) => {
|
|
36501
|
-
await doctorCommand(options);
|
|
36502
|
-
});
|
|
36503
|
-
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) => {
|
|
36504
|
-
await uninstallCommand(options);
|
|
36505
|
-
});
|
|
36506
|
-
cli.command("easter-egg", "\uD83E\uDD5A Roll for a random discount code (Code Hunt 2025)").action(async () => {
|
|
36507
|
-
await easterEggCommand();
|
|
36508
|
-
});
|
|
36509
|
-
}
|
|
36510
|
-
|
|
36511
|
-
// src/cli/version-display.ts
|
|
36512
|
-
import { existsSync as existsSync17, readFileSync as readFileSync5 } from "node:fs";
|
|
36513
|
-
import { join as join66 } from "node:path";
|
|
36514
|
-
|
|
36515
|
-
// src/domains/versioning/checking/version-utils.ts
|
|
36516
|
-
var import_compare_versions3 = __toESM(require_umd(), 1);
|
|
36517
|
-
function isUpdateCheckDisabled() {
|
|
36518
|
-
return process.env.NO_UPDATE_NOTIFIER === "1" || process.env.NO_UPDATE_NOTIFIER === "true" || !process.stdout.isTTY;
|
|
36519
|
-
}
|
|
36520
|
-
function normalizeVersion(version) {
|
|
36521
|
-
return version.replace(/^v/, "");
|
|
36522
|
-
}
|
|
36523
|
-
function isNewerVersion(currentVersion, latestVersion) {
|
|
36524
|
-
try {
|
|
36525
|
-
const current = normalizeVersion(currentVersion);
|
|
36526
|
-
const latest = normalizeVersion(latestVersion);
|
|
36527
|
-
return import_compare_versions3.compareVersions(latest, current) > 0;
|
|
36528
|
-
} catch {
|
|
36529
|
-
return false;
|
|
36530
|
-
}
|
|
36531
|
-
}
|
|
36532
|
-
// src/domains/versioning/checking/kit-version-checker.ts
|
|
36533
|
-
init_logger();
|
|
36534
|
-
init_types2();
|
|
36535
|
-
|
|
36536
|
-
// src/domains/versioning/version-cache.ts
|
|
36537
|
-
init_logger();
|
|
36538
|
-
import { existsSync as existsSync16 } from "node:fs";
|
|
36539
|
-
import { mkdir as mkdir18, readFile as readFile20, writeFile as writeFile17 } from "node:fs/promises";
|
|
36540
|
-
import { join as join65 } from "node:path";
|
|
36541
|
-
class VersionCacheManager {
|
|
36542
|
-
static CACHE_FILENAME = "version-check.json";
|
|
36543
|
-
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
36544
|
-
static getCacheFile() {
|
|
36545
|
-
const cacheDir = PathResolver.getCacheDir(false);
|
|
36546
|
-
return join65(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
36547
|
-
}
|
|
36548
|
-
static async load() {
|
|
36549
|
-
const cacheFile = VersionCacheManager.getCacheFile();
|
|
36550
|
-
try {
|
|
36551
|
-
if (!existsSync16(cacheFile)) {
|
|
36552
|
-
logger.debug("Version check cache not found");
|
|
36553
|
-
return null;
|
|
36554
|
-
}
|
|
36555
|
-
const content = await readFile20(cacheFile, "utf-8");
|
|
36556
|
-
const cache2 = JSON.parse(content);
|
|
36557
|
-
if (!cache2.lastCheck || !cache2.currentVersion || !cache2.latestVersion) {
|
|
36558
|
-
logger.debug("Invalid cache structure, ignoring");
|
|
36559
|
-
return null;
|
|
36560
|
-
}
|
|
36561
|
-
logger.debug(`Version check cache loaded: ${JSON.stringify(cache2)}`);
|
|
36562
|
-
return cache2;
|
|
36563
|
-
} catch (error) {
|
|
36564
|
-
logger.debug(`Failed to load version check cache: ${error}`);
|
|
36565
|
-
return null;
|
|
36566
|
-
}
|
|
36567
|
-
}
|
|
36568
|
-
static async save(cache2) {
|
|
36569
|
-
const cacheFile = VersionCacheManager.getCacheFile();
|
|
36570
|
-
const cacheDir = PathResolver.getCacheDir(false);
|
|
36571
|
-
try {
|
|
36572
|
-
if (!existsSync16(cacheDir)) {
|
|
36573
|
-
await mkdir18(cacheDir, { recursive: true, mode: 448 });
|
|
36574
|
-
}
|
|
36575
|
-
await writeFile17(cacheFile, JSON.stringify(cache2, null, 2), "utf-8");
|
|
36576
|
-
logger.debug(`Version check cache saved to ${cacheFile}`);
|
|
36577
|
-
} catch (error) {
|
|
36578
|
-
logger.debug(`Failed to save version check cache: ${error}`);
|
|
36579
|
-
}
|
|
36580
|
-
}
|
|
36581
|
-
static isCacheValid(cache2) {
|
|
36582
|
-
if (!cache2)
|
|
36583
|
-
return false;
|
|
36584
|
-
const now = Date.now();
|
|
36585
|
-
const age = now - cache2.lastCheck;
|
|
36586
|
-
const isValid2 = age < VersionCacheManager.CACHE_TTL_MS;
|
|
36587
|
-
const ageDays = (age / 1000 / 60 / 60 / 24).toFixed(1);
|
|
36588
|
-
logger.debug(`Cache validity check: age=${ageDays} days, valid=${isValid2}`);
|
|
36589
|
-
return isValid2;
|
|
36590
|
-
}
|
|
36591
|
-
static async clear() {
|
|
36592
|
-
const cacheFile = VersionCacheManager.getCacheFile();
|
|
36593
|
-
try {
|
|
36594
|
-
if (existsSync16(cacheFile)) {
|
|
36595
|
-
const fs12 = await import("node:fs/promises");
|
|
36596
|
-
await fs12.unlink(cacheFile);
|
|
36597
|
-
logger.debug("Version check cache cleared");
|
|
36598
|
-
}
|
|
36599
|
-
} catch (error) {
|
|
36600
|
-
logger.debug(`Failed to clear version check cache: ${error}`);
|
|
36601
|
-
}
|
|
36808
|
+
const assetCount = release.assets.length;
|
|
36809
|
+
const badges = [];
|
|
36810
|
+
if (release.prerelease)
|
|
36811
|
+
badges.push(import_picocolors20.default.yellow("[prerelease]"));
|
|
36812
|
+
if (release.draft)
|
|
36813
|
+
badges.push(import_picocolors20.default.gray("[draft]"));
|
|
36814
|
+
const badgeStr = badges.length > 0 ? ` ${badges.join(" ")}` : "";
|
|
36815
|
+
const versionPart = version.padEnd(20);
|
|
36816
|
+
const namePart = name2.length > 40 ? `${name2.slice(0, 37)}...` : name2.padEnd(40);
|
|
36817
|
+
const timePart = import_picocolors20.default.dim(publishedAt.padEnd(20));
|
|
36818
|
+
const assetPart = import_picocolors20.default.dim(`(${assetCount} ${assetCount === 1 ? "asset" : "assets"})`);
|
|
36819
|
+
console.log(` ${versionPart} ${namePart} ${timePart} ${assetPart}${badgeStr}`);
|
|
36602
36820
|
}
|
|
36821
|
+
console.log(import_picocolors20.default.dim(`
|
|
36822
|
+
Showing ${releases.length} ${releases.length === 1 ? "release" : "releases"}`));
|
|
36603
36823
|
}
|
|
36604
|
-
|
|
36605
|
-
|
|
36606
|
-
|
|
36824
|
+
async function versionCommand(options) {
|
|
36825
|
+
const prompts2 = new PromptsManager;
|
|
36826
|
+
prompts2.intro("\uD83D\uDCE6 ClaudeKit - Available Versions");
|
|
36607
36827
|
try {
|
|
36608
|
-
const
|
|
36609
|
-
const
|
|
36610
|
-
const
|
|
36611
|
-
const
|
|
36612
|
-
const
|
|
36613
|
-
|
|
36614
|
-
|
|
36615
|
-
|
|
36616
|
-
|
|
36617
|
-
|
|
36618
|
-
|
|
36619
|
-
|
|
36620
|
-
|
|
36621
|
-
|
|
36622
|
-
|
|
36828
|
+
const validOptions = VersionCommandOptionsSchema.parse(options);
|
|
36829
|
+
const kitsToFetch = validOptions.kit ? [validOptions.kit] : Object.keys(AVAILABLE_KITS);
|
|
36830
|
+
const github = new GitHubClient;
|
|
36831
|
+
const limit = validOptions.limit || 30;
|
|
36832
|
+
const releasePromises = kitsToFetch.map(async (kitType) => {
|
|
36833
|
+
const kitConfig = AVAILABLE_KITS[kitType];
|
|
36834
|
+
try {
|
|
36835
|
+
const releases = await github.listReleases(kitConfig, limit);
|
|
36836
|
+
const filteredReleases = validOptions.all ? releases : releases.filter((r2) => !r2.draft && !r2.prerelease);
|
|
36837
|
+
return {
|
|
36838
|
+
kitType,
|
|
36839
|
+
kitConfig,
|
|
36840
|
+
releases: filteredReleases,
|
|
36841
|
+
error: null
|
|
36842
|
+
};
|
|
36843
|
+
} catch (error) {
|
|
36844
|
+
return {
|
|
36845
|
+
kitType,
|
|
36846
|
+
kitConfig,
|
|
36847
|
+
releases: [],
|
|
36848
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
36849
|
+
};
|
|
36850
|
+
}
|
|
36851
|
+
});
|
|
36852
|
+
const results = await Promise.all(releasePromises);
|
|
36853
|
+
for (const result of results) {
|
|
36854
|
+
if (result.error) {
|
|
36855
|
+
console.log(`
|
|
36856
|
+
${import_picocolors20.default.bold(import_picocolors20.default.cyan(result.kitConfig.name))} - ${import_picocolors20.default.red("Error")}`);
|
|
36857
|
+
console.log(import_picocolors20.default.dim(` ${result.error}`));
|
|
36858
|
+
} else {
|
|
36859
|
+
displayKitReleases(result.kitConfig.name, result.releases);
|
|
36860
|
+
}
|
|
36861
|
+
}
|
|
36862
|
+
prompts2.outro("✨ Done");
|
|
36623
36863
|
} catch (error) {
|
|
36624
|
-
logger.
|
|
36625
|
-
|
|
36864
|
+
logger.error(error instanceof Error ? error.message : "Unknown error occurred");
|
|
36865
|
+
process.exit(1);
|
|
36626
36866
|
}
|
|
36627
36867
|
}
|
|
36628
36868
|
|
|
36629
|
-
|
|
36630
|
-
|
|
36631
|
-
|
|
36632
|
-
|
|
36633
|
-
|
|
36869
|
+
// src/cli/command-registry.ts
|
|
36870
|
+
init_logger();
|
|
36871
|
+
function registerCommands(cli) {
|
|
36872
|
+
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) => {
|
|
36873
|
+
if (options.exclude && !Array.isArray(options.exclude)) {
|
|
36874
|
+
options.exclude = [options.exclude];
|
|
36634
36875
|
}
|
|
36635
|
-
|
|
36636
|
-
|
|
36637
|
-
|
|
36638
|
-
|
|
36639
|
-
|
|
36640
|
-
latestVersion: cache2.latestVersion,
|
|
36641
|
-
updateAvailable: cache2.updateAvailable,
|
|
36642
|
-
releaseUrl: cache2.latestUrl
|
|
36643
|
-
};
|
|
36876
|
+
await newCommand(options);
|
|
36877
|
+
});
|
|
36878
|
+
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) => {
|
|
36879
|
+
if (options.exclude && !Array.isArray(options.exclude)) {
|
|
36880
|
+
options.exclude = [options.exclude];
|
|
36644
36881
|
}
|
|
36645
|
-
|
|
36646
|
-
|
|
36647
|
-
if (result) {
|
|
36648
|
-
await VersionCacheManager.save({
|
|
36649
|
-
lastCheck: Date.now(),
|
|
36650
|
-
currentVersion: result.currentVersion,
|
|
36651
|
-
latestVersion: result.latestVersion,
|
|
36652
|
-
latestUrl: result.releaseUrl,
|
|
36653
|
-
updateAvailable: result.updateAvailable
|
|
36654
|
-
});
|
|
36882
|
+
if (options.only && !Array.isArray(options.only)) {
|
|
36883
|
+
options.only = [options.only];
|
|
36655
36884
|
}
|
|
36656
|
-
|
|
36657
|
-
}
|
|
36658
|
-
|
|
36659
|
-
|
|
36660
|
-
|
|
36661
|
-
|
|
36662
|
-
|
|
36663
|
-
|
|
36664
|
-
|
|
36665
|
-
|
|
36666
|
-
|
|
36667
|
-
|
|
36668
|
-
|
|
36885
|
+
await initCommand(options);
|
|
36886
|
+
});
|
|
36887
|
+
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) => {
|
|
36888
|
+
if (options.kit || options.global) {
|
|
36889
|
+
console.log();
|
|
36890
|
+
const deprecatedFlags = [options.kit && "--kit", options.global && "--global"].filter(Boolean).join(" and ");
|
|
36891
|
+
logger.warning(`The ${deprecatedFlags} option${options.kit && options.global ? "s are" : " is"} no longer supported with 'ck update'`);
|
|
36892
|
+
console.log();
|
|
36893
|
+
console.log(" 'ck update' now only updates the ClaudeKit CLI itself.");
|
|
36894
|
+
console.log();
|
|
36895
|
+
console.log(" To update a kit installation, use:");
|
|
36896
|
+
const suggestedCmd = ["ck init"];
|
|
36897
|
+
if (options.kit)
|
|
36898
|
+
suggestedCmd.push(`--kit ${options.kit}`);
|
|
36899
|
+
if (options.global)
|
|
36900
|
+
suggestedCmd.push("--global");
|
|
36901
|
+
console.log(` ${suggestedCmd.join(" ")}`);
|
|
36902
|
+
console.log();
|
|
36903
|
+
process.exit(0);
|
|
36669
36904
|
}
|
|
36670
36905
|
try {
|
|
36671
|
-
|
|
36672
|
-
if (!latestVersion) {
|
|
36673
|
-
logger.debug("Failed to fetch latest CLI version from npm");
|
|
36674
|
-
return null;
|
|
36675
|
-
}
|
|
36676
|
-
const current = normalizeVersion(currentVersion);
|
|
36677
|
-
const latest = normalizeVersion(latestVersion);
|
|
36678
|
-
const updateAvailable = import_compare_versions4.compareVersions(latest, current) > 0;
|
|
36679
|
-
logger.debug(`CLI version check: current=${current}, latest=${latest}, updateAvailable=${updateAvailable}`);
|
|
36680
|
-
return {
|
|
36681
|
-
currentVersion: current,
|
|
36682
|
-
latestVersion: latest,
|
|
36683
|
-
updateAvailable,
|
|
36684
|
-
releaseUrl: `https://www.npmjs.com/package/${PACKAGE_NAME2}`
|
|
36685
|
-
};
|
|
36906
|
+
await updateCliCommand(options);
|
|
36686
36907
|
} catch (error) {
|
|
36687
|
-
|
|
36688
|
-
return null;
|
|
36908
|
+
process.exit(1);
|
|
36689
36909
|
}
|
|
36690
|
-
}
|
|
36691
|
-
|
|
36692
|
-
|
|
36693
|
-
|
|
36694
|
-
|
|
36695
|
-
|
|
36696
|
-
|
|
36697
|
-
|
|
36698
|
-
|
|
36699
|
-
|
|
36700
|
-
|
|
36701
|
-
|
|
36702
|
-
|
|
36703
|
-
const totalPadding = contentWidth - actualLen;
|
|
36704
|
-
const leftPadding = Math.max(0, Math.floor(totalPadding / 2));
|
|
36705
|
-
const rightPadding = Math.max(0, totalPadding - leftPadding);
|
|
36706
|
-
return borderColor("│") + " ".repeat(leftPadding) + displayText + " ".repeat(rightPadding) + borderColor("│");
|
|
36707
|
-
};
|
|
36708
|
-
return { topBorder, bottomBorder, emptyLine, padLine };
|
|
36709
|
-
}
|
|
36710
|
-
function displayKitNotification(result, options = {}) {
|
|
36711
|
-
if (!result.updateAvailable)
|
|
36712
|
-
return;
|
|
36713
|
-
const { currentVersion, latestVersion } = result;
|
|
36714
|
-
const { isGlobal = false } = options;
|
|
36715
|
-
const displayCurrent = normalizeVersion(currentVersion);
|
|
36716
|
-
const displayLatest = normalizeVersion(latestVersion);
|
|
36717
|
-
const boxWidth = 52;
|
|
36718
|
-
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.cyan, boxWidth);
|
|
36719
|
-
const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ Kit Update Available"));
|
|
36720
|
-
const headerLen = "⬆ Kit Update Available".length;
|
|
36721
|
-
const versionText = `${import_picocolors18.default.dim(displayCurrent)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(displayLatest))}`;
|
|
36722
|
-
const versionLen = displayCurrent.length + 3 + displayLatest.length;
|
|
36723
|
-
const updateCmd = isGlobal ? "ck init -g" : "ck init";
|
|
36724
|
-
const commandText = `Run: ${import_picocolors18.default.cyan(import_picocolors18.default.bold(updateCmd))}`;
|
|
36725
|
-
const commandLen = `Run: ${updateCmd}`.length;
|
|
36726
|
-
console.log("");
|
|
36727
|
-
console.log(topBorder);
|
|
36728
|
-
console.log(emptyLine);
|
|
36729
|
-
console.log(padLine(headerText, headerLen));
|
|
36730
|
-
console.log(padLine(versionText, versionLen));
|
|
36731
|
-
console.log(emptyLine);
|
|
36732
|
-
console.log(padLine(commandText, commandLen));
|
|
36733
|
-
console.log(emptyLine);
|
|
36734
|
-
console.log(bottomBorder);
|
|
36735
|
-
console.log("");
|
|
36736
|
-
}
|
|
36737
|
-
function displayCliNotification(result) {
|
|
36738
|
-
if (!result.updateAvailable)
|
|
36739
|
-
return;
|
|
36740
|
-
const { currentVersion, latestVersion } = result;
|
|
36741
|
-
const boxWidth = 52;
|
|
36742
|
-
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox(import_picocolors18.default.magenta, boxWidth);
|
|
36743
|
-
const headerText = import_picocolors18.default.bold(import_picocolors18.default.yellow("⬆ CLI Update Available"));
|
|
36744
|
-
const headerLen = "⬆ CLI Update Available".length;
|
|
36745
|
-
const versionText = `${import_picocolors18.default.dim(currentVersion)} ${import_picocolors18.default.white("→")} ${import_picocolors18.default.green(import_picocolors18.default.bold(latestVersion))}`;
|
|
36746
|
-
const versionLen = currentVersion.length + 3 + latestVersion.length;
|
|
36747
|
-
const commandText = `Run: ${import_picocolors18.default.magenta(import_picocolors18.default.bold("ck update"))}`;
|
|
36748
|
-
const commandLen = "Run: ck update".length;
|
|
36749
|
-
console.log("");
|
|
36750
|
-
console.log(topBorder);
|
|
36751
|
-
console.log(emptyLine);
|
|
36752
|
-
console.log(padLine(headerText, headerLen));
|
|
36753
|
-
console.log(padLine(versionText, versionLen));
|
|
36754
|
-
console.log(emptyLine);
|
|
36755
|
-
console.log(padLine(commandText, commandLen));
|
|
36756
|
-
console.log(emptyLine);
|
|
36757
|
-
console.log(bottomBorder);
|
|
36758
|
-
console.log("");
|
|
36759
|
-
}
|
|
36760
|
-
// src/domains/versioning/version-checker.ts
|
|
36761
|
-
class VersionChecker2 {
|
|
36762
|
-
static async check(currentVersion) {
|
|
36763
|
-
return VersionChecker.check(currentVersion);
|
|
36764
|
-
}
|
|
36765
|
-
static displayNotification(result, options = {}) {
|
|
36766
|
-
displayKitNotification(result, options);
|
|
36767
|
-
}
|
|
36768
|
-
}
|
|
36769
|
-
|
|
36770
|
-
class CliVersionChecker2 {
|
|
36771
|
-
static async check(currentVersion) {
|
|
36772
|
-
return CliVersionChecker.check(currentVersion);
|
|
36773
|
-
}
|
|
36774
|
-
static displayNotification(result) {
|
|
36775
|
-
displayCliNotification(result);
|
|
36776
|
-
}
|
|
36910
|
+
});
|
|
36911
|
+
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) => {
|
|
36912
|
+
await versionCommand(options);
|
|
36913
|
+
});
|
|
36914
|
+
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) => {
|
|
36915
|
+
await doctorCommand(options);
|
|
36916
|
+
});
|
|
36917
|
+
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) => {
|
|
36918
|
+
await uninstallCommand(options);
|
|
36919
|
+
});
|
|
36920
|
+
cli.command("easter-egg", "\uD83E\uDD5A Roll for a random discount code (Code Hunt 2025)").action(async () => {
|
|
36921
|
+
await easterEggCommand();
|
|
36922
|
+
});
|
|
36777
36923
|
}
|
|
36778
36924
|
|
|
36779
36925
|
// src/cli/version-display.ts
|
|
36926
|
+
import { existsSync as existsSync17, readFileSync as readFileSync5 } from "node:fs";
|
|
36927
|
+
import { join as join66 } from "node:path";
|
|
36780
36928
|
init_logger();
|
|
36781
36929
|
init_types2();
|
|
36782
36930
|
var packageVersion = package_default.version;
|
|
@@ -36823,6 +36971,8 @@ async function displayVersion() {
|
|
|
36823
36971
|
}
|
|
36824
36972
|
if (!foundAnyKit) {
|
|
36825
36973
|
console.log("No ClaudeKit installation found");
|
|
36974
|
+
console.log(`
|
|
36975
|
+
To get started: ck new (local project) or ck init -g (global)`);
|
|
36826
36976
|
}
|
|
36827
36977
|
try {
|
|
36828
36978
|
const cliUpdateCheck = await CliVersionChecker2.check(packageVersion);
|
|
@@ -36849,7 +36999,7 @@ function getPackageVersion2() {
|
|
|
36849
36999
|
|
|
36850
37000
|
// src/shared/logger.ts
|
|
36851
37001
|
init_output_manager();
|
|
36852
|
-
var
|
|
37002
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
36853
37003
|
import { createWriteStream as createWriteStream3 } from "node:fs";
|
|
36854
37004
|
|
|
36855
37005
|
class Logger2 {
|
|
@@ -36858,23 +37008,23 @@ class Logger2 {
|
|
|
36858
37008
|
exitHandlerRegistered = false;
|
|
36859
37009
|
info(message) {
|
|
36860
37010
|
const symbols = output.getSymbols();
|
|
36861
|
-
console.log(
|
|
37011
|
+
console.log(import_picocolors21.default.blue(symbols.info), message);
|
|
36862
37012
|
}
|
|
36863
37013
|
success(message) {
|
|
36864
37014
|
const symbols = output.getSymbols();
|
|
36865
|
-
console.log(
|
|
37015
|
+
console.log(import_picocolors21.default.green(symbols.success), message);
|
|
36866
37016
|
}
|
|
36867
37017
|
warning(message) {
|
|
36868
37018
|
const symbols = output.getSymbols();
|
|
36869
|
-
console.log(
|
|
37019
|
+
console.log(import_picocolors21.default.yellow(symbols.warning), message);
|
|
36870
37020
|
}
|
|
36871
37021
|
error(message) {
|
|
36872
37022
|
const symbols = output.getSymbols();
|
|
36873
|
-
console.error(
|
|
37023
|
+
console.error(import_picocolors21.default.red(symbols.error), message);
|
|
36874
37024
|
}
|
|
36875
37025
|
debug(message) {
|
|
36876
37026
|
if (process.env.DEBUG) {
|
|
36877
|
-
console.log(
|
|
37027
|
+
console.log(import_picocolors21.default.gray("[DEBUG]"), message);
|
|
36878
37028
|
}
|
|
36879
37029
|
}
|
|
36880
37030
|
verbose(message, context) {
|
|
@@ -36883,7 +37033,7 @@ class Logger2 {
|
|
|
36883
37033
|
const timestamp = this.getTimestamp();
|
|
36884
37034
|
const sanitizedMessage = this.sanitize(message);
|
|
36885
37035
|
const formattedContext = context ? this.formatContext(context) : "";
|
|
36886
|
-
const logLine = `${timestamp} ${
|
|
37036
|
+
const logLine = `${timestamp} ${import_picocolors21.default.gray("[VERBOSE]")} ${sanitizedMessage}${formattedContext}`;
|
|
36887
37037
|
console.error(logLine);
|
|
36888
37038
|
if (this.logFileStream) {
|
|
36889
37039
|
const plainLogLine = `${timestamp} [VERBOSE] ${sanitizedMessage}${formattedContext}`;
|
|
@@ -36986,7 +37136,7 @@ var logger3 = new Logger2;
|
|
|
36986
37136
|
|
|
36987
37137
|
// src/shared/output-manager.ts
|
|
36988
37138
|
init_terminal_utils();
|
|
36989
|
-
var
|
|
37139
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
36990
37140
|
var SYMBOLS2 = {
|
|
36991
37141
|
unicode: {
|
|
36992
37142
|
prompt: "◇",
|
|
@@ -37065,7 +37215,7 @@ class OutputManager2 {
|
|
|
37065
37215
|
if (this.config.quiet)
|
|
37066
37216
|
return;
|
|
37067
37217
|
const symbol = this.getSymbols().success;
|
|
37068
|
-
console.log(
|
|
37218
|
+
console.log(import_picocolors22.default.green(`${symbol} ${message}`));
|
|
37069
37219
|
}
|
|
37070
37220
|
error(message, data) {
|
|
37071
37221
|
if (this.config.json) {
|
|
@@ -37073,7 +37223,7 @@ class OutputManager2 {
|
|
|
37073
37223
|
return;
|
|
37074
37224
|
}
|
|
37075
37225
|
const symbol = this.getSymbols().error;
|
|
37076
|
-
console.error(
|
|
37226
|
+
console.error(import_picocolors22.default.red(`${symbol} ${message}`));
|
|
37077
37227
|
}
|
|
37078
37228
|
warning(message, data) {
|
|
37079
37229
|
if (this.config.json) {
|
|
@@ -37083,7 +37233,7 @@ class OutputManager2 {
|
|
|
37083
37233
|
if (this.config.quiet)
|
|
37084
37234
|
return;
|
|
37085
37235
|
const symbol = this.getSymbols().warning;
|
|
37086
|
-
console.log(
|
|
37236
|
+
console.log(import_picocolors22.default.yellow(`${symbol} ${message}`));
|
|
37087
37237
|
}
|
|
37088
37238
|
info(message, data) {
|
|
37089
37239
|
if (this.config.json) {
|
|
@@ -37093,7 +37243,7 @@ class OutputManager2 {
|
|
|
37093
37243
|
if (this.config.quiet)
|
|
37094
37244
|
return;
|
|
37095
37245
|
const symbol = this.getSymbols().info;
|
|
37096
|
-
console.log(
|
|
37246
|
+
console.log(import_picocolors22.default.blue(`${symbol} ${message}`));
|
|
37097
37247
|
}
|
|
37098
37248
|
verbose(message, data) {
|
|
37099
37249
|
if (!this.config.verbose)
|
|
@@ -37102,7 +37252,7 @@ class OutputManager2 {
|
|
|
37102
37252
|
this.addJsonEntry({ type: "info", message, data });
|
|
37103
37253
|
return;
|
|
37104
37254
|
}
|
|
37105
|
-
console.log(
|
|
37255
|
+
console.log(import_picocolors22.default.dim(` ${message}`));
|
|
37106
37256
|
}
|
|
37107
37257
|
indent(message) {
|
|
37108
37258
|
if (this.config.json)
|
|
@@ -37127,7 +37277,7 @@ class OutputManager2 {
|
|
|
37127
37277
|
return;
|
|
37128
37278
|
const symbols = this.getSymbols();
|
|
37129
37279
|
console.log();
|
|
37130
|
-
console.log(
|
|
37280
|
+
console.log(import_picocolors22.default.bold(import_picocolors22.default.cyan(`${symbols.line} ${title}`)));
|
|
37131
37281
|
}
|
|
37132
37282
|
addJsonEntry(entry) {
|
|
37133
37283
|
this.jsonBuffer.push({
|