claudekit-cli 3.38.0-dev.4 → 3.38.0-dev.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -12214,18 +12214,6 @@ function isUnknownChecksum(checksum) {
|
|
|
12214
12214
|
var UNKNOWN_CHECKSUM = "unknown";
|
|
12215
12215
|
|
|
12216
12216
|
// src/commands/portable/portable-registry.ts
|
|
12217
|
-
var exports_portable_registry = {};
|
|
12218
|
-
__export(exports_portable_registry, {
|
|
12219
|
-
writePortableRegistry: () => writePortableRegistry,
|
|
12220
|
-
updateAppliedManifestVersion: () => updateAppliedManifestVersion,
|
|
12221
|
-
syncPortableRegistry: () => syncPortableRegistry,
|
|
12222
|
-
removePortableInstallation: () => removePortableInstallation,
|
|
12223
|
-
removeInstallationsByFilter: () => removeInstallationsByFilter,
|
|
12224
|
-
readPortableRegistry: () => readPortableRegistry,
|
|
12225
|
-
getInstallationsByType: () => getInstallationsByType,
|
|
12226
|
-
findPortableInstallations: () => findPortableInstallations,
|
|
12227
|
-
addPortableInstallation: () => addPortableInstallation
|
|
12228
|
-
});
|
|
12229
12217
|
import { existsSync as existsSync2 } from "node:fs";
|
|
12230
12218
|
import { mkdir, readFile as readFile2, rename, unlink, writeFile } from "node:fs/promises";
|
|
12231
12219
|
import { homedir as homedir3 } from "node:os";
|
|
@@ -12485,9 +12473,6 @@ function findPortableInstallations(registry, item, type, provider, global2) {
|
|
|
12485
12473
|
return true;
|
|
12486
12474
|
});
|
|
12487
12475
|
}
|
|
12488
|
-
function getInstallationsByType(registry, type) {
|
|
12489
|
-
return registry.installations.filter((i) => i.type === type);
|
|
12490
|
-
}
|
|
12491
12476
|
async function updateAppliedManifestVersion(version) {
|
|
12492
12477
|
await withRegistryLock(async () => {
|
|
12493
12478
|
const registry = await readPortableRegistry();
|
|
@@ -42046,6 +42031,7 @@ var init_commands = __esm(() => {
|
|
|
42046
42031
|
only: exports_external.array(ExcludePatternSchema).optional().default([]),
|
|
42047
42032
|
global: exports_external.boolean().default(false),
|
|
42048
42033
|
fresh: exports_external.boolean().default(false),
|
|
42034
|
+
force: exports_external.boolean().default(false),
|
|
42049
42035
|
installSkills: exports_external.boolean().default(false),
|
|
42050
42036
|
withSudo: exports_external.boolean().default(false),
|
|
42051
42037
|
prefix: exports_external.boolean().default(false),
|
|
@@ -42432,7 +42418,7 @@ var init_ck_config = __esm(() => {
|
|
|
42432
42418
|
}).passthrough();
|
|
42433
42419
|
UpdatePipelineSchema = exports_external.object({
|
|
42434
42420
|
autoInitAfterUpdate: exports_external.boolean().default(false),
|
|
42435
|
-
|
|
42421
|
+
autoMigrateAfterUpdate: exports_external.boolean().default(false),
|
|
42436
42422
|
migrateProviders: exports_external.union([exports_external.literal("auto"), exports_external.array(exports_external.string())]).default("auto")
|
|
42437
42423
|
});
|
|
42438
42424
|
ResolvedModelConfigSchema = exports_external.object({
|
|
@@ -42543,7 +42529,7 @@ var init_ck_config = __esm(() => {
|
|
|
42543
42529
|
},
|
|
42544
42530
|
updatePipeline: {
|
|
42545
42531
|
autoInitAfterUpdate: false,
|
|
42546
|
-
|
|
42532
|
+
autoMigrateAfterUpdate: false,
|
|
42547
42533
|
migrateProviders: "auto"
|
|
42548
42534
|
}
|
|
42549
42535
|
};
|
|
@@ -48551,17 +48537,17 @@ var init_ck_config_schema = __esm(() => {
|
|
|
48551
48537
|
},
|
|
48552
48538
|
updatePipeline: {
|
|
48553
48539
|
type: "object",
|
|
48554
|
-
description: "
|
|
48540
|
+
description: "3-step update pipeline: CLI update -> kit init -> provider migrate (each independent)",
|
|
48555
48541
|
properties: {
|
|
48556
48542
|
autoInitAfterUpdate: {
|
|
48557
48543
|
type: "boolean",
|
|
48558
48544
|
default: false,
|
|
48559
48545
|
description: "Automatically run ck init after ck update when kit has new version"
|
|
48560
48546
|
},
|
|
48561
|
-
|
|
48547
|
+
autoMigrateAfterUpdate: {
|
|
48562
48548
|
type: "boolean",
|
|
48563
48549
|
default: false,
|
|
48564
|
-
description: "Automatically run ck migrate after ck
|
|
48550
|
+
description: "Automatically run ck migrate after ck update for detected providers (independent of init)"
|
|
48565
48551
|
},
|
|
48566
48552
|
migrateProviders: {
|
|
48567
48553
|
oneOf: [
|
|
@@ -57258,7 +57244,7 @@ var package_default;
|
|
|
57258
57244
|
var init_package = __esm(() => {
|
|
57259
57245
|
package_default = {
|
|
57260
57246
|
name: "claudekit-cli",
|
|
57261
|
-
version: "3.38.0-dev.
|
|
57247
|
+
version: "3.38.0-dev.6",
|
|
57262
57248
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
57263
57249
|
type: "module",
|
|
57264
57250
|
repository: {
|
|
@@ -58553,7 +58539,8 @@ function getDefaultUpdateCliCommandDeps() {
|
|
|
58553
58539
|
execAsyncFn: execAsync2,
|
|
58554
58540
|
packageManagerDetector: PackageManagerDetector,
|
|
58555
58541
|
npmRegistryClient: NpmRegistryClient,
|
|
58556
|
-
promptKitUpdateFn: promptKitUpdate
|
|
58542
|
+
promptKitUpdateFn: promptKitUpdate,
|
|
58543
|
+
promptMigrateUpdateFn: promptMigrateUpdate
|
|
58557
58544
|
};
|
|
58558
58545
|
}
|
|
58559
58546
|
function extractCommandStdout(result) {
|
|
@@ -58678,14 +58665,14 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
58678
58665
|
if (selection.kit && kitVersion) {
|
|
58679
58666
|
logger.info(`Current kit version: ${selection.kit}@${kitVersion}`);
|
|
58680
58667
|
}
|
|
58668
|
+
let alreadyAtLatest = false;
|
|
58681
58669
|
if (yes && selection.kit && kitVersion) {
|
|
58682
58670
|
const getTagFn = deps?.getLatestReleaseTagFn ?? fetchLatestReleaseTag;
|
|
58683
58671
|
const latestTag = await getTagFn(selection.kit, beta || isBetaInstalled);
|
|
58684
58672
|
if (latestTag && versionsMatch(kitVersion, latestTag)) {
|
|
58685
58673
|
logger.success(`Already at latest version (${selection.kit}@${kitVersion}), skipping reinstall`);
|
|
58686
|
-
|
|
58687
|
-
}
|
|
58688
|
-
if (latestTag) {
|
|
58674
|
+
alreadyAtLatest = true;
|
|
58675
|
+
} else if (latestTag) {
|
|
58689
58676
|
logger.info(`Kit update available: ${kitVersion} -> ${latestTag}`);
|
|
58690
58677
|
}
|
|
58691
58678
|
}
|
|
@@ -58694,6 +58681,9 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
58694
58681
|
const ckConfig = await loadFullConfigFn(null);
|
|
58695
58682
|
autoInit = ckConfig.config.updatePipeline?.autoInitAfterUpdate ?? false;
|
|
58696
58683
|
} catch {}
|
|
58684
|
+
if (alreadyAtLatest && !autoInit) {
|
|
58685
|
+
return;
|
|
58686
|
+
}
|
|
58697
58687
|
if (!yes && !autoInit) {
|
|
58698
58688
|
logger.info("");
|
|
58699
58689
|
const shouldUpdate = await confirmFn({
|
|
@@ -58742,6 +58732,77 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
58742
58732
|
logger.verbose(`Failed to prompt for kit update: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
58743
58733
|
}
|
|
58744
58734
|
}
|
|
58735
|
+
async function promptMigrateUpdate(deps) {
|
|
58736
|
+
try {
|
|
58737
|
+
const providerRegistry = deps?.detectInstalledProvidersFn && deps?.getProviderConfigFn ? null : await Promise.resolve().then(() => (init_provider_registry(), exports_provider_registry));
|
|
58738
|
+
const detectFn = deps?.detectInstalledProvidersFn ?? providerRegistry?.detectInstalledProviders;
|
|
58739
|
+
const getConfigFn = deps?.getProviderConfigFn ?? providerRegistry?.getProviderConfig;
|
|
58740
|
+
const getSetupFn = deps?.getSetupFn ?? getClaudeKitSetup;
|
|
58741
|
+
const loadFullConfigFn = deps?.loadFullConfigFn ?? CkConfigManager.loadFull;
|
|
58742
|
+
const execFn = deps?.execAsyncFn ?? execAsync2;
|
|
58743
|
+
if (!detectFn || !getConfigFn)
|
|
58744
|
+
return;
|
|
58745
|
+
const allProviders = await detectFn();
|
|
58746
|
+
const targets = allProviders.filter((p) => p !== "claude-code");
|
|
58747
|
+
if (targets.length === 0) {
|
|
58748
|
+
logger.verbose("No migration targets detected, skipping migrate step");
|
|
58749
|
+
return;
|
|
58750
|
+
}
|
|
58751
|
+
let autoMigrate = false;
|
|
58752
|
+
let migrateProviders = "auto";
|
|
58753
|
+
try {
|
|
58754
|
+
const ckConfig = await loadFullConfigFn(null);
|
|
58755
|
+
const pipeline = ckConfig.config.updatePipeline;
|
|
58756
|
+
autoMigrate = pipeline?.autoMigrateAfterUpdate ?? false;
|
|
58757
|
+
migrateProviders = pipeline?.migrateProviders ?? "auto";
|
|
58758
|
+
} catch {}
|
|
58759
|
+
if (!autoMigrate)
|
|
58760
|
+
return;
|
|
58761
|
+
let providers2;
|
|
58762
|
+
if (migrateProviders === "auto") {
|
|
58763
|
+
providers2 = targets;
|
|
58764
|
+
} else if (Array.isArray(migrateProviders)) {
|
|
58765
|
+
const invalid = migrateProviders.filter((p) => !targets.includes(p));
|
|
58766
|
+
if (invalid.length > 0) {
|
|
58767
|
+
logger.warning(`Unknown/uninstalled providers in migrateProviders: ${invalid.join(", ")}`);
|
|
58768
|
+
}
|
|
58769
|
+
providers2 = migrateProviders.filter((p) => targets.includes(p));
|
|
58770
|
+
} else {
|
|
58771
|
+
return;
|
|
58772
|
+
}
|
|
58773
|
+
if (providers2.length === 0)
|
|
58774
|
+
return;
|
|
58775
|
+
const safeProviders = providers2.filter((p) => SAFE_PROVIDER_NAME.test(p));
|
|
58776
|
+
if (safeProviders.length !== providers2.length) {
|
|
58777
|
+
logger.warning("Some provider names contain invalid characters and were skipped");
|
|
58778
|
+
}
|
|
58779
|
+
if (safeProviders.length === 0)
|
|
58780
|
+
return;
|
|
58781
|
+
let isGlobal = false;
|
|
58782
|
+
try {
|
|
58783
|
+
const setup = await getSetupFn();
|
|
58784
|
+
isGlobal = !!setup.global.metadata && !setup.project.metadata;
|
|
58785
|
+
} catch {}
|
|
58786
|
+
const providerNames = safeProviders.map((p) => getConfigFn(p).displayName).join(", ");
|
|
58787
|
+
const parts = ["ck", "migrate"];
|
|
58788
|
+
if (isGlobal)
|
|
58789
|
+
parts.push("-g");
|
|
58790
|
+
for (const p of safeProviders) {
|
|
58791
|
+
parts.push("--agent", p);
|
|
58792
|
+
}
|
|
58793
|
+
parts.push("--yes");
|
|
58794
|
+
const cmd = parts.join(" ");
|
|
58795
|
+
logger.info(`Auto-migrating to: ${providerNames}`);
|
|
58796
|
+
try {
|
|
58797
|
+
await execFn(cmd, { timeout: 300000 });
|
|
58798
|
+
logger.success("Auto-migration complete");
|
|
58799
|
+
} catch (error) {
|
|
58800
|
+
logger.warning(`Auto-migration failed: ${error instanceof Error ? error.message : "unknown"}. Run \`ck migrate\` manually to retry.`);
|
|
58801
|
+
}
|
|
58802
|
+
} catch (error) {
|
|
58803
|
+
logger.verbose(`Migrate step skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
58804
|
+
}
|
|
58805
|
+
}
|
|
58745
58806
|
async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps()) {
|
|
58746
58807
|
const s = de();
|
|
58747
58808
|
intro("[>] ClaudeKit CLI - Update");
|
|
@@ -58751,7 +58812,8 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
58751
58812
|
execAsyncFn,
|
|
58752
58813
|
packageManagerDetector,
|
|
58753
58814
|
npmRegistryClient,
|
|
58754
|
-
promptKitUpdateFn
|
|
58815
|
+
promptKitUpdateFn,
|
|
58816
|
+
promptMigrateUpdateFn
|
|
58755
58817
|
} = deps;
|
|
58756
58818
|
const opts = UpdateCliOptionsSchema.parse(options2);
|
|
58757
58819
|
logger.info(`Current CLI version: ${currentVersion}`);
|
|
@@ -58812,12 +58874,14 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
58812
58874
|
if (comparison === 0) {
|
|
58813
58875
|
outro(`[+] Already on the latest CLI version (${currentVersion})`);
|
|
58814
58876
|
await promptKitUpdateFn(targetIsPrerelease, opts.yes);
|
|
58877
|
+
await promptMigrateUpdateFn();
|
|
58815
58878
|
return;
|
|
58816
58879
|
}
|
|
58817
58880
|
const isDevChannelSwitch = (opts.dev || opts.beta) && isBetaVersion(targetVersion) && !isBetaVersion(currentVersion);
|
|
58818
58881
|
if (comparison > 0 && !opts.release && !isDevChannelSwitch) {
|
|
58819
58882
|
outro(`[+] Current version (${currentVersion}) is newer than latest (${targetVersion})`);
|
|
58820
58883
|
await promptKitUpdateFn(targetIsPrerelease, opts.yes);
|
|
58884
|
+
await promptMigrateUpdateFn();
|
|
58821
58885
|
return;
|
|
58822
58886
|
}
|
|
58823
58887
|
const isUpgrade = comparison < 0 || isDevChannelSwitch;
|
|
@@ -58828,6 +58892,7 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
58828
58892
|
|
|
58829
58893
|
Run 'ck update' to install`, "Update Check");
|
|
58830
58894
|
await promptKitUpdateFn(targetIsPrerelease, opts.yes);
|
|
58895
|
+
await promptMigrateUpdateFn();
|
|
58831
58896
|
outro("Check complete");
|
|
58832
58897
|
return;
|
|
58833
58898
|
}
|
|
@@ -58894,6 +58959,7 @@ Run '${redactCommandForLog(updateCmd)}' manually, restart terminal, then check c
|
|
|
58894
58959
|
}
|
|
58895
58960
|
outro(`[+] Successfully updated ClaudeKit CLI to ${activeVersion}`);
|
|
58896
58961
|
await promptKitUpdateFn(targetIsPrerelease, opts.yes);
|
|
58962
|
+
await promptMigrateUpdateFn();
|
|
58897
58963
|
} catch (error) {
|
|
58898
58964
|
if (error instanceof CliUpdateError) {
|
|
58899
58965
|
throw error;
|
|
@@ -58915,7 +58981,7 @@ Manual update: ${redactCommandForLog(updateCmd)}`;
|
|
|
58915
58981
|
throw new CliUpdateError(errorMessage);
|
|
58916
58982
|
}
|
|
58917
58983
|
}
|
|
58918
|
-
var import_compare_versions3, import_fs_extra5, execAsync2, CliUpdateError;
|
|
58984
|
+
var import_compare_versions3, import_fs_extra5, execAsync2, CliUpdateError, SAFE_PROVIDER_NAME;
|
|
58919
58985
|
var init_update_cli = __esm(() => {
|
|
58920
58986
|
init_ck_config_manager();
|
|
58921
58987
|
init_npm_registry();
|
|
@@ -58938,6 +59004,7 @@ var init_update_cli = __esm(() => {
|
|
|
58938
59004
|
this.name = "CliUpdateError";
|
|
58939
59005
|
}
|
|
58940
59006
|
};
|
|
59007
|
+
SAFE_PROVIDER_NAME = /^[a-z0-9-]+$/;
|
|
58941
59008
|
});
|
|
58942
59009
|
|
|
58943
59010
|
// src/domains/versioning/version-cache.ts
|
|
@@ -70762,6 +70829,10 @@ var init_init_command_help = __esm(() => {
|
|
|
70762
70829
|
{
|
|
70763
70830
|
flags: "--fresh",
|
|
70764
70831
|
description: "Full reset: remove CK files, replace settings.json and CLAUDE.md, reinstall from scratch"
|
|
70832
|
+
},
|
|
70833
|
+
{
|
|
70834
|
+
flags: "--force",
|
|
70835
|
+
description: "Force reinstall even if already at latest version (use with --yes; re-onboards missing files without full reset)"
|
|
70765
70836
|
}
|
|
70766
70837
|
]
|
|
70767
70838
|
},
|
|
@@ -96046,6 +96117,7 @@ async function resolveOptions(ctx) {
|
|
|
96046
96117
|
global: parsed.global ?? false,
|
|
96047
96118
|
yes: parsed.yes ?? false,
|
|
96048
96119
|
fresh: parsed.fresh ?? false,
|
|
96120
|
+
force: parsed.force ?? false,
|
|
96049
96121
|
refresh: parsed.refresh ?? false,
|
|
96050
96122
|
exclude: parsed.exclude ?? [],
|
|
96051
96123
|
only: parsed.only ?? [],
|
|
@@ -96115,116 +96187,6 @@ import { join as join109 } from "node:path";
|
|
|
96115
96187
|
init_logger();
|
|
96116
96188
|
init_path_resolver();
|
|
96117
96189
|
var import_fs_extra30 = __toESM(require_lib3(), 1);
|
|
96118
|
-
|
|
96119
|
-
// src/commands/init/phases/post-init-migrate-nudge.ts
|
|
96120
|
-
init_ck_config_manager();
|
|
96121
|
-
init_logger();
|
|
96122
|
-
init_safe_prompts();
|
|
96123
|
-
import { exec as exec8 } from "node:child_process";
|
|
96124
|
-
import { promisify as promisify14 } from "node:util";
|
|
96125
|
-
var execAsync8 = promisify14(exec8);
|
|
96126
|
-
var SAFE_PROVIDER_NAME = /^[a-z0-9-]+$/;
|
|
96127
|
-
async function maybePostInitMigrate(ctx, deps) {
|
|
96128
|
-
if (ctx.cancelled || !ctx.resolvedDir)
|
|
96129
|
-
return;
|
|
96130
|
-
try {
|
|
96131
|
-
const providerRegistry = deps?.detectInstalledProvidersFn && deps?.getProviderConfigFn ? null : await Promise.resolve().then(() => (init_provider_registry(), exports_provider_registry));
|
|
96132
|
-
const portableRegistry = deps?.readPortableRegistryFn ? null : await Promise.resolve().then(() => (init_portable_registry(), exports_portable_registry));
|
|
96133
|
-
const detectInstalledProvidersFn = deps?.detectInstalledProvidersFn ?? providerRegistry?.detectInstalledProviders;
|
|
96134
|
-
const getProviderConfigFn = deps?.getProviderConfigFn ?? providerRegistry?.getProviderConfig;
|
|
96135
|
-
const readPortableRegistryFn = deps?.readPortableRegistryFn ?? portableRegistry?.readPortableRegistry;
|
|
96136
|
-
const loadFullConfigFn = deps?.loadFullConfigFn ?? CkConfigManager.loadFull;
|
|
96137
|
-
if (!detectInstalledProvidersFn || !getProviderConfigFn || !readPortableRegistryFn) {
|
|
96138
|
-
return;
|
|
96139
|
-
}
|
|
96140
|
-
const allProviders = await detectInstalledProvidersFn();
|
|
96141
|
-
const targets = allProviders.filter((p) => p !== "claude-code");
|
|
96142
|
-
if (targets.length === 0)
|
|
96143
|
-
return;
|
|
96144
|
-
const providerNames = targets.map((p) => getProviderConfigFn(p).displayName).join(", ");
|
|
96145
|
-
const registry = await readPortableRegistryFn();
|
|
96146
|
-
const hasHistory = registry.installations.some((i) => i.provider !== "claude-code");
|
|
96147
|
-
const ckConfig = await loadFullConfigFn(ctx.options.global ? null : ctx.resolvedDir);
|
|
96148
|
-
const pipeline = ckConfig.config.updatePipeline;
|
|
96149
|
-
const autoMigrate = pipeline?.autoMigrateAfterInit ?? false;
|
|
96150
|
-
if (autoMigrate) {
|
|
96151
|
-
await runAutoMigrate(ctx, pipeline, targets, providerNames, deps);
|
|
96152
|
-
} else if (!hasHistory && !ctx.isNonInteractive) {
|
|
96153
|
-
await showNudge(ctx, providerNames, deps);
|
|
96154
|
-
}
|
|
96155
|
-
} catch (error) {
|
|
96156
|
-
logger.debug(`Post-init migrate check skipped: ${error instanceof Error ? error.message : "unknown"}`);
|
|
96157
|
-
}
|
|
96158
|
-
}
|
|
96159
|
-
async function showNudge(ctx, providerNames, deps) {
|
|
96160
|
-
const noteFn = deps?.noteFn ?? note;
|
|
96161
|
-
const confirmFn = deps?.confirmFn ?? se;
|
|
96162
|
-
const isCancelFn = deps?.isCancelFn ?? lD;
|
|
96163
|
-
const execAsyncFn = deps?.execAsyncFn ?? execAsync8;
|
|
96164
|
-
noteFn([
|
|
96165
|
-
`Detected providers: ${providerNames}`,
|
|
96166
|
-
"Run `ck migrate` to sync your kit to these providers.",
|
|
96167
|
-
"Set `autoMigrateAfterInit: true` in .ck.json to auto-sync on future updates."
|
|
96168
|
-
].join(`
|
|
96169
|
-
`), "[i] Provider Sync Available");
|
|
96170
|
-
const shouldMigrate = await confirmFn({
|
|
96171
|
-
message: "Run ck migrate now?"
|
|
96172
|
-
});
|
|
96173
|
-
if (isCancelFn(shouldMigrate) || !shouldMigrate)
|
|
96174
|
-
return;
|
|
96175
|
-
const parts = ["ck", "migrate"];
|
|
96176
|
-
if (ctx.options.global)
|
|
96177
|
-
parts.push("-g");
|
|
96178
|
-
parts.push("--yes");
|
|
96179
|
-
const cmd = parts.join(" ");
|
|
96180
|
-
try {
|
|
96181
|
-
logger.info(`Running: ${cmd}`);
|
|
96182
|
-
await execAsyncFn(cmd, { timeout: 300000 });
|
|
96183
|
-
logger.success("Migration complete");
|
|
96184
|
-
} catch (error) {
|
|
96185
|
-
logger.warning(`Migration failed: ${error instanceof Error ? error.message : "unknown"}. Run \`ck migrate\` manually to retry.`);
|
|
96186
|
-
}
|
|
96187
|
-
}
|
|
96188
|
-
async function runAutoMigrate(ctx, pipeline, detectedTargets, providerNames, deps) {
|
|
96189
|
-
const execAsyncFn = deps?.execAsyncFn ?? execAsync8;
|
|
96190
|
-
let providers2;
|
|
96191
|
-
if (!pipeline?.migrateProviders || pipeline.migrateProviders === "auto") {
|
|
96192
|
-
providers2 = detectedTargets;
|
|
96193
|
-
} else if (Array.isArray(pipeline.migrateProviders)) {
|
|
96194
|
-
const invalid = pipeline.migrateProviders.filter((p) => !detectedTargets.includes(p));
|
|
96195
|
-
if (invalid.length > 0) {
|
|
96196
|
-
logger.warning(`Unknown/uninstalled providers in migrateProviders: ${invalid.join(", ")}`);
|
|
96197
|
-
}
|
|
96198
|
-
providers2 = pipeline.migrateProviders.filter((p) => detectedTargets.includes(p));
|
|
96199
|
-
} else {
|
|
96200
|
-
return;
|
|
96201
|
-
}
|
|
96202
|
-
if (providers2.length === 0)
|
|
96203
|
-
return;
|
|
96204
|
-
const safeProviders = providers2.filter((p) => SAFE_PROVIDER_NAME.test(p));
|
|
96205
|
-
if (safeProviders.length !== providers2.length) {
|
|
96206
|
-
logger.warning("Some provider names contain invalid characters and were skipped");
|
|
96207
|
-
}
|
|
96208
|
-
if (safeProviders.length === 0)
|
|
96209
|
-
return;
|
|
96210
|
-
const parts = ["ck", "migrate"];
|
|
96211
|
-
if (ctx.options.global)
|
|
96212
|
-
parts.push("-g");
|
|
96213
|
-
for (const p of safeProviders) {
|
|
96214
|
-
parts.push("--agent", p);
|
|
96215
|
-
}
|
|
96216
|
-
parts.push("--yes");
|
|
96217
|
-
const cmd = parts.join(" ");
|
|
96218
|
-
logger.info(`Auto-migrating to: ${providerNames}`);
|
|
96219
|
-
try {
|
|
96220
|
-
await execAsyncFn(cmd, { timeout: 300000 });
|
|
96221
|
-
logger.success("Auto-migration complete");
|
|
96222
|
-
} catch (error) {
|
|
96223
|
-
logger.warning(`Auto-migration failed: ${error instanceof Error ? error.message : "unknown"}. Run \`ck migrate\` manually to retry.`);
|
|
96224
|
-
}
|
|
96225
|
-
}
|
|
96226
|
-
|
|
96227
|
-
// src/commands/init/phases/post-install-handler.ts
|
|
96228
96190
|
async function handlePostInstall(ctx) {
|
|
96229
96191
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir || !ctx.claudeDir) {
|
|
96230
96192
|
return ctx;
|
|
@@ -96294,7 +96256,6 @@ async function handlePostInstall(ctx) {
|
|
|
96294
96256
|
logger.debug(`Project auto-registration skipped: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
96295
96257
|
}
|
|
96296
96258
|
}
|
|
96297
|
-
await maybePostInitMigrate(ctx);
|
|
96298
96259
|
return {
|
|
96299
96260
|
...ctx,
|
|
96300
96261
|
installSkills
|
|
@@ -96335,9 +96296,9 @@ async function detectAccessibleKits() {
|
|
|
96335
96296
|
|
|
96336
96297
|
// src/domains/github/preflight-checker.ts
|
|
96337
96298
|
init_logger();
|
|
96338
|
-
import { exec as
|
|
96339
|
-
import { promisify as
|
|
96340
|
-
var
|
|
96299
|
+
import { exec as exec8 } from "node:child_process";
|
|
96300
|
+
import { promisify as promisify14 } from "node:util";
|
|
96301
|
+
var execAsync8 = promisify14(exec8);
|
|
96341
96302
|
function createSuccessfulPreflightResult() {
|
|
96342
96303
|
return {
|
|
96343
96304
|
success: true,
|
|
@@ -96370,7 +96331,7 @@ async function runPreflightChecks() {
|
|
|
96370
96331
|
errorLines: []
|
|
96371
96332
|
};
|
|
96372
96333
|
try {
|
|
96373
|
-
const { stdout: stdout2 } = await
|
|
96334
|
+
const { stdout: stdout2 } = await execAsync8("gh --version", { timeout: GH_COMMAND_TIMEOUT_MS });
|
|
96374
96335
|
const match2 = stdout2.match(/(\d+\.\d+\.\d+)/);
|
|
96375
96336
|
if (!match2) {
|
|
96376
96337
|
logger.debug(`GitHub CLI version not detected from output: ${stdout2.trim()}`);
|
|
@@ -96408,7 +96369,7 @@ async function runPreflightChecks() {
|
|
|
96408
96369
|
}
|
|
96409
96370
|
}
|
|
96410
96371
|
try {
|
|
96411
|
-
await
|
|
96372
|
+
await execAsync8("gh auth status -h github.com", {
|
|
96412
96373
|
timeout: GH_COMMAND_TIMEOUT_MS,
|
|
96413
96374
|
env: { ...process.env, GH_NO_UPDATE_NOTIFIER: "1" }
|
|
96414
96375
|
});
|
|
@@ -96950,8 +96911,11 @@ async function handleSelection(ctx) {
|
|
|
96950
96911
|
logger.success(`Found: ${release.tag_name}`);
|
|
96951
96912
|
}
|
|
96952
96913
|
}
|
|
96914
|
+
if (ctx.options.force && !ctx.options.yes) {
|
|
96915
|
+
logger.info("--force has no effect without --yes (the version-match skip only applies in non-interactive mode)");
|
|
96916
|
+
}
|
|
96953
96917
|
const releaseTag = release?.tag_name;
|
|
96954
|
-
if (ctx.options.yes && !ctx.options.fresh && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
96918
|
+
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
96955
96919
|
try {
|
|
96956
96920
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
96957
96921
|
const claudeDir2 = prefix ? join111(resolvedDir, prefix) : resolvedDir;
|
|
@@ -97882,6 +97846,7 @@ function createInitContext(rawOptions, prompts) {
|
|
|
97882
97846
|
global: false,
|
|
97883
97847
|
yes: false,
|
|
97884
97848
|
fresh: false,
|
|
97849
|
+
force: false,
|
|
97885
97850
|
refresh: false,
|
|
97886
97851
|
exclude: [],
|
|
97887
97852
|
only: [],
|
|
@@ -100234,6 +100199,7 @@ async function handleKitSelection(ctx) {
|
|
|
100234
100199
|
exclude: [],
|
|
100235
100200
|
only: [],
|
|
100236
100201
|
fresh: false,
|
|
100202
|
+
force: false,
|
|
100237
100203
|
installSkills: false,
|
|
100238
100204
|
withSudo: false,
|
|
100239
100205
|
prefix: false,
|
|
@@ -103163,7 +103129,7 @@ function registerCommands(cli) {
|
|
|
103163
103129
|
}
|
|
103164
103130
|
await newCommand(options2);
|
|
103165
103131
|
});
|
|
103166
|
-
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, all, or comma-separated").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", "Full reset: remove CK files, replace settings.json and CLAUDE.md, reinstall from scratch").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)").option("--sync", "Sync config files from upstream with interactive hunk-by-hunk merge").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
103132
|
+
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, all, or comma-separated").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", "Full reset: remove CK files, replace settings.json and CLAUDE.md, reinstall from scratch").option("--force", "Force reinstall even if already at latest version (use with --yes; re-onboards missing files without full reset)").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)").option("--sync", "Sync config files from upstream with interactive hunk-by-hunk merge").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
103167
103133
|
if (options2.exclude && !Array.isArray(options2.exclude)) {
|
|
103168
103134
|
options2.exclude = [options2.exclude];
|
|
103169
103135
|
}
|