claudekit-cli 3.35.0-dev.18 → 3.35.0-dev.19

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.
Files changed (2) hide show
  1. package/dist/index.js +133 -32
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49746,7 +49746,7 @@ var init_skills_discovery = __esm(() => {
49746
49746
 
49747
49747
  // src/domains/web-server/routes/migration-routes.ts
49748
49748
  import { existsSync as existsSync19 } from "node:fs";
49749
- import { readFile as readFile14 } from "node:fs/promises";
49749
+ import { readFile as readFile14, rm as rm5 } from "node:fs/promises";
49750
49750
  import { resolve as resolve7 } from "node:path";
49751
49751
  function isDisallowedControlCode(codePoint) {
49752
49752
  return codePoint >= 0 && codePoint <= 8 || codePoint >= 11 && codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
@@ -49950,6 +49950,41 @@ function normalizeIncludeOptions(input) {
49950
49950
  rules: typeof parsed.rules === "boolean" ? parsed.rules : defaults.rules
49951
49951
  };
49952
49952
  }
49953
+ function shouldExecuteAction(action) {
49954
+ if (action.action === "install" || action.action === "update")
49955
+ return true;
49956
+ if (action.action === "conflict") {
49957
+ const resolution = action.resolution?.type;
49958
+ return resolution === "overwrite" || resolution === "smart-merge" || resolution === "resolved";
49959
+ }
49960
+ return false;
49961
+ }
49962
+ async function executePlanDeleteAction(action, options2) {
49963
+ const preservePaths = options2?.preservePaths ?? new Set;
49964
+ const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve7(action.targetPath));
49965
+ try {
49966
+ if (!shouldPreserveTarget && action.targetPath && existsSync19(action.targetPath)) {
49967
+ await rm5(action.targetPath, { recursive: true, force: true });
49968
+ }
49969
+ await removePortableInstallation(action.item, action.type, action.provider, action.global);
49970
+ return {
49971
+ provider: action.provider,
49972
+ providerDisplayName: providers[action.provider]?.displayName || action.provider,
49973
+ success: true,
49974
+ path: action.targetPath,
49975
+ skipped: shouldPreserveTarget,
49976
+ skipReason: shouldPreserveTarget ? "Registry entry removed; target preserved because newer action wrote same path" : undefined
49977
+ };
49978
+ } catch (error) {
49979
+ return {
49980
+ provider: action.provider,
49981
+ providerDisplayName: providers[action.provider]?.displayName || action.provider,
49982
+ success: false,
49983
+ path: action.targetPath,
49984
+ error: error instanceof Error ? error.message : "Delete action failed"
49985
+ };
49986
+ }
49987
+ }
49953
49988
  function countEnabledTypes(include) {
49954
49989
  return MIGRATION_TYPES.filter((type) => include[type]).length;
49955
49990
  }
@@ -50245,10 +50280,76 @@ function registerMigrationRoutes(app) {
50245
50280
  }
50246
50281
  }
50247
50282
  }
