claudekit-cli 3.35.0-dev.17 → 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.
- package/dist/index.js +185 -50
- 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
|
-
|
|
50249
|
-
|
|
50250
|
-
|
|
50251
|
-
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
81417
|
+
await rm7(tempExtractDir, { recursive: true, force: true });
|
|
81317
81418
|
} catch (error) {
|
|
81318
81419
|
try {
|
|
81319
|
-
await
|
|
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
|
|
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
|
|
81504
|
+
await rm8(tempExtractDir, { recursive: true, force: true });
|
|
81404
81505
|
} catch (error) {
|
|
81405
81506
|
try {
|
|
81406
|
-
await
|
|
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
|
|
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
|
|
86541
|
+
await rm9(currentSkillsDir, { recursive: true, force: true });
|
|
86441
86542
|
await mkdir26(currentSkillsDir, { recursive: true });
|
|
86442
86543
|
await copySkillDirectory(tempDir, currentSkillsDir);
|
|
86443
|
-
await
|
|
86544
|
+
await rm9(tempDir, { recursive: true, force: true });
|
|
86444
86545
|
return { migrated, preserved, errors: errors2 };
|
|
86445
86546
|
} catch (error) {
|
|
86446
86547
|
try {
|
|
86447
|
-
await
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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");
|
|
@@ -87239,16 +87340,7 @@ async function handlePostInstall(ctx) {
|
|
|
87239
87340
|
return ctx;
|
|
87240
87341
|
}
|
|
87241
87342
|
if (ctx.options.global) {
|
|
87242
|
-
|
|
87243
|
-
const claudeMdDest = join99(ctx.resolvedDir, "CLAUDE.md");
|
|
87244
|
-
if (await import_fs_extra30.pathExists(claudeMdSource)) {
|
|
87245
|
-
if (!await import_fs_extra30.pathExists(claudeMdDest)) {
|
|
87246
|
-
await import_fs_extra30.copy(claudeMdSource, claudeMdDest);
|
|
87247
|
-
logger.success("Copied CLAUDE.md to global directory");
|
|
87248
|
-
} else {
|
|
87249
|
-
logger.debug("CLAUDE.md already exists in global directory (preserved)");
|
|
87250
|
-
}
|
|
87251
|
-
}
|
|
87343
|
+
await handleGlobalClaudeMd(ctx);
|
|
87252
87344
|
}
|
|
87253
87345
|
let installSkills = ctx.options.installSkills;
|
|
87254
87346
|
if (!ctx.isNonInteractive && !installSkills) {
|
|
@@ -87308,6 +87400,49 @@ async function handlePostInstall(ctx) {
|
|
|
87308
87400
|
installSkills
|
|
87309
87401
|
};
|
|
87310
87402
|
}
|
|
87403
|
+
function normalizeLineEndings(content) {
|
|
87404
|
+
return content.replace(/\r\n/g, `
|
|
87405
|
+
`);
|
|
87406
|
+
}
|
|
87407
|
+
async function handleGlobalClaudeMd(ctx) {
|
|
87408
|
+
if (!ctx.extractDir || !ctx.resolvedDir)
|
|
87409
|
+
return;
|
|
87410
|
+
const claudeMdSource = join99(ctx.extractDir, "CLAUDE.md");
|
|
87411
|
+
const claudeMdDest = join99(ctx.resolvedDir, "CLAUDE.md");
|
|
87412
|
+
if (!await import_fs_extra30.pathExists(claudeMdSource))
|
|
87413
|
+
return;
|
|
87414
|
+
const destExists = await import_fs_extra30.pathExists(claudeMdDest);
|
|
87415
|
+
if (!destExists) {
|
|
87416
|
+
await import_fs_extra30.copy(claudeMdSource, claudeMdDest);
|
|
87417
|
+
logger.success("Copied CLAUDE.md to global directory");
|
|
87418
|
+
return;
|
|
87419
|
+
}
|
|
87420
|
+
if (ctx.options.fresh || ctx.options.forceOverwrite) {
|
|
87421
|
+
await import_fs_extra30.copy(claudeMdSource, claudeMdDest);
|
|
87422
|
+
logger.success("Updated CLAUDE.md in global directory");
|
|
87423
|
+
return;
|
|
87424
|
+
}
|
|
87425
|
+
const [srcContent, destContent] = await Promise.all([
|
|
87426
|
+
import_fs_extra30.readFile(claudeMdSource, "utf-8"),
|
|
87427
|
+
import_fs_extra30.readFile(claudeMdDest, "utf-8")
|
|
87428
|
+
]);
|
|
87429
|
+
if (normalizeLineEndings(srcContent) === normalizeLineEndings(destContent)) {
|
|
87430
|
+
logger.debug("CLAUDE.md already up to date");
|
|
87431
|
+
return;
|
|
87432
|
+
}
|
|
87433
|
+
if (!ctx.isNonInteractive) {
|
|
87434
|
+
const shouldOverwrite = await ctx.prompts.confirm(`CLAUDE.md has changed in the new version. Update it?
|
|
87435
|
+
(Your customizations will be replaced)`);
|
|
87436
|
+
if (!shouldOverwrite) {
|
|
87437
|
+
logger.info("CLAUDE.md preserved (user chose to keep existing)");
|
|
87438
|
+
return;
|
|
87439
|
+
}
|
|
87440
|
+
} else {
|
|
87441
|
+
logger.warning("Updating CLAUDE.md (content differs from new version)");
|
|
87442
|
+
}
|
|
87443
|
+
await import_fs_extra30.copy(claudeMdSource, claudeMdDest);
|
|
87444
|
+
logger.success("Updated CLAUDE.md (new version detected)");
|
|
87445
|
+
}
|
|
87311
87446
|
// src/commands/init/phases/selection-handler.ts
|
|
87312
87447
|
init_config_manager();
|
|
87313
87448
|
init_github_client();
|
|
@@ -87969,7 +88104,7 @@ async function handleSelection(ctx) {
|
|
|
87969
88104
|
};
|
|
87970
88105
|
}
|
|
87971
88106
|
// src/commands/init/phases/sync-handler.ts
|
|
87972
|
-
import { copyFile as copyFile7, mkdir as mkdir29, open as open4, readFile as
|
|
88107
|
+
import { copyFile as copyFile7, mkdir as mkdir29, open as open4, readFile as readFile48, rename as rename5, stat as stat17, unlink as unlink10, writeFile as writeFile28 } from "node:fs/promises";
|
|
87973
88108
|
import { dirname as dirname21, join as join102, resolve as resolve20 } from "node:path";
|
|
87974
88109
|
init_logger();
|
|
87975
88110
|
init_path_resolver();
|
|
@@ -88137,7 +88272,7 @@ async function executeSyncMerge(ctx) {
|
|
|
88137
88272
|
try {
|
|
88138
88273
|
const sourceMetadataPath = join102(upstreamDir, "metadata.json");
|
|
88139
88274
|
if (await import_fs_extra33.pathExists(sourceMetadataPath)) {
|
|
88140
|
-
const content = await
|
|
88275
|
+
const content = await readFile48(sourceMetadataPath, "utf-8");
|
|
88141
88276
|
const sourceMetadata = JSON.parse(content);
|
|
88142
88277
|
deletions = sourceMetadata.deletions || [];
|
|
88143
88278
|
}
|
|
@@ -88363,7 +88498,7 @@ init_types3();
|
|
|
88363
88498
|
init_logger();
|
|
88364
88499
|
init_types3();
|
|
88365
88500
|
var import_fs_extra34 = __toESM(require_lib3(), 1);
|
|
88366
|
-
import { rename as rename6, rm as
|
|
88501
|
+
import { rename as rename6, rm as rm12 } from "node:fs/promises";
|
|
88367
88502
|
import { join as join103, relative as relative17 } from "node:path";
|
|
88368
88503
|
async function collectDirsToRename(extractDir, folders) {
|
|
88369
88504
|
const dirsToRename = [];
|
|
@@ -88408,7 +88543,7 @@ async function moveAcrossDevices(src, dest) {
|
|
|
88408
88543
|
if (e2.code === "EXDEV") {
|
|
88409
88544
|
logger.debug(`Cross-device move detected, using copy+delete: ${src} -> ${dest}`);
|
|
88410
88545
|
await import_fs_extra34.copy(src, dest, { overwrite: true });
|
|
88411
|
-
await
|
|
88546
|
+
await rm12(src, { recursive: true, force: true });
|
|
88412
88547
|
} else {
|
|
88413
88548
|
throw e2;
|
|
88414
88549
|
}
|
|
@@ -88435,7 +88570,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
88435
88570
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
88436
88571
|
init_logger();
|
|
88437
88572
|
init_types3();
|
|
88438
|
-
import { readFile as
|
|
88573
|
+
import { readFile as readFile49, readdir as readdir32, writeFile as writeFile29 } from "node:fs/promises";
|
|
88439
88574
|
import { join as join104, relative as relative18 } from "node:path";
|
|
88440
88575
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
88441
88576
|
".md",
|
|
@@ -88502,7 +88637,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
88502
88637
|
if (!shouldTransform)
|
|
88503
88638
|
continue;
|
|
88504
88639
|
try {
|
|
88505
|
-
const content = await
|
|
88640
|
+
const content = await readFile49(fullPath, "utf-8");
|
|
88506
88641
|
let newContent = content;
|
|
88507
88642
|
let changeCount = 0;
|
|
88508
88643
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -88624,7 +88759,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
88624
88759
|
|
|
88625
88760
|
// src/services/transformers/global-path-transformer.ts
|
|
88626
88761
|
init_logger();
|
|
88627
|
-
import { readFile as
|
|
88762
|
+
import { readFile as readFile50, readdir as readdir33, writeFile as writeFile30 } from "node:fs/promises";
|
|
88628
88763
|
import { platform as platform13 } from "node:os";
|
|
88629
88764
|
import { extname as extname5, join as join105 } from "node:path";
|
|
88630
88765
|
var IS_WINDOWS3 = platform13() === "win32";
|
|
@@ -88744,7 +88879,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
88744
88879
|
await processDirectory2(fullPath);
|
|
88745
88880
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
88746
88881
|
try {
|
|
88747
|
-
const content = await
|
|
88882
|
+
const content = await readFile50(fullPath, "utf-8");
|
|
88748
88883
|
const { transformed, changes } = transformContent(content);
|
|
88749
88884
|
if (changes > 0) {
|
|
88750
88885
|
await writeFile30(fullPath, transformed, "utf-8");
|
|
@@ -89006,7 +89141,7 @@ init_checksum_utils();
|
|
|
89006
89141
|
init_config_discovery();
|
|
89007
89142
|
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
89008
89143
|
import { existsSync as existsSync50 } from "node:fs";
|
|
89009
|
-
import { readFile as
|
|
89144
|
+
import { readFile as readFile51, rm as rm13, unlink as unlink11 } from "node:fs/promises";
|
|
89010
89145
|
import { resolve as resolve21 } from "node:path";
|
|
89011
89146
|
|
|
89012
89147
|
// src/commands/portable/conflict-resolver.ts
|
|
@@ -89342,7 +89477,7 @@ function getProviderPathKey(type) {
|
|
|
89342
89477
|
return type;
|
|
89343
89478
|
}
|
|
89344
89479
|
}
|
|
89345
|
-
function
|
|
89480
|
+
function shouldExecuteAction2(action) {
|
|
89346
89481
|
if (action.action === "install" || action.action === "update") {
|
|
89347
89482
|
return true;
|
|
89348
89483
|
}
|
|
@@ -89357,7 +89492,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
89357
89492
|
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve21(action.targetPath));
|
|
89358
89493
|
try {
|
|
89359
89494
|
if (!shouldPreserveTarget && action.targetPath && existsSync50(action.targetPath)) {
|
|
89360
|
-
await
|
|
89495
|
+
await rm13(action.targetPath, { recursive: true, force: true });
|
|
89361
89496
|
}
|
|
89362
89497
|
await removePortableInstallation(action.item, action.type, action.provider, action.global);
|
|
89363
89498
|
return {
|
|
@@ -89580,7 +89715,7 @@ async function migrateCommand(options2) {
|
|
|
89580
89715
|
for (const action of conflictActions) {
|
|
89581
89716
|
if (!action.diff && action.targetPath && existsSync50(action.targetPath)) {
|
|
89582
89717
|
try {
|
|
89583
|
-
const targetContent = await
|
|
89718
|
+
const targetContent = await readFile51(action.targetPath, "utf-8");
|
|
89584
89719
|
const sourceItem = agents2.find((a3) => a3.name === action.item) || commands.find((c2) => c2.name === action.item) || (configItem?.name === action.item ? configItem : null) || ruleItems.find((r2) => r2.name === action.item);
|
|
89585
89720
|
if (sourceItem) {
|
|
89586
89721
|
const providerConfig = providers[action.provider];
|
|
@@ -89604,7 +89739,7 @@ async function migrateCommand(options2) {
|
|
|
89604
89739
|
command: 3,
|
|
89605
89740
|
skill: 4
|
|
89606
89741
|
};
|
|
89607
|
-
const plannedExecActions = plan.actions.filter(
|
|
89742
|
+
const plannedExecActions = plan.actions.filter(shouldExecuteAction2).sort((a3, b3) => (typePriority[a3.type] ?? 99) - (typePriority[b3.type] ?? 99));
|
|
89608
89743
|
const plannedDeleteActions = plan.actions.filter((a3) => a3.action === "delete");
|
|
89609
89744
|
if (!options2.yes) {
|
|
89610
89745
|
const totalItems = plannedExecActions.length + plannedDeleteActions.length;
|
|
@@ -89724,7 +89859,7 @@ async function rollbackResults(results) {
|
|
|
89724
89859
|
continue;
|
|
89725
89860
|
const stat18 = await import("node:fs/promises").then((fs19) => fs19.stat(result.path));
|
|
89726
89861
|
if (stat18.isDirectory()) {
|
|
89727
|
-
await
|
|
89862
|
+
await rm13(result.path, { recursive: true, force: true });
|
|
89728
89863
|
} else {
|
|
89729
89864
|
await unlink11(result.path);
|
|
89730
89865
|
}
|
|
@@ -89774,7 +89909,7 @@ async function computeTargetStates(selectedProviders, global3) {
|
|
|
89774
89909
|
continue;
|
|
89775
89910
|
try {
|
|
89776
89911
|
if (existsSync50(entry.path)) {
|
|
89777
|
-
const content = await
|
|
89912
|
+
const content = await readFile51(entry.path, "utf-8");
|
|
89778
89913
|
states.set(entry.path, {
|
|
89779
89914
|
path: entry.path,
|
|
89780
89915
|
exists: true,
|