claudekit-cli 3.37.0-dev.2 → 3.37.0-dev.3

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
@@ -42221,6 +42221,68 @@ var init_claudekit_data = __esm(() => {
42221
42221
  });
42222
42222
 
42223
42223
  // src/types/ck-config.ts
42224
+ function normalizeMigrateProviderToken(token) {
42225
+ const trimmed = token.trim();
42226
+ const unwrapped = trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'") ? trimmed.slice(1, -1) : trimmed;
42227
+ return unwrapped.trim().toLowerCase();
42228
+ }
42229
+ function parseMigrateProvidersString(value) {
42230
+ const trimmed = value.trim();
42231
+ if (!trimmed)
42232
+ return [];
42233
+ try {
42234
+ const parsed = JSON.parse(trimmed);
42235
+ if (typeof parsed === "string" || Array.isArray(parsed)) {
42236
+ return parsed;
42237
+ }
42238
+ } catch {}
42239
+ if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
42240
+ return trimmed.slice(1, -1).split(",").map((part) => part.trim()).filter(Boolean);
42241
+ }
42242
+ return trimmed;
42243
+ }
42244
+ function normalizeMigrateProviderList(value) {
42245
+ const parts = value.map(normalizeMigrateProviderToken).filter(Boolean).filter((part, index, list) => list.indexOf(part) === index);
42246
+ if (parts.length === 0 || parts.length === 1 && parts[0] === "auto") {
42247
+ return "auto";
42248
+ }
42249
+ return parts.filter((part) => part !== "auto");
42250
+ }
42251
+ function normalizeMigrateProvidersValue(value) {
42252
+ if (typeof value === "string") {
42253
+ const parsed = parseMigrateProvidersString(value);
42254
+ const parts = Array.isArray(parsed) ? parsed : String(parsed).split(",");
42255
+ return normalizeMigrateProviderList(parts);
42256
+ }
42257
+ if (Array.isArray(value)) {
42258
+ return normalizeMigrateProviderList(value.filter((item) => typeof item === "string"));
42259
+ }
42260
+ if (typeof value === "number" || typeof value === "boolean") {
42261
+ return normalizeMigrateProvidersValue(String(value));
42262
+ }
42263
+ return value;
42264
+ }
42265
+ function normalizeMigrateProvidersInput(value) {
42266
+ const normalized = normalizeMigrateProvidersValue(value);
42267
+ if (normalized === "auto" || Array.isArray(normalized)) {
42268
+ return normalized;
42269
+ }
42270
+ return normalizeMigrateProviderList(String(normalized).split(","));
42271
+ }
42272
+ function normalizeCkConfigInput(value) {
42273
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
42274
+ return value;
42275
+ }
42276
+ const normalized = structuredClone(value);
42277
+ const updatePipeline = normalized.updatePipeline;
42278
+ if (updatePipeline && typeof updatePipeline === "object" && !Array.isArray(updatePipeline)) {
42279
+ const pipeline = updatePipeline;
42280
+ if ("migrateProviders" in pipeline) {
42281
+ pipeline.migrateProviders = normalizeMigrateProvidersValue(pipeline.migrateProviders);
42282
+ }
42283
+ }
42284
+ return normalized;
42285
+ }
42224
42286
  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;
42225
42287
  var init_ck_config = __esm(() => {
42226
42288
  init_zod();
@@ -42447,6 +42509,8 @@ var init_ck_config = __esm(() => {
42447
42509
  // src/types/index.ts
42448
42510
  var exports_types = {};
42449
42511
  __export(exports_types, {
42512
+ normalizeMigrateProvidersInput: () => normalizeMigrateProvidersInput,
42513
+ normalizeCkConfigInput: () => normalizeCkConfigInput,
42450
42514
  isValidKitType: () => isValidKitType,
42451
42515
  VidcapOptionsSchema: () => VidcapOptionsSchema,
42452
42516
  VersionCommandOptionsSchema: () => VersionCommandOptionsSchema,
@@ -42809,7 +42873,7 @@ class CkConfigManager {
42809
42873
  if (!existsSync12(configPath))
42810
42874
  return null;
42811
42875
  const content = await readFile8(configPath, "utf-8");
42812
- const data = JSON.parse(content);
42876
+ const data = normalizeCkConfigInput(JSON.parse(content));
42813
42877
  return CkConfigSchema.parse(data);
42814
42878
  } catch (error) {
42815
42879
  logger.warning(`Failed to load config from ${configPath}: ${error instanceof Error ? error.message : "Unknown"}`);
@@ -42863,7 +42927,7 @@ class CkConfigManager {
42863
42927
  };
42864
42928
  }
42865
42929
  static async saveFull(config, scope, projectDir) {
42866
- const validConfig = CkConfigSchema.parse(config);
42930
+ const validConfig = CkConfigSchema.parse(normalizeCkConfigInput(config));
42867
42931
  const configPath = scope === "global" ? CkConfigManager.getGlobalConfigPath() : projectDir ? CkConfigManager.getProjectConfigPath(projectDir) : null;
42868
42932
  if (!configPath) {
42869
42933
  throw new Error("Project directory required for project scope");
@@ -48565,7 +48629,7 @@ function registerCkConfigRoutes(app) {
48565
48629
  res.status(400).json({ error: "Invalid config payload" });
48566
48630
  return;
48567
48631
  }
48568
- const parseResult = CkConfigSchema.safeParse(config);
48632
+ const parseResult = CkConfigSchema.safeParse(normalizeCkConfigInput(config));
48569
48633
  if (!parseResult.success) {
48570
48634
  res.status(400).json({
48571
48635
  error: "Config validation failed",
@@ -56780,7 +56844,7 @@ var package_default;
56780
56844
  var init_package = __esm(() => {
56781
56845
  package_default = {
56782
56846
  name: "claudekit-cli",
56783
- version: "3.37.0-dev.2",
56847
+ version: "3.37.0-dev.3",
56784
56848
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
56785
56849
  type: "module",
56786
56850
  repository: {