claudekit-cli 3.34.4 → 3.34.5
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 +119 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44436,6 +44436,27 @@ var init_skill_routes = __esm(() => {
|
|
|
44436
44436
|
});
|
|
44437
44437
|
|
|
44438
44438
|
// src/domains/github/npm-registry.ts
|
|
44439
|
+
function redactRegistryUrlForLog(url) {
|
|
44440
|
+
if (!url)
|
|
44441
|
+
return url;
|
|
44442
|
+
try {
|
|
44443
|
+
const parsed = new URL(url);
|
|
44444
|
+
if (parsed.username) {
|
|
44445
|
+
parsed.username = REDACTED_VALUE;
|
|
44446
|
+
}
|
|
44447
|
+
if (parsed.password) {
|
|
44448
|
+
parsed.password = REDACTED_VALUE;
|
|
44449
|
+
}
|
|
44450
|
+
for (const key of parsed.searchParams.keys()) {
|
|
44451
|
+
if (/(token|auth|password|secret|key)/i.test(key)) {
|
|
44452
|
+
parsed.searchParams.set(key, REDACTED_VALUE);
|
|
44453
|
+
}
|
|
44454
|
+
}
|
|
44455
|
+
return parsed.toString();
|
|
44456
|
+
} catch {
|
|
44457
|
+
return url.replace(/\/\/([^/@\s]+)@/, `//${REDACTED_VALUE}@`);
|
|
44458
|
+
}
|
|
44459
|
+
}
|
|
44439
44460
|
async function fetchWithTimeout(url, options2 = {}, timeout2 = REQUEST_TIMEOUT) {
|
|
44440
44461
|
const controller = new AbortController;
|
|
44441
44462
|
const timeoutId = setTimeout(() => controller.abort(), timeout2);
|
|
@@ -44457,7 +44478,7 @@ class NpmRegistryClient {
|
|
|
44457
44478
|
}
|
|
44458
44479
|
const registry = registryUrl || DEFAULT_REGISTRY_URL;
|
|
44459
44480
|
const url = `${registry}/${encodeURIComponent(packageName)}`;
|
|
44460
|
-
logger.debug(`Fetching package info from: ${url}`);
|
|
44481
|
+
logger.debug(`Fetching package info from: ${redactRegistryUrlForLog(url)}`);
|
|
44461
44482
|
try {
|
|
44462
44483
|
const response = await fetchWithTimeout(url, {
|
|
44463
44484
|
headers: {
|
|
@@ -44520,18 +44541,12 @@ class NpmRegistryClient {
|
|
|
44520
44541
|
}
|
|
44521
44542
|
}
|
|
44522
44543
|
static async versionExists(packageName, version, registryUrl) {
|
|
44523
|
-
|
|
44524
|
-
|
|
44525
|
-
if (!info)
|
|
44526
|
-
return false;
|
|
44527
|
-
const exists = version in (info.versions || {});
|
|
44528
|
-
logger.debug(`Version ${version} exists for ${packageName}: ${exists}`);
|
|
44529
|
-
return exists;
|
|
44530
|
-
} catch (error) {
|
|
44531
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
44532
|
-
logger.debug(`Failed to check version ${version} for ${packageName}: ${message}`);
|
|
44544
|
+
const info = await NpmRegistryClient.getPackageInfo(packageName, registryUrl);
|
|
44545
|
+
if (!info)
|
|
44533
44546
|
return false;
|
|
44534
|
-
}
|
|
44547
|
+
const exists = version in (info.versions || {});
|
|
44548
|
+
logger.debug(`Version ${version} exists for ${packageName}: ${exists}`);
|
|
44549
|
+
return exists;
|
|
44535
44550
|
}
|
|
44536
44551
|
static async getVersionInfo(packageName, version, registryUrl) {
|
|
44537
44552
|
try {
|
|
@@ -44569,7 +44584,7 @@ class NpmRegistryClient {
|
|
|
44569
44584
|
}
|
|
44570
44585
|
}
|
|
44571
44586
|
}
|
|
44572
|
-
var DEFAULT_REGISTRY_URL = "https://registry.npmjs.org", REQUEST_TIMEOUT = 5000;
|
|
44587
|
+
var DEFAULT_REGISTRY_URL = "https://registry.npmjs.org", REQUEST_TIMEOUT = 5000, REDACTED_VALUE = "***";
|
|
44573
44588
|
var init_npm_registry = __esm(() => {
|
|
44574
44589
|
init_logger();
|
|
44575
44590
|
});
|
|
@@ -44596,9 +44611,9 @@ function getNpmQuery() {
|
|
|
44596
44611
|
checkFn: (stdout) => {
|
|
44597
44612
|
try {
|
|
44598
44613
|
const data = JSON.parse(stdout);
|
|
44599
|
-
return !!
|
|
44614
|
+
return !!data.dependencies?.["claudekit-cli"];
|
|
44600
44615
|
} catch {
|
|
44601
|
-
return
|
|
44616
|
+
return /"claudekit-cli"\s*:/.test(stdout) || /(?:^|[^a-z0-9-])claudekit-cli@/m.test(stdout);
|
|
44602
44617
|
}
|
|
44603
44618
|
}
|
|
44604
44619
|
};
|
|
@@ -44614,7 +44629,36 @@ async function getNpmVersion() {
|
|
|
44614
44629
|
return null;
|
|
44615
44630
|
}
|
|
44616
44631
|
}
|
|
44617
|
-
function
|
|
44632
|
+
function normalizeNpmRegistryUrl(rawValue) {
|
|
44633
|
+
const value = rawValue.trim();
|
|
44634
|
+
if (!value) {
|
|
44635
|
+
return null;
|
|
44636
|
+
}
|
|
44637
|
+
if (!/^https?:\/\//i.test(value)) {
|
|
44638
|
+
return null;
|
|
44639
|
+
}
|
|
44640
|
+
try {
|
|
44641
|
+
const parsed = new URL(value);
|
|
44642
|
+
const protocol = parsed.protocol.toLowerCase();
|
|
44643
|
+
if (protocol !== "http:" && protocol !== "https:") {
|
|
44644
|
+
return null;
|
|
44645
|
+
}
|
|
44646
|
+
const normalizedPath = parsed.pathname.replace(/\/+$/, "");
|
|
44647
|
+
return `${parsed.protocol}//${parsed.host}${normalizedPath}${parsed.search}${parsed.hash}`;
|
|
44648
|
+
} catch {
|
|
44649
|
+
return null;
|
|
44650
|
+
}
|
|
44651
|
+
}
|
|
44652
|
+
async function getNpmRegistryUrl() {
|
|
44653
|
+
try {
|
|
44654
|
+
const cmd = isWindows() ? "npm.cmd config get registry" : "npm config get registry";
|
|
44655
|
+
const { stdout } = await execAsync(cmd, { timeout: 3000 });
|
|
44656
|
+
return normalizeNpmRegistryUrl(stdout);
|
|
44657
|
+
} catch {
|
|
44658
|
+
return null;
|
|
44659
|
+
}
|
|
44660
|
+
}
|
|
44661
|
+
function getNpmUpdateCommand(packageName, version, registryUrl) {
|
|
44618
44662
|
if (!isValidPackageName(packageName)) {
|
|
44619
44663
|
throw new Error(`Invalid package name: ${packageName}`);
|
|
44620
44664
|
}
|
|
@@ -44622,7 +44666,8 @@ function getNpmUpdateCommand(packageName, version) {
|
|
|
44622
44666
|
throw new Error(`Invalid version: ${version}`);
|
|
44623
44667
|
}
|
|
44624
44668
|
const versionSuffix = version ? `@${version}` : "@latest";
|
|
44625
|
-
|
|
44669
|
+
const registryFlag = registryUrl ? ` --registry ${registryUrl}` : "";
|
|
44670
|
+
return isWindows() ? `npm.cmd install -g ${packageName}${versionSuffix}${registryFlag}` : `npm install -g ${packageName}${versionSuffix}${registryFlag}`;
|
|
44626
44671
|
}
|
|
44627
44672
|
var init_npm_detector = __esm(() => {
|
|
44628
44673
|
init_environment();
|
|
@@ -44634,7 +44679,7 @@ function getBunQuery() {
|
|
|
44634
44679
|
return {
|
|
44635
44680
|
pm: "bun",
|
|
44636
44681
|
cmd: "bun pm ls -g",
|
|
44637
|
-
checkFn: (stdout) =>
|
|
44682
|
+
checkFn: (stdout) => /(?:^|[^a-z0-9-])claudekit-cli@/m.test(stdout)
|
|
44638
44683
|
};
|
|
44639
44684
|
}
|
|
44640
44685
|
function getBunVersionCommand() {
|
|
@@ -44648,7 +44693,7 @@ async function getBunVersion() {
|
|
|
44648
44693
|
return null;
|
|
44649
44694
|
}
|
|
44650
44695
|
}
|
|
44651
|
-
function getBunUpdateCommand(packageName, version) {
|
|
44696
|
+
function getBunUpdateCommand(packageName, version, registryUrl) {
|
|
44652
44697
|
if (!isValidPackageName(packageName)) {
|
|
44653
44698
|
throw new Error(`Invalid package name: ${packageName}`);
|
|
44654
44699
|
}
|
|
@@ -44656,7 +44701,8 @@ function getBunUpdateCommand(packageName, version) {
|
|
|
44656
44701
|
throw new Error(`Invalid version: ${version}`);
|
|
44657
44702
|
}
|
|
44658
44703
|
const versionSuffix = version ? `@${version}` : "@latest";
|
|
44659
|
-
|
|
44704
|
+
const registryFlag = registryUrl ? ` --registry ${registryUrl}` : "";
|
|
44705
|
+
return `bun add -g ${packageName}${versionSuffix}${registryFlag}`;
|
|
44660
44706
|
}
|
|
44661
44707
|
var init_bun_detector = __esm(() => {
|
|
44662
44708
|
init_detector_base();
|
|
@@ -44667,7 +44713,7 @@ function getYarnQuery() {
|
|
|
44667
44713
|
return {
|
|
44668
44714
|
pm: "yarn",
|
|
44669
44715
|
cmd: isWindows() ? "yarn.cmd global list --pattern claudekit-cli" : "yarn global list --pattern claudekit-cli",
|
|
44670
|
-
checkFn: (stdout) =>
|
|
44716
|
+
checkFn: (stdout) => /(?:^|[^a-z0-9-])claudekit-cli@/m.test(stdout)
|
|
44671
44717
|
};
|
|
44672
44718
|
}
|
|
44673
44719
|
function getYarnVersionCommand() {
|
|
@@ -44681,7 +44727,7 @@ async function getYarnVersion() {
|
|
|
44681
44727
|
return null;
|
|
44682
44728
|
}
|
|
44683
44729
|
}
|
|
44684
|
-
function getYarnUpdateCommand(packageName, version) {
|
|
44730
|
+
function getYarnUpdateCommand(packageName, version, registryUrl) {
|
|
44685
44731
|
if (!isValidPackageName(packageName)) {
|
|
44686
44732
|
throw new Error(`Invalid package name: ${packageName}`);
|
|
44687
44733
|
}
|
|
@@ -44689,7 +44735,8 @@ function getYarnUpdateCommand(packageName, version) {
|
|
|
44689
44735
|
throw new Error(`Invalid version: ${version}`);
|
|
44690
44736
|
}
|
|
44691
44737
|
const versionSuffix = version ? `@${version}` : "@latest";
|
|
44692
|
-
|
|
44738
|
+
const registryFlag = registryUrl ? ` --registry ${registryUrl}` : "";
|
|
44739
|
+
return isWindows() ? `yarn.cmd global add ${packageName}${versionSuffix}${registryFlag}` : `yarn global add ${packageName}${versionSuffix}${registryFlag}`;
|
|
44693
44740
|
}
|
|
44694
44741
|
var init_yarn_detector = __esm(() => {
|
|
44695
44742
|
init_environment();
|
|
@@ -44701,7 +44748,7 @@ function getPnpmQuery() {
|
|
|
44701
44748
|
return {
|
|
44702
44749
|
pm: "pnpm",
|
|
44703
44750
|
cmd: isWindows() ? "pnpm.cmd ls -g claudekit-cli" : "pnpm ls -g claudekit-cli",
|
|
44704
|
-
checkFn: (stdout) =>
|
|
44751
|
+
checkFn: (stdout) => /(?:^|[^a-z0-9-])claudekit-cli(?:@|\s+\d)/m.test(stdout)
|
|
44705
44752
|
};
|
|
44706
44753
|
}
|
|
44707
44754
|
function getPnpmVersionCommand() {
|
|
@@ -44715,7 +44762,7 @@ async function getPnpmVersion() {
|
|
|
44715
44762
|
return null;
|
|
44716
44763
|
}
|
|
44717
44764
|
}
|
|
44718
|
-
function getPnpmUpdateCommand(packageName, version) {
|
|
44765
|
+
function getPnpmUpdateCommand(packageName, version, registryUrl) {
|
|
44719
44766
|
if (!isValidPackageName(packageName)) {
|
|
44720
44767
|
throw new Error(`Invalid package name: ${packageName}`);
|
|
44721
44768
|
}
|
|
@@ -44723,7 +44770,8 @@ function getPnpmUpdateCommand(packageName, version) {
|
|
|
44723
44770
|
throw new Error(`Invalid version: ${version}`);
|
|
44724
44771
|
}
|
|
44725
44772
|
const versionSuffix = version ? `@${version}` : "@latest";
|
|
44726
|
-
|
|
44773
|
+
const registryFlag = registryUrl ? ` --registry ${registryUrl}` : "";
|
|
44774
|
+
return isWindows() ? `pnpm.cmd add -g ${packageName}${versionSuffix}${registryFlag}` : `pnpm add -g ${packageName}${versionSuffix}${registryFlag}`;
|
|
44727
44775
|
}
|
|
44728
44776
|
var init_pnpm_detector = __esm(() => {
|
|
44729
44777
|
init_environment();
|
|
@@ -44936,24 +44984,25 @@ var init_package_manager_detector = __esm(() => {
|
|
|
44936
44984
|
return "echo unknown";
|
|
44937
44985
|
}
|
|
44938
44986
|
}
|
|
44939
|
-
static
|
|
44987
|
+
static getNpmRegistryUrl = getNpmRegistryUrl;
|
|
44988
|
+
static getUpdateCommand(pm, packageName, version, registryUrl) {
|
|
44940
44989
|
if (!isValidPackageName(packageName))
|
|
44941
44990
|
throw new Error(`Invalid package name: ${packageName}`);
|
|
44942
44991
|
if (version && !isValidVersion(version))
|
|
44943
44992
|
throw new Error(`Invalid version: ${version}`);
|
|
44944
44993
|
switch (pm) {
|
|
44945
44994
|
case "bun":
|
|
44946
|
-
return getBunUpdateCommand(packageName, version);
|
|
44995
|
+
return getBunUpdateCommand(packageName, version, registryUrl);
|
|
44947
44996
|
case "yarn":
|
|
44948
|
-
return getYarnUpdateCommand(packageName, version);
|
|
44997
|
+
return getYarnUpdateCommand(packageName, version, registryUrl);
|
|
44949
44998
|
case "pnpm":
|
|
44950
|
-
return getPnpmUpdateCommand(packageName, version);
|
|
44999
|
+
return getPnpmUpdateCommand(packageName, version, registryUrl);
|
|
44951
45000
|
default:
|
|
44952
|
-
return getNpmUpdateCommand(packageName, version);
|
|
45001
|
+
return getNpmUpdateCommand(packageName, version, registryUrl);
|
|
44953
45002
|
}
|
|
44954
45003
|
}
|
|
44955
|
-
static getInstallCommand(pm, packageName, version) {
|
|
44956
|
-
return PackageManagerDetector.getUpdateCommand(pm, packageName, version);
|
|
45004
|
+
static getInstallCommand(pm, packageName, version, registryUrl) {
|
|
45005
|
+
return PackageManagerDetector.getUpdateCommand(pm, packageName, version, registryUrl);
|
|
44957
45006
|
}
|
|
44958
45007
|
static getDisplayName(pm) {
|
|
44959
45008
|
switch (pm) {
|
|
@@ -45382,7 +45431,7 @@ var package_default;
|
|
|
45382
45431
|
var init_package = __esm(() => {
|
|
45383
45432
|
package_default = {
|
|
45384
45433
|
name: "claudekit-cli",
|
|
45385
|
-
version: "3.34.
|
|
45434
|
+
version: "3.34.5",
|
|
45386
45435
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
45387
45436
|
type: "module",
|
|
45388
45437
|
repository: {
|
|
@@ -45492,6 +45541,12 @@ var init_package = __esm(() => {
|
|
|
45492
45541
|
import { exec as exec2 } from "node:child_process";
|
|
45493
45542
|
import { join as join26 } from "node:path";
|
|
45494
45543
|
import { promisify as promisify8 } from "node:util";
|
|
45544
|
+
function redactCommandForLog(command) {
|
|
45545
|
+
if (!command)
|
|
45546
|
+
return command;
|
|
45547
|
+
const redactedRegistryFlags = command.replace(/(--registry(?:=|\s+))(['"]?)(\S+?)(\2)(?=\s|$)/g, (_match, prefix, quote, url) => `${prefix}${quote}${redactRegistryUrlForLog(url)}${quote}`);
|
|
45548
|
+
return redactedRegistryFlags.replace(/https?:\/\/[^\s"']+/g, (url) => redactRegistryUrlForLog(url));
|
|
45549
|
+
}
|
|
45495
45550
|
function buildInitCommand(isGlobal, kit, beta) {
|
|
45496
45551
|
const parts = ["ck init"];
|
|
45497
45552
|
if (isGlobal)
|
|
@@ -45621,31 +45676,50 @@ async function updateCliCommand(options2) {
|
|
|
45621
45676
|
const pmVersion = await PackageManagerDetector.getVersion(pm);
|
|
45622
45677
|
s.stop(`Using ${PackageManagerDetector.getDisplayName(pm)}${pmVersion ? ` v${pmVersion}` : ""}`);
|
|
45623
45678
|
logger.verbose(`Detected package manager: ${pm}`);
|
|
45679
|
+
let registryUrl = opts.registry;
|
|
45680
|
+
if (!registryUrl && pm === "npm") {
|
|
45681
|
+
const userRegistry = await PackageManagerDetector.getNpmRegistryUrl();
|
|
45682
|
+
if (userRegistry) {
|
|
45683
|
+
registryUrl = userRegistry;
|
|
45684
|
+
logger.verbose(`Using npm configured registry: ${redactRegistryUrlForLog(registryUrl)}`);
|
|
45685
|
+
}
|
|
45686
|
+
}
|
|
45624
45687
|
s.start("Checking for updates...");
|
|
45625
45688
|
let targetVersion = null;
|
|
45626
45689
|
if (opts.release && opts.release !== "latest") {
|
|
45627
|
-
|
|
45628
|
-
|
|
45629
|
-
|
|
45630
|
-
|
|
45690
|
+
try {
|
|
45691
|
+
const exists = await NpmRegistryClient.versionExists(PACKAGE_NAME, opts.release, registryUrl);
|
|
45692
|
+
if (!exists) {
|
|
45693
|
+
s.stop("Version not found");
|
|
45694
|
+
throw new CliUpdateError(`Version ${opts.release} does not exist on npm registry. Run 'ck versions' to see available versions.`);
|
|
45695
|
+
}
|
|
45696
|
+
} catch (error) {
|
|
45697
|
+
if (error instanceof CliUpdateError) {
|
|
45698
|
+
throw error;
|
|
45699
|
+
}
|
|
45700
|
+
s.stop("Version check failed");
|
|
45701
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
45702
|
+
logger.verbose(`Release check failed for ${opts.release}: ${message}`);
|
|
45703
|
+
const registryHint = registryUrl ? ` (${redactRegistryUrlForLog(registryUrl)})` : " (default registry)";
|
|
45704
|
+
throw new CliUpdateError(`Failed to verify version ${opts.release} on npm registry${registryHint}. Check registry settings/network connectivity and try again.`);
|
|
45631
45705
|
}
|
|
45632
45706
|
targetVersion = opts.release;
|
|
45633
45707
|
s.stop(`Target version: ${targetVersion}`);
|
|
45634
45708
|
} else if (opts.dev || opts.beta) {
|
|
45635
|
-
targetVersion = await NpmRegistryClient.getDevVersion(PACKAGE_NAME,
|
|
45709
|
+
targetVersion = await NpmRegistryClient.getDevVersion(PACKAGE_NAME, registryUrl);
|
|
45636
45710
|
if (!targetVersion) {
|
|
45637
45711
|
s.stop("No dev version available");
|
|
45638
45712
|
logger.warning("No dev version found. Using latest stable version instead.");
|
|
45639
|
-
targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME,
|
|
45713
|
+
targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME, registryUrl);
|
|
45640
45714
|
} else {
|
|
45641
45715
|
s.stop(`Latest dev version: ${targetVersion}`);
|
|
45642
45716
|
}
|
|
45643
45717
|
} else {
|
|
45644
|
-
targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME,
|
|
45718
|
+
targetVersion = await NpmRegistryClient.getLatestVersion(PACKAGE_NAME, registryUrl);
|
|
45645
45719
|
s.stop(`Latest version: ${targetVersion || "unknown"}`);
|
|
45646
45720
|
}
|
|
45647
45721
|
if (!targetVersion) {
|
|
45648
|
-
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)}`);
|
|
45722
|
+
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, undefined, registryUrl)}`);
|
|
45649
45723
|
}
|
|
45650
45724
|
const comparison = import_compare_versions.compareVersions(currentVersion, targetVersion);
|
|
45651
45725
|
if (comparison === 0) {
|
|
@@ -45678,8 +45752,8 @@ Run 'ck update' to install`, "Update Check");
|
|
|
45678
45752
|
return;
|
|
45679
45753
|
}
|
|
45680
45754
|
}
|
|
45681
|
-
const updateCmd = PackageManagerDetector.getUpdateCommand(pm, PACKAGE_NAME, targetVersion);
|
|
45682
|
-
logger.info(`Running: ${updateCmd}`);
|
|
45755
|
+
const updateCmd = PackageManagerDetector.getUpdateCommand(pm, PACKAGE_NAME, targetVersion, registryUrl);
|
|
45756
|
+
logger.info(`Running: ${redactCommandForLog(updateCmd)}`);
|
|
45683
45757
|
s.start("Updating CLI...");
|
|
45684
45758
|
try {
|
|
45685
45759
|
await execAsync2(updateCmd, {
|
|
@@ -45703,7 +45777,7 @@ Run 'ck update' to install`, "Update Check");
|
|
|
45703
45777
|
Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally`);
|
|
45704
45778
|
}
|
|
45705
45779
|
logger.error(`Update failed: ${errorMessage}`);
|
|
45706
|
-
logger.info(
|
|
45780
|
+
logger.info(`Try running: ${redactCommandForLog(updateCmd)}`);
|
|
45707
45781
|
throw new CliUpdateError(`Update failed: ${errorMessage}
|
|
45708
45782
|
|
|
45709
45783
|
Manual update: ${updateCmd}`);
|
|
@@ -45723,7 +45797,6 @@ Manual update: ${updateCmd}`);
|
|
|
45723
45797
|
}
|
|
45724
45798
|
} catch (error) {
|
|
45725
45799
|
if (error instanceof CliUpdateError) {
|
|
45726
|
-
logger.error(error.message);
|
|
45727
45800
|
throw error;
|
|
45728
45801
|
}
|
|
45729
45802
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|