claudekit-cli 3.35.0-dev.7 → 3.35.0-dev.9

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
@@ -9320,7 +9320,8 @@ var init_provider_registry = __esm(() => {
9320
9320
  globalPath: join(home, ".codex/prompts"),
9321
9321
  format: "direct-copy",
9322
9322
  writeStrategy: "per-file",
9323
- fileExtension: ".md"
9323
+ fileExtension: ".md",
9324
+ nestedCommands: false
9324
9325
  },
9325
9326
  skills: {
9326
9327
  projectPath: ".codex/skills",
@@ -9495,7 +9496,8 @@ var init_provider_registry = __esm(() => {
9495
9496
  globalPath: join(home, ".codeium/windsurf/workflows"),
9496
9497
  format: "direct-copy",
9497
9498
  writeStrategy: "per-file",
9498
- fileExtension: ".md"
9499
+ fileExtension: ".md",
9500
+ nestedCommands: false
9499
9501
  },
9500
9502
  skills: {
9501
9503
  projectPath: ".windsurf/skills",
@@ -9674,7 +9676,8 @@ var init_provider_registry = __esm(() => {
9674
9676
  globalPath: join(home, ".gemini/antigravity/global_workflows"),
9675
9677
  format: "direct-copy",
9676
9678
  writeStrategy: "per-file",
9677
- fileExtension: ".md"
9679
+ fileExtension: ".md",
9680
+ nestedCommands: false
9678
9681
  },
9679
9682
  skills: {
9680
9683
  projectPath: ".agent/skills",
@@ -11945,7 +11948,7 @@ function parseMergedSections(content, kind) {
11945
11948
  if (kind === "agent") {
11946
11949
  preamble = preamble.replace(/^# Agents\n\n> Ported from Claude Code agents via ClaudeKit CLI \(ck agents\)\n> Target: .*\n+/s, "").trimEnd();
11947
11950
  } else {
11948
- preamble = preamble.replace(/^# Rules\n\n> Ported from Claude Code rules via ClaudeKit CLI \(ck port --rules\)\n> Target: .*\n+/s, "").trimEnd();
11951
+ preamble = preamble.replace(/^# Rules\n\n> Ported from Claude Code rules via ClaudeKit CLI \(ck migrate --rules\)\n> Target: .*\n+/s, "").trimEnd();
11949
11952
  }
11950
11953
  return {
11951
11954
  sections,
@@ -12017,7 +12020,14 @@ async function installPerFile(item, provider, portableType, options2) {
12017
12020
  warnings: result.warnings.length > 0 ? result.warnings : undefined
12018
12021
  };
12019
12022
  }
12020
- targetPath = pathConfig.writeStrategy === "single-file" ? basePath : join3(basePath, result.filename);
12023
+ let resolvedFilename = result.filename;
12024
+ if (pathConfig.nestedCommands === false && resolvedFilename.includes("/")) {
12025
+ const extIdx = resolvedFilename.lastIndexOf(".");
12026
+ const ext = extIdx >= 0 ? resolvedFilename.substring(extIdx) : "";
12027
+ const nameWithoutExt = extIdx >= 0 ? resolvedFilename.substring(0, extIdx) : resolvedFilename;
12028
+ resolvedFilename = `${nameWithoutExt.replace(/\//g, "-")}${ext}`;
12029
+ }
12030
+ targetPath = pathConfig.writeStrategy === "single-file" ? basePath : join3(basePath, resolvedFilename);
12021
12031
  const resolvedTarget = resolve(targetPath);
12022
12032
  const resolvedBase = pathConfig.writeStrategy === "single-file" ? resolve(dirname2(basePath)) : resolve(basePath);
12023
12033
  if (!resolvedTarget.startsWith(resolvedBase + sep) && resolvedTarget !== resolvedBase) {
@@ -45691,7 +45701,7 @@ function registerHealthRoutes(app) {
45691
45701
  });
45692
45702
  }
45693
45703
 
45694
- // src/commands/port/skill-directory-installer.ts
45704
+ // src/commands/migrate/skill-directory-installer.ts
45695
45705
  import { existsSync as existsSync14 } from "node:fs";
45696
45706
  import { cp, mkdir as mkdir6 } from "node:fs/promises";
45697
45707
  import { join as join17, resolve as resolve6 } from "node:path";
@@ -48830,7 +48840,7 @@ var package_default;
48830
48840
  var init_package = __esm(() => {
48831
48841
  package_default = {
48832
48842
  name: "claudekit-cli",
48833
- version: "3.35.0-dev.7",
48843
+ version: "3.35.0-dev.9",
48834
48844
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
48835
48845
  type: "module",
48836
48846
  repository: {
@@ -61667,21 +61677,21 @@ var init_commands_command_help = __esm(() => {
61667
61677
  };
61668
61678
  });
61669
61679
 
61670
- // src/domains/help/commands/port-command-help.ts
61671
- var portCommandHelp;
61672
- var init_port_command_help = __esm(() => {
61673
- portCommandHelp = {
61674
- name: "port",
61675
- description: "Port agents, commands, skills, config, and rules to other providers",
61676
- usage: "ck port [options]",
61680
+ // src/domains/help/commands/migrate-command-help.ts
61681
+ var migrateCommandHelp;
61682
+ var init_migrate_command_help = __esm(() => {
61683
+ migrateCommandHelp = {
61684
+ name: "migrate",
61685
+ description: "Migrate agents, commands, skills, config, and rules to other providers",
61686
+ usage: "ck migrate [options]",
61677
61687
  examples: [
61678
61688
  {
61679
- command: "ck port --agent codex --agent opencode",
61680
- description: "Port all supported content to selected providers"
61689
+ command: "ck migrate --agent codex --agent opencode",
61690
+ description: "Migrate all supported content to selected providers"
61681
61691
  },
61682
61692
  {
61683
- command: "ck port --config --source ./CLAUDE.md",
61684
- description: "Port only config from a specific source file"
61693
+ command: "ck migrate --config --source ./CLAUDE.md",
61694
+ description: "Migrate only config from a specific source file"
61685
61695
  }
61686
61696
  ],
61687
61697
  optionGroups: [
@@ -61694,7 +61704,7 @@ var init_port_command_help = __esm(() => {
61694
61704
  },
61695
61705
  {
61696
61706
  flags: "--all",
61697
- description: "Port to all supported providers"
61707
+ description: "Migrate to all supported providers"
61698
61708
  },
61699
61709
  {
61700
61710
  flags: "-g, --global",
@@ -61711,19 +61721,19 @@ var init_port_command_help = __esm(() => {
61711
61721
  options: [
61712
61722
  {
61713
61723
  flags: "--config",
61714
- description: "Port CLAUDE.md config only"
61724
+ description: "Migrate CLAUDE.md config only"
61715
61725
  },
61716
61726
  {
61717
61727
  flags: "--rules",
61718
- description: "Port .claude/rules only"
61728
+ description: "Migrate .claude/rules only"
61719
61729
  },
61720
61730
  {
61721
61731
  flags: "--skip-config",
61722
- description: "Skip config porting"
61732
+ description: "Skip config migration"
61723
61733
  },
61724
61734
  {
61725
61735
  flags: "--skip-rules",
61726
- description: "Skip rules porting"
61736
+ description: "Skip rules migration"
61727
61737
  },
61728
61738
  {
61729
61739
  flags: "--source <path>",
@@ -61749,7 +61759,7 @@ var init_commands2 = __esm(() => {
61749
61759
  init_setup_command_help();
61750
61760
  init_agents_command_help();
61751
61761
  init_commands_command_help();
61752
- init_port_command_help();
61762
+ init_migrate_command_help();
61753
61763
  init_common_options();
61754
61764
  });
61755
61765
 
@@ -61774,7 +61784,7 @@ var init_help_commands = __esm(() => {
61774
61784
  skills: skillsCommandHelp,
61775
61785
  agents: agentsCommandHelp,
61776
61786
  commands: commandsCommandHelp,
61777
- port: portCommandHelp
61787
+ migrate: migrateCommandHelp
61778
61788
  };
61779
61789
  });
61780
61790
 
@@ -62084,7 +62094,7 @@ function renderGlobalHelp(commands, options2 = DEFAULT_HELP_OPTIONS) {
62084
62094
  lines.push(` ${padEnd(theme.example("ck config"), 24)}${theme.description("Open the config dashboard")}`);
62085
62095
  lines.push(` ${padEnd(theme.example("ck config --help"), 24)}${theme.description("See config actions and dashboard flags")}`);
62086
62096
  lines.push(` ${padEnd(theme.example("ck skills --help"), 24)}${theme.description("Discover skill installation workflows")}`);
62087
- lines.push(` ${padEnd(theme.example("ck port --help"), 24)}${theme.description("Migrate agents/commands/skills across providers")}`);
62097
+ lines.push(` ${padEnd(theme.example("ck migrate --help"), 24)}${theme.description("Migrate agents/commands/skills across providers")}`);
62088
62098
  lines.push("");
62089
62099
  lines.push(theme.heading("Global Options:"));
62090
62100
  lines.push(` ${padEnd(theme.flag("--verbose"), 20)}${theme.description("Enable verbose logging")}`);
@@ -86393,11 +86403,300 @@ async function initCommand(options2) {
86393
86403
  throw error;
86394
86404
  }
86395
86405
  }
86406
+ // src/commands/migrate/migrate-command.ts
86407
+ init_dist2();
86408
+ init_logger();
86409
+ init_agents_discovery();
86410
+ init_commands_discovery();
86411
+ init_config_discovery();
86412
+ init_portable_installer();
86413
+ init_provider_registry();
86414
+ init_skills_discovery();
86415
+ init_skill_directory_installer();
86416
+ var import_picocolors24 = __toESM(require_picocolors(), 1);
86417
+ async function migrateCommand(options2) {
86418
+ console.log();
86419
+ oe(import_picocolors24.default.bgMagenta(import_picocolors24.default.black(" ck migrate ")));
86420
+ try {
86421
+ const argv = new Set(process.argv.slice(2));
86422
+ const hasConfigArg = argv.has("--config");
86423
+ const hasRulesArg = argv.has("--rules");
86424
+ const hasNoConfigArg = argv.has("--no-config") || argv.has("--skip-config");
86425
+ const hasNoRulesArg = argv.has("--no-rules") || argv.has("--skip-rules");
86426
+ const hasNoToggleArgs = !hasConfigArg && !hasRulesArg && !hasNoConfigArg && !hasNoRulesArg;
86427
+ const fallbackConfigOnly = hasNoToggleArgs && options2.config === true && options2.rules !== true;
86428
+ const fallbackRulesOnly = hasNoToggleArgs && options2.rules === true && options2.config !== true;
86429
+ const hasOnlyFlag = hasConfigArg || hasRulesArg || fallbackConfigOnly || fallbackRulesOnly;
86430
+ const skipConfig = hasNoConfigArg || options2.skipConfig === true || options2.config === false;
86431
+ const skipRules = hasNoRulesArg || options2.skipRules === true || options2.rules === false;
86432
+ const migrateConfigOnly = hasConfigArg || fallbackConfigOnly;
86433
+ const migrateRulesOnly = hasRulesArg || fallbackRulesOnly;
86434
+ const migrateAgents = !hasOnlyFlag;
86435
+ const migrateCommands = !hasOnlyFlag;
86436
+ const migrateSkills = !hasOnlyFlag;
86437
+ const migrateConfig = hasOnlyFlag ? migrateConfigOnly && !skipConfig : !skipConfig;
86438
+ const migrateRules = hasOnlyFlag ? migrateRulesOnly && !skipRules : !skipRules;
86439
+ const spinner = de();
86440
+ spinner.start("Discovering portable items...");
86441
+ const agentSource = migrateAgents ? getAgentSourcePath() : null;
86442
+ const commandSource = migrateCommands ? getCommandSourcePath() : null;
86443
+ const skillSource = migrateSkills ? getSkillSourcePath() : null;
86444
+ const agents2 = agentSource ? await discoverAgents(agentSource) : [];
86445
+ const commands = commandSource ? await discoverCommands(commandSource) : [];
86446
+ const skills = skillSource ? await discoverSkills(skillSource) : [];
86447
+ const configItem = migrateConfig ? await discoverConfig(options2.source) : null;
86448
+ const ruleItems = migrateRules ? await discoverRules() : [];
86449
+ spinner.stop("Discovery complete");
86450
+ const hasItems = agents2.length > 0 || commands.length > 0 || skills.length > 0 || configItem !== null || ruleItems.length > 0;
86451
+ if (!hasItems) {
86452
+ f2.error("Nothing to migrate.");
86453
+ f2.info(import_picocolors24.default.dim("Check ~/.claude/agents/, ~/.claude/commands/, ~/.claude/skills/, and ~/.claude/CLAUDE.md"));
86454
+ $e(import_picocolors24.default.red("Nothing to migrate"));
86455
+ return;
86456
+ }
86457
+ const parts = [];
86458
+ if (agents2.length > 0)
86459
+ parts.push(`${agents2.length} agent(s)`);
86460
+ if (commands.length > 0)
86461
+ parts.push(`${commands.length} command(s)`);
86462
+ if (skills.length > 0)
86463
+ parts.push(`${skills.length} skill(s)`);
86464
+ if (configItem)
86465
+ parts.push("config");
86466
+ if (ruleItems.length > 0)
86467
+ parts.push(`${ruleItems.length} rule(s)`);
86468
+ f2.info(`Found: ${parts.join(", ")}`);
86469
+ const detectedProviders = await detectInstalledProviders();
86470
+ let selectedProviders;
86471
+ if (options2.agent && options2.agent.length > 0) {
86472
+ const validProviders = Object.keys(providers);
86473
+ const invalid = options2.agent.filter((a3) => !validProviders.includes(a3));
86474
+ if (invalid.length > 0) {
86475
+ f2.error(`Unknown provider(s): ${invalid.join(", ")}`);
86476
+ f2.info(import_picocolors24.default.dim(`Valid providers: ${validProviders.join(", ")}`));
86477
+ $e(import_picocolors24.default.red("Invalid provider"));
86478
+ return;
86479
+ }
86480
+ selectedProviders = options2.agent;
86481
+ } else if (options2.all) {
86482
+ const allProviders = new Set([
86483
+ ...getProvidersSupporting("agents"),
86484
+ ...getProvidersSupporting("commands"),
86485
+ ...getProvidersSupporting("skills"),
86486
+ ...getProvidersSupporting("config"),
86487
+ ...getProvidersSupporting("rules")
86488
+ ]);
86489
+ selectedProviders = Array.from(allProviders);
86490
+ f2.info(`Migrating to all ${selectedProviders.length} providers`);
86491
+ } else if (detectedProviders.length === 0) {
86492
+ if (options2.yes) {
86493
+ const allProviders = new Set([
86494
+ ...getProvidersSupporting("agents"),
86495
+ ...getProvidersSupporting("commands"),
86496
+ ...getProvidersSupporting("skills"),
86497
+ ...getProvidersSupporting("config"),
86498
+ ...getProvidersSupporting("rules")
86499
+ ]);
86500
+ selectedProviders = Array.from(allProviders);
86501
+ f2.info("No providers detected, migrating to all");
86502
+ } else {
86503
+ f2.warn("No providers detected on your system.");
86504
+ const allProviders = new Set([
86505
+ ...getProvidersSupporting("agents"),
86506
+ ...getProvidersSupporting("commands"),
86507
+ ...getProvidersSupporting("skills"),
86508
+ ...getProvidersSupporting("config"),
86509
+ ...getProvidersSupporting("rules")
86510
+ ]);
86511
+ const selected = await ae({
86512
+ message: "Select providers to migrate to",
86513
+ options: Array.from(allProviders).map((key) => ({
86514
+ value: key,
86515
+ label: providers[key].displayName
86516
+ })),
86517
+ required: true
86518
+ });
86519
+ if (lD(selected)) {
86520
+ ue("Migrate cancelled");
86521
+ return;
86522
+ }
86523
+ selectedProviders = selected;
86524
+ }
86525
+ } else if (detectedProviders.length === 1 || options2.yes) {
86526
+ selectedProviders = detectedProviders;
86527
+ f2.info(`Migrating to: ${detectedProviders.map((a3) => import_picocolors24.default.cyan(providers[a3].displayName)).join(", ")}`);
86528
+ } else {
86529
+ const selected = await ae({
86530
+ message: "Select providers to migrate to",
86531
+ options: detectedProviders.map((a3) => ({
86532
+ value: a3,
86533
+ label: providers[a3].displayName
86534
+ })),
86535
+ required: true,
86536
+ initialValues: detectedProviders
86537
+ });
86538
+ if (lD(selected)) {
86539
+ ue("Migrate cancelled");
86540
+ return;
86541
+ }
86542
+ selectedProviders = selected;
86543
+ }
86544
+ let installGlobally = options2.global ?? false;
86545
+ if (options2.global === undefined && !options2.yes) {
86546
+ const scope = await ie({
86547
+ message: "Installation scope",
86548
+ options: [
86549
+ {
86550
+ value: false,
86551
+ label: "Project",
86552
+ hint: "Install in current directory"
86553
+ },
86554
+ {
86555
+ value: true,
86556
+ label: "Global",
86557
+ hint: "Install in home directory"
86558
+ }
86559
+ ]
86560
+ });
86561
+ if (lD(scope)) {
86562
+ ue("Migrate cancelled");
86563
+ return;
86564
+ }
86565
+ installGlobally = scope;
86566
+ }
86567
+ console.log();
86568
+ f2.step(import_picocolors24.default.bold("Migrate Summary"));
86569
+ if (agents2.length > 0) {
86570
+ f2.message(` Agents: ${agents2.map((a3) => import_picocolors24.default.cyan(a3.name)).join(", ")}`);
86571
+ }
86572
+ if (commands.length > 0) {
86573
+ const cmdNames = commands.map((c2) => import_picocolors24.default.cyan(`/${c2.displayName || c2.name}`)).join(", ");
86574
+ f2.message(` Commands: ${cmdNames}`);
86575
+ }
86576
+ if (skills.length > 0) {
86577
+ f2.message(` Skills: ${skills.map((s) => import_picocolors24.default.cyan(s.name)).join(", ")}`);
86578
+ }
86579
+ if (configItem) {
86580
+ const lines = configItem.body.split(`
86581
+ `).length;
86582
+ f2.message(` Config: ${import_picocolors24.default.cyan("CLAUDE.md")} (${lines} lines)`);
86583
+ }
86584
+ if (ruleItems.length > 0) {
86585
+ f2.message(` Rules: ${import_picocolors24.default.cyan(`${ruleItems.length} file(s)`)}`);
86586
+ }
86587
+ const providerNames = selectedProviders.map((prov) => import_picocolors24.default.cyan(providers[prov].displayName)).join(", ");
86588
+ f2.message(` Providers: ${providerNames}`);
86589
+ f2.message(` Scope: ${installGlobally ? "Global" : "Project"}`);
86590
+ const cmdProviders = getProvidersSupporting("commands");
86591
+ const unsupportedCmd = selectedProviders.filter((p) => !cmdProviders.includes(p));
86592
+ if (commands.length > 0 && unsupportedCmd.length > 0) {
86593
+ f2.info(import_picocolors24.default.dim(` [i] Commands skipped for: ${unsupportedCmd.map((p) => providers[p].displayName).join(", ")} (unsupported)`));
86594
+ }
86595
+ console.log();
86596
+ if (!options2.yes) {
86597
+ const totalItems = agents2.length + commands.length + skills.length + (configItem ? 1 : 0) + ruleItems.length;
86598
+ const confirmed = await se({
86599
+ message: `Migrate ${totalItems} item(s) to ${selectedProviders.length} provider(s)?`
86600
+ });
86601
+ if (lD(confirmed) || !confirmed) {
86602
+ ue("Migrate cancelled");
86603
+ return;
86604
+ }
86605
+ }
86606
+ const installSpinner = de();
86607
+ installSpinner.start("Migrating...");
86608
+ const allResults = [];
86609
+ const installOpts = { global: installGlobally };
86610
+ if (agents2.length > 0) {
86611
+ const agentProviders = selectedProviders.filter((p) => getProvidersSupporting("agents").includes(p));
86612
+ if (agentProviders.length > 0) {
86613
+ const results = await installPortableItems(agents2, agentProviders, "agent", installOpts);
86614
+ allResults.push(...results);
86615
+ }
86616
+ }
86617
+ if (commands.length > 0) {
86618
+ const cmdProviders2 = selectedProviders.filter((p) => getProvidersSupporting("commands").includes(p));
86619
+ if (cmdProviders2.length > 0) {
86620
+ const results = await installPortableItems(commands, cmdProviders2, "command", installOpts);
86621
+ allResults.push(...results);
86622
+ }
86623
+ }
86624
+ if (skills.length > 0) {
86625
+ const skillProviders = selectedProviders.filter((p) => getProvidersSupporting("skills").includes(p));
86626
+ if (skillProviders.length > 0) {
86627
+ const results = await installSkillDirectories(skills, skillProviders, installOpts);
86628
+ allResults.push(...results);
86629
+ }
86630
+ }
86631
+ if (configItem) {
86632
+ const cfgProviders = selectedProviders.filter((p) => getProvidersSupporting("config").includes(p));
86633
+ if (cfgProviders.length > 0) {
86634
+ const results = await installPortableItems([configItem], cfgProviders, "config", installOpts);
86635
+ allResults.push(...results);
86636
+ }
86637
+ }
86638
+ if (ruleItems.length > 0) {
86639
+ const ruleProviders = selectedProviders.filter((p) => getProvidersSupporting("rules").includes(p));
86640
+ if (ruleProviders.length > 0) {
86641
+ const results = await installPortableItems(ruleItems, ruleProviders, "rules", installOpts);
86642
+ allResults.push(...results);
86643
+ }
86644
+ }
86645
+ installSpinner.stop("Migrate complete");
86646
+ displayResults3(allResults);
86647
+ } catch (error) {
86648
+ logger.error(error instanceof Error ? error.message : "Unknown error");
86649
+ $e(import_picocolors24.default.red("Migrate failed"));
86650
+ process.exit(1);
86651
+ }
86652
+ }
86653
+ function displayResults3(results) {
86654
+ console.log();
86655
+ const successful = results.filter((r2) => r2.success && !r2.skipped);
86656
+ const skipped = results.filter((r2) => r2.skipped);
86657
+ const failed = results.filter((r2) => !r2.success);
86658
+ if (successful.length > 0) {
86659
+ for (const r2 of successful) {
86660
+ f2.success(`${import_picocolors24.default.green("[OK]")} ${r2.providerDisplayName}`);
86661
+ if (r2.warnings) {
86662
+ for (const w3 of r2.warnings) {
86663
+ f2.warn(` ${import_picocolors24.default.yellow("[!]")} ${w3}`);
86664
+ }
86665
+ }
86666
+ }
86667
+ }
86668
+ if (skipped.length > 0) {
86669
+ for (const r2 of skipped) {
86670
+ f2.info(`${import_picocolors24.default.yellow("[i]")} ${r2.providerDisplayName}: ${import_picocolors24.default.dim(r2.skipReason || "Skipped")}`);
86671
+ }
86672
+ }
86673
+ if (failed.length > 0) {
86674
+ for (const r2 of failed) {
86675
+ f2.error(`${import_picocolors24.default.red("[X]")} ${r2.providerDisplayName}: ${import_picocolors24.default.dim(r2.error || "Failed")}`);
86676
+ }
86677
+ }
86678
+ console.log();
86679
+ const parts = [];
86680
+ if (successful.length > 0)
86681
+ parts.push(`${successful.length} installed`);
86682
+ if (skipped.length > 0)
86683
+ parts.push(`${skipped.length} skipped`);
86684
+ if (failed.length > 0)
86685
+ parts.push(`${failed.length} failed`);
86686
+ if (parts.length === 0) {
86687
+ $e(import_picocolors24.default.yellow("No installations performed"));
86688
+ } else if (failed.length > 0 && successful.length === 0) {
86689
+ $e(import_picocolors24.default.red("Migrate failed"));
86690
+ process.exit(1);
86691
+ } else {
86692
+ $e(import_picocolors24.default.green(`Done! ${parts.join(", ")}`));
86693
+ }
86694
+ }
86396
86695
  // src/commands/new/new-command.ts
86397
86696
  init_logger();
86398
86697
  init_safe_prompts();
86399
86698
  init_types3();
86400
- var import_picocolors24 = __toESM(require_picocolors(), 1);
86699
+ var import_picocolors25 = __toESM(require_picocolors(), 1);
86401
86700
 
86402
86701
  // src/commands/new/phases/directory-setup.ts
86403
86702
  init_config_manager();
@@ -86811,301 +87110,12 @@ Please use only one download method.`);
86811
87110
  if (ctx.cancelled)
86812
87111
  return;
86813
87112
  prompts.outro(`✨ Project created successfully at ${ctx.resolvedDir}`);
86814
- log.info(`${import_picocolors24.default.dim("Tip:")} To update later: ${import_picocolors24.default.cyan("ck update")} (CLI) + ${import_picocolors24.default.cyan("ck init")} (kit content)`);
87113
+ log.info(`${import_picocolors25.default.dim("Tip:")} To update later: ${import_picocolors25.default.cyan("ck update")} (CLI) + ${import_picocolors25.default.cyan("ck init")} (kit content)`);
86815
87114
  } catch (error) {
86816
87115
  logger.error(error instanceof Error ? error.message : "Unknown error occurred");
86817
87116
  process.exit(1);
86818
87117
  }
86819
87118
  }
86820
- // src/commands/port/port-command.ts
86821
- init_dist2();
86822
- init_logger();
86823
- init_agents_discovery();
86824
- init_commands_discovery();
86825
- init_config_discovery();
86826
- init_portable_installer();
86827
- init_provider_registry();
86828
- init_skills_discovery();
86829
- init_skill_directory_installer();
86830
- var import_picocolors25 = __toESM(require_picocolors(), 1);
86831
- async function portCommand(options2) {
86832
- console.log();
86833
- oe(import_picocolors25.default.bgMagenta(import_picocolors25.default.black(" ck port ")));
86834
- try {
86835
- const argv = new Set(process.argv.slice(2));
86836
- const hasConfigArg = argv.has("--config");
86837
- const hasRulesArg = argv.has("--rules");
86838
- const hasNoConfigArg = argv.has("--no-config") || argv.has("--skip-config");
86839
- const hasNoRulesArg = argv.has("--no-rules") || argv.has("--skip-rules");
86840
- const hasNoToggleArgs = !hasConfigArg && !hasRulesArg && !hasNoConfigArg && !hasNoRulesArg;
86841
- const fallbackConfigOnly = hasNoToggleArgs && options2.config === true && options2.rules !== true;
86842
- const fallbackRulesOnly = hasNoToggleArgs && options2.rules === true && options2.config !== true;
86843
- const hasOnlyFlag = hasConfigArg || hasRulesArg || fallbackConfigOnly || fallbackRulesOnly;
86844
- const skipConfig = hasNoConfigArg || options2.skipConfig === true || options2.config === false;
86845
- const skipRules = hasNoRulesArg || options2.skipRules === true || options2.rules === false;
86846
- const portConfigOnly = hasConfigArg || fallbackConfigOnly;
86847
- const portRulesOnly = hasRulesArg || fallbackRulesOnly;
86848
- const portAgents = !hasOnlyFlag;
86849
- const portCommands = !hasOnlyFlag;
86850
- const portSkills = !hasOnlyFlag;
86851
- const portConfig = hasOnlyFlag ? portConfigOnly && !skipConfig : !skipConfig;
86852
- const portRules = hasOnlyFlag ? portRulesOnly && !skipRules : !skipRules;
86853
- const spinner = de();
86854
- spinner.start("Discovering portable items...");
86855
- const agentSource = portAgents ? getAgentSourcePath() : null;
86856
- const commandSource = portCommands ? getCommandSourcePath() : null;
86857
- const skillSource = portSkills ? getSkillSourcePath() : null;
86858
- const agents2 = agentSource ? await discoverAgents(agentSource) : [];
86859
- const commands = commandSource ? await discoverCommands(commandSource) : [];
86860
- const skills = skillSource ? await discoverSkills(skillSource) : [];
86861
- const configItem = portConfig ? await discoverConfig(options2.source) : null;
86862
- const ruleItems = portRules ? await discoverRules() : [];
86863
- spinner.stop("Discovery complete");
86864
- const hasItems = agents2.length > 0 || commands.length > 0 || skills.length > 0 || configItem !== null || ruleItems.length > 0;
86865
- if (!hasItems) {
86866
- f2.error("Nothing to port.");
86867
- f2.info(import_picocolors25.default.dim("Check ~/.claude/agents/, ~/.claude/commands/, ~/.claude/skills/, and ~/.claude/CLAUDE.md"));
86868
- $e(import_picocolors25.default.red("Nothing to port"));
86869
- return;
86870
- }
86871
- const parts = [];
86872
- if (agents2.length > 0)
86873
- parts.push(`${agents2.length} agent(s)`);
86874
- if (commands.length > 0)
86875
- parts.push(`${commands.length} command(s)`);
86876
- if (skills.length > 0)
86877
- parts.push(`${skills.length} skill(s)`);
86878
- if (configItem)
86879
- parts.push("config");
86880
- if (ruleItems.length > 0)
86881
- parts.push(`${ruleItems.length} rule(s)`);
86882
- f2.info(`Found: ${parts.join(", ")}`);
86883
- const detectedProviders = await detectInstalledProviders();
86884
- let selectedProviders;
86885
- if (options2.agent && options2.agent.length > 0) {
86886
- const validProviders = Object.keys(providers);
86887
- const invalid = options2.agent.filter((a3) => !validProviders.includes(a3));
86888
- if (invalid.length > 0) {
86889
- f2.error(`Unknown provider(s): ${invalid.join(", ")}`);
86890
- f2.info(import_picocolors25.default.dim(`Valid providers: ${validProviders.join(", ")}`));
86891
- $e(import_picocolors25.default.red("Invalid provider"));
86892
- return;
86893
- }
86894
- selectedProviders = options2.agent;
86895
- } else if (options2.all) {
86896
- const allProviders = new Set([
86897
- ...getProvidersSupporting("agents"),
86898
- ...getProvidersSupporting("commands"),
86899
- ...getProvidersSupporting("skills"),
86900
- ...getProvidersSupporting("config"),
86901
- ...getProvidersSupporting("rules")
86902
- ]);
86903
- selectedProviders = Array.from(allProviders);
86904
- f2.info(`Porting to all ${selectedProviders.length} providers`);
86905
- } else if (detectedProviders.length === 0) {
86906
- if (options2.yes) {
86907
- const allProviders = new Set([
86908
- ...getProvidersSupporting("agents"),
86909
- ...getProvidersSupporting("commands"),
86910
- ...getProvidersSupporting("skills"),
86911
- ...getProvidersSupporting("config"),
86912
- ...getProvidersSupporting("rules")
86913
- ]);
86914
- selectedProviders = Array.from(allProviders);
86915
- f2.info("No providers detected, porting to all");
86916
- } else {
86917
- f2.warn("No providers detected on your system.");
86918
- const allProviders = new Set([
86919
- ...getProvidersSupporting("agents"),
86920
- ...getProvidersSupporting("commands"),
86921
- ...getProvidersSupporting("skills"),
86922
- ...getProvidersSupporting("config"),
86923
- ...getProvidersSupporting("rules")
86924
- ]);
86925
- const selected = await ae({
86926
- message: "Select providers to port to",
86927
- options: Array.from(allProviders).map((key) => ({
86928
- value: key,
86929
- label: providers[key].displayName
86930
- })),
86931
- required: true
86932
- });
86933
- if (lD(selected)) {
86934
- ue("Port cancelled");
86935
- return;
86936
- }
86937
- selectedProviders = selected;
86938
- }
86939
- } else if (detectedProviders.length === 1 || options2.yes) {
86940
- selectedProviders = detectedProviders;
86941
- f2.info(`Porting to: ${detectedProviders.map((a3) => import_picocolors25.default.cyan(providers[a3].displayName)).join(", ")}`);
86942
- } else {
86943
- const selected = await ae({
86944
- message: "Select providers to port to",
86945
- options: detectedProviders.map((a3) => ({
86946
- value: a3,
86947
- label: providers[a3].displayName
86948
- })),
86949
- required: true,
86950
- initialValues: detectedProviders
86951
- });
86952
- if (lD(selected)) {
86953
- ue("Port cancelled");
86954
- return;
86955
- }
86956
- selectedProviders = selected;
86957
- }
86958
- let installGlobally = options2.global ?? false;
86959
- if (options2.global === undefined && !options2.yes) {
86960
- const scope = await ie({
86961
- message: "Installation scope",
86962
- options: [
86963
- {
86964
- value: false,
86965
- label: "Project",
86966
- hint: "Install in current directory"
86967
- },
86968
- {
86969
- value: true,
86970
- label: "Global",
86971
- hint: "Install in home directory"
86972
- }
86973
- ]
86974
- });
86975
- if (lD(scope)) {
86976
- ue("Port cancelled");
86977
- return;
86978
- }
86979
- installGlobally = scope;
86980
- }
86981
- console.log();
86982
- f2.step(import_picocolors25.default.bold("Port Summary"));
86983
- if (agents2.length > 0) {
86984
- f2.message(` Agents: ${agents2.map((a3) => import_picocolors25.default.cyan(a3.name)).join(", ")}`);
86985
- }
86986
- if (commands.length > 0) {
86987
- const cmdNames = commands.map((c2) => import_picocolors25.default.cyan(`/${c2.displayName || c2.name}`)).join(", ");
86988
- f2.message(` Commands: ${cmdNames}`);
86989
- }
86990
- if (skills.length > 0) {
86991
- f2.message(` Skills: ${skills.map((s) => import_picocolors25.default.cyan(s.name)).join(", ")}`);
86992
- }
86993
- if (configItem) {
86994
- const lines = configItem.body.split(`
86995
- `).length;
86996
- f2.message(` Config: ${import_picocolors25.default.cyan("CLAUDE.md")} (${lines} lines)`);
86997
- }
86998
- if (ruleItems.length > 0) {
86999
- f2.message(` Rules: ${import_picocolors25.default.cyan(`${ruleItems.length} file(s)`)}`);
87000
- }
87001
- const providerNames = selectedProviders.map((prov) => import_picocolors25.default.cyan(providers[prov].displayName)).join(", ");
87002
- f2.message(` Providers: ${providerNames}`);
87003
- f2.message(` Scope: ${installGlobally ? "Global" : "Project"}`);
87004
- const cmdProviders = getProvidersSupporting("commands");
87005
- const unsupportedCmd = selectedProviders.filter((p) => !cmdProviders.includes(p));
87006
- if (commands.length > 0 && unsupportedCmd.length > 0) {
87007
- f2.info(import_picocolors25.default.dim(` [i] Commands skipped for: ${unsupportedCmd.map((p) => providers[p].displayName).join(", ")} (unsupported)`));
87008
- }
87009
- console.log();
87010
- if (!options2.yes) {
87011
- const totalItems = agents2.length + commands.length + skills.length + (configItem ? 1 : 0) + ruleItems.length;
87012
- const confirmed = await se({
87013
- message: `Port ${totalItems} item(s) to ${selectedProviders.length} provider(s)?`
87014
- });
87015
- if (lD(confirmed) || !confirmed) {
87016
- ue("Port cancelled");
87017
- return;
87018
- }
87019
- }
87020
- const installSpinner = de();
87021
- installSpinner.start("Porting...");
87022
- const allResults = [];
87023
- const installOpts = { global: installGlobally };
87024
- if (agents2.length > 0) {
87025
- const agentProviders = selectedProviders.filter((p) => getProvidersSupporting("agents").includes(p));
87026
- if (agentProviders.length > 0) {
87027
- const results = await installPortableItems(agents2, agentProviders, "agent", installOpts);
87028
- allResults.push(...results);
87029
- }
87030
- }
87031
- if (commands.length > 0) {
87032
- const cmdProviders2 = selectedProviders.filter((p) => getProvidersSupporting("commands").includes(p));
87033
- if (cmdProviders2.length > 0) {
87034
- const results = await installPortableItems(commands, cmdProviders2, "command", installOpts);
87035
- allResults.push(...results);
87036
- }
87037
- }
87038
- if (skills.length > 0) {
87039
- const skillProviders = selectedProviders.filter((p) => getProvidersSupporting("skills").includes(p));
87040
- if (skillProviders.length > 0) {
87041
- const results = await installSkillDirectories(skills, skillProviders, installOpts);
87042
- allResults.push(...results);
87043
- }
87044
- }
87045
- if (configItem) {
87046
- const cfgProviders = selectedProviders.filter((p) => getProvidersSupporting("config").includes(p));
87047
- if (cfgProviders.length > 0) {
87048
- const results = await installPortableItems([configItem], cfgProviders, "config", installOpts);
87049
- allResults.push(...results);
87050
- }
87051
- }
87052
- if (ruleItems.length > 0) {
87053
- const ruleProviders = selectedProviders.filter((p) => getProvidersSupporting("rules").includes(p));
87054
- if (ruleProviders.length > 0) {
87055
- const results = await installPortableItems(ruleItems, ruleProviders, "rules", installOpts);
87056
- allResults.push(...results);
87057
- }
87058
- }
87059
- installSpinner.stop("Port complete");
87060
- displayResults3(allResults);
87061
- } catch (error) {
87062
- logger.error(error instanceof Error ? error.message : "Unknown error");
87063
- $e(import_picocolors25.default.red("Port failed"));
87064
- process.exit(1);
87065
- }
87066
- }
87067
- function displayResults3(results) {
87068
- console.log();
87069
- const successful = results.filter((r2) => r2.success && !r2.skipped);
87070
- const skipped = results.filter((r2) => r2.skipped);
87071
- const failed = results.filter((r2) => !r2.success);
87072
- if (successful.length > 0) {
87073
- for (const r2 of successful) {
87074
- f2.success(`${import_picocolors25.default.green("[OK]")} ${r2.providerDisplayName}`);
87075
- if (r2.warnings) {
87076
- for (const w3 of r2.warnings) {
87077
- f2.warn(` ${import_picocolors25.default.yellow("[!]")} ${w3}`);
87078
- }
87079
- }
87080
- }
87081
- }
87082
- if (skipped.length > 0) {
87083
- for (const r2 of skipped) {
87084
- f2.info(`${import_picocolors25.default.yellow("[i]")} ${r2.providerDisplayName}: ${import_picocolors25.default.dim(r2.skipReason || "Skipped")}`);
87085
- }
87086
- }
87087
- if (failed.length > 0) {
87088
- for (const r2 of failed) {
87089
- f2.error(`${import_picocolors25.default.red("[X]")} ${r2.providerDisplayName}: ${import_picocolors25.default.dim(r2.error || "Failed")}`);
87090
- }
87091
- }
87092
- console.log();
87093
- const parts = [];
87094
- if (successful.length > 0)
87095
- parts.push(`${successful.length} installed`);
87096
- if (skipped.length > 0)
87097
- parts.push(`${skipped.length} skipped`);
87098
- if (failed.length > 0)
87099
- parts.push(`${failed.length} failed`);
87100
- if (parts.length === 0) {
87101
- $e(import_picocolors25.default.yellow("No installations performed"));
87102
- } else if (failed.length > 0 && successful.length === 0) {
87103
- $e(import_picocolors25.default.red("Port failed"));
87104
- process.exit(1);
87105
- } else {
87106
- $e(import_picocolors25.default.green(`Done! ${parts.join(", ")}`));
87107
- }
87108
- }
87109
87119
  // src/commands/projects/add-handler.ts
87110
87120
  init_claudekit_data2();
87111
87121
  init_logger();
@@ -88607,11 +88617,11 @@ function registerCommands(cli) {
88607
88617
  }
88608
88618
  await commandsCommand(options2);
88609
88619
  });
88610
- cli.command("port", "Port agents, commands, skills, config, and rules to other providers").option("-a, --agent <agents...>", "Target providers (cursor, codex, opencode, etc.)").option("-g, --global", "Install globally instead of project-level").option("--all", "Port to all supported providers").option("-y, --yes", "Skip confirmation prompts").option("--config", "Port CLAUDE.md config only").option("--rules", "Port .claude/rules/ only").option("--skip-config", "Skip config porting").option("--skip-rules", "Skip rules porting").option("--source <path>", "Custom CLAUDE.md source path").action(async (options2) => {
88620
+ cli.command("migrate", "Migrate agents, commands, skills, config, and rules to other providers").option("-a, --agent <agents...>", "Target providers (cursor, codex, opencode, etc.)").option("-g, --global", "Install globally instead of project-level").option("--all", "Migrate to all supported providers").option("-y, --yes", "Skip confirmation prompts").option("--config", "Migrate CLAUDE.md config only").option("--rules", "Migrate .claude/rules/ only").option("--skip-config", "Skip config migration").option("--skip-rules", "Skip rules migration").option("--source <path>", "Custom CLAUDE.md source path").action(async (options2) => {
88611
88621
  if (options2.agent && !Array.isArray(options2.agent)) {
88612
88622
  options2.agent = [options2.agent];
88613
88623
  }
88614
- await portCommand(options2);
88624
+ await migrateCommand(options2);
88615
88625
  });
88616
88626
  }
88617
88627