claudekit-cli 3.35.0-dev.27 → 3.35.0-dev.29
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 +122 -61
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53303,32 +53303,44 @@ var init_pnpm_detector = __esm(() => {
|
|
|
53303
53303
|
import { existsSync as existsSync29, realpathSync } from "node:fs";
|
|
53304
53304
|
import { chmod as chmod2, mkdir as mkdir11, readFile as readFile22, writeFile as writeFile12 } from "node:fs/promises";
|
|
53305
53305
|
import { platform as platform4 } from "node:os";
|
|
53306
|
-
import { join as join34
|
|
53306
|
+
import { join as join34 } from "node:path";
|
|
53307
53307
|
function detectFromBinaryPath() {
|
|
53308
|
-
|
|
53309
|
-
|
|
53310
|
-
if (
|
|
53311
|
-
return "unknown";
|
|
53312
|
-
let resolvedPath;
|
|
53313
|
-
try {
|
|
53314
|
-
resolvedPath = realpathSync(scriptPath);
|
|
53315
|
-
} catch {
|
|
53316
|
-
resolvedPath = scriptPath;
|
|
53317
|
-
}
|
|
53318
|
-
const normalized = resolvedPath.split(sep3).join("/").toLowerCase();
|
|
53319
|
-
logger.verbose(`Binary path resolved: ${normalized}`);
|
|
53320
|
-
if (normalized.includes("/.bun/install/") || normalized.includes("/bun/install/global/")) {
|
|
53308
|
+
const normalizePath2 = (pathValue) => pathValue.replace(/\\/g, "/").toLowerCase();
|
|
53309
|
+
const detectFromNormalizedPath = (normalized) => {
|
|
53310
|
+
if (normalized.includes("/.bun/install/") || normalized.includes("/bun/install/global/") || normalized.includes("/.bun/bin/")) {
|
|
53321
53311
|
return "bun";
|
|
53322
53312
|
}
|
|
53323
|
-
if (normalized.includes("/pnpm/global/") || normalized.includes("/.local/share/pnpm/")) {
|
|
53313
|
+
if (normalized.includes("/pnpm/global/") || normalized.includes("/.local/share/pnpm/") || normalized.includes("/appdata/local/pnpm/")) {
|
|
53324
53314
|
return "pnpm";
|
|
53325
53315
|
}
|
|
53326
|
-
if (normalized.includes("/yarn/global/") || normalized.includes("/.config/yarn/")) {
|
|
53316
|
+
if (normalized.includes("/yarn/global/") || normalized.includes("/.config/yarn/") || normalized.includes("/appdata/local/yarn/data/global/")) {
|
|
53327
53317
|
return "yarn";
|
|
53328
53318
|
}
|
|
53329
|
-
if (normalized.includes("/npm/node_modules/") || normalized.includes("/usr/local/lib/node_modules/") || normalized.includes("/usr/lib/node_modules/") || normalized.includes("/opt/homebrew/lib/node_modules/") || normalized.includes("/.nvm/versions/node/") || normalized.includes("/n/versions/node/") || normalized.includes("/appdata/roaming/npm/")) {
|
|
53319
|
+
if (normalized.includes("/npm/node_modules/") || normalized.includes("/usr/local/lib/node_modules/") || normalized.includes("/usr/lib/node_modules/") || normalized.includes("/opt/homebrew/lib/node_modules/") || normalized.includes("/.nvm/versions/node/") || normalized.includes("/n/versions/node/") || normalized.includes("/appdata/roaming/npm/") || normalized.includes("/appdata/roaming/nvm/")) {
|
|
53330
53320
|
return "npm";
|
|
53331
53321
|
}
|
|
53322
|
+
if (normalized.includes("/node_modules/claudekit-cli/")) {
|
|
53323
|
+
return "npm";
|
|
53324
|
+
}
|
|
53325
|
+
return "unknown";
|
|
53326
|
+
};
|
|
53327
|
+
try {
|
|
53328
|
+
const execPathCandidate = typeof process.execPath === "string" && /(?:^|[\\/])ck(?:[-.].+)?(?:\.exe)?$/i.test(process.execPath) ? process.execPath : undefined;
|
|
53329
|
+
const pathCandidates = [process.argv[1], execPathCandidate].filter((candidate) => typeof candidate === "string" && candidate.trim().length > 0);
|
|
53330
|
+
for (const candidate of pathCandidates) {
|
|
53331
|
+
let resolvedPath;
|
|
53332
|
+
try {
|
|
53333
|
+
resolvedPath = realpathSync(candidate);
|
|
53334
|
+
} catch {
|
|
53335
|
+
resolvedPath = candidate;
|
|
53336
|
+
}
|
|
53337
|
+
const normalized = normalizePath2(resolvedPath);
|
|
53338
|
+
logger.verbose(`Binary path candidate resolved: ${normalized}`);
|
|
53339
|
+
const detectedPm = detectFromNormalizedPath(normalized);
|
|
53340
|
+
if (detectedPm !== "unknown") {
|
|
53341
|
+
return detectedPm;
|
|
53342
|
+
}
|
|
53343
|
+
}
|
|
53332
53344
|
} catch {}
|
|
53333
53345
|
return "unknown";
|
|
53334
53346
|
}
|
|
@@ -54013,7 +54025,7 @@ var package_default;
|
|
|
54013
54025
|
var init_package = __esm(() => {
|
|
54014
54026
|
package_default = {
|
|
54015
54027
|
name: "claudekit-cli",
|
|
54016
|
-
version: "3.35.0-dev.
|
|
54028
|
+
version: "3.35.0-dev.29",
|
|
54017
54029
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
54018
54030
|
type: "module",
|
|
54019
54031
|
repository: {
|
|
@@ -54124,6 +54136,24 @@ var init_package = __esm(() => {
|
|
|
54124
54136
|
import { exec as exec2 } from "node:child_process";
|
|
54125
54137
|
import { join as join37 } from "node:path";
|
|
54126
54138
|
import { promisify as promisify8 } from "node:util";
|
|
54139
|
+
function getDefaultUpdateCliCommandDeps() {
|
|
54140
|
+
return {
|
|
54141
|
+
currentVersion: package_default.version,
|
|
54142
|
+
execAsyncFn: execAsync2,
|
|
54143
|
+
packageManagerDetector: PackageManagerDetector,
|
|
54144
|
+
npmRegistryClient: NpmRegistryClient,
|
|
54145
|
+
promptKitUpdateFn: promptKitUpdate
|
|
54146
|
+
};
|
|
54147
|
+
}
|
|
54148
|
+
function extractCommandStdout(result) {
|
|
54149
|
+
if (typeof result === "string") {
|
|
54150
|
+
return result;
|
|
54151
|
+
}
|
|
54152
|
+
if (result && typeof result.stdout === "string") {
|
|
54153
|
+
return result.stdout;
|
|
54154
|
+
}
|
|
54155
|
+
return "";
|
|
54156
|
+
}
|
|
54127
54157
|
function redactCommandForLog(command) {
|
|
54128
54158
|
if (!command)
|
|
54129
54159
|
return command;
|
|
@@ -54146,6 +54176,12 @@ function isBetaVersion(version) {
|
|
|
54146
54176
|
return false;
|
|
54147
54177
|
return /-(beta|alpha|rc|dev)[.\d]/i.test(version);
|
|
54148
54178
|
}
|
|
54179
|
+
function parseCliVersionFromOutput(output2) {
|
|
54180
|
+
if (!output2)
|
|
54181
|
+
return null;
|
|
54182
|
+
const match = output2.match(/CLI Version:\s*(\S+)/);
|
|
54183
|
+
return match ? match[1] : null;
|
|
54184
|
+
}
|
|
54149
54185
|
function selectKitForUpdate(params) {
|
|
54150
54186
|
const { hasLocal, hasGlobal, localKits, globalKits } = params;
|
|
54151
54187
|
const hasLocalKit = localKits.length > 0 || hasLocal;
|
|
@@ -54247,21 +54283,27 @@ async function promptKitUpdate(beta, yes) {
|
|
|
54247
54283
|
logger.verbose(`Failed to prompt for kit update: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
54248
54284
|
}
|
|
54249
54285
|
}
|
|
54250
|
-
async function updateCliCommand(options2) {
|
|
54286
|
+
async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps()) {
|
|
54251
54287
|
const s = de();
|
|
54252
54288
|
intro("[>] ClaudeKit CLI - Update");
|
|
54253
54289
|
try {
|
|
54290
|
+
const {
|
|
54291
|
+
currentVersion,
|
|
54292
|
+
execAsyncFn,
|
|
54293
|
+
packageManagerDetector,
|
|
54294
|
+
npmRegistryClient,
|
|
54295
|
+
promptKitUpdateFn
|
|
54296
|
+
} = deps;
|
|
54254
54297
|
const opts = UpdateCliOptionsSchema.parse(options2);
|
|
54255
|
-
const currentVersion = package_default.version;
|
|
54256
54298
|
logger.info(`Current CLI version: ${currentVersion}`);
|
|
54257
54299
|
s.start("Detecting package manager...");
|
|
54258
|
-
const pm = await
|
|
54259
|
-
const pmVersion = await
|
|
54260
|
-
s.stop(`Using ${
|
|
54300
|
+
const pm = await packageManagerDetector.detect();
|
|
54301
|
+
const pmVersion = await packageManagerDetector.getVersion(pm);
|
|
54302
|
+
s.stop(`Using ${packageManagerDetector.getDisplayName(pm)}${pmVersion ? ` v${pmVersion}` : ""}`);
|
|
54261
54303
|
logger.verbose(`Detected package manager: ${pm}`);
|
|
54262
54304
|
let registryUrl = opts.registry;
|
|
54263
54305
|
if (!registryUrl && pm === "npm") {
|
|
54264
|
-
const userRegistry = await
|
|
54306
|
+
const userRegistry = await packageManagerDetector.getNpmRegistryUrl();
|
|
54265
54307
|
if (userRegistry) {
|
|
54266
54308
|
registryUrl = userRegistry;
|
|
54267
54309
|
logger.verbose(`Using npm configured registry: ${redactRegistryUrlForLog(registryUrl)}`);
|
|
@@ -54271,7 +54313,7 @@ async function updateCliCommand(options2) {
|
|
|
54271
54313
|
let targetVersion = null;
|
|
54272
54314
|
if (opts.release && opts.release !== "latest") {
|
|
54273
54315
|
try {
|
|
54274
|
-
const exists = await
|
|
54316
|
+
const exists = await npmRegistryClient.versionExists(CLAUDEKIT_CLI_NPM_PACKAGE_NAME, opts.release, registryUrl);
|
|
54275
54317
|
if (!exists) {
|
|
54276
54318
|
s.stop("Version not found");
|
|
54277
54319
|
throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run 'ck versions' to see available versions.`);
|
|
@@ -54289,25 +54331,25 @@ async function updateCliCommand(options2) {
|
|
|
54289
54331
|
targetVersion = opts.release;
|
|
54290
54332
|
s.stop(`Target version: ${targetVersion}`);
|
|
54291
54333
|
} else if (opts.dev || opts.beta) {
|
|
54292
|
-
targetVersion = await
|
|
54334
|
+
targetVersion = await npmRegistryClient.getDevVersion(CLAUDEKIT_CLI_NPM_PACKAGE_NAME, registryUrl);
|
|
54293
54335
|
if (!targetVersion) {
|
|
54294
54336
|
s.stop("No dev version available");
|
|
54295
54337
|
logger.warning("No dev version found. Using latest stable version instead.");
|
|
54296
|
-
targetVersion = await
|
|
54338
|
+
targetVersion = await npmRegistryClient.getLatestVersion(CLAUDEKIT_CLI_NPM_PACKAGE_NAME, registryUrl);
|
|
54297
54339
|
} else {
|
|
54298
54340
|
s.stop(`Latest dev version: ${targetVersion}`);
|
|
54299
54341
|
}
|
|
54300
54342
|
} else {
|
|
54301
|
-
targetVersion = await
|
|
54343
|
+
targetVersion = await npmRegistryClient.getLatestVersion(CLAUDEKIT_CLI_NPM_PACKAGE_NAME, registryUrl);
|
|
54302
54344
|
s.stop(`Latest version: ${targetVersion || "unknown"}`);
|
|
54303
54345
|
}
|
|
54304
54346
|
if (!targetVersion) {
|
|
54305
|
-
throw new CliUpdateError(`Failed to fetch version information from npm registry. Check your internet connection and try again. Manual update: ${
|
|
54347
|
+
throw new CliUpdateError(`Failed to fetch version information from npm registry. Check your internet connection and try again. Manual update: ${packageManagerDetector.getUpdateCommand(pm, CLAUDEKIT_CLI_NPM_PACKAGE_NAME, undefined, registryUrl)}`);
|
|
54306
54348
|
}
|
|
54307
54349
|
const comparison = import_compare_versions.compareVersions(currentVersion, targetVersion);
|
|
54308
54350
|
if (comparison === 0) {
|
|
54309
54351
|
outro(`[+] Already on the latest CLI version (${currentVersion})`);
|
|
54310
|
-
await
|
|
54352
|
+
await promptKitUpdateFn(opts.dev || opts.beta, opts.yes);
|
|
54311
54353
|
return;
|
|
54312
54354
|
}
|
|
54313
54355
|
const isDevChannelSwitch = (opts.dev || opts.beta) && isBetaVersion(targetVersion) && !isBetaVersion(currentVersion);
|
|
@@ -54322,7 +54364,7 @@ async function updateCliCommand(options2) {
|
|
|
54322
54364
|
note(`CLI update available: ${currentVersion} -> ${targetVersion}
|
|
54323
54365
|
|
|
54324
54366
|
Run 'ck update' to install`, "Update Check");
|
|
54325
|
-
await
|
|
54367
|
+
await promptKitUpdateFn(opts.dev || opts.beta, opts.yes);
|
|
54326
54368
|
outro("Check complete");
|
|
54327
54369
|
return;
|
|
54328
54370
|
}
|
|
@@ -54335,21 +54377,13 @@ Run 'ck update' to install`, "Update Check");
|
|
|
54335
54377
|
return;
|
|
54336
54378
|
}
|
|
54337
54379
|
}
|
|
54338
|
-
const updateCmd =
|
|
54380
|
+
const updateCmd = packageManagerDetector.getUpdateCommand(pm, CLAUDEKIT_CLI_NPM_PACKAGE_NAME, targetVersion, registryUrl);
|
|
54339
54381
|
logger.info(`Running: ${redactCommandForLog(updateCmd)}`);
|
|
54340
54382
|
s.start("Updating CLI...");
|
|
54341
54383
|
try {
|
|
54342
|
-
await
|
|
54384
|
+
await execAsyncFn(updateCmd, {
|
|
54343
54385
|
timeout: 120000
|
|
54344
54386
|
});
|
|
54345
|
-
try {
|
|
54346
|
-
const verifyResult = await execAsync2("ck --version", { timeout: 5000 });
|
|
54347
|
-
if (!verifyResult.stdout.includes(targetVersion)) {
|
|
54348
|
-
throw new CliUpdateError("Version verification failed after update");
|
|
54349
|
-
}
|
|
54350
|
-
} catch (verifyError) {
|
|
54351
|
-
logger.warning("Could not verify installation automatically");
|
|
54352
|
-
}
|
|
54353
54387
|
s.stop("Update completed");
|
|
54354
54388
|
} catch (error) {
|
|
54355
54389
|
s.stop("Update failed");
|
|
@@ -54370,16 +54404,44 @@ Manual update: ${updateCmd}`);
|
|
|
54370
54404
|
}
|
|
54371
54405
|
s.start("Verifying installation...");
|
|
54372
54406
|
try {
|
|
54373
|
-
const
|
|
54374
|
-
const
|
|
54375
|
-
const
|
|
54376
|
-
|
|
54377
|
-
|
|
54378
|
-
|
|
54379
|
-
|
|
54380
|
-
|
|
54381
|
-
|
|
54382
|
-
|
|
54407
|
+
const versionResult = await execAsyncFn("ck --version", { timeout: 5000 });
|
|
54408
|
+
const stdout = extractCommandStdout(versionResult);
|
|
54409
|
+
const activeVersion = parseCliVersionFromOutput(stdout);
|
|
54410
|
+
if (!activeVersion) {
|
|
54411
|
+
s.stop("Verification failed");
|
|
54412
|
+
const message = `Update completed but could not parse 'ck --version' output.
|
|
54413
|
+
Please restart your terminal and run 'ck --version'. Expected: ${targetVersion}
|
|
54414
|
+
|
|
54415
|
+
Manual update: ${redactCommandForLog(updateCmd)}`;
|
|
54416
|
+
logger.error(message);
|
|
54417
|
+
throw new CliUpdateError(message);
|
|
54418
|
+
}
|
|
54419
|
+
s.stop(`Installed version: ${activeVersion}`);
|
|
54420
|
+
if (activeVersion !== targetVersion) {
|
|
54421
|
+
const mismatchMessage = `Update did not activate the requested version.
|
|
54422
|
+
Expected: ${targetVersion}
|
|
54423
|
+
Active ck: ${activeVersion}
|
|
54424
|
+
|
|
54425
|
+
Likely causes: multiple global installations (npm/bun/pnpm/yarn) or stale shell shim/cache (common on Windows).
|
|
54426
|
+
Run '${redactCommandForLog(updateCmd)}' manually, restart terminal, then check command resolution:
|
|
54427
|
+
- Windows: where ck
|
|
54428
|
+
- macOS/Linux: which -a ck`;
|
|
54429
|
+
logger.error(mismatchMessage);
|
|
54430
|
+
throw new CliUpdateError(mismatchMessage);
|
|
54431
|
+
}
|
|
54432
|
+
outro(`[+] Successfully updated ClaudeKit CLI to ${activeVersion}`);
|
|
54433
|
+
await promptKitUpdateFn(opts.dev || opts.beta, opts.yes);
|
|
54434
|
+
} catch (error) {
|
|
54435
|
+
if (error instanceof CliUpdateError) {
|
|
54436
|
+
throw error;
|
|
54437
|
+
}
|
|
54438
|
+
s.stop("Verification failed");
|
|
54439
|
+
const message = `Update completed but automatic verification failed.
|
|
54440
|
+
Please restart your terminal and run 'ck --version'. Expected: ${targetVersion}
|
|
54441
|
+
|
|
54442
|
+
Manual update: ${redactCommandForLog(updateCmd)}`;
|
|
54443
|
+
logger.error(message);
|
|
54444
|
+
throw new CliUpdateError(message);
|
|
54383
54445
|
}
|
|
54384
54446
|
} catch (error) {
|
|
54385
54447
|
if (error instanceof CliUpdateError) {
|
|
@@ -82907,7 +82969,7 @@ import { join as join89 } from "node:path";
|
|
|
82907
82969
|
|
|
82908
82970
|
// src/domains/installation/deletion-handler.ts
|
|
82909
82971
|
import { existsSync as existsSync48, lstatSync as lstatSync3, readdirSync as readdirSync3, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync3 } from "node:fs";
|
|
82910
|
-
import { dirname as dirname18, join as join76, relative as relative10, resolve as resolve17, sep as
|
|
82972
|
+
import { dirname as dirname18, join as join76, relative as relative10, resolve as resolve17, sep as sep3 } from "node:path";
|
|
82911
82973
|
|
|
82912
82974
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
82913
82975
|
init_metadata_migration();
|
|
@@ -83146,7 +83208,7 @@ function cleanupEmptyDirectories(filePath, claudeDir2) {
|
|
|
83146
83208
|
function deletePath(fullPath, claudeDir2) {
|
|
83147
83209
|
const normalizedPath = resolve17(fullPath);
|
|
83148
83210
|
const normalizedClaudeDir = resolve17(claudeDir2);
|
|
83149
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
83211
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep3}`) && normalizedPath !== normalizedClaudeDir) {
|
|
83150
83212
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
83151
83213
|
}
|
|
83152
83214
|
try {
|
|
@@ -83220,7 +83282,7 @@ async function handleDeletions(sourceMetadata, claudeDir2) {
|
|
|
83220
83282
|
const fullPath = join76(claudeDir2, path13);
|
|
83221
83283
|
const normalizedPath = resolve17(fullPath);
|
|
83222
83284
|
const normalizedClaudeDir = resolve17(claudeDir2);
|
|
83223
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
83285
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep3}`)) {
|
|
83224
83286
|
logger.warning(`Skipping invalid path: ${path13}`);
|
|
83225
83287
|
result.errors.push(path13);
|
|
83226
83288
|
continue;
|
|
@@ -84243,8 +84305,8 @@ var path13 = {
|
|
|
84243
84305
|
win32: { sep: "\\" },
|
|
84244
84306
|
posix: { sep: "/" }
|
|
84245
84307
|
};
|
|
84246
|
-
var
|
|
84247
|
-
minimatch.sep =
|
|
84308
|
+
var sep4 = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
|
|
84309
|
+
minimatch.sep = sep4;
|
|
84248
84310
|
var GLOBSTAR = Symbol("globstar **");
|
|
84249
84311
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
84250
84312
|
var qmark2 = "[^/]";
|
|
@@ -90650,8 +90712,7 @@ async function migrateCommand(options2) {
|
|
|
90650
90712
|
value: a3,
|
|
90651
90713
|
label: providers[a3].displayName
|
|
90652
90714
|
})),
|
|
90653
|
-
required: true
|
|
90654
|
-
initialValues: detectedProviders
|
|
90715
|
+
required: true
|
|
90655
90716
|
});
|
|
90656
90717
|
if (lD(selected)) {
|
|
90657
90718
|
ue("Migrate cancelled");
|
|
@@ -92372,7 +92433,7 @@ async function detectInstallations() {
|
|
|
92372
92433
|
|
|
92373
92434
|
// src/commands/uninstall/removal-handler.ts
|
|
92374
92435
|
import { readdirSync as readdirSync6, rmSync as rmSync5 } from "node:fs";
|
|
92375
|
-
import { join as join111, resolve as resolve25, sep as
|
|
92436
|
+
import { join as join111, resolve as resolve25, sep as sep5 } from "node:path";
|
|
92376
92437
|
init_logger();
|
|
92377
92438
|
init_safe_prompts();
|
|
92378
92439
|
init_safe_spinner();
|
|
@@ -92515,7 +92576,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
92515
92576
|
try {
|
|
92516
92577
|
const resolvedPath = resolve25(filePath);
|
|
92517
92578
|
const resolvedBase = resolve25(baseDir);
|
|
92518
|
-
if (!resolvedPath.startsWith(resolvedBase +
|
|
92579
|
+
if (!resolvedPath.startsWith(resolvedBase + sep5) && resolvedPath !== resolvedBase) {
|
|
92519
92580
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
92520
92581
|
return false;
|
|
92521
92582
|
}
|
|
@@ -92523,7 +92584,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
92523
92584
|
if (stats.isSymbolicLink()) {
|
|
92524
92585
|
const realPath = await import_fs_extra37.realpath(filePath);
|
|
92525
92586
|
const resolvedReal = resolve25(realPath);
|
|
92526
|
-
if (!resolvedReal.startsWith(resolvedBase +
|
|
92587
|
+
if (!resolvedReal.startsWith(resolvedBase + sep5) && resolvedReal !== resolvedBase) {
|
|
92527
92588
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
92528
92589
|
return false;
|
|
92529
92590
|
}
|