50248
- res.status(501).json({
50249
- error: "Plan-based execution not yet implemented. Use standard migration endpoint.",
50250
- phase: "planned-for-future",
50251
- code: "PLAN_EXECUTION_NOT_IMPLEMENTED"
50283
+ const execActions = plan.actions.filter(shouldExecuteAction);
50284
+ const deleteActions = plan.actions.filter((a3) => a3.action === "delete");
50285
+ const includeAll = {
50286
+ agents: true,
50287
+ commands: true,
50288
+ skills: true,
50289
+ config: true,
50290
+ rules: true
50291
+ };
50292
+ const discovered2 = await discoverMigrationItems(includeAll);
50293
+ const agentByName = new Map(discovered2.agents.map((item) => [item.name, item]));
50294
+ const commandByName = new Map(discovered2.commands.map((item) => [item.name, item]));
50295
+ const skillByName = new Map(discovered2.skills.map((item) => [item.name, item]));
50296
+ const configByName = new Map(discovered2.configItem ? [[discovered2.configItem.name, discovered2.configItem]] : []);
50297
+ const ruleByName = new Map(discovered2.ruleItems.map((item) => [item.name, item]));
50298
+ const allResults = [];
50299
+ for (const action of execActions) {
50300
+ const provider = action.provider;
50301
+ const installOpts = { global: action.global };
50302
+ if (action.type === "agent") {
50303
+ const item = agentByName.get(action.item);
50304
+ if (!item || !getProvidersSupporting("agents").includes(provider))
50305
+ continue;
50306
+ allResults.push(...await installPortableItems([item], [provider], "agent", installOpts));
50307
+ } else if (action.type === "command") {
50308
+ const item = commandByName.get(action.item);
50309
+ if (!item || !getProvidersSupporting("commands").includes(provider))
50310
+ continue;
50311
+ allResults.push(...await installPortableItems([item], [provider], "command", installOpts));
50312
+ } else if (action.type === "skill") {
50313
+ const item = skillByName.get(action.item);
50314
+ if (!item || !getProvidersSupporting("skills").includes(provider))
50315
+ continue;
50316
+ allResults.push(...await installSkillDirectories([item], [provider], installOpts));
50317
+ } else if (action.type === "config") {
50318
+ const item = configByName.get(action.item);
50319
+ if (!item || !getProvidersSupporting("config").includes(provider))
50320
+ continue;
50321
+ allResults.push(...await installPortableItems([item], [provider], "config", installOpts));
50322
+ } else if (action.type === "rules") {
50323
+ const item = ruleByName.get(action.item);
50324
+ if (!item || !getProvidersSupporting("rules").includes(provider))
50325
+ continue;
50326
+ allResults.push(...await installPortableItems([item], [provider], "rules", installOpts));
50327
+ }
50328
+ }
50329
+ const plannedSkillActions = execActions.filter((a3) => a3.type === "skill").length;
50330
+ if (discovered2.skills.length > 0 && plannedSkillActions === 0) {
50331
+ const planProviders = [
50332
+ ...new Set(plan.actions.map((a3) => a3.provider))
50333
+ ];
50334
+ const skillProviders = planProviders.filter((pv) => getProvidersSupporting("skills").includes(pv));
50335
+ if (skillProviders.length > 0) {
50336
+ const globalFromPlan = plan.actions[0]?.global ?? false;
50337
+ allResults.push(...await installSkillDirectories(discovered2.skills, skillProviders, {
50338
+ global: globalFromPlan
50339
+ }));
50340
+ }
50341
+ }
50342
+ const writtenPaths = new Set(allResults.filter((r2) => r2.success && !r2.skipped && r2.path.length > 0).map((r2) => resolve7(r2.path)));
50343
+ for (const deleteAction of deleteActions) {
50344
+ allResults.push(await executePlanDeleteAction(deleteAction, { preservePaths: writtenPaths }));
50345
+ }
50346
+ const installed2 = allResults.filter((r2) => r2.success && !r2.skipped).length;
50347
+ const skipped2 = allResults.filter((r2) => r2.skipped).length;
50348
+ const failed2 = allResults.filter((r2) => !r2.success).length;
50349
+ res.status(200).json({
50350
+ results: allResults,
50351
+ warnings: [],
50352
+ counts: { installed: installed2, skipped: skipped2, failed: failed2 }
50252
50353
  });
50253
50354
  return;
50254
50355
  }
@@ -51808,7 +51909,7 @@ var init_skills_installer = __esm(() => {
51808
51909
 
51809
51910
  // src/commands/skills/skills-uninstaller.ts
51810
51911
  import { existsSync as existsSync27 } from "node:fs";
51811
- import { rm as rm5 } from "node:fs/promises";
51912
+ import { rm as rm6 } from "node:fs/promises";
51812
51913
  import { join as join32 } from "node:path";
51813
51914
  async function uninstallSkillFromAgent(skill, agent, global3) {
51814
51915
  const agentConfig = agents[agent];
@@ -51830,7 +51931,7 @@ async function uninstallSkillFromAgent(skill, agent, global3) {
51830
51931
  const fileExists = existsSync27(path4);
51831
51932
  try {
51832
51933
  if (fileExists) {
51833
- await rm5(path4, { recursive: true, force: true });
51934
+ await rm6(path4, { recursive: true, force: true });
51834
51935
  }
51835
51936
  await removeInstallation(skill, agent, global3);
51836
51937
  return {
@@ -51870,7 +51971,7 @@ async function forceUninstallSkill(skill, agent, global3) {
51870
51971
  };
51871
51972
  }
51872
51973
  try {
51873
- await rm5(path4, { recursive: true, force: true });
51974
+ await rm6(path4, { recursive: true, force: true });
51874
51975
  await removeInstallation(skill, agent, global3);
51875
51976
  return {
51876
51977
  skill,
@@ -53065,7 +53166,7 @@ var package_default;
53065
53166
  var init_package = __esm(() => {
53066
53167
  package_default = {
53067
53168
  name: "claudekit-cli",
53068
- version: "3.35.0-dev.18",
53169
+ version: "3.35.0-dev.19",
53069
53170
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
53070
53171
  type: "module",
53071
53172
  repository: {
@@ -74321,7 +74422,7 @@ async function validateExtraction(extractDir) {
74321
74422
 
74322
74423
  // src/domains/installation/extraction/tar-extractor.ts
74323
74424
  init_logger();
74324
- import { copyFile as copyFile3, mkdir as mkdir21, readdir as readdir15, rm as rm6, stat as stat10 } from "node:fs/promises";
74425
+ import { copyFile as copyFile3, mkdir as mkdir21, readdir as readdir15, rm as rm7, stat as stat10 } from "node:fs/promises";
74325
74426
  import { join as join70 } from "node:path";
74326
74427
 
74327
74428
  // node_modules/@isaacs/fs-minipass/dist/esm/index.js
@@ -81313,10 +81414,10 @@ class TarExtractor {
81313
81414
  await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
81314
81415
  }
81315
81416
  logger.debug(`Moved contents to: ${destDir}`);
81316
- await rm6(tempExtractDir, { recursive: true, force: true });
81417
+ await rm7(tempExtractDir, { recursive: true, force: true });
81317
81418
  } catch (error) {
81318
81419
  try {
81319
- await rm6(tempExtractDir, { recursive: true, force: true });
81420
+ await rm7(tempExtractDir, { recursive: true, force: true });
81320
81421
  } catch {}
81321
81422
  throw error;
81322
81423
  }
@@ -81328,7 +81429,7 @@ init_environment();
81328
81429
  init_logger();
81329
81430
  var import_extract_zip = __toESM(require_extract_zip(), 1);
81330
81431
  import { execFile as execFile8 } from "node:child_process";
81331
- import { copyFile as copyFile4, mkdir as mkdir22, readdir as readdir16, rm as rm7, stat as stat11 } from "node:fs/promises";
81432
+ import { copyFile as copyFile4, mkdir as mkdir22, readdir as readdir16, rm as rm8, stat as stat11 } from "node:fs/promises";
81332
81433
  import { join as join71 } from "node:path";
81333
81434
  class ZipExtractor {
81334
81435
  async tryNativeUnzip(archivePath, destDir) {
@@ -81400,10 +81501,10 @@ class ZipExtractor {
81400
81501
  await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
81401
81502
  }
81402
81503
  logger.debug(`Moved contents to: ${destDir}`);
81403
- await rm7(tempExtractDir, { recursive: true, force: true });
81504
+ await rm8(tempExtractDir, { recursive: true, force: true });
81404
81505
  } catch (error) {
81405
81506
  try {
81406
- await rm7(tempExtractDir, { recursive: true, force: true });
81507
+ await rm8(tempExtractDir, { recursive: true, force: true });
81407
81508
  } catch {}
81408
81509
  throw error;
81409
81510
  }
@@ -86214,7 +86315,7 @@ import { join as join95 } from "node:path";
86214
86315
 
86215
86316
  // src/domains/skills/migrator/migration-executor.ts
86216
86317
  init_logger();
86217
- import { copyFile as copyFile5, mkdir as mkdir26, readdir as readdir26, rm as rm8 } from "node:fs/promises";
86318
+ import { copyFile as copyFile5, mkdir as mkdir26, readdir as readdir26, rm as rm9 } from "node:fs/promises";
86218
86319
  import { join as join91 } from "node:path";
86219
86320
  var import_fs_extra24 = __toESM(require_lib3(), 1);
86220
86321
 
@@ -86437,14 +86538,14 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
86437
86538
  logger.error(`Failed to migrate ${mapping.skillName}: ${error instanceof Error ? error.message : "Unknown error"}`);
86438
86539
  }
86439
86540
  }
86440
- await rm8(currentSkillsDir, { recursive: true, force: true });
86541
+ await rm9(currentSkillsDir, { recursive: true, force: true });
86441
86542
  await mkdir26(currentSkillsDir, { recursive: true });
86442
86543
  await copySkillDirectory(tempDir, currentSkillsDir);
86443
- await rm8(tempDir, { recursive: true, force: true });
86544
+ await rm9(tempDir, { recursive: true, force: true });
86444
86545
  return { migrated, preserved, errors: errors2 };
86445
86546
  } catch (error) {
86446
86547
  try {
86447
- await rm8(tempDir, { recursive: true, force: true });
86548
+ await rm9(tempDir, { recursive: true, force: true });
86448
86549
  } catch {}
86449
86550
  throw error;
86450
86551
  }
@@ -86485,7 +86586,7 @@ function validateMigrationPath(path14, paramName) {
86485
86586
  init_logger();
86486
86587
  init_types3();
86487
86588
  var import_fs_extra25 = __toESM(require_lib3(), 1);
86488
- import { copyFile as copyFile6, mkdir as mkdir27, readdir as readdir27, rm as rm9, stat as stat16 } from "node:fs/promises";
86589
+ import { copyFile as copyFile6, mkdir as mkdir27, readdir as readdir27, rm as rm10, stat as stat16 } from "node:fs/promises";
86489
86590
  import { basename as basename9, join as join92, normalize as normalize8 } from "node:path";
86490
86591
  function validatePath2(path14, paramName) {
86491
86592
  if (!path14 || typeof path14 !== "string") {
@@ -86521,7 +86622,7 @@ class SkillsBackupManager {
86521
86622
  return backupDir;
86522
86623
  } catch (error) {
86523
86624
  try {
86524
- await rm9(backupDir, { recursive: true, force: true });
86625
+ await rm10(backupDir, { recursive: true, force: true });
86525
86626
  } catch {}
86526
86627
  throw new SkillsMigrationError(`Failed to create backup: ${error instanceof Error ? error.message : "Unknown error"}`);
86527
86628
  }
@@ -86535,7 +86636,7 @@ class SkillsBackupManager {
86535
86636
  logger.info(`Restoring from backup: ${backupDir}`);
86536
86637
  try {
86537
86638
  if (await import_fs_extra25.pathExists(targetDir)) {
86538
- await rm9(targetDir, { recursive: true, force: true });
86639
+ await rm10(targetDir, { recursive: true, force: true });
86539
86640
  }
86540
86641
  await mkdir27(targetDir, { recursive: true });
86541
86642
  await SkillsBackupManager.copyDirectory(backupDir, targetDir);
@@ -86551,7 +86652,7 @@ class SkillsBackupManager {
86551
86652
  }
86552
86653
  logger.debug(`Deleting backup: ${backupDir}`);
86553
86654
  try {
86554
- await rm9(backupDir, { recursive: true, force: true });
86655
+ await rm10(backupDir, { recursive: true, force: true });
86555
86656
  logger.debug("Backup deleted successfully");
86556
86657
  } catch (error) {
86557
86658
  logger.warning(`Failed to delete backup: ${error instanceof Error ? error.message : "Unknown error"}`);
@@ -87011,7 +87112,7 @@ async function handleMigration(ctx) {
87011
87112
  return ctx;
87012
87113
  }
87013
87114
  // src/commands/init/phases/opencode-handler.ts
87014
- import { cp as cp3, readdir as readdir31, rm as rm10 } from "node:fs/promises";
87115
+ import { cp as cp3, readdir as readdir31, rm as rm11 } from "node:fs/promises";
87015
87116
  import { join as join98 } from "node:path";
87016
87117
 
87017
87118
  // src/services/transformers/opencode-path-transformer.ts
@@ -87147,7 +87248,7 @@ async function handleOpenCode(ctx) {
87147
87248
  await cp3(sourcePath, targetPath, { recursive: true });
87148
87249
  logger.verbose(`Copied: ${entry.name}`);
87149
87250
  }
87150
- await rm10(openCodeSource, { recursive: true, force: true });
87251
+ await rm11(openCodeSource, { recursive: true, force: true });
87151
87252
  logger.success(`OpenCode config installed to ${targetDir}`);
87152
87253
  } else {
87153
87254
  logger.debug("Local mode: .opencode will be placed at project root");
@@ -88397,7 +88498,7 @@ init_types3();
88397
88498
  init_logger();
88398
88499
  init_types3();
88399
88500
  var import_fs_extra34 = __toESM(require_lib3(), 1);
88400
- import { rename as rename6, rm as rm11 } from "node:fs/promises";
88501
+ import { rename as rename6, rm as rm12 } from "node:fs/promises";
88401
88502
  import { join as join103, relative as relative17 } from "node:path";
88402
88503
  async function collectDirsToRename(extractDir, folders) {
88403
88504
  const dirsToRename = [];
@@ -88442,7 +88543,7 @@ async function moveAcrossDevices(src, dest) {
88442
88543
  if (e2.code === "EXDEV") {
88443
88544
  logger.debug(`Cross-device move detected, using copy+delete: ${src} -> ${dest}`);
88444
88545
  await import_fs_extra34.copy(src, dest, { overwrite: true });
88445
- await rm11(src, { recursive: true, force: true });
88546
+ await rm12(src, { recursive: true, force: true });
88446
88547
  } else {
88447
88548
  throw e2;
88448
88549
  }
@@ -89040,7 +89141,7 @@ init_checksum_utils();
89040
89141
  init_config_discovery();
89041
89142
  var import_picocolors25 = __toESM(require_picocolors(), 1);
89042
89143
  import { existsSync as existsSync50 } from "node:fs";
89043
- import { readFile as readFile51, rm as rm12, unlink as unlink11 } from "node:fs/promises";
89144
+ import { readFile as readFile51, rm as rm13, unlink as unlink11 } from "node:fs/promises";
89044
89145
  import { resolve as resolve21 } from "node:path";
89045
89146
 
89046
89147
  // src/commands/portable/conflict-resolver.ts
@@ -89376,7 +89477,7 @@ function getProviderPathKey(type) {
89376
89477
  return type;
89377
89478
  }
89378
89479
  }
89379
- function shouldExecuteAction(action) {
89480
+ function shouldExecuteAction2(action) {
89380
89481
  if (action.action === "install" || action.action === "update") {
89381
89482
  return true;
89382
89483
  }
@@ -89391,7 +89492,7 @@ async function executeDeleteAction(action, options2) {
89391
89492
  const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve21(action.targetPath));
89392
89493
  try {
89393
89494
  if (!shouldPreserveTarget && action.targetPath && existsSync50(action.targetPath)) {
89394
- await rm12(action.targetPath, { recursive: true, force: true });
89495
+ await rm13(action.targetPath, { recursive: true, force: true });
89395
89496
  }
89396
89497
  await removePortableInstallation(action.item, action.type, action.provider, action.global);
89397
89498
  return {
@@ -89638,7 +89739,7 @@ async function migrateCommand(options2) {
89638
89739
  command: 3,
89639
89740
  skill: 4
89640
89741
  };
89641
- const plannedExecActions = plan.actions.filter(shouldExecuteAction).sort((a3, b3) => (typePriority[a3.type] ?? 99) - (typePriority[b3.type] ?? 99));
89742
+ const plannedExecActions = plan.actions.filter(shouldExecuteAction2).sort((a3, b3) => (typePriority[a3.type] ?? 99) - (typePriority[b3.type] ?? 99));
89642
89743
  const plannedDeleteActions = plan.actions.filter((a3) => a3.action === "delete");
89643
89744
  if (!options2.yes) {
89644
89745
  const totalItems = plannedExecActions.length + plannedDeleteActions.length;
@@ -89758,7 +89859,7 @@ async function rollbackResults(results) {
89758
89859
  continue;
89759
89860
  const stat18 = await import("node:fs/promises").then((fs19) => fs19.stat(result.path));
89760
89861
  if (stat18.isDirectory()) {
89761
- await rm12(result.path, { recursive: true, force: true });
89862
+ await rm13(result.path, { recursive: true, force: true });
89762
89863
  } else {
89763
89864
  await unlink11(result.path);
89764
89865
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.35.0-dev.18",
3
+ "version": "3.35.0-dev.19",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {