claudekit-cli 3.36.0-dev.36 → 3.36.0-dev.37

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
@@ -10971,6 +10971,16 @@ var init_fm_to_yaml = __esm(() => {
10971
10971
  });
10972
10972
 
10973
10973
  // src/commands/portable/provider-registry.ts
10974
+ var exports_provider_registry = {};
10975
+ __export(exports_provider_registry, {
10976
+ providers: () => providers,
10977
+ getProvidersSupporting: () => getProvidersSupporting,
10978
+ getProviderConfig: () => getProviderConfig,
10979
+ getPortableInstallPath: () => getPortableInstallPath,
10980
+ getAllProviderTypes: () => getAllProviderTypes,
10981
+ detectProviderPathCollisions: () => detectProviderPathCollisions,
10982
+ detectInstalledProviders: () => detectInstalledProviders
10983
+ });
10974
10984
  import { existsSync, readdirSync, statSync } from "node:fs";
10975
10985
  import { homedir } from "node:os";
10976
10986
  import { join } from "node:path";
@@ -10994,6 +11004,12 @@ function hasInstallSignal(path) {
10994
11004
  function hasAnyInstallSignal(paths) {
10995
11005
  return paths.some((path) => hasInstallSignal(path));
10996
11006
  }
11007
+ function getAllProviderTypes() {
11008
+ return Object.keys(providers);
11009
+ }
11010
+ function getProviderConfig(type) {
11011
+ return providers[type];
11012
+ }
10997
11013
  async function detectInstalledProviders() {
10998
11014
  const installed = [];
10999
11015
  for (const [type, config] of Object.entries(providers)) {
@@ -11006,6 +11022,19 @@ async function detectInstalledProviders() {
11006
11022
  function getProvidersSupporting(type) {
11007
11023
  return Object.entries(providers).filter(([, config]) => config[type] != null).map(([name]) => name);
11008
11024
  }
11025
+ function getPortableInstallPath(itemName, provider, portableType, options2) {
11026
+ const config = providers[provider];
11027
+ const pathConfig = config[portableType];
11028
+ if (!pathConfig)
11029
+ return null;
11030
+ const basePath = options2.global ? pathConfig.globalPath : pathConfig.projectPath;
11031
+ if (!basePath)
11032
+ return null;
11033
+ if (pathConfig.writeStrategy === "merge-single" || pathConfig.writeStrategy === "yaml-merge" || pathConfig.writeStrategy === "json-merge" || pathConfig.writeStrategy === "single-file") {
11034
+ return basePath;
11035
+ }
11036
+ return join(basePath, `${itemName}${pathConfig.fileExtension}`);
11037
+ }
11009
11038
  function detectProviderPathCollisions(selectedProviders, options2) {
11010
11039
  const portableTypes = ["agents", "commands", "skills", "config", "rules", "hooks"];
11011
11040
  const collisions = [];
@@ -12185,6 +12214,18 @@ function isUnknownChecksum(checksum) {
12185
12214
  var UNKNOWN_CHECKSUM = "unknown";
12186
12215
 
12187
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
+ });
12188
12229
  import { existsSync as existsSync2 } from "node:fs";
12189
12230
  import { mkdir, readFile as readFile2, rename, unlink, writeFile } from "node:fs/promises";
12190
12231
  import { homedir as homedir3 } from "node:os";
@@ -12444,6 +12485,9 @@ function findPortableInstallations(registry, item, type, provider, global2) {
12444
12485
  return true;
12445
12486
  });
12446
12487
  }
12488
+ function getInstallationsByType(registry, type) {
12489
+ return registry.installations.filter((i) => i.type === type);
12490
+ }
12447
12491
  async function updateAppliedManifestVersion(version) {
12448
12492
  await withRegistryLock(async () => {
12449
12493
  const registry = await readPortableRegistry();
@@ -42177,7 +42221,7 @@ var init_claudekit_data = __esm(() => {
42177
42221
  });
42178
42222
 
42179
42223
  // src/types/ck-config.ts
42180
- var PlanValidationModeSchema, PlanFocusAreaSchema, PlanResolutionOrderSchema, ProjectTypeSchema, PackageManagerSchema, FrameworkSchema, GeminiModelSchema, StatuslineModeSchema, CodingLevelSchema, PlanResolutionSchema, PlanValidationSchema, CkPlanConfigSchema, CkDocsConfigSchema, CkPathsConfigSchema, CkLocaleConfigSchema, CkTrustConfigSchema, CkProjectConfigSchema, CkGeminiConfigSchema, CkSkillsConfigSchema, ResolvedModelConfigSchema, ModelTierMapSchema, CkModelTaxonomySchema, CkAssertionSchema, CkHooksConfigSchema, CkConfigSchema, DEFAULT_CK_CONFIG, CK_HOOK_NAMES;
42224
+ var PlanValidationModeSchema, PlanFocusAreaSchema, PlanResolutionOrderSchema, ProjectTypeSchema, PackageManagerSchema, FrameworkSchema, GeminiModelSchema, StatuslineModeSchema, CodingLevelSchema, PlanResolutionSchema, PlanValidationSchema, CkPlanConfigSchema, CkDocsConfigSchema, CkPathsConfigSchema, CkLocaleConfigSchema, CkTrustConfigSchema, CkProjectConfigSchema, CkGeminiConfigSchema, CkSkillsConfigSchema, UpdatePipelineSchema, ResolvedModelConfigSchema, ModelTierMapSchema, CkModelTaxonomySchema, CkAssertionSchema, CkHooksConfigSchema, CkConfigSchema, DEFAULT_CK_CONFIG, CK_HOOK_NAMES;
42181
42225
  var init_ck_config = __esm(() => {
42182
42226
  init_zod();
42183
42227
  PlanValidationModeSchema = exports_external.enum(["prompt", "auto", "strict", "none"]);
@@ -42270,6 +42314,11 @@ var init_ck_config = __esm(() => {
42270
42314
  useGemini: exports_external.boolean().optional()
42271
42315
  }).passthrough().optional()
42272
42316
  }).passthrough();
42317
+ UpdatePipelineSchema = exports_external.object({
42318
+ autoInitAfterUpdate: exports_external.boolean().default(false),
42319
+ autoMigrateAfterInit: exports_external.boolean().default(false),
42320
+ migrateProviders: exports_external.union([exports_external.literal("auto"), exports_external.array(exports_external.string())]).default("auto")
42321
+ });
42273
42322
  ResolvedModelConfigSchema = exports_external.object({
42274
42323
  model: exports_external.string(),
42275
42324
  effort: exports_external.string().optional()
@@ -42312,6 +42361,7 @@ var init_ck_config = __esm(() => {
42312
42361
  skills: CkSkillsConfigSchema.optional(),
42313
42362
  assertions: exports_external.array(CkAssertionSchema).optional(),
42314
42363
  hooks: CkHooksConfigSchema.optional(),
42364
+ updatePipeline: UpdatePipelineSchema.optional(),
42315
42365
  modelTaxonomy: CkModelTaxonomySchema.optional()
42316
42366
  }).passthrough();
42317
42367
  DEFAULT_CK_CONFIG = {
@@ -42374,6 +42424,11 @@ var init_ck_config = __esm(() => {
42374
42424
  "scout-block": true,
42375
42425
  "privacy-block": true,
42376
42426
  "post-edit-simplify-reminder": true
42427
+ },
42428
+ updatePipeline: {
42429
+ autoInitAfterUpdate: false,
42430
+ autoMigrateAfterInit: false,
42431
+ migrateProviders: "auto"
42377
42432
  }
42378
42433
  };
42379
42434
  CK_HOOK_NAMES = [
@@ -48320,6 +48375,31 @@ var init_ck_config_schema = __esm(() => {
48320
48375
  },
48321
48376
  additionalProperties: false
48322
48377
  },
48378
+ updatePipeline: {
48379
+ type: "object",
48380
+ description: "Auto-chaining behavior for update -> init -> migrate pipeline",
48381
+ properties: {
48382
+ autoInitAfterUpdate: {
48383
+ type: "boolean",
48384
+ default: false,
48385
+ description: "Automatically run ck init after ck update when kit has new version"
48386
+ },
48387
+ autoMigrateAfterInit: {
48388
+ type: "boolean",
48389
+ default: false,
48390
+ description: "Automatically run ck migrate after ck init for detected providers"
48391
+ },
48392
+ migrateProviders: {
48393
+ oneOf: [
48394
+ { type: "string", const: "auto" },
48395
+ { type: "array", items: { type: "string" } }
48396
+ ],
48397
+ default: "auto",
48398
+ description: "Which providers to auto-migrate. 'auto' scans filesystem."
48399
+ }
48400
+ },
48401
+ additionalProperties: false
48402
+ },
48323
48403
  modelTaxonomy: {
48324
48404
  type: "object",
48325
48405
  description: "Custom model mappings for portable migration. Keys are provider names (e.g., 'codex', 'gemini-cli'), values map tiers to model config.",
@@ -56639,7 +56719,7 @@ var package_default;
56639
56719
  var init_package = __esm(() => {
56640
56720
  package_default = {
56641
56721
  name: "claudekit-cli",
56642
- version: "3.36.0-dev.36",
56722
+ version: "3.36.0-dev.37",
56643
56723
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
56644
56724
  type: "module",
56645
56725
  repository: {
@@ -58038,7 +58118,11 @@ async function fetchLatestReleaseTag(kit, beta) {
58038
58118
  async function promptKitUpdate(beta, yes, deps) {
58039
58119
  try {
58040
58120
  const execFn = deps?.execAsyncFn ?? execAsync2;
58041
- const setup = await (deps?.getSetupFn ?? getClaudeKitSetup)();
58121
+ const loadFullConfigFn = deps?.loadFullConfigFn ?? CkConfigManager.loadFull;
58122
+ const confirmFn = deps?.confirmFn ?? se;
58123
+ const isCancelFn = deps?.isCancelFn ?? lD;
58124
+ const getSetupFn = deps?.getSetupFn ?? getClaudeKitSetup;
58125
+ const setup = await getSetupFn();
58042
58126
  const hasLocal = !!setup.project.metadata;
58043
58127
  const hasGlobal = !!setup.global.metadata;
58044
58128
  const localMetadata = hasLocal ? await readMetadataFile(setup.project.path) : null;
@@ -58068,15 +58152,22 @@ async function promptKitUpdate(beta, yes, deps) {
58068
58152
  logger.info(`Kit update available: ${kitVersion} -> ${latestTag}`);
58069
58153
  }
58070
58154
  }
58071
- if (!yes) {
58155
+ let autoInit = false;
58156
+ try {
58157
+ const ckConfig = await loadFullConfigFn(null);
58158
+ autoInit = ckConfig.config.updatePipeline?.autoInitAfterUpdate ?? false;
58159
+ } catch {}
58160
+ if (!yes && !autoInit) {
58072
58161
  logger.info("");
58073
- const shouldUpdate = await se({
58162
+ const shouldUpdate = await confirmFn({
58074
58163
  message: promptMessage
58075
58164
  });
58076
- if (lD(shouldUpdate) || !shouldUpdate) {
58165
+ if (isCancelFn(shouldUpdate) || !shouldUpdate) {
58077
58166
  log.info("Skipped kit content update");
58078
58167
  return;
58079
58168
  }
58169
+ } else if (autoInit && !yes) {
58170
+ logger.info("Auto-running kit update (updatePipeline.autoInitAfterUpdate is enabled)");
58080
58171
  } else {
58081
58172
  logger.verbose("Auto-proceeding with kit update (--yes flag)");
58082
58173
  }
@@ -58286,6 +58377,7 @@ Manual update: ${redactCommandForLog(updateCmd)}`;
58286
58377
  }
58287
58378
  var import_compare_versions3, import_fs_extra5, execAsync2, CliUpdateError;
58288
58379
  var init_update_cli = __esm(() => {
58380
+ init_ck_config_manager();
58289
58381
  init_npm_registry();
58290
58382
  init_package_manager_detector();
58291
58383
  init_metadata_migration();
@@ -95396,6 +95488,116 @@ import { join as join108 } from "node:path";
95396
95488
  init_logger();
95397
95489
  init_path_resolver();
95398
95490
  var import_fs_extra30 = __toESM(require_lib3(), 1);
95491
+
95492
+ // src/commands/init/phases/post-init-migrate-nudge.ts
95493
+ init_ck_config_manager();
95494
+ init_logger();
95495
+ init_safe_prompts();
95496
+ import { exec as exec8 } from "node:child_process";
95497
+ import { promisify as promisify14 } from "node:util";
95498
+ var execAsync8 = promisify14(exec8);
95499
+ var SAFE_PROVIDER_NAME = /^[a-z0-9-]+$/;
95500
+ async function maybePostInitMigrate(ctx, deps) {
95501
+ if (ctx.cancelled || !ctx.resolvedDir)
95502
+ return;
95503
+ try {
95504
+ const providerRegistry = deps?.detectInstalledProvidersFn && deps?.getProviderConfigFn ? null : await Promise.resolve().then(() => (init_provider_registry(), exports_provider_registry));
95505
+ const portableRegistry = deps?.readPortableRegistryFn ? null : await Promise.resolve().then(() => (init_portable_registry(), exports_portable_registry));
95506
+ const detectInstalledProvidersFn = deps?.detectInstalledProvidersFn ?? providerRegistry?.detectInstalledProviders;
95507
+ const getProviderConfigFn = deps?.getProviderConfigFn ?? providerRegistry?.getProviderConfig;
95508
+ const readPortableRegistryFn = deps?.readPortableRegistryFn ?? portableRegistry?.readPortableRegistry;
95509
+ const loadFullConfigFn = deps?.loadFullConfigFn ?? CkConfigManager.loadFull;
95510
+ if (!detectInstalledProvidersFn || !getProviderConfigFn || !readPortableRegistryFn) {
95511
+ return;
95512
+ }
95513
+ const allProviders = await detectInstalledProvidersFn();
95514
+ const targets = allProviders.filter((p) => p !== "claude-code");
95515
+ if (targets.length === 0)
95516
+ return;
95517
+ const providerNames = targets.map((p) => getProviderConfigFn(p).displayName).join(", ");
95518
+ const registry = await readPortableRegistryFn();
95519
+ const hasHistory = registry.installations.some((i) => i.provider !== "claude-code");
95520
+ const ckConfig = await loadFullConfigFn(ctx.options.global ? null : ctx.resolvedDir);
95521
+ const pipeline = ckConfig.config.updatePipeline;
95522
+ const autoMigrate = pipeline?.autoMigrateAfterInit ?? false;
95523
+ if (autoMigrate) {
95524
+ await runAutoMigrate(ctx, pipeline, targets, providerNames, deps);
95525
+ } else if (!hasHistory && !ctx.isNonInteractive) {
95526
+ await showNudge(ctx, providerNames, deps);
95527
+ }
95528
+ } catch (error) {
95529
+ logger.debug(`Post-init migrate check skipped: ${error instanceof Error ? error.message : "unknown"}`);
95530
+ }
95531
+ }
95532
+ async function showNudge(ctx, providerNames, deps) {
95533
+ const noteFn = deps?.noteFn ?? note;
95534
+ const confirmFn = deps?.confirmFn ?? se;
95535
+ const isCancelFn = deps?.isCancelFn ?? lD;
95536
+ const execAsyncFn = deps?.execAsyncFn ?? execAsync8;
95537
+ noteFn([
95538
+ `Detected providers: ${providerNames}`,
95539
+ "Run `ck migrate` to sync your kit to these providers.",
95540
+ "Set `autoMigrateAfterInit: true` in .ck.json to auto-sync on future updates."
95541
+ ].join(`
95542
+ `), "[i] Provider Sync Available");
95543
+ const shouldMigrate = await confirmFn({
95544
+ message: "Run ck migrate now?"
95545
+ });
95546
+ if (isCancelFn(shouldMigrate) || !shouldMigrate)
95547
+ return;
95548
+ const parts = ["ck", "migrate"];
95549
+ if (ctx.options.global)
95550
+ parts.push("-g");
95551
+ parts.push("--yes");
95552
+ const cmd = parts.join(" ");
95553
+ try {
95554
+ logger.info(`Running: ${cmd}`);
95555
+ await execAsyncFn(cmd, { timeout: 300000 });
95556
+ logger.success("Migration complete");
95557
+ } catch (error) {
95558
+ logger.warning(`Migration failed: ${error instanceof Error ? error.message : "unknown"}. Run \`ck migrate\` manually to retry.`);
95559
+ }
95560
+ }
95561
+ async function runAutoMigrate(ctx, pipeline, detectedTargets, providerNames, deps) {
95562
+ const execAsyncFn = deps?.execAsyncFn ?? execAsync8;
95563
+ let providers2;
95564
+ if (!pipeline?.migrateProviders || pipeline.migrateProviders === "auto") {
95565
+ providers2 = detectedTargets;
95566
+ } else if (Array.isArray(pipeline.migrateProviders)) {
95567
+ const invalid = pipeline.migrateProviders.filter((p) => !detectedTargets.includes(p));
95568
+ if (invalid.length > 0) {
95569
+ logger.warning(`Unknown/uninstalled providers in migrateProviders: ${invalid.join(", ")}`);
95570
+ }
95571
+ providers2 = pipeline.migrateProviders.filter((p) => detectedTargets.includes(p));
95572
+ } else {
95573
+ return;
95574
+ }
95575
+ if (providers2.length === 0)
95576
+ return;
95577
+ const safeProviders = providers2.filter((p) => SAFE_PROVIDER_NAME.test(p));
95578
+ if (safeProviders.length !== providers2.length) {
95579
+ logger.warning("Some provider names contain invalid characters and were skipped");
95580
+ }
95581
+ if (safeProviders.length === 0)
95582
+ return;
95583
+ const parts = ["ck", "migrate"];
95584
+ if (ctx.options.global)
95585
+ parts.push("-g");
95586
+ for (const p of safeProviders) {
95587
+ parts.push("--agent", p);
95588
+ }
95589
+ parts.push("--yes");
95590
+ const cmd = parts.join(" ");
95591
+ logger.info(`Auto-migrating to: ${providerNames}`);
95592
+ try {
95593
+ await execAsyncFn(cmd, { timeout: 300000 });
95594
+ logger.success("Auto-migration complete");
95595
+ } catch (error) {
95596
+ logger.warning(`Auto-migration failed: ${error instanceof Error ? error.message : "unknown"}. Run \`ck migrate\` manually to retry.`);
95597
+ }
95598
+ }
95599
+
95600
+ // src/commands/init/phases/post-install-handler.ts
95399
95601
  async function handlePostInstall(ctx) {
95400
95602
  if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir || !ctx.claudeDir) {
95401
95603
  return ctx;
@@ -95465,6 +95667,7 @@ async function handlePostInstall(ctx) {
95465
95667
  logger.debug(`Project auto-registration skipped: ${error instanceof Error ? error.message : "Unknown error"}`);
95466
95668
  }
95467
95669
  }
95670
+ await maybePostInitMigrate(ctx);
95468
95671
  return {
95469
95672
  ...ctx,
95470
95673
  installSkills
@@ -95505,9 +95708,9 @@ async function detectAccessibleKits() {
95505
95708
 
95506
95709
  // src/domains/github/preflight-checker.ts
95507
95710
  init_logger();
95508
- import { exec as exec8 } from "node:child_process";
95509
- import { promisify as promisify14 } from "node:util";
95510
- var execAsync8 = promisify14(exec8);
95711
+ import { exec as exec9 } from "node:child_process";
95712
+ import { promisify as promisify15 } from "node:util";
95713
+ var execAsync9 = promisify15(exec9);
95511
95714
  function createSuccessfulPreflightResult() {
95512
95715
  return {
95513
95716
  success: true,
@@ -95540,7 +95743,7 @@ async function runPreflightChecks() {
95540
95743
  errorLines: []
95541
95744
  };
95542
95745
  try {
95543
- const { stdout: stdout2 } = await execAsync8("gh --version", { timeout: GH_COMMAND_TIMEOUT_MS });
95746
+ const { stdout: stdout2 } = await execAsync9("gh --version", { timeout: GH_COMMAND_TIMEOUT_MS });
95544
95747
  const match2 = stdout2.match(/(\d+\.\d+\.\d+)/);
95545
95748
  if (!match2) {
95546
95749
  logger.debug(`GitHub CLI version not detected from output: ${stdout2.trim()}`);
@@ -95578,7 +95781,7 @@ async function runPreflightChecks() {
95578
95781
  }
95579
95782
  }
95580
95783
  try {
95581
- await execAsync8("gh auth status -h github.com", {
95784
+ await execAsync9("gh auth status -h github.com", {
95582
95785
  timeout: GH_COMMAND_TIMEOUT_MS,
95583
95786
  env: { ...process.env, GH_NO_UPDATE_NOTIFIER: "1" }
95584
95787
  });