claudekit-cli 4.4.0-dev.13 → 4.4.0-dev.14
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/cli-manifest.json +3 -3
- package/dist/index.js +450 -222
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10777,7 +10777,30 @@ import { extname } from "node:path";
|
|
|
10777
10777
|
function rewriteKiroPaths(content) {
|
|
10778
10778
|
return content.replace(/\.claude\/skills\//g, ".kiro/skills/").replace(/\.claude\/agents\//g, ".kiro/agents/").replace(/\.claude\/rules\//g, ".kiro/steering/").replace(/\.claude\/commands\//g, "Claude Code commands/").replace(/\.claude\/hooks\//g, "Claude Code hooks/");
|
|
10779
10779
|
}
|
|
10780
|
-
function
|
|
10780
|
+
function splitTrailingPunctuation(pathSuffix) {
|
|
10781
|
+
const match = pathSuffix.match(/^(.+?)([.,;:!?]+)?$/);
|
|
10782
|
+
return {
|
|
10783
|
+
itemPath: match?.[1] ?? pathSuffix,
|
|
10784
|
+
punctuation: match?.[2] ?? ""
|
|
10785
|
+
};
|
|
10786
|
+
}
|
|
10787
|
+
function rewriteAntigravityCommandRefSuffix(suffix) {
|
|
10788
|
+
const { itemPath, punctuation } = splitTrailingPunctuation(suffix);
|
|
10789
|
+
const extIdx = itemPath.lastIndexOf(".");
|
|
10790
|
+
const ext = extIdx >= 0 ? itemPath.substring(extIdx) : "";
|
|
10791
|
+
const nameWithoutExt = extIdx >= 0 ? itemPath.substring(0, extIdx) : itemPath;
|
|
10792
|
+
return `${nameWithoutExt.replace(/[\\/]+/g, "-")}${ext}${punctuation}`;
|
|
10793
|
+
}
|
|
10794
|
+
function rewriteAntigravityPaths(content, options2 = {}) {
|
|
10795
|
+
const skillsBase = options2.global ? "~/.gemini/config/skills/" : ".agents/skills/";
|
|
10796
|
+
return content.replace(/\.claude\/agents\/([a-zA-Z0-9_./-]+)/g, (_matched, suffix) => {
|
|
10797
|
+
const { punctuation } = splitTrailingPunctuation(suffix);
|
|
10798
|
+
return `.agents/agents.md${punctuation}`;
|
|
10799
|
+
}).replace(/\.claude\/commands\/([a-zA-Z0-9_./-]+)/g, (_matched, suffix) => {
|
|
10800
|
+
return `.agents/workflows/${rewriteAntigravityCommandRefSuffix(suffix)}`;
|
|
10801
|
+
}).replace(/\.claude\/skills\//g, skillsBase).replace(/\.claude\/rules\//g, ".agents/rules/").replace(/\.claude\/agents\//g, ".agents/agents.md").replace(/\.claude\/commands\//g, ".agents/workflows/").replace(/\.claude\/hooks\//g, "Claude Code hooks/");
|
|
10802
|
+
}
|
|
10803
|
+
function convertDirectCopy(item, provider, options2 = {}) {
|
|
10781
10804
|
let content;
|
|
10782
10805
|
try {
|
|
10783
10806
|
content = readFileSync(item.sourcePath, "utf-8");
|
|
@@ -10791,6 +10814,8 @@ function convertDirectCopy(item, provider) {
|
|
|
10791
10814
|
if (provider && provider !== "claude-code") {
|
|
10792
10815
|
if (provider === "kiro") {
|
|
10793
10816
|
content = rewriteKiroPaths(content);
|
|
10817
|
+
} else if (provider === "antigravity") {
|
|
10818
|
+
content = rewriteAntigravityPaths(content, options2);
|
|
10794
10819
|
} else {
|
|
10795
10820
|
const targetDir = PROVIDER_CONFIG_DIR[provider];
|
|
10796
10821
|
if (targetDir) {
|
|
@@ -10823,7 +10848,6 @@ var init_direct_copy = __esm(() => {
|
|
|
10823
10848
|
opencode: ".opencode/",
|
|
10824
10849
|
droid: ".factory/",
|
|
10825
10850
|
windsurf: ".windsurf/",
|
|
10826
|
-
antigravity: ".agent/",
|
|
10827
10851
|
cursor: ".cursor/",
|
|
10828
10852
|
roo: ".roo/",
|
|
10829
10853
|
kilo: ".kilocode/",
|
|
@@ -11629,9 +11653,15 @@ var init_provider_registry = __esm(() => {
|
|
|
11629
11653
|
name: "antigravity",
|
|
11630
11654
|
displayName: "Antigravity",
|
|
11631
11655
|
subagents: "full",
|
|
11632
|
-
agents:
|
|
11656
|
+
agents: {
|
|
11657
|
+
projectPath: ".agents/agents.md",
|
|
11658
|
+
globalPath: null,
|
|
11659
|
+
format: "fm-strip",
|
|
11660
|
+
writeStrategy: "merge-single",
|
|
11661
|
+
fileExtension: ".md"
|
|
11662
|
+
},
|
|
11633
11663
|
commands: {
|
|
11634
|
-
projectPath: ".
|
|
11664
|
+
projectPath: ".agents/workflows",
|
|
11635
11665
|
globalPath: null,
|
|
11636
11666
|
format: "direct-copy",
|
|
11637
11667
|
writeStrategy: "per-file",
|
|
@@ -11639,8 +11669,8 @@ var init_provider_registry = __esm(() => {
|
|
|
11639
11669
|
nestedCommands: false
|
|
11640
11670
|
},
|
|
11641
11671
|
skills: {
|
|
11642
|
-
projectPath: ".
|
|
11643
|
-
globalPath: join(home, ".gemini/
|
|
11672
|
+
projectPath: ".agents/skills",
|
|
11673
|
+
globalPath: join(home, ".gemini/config/skills"),
|
|
11644
11674
|
format: "direct-copy",
|
|
11645
11675
|
writeStrategy: "per-file",
|
|
11646
11676
|
fileExtension: ".md"
|
|
@@ -11653,7 +11683,7 @@ var init_provider_registry = __esm(() => {
|
|
|
11653
11683
|
fileExtension: ".md"
|
|
11654
11684
|
},
|
|
11655
11685
|
rules: {
|
|
11656
|
-
projectPath: ".
|
|
11686
|
+
projectPath: ".agents/rules",
|
|
11657
11687
|
globalPath: null,
|
|
11658
11688
|
format: "md-strip",
|
|
11659
11689
|
writeStrategy: "per-file",
|
|
@@ -11662,10 +11692,18 @@ var init_provider_registry = __esm(() => {
|
|
|
11662
11692
|
hooks: null,
|
|
11663
11693
|
settingsJsonPath: null,
|
|
11664
11694
|
detect: async () => hasBinaryInPath("agy") || hasBinaryInPath("antigravity") || hasAnyInstallSignal([
|
|
11695
|
+
join(cwd, ".agents/rules"),
|
|
11696
|
+
join(cwd, ".agents/agents.md"),
|
|
11697
|
+
join(cwd, ".agents/skills"),
|
|
11698
|
+
join(cwd, ".agents/workflows"),
|
|
11699
|
+
join(cwd, ".agents/plugins"),
|
|
11665
11700
|
join(cwd, ".agent/rules"),
|
|
11666
11701
|
join(cwd, ".agent/skills"),
|
|
11667
11702
|
join(cwd, ".agent/workflows"),
|
|
11668
11703
|
join(cwd, "GEMINI.md"),
|
|
11704
|
+
join(home, ".gemini/config"),
|
|
11705
|
+
join(home, ".gemini/config/skills"),
|
|
11706
|
+
join(home, ".gemini/config/plugins"),
|
|
11669
11707
|
join(home, ".gemini/antigravity"),
|
|
11670
11708
|
join(home, ".gemini/antigravity/skills")
|
|
11671
11709
|
])
|
|
@@ -11765,7 +11803,7 @@ function normalizeProjectPath(path2) {
|
|
|
11765
11803
|
const home2 = homedir2().replace(/\\/g, "/");
|
|
11766
11804
|
return normalized.startsWith(home2) ? normalized.replace(home2, "~") : normalized;
|
|
11767
11805
|
}
|
|
11768
|
-
function
|
|
11806
|
+
function splitTrailingPunctuation2(pathSuffix) {
|
|
11769
11807
|
const match = pathSuffix.match(/^(.+?)([.,;:!?]+)?$/);
|
|
11770
11808
|
return {
|
|
11771
11809
|
itemPath: match?.[1] ?? pathSuffix,
|
|
@@ -11788,7 +11826,7 @@ function getProviderPathTarget(provider, type, global2 = false) {
|
|
|
11788
11826
|
return {
|
|
11789
11827
|
path: isDirectory && !normalized.endsWith("/") ? `${normalized}/` : normalized,
|
|
11790
11828
|
isDirectory,
|
|
11791
|
-
rewriteSuffix: provider === "codex" && type === "commands" ? getCodexCommandSkillFilenameFromCommandPath : undefined
|
|
11829
|
+
rewriteSuffix: provider === "codex" && type === "commands" ? getCodexCommandSkillFilenameFromCommandPath : provider === "antigravity" && type === "commands" ? rewriteAntigravityCommandRefSuffix : undefined
|
|
11792
11830
|
};
|
|
11793
11831
|
}
|
|
11794
11832
|
function rewriteClaudeDirectoryRefs(input, sourceDir, target, fallbackPrefix, isInCodeBlock) {
|
|
@@ -11798,7 +11836,7 @@ function rewriteClaudeDirectoryRefs(input, sourceDir, target, fallbackPrefix, is
|
|
|
11798
11836
|
const offset = args[args.length - 2];
|
|
11799
11837
|
if (isInCodeBlock(offset))
|
|
11800
11838
|
return matched;
|
|
11801
|
-
const { itemPath, punctuation } =
|
|
11839
|
+
const { itemPath, punctuation } = splitTrailingPunctuation2(suffix);
|
|
11802
11840
|
if (!target)
|
|
11803
11841
|
return `${fallbackPrefix}${itemPath}${punctuation}`;
|
|
11804
11842
|
const rewrittenSuffix = target.rewriteSuffix ? target.rewriteSuffix(itemPath) : itemPath;
|
|
@@ -12051,13 +12089,14 @@ function convertMdStrip(item, provider, options2 = {}) {
|
|
|
12051
12089
|
var MAX_CONTENT_SIZE = 512000;
|
|
12052
12090
|
var init_md_strip = __esm(() => {
|
|
12053
12091
|
init_provider_registry();
|
|
12092
|
+
init_direct_copy();
|
|
12054
12093
|
});
|
|
12055
12094
|
|
|
12056
12095
|
// src/commands/portable/converters/fm-strip.ts
|
|
12057
12096
|
function convertFmStrip(item, provider) {
|
|
12058
12097
|
const warnings = [];
|
|
12059
12098
|
const heading = item.frontmatter.name || item.name;
|
|
12060
|
-
const isMergeProvider = ["goose", "gemini-cli", "amp"].includes(provider);
|
|
12099
|
+
const isMergeProvider = ["goose", "gemini-cli", "amp", "antigravity"].includes(provider);
|
|
12061
12100
|
let body = item.body;
|
|
12062
12101
|
if (PROVIDERS_WITH_BODY_REWRITING.includes(provider)) {
|
|
12063
12102
|
const stripped = stripClaudeRefs(body, { provider });
|
|
@@ -12106,7 +12145,7 @@ function buildMergedAgentsMd(sections, providerName) {
|
|
|
12106
12145
|
var PROVIDERS_WITH_BODY_REWRITING;
|
|
12107
12146
|
var init_fm_strip = __esm(() => {
|
|
12108
12147
|
init_md_strip();
|
|
12109
|
-
PROVIDERS_WITH_BODY_REWRITING = ["gemini-cli"];
|
|
12148
|
+
PROVIDERS_WITH_BODY_REWRITING = ["gemini-cli", "antigravity"];
|
|
12110
12149
|
});
|
|
12111
12150
|
|
|
12112
12151
|
// src/commands/portable/converters/fm-to-fm.ts
|
|
@@ -12618,14 +12657,15 @@ var init_md_to_mdc = __esm(() => {
|
|
|
12618
12657
|
});
|
|
12619
12658
|
|
|
12620
12659
|
// src/commands/portable/converters/skill-md.ts
|
|
12621
|
-
function convertToSkillMd(item) {
|
|
12660
|
+
function convertToSkillMd(item, provider, options2 = {}) {
|
|
12622
12661
|
const fm = {
|
|
12623
12662
|
name: item.frontmatter.name || item.name,
|
|
12624
12663
|
description: item.description || ""
|
|
12625
12664
|
};
|
|
12665
|
+
const itemBody = provider === "antigravity" ? rewriteAntigravityPaths(item.body, options2) : item.body;
|
|
12626
12666
|
const body = `# ${fm.name}
|
|
12627
12667
|
|
|
12628
|
-
${
|
|
12668
|
+
${itemBody}`;
|
|
12629
12669
|
const content = import_gray_matter2.default.stringify(body, fm);
|
|
12630
12670
|
return {
|
|
12631
12671
|
content,
|
|
@@ -12635,6 +12675,7 @@ ${item.body}`;
|
|
|
12635
12675
|
}
|
|
12636
12676
|
var import_gray_matter2;
|
|
12637
12677
|
var init_skill_md = __esm(() => {
|
|
12678
|
+
init_direct_copy();
|
|
12638
12679
|
import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
12639
12680
|
});
|
|
12640
12681
|
|
|
@@ -12643,7 +12684,7 @@ function convertItem(item, format, provider, options2 = {}) {
|
|
|
12643
12684
|
try {
|
|
12644
12685
|
switch (format) {
|
|
12645
12686
|
case "direct-copy":
|
|
12646
|
-
return convertDirectCopy(item, provider);
|
|
12687
|
+
return convertDirectCopy(item, provider, { global: options2.global });
|
|
12647
12688
|
case "command-to-codex-skill":
|
|
12648
12689
|
return convertCommandToCodexSkill(item);
|
|
12649
12690
|
case "fm-to-fm":
|
|
@@ -12657,7 +12698,7 @@ function convertItem(item, format, provider, options2 = {}) {
|
|
|
12657
12698
|
case "md-to-toml":
|
|
12658
12699
|
return convertMdToToml(item);
|
|
12659
12700
|
case "skill-md":
|
|
12660
|
-
return convertToSkillMd(item);
|
|
12701
|
+
return convertToSkillMd(item, provider, { global: options2.global });
|
|
12661
12702
|
case "md-strip":
|
|
12662
12703
|
return convertMdStrip(item, provider, { global: options2.global });
|
|
12663
12704
|
case "md-to-mdc":
|
|
@@ -51989,7 +52030,7 @@ var init_migrate_provider_scopes = __esm(() => {
|
|
|
51989
52030
|
|
|
51990
52031
|
// src/commands/migrate/skill-directory-installer.ts
|
|
51991
52032
|
import { existsSync as existsSync22 } from "node:fs";
|
|
51992
|
-
import { cp, mkdir as mkdir10, realpath as realpath6, rename as rename6, rm as rm5 } from "node:fs/promises";
|
|
52033
|
+
import { cp, mkdir as mkdir10, readFile as readFile19, realpath as realpath6, rename as rename6, rm as rm5, writeFile as writeFile11 } from "node:fs/promises";
|
|
51993
52034
|
import { dirname as dirname11, join as join40, resolve as resolve15 } from "node:path";
|
|
51994
52035
|
async function canonicalize(path4) {
|
|
51995
52036
|
try {
|
|
@@ -52010,6 +52051,18 @@ async function canonicalize(path4) {
|
|
|
52010
52051
|
}
|
|
52011
52052
|
}
|
|
52012
52053
|
}
|
|
52054
|
+
async function rewriteInstalledSkillMd(targetDir, provider, options2) {
|
|
52055
|
+
if (provider !== "antigravity")
|
|
52056
|
+
return;
|
|
52057
|
+
const skillMdPath = join40(targetDir, "SKILL.md");
|
|
52058
|
+
if (!existsSync22(skillMdPath))
|
|
52059
|
+
return;
|
|
52060
|
+
const content = await readFile19(skillMdPath, "utf-8");
|
|
52061
|
+
const rewritten = rewriteAntigravityPaths(content, { global: options2.global });
|
|
52062
|
+
if (rewritten !== content) {
|
|
52063
|
+
await writeFile11(skillMdPath, rewritten, "utf-8");
|
|
52064
|
+
}
|
|
52065
|
+
}
|
|
52013
52066
|
async function installSkillDirectories(skills, targetProviders, options2) {
|
|
52014
52067
|
const results = [];
|
|
52015
52068
|
for (const provider of targetProviders) {
|
|
@@ -52081,6 +52134,7 @@ async function installSkillDirectories(skills, targetProviders, options2) {
|
|
|
52081
52134
|
try {
|
|
52082
52135
|
await cp(skill.path, targetDir, { recursive: true, force: true });
|
|
52083
52136
|
copied = true;
|
|
52137
|
+
await rewriteInstalledSkillMd(targetDir, provider, options2);
|
|
52084
52138
|
await addPortableInstallation(skill.name, "skill", provider, options2.global, targetDir, skill.path);
|
|
52085
52139
|
} catch (error) {
|
|
52086
52140
|
try {
|
|
@@ -52125,13 +52179,14 @@ async function installSkillDirectories(skills, targetProviders, options2) {
|
|
|
52125
52179
|
return results;
|
|
52126
52180
|
}
|
|
52127
52181
|
var init_skill_directory_installer = __esm(() => {
|
|
52182
|
+
init_direct_copy();
|
|
52128
52183
|
init_portable_registry();
|
|
52129
52184
|
init_provider_registry();
|
|
52130
52185
|
});
|
|
52131
52186
|
|
|
52132
52187
|
// src/commands/portable/config-discovery.ts
|
|
52133
52188
|
import { existsSync as existsSync23, readFileSync as readFileSync6 } from "node:fs";
|
|
52134
|
-
import { cp as cp2, mkdir as mkdir11, readFile as
|
|
52189
|
+
import { cp as cp2, mkdir as mkdir11, readFile as readFile20, readdir as readdir12, stat as stat8 } from "node:fs/promises";
|
|
52135
52190
|
import { homedir as homedir23 } from "node:os";
|
|
52136
52191
|
import { basename as basename13, dirname as dirname12, extname as extname3, join as join41, relative as relative9, resolve as resolve16, sep as sep6 } from "node:path";
|
|
52137
52192
|
async function copyHooksCompanionDirs(sourceDir, targetDir) {
|
|
@@ -52249,7 +52304,7 @@ async function discoverConfig(sourcePath) {
|
|
|
52249
52304
|
if (!existsSync23(path4)) {
|
|
52250
52305
|
return null;
|
|
52251
52306
|
}
|
|
52252
|
-
const content = await
|
|
52307
|
+
const content = await readFile20(path4, "utf-8");
|
|
52253
52308
|
return {
|
|
52254
52309
|
name: "CLAUDE",
|
|
52255
52310
|
description: "Project configuration",
|
|
@@ -52306,7 +52361,7 @@ async function discoverHooks(sourcePath) {
|
|
|
52306
52361
|
continue;
|
|
52307
52362
|
}
|
|
52308
52363
|
try {
|
|
52309
|
-
const content = await
|
|
52364
|
+
const content = await readFile20(file.fullPath, "utf-8");
|
|
52310
52365
|
items.push({
|
|
52311
52366
|
name: file.name,
|
|
52312
52367
|
segments: file.name.split("/"),
|
|
@@ -52335,7 +52390,7 @@ async function readHooksNearHooksDir(hooksDir) {
|
|
|
52335
52390
|
if (!existsSync23(settingsPath))
|
|
52336
52391
|
return null;
|
|
52337
52392
|
try {
|
|
52338
|
-
const parsed = JSON.parse(await
|
|
52393
|
+
const parsed = JSON.parse(await readFile20(settingsPath, "utf-8"));
|
|
52339
52394
|
return parsed.hooks && typeof parsed.hooks === "object" ? parsed.hooks : null;
|
|
52340
52395
|
} catch {
|
|
52341
52396
|
return null;
|
|
@@ -52473,7 +52528,7 @@ async function discoverPortableFiles(dir, baseDir, options2) {
|
|
|
52473
52528
|
const normalizedPath = relPath.split(/[/\\]/).join("/");
|
|
52474
52529
|
const name = options2.stripExtension ? normalizedPath.replace(/\.[^.]+$/, "") : normalizedPath;
|
|
52475
52530
|
try {
|
|
52476
|
-
const content = await
|
|
52531
|
+
const content = await readFile20(fullPath, "utf-8");
|
|
52477
52532
|
items.push({
|
|
52478
52533
|
name,
|
|
52479
52534
|
description: `${options2.descriptionPrefix}: ${name}`,
|
|
@@ -54484,7 +54539,7 @@ var init_codex_path_safety = __esm(() => {
|
|
|
54484
54539
|
|
|
54485
54540
|
// src/commands/portable/codex-features-flag.ts
|
|
54486
54541
|
import { existsSync as existsSync25 } from "node:fs";
|
|
54487
|
-
import { readFile as
|
|
54542
|
+
import { readFile as readFile21, rename as rename7, unlink as unlink6, writeFile as writeFile12 } from "node:fs/promises";
|
|
54488
54543
|
import { dirname as dirname14, resolve as resolve18 } from "node:path";
|
|
54489
54544
|
async function ensureCodexHooksFeatureFlag(configTomlPath, isGlobal = false) {
|
|
54490
54545
|
const boundary = isGlobal ? getCodexGlobalBoundary() : dirname14(resolve18(configTomlPath));
|
|
@@ -54501,7 +54556,7 @@ async function _ensureFeatureFlagLocked(configTomlPath) {
|
|
|
54501
54556
|
let existing = "";
|
|
54502
54557
|
if (existsSync25(configTomlPath)) {
|
|
54503
54558
|
try {
|
|
54504
|
-
existing = await
|
|
54559
|
+
existing = await readFile21(configTomlPath, "utf8");
|
|
54505
54560
|
} catch (err) {
|
|
54506
54561
|
return {
|
|
54507
54562
|
status: "failed",
|
|
@@ -54633,7 +54688,7 @@ function stripAllManagedBlocks(content) {
|
|
|
54633
54688
|
async function atomicWrite(filePath, content) {
|
|
54634
54689
|
const tempPath = `${filePath}.ck-tmp`;
|
|
54635
54690
|
try {
|
|
54636
|
-
await
|
|
54691
|
+
await writeFile12(tempPath, content, "utf8");
|
|
54637
54692
|
await rename7(tempPath, filePath);
|
|
54638
54693
|
} catch (err) {
|
|
54639
54694
|
try {
|
|
@@ -55081,7 +55136,7 @@ var init_gemini_hook_event_map = __esm(() => {
|
|
|
55081
55136
|
|
|
55082
55137
|
// src/commands/portable/hooks-settings-merger.ts
|
|
55083
55138
|
import { existsSync as existsSync26 } from "node:fs";
|
|
55084
|
-
import { mkdir as mkdir13, readFile as
|
|
55139
|
+
import { mkdir as mkdir13, readFile as readFile22, rename as rename8, rm as rm6, writeFile as writeFile13 } from "node:fs/promises";
|
|
55085
55140
|
import { homedir as homedir26 } from "node:os";
|
|
55086
55141
|
import { basename as basename14, dirname as dirname16, extname as extname4, join as join44, resolve as resolve20 } from "node:path";
|
|
55087
55142
|
function isCodexWrappableHookPath(filePath) {
|
|
@@ -55124,7 +55179,7 @@ async function inspectHooksSettings(settingsPath) {
|
|
|
55124
55179
|
if (!existsSync26(settingsPath)) {
|
|
55125
55180
|
return { status: "missing-file" };
|
|
55126
55181
|
}
|
|
55127
|
-
const raw = await
|
|
55182
|
+
const raw = await readFile22(settingsPath, "utf8");
|
|
55128
55183
|
const parsed = JSON.parse(raw);
|
|
55129
55184
|
if (!parsed.hooks || typeof parsed.hooks !== "object") {
|
|
55130
55185
|
return { status: "missing-hooks" };
|
|
@@ -55237,7 +55292,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks, options2 = {
|
|
|
55237
55292
|
let existingSettings = {};
|
|
55238
55293
|
let backupPath = null;
|
|
55239
55294
|
if (existsSync26(targetSettingsPath)) {
|
|
55240
|
-
const raw = await
|
|
55295
|
+
const raw = await readFile22(targetSettingsPath, "utf8");
|
|
55241
55296
|
try {
|
|
55242
55297
|
existingSettings = JSON.parse(raw);
|
|
55243
55298
|
} catch {
|
|
@@ -55246,7 +55301,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks, options2 = {
|
|
|
55246
55301
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
55247
55302
|
backupPath = `${targetSettingsPath}.${timestamp}.bak`;
|
|
55248
55303
|
try {
|
|
55249
|
-
await
|
|
55304
|
+
await writeFile13(backupPath, raw, "utf8");
|
|
55250
55305
|
} catch {
|
|
55251
55306
|
backupPath = null;
|
|
55252
55307
|
}
|
|
@@ -55263,7 +55318,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks, options2 = {
|
|
|
55263
55318
|
await mkdir13(dir, { recursive: true });
|
|
55264
55319
|
const tempPath = `${targetSettingsPath}.tmp`;
|
|
55265
55320
|
try {
|
|
55266
|
-
await
|
|
55321
|
+
await writeFile13(tempPath, JSON.stringify(existingSettings, null, 2), "utf8");
|
|
55267
55322
|
await rename8(tempPath, targetSettingsPath);
|
|
55268
55323
|
} catch (err) {
|
|
55269
55324
|
await rm6(tempPath, { force: true });
|
|
@@ -55817,7 +55872,7 @@ var init_generated_context_hooks = __esm(() => {
|
|
|
55817
55872
|
|
|
55818
55873
|
// src/commands/portable/migrated-hook-settings-cleanup.ts
|
|
55819
55874
|
import { existsSync as existsSync27, realpathSync } from "node:fs";
|
|
55820
|
-
import { readFile as
|
|
55875
|
+
import { readFile as readFile23, rename as rename9, rm as rm7, unlink as unlink7, writeFile as writeFile14 } from "node:fs/promises";
|
|
55821
55876
|
import { basename as basename16, isAbsolute as isAbsolute6, relative as relative10, resolve as resolve21 } from "node:path";
|
|
55822
55877
|
async function pruneSettingsHooks(settingsPath, hooksDir) {
|
|
55823
55878
|
const filesToRemove = new Set;
|
|
@@ -55826,7 +55881,7 @@ async function pruneSettingsHooks(settingsPath, hooksDir) {
|
|
|
55826
55881
|
return { hooksPruned: 0, filesToRemove, warnings };
|
|
55827
55882
|
let parsed;
|
|
55828
55883
|
try {
|
|
55829
|
-
parsed = JSON.parse(await
|
|
55884
|
+
parsed = JSON.parse(await readFile23(settingsPath, "utf8"));
|
|
55830
55885
|
} catch (error) {
|
|
55831
55886
|
warnings.push(`Could not parse ${settingsPath}; hook cleanup skipped (${error instanceof Error ? error.message : String(error)})`);
|
|
55832
55887
|
return { hooksPruned: 0, filesToRemove, warnings };
|
|
@@ -55928,7 +55983,7 @@ function resolvePathForContainment(pathValue) {
|
|
|
55928
55983
|
async function atomicWrite2(filePath, content) {
|
|
55929
55984
|
const tempPath = `${filePath}.ck-tmp`;
|
|
55930
55985
|
try {
|
|
55931
|
-
await
|
|
55986
|
+
await writeFile14(tempPath, `${content}
|
|
55932
55987
|
`, "utf8");
|
|
55933
55988
|
await rename9(tempPath, filePath);
|
|
55934
55989
|
} catch (error) {
|
|
@@ -56015,7 +56070,7 @@ var init_migrated_hooks_cleanup = __esm(() => {
|
|
|
56015
56070
|
|
|
56016
56071
|
// src/commands/portable/portable-manifest.ts
|
|
56017
56072
|
import { existsSync as existsSync28 } from "node:fs";
|
|
56018
|
-
import { readFile as
|
|
56073
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
56019
56074
|
import path4 from "node:path";
|
|
56020
56075
|
async function loadPortableManifest(kitPath) {
|
|
56021
56076
|
const manifestPath = path4.join(kitPath, "portable-manifest.json");
|
|
@@ -56024,7 +56079,7 @@ async function loadPortableManifest(kitPath) {
|
|
|
56024
56079
|
logger.verbose("No portable-manifest.json found — no evolution tracking");
|
|
56025
56080
|
return null;
|
|
56026
56081
|
}
|
|
56027
|
-
const raw = await
|
|
56082
|
+
const raw = await readFile24(manifestPath, "utf-8");
|
|
56028
56083
|
let parsed;
|
|
56029
56084
|
try {
|
|
56030
56085
|
parsed = JSON.parse(raw);
|
|
@@ -56136,7 +56191,7 @@ var init_reconcile_registry_backfill = __esm(() => {
|
|
|
56136
56191
|
|
|
56137
56192
|
// src/commands/portable/reconcile-state-builders.ts
|
|
56138
56193
|
import { existsSync as existsSync29, readdirSync as readdirSync3, statSync as statSync5 } from "node:fs";
|
|
56139
|
-
import { readFile as
|
|
56194
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
56140
56195
|
function getProviderPathKeyForPortableType2(type) {
|
|
56141
56196
|
switch (type) {
|
|
56142
56197
|
case "agent":
|
|
@@ -56337,7 +56392,7 @@ async function buildTargetStates(entries, options2) {
|
|
|
56337
56392
|
const state = { path: entryPath, exists };
|
|
56338
56393
|
if (exists) {
|
|
56339
56394
|
try {
|
|
56340
|
-
const content = await
|
|
56395
|
+
const content = await readFile25(entryPath, "utf-8");
|
|
56341
56396
|
state.currentChecksum = computeContentChecksum(content);
|
|
56342
56397
|
if (groupedEntries.some((entry) => usesMergeSingleChecksums(entry))) {
|
|
56343
56398
|
state.sectionChecksums = computeManagedSectionChecksums(content);
|
|
@@ -56958,7 +57013,7 @@ function detectPathMigrations(input) {
|
|
|
56958
57013
|
const actions = [];
|
|
56959
57014
|
const activeProviderConfigs = dedupeProviderConfigs(input.providerConfigs);
|
|
56960
57015
|
for (const migration of migrations) {
|
|
56961
|
-
const affectedEntries = input.registry.installations.filter((e2) => e2.provider === migration.provider && e2.type === migration.type && pathContainsSegments(e2.path, migration.from) && providerConfigIsActiveForEntry(activeProviderConfigs, e2, { emptyMeansAll: true }));
|
|
57016
|
+
const affectedEntries = input.registry.installations.filter((e2) => e2.provider === migration.provider && e2.type === migration.type && e2.installSource !== "manual" && pathContainsSegments(e2.path, migration.from) && providerConfigIsActiveForEntry(activeProviderConfigs, e2, { emptyMeansAll: true }));
|
|
56962
57017
|
for (const entry of affectedEntries) {
|
|
56963
57018
|
const code = "path-migrated-cleanup";
|
|
56964
57019
|
actions.push({
|
|
@@ -57003,6 +57058,36 @@ var init_reconciler = __esm(() => {
|
|
|
57003
57058
|
type: "command",
|
|
57004
57059
|
from: ".codex/prompts",
|
|
57005
57060
|
to: ".agents/skills"
|
|
57061
|
+
},
|
|
57062
|
+
{
|
|
57063
|
+
provider: "antigravity",
|
|
57064
|
+
type: "command",
|
|
57065
|
+
from: ".agent/workflows",
|
|
57066
|
+
to: ".agents/workflows"
|
|
57067
|
+
},
|
|
57068
|
+
{
|
|
57069
|
+
provider: "antigravity",
|
|
57070
|
+
type: "skill",
|
|
57071
|
+
from: ".agent/skills",
|
|
57072
|
+
to: ".agents/skills"
|
|
57073
|
+
},
|
|
57074
|
+
{
|
|
57075
|
+
provider: "antigravity",
|
|
57076
|
+
type: "agent",
|
|
57077
|
+
from: ".agent/skills",
|
|
57078
|
+
to: ".agents/agents.md"
|
|
57079
|
+
},
|
|
57080
|
+
{
|
|
57081
|
+
provider: "antigravity",
|
|
57082
|
+
type: "skill",
|
|
57083
|
+
from: ".gemini/antigravity/skills",
|
|
57084
|
+
to: ".gemini/config/skills"
|
|
57085
|
+
},
|
|
57086
|
+
{
|
|
57087
|
+
provider: "antigravity",
|
|
57088
|
+
type: "rules",
|
|
57089
|
+
from: ".agent/rules",
|
|
57090
|
+
to: ".agents/rules"
|
|
57006
57091
|
}
|
|
57007
57092
|
];
|
|
57008
57093
|
});
|
|
@@ -57164,7 +57249,7 @@ __export(exports_skills_discovery, {
|
|
|
57164
57249
|
discoverSkillsEnriched: () => discoverSkillsEnriched,
|
|
57165
57250
|
discoverSkills: () => discoverSkills
|
|
57166
57251
|
});
|
|
57167
|
-
import { readFile as
|
|
57252
|
+
import { readFile as readFile26, readdir as readdir13, stat as stat9 } from "node:fs/promises";
|
|
57168
57253
|
import { homedir as homedir27 } from "node:os";
|
|
57169
57254
|
import { dirname as dirname17, join as join45 } from "node:path";
|
|
57170
57255
|
function getSkillSourcePath(globalOnly = false) {
|
|
@@ -57191,7 +57276,7 @@ async function hasSkillMd(dir) {
|
|
|
57191
57276
|
}
|
|
57192
57277
|
async function parseSkillMd(skillMdPath) {
|
|
57193
57278
|
try {
|
|
57194
|
-
const content = await
|
|
57279
|
+
const content = await readFile26(skillMdPath, "utf-8");
|
|
57195
57280
|
const { data } = import_gray_matter5.default(content, { engines: { javascript: { parse: () => ({}) } } });
|
|
57196
57281
|
const skillDir = dirname17(skillMdPath);
|
|
57197
57282
|
const dirName = skillDir.split(/[/\\]/).pop() || "";
|
|
@@ -57264,7 +57349,7 @@ async function discoverSkillsEnriched(sourcePath) {
|
|
|
57264
57349
|
for (const skill of base) {
|
|
57265
57350
|
const skillMdPath = join45(skill.path, "SKILL.md");
|
|
57266
57351
|
try {
|
|
57267
|
-
const content = await
|
|
57352
|
+
const content = await readFile26(skillMdPath, "utf-8");
|
|
57268
57353
|
const { data, content: body } = import_gray_matter5.default(content, {
|
|
57269
57354
|
engines: { javascript: { parse: () => ({}) } }
|
|
57270
57355
|
});
|
|
@@ -57408,7 +57493,7 @@ var init_migration_result_utils = __esm(() => {
|
|
|
57408
57493
|
|
|
57409
57494
|
// src/domains/web-server/routes/migration-routes.ts
|
|
57410
57495
|
import { existsSync as existsSync30 } from "node:fs";
|
|
57411
|
-
import { readFile as
|
|
57496
|
+
import { readFile as readFile27, rm as rm8 } from "node:fs/promises";
|
|
57412
57497
|
import { homedir as homedir28 } from "node:os";
|
|
57413
57498
|
import { basename as basename17, join as join46, resolve as resolve23 } from "node:path";
|
|
57414
57499
|
function resolveRegistryDeps(deps) {
|
|
@@ -57670,6 +57755,40 @@ async function executePlanDeleteAction(action, options2) {
|
|
|
57670
57755
|
};
|
|
57671
57756
|
}
|
|
57672
57757
|
}
|
|
57758
|
+
function hasSuccessfulReplacementWriteForDelete(action, results) {
|
|
57759
|
+
return results.some((result) => result.success && !result.skipped && result.provider === action.provider && replacementTypeMatchesForDelete(action.type, result.portableType) && replacementItemMatchesForDelete(action, result) && result.path.length > 0 && resolve23(result.path) !== resolve23(action.targetPath));
|
|
57760
|
+
}
|
|
57761
|
+
function replacementTypeMatchesForDelete(actionType, resultType) {
|
|
57762
|
+
return resultType === actionType || actionType === "command" && resultType === "skill";
|
|
57763
|
+
}
|
|
57764
|
+
function replacementItemMatchesForDelete(action, result) {
|
|
57765
|
+
if (result.itemName === action.item || result.itemName === undefined)
|
|
57766
|
+
return true;
|
|
57767
|
+
const parts = result.path.replace(/\\/g, "/").split("/");
|
|
57768
|
+
const leaf = parts.at(-1) ?? "";
|
|
57769
|
+
const parent = parts.at(-2) ?? "";
|
|
57770
|
+
const leafName = leaf.replace(/\.[^.]+$/, "");
|
|
57771
|
+
return leafName === action.item || parent === action.item || action.type === "command" && parent === `source-command-${action.item}`;
|
|
57772
|
+
}
|
|
57773
|
+
function shouldRunPlanDeleteAction(action, results) {
|
|
57774
|
+
if (action.reasonCode !== "path-migrated-cleanup")
|
|
57775
|
+
return true;
|
|
57776
|
+
return hasSuccessfulReplacementWriteForDelete(action, results);
|
|
57777
|
+
}
|
|
57778
|
+
function createSkippedPathMigrationCleanupResult(action) {
|
|
57779
|
+
const provider = action.provider;
|
|
57780
|
+
return {
|
|
57781
|
+
operation: "delete",
|
|
57782
|
+
portableType: action.type,
|
|
57783
|
+
itemName: action.item,
|
|
57784
|
+
provider,
|
|
57785
|
+
providerDisplayName: providers[provider]?.displayName || action.provider,
|
|
57786
|
+
success: true,
|
|
57787
|
+
path: action.targetPath,
|
|
57788
|
+
skipped: true,
|
|
57789
|
+
skipReason: "Legacy path cleanup skipped because no successful replacement write was recorded"
|
|
57790
|
+
};
|
|
57791
|
+
}
|
|
57673
57792
|
function countEnabledTypes(include) {
|
|
57674
57793
|
return MIGRATION_TYPES.filter((type) => include[type]).length;
|
|
57675
57794
|
}
|
|
@@ -58208,9 +58327,9 @@ function registerMigrationRoutes(app, deps) {
|
|
|
58208
58327
|
const readmePath = `${skill.path}/README.md`;
|
|
58209
58328
|
let content;
|
|
58210
58329
|
if (existsSync30(skillMdPath)) {
|
|
58211
|
-
content = await
|
|
58330
|
+
content = await readFile27(skillMdPath, "utf-8");
|
|
58212
58331
|
} else if (existsSync30(readmePath)) {
|
|
58213
|
-
content = await
|
|
58332
|
+
content = await readFile27(readmePath, "utf-8");
|
|
58214
58333
|
} else {
|
|
58215
58334
|
console.warn(`[migrate] Skill "${sanitizeUntrusted(skill.name, 80)}" has neither SKILL.md nor README.md, skipping`);
|
|
58216
58335
|
continue;
|
|
@@ -58636,6 +58755,16 @@ function registerMigrationRoutes(app, deps) {
|
|
|
58636
58755
|
}
|
|
58637
58756
|
const writtenPaths = new Set(allResults.filter((r2) => r2.success && !r2.skipped && r2.path.length > 0).map((r2) => resolve23(r2.path)));
|
|
58638
58757
|
for (const deleteAction of deleteActions) {
|
|
58758
|
+
if (!shouldRunPlanDeleteAction(deleteAction, allResults)) {
|
|
58759
|
+
const skippedDelete = createSkippedPathMigrationCleanupResult({
|
|
58760
|
+
item: deleteAction.item,
|
|
58761
|
+
type: deleteAction.type,
|
|
58762
|
+
provider: deleteAction.provider,
|
|
58763
|
+
targetPath: deleteAction.targetPath
|
|
58764
|
+
});
|
|
58765
|
+
allResults.push(skippedDelete);
|
|
58766
|
+
continue;
|
|
58767
|
+
}
|
|
58639
58768
|
const deleteResult = await executePlanDeleteAction(deleteAction, {
|
|
58640
58769
|
preservePaths: writtenPaths,
|
|
58641
58770
|
removePortableInstallation: registryDeps.removePortableInstallation
|
|
@@ -61391,7 +61520,7 @@ var init_project_plan_data = __esm(() => {
|
|
|
61391
61520
|
|
|
61392
61521
|
// src/domains/web-server/routes/project-routes.ts
|
|
61393
61522
|
import { existsSync as existsSync37 } from "node:fs";
|
|
61394
|
-
import { readFile as
|
|
61523
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
61395
61524
|
import { homedir as homedir31 } from "node:os";
|
|
61396
61525
|
import { basename as basename21, join as join55, resolve as resolve28 } from "node:path";
|
|
61397
61526
|
function registerProjectRoutes(app) {
|
|
@@ -61634,7 +61763,7 @@ async function buildProjectInfoFromRegistry(registered, cachedSettings, cachedSk
|
|
|
61634
61763
|
let metadata = {};
|
|
61635
61764
|
try {
|
|
61636
61765
|
if (hasClaudeDir && existsSync37(metadataPath)) {
|
|
61637
|
-
const content = await
|
|
61766
|
+
const content = await readFile28(metadataPath, "utf-8");
|
|
61638
61767
|
try {
|
|
61639
61768
|
metadata = JSON.parse(content);
|
|
61640
61769
|
} catch {}
|
|
@@ -61676,7 +61805,7 @@ async function detectAndBuildProjectInfo(path6, id, cachedSettings, cachedSkills
|
|
|
61676
61805
|
let metadata = {};
|
|
61677
61806
|
try {
|
|
61678
61807
|
if (existsSync37(metadataPath)) {
|
|
61679
|
-
const content = await
|
|
61808
|
+
const content = await readFile28(metadataPath, "utf-8");
|
|
61680
61809
|
try {
|
|
61681
61810
|
metadata = JSON.parse(content);
|
|
61682
61811
|
} catch {}
|
|
@@ -61732,7 +61861,7 @@ var init_project_routes = __esm(() => {
|
|
|
61732
61861
|
|
|
61733
61862
|
// src/domains/web-server/routes/session-routes.ts
|
|
61734
61863
|
import { existsSync as existsSync38 } from "node:fs";
|
|
61735
|
-
import { readFile as
|
|
61864
|
+
import { readFile as readFile29, readdir as readdir14, stat as stat10 } from "node:fs/promises";
|
|
61736
61865
|
import { homedir as homedir32 } from "node:os";
|
|
61737
61866
|
import { basename as basename22, join as join56 } from "node:path";
|
|
61738
61867
|
function toDateStr(d3) {
|
|
@@ -61891,7 +62020,7 @@ async function parseSessionDetail(filePath, limit, offset) {
|
|
|
61891
62020
|
summary: { messageCount: 0, toolCallCount: 0 }
|
|
61892
62021
|
};
|
|
61893
62022
|
}
|
|
61894
|
-
const raw = await
|
|
62023
|
+
const raw = await readFile29(filePath, "utf-8");
|
|
61895
62024
|
const lines = raw.split(`
|
|
61896
62025
|
`).filter((l2) => l2.trim());
|
|
61897
62026
|
const toolResultsMap = new Map;
|
|
@@ -62209,7 +62338,7 @@ var init_settings_routes = __esm(() => {
|
|
|
62209
62338
|
});
|
|
62210
62339
|
|
|
62211
62340
|
// src/domains/skills/skill-catalog-generator.ts
|
|
62212
|
-
import { mkdir as mkdir14, readFile as
|
|
62341
|
+
import { mkdir as mkdir14, readFile as readFile30, readdir as readdir15, rename as rename10, stat as stat11, writeFile as writeFile15 } from "node:fs/promises";
|
|
62213
62342
|
import { homedir as homedir34 } from "node:os";
|
|
62214
62343
|
import { dirname as dirname25, join as join57, relative as relative15 } from "node:path";
|
|
62215
62344
|
async function hasScripts(skillPath) {
|
|
@@ -62280,13 +62409,13 @@ class SkillCatalogGenerator {
|
|
|
62280
62409
|
await mkdir14(dirname25(CATALOG_PATH), { recursive: true });
|
|
62281
62410
|
const tmpPath = `${CATALOG_PATH}.tmp`;
|
|
62282
62411
|
const json = JSON.stringify(catalog, null, 2);
|
|
62283
|
-
await
|
|
62412
|
+
await writeFile15(tmpPath, json, "utf-8");
|
|
62284
62413
|
await rename10(tmpPath, CATALOG_PATH);
|
|
62285
62414
|
logger.verbose(`Catalog written: ${catalog.skillCount} skills`);
|
|
62286
62415
|
}
|
|
62287
62416
|
async read() {
|
|
62288
62417
|
try {
|
|
62289
|
-
const content = await
|
|
62418
|
+
const content = await readFile30(CATALOG_PATH, "utf-8");
|
|
62290
62419
|
const parsed = JSON.parse(content);
|
|
62291
62420
|
if (parsed.version !== CATALOG_VERSION) {
|
|
62292
62421
|
logger.verbose(`Catalog version mismatch (${parsed.version} vs ${CATALOG_VERSION})`);
|
|
@@ -62748,9 +62877,18 @@ var init_agents = __esm(() => {
|
|
|
62748
62877
|
antigravity: {
|
|
62749
62878
|
name: "antigravity",
|
|
62750
62879
|
displayName: "Antigravity",
|
|
62751
|
-
projectPath: ".
|
|
62752
|
-
globalPath: join59(home3, ".gemini/
|
|
62753
|
-
detect: async () =>
|
|
62880
|
+
projectPath: ".agents/skills",
|
|
62881
|
+
globalPath: join59(home3, ".gemini/config/skills"),
|
|
62882
|
+
detect: async () => hasAnyInstallSignal2([
|
|
62883
|
+
join59(process.cwd(), ".agents/skills"),
|
|
62884
|
+
join59(process.cwd(), ".agents/rules"),
|
|
62885
|
+
join59(process.cwd(), ".agents/plugins"),
|
|
62886
|
+
join59(process.cwd(), ".agent/skills"),
|
|
62887
|
+
join59(process.cwd(), ".agent/rules"),
|
|
62888
|
+
join59(home3, ".gemini/config/skills"),
|
|
62889
|
+
join59(home3, ".gemini/config/plugins"),
|
|
62890
|
+
join59(home3, ".gemini/antigravity/skills")
|
|
62891
|
+
])
|
|
62754
62892
|
},
|
|
62755
62893
|
"github-copilot": {
|
|
62756
62894
|
name: "github-copilot",
|
|
@@ -62822,9 +62960,9 @@ var init_agents = __esm(() => {
|
|
|
62822
62960
|
|
|
62823
62961
|
// src/commands/skills/skills-registry.ts
|
|
62824
62962
|
import { existsSync as existsSync40 } from "node:fs";
|
|
62825
|
-
import { mkdir as mkdir15, readFile as
|
|
62963
|
+
import { mkdir as mkdir15, readFile as readFile32, writeFile as writeFile16 } from "node:fs/promises";
|
|
62826
62964
|
import { homedir as homedir37 } from "node:os";
|
|
62827
|
-
import { dirname as dirname26, join as join60
|
|
62965
|
+
import { dirname as dirname26, join as join60 } from "node:path";
|
|
62828
62966
|
function getCliVersion3() {
|
|
62829
62967
|
try {
|
|
62830
62968
|
if (process.env.npm_package_version) {
|
|
@@ -62841,12 +62979,40 @@ function getCliVersion3() {
|
|
|
62841
62979
|
return "unknown";
|
|
62842
62980
|
}
|
|
62843
62981
|
}
|
|
62982
|
+
function migratePathBySegments(pathValue, oldPath, newPath) {
|
|
62983
|
+
const usesBackslash = pathValue.includes("\\") && !pathValue.includes("/");
|
|
62984
|
+
const separator = usesBackslash ? "\\" : "/";
|
|
62985
|
+
const normalized = pathValue.replace(/\\/g, "/");
|
|
62986
|
+
const oldSegments = oldPath.split("/").filter(Boolean);
|
|
62987
|
+
const newSegments = newPath.split("/").filter(Boolean);
|
|
62988
|
+
const segments = normalized.split("/").filter((segment, index) => index > 0 || segment !== "");
|
|
62989
|
+
for (let i = 0;i <= segments.length - oldSegments.length; i++) {
|
|
62990
|
+
let matches = true;
|
|
62991
|
+
for (let j2 = 0;j2 < oldSegments.length; j2++) {
|
|
62992
|
+
if (segments[i + j2] !== oldSegments[j2]) {
|
|
62993
|
+
matches = false;
|
|
62994
|
+
break;
|
|
62995
|
+
}
|
|
62996
|
+
}
|
|
62997
|
+
if (!matches)
|
|
62998
|
+
continue;
|
|
62999
|
+
const migratedSegments = [
|
|
63000
|
+
...segments.slice(0, i),
|
|
63001
|
+
...newSegments,
|
|
63002
|
+
...segments.slice(i + oldSegments.length)
|
|
63003
|
+
];
|
|
63004
|
+
const prefix = normalized.startsWith("/") ? separator : "";
|
|
63005
|
+
return `${prefix}${migratedSegments.join(separator)}`;
|
|
63006
|
+
}
|
|
63007
|
+
return null;
|
|
63008
|
+
}
|
|
62844
63009
|
function migrateRegistryPaths(registry) {
|
|
62845
63010
|
let changed = false;
|
|
62846
63011
|
for (const entry of registry.installations) {
|
|
62847
63012
|
for (const migration of REGISTRY_PATH_MIGRATIONS) {
|
|
62848
|
-
|
|
62849
|
-
|
|
63013
|
+
const migratedPath = entry.agent === migration.agent ? migratePathBySegments(entry.path, migration.oldPath, migration.newPath) : null;
|
|
63014
|
+
if (migratedPath) {
|
|
63015
|
+
entry.path = migratedPath;
|
|
62850
63016
|
changed = true;
|
|
62851
63017
|
break;
|
|
62852
63018
|
}
|
|
@@ -62859,12 +63025,12 @@ async function readRegistry2() {
|
|
|
62859
63025
|
if (!existsSync40(REGISTRY_PATH)) {
|
|
62860
63026
|
return { version: "1.0", installations: [] };
|
|
62861
63027
|
}
|
|
62862
|
-
const content = await
|
|
63028
|
+
const content = await readFile32(REGISTRY_PATH, "utf-8");
|
|
62863
63029
|
const data = JSON.parse(content);
|
|
62864
63030
|
const registry = SkillRegistrySchema.parse(data);
|
|
62865
63031
|
if (migrateRegistryPaths(registry)) {
|
|
62866
63032
|
try {
|
|
62867
|
-
await
|
|
63033
|
+
await writeFile16(REGISTRY_PATH, JSON.stringify(registry, null, 2), "utf-8");
|
|
62868
63034
|
} catch {}
|
|
62869
63035
|
}
|
|
62870
63036
|
return registry;
|
|
@@ -62880,7 +63046,7 @@ async function writeRegistry2(registry) {
|
|
|
62880
63046
|
if (!existsSync40(dir)) {
|
|
62881
63047
|
await mkdir15(dir, { recursive: true });
|
|
62882
63048
|
}
|
|
62883
|
-
await
|
|
63049
|
+
await writeFile16(REGISTRY_PATH, JSON.stringify(registry, null, 2), "utf-8");
|
|
62884
63050
|
}
|
|
62885
63051
|
async function addInstallation(skill, agent, global3, path7, sourcePath) {
|
|
62886
63052
|
const registry = await readRegistry2();
|
|
@@ -62953,20 +63119,25 @@ var init_skills_registry = __esm(() => {
|
|
|
62953
63119
|
REGISTRY_PATH_MIGRATIONS = [
|
|
62954
63120
|
{
|
|
62955
63121
|
agent: "gemini-cli",
|
|
62956
|
-
|
|
62957
|
-
|
|
63122
|
+
oldPath: ".gemini/skills",
|
|
63123
|
+
newPath: ".agents/skills"
|
|
62958
63124
|
},
|
|
62959
63125
|
{
|
|
62960
|
-
agent: "
|
|
62961
|
-
|
|
62962
|
-
|
|
63126
|
+
agent: "antigravity",
|
|
63127
|
+
oldPath: ".agent/skills",
|
|
63128
|
+
newPath: ".agents/skills"
|
|
63129
|
+
},
|
|
63130
|
+
{
|
|
63131
|
+
agent: "antigravity",
|
|
63132
|
+
oldPath: ".gemini/antigravity/skills",
|
|
63133
|
+
newPath: ".gemini/config/skills"
|
|
62963
63134
|
}
|
|
62964
63135
|
];
|
|
62965
63136
|
});
|
|
62966
63137
|
|
|
62967
63138
|
// src/commands/skills/skills-installer.ts
|
|
62968
63139
|
import { existsSync as existsSync41 } from "node:fs";
|
|
62969
|
-
import { cp as cp3, mkdir as mkdir16, rm as rm9, stat as stat12 } from "node:fs/promises";
|
|
63140
|
+
import { cp as cp3, mkdir as mkdir16, readFile as readFile33, rm as rm9, stat as stat12, writeFile as writeFile17 } from "node:fs/promises";
|
|
62970
63141
|
import { homedir as homedir38 } from "node:os";
|
|
62971
63142
|
import { dirname as dirname27, join as join61, resolve as resolve30 } from "node:path";
|
|
62972
63143
|
function isSamePath2(path1, path22) {
|
|
@@ -63019,6 +63190,18 @@ async function cleanupLegacySkillPath(skillName, agent, global3) {
|
|
|
63019
63190
|
await writeRegistry2(registry);
|
|
63020
63191
|
}
|
|
63021
63192
|
}
|
|
63193
|
+
async function rewriteInstalledSkillMd2(targetPath, agent, options2) {
|
|
63194
|
+
if (agent !== "antigravity")
|
|
63195
|
+
return;
|
|
63196
|
+
const skillMdPath = join61(targetPath, "SKILL.md");
|
|
63197
|
+
if (!existsSync41(skillMdPath))
|
|
63198
|
+
return;
|
|
63199
|
+
const content = await readFile33(skillMdPath, "utf-8");
|
|
63200
|
+
const rewritten = rewriteAntigravityPaths(content, { global: options2.global });
|
|
63201
|
+
if (rewritten !== content) {
|
|
63202
|
+
await writeFile17(skillMdPath, rewritten, "utf-8");
|
|
63203
|
+
}
|
|
63204
|
+
}
|
|
63022
63205
|
async function installSkillForAgent(skill, agent, options2) {
|
|
63023
63206
|
const agentConfig = agents[agent];
|
|
63024
63207
|
const targetPath = getInstallPath(skill.name, agent, options2);
|
|
@@ -63057,6 +63240,7 @@ async function installSkillForAgent(skill, agent, options2) {
|
|
|
63057
63240
|
recursive: true,
|
|
63058
63241
|
force: true
|
|
63059
63242
|
});
|
|
63243
|
+
await rewriteInstalledSkillMd2(targetPath, agent, options2);
|
|
63060
63244
|
await addInstallation(skill.name, agent, options2.global, targetPath, skill.path);
|
|
63061
63245
|
return {
|
|
63062
63246
|
agent,
|
|
@@ -63093,12 +63277,17 @@ function getInstallPreview(skill, targetAgents, options2) {
|
|
|
63093
63277
|
}
|
|
63094
63278
|
var LEGACY_SKILL_PATHS;
|
|
63095
63279
|
var init_skills_installer = __esm(() => {
|
|
63280
|
+
init_direct_copy();
|
|
63096
63281
|
init_agents();
|
|
63097
63282
|
init_skills_registry();
|
|
63098
63283
|
LEGACY_SKILL_PATHS = {
|
|
63099
63284
|
"gemini-cli": {
|
|
63100
63285
|
project: ".gemini/skills",
|
|
63101
63286
|
global: join61(homedir38(), ".gemini/skills")
|
|
63287
|
+
},
|
|
63288
|
+
antigravity: {
|
|
63289
|
+
project: ".agent/skills",
|
|
63290
|
+
global: join61(homedir38(), ".gemini/antigravity/skills")
|
|
63102
63291
|
}
|
|
63103
63292
|
};
|
|
63104
63293
|
});
|
|
@@ -63713,7 +63902,7 @@ var init_pnpm_detector = __esm(() => {
|
|
|
63713
63902
|
|
|
63714
63903
|
// src/domains/installation/package-managers/detection-core.ts
|
|
63715
63904
|
import { existsSync as existsSync43, realpathSync as realpathSync3 } from "node:fs";
|
|
63716
|
-
import { chmod as chmod2, mkdir as mkdir17, readFile as
|
|
63905
|
+
import { chmod as chmod2, mkdir as mkdir17, readFile as readFile34, writeFile as writeFile18 } from "node:fs/promises";
|
|
63717
63906
|
import { platform as platform6 } from "node:os";
|
|
63718
63907
|
import { join as join63 } from "node:path";
|
|
63719
63908
|
function detectFromBinaryPath() {
|
|
@@ -63796,7 +63985,7 @@ async function readCachedPm() {
|
|
|
63796
63985
|
if (!existsSync43(cacheFile)) {
|
|
63797
63986
|
return null;
|
|
63798
63987
|
}
|
|
63799
|
-
const content = await
|
|
63988
|
+
const content = await readFile34(cacheFile, "utf-8");
|
|
63800
63989
|
const data = JSON.parse(content);
|
|
63801
63990
|
if (!data.packageManager || !data.detectedAt) {
|
|
63802
63991
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -63836,7 +64025,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
63836
64025
|
detectedAt: Date.now(),
|
|
63837
64026
|
version: version ?? undefined
|
|
63838
64027
|
};
|
|
63839
|
-
await
|
|
64028
|
+
await writeFile18(cacheFile, JSON.stringify(data, null, 2), "utf-8");
|
|
63840
64029
|
if (platform6() !== "win32") {
|
|
63841
64030
|
await chmod2(cacheFile, 384);
|
|
63842
64031
|
}
|
|
@@ -64047,7 +64236,7 @@ var package_default;
|
|
|
64047
64236
|
var init_package = __esm(() => {
|
|
64048
64237
|
package_default = {
|
|
64049
64238
|
name: "claudekit-cli",
|
|
64050
|
-
version: "4.4.0-dev.
|
|
64239
|
+
version: "4.4.0-dev.14",
|
|
64051
64240
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
64052
64241
|
type: "module",
|
|
64053
64242
|
repository: {
|
|
@@ -64549,7 +64738,7 @@ var init_package_manager_runner = __esm(() => {
|
|
|
64549
64738
|
// src/domains/installation/merger/zombie-wirings-pruner.ts
|
|
64550
64739
|
import { existsSync as existsSync44, readdirSync as readdirSync7 } from "node:fs";
|
|
64551
64740
|
import { homedir as homedir39 } from "node:os";
|
|
64552
|
-
import { basename as basename23, dirname as dirname28, isAbsolute as isAbsolute10, resolve as resolve32, sep as
|
|
64741
|
+
import { basename as basename23, dirname as dirname28, isAbsolute as isAbsolute10, resolve as resolve32, sep as sep10 } from "node:path";
|
|
64553
64742
|
function pruneZombieEngineerWirings(settings, hookDir, preserveCommands = new Set) {
|
|
64554
64743
|
const pruned = [];
|
|
64555
64744
|
const normalizedPreserveCommands = new Set(Array.from(preserveCommands).map((command) => normalizeCommand(command)));
|
|
@@ -64648,7 +64837,7 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64648
64837
|
if (bashMatch) {
|
|
64649
64838
|
const rawPath = bashMatch[1].replace(/\\/g, "/");
|
|
64650
64839
|
const resolved = isAbsolute10(rawPath) || /^[A-Za-z]:[\\/]/.test(rawPath) ? rawPath : resolve32(hookDir, rawPath);
|
|
64651
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64840
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64652
64841
|
}
|
|
64653
64842
|
return null;
|
|
64654
64843
|
}
|
|
@@ -64658,7 +64847,7 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64658
64847
|
if (varOnlyQuoted) {
|
|
64659
64848
|
const [, envVar, rest] = varOnlyQuoted;
|
|
64660
64849
|
const resolved = resolveEnvPath(envVar, rest);
|
|
64661
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64850
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64662
64851
|
}
|
|
64663
64852
|
const quotedMatch = command.match(/(?:^|\s)node\s+["']([^"']+)["']/);
|
|
64664
64853
|
if (quotedMatch) {
|
|
@@ -64666,11 +64855,11 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64666
64855
|
const envPrefixMatch = rawArg.match(/^(\$HOME|\$\{HOME\}|%USERPROFILE%|\$CLAUDE_PROJECT_DIR|%CLAUDE_PROJECT_DIR%)[/\\](.*)/);
|
|
64667
64856
|
if (envPrefixMatch) {
|
|
64668
64857
|
const resolved = resolveEnvPath(envPrefixMatch[1], envPrefixMatch[2]);
|
|
64669
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64858
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64670
64859
|
}
|
|
64671
64860
|
const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
|
|
64672
64861
|
if (isAbsolute10(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
|
|
64673
|
-
return process.platform === "win32" ? tildeResolved.replace(/\//g,
|
|
64862
|
+
return process.platform === "win32" ? tildeResolved.replace(/\//g, sep10) : tildeResolved;
|
|
64674
64863
|
}
|
|
64675
64864
|
return resolve32(hookDir, tildeResolved);
|
|
64676
64865
|
}
|
|
@@ -64680,11 +64869,11 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64680
64869
|
const envPrefixMatch = rawArg.match(/^(\$HOME|\$\{HOME\}|%USERPROFILE%|\$CLAUDE_PROJECT_DIR|%CLAUDE_PROJECT_DIR%)[/\\](.*)/);
|
|
64681
64870
|
if (envPrefixMatch) {
|
|
64682
64871
|
const resolved = resolveEnvPath(envPrefixMatch[1], envPrefixMatch[2]);
|
|
64683
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64872
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64684
64873
|
}
|
|
64685
64874
|
const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
|
|
64686
64875
|
if (isAbsolute10(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
|
|
64687
|
-
return process.platform === "win32" ? tildeResolved.replace(/\//g,
|
|
64876
|
+
return process.platform === "win32" ? tildeResolved.replace(/\//g, sep10) : tildeResolved;
|
|
64688
64877
|
}
|
|
64689
64878
|
return resolve32(hookDir, tildeResolved);
|
|
64690
64879
|
}
|
|
@@ -67174,7 +67363,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
67174
67363
|
|
|
67175
67364
|
// src/domains/versioning/release-cache.ts
|
|
67176
67365
|
import { existsSync as existsSync46 } from "node:fs";
|
|
67177
|
-
import { mkdir as mkdir18, readFile as
|
|
67366
|
+
import { mkdir as mkdir18, readFile as readFile37, unlink as unlink8, writeFile as writeFile20 } from "node:fs/promises";
|
|
67178
67367
|
import { join as join67 } from "node:path";
|
|
67179
67368
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
67180
67369
|
var init_release_cache = __esm(() => {
|
|
@@ -67199,7 +67388,7 @@ var init_release_cache = __esm(() => {
|
|
|
67199
67388
|
logger.debug(`Release cache not found for key: ${key}`);
|
|
67200
67389
|
return null;
|
|
67201
67390
|
}
|
|
67202
|
-
const content = await
|
|
67391
|
+
const content = await readFile37(cacheFile, "utf-8");
|
|
67203
67392
|
const parsed = JSON.parse(content);
|
|
67204
67393
|
const cacheEntry = ReleaseCacheEntrySchema.parse(parsed);
|
|
67205
67394
|
if (this.isExpired(cacheEntry.timestamp)) {
|
|
@@ -67225,7 +67414,7 @@ var init_release_cache = __esm(() => {
|
|
|
67225
67414
|
timestamp: Date.now(),
|
|
67226
67415
|
releases
|
|
67227
67416
|
};
|
|
67228
|
-
await
|
|
67417
|
+
await writeFile20(cacheFile, JSON.stringify(cacheEntry, null, 2), "utf-8");
|
|
67229
67418
|
logger.debug(`Release cache set for key: ${key}, cached ${releases.length} releases`);
|
|
67230
67419
|
} catch (error) {
|
|
67231
67420
|
logger.debug(`Failed to set release cache for key ${key}: ${error}`);
|
|
@@ -68601,7 +68790,7 @@ var init_update_cli = __esm(() => {
|
|
|
68601
68790
|
});
|
|
68602
68791
|
|
|
68603
68792
|
// src/domains/sync/config-version-checker.ts
|
|
68604
|
-
import { mkdir as mkdir19, readFile as
|
|
68793
|
+
import { mkdir as mkdir19, readFile as readFile39, unlink as unlink9, writeFile as writeFile21 } from "node:fs/promises";
|
|
68605
68794
|
import { join as join69 } from "node:path";
|
|
68606
68795
|
function parseCacheTtl() {
|
|
68607
68796
|
const envValue = process.env.CK_SYNC_CACHE_TTL;
|
|
@@ -68686,7 +68875,7 @@ class ConfigVersionChecker {
|
|
|
68686
68875
|
}
|
|
68687
68876
|
for (const cachePath of cachePaths) {
|
|
68688
68877
|
try {
|
|
68689
|
-
const data = await
|
|
68878
|
+
const data = await readFile39(cachePath, "utf8");
|
|
68690
68879
|
const parsed = JSON.parse(data);
|
|
68691
68880
|
if (typeof parsed !== "object" || parsed === null || typeof parsed.lastCheck !== "number" || typeof parsed.latestVersion !== "string" || !parsed.latestVersion || parsed.lastCheck < 0 || parsed.lastCheck > Date.now() + 7 * 24 * 60 * 60 * 1000) {
|
|
68692
68881
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -68704,7 +68893,7 @@ class ConfigVersionChecker {
|
|
|
68704
68893
|
const cachePath = ConfigVersionChecker.getCacheFilePath(kitType, global3, channel);
|
|
68705
68894
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
68706
68895
|
await mkdir19(cacheDir, { recursive: true });
|
|
68707
|
-
await
|
|
68896
|
+
await writeFile21(cachePath, JSON.stringify(cache3, null, 2));
|
|
68708
68897
|
} catch (error) {
|
|
68709
68898
|
logger.debug(`Cache write failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
68710
68899
|
}
|
|
@@ -68866,7 +69055,7 @@ var init_config_version_checker = __esm(() => {
|
|
|
68866
69055
|
import { spawn as spawn3 } from "node:child_process";
|
|
68867
69056
|
import { execFile as execFile8 } from "node:child_process";
|
|
68868
69057
|
import { existsSync as existsSync48 } from "node:fs";
|
|
68869
|
-
import { readFile as
|
|
69058
|
+
import { readFile as readFile40 } from "node:fs/promises";
|
|
68870
69059
|
import { cpus, homedir as homedir42, totalmem } from "node:os";
|
|
68871
69060
|
import { join as join70 } from "node:path";
|
|
68872
69061
|
function runCommand(cmd, args, fallback2) {
|
|
@@ -69157,7 +69346,7 @@ async function getKitMetadata2(kitName) {
|
|
|
69157
69346
|
const metadataPath = join70(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
69158
69347
|
if (!existsSync48(metadataPath))
|
|
69159
69348
|
return null;
|
|
69160
|
-
const content = await
|
|
69349
|
+
const content = await readFile40(metadataPath, "utf-8");
|
|
69161
69350
|
const metadata = JSON.parse(content);
|
|
69162
69351
|
if (typeof metadata.kits?.[kitName]?.version === "string" && metadata.kits[kitName].version.trim()) {
|
|
69163
69352
|
return { version: metadata.kits[kitName].version };
|
|
@@ -74695,8 +74884,8 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74695
74884
|
logger.info(` Platform: ${platform10 === "win32" ? "Windows (PowerShell)" : "Unix (bash)"}`);
|
|
74696
74885
|
if (logger.isVerbose()) {
|
|
74697
74886
|
try {
|
|
74698
|
-
const { readFile:
|
|
74699
|
-
const scriptContent = await
|
|
74887
|
+
const { readFile: readFile49 } = await import("node:fs/promises");
|
|
74888
|
+
const scriptContent = await readFile49(scriptPath, "utf-8");
|
|
74700
74889
|
const previewLines = scriptContent.split(`
|
|
74701
74890
|
`).slice(0, 20);
|
|
74702
74891
|
logger.verbose("Script preview (first 20 lines):");
|
|
@@ -74892,11 +75081,11 @@ var init_skills_installer2 = __esm(() => {
|
|
|
74892
75081
|
|
|
74893
75082
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
74894
75083
|
import { existsSync as existsSync62 } from "node:fs";
|
|
74895
|
-
import { mkdir as mkdir23, readFile as
|
|
75084
|
+
import { mkdir as mkdir23, readFile as readFile49, writeFile as writeFile25 } from "node:fs/promises";
|
|
74896
75085
|
import { dirname as dirname33, join as join92 } from "node:path";
|
|
74897
75086
|
async function readJsonFile(filePath) {
|
|
74898
75087
|
try {
|
|
74899
|
-
const content = await
|
|
75088
|
+
const content = await readFile49(filePath, "utf-8");
|
|
74900
75089
|
return JSON.parse(content);
|
|
74901
75090
|
} catch (error) {
|
|
74902
75091
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -74910,7 +75099,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
74910
75099
|
try {
|
|
74911
75100
|
let content = "";
|
|
74912
75101
|
if (existsSync62(gitignorePath)) {
|
|
74913
|
-
content = await
|
|
75102
|
+
content = await readFile49(gitignorePath, "utf-8");
|
|
74914
75103
|
const lines = content.split(`
|
|
74915
75104
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
74916
75105
|
const geminiPatterns = [".gemini/", ".gemini", "/.gemini/", "/.gemini"];
|
|
@@ -74923,7 +75112,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
74923
75112
|
`) || content === "" ? "" : `
|
|
74924
75113
|
`;
|
|
74925
75114
|
const comment = "# Gemini CLI settings (contains user-specific config)";
|
|
74926
|
-
await
|
|
75115
|
+
await writeFile25(gitignorePath, `${content}${newLine}${comment}
|
|
74927
75116
|
${geminiPattern}
|
|
74928
75117
|
`, "utf-8");
|
|
74929
75118
|
logger.debug(`Added ${geminiPattern} to .gitignore`);
|
|
@@ -74948,7 +75137,7 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
74948
75137
|
}
|
|
74949
75138
|
const newSettings = { mcpServers };
|
|
74950
75139
|
try {
|
|
74951
|
-
await
|
|
75140
|
+
await writeFile25(geminiSettingsPath, JSON.stringify(newSettings, null, 2), "utf-8");
|
|
74952
75141
|
logger.debug(`Created new Gemini settings with mcpServers: ${geminiSettingsPath}`);
|
|
74953
75142
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
74954
75143
|
} catch (error) {
|
|
@@ -74978,7 +75167,7 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
74978
75167
|
mcpServers
|
|
74979
75168
|
};
|
|
74980
75169
|
try {
|
|
74981
|
-
await
|
|
75170
|
+
await writeFile25(geminiSettingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
74982
75171
|
logger.debug(`Merged mcpServers into: ${geminiSettingsPath}`);
|
|
74983
75172
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
74984
75173
|
} catch (error) {
|
|
@@ -77479,7 +77668,7 @@ __export(exports_worktree_manager, {
|
|
|
77479
77668
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
77480
77669
|
});
|
|
77481
77670
|
import { existsSync as existsSync73 } from "node:fs";
|
|
77482
|
-
import { readFile as
|
|
77671
|
+
import { readFile as readFile69, writeFile as writeFile40 } from "node:fs/promises";
|
|
77483
77672
|
import { join as join154 } from "node:path";
|
|
77484
77673
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
77485
77674
|
const worktreePath = join154(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
@@ -77544,14 +77733,14 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
77544
77733
|
async function ensureGitignore(projectDir) {
|
|
77545
77734
|
const gitignorePath = join154(projectDir, ".gitignore");
|
|
77546
77735
|
try {
|
|
77547
|
-
const content = existsSync73(gitignorePath) ? await
|
|
77736
|
+
const content = existsSync73(gitignorePath) ? await readFile69(gitignorePath, "utf-8") : "";
|
|
77548
77737
|
if (!content.includes(".worktrees")) {
|
|
77549
77738
|
const newContent = content.endsWith(`
|
|
77550
77739
|
`) ? `${content}.worktrees/
|
|
77551
77740
|
` : `${content}
|
|
77552
77741
|
.worktrees/
|
|
77553
77742
|
`;
|
|
77554
|
-
await
|
|
77743
|
+
await writeFile40(gitignorePath, newContent, "utf-8");
|
|
77555
77744
|
logger.info("[worktree] Added .worktrees/ to .gitignore");
|
|
77556
77745
|
}
|
|
77557
77746
|
} catch (err) {
|
|
@@ -77647,7 +77836,7 @@ var init_content_validator = __esm(() => {
|
|
|
77647
77836
|
// src/commands/content/phases/context-cache-manager.ts
|
|
77648
77837
|
import { createHash as createHash9 } from "node:crypto";
|
|
77649
77838
|
import { existsSync as existsSync79, mkdirSync as mkdirSync5, readFileSync as readFileSync19, readdirSync as readdirSync13, statSync as statSync14 } from "node:fs";
|
|
77650
|
-
import { rename as rename16, writeFile as
|
|
77839
|
+
import { rename as rename16, writeFile as writeFile42 } from "node:fs/promises";
|
|
77651
77840
|
import { homedir as homedir54 } from "node:os";
|
|
77652
77841
|
import { basename as basename34, join as join161 } from "node:path";
|
|
77653
77842
|
function getCachedContext(repoPath) {
|
|
@@ -77674,7 +77863,7 @@ async function saveCachedContext(repoPath, cache5) {
|
|
|
77674
77863
|
}
|
|
77675
77864
|
const cachePath = getCacheFilePath(repoPath);
|
|
77676
77865
|
const tmpPath = `${cachePath}.tmp`;
|
|
77677
|
-
await
|
|
77866
|
+
await writeFile42(tmpPath, JSON.stringify(cache5, null, 2), "utf-8");
|
|
77678
77867
|
await rename16(tmpPath, cachePath);
|
|
77679
77868
|
}
|
|
77680
77869
|
function computeSourceHash(repoPath) {
|
|
@@ -79511,12 +79700,12 @@ var init_types6 = __esm(() => {
|
|
|
79511
79700
|
});
|
|
79512
79701
|
|
|
79513
79702
|
// src/commands/content/phases/state-manager.ts
|
|
79514
|
-
import { readFile as
|
|
79703
|
+
import { readFile as readFile71, rename as rename17, writeFile as writeFile43 } from "node:fs/promises";
|
|
79515
79704
|
import { join as join167 } from "node:path";
|
|
79516
79705
|
async function loadContentConfig(projectDir) {
|
|
79517
79706
|
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79518
79707
|
try {
|
|
79519
|
-
const raw2 = await
|
|
79708
|
+
const raw2 = await readFile71(configPath, "utf-8");
|
|
79520
79709
|
const json = JSON.parse(raw2);
|
|
79521
79710
|
return ContentConfigSchema.parse(json.content ?? {});
|
|
79522
79711
|
} catch {
|
|
@@ -79532,7 +79721,7 @@ async function saveContentConfig(projectDir, config) {
|
|
|
79532
79721
|
async function loadContentState(projectDir) {
|
|
79533
79722
|
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79534
79723
|
try {
|
|
79535
|
-
const raw2 = await
|
|
79724
|
+
const raw2 = await readFile71(configPath, "utf-8");
|
|
79536
79725
|
const json = JSON.parse(raw2);
|
|
79537
79726
|
const contentBlock = json.content ?? {};
|
|
79538
79727
|
return ContentStateSchema.parse(contentBlock.state ?? {});
|
|
@@ -79559,7 +79748,7 @@ async function saveContentState(projectDir, state) {
|
|
|
79559
79748
|
}
|
|
79560
79749
|
async function readJsonSafe(filePath) {
|
|
79561
79750
|
try {
|
|
79562
|
-
const raw2 = await
|
|
79751
|
+
const raw2 = await readFile71(filePath, "utf-8");
|
|
79563
79752
|
return JSON.parse(raw2);
|
|
79564
79753
|
} catch {
|
|
79565
79754
|
return {};
|
|
@@ -79567,7 +79756,7 @@ async function readJsonSafe(filePath) {
|
|
|
79567
79756
|
}
|
|
79568
79757
|
async function atomicWrite3(filePath, data) {
|
|
79569
79758
|
const tmpPath = `${filePath}.tmp`;
|
|
79570
|
-
await
|
|
79759
|
+
await writeFile43(tmpPath, JSON.stringify(data, null, 2), "utf-8");
|
|
79571
79760
|
await rename17(tmpPath, filePath);
|
|
79572
79761
|
}
|
|
79573
79762
|
var CK_CONFIG_FILE2 = ".ck.json";
|
|
@@ -81640,6 +81829,7 @@ var init_migrate_command_help = __esm(() => {
|
|
|
81640
81829
|
" --respect-deletions disables the auto-reinstall heuristic for empty directories",
|
|
81641
81830
|
" --force overrides skip decisions per item; --reinstall-empty-dirs is a per-directory heuristic",
|
|
81642
81831
|
" Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills",
|
|
81832
|
+
" Antigravity 2.0 agents migrate to .agents/agents.md; skills remain .agents/skills/<name>/SKILL.md",
|
|
81643
81833
|
" Kiro agents migrate as custom subagents; rules/config migrate as steering files; skills copy to .kiro/skills; commands/hooks are skipped"
|
|
81644
81834
|
].join(`
|
|
81645
81835
|
`)
|
|
@@ -88464,7 +88654,7 @@ import { join as join76, resolve as resolve36 } from "node:path";
|
|
|
88464
88654
|
// src/domains/health-checks/checkers/skill-budget-scanner.ts
|
|
88465
88655
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
88466
88656
|
import { existsSync as existsSync54 } from "node:fs";
|
|
88467
|
-
import { readFile as
|
|
88657
|
+
import { readFile as readFile41, readdir as readdir20 } from "node:fs/promises";
|
|
88468
88658
|
import { basename as basename25, join as join75, relative as relative16 } from "node:path";
|
|
88469
88659
|
var SKIP_DIRS5 = new Set([".git", ".venv", "__pycache__", "node_modules", "scripts", "common"]);
|
|
88470
88660
|
async function scanSkills2(skillsDir2) {
|
|
@@ -88475,7 +88665,7 @@ async function scanSkills2(skillsDir2) {
|
|
|
88475
88665
|
for (const dir of skillDirs) {
|
|
88476
88666
|
const file = join75(dir, "SKILL.md");
|
|
88477
88667
|
try {
|
|
88478
|
-
const content = await
|
|
88668
|
+
const content = await readFile41(file, "utf8");
|
|
88479
88669
|
const { data } = import_gray_matter11.default(content, { engines: { javascript: { parse: () => ({}) } } });
|
|
88480
88670
|
const rawName = typeof data.name === "string" ? data.name : "";
|
|
88481
88671
|
const fallbackId = relative16(skillsDir2, dir).replace(/\\/g, "/") || basename25(dir);
|
|
@@ -88519,7 +88709,7 @@ function normalizeSkillId(rawName, fallbackId) {
|
|
|
88519
88709
|
// src/domains/health-checks/checkers/skill-budget-settings.ts
|
|
88520
88710
|
init_settings_merger();
|
|
88521
88711
|
import { existsSync as existsSync55 } from "node:fs";
|
|
88522
|
-
import { mkdir as mkdir20, readFile as
|
|
88712
|
+
import { mkdir as mkdir20, readFile as readFile42 } from "node:fs/promises";
|
|
88523
88713
|
var CONTEXT_FLOOR_TOKENS = 200000;
|
|
88524
88714
|
var CHARS_PER_TOKEN = 4;
|
|
88525
88715
|
var DEFAULT_BUDGET_FRACTION = 0.03;
|
|
@@ -88530,7 +88720,7 @@ async function readProjectSettings(settingsPath) {
|
|
|
88530
88720
|
if (!existsSync55(settingsPath))
|
|
88531
88721
|
return { exists: false, settings: null };
|
|
88532
88722
|
try {
|
|
88533
|
-
const parsed = JSON.parse(await
|
|
88723
|
+
const parsed = JSON.parse(await readFile42(settingsPath, "utf8"));
|
|
88534
88724
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
88535
88725
|
return { exists: true, settings: null, error: "settings.json must contain a JSON object" };
|
|
88536
88726
|
}
|
|
@@ -88744,7 +88934,7 @@ function warn(id, name, message, skills, suggestion) {
|
|
|
88744
88934
|
init_logger();
|
|
88745
88935
|
init_path_resolver();
|
|
88746
88936
|
init_shared2();
|
|
88747
|
-
import { constants as constants2, access as access3, unlink as unlink10, writeFile as
|
|
88937
|
+
import { constants as constants2, access as access3, unlink as unlink10, writeFile as writeFile22 } from "node:fs/promises";
|
|
88748
88938
|
import { join as join77 } from "node:path";
|
|
88749
88939
|
async function checkGlobalDirReadable() {
|
|
88750
88940
|
const globalDir = PathResolver.getGlobalKitDir();
|
|
@@ -88804,7 +88994,7 @@ async function checkGlobalDirWritable() {
|
|
|
88804
88994
|
const random = Math.random().toString(36).substring(2);
|
|
88805
88995
|
const testFile = join77(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
88806
88996
|
try {
|
|
88807
|
-
await
|
|
88997
|
+
await writeFile22(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
88808
88998
|
} catch (error) {
|
|
88809
88999
|
return {
|
|
88810
89000
|
id: "ck-global-dir-writable",
|
|
@@ -88902,7 +89092,7 @@ async function checkHooksExist(projectDir) {
|
|
|
88902
89092
|
init_logger();
|
|
88903
89093
|
init_path_resolver();
|
|
88904
89094
|
import { existsSync as existsSync57 } from "node:fs";
|
|
88905
|
-
import { readFile as
|
|
89095
|
+
import { readFile as readFile43 } from "node:fs/promises";
|
|
88906
89096
|
import { join as join79 } from "node:path";
|
|
88907
89097
|
async function checkSettingsValid(projectDir) {
|
|
88908
89098
|
const globalSettings = join79(PathResolver.getGlobalKitDir(), "settings.json");
|
|
@@ -88920,7 +89110,7 @@ async function checkSettingsValid(projectDir) {
|
|
|
88920
89110
|
};
|
|
88921
89111
|
}
|
|
88922
89112
|
try {
|
|
88923
|
-
const content = await
|
|
89113
|
+
const content = await readFile43(settingsPath, "utf-8");
|
|
88924
89114
|
JSON.parse(content);
|
|
88925
89115
|
return {
|
|
88926
89116
|
id: "ck-settings-valid",
|
|
@@ -88977,7 +89167,7 @@ async function checkSettingsValid(projectDir) {
|
|
|
88977
89167
|
init_logger();
|
|
88978
89168
|
init_path_resolver();
|
|
88979
89169
|
import { existsSync as existsSync58 } from "node:fs";
|
|
88980
|
-
import { readFile as
|
|
89170
|
+
import { readFile as readFile44 } from "node:fs/promises";
|
|
88981
89171
|
import { homedir as homedir43 } from "node:os";
|
|
88982
89172
|
import { dirname as dirname31, join as join80, normalize as normalize6, resolve as resolve37 } from "node:path";
|
|
88983
89173
|
async function checkPathRefsValid(projectDir) {
|
|
@@ -88996,7 +89186,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
88996
89186
|
};
|
|
88997
89187
|
}
|
|
88998
89188
|
try {
|
|
88999
|
-
const content = await
|
|
89189
|
+
const content = await readFile44(claudeMdPath, "utf-8");
|
|
89000
89190
|
const refPattern = /@([^\s\)]+)/g;
|
|
89001
89191
|
const refs = [...content.matchAll(refPattern)].map((m2) => m2[1]);
|
|
89002
89192
|
if (refs.length === 0) {
|
|
@@ -90014,7 +90204,7 @@ import { platform as platform9 } from "node:os";
|
|
|
90014
90204
|
// src/domains/health-checks/platform/environment-checker.ts
|
|
90015
90205
|
init_environment();
|
|
90016
90206
|
init_path_resolver();
|
|
90017
|
-
import { constants as constants3, access as access4, mkdir as mkdir21, readFile as
|
|
90207
|
+
import { constants as constants3, access as access4, mkdir as mkdir21, readFile as readFile46, unlink as unlink11, writeFile as writeFile23 } from "node:fs/promises";
|
|
90018
90208
|
import { arch as arch2, homedir as homedir44, platform as platform8 } from "node:os";
|
|
90019
90209
|
import { join as join85, normalize as normalize7 } from "node:path";
|
|
90020
90210
|
function shouldSkipExpensiveOperations4() {
|
|
@@ -90110,8 +90300,8 @@ async function checkGlobalDirAccess() {
|
|
|
90110
90300
|
const testFile = join85(globalDir, ".ck-doctor-access-test");
|
|
90111
90301
|
try {
|
|
90112
90302
|
await mkdir21(globalDir, { recursive: true });
|
|
90113
|
-
await
|
|
90114
|
-
const content = await
|
|
90303
|
+
await writeFile23(testFile, "test", "utf-8");
|
|
90304
|
+
const content = await readFile46(testFile, "utf-8");
|
|
90115
90305
|
await unlink11(testFile);
|
|
90116
90306
|
if (content !== "test")
|
|
90117
90307
|
throw new Error("Read mismatch");
|
|
@@ -90184,7 +90374,7 @@ async function checkWSLBoundary() {
|
|
|
90184
90374
|
|
|
90185
90375
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
90186
90376
|
init_path_resolver();
|
|
90187
|
-
import { mkdir as mkdir22, symlink as symlink2, unlink as unlink12, writeFile as
|
|
90377
|
+
import { mkdir as mkdir22, symlink as symlink2, unlink as unlink12, writeFile as writeFile24 } from "node:fs/promises";
|
|
90188
90378
|
import { join as join86 } from "node:path";
|
|
90189
90379
|
async function checkLongPathSupport() {
|
|
90190
90380
|
if (shouldSkipExpensiveOperations4()) {
|
|
@@ -90241,7 +90431,7 @@ async function checkSymlinkSupport() {
|
|
|
90241
90431
|
const link = join86(testDir, ".ck-symlink-test-link");
|
|
90242
90432
|
try {
|
|
90243
90433
|
await mkdir22(testDir, { recursive: true });
|
|
90244
|
-
await
|
|
90434
|
+
await writeFile24(target, "test", "utf-8");
|
|
90245
90435
|
await symlink2(target, link);
|
|
90246
90436
|
await unlink12(link);
|
|
90247
90437
|
await unlink12(target);
|
|
@@ -91344,13 +91534,13 @@ init_hook_health_checker();
|
|
|
91344
91534
|
init_config_version_checker();
|
|
91345
91535
|
|
|
91346
91536
|
// src/domains/sync/sync-engine.ts
|
|
91347
|
-
import { lstat as lstat6, readFile as
|
|
91537
|
+
import { lstat as lstat6, readFile as readFile48, readlink as readlink2, realpath as realpath8, stat as stat14 } from "node:fs/promises";
|
|
91348
91538
|
import { isAbsolute as isAbsolute11, join as join88, normalize as normalize8, relative as relative18 } from "node:path";
|
|
91349
91539
|
|
|
91350
91540
|
// src/services/file-operations/ownership-checker.ts
|
|
91351
91541
|
init_metadata_migration();
|
|
91352
91542
|
import { createHash as createHash6 } from "node:crypto";
|
|
91353
|
-
import { readFile as
|
|
91543
|
+
import { readFile as readFile47, stat as stat13 } from "node:fs/promises";
|
|
91354
91544
|
import { relative as relative17 } from "node:path";
|
|
91355
91545
|
|
|
91356
91546
|
// src/shared/concurrent-file-ops.ts
|
|
@@ -91365,7 +91555,7 @@ async function mapWithLimit(items, fn, concurrency = DEFAULT_CONCURRENCY) {
|
|
|
91365
91555
|
class OwnershipChecker {
|
|
91366
91556
|
static async calculateChecksum(filePath) {
|
|
91367
91557
|
try {
|
|
91368
|
-
return createHash6("sha256").update(await
|
|
91558
|
+
return createHash6("sha256").update(await readFile47(filePath)).digest("hex");
|
|
91369
91559
|
} catch (err) {
|
|
91370
91560
|
const message = err instanceof Error ? err.message : String(err);
|
|
91371
91561
|
throw new Error(operationError("Checksum calculation", filePath, message));
|
|
@@ -92782,7 +92972,7 @@ class SyncEngine {
|
|
|
92782
92972
|
if (lstats.size > MAX_SYNC_FILE_SIZE) {
|
|
92783
92973
|
throw new Error(`File too large for sync (${Math.round(lstats.size / 1024 / 1024)}MB > ${MAX_SYNC_FILE_SIZE / 1024 / 1024}MB limit)`);
|
|
92784
92974
|
}
|
|
92785
|
-
const buffer = await
|
|
92975
|
+
const buffer = await readFile48(filePath);
|
|
92786
92976
|
if (buffer.includes(0)) {
|
|
92787
92977
|
return { content: "", isBinary: true };
|
|
92788
92978
|
}
|
|
@@ -102110,7 +102300,7 @@ import { join as join121 } from "node:path";
|
|
|
102110
102300
|
|
|
102111
102301
|
// src/domains/installation/deletion-handler.ts
|
|
102112
102302
|
import { existsSync as existsSync65, lstatSync as lstatSync3, readdirSync as readdirSync9, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
102113
|
-
import { dirname as dirname37, join as join106, relative as relative21, resolve as resolve42, sep as
|
|
102303
|
+
import { dirname as dirname37, join as join106, relative as relative21, resolve as resolve42, sep as sep11 } from "node:path";
|
|
102114
102304
|
|
|
102115
102305
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
102116
102306
|
init_metadata_migration();
|
|
@@ -102357,7 +102547,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102357
102547
|
function deletePath(fullPath, claudeDir3) {
|
|
102358
102548
|
const normalizedPath = resolve42(fullPath);
|
|
102359
102549
|
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102360
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
102550
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep11}`) && normalizedPath !== normalizedClaudeDir) {
|
|
102361
102551
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
102362
102552
|
}
|
|
102363
102553
|
try {
|
|
@@ -102431,7 +102621,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
102431
102621
|
const fullPath = join106(claudeDir3, path16);
|
|
102432
102622
|
const normalizedPath = resolve42(fullPath);
|
|
102433
102623
|
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102434
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
102624
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep11}`)) {
|
|
102435
102625
|
logger.warning(`Skipping invalid path: ${path16}`);
|
|
102436
102626
|
result.errors.push(path16);
|
|
102437
102627
|
continue;
|
|
@@ -103529,8 +103719,8 @@ var path16 = {
|
|
|
103529
103719
|
win32: { sep: "\\" },
|
|
103530
103720
|
posix: { sep: "/" }
|
|
103531
103721
|
};
|
|
103532
|
-
var
|
|
103533
|
-
minimatch.sep =
|
|
103722
|
+
var sep12 = defaultPlatform === "win32" ? path16.win32.sep : path16.posix.sep;
|
|
103723
|
+
minimatch.sep = sep12;
|
|
103534
103724
|
var GLOBSTAR = Symbol("globstar **");
|
|
103535
103725
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
103536
103726
|
var qmark2 = "[^/]";
|
|
@@ -104219,7 +104409,7 @@ import { dirname as dirname40, join as join110 } from "node:path";
|
|
|
104219
104409
|
// src/domains/config/installed-settings-tracker.ts
|
|
104220
104410
|
init_shared();
|
|
104221
104411
|
import { existsSync as existsSync66 } from "node:fs";
|
|
104222
|
-
import { mkdir as mkdir31, readFile as
|
|
104412
|
+
import { mkdir as mkdir31, readFile as readFile52, writeFile as writeFile27 } from "node:fs/promises";
|
|
104223
104413
|
import { dirname as dirname39, join as join109 } from "node:path";
|
|
104224
104414
|
var CK_JSON_FILE = ".ck.json";
|
|
104225
104415
|
|
|
@@ -104244,7 +104434,7 @@ class InstalledSettingsTracker {
|
|
|
104244
104434
|
return { hooks: [], mcpServers: [] };
|
|
104245
104435
|
}
|
|
104246
104436
|
try {
|
|
104247
|
-
const content = await
|
|
104437
|
+
const content = await readFile52(ckJsonPath, "utf-8");
|
|
104248
104438
|
const data = parseJsonContent(content);
|
|
104249
104439
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
104250
104440
|
if (installed) {
|
|
@@ -104261,7 +104451,7 @@ class InstalledSettingsTracker {
|
|
|
104261
104451
|
try {
|
|
104262
104452
|
let data = {};
|
|
104263
104453
|
if (existsSync66(ckJsonPath)) {
|
|
104264
|
-
const content = await
|
|
104454
|
+
const content = await readFile52(ckJsonPath, "utf-8");
|
|
104265
104455
|
data = parseJsonContent(content);
|
|
104266
104456
|
}
|
|
104267
104457
|
if (!data.kits) {
|
|
@@ -104272,7 +104462,7 @@ class InstalledSettingsTracker {
|
|
|
104272
104462
|
}
|
|
104273
104463
|
data.kits[this.kitName].installedSettings = settings;
|
|
104274
104464
|
await mkdir31(dirname39(ckJsonPath), { recursive: true });
|
|
104275
|
-
await
|
|
104465
|
+
await writeFile27(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
104276
104466
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
104277
104467
|
} catch (error) {
|
|
104278
104468
|
logger.warning(`Failed to save installed settings: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -106169,7 +106359,7 @@ import { join as join118 } from "node:path";
|
|
|
106169
106359
|
|
|
106170
106360
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
106171
106361
|
init_logger();
|
|
106172
|
-
import { readFile as
|
|
106362
|
+
import { readFile as readFile56, readdir as readdir30, writeFile as writeFile31 } from "node:fs/promises";
|
|
106173
106363
|
import { join as join117 } from "node:path";
|
|
106174
106364
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
106175
106365
|
".md",
|
|
@@ -106238,13 +106428,13 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
106238
106428
|
await processDirectory(fullPath);
|
|
106239
106429
|
} else if (entry.isFile() && shouldTransformFile(entry.name)) {
|
|
106240
106430
|
try {
|
|
106241
|
-
const content = await
|
|
106431
|
+
const content = await readFile56(fullPath, "utf-8");
|
|
106242
106432
|
const { transformed, changes } = transformCommandContent(content);
|
|
106243
106433
|
if (changes > 0) {
|
|
106244
106434
|
if (options2.dryRun) {
|
|
106245
106435
|
logger.debug(`[dry-run] Would transform ${changes} command ref(s) in ${fullPath}`);
|
|
106246
106436
|
} else {
|
|
106247
|
-
await
|
|
106437
|
+
await writeFile31(fullPath, transformed, "utf-8");
|
|
106248
106438
|
if (options2.verbose) {
|
|
106249
106439
|
logger.verbose(`Transformed ${changes} command ref(s) in ${fullPath}`);
|
|
106250
106440
|
}
|
|
@@ -106779,7 +106969,7 @@ init_skip_directories();
|
|
|
106779
106969
|
init_types3();
|
|
106780
106970
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
106781
106971
|
import { createHash as createHash7 } from "node:crypto";
|
|
106782
|
-
import { readFile as
|
|
106972
|
+
import { readFile as readFile58, readdir as readdir34, writeFile as writeFile32 } from "node:fs/promises";
|
|
106783
106973
|
import { join as join122, relative as relative27 } from "node:path";
|
|
106784
106974
|
|
|
106785
106975
|
class SkillsManifestManager {
|
|
@@ -106803,7 +106993,7 @@ class SkillsManifestManager {
|
|
|
106803
106993
|
}
|
|
106804
106994
|
static async writeManifest(skillsDir2, manifest) {
|
|
106805
106995
|
const manifestPath = join122(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
106806
|
-
await
|
|
106996
|
+
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
106807
106997
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
106808
106998
|
}
|
|
106809
106999
|
static async readManifest(skillsDir2) {
|
|
@@ -106813,7 +107003,7 @@ class SkillsManifestManager {
|
|
|
106813
107003
|
return null;
|
|
106814
107004
|
}
|
|
106815
107005
|
try {
|
|
106816
|
-
const content = await
|
|
107006
|
+
const content = await readFile58(manifestPath, "utf-8");
|
|
106817
107007
|
const data = JSON.parse(content);
|
|
106818
107008
|
const manifest = SkillsManifestSchema.parse(data);
|
|
106819
107009
|
logger.debug(`Read manifest from: ${manifestPath}`);
|
|
@@ -106885,7 +107075,7 @@ class SkillsManifestManager {
|
|
|
106885
107075
|
files.sort();
|
|
106886
107076
|
for (const file of files) {
|
|
106887
107077
|
const relativePath = relative27(dirPath, file);
|
|
106888
|
-
const content = await
|
|
107078
|
+
const content = await readFile58(file);
|
|
106889
107079
|
hash.update(relativePath);
|
|
106890
107080
|
hash.update(content);
|
|
106891
107081
|
}
|
|
@@ -107625,7 +107815,7 @@ import { relative as relative29 } from "node:path";
|
|
|
107625
107815
|
init_skip_directories();
|
|
107626
107816
|
import { createHash as createHash8 } from "node:crypto";
|
|
107627
107817
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
107628
|
-
import { readFile as
|
|
107818
|
+
import { readFile as readFile59, readdir as readdir38 } from "node:fs/promises";
|
|
107629
107819
|
import { join as join126, relative as relative28 } from "node:path";
|
|
107630
107820
|
async function getAllFiles(dirPath) {
|
|
107631
107821
|
const files = [];
|
|
@@ -107664,7 +107854,7 @@ async function hashDirectory(dirPath) {
|
|
|
107664
107854
|
files.sort();
|
|
107665
107855
|
for (const file of files) {
|
|
107666
107856
|
const relativePath = relative28(dirPath, file);
|
|
107667
|
-
const content = await
|
|
107857
|
+
const content = await readFile59(file);
|
|
107668
107858
|
hash.update(relativePath);
|
|
107669
107859
|
hash.update(content);
|
|
107670
107860
|
}
|
|
@@ -107998,7 +108188,7 @@ import { join as join131 } from "node:path";
|
|
|
107998
108188
|
|
|
107999
108189
|
// src/services/transformers/opencode-path-transformer.ts
|
|
108000
108190
|
init_logger();
|
|
108001
|
-
import { readFile as
|
|
108191
|
+
import { readFile as readFile60, readdir as readdir40, writeFile as writeFile33 } from "node:fs/promises";
|
|
108002
108192
|
import { platform as platform15 } from "node:os";
|
|
108003
108193
|
import { extname as extname6, join as join130 } from "node:path";
|
|
108004
108194
|
var IS_WINDOWS2 = platform15() === "win32";
|
|
@@ -108069,10 +108259,10 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
108069
108259
|
await processDirectory2(fullPath);
|
|
108070
108260
|
} else if (entry.isFile() && shouldTransformFile2(entry.name)) {
|
|
108071
108261
|
try {
|
|
108072
|
-
const content = await
|
|
108262
|
+
const content = await readFile60(fullPath, "utf-8");
|
|
108073
108263
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
108074
108264
|
if (changes > 0) {
|
|
108075
|
-
await
|
|
108265
|
+
await writeFile33(fullPath, transformed, "utf-8");
|
|
108076
108266
|
filesTransformed++;
|
|
108077
108267
|
totalChanges += changes;
|
|
108078
108268
|
if (options2.verbose) {
|
|
@@ -109231,7 +109421,7 @@ async function handleSelection(ctx) {
|
|
|
109231
109421
|
};
|
|
109232
109422
|
}
|
|
109233
109423
|
// src/commands/init/phases/sync-handler.ts
|
|
109234
|
-
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as
|
|
109424
|
+
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile61, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile35 } from "node:fs/promises";
|
|
109235
109425
|
import { dirname as dirname44, join as join136, resolve as resolve47 } from "node:path";
|
|
109236
109426
|
init_logger();
|
|
109237
109427
|
init_path_resolver();
|
|
@@ -109400,7 +109590,7 @@ async function executeSyncMerge(ctx) {
|
|
|
109400
109590
|
try {
|
|
109401
109591
|
const sourceMetadataPath = join136(upstreamDir, "metadata.json");
|
|
109402
109592
|
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
109403
|
-
const content = await
|
|
109593
|
+
const content = await readFile61(sourceMetadataPath, "utf-8");
|
|
109404
109594
|
sourceMetadata = JSON.parse(content);
|
|
109405
109595
|
deletions = sourceMetadata.deletions || [];
|
|
109406
109596
|
}
|
|
@@ -109541,7 +109731,7 @@ async function executeSyncMerge(ctx) {
|
|
|
109541
109731
|
try {
|
|
109542
109732
|
const tempPath = `${currentPath}.tmp.${Date.now()}`;
|
|
109543
109733
|
try {
|
|
109544
|
-
await
|
|
109734
|
+
await writeFile35(tempPath, result.result, "utf-8");
|
|
109545
109735
|
await rename12(tempPath, currentPath);
|
|
109546
109736
|
} catch (atomicError) {
|
|
109547
109737
|
await unlink13(tempPath).catch(() => {});
|
|
@@ -109728,7 +109918,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
109728
109918
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
109729
109919
|
init_logger();
|
|
109730
109920
|
init_types3();
|
|
109731
|
-
import { readFile as
|
|
109921
|
+
import { readFile as readFile62, readdir as readdir43, writeFile as writeFile36 } from "node:fs/promises";
|
|
109732
109922
|
import { join as join138, relative as relative31 } from "node:path";
|
|
109733
109923
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
109734
109924
|
".md",
|
|
@@ -109795,7 +109985,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
109795
109985
|
if (!shouldTransform)
|
|
109796
109986
|
continue;
|
|
109797
109987
|
try {
|
|
109798
|
-
const content = await
|
|
109988
|
+
const content = await readFile62(fullPath, "utf-8");
|
|
109799
109989
|
let newContent = content;
|
|
109800
109990
|
let changeCount = 0;
|
|
109801
109991
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -109811,7 +110001,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
109811
110001
|
if (options2.dryRun) {
|
|
109812
110002
|
logger.debug(`[dry-run] Would update ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
109813
110003
|
} else {
|
|
109814
|
-
await
|
|
110004
|
+
await writeFile36(fullPath, newContent, "utf-8");
|
|
109815
110005
|
logger.debug(`Updated ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
109816
110006
|
}
|
|
109817
110007
|
filesChanged++;
|
|
@@ -109917,7 +110107,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
109917
110107
|
|
|
109918
110108
|
// src/services/transformers/global-path-transformer.ts
|
|
109919
110109
|
init_logger();
|
|
109920
|
-
import { readFile as
|
|
110110
|
+
import { readFile as readFile63, readdir as readdir44, writeFile as writeFile37 } from "node:fs/promises";
|
|
109921
110111
|
import { homedir as homedir48, platform as platform16 } from "node:os";
|
|
109922
110112
|
import { extname as extname7, join as join139 } from "node:path";
|
|
109923
110113
|
var IS_WINDOWS3 = platform16() === "win32";
|
|
@@ -110068,12 +110258,12 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
110068
110258
|
await processDirectory2(fullPath);
|
|
110069
110259
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
110070
110260
|
try {
|
|
110071
|
-
const content = await
|
|
110261
|
+
const content = await readFile63(fullPath, "utf-8");
|
|
110072
110262
|
const { transformed, changes } = transformContent(content, {
|
|
110073
110263
|
targetClaudeDir: options2.targetClaudeDir
|
|
110074
110264
|
});
|
|
110075
110265
|
if (changes > 0) {
|
|
110076
|
-
await
|
|
110266
|
+
await writeFile37(fullPath, transformed, "utf-8");
|
|
110077
110267
|
filesTransformed++;
|
|
110078
110268
|
totalChanges += changes;
|
|
110079
110269
|
if (options2.verbose) {
|
|
@@ -110360,7 +110550,7 @@ async function initCommand(options2) {
|
|
|
110360
110550
|
init_dist2();
|
|
110361
110551
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
110362
110552
|
import { existsSync as existsSync68 } from "node:fs";
|
|
110363
|
-
import { readFile as
|
|
110553
|
+
import { readFile as readFile67, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
110364
110554
|
import { homedir as homedir52 } from "node:os";
|
|
110365
110555
|
import { basename as basename30, join as join144, resolve as resolve48 } from "node:path";
|
|
110366
110556
|
init_logger();
|
|
@@ -110575,13 +110765,13 @@ init_model_taxonomy();
|
|
|
110575
110765
|
init_logger();
|
|
110576
110766
|
init_dist2();
|
|
110577
110767
|
init_model_taxonomy();
|
|
110578
|
-
import { mkdir as mkdir39, readFile as
|
|
110768
|
+
import { mkdir as mkdir39, readFile as readFile66, writeFile as writeFile39 } from "node:fs/promises";
|
|
110579
110769
|
import { homedir as homedir51 } from "node:os";
|
|
110580
110770
|
import { dirname as dirname45, join as join143 } from "node:path";
|
|
110581
110771
|
|
|
110582
110772
|
// src/commands/portable/models-dev-cache.ts
|
|
110583
110773
|
init_logger();
|
|
110584
|
-
import { mkdir as mkdir38, readFile as
|
|
110774
|
+
import { mkdir as mkdir38, readFile as readFile64, rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
|
|
110585
110775
|
import { homedir as homedir49 } from "node:os";
|
|
110586
110776
|
import { join as join141 } from "node:path";
|
|
110587
110777
|
|
|
@@ -110606,7 +110796,7 @@ function tmpFilePath(cacheDir) {
|
|
|
110606
110796
|
async function readCacheEntry(cacheDir) {
|
|
110607
110797
|
const filePath = cacheFilePath(cacheDir);
|
|
110608
110798
|
try {
|
|
110609
|
-
const raw2 = await
|
|
110799
|
+
const raw2 = await readFile64(filePath, "utf-8");
|
|
110610
110800
|
const parsed = JSON.parse(raw2);
|
|
110611
110801
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && "fetchedAt" in parsed && typeof parsed.fetchedAt === "string" && "payload" in parsed && typeof parsed.payload === "object" && parsed.payload !== null) {
|
|
110612
110802
|
return parsed;
|
|
@@ -110624,7 +110814,7 @@ async function writeCacheEntry(cacheDir, entry) {
|
|
|
110624
110814
|
await mkdir38(cacheDir, { recursive: true });
|
|
110625
110815
|
const tmp = tmpFilePath(cacheDir);
|
|
110626
110816
|
const dest = cacheFilePath(cacheDir);
|
|
110627
|
-
await
|
|
110817
|
+
await writeFile38(tmp, JSON.stringify(entry), "utf-8");
|
|
110628
110818
|
await rename14(tmp, dest);
|
|
110629
110819
|
}
|
|
110630
110820
|
async function fetchCatalog(fetcher) {
|
|
@@ -110674,7 +110864,7 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
110674
110864
|
|
|
110675
110865
|
// src/commands/portable/opencode-model-discovery.ts
|
|
110676
110866
|
init_logger();
|
|
110677
|
-
import { readFile as
|
|
110867
|
+
import { readFile as readFile65 } from "node:fs/promises";
|
|
110678
110868
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
110679
110869
|
import { join as join142 } from "node:path";
|
|
110680
110870
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
@@ -110688,7 +110878,7 @@ function resolveOpenCodeAuthPath(homeDir) {
|
|
|
110688
110878
|
async function readAuthedProviders(homeDir) {
|
|
110689
110879
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
110690
110880
|
try {
|
|
110691
|
-
const raw2 = await
|
|
110881
|
+
const raw2 = await readFile65(authPath, "utf-8");
|
|
110692
110882
|
const parsed = JSON.parse(raw2);
|
|
110693
110883
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
110694
110884
|
return Object.keys(parsed);
|
|
@@ -110890,7 +111080,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110890
111080
|
const configPath = getOpenCodeConfigPath(options2);
|
|
110891
111081
|
let existing = null;
|
|
110892
111082
|
try {
|
|
110893
|
-
const raw2 = await
|
|
111083
|
+
const raw2 = await readFile66(configPath, "utf-8");
|
|
110894
111084
|
const parsed = JSON.parse(raw2);
|
|
110895
111085
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
110896
111086
|
existing = parsed;
|
|
@@ -110931,7 +111121,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110931
111121
|
const chosenModel2 = response2.action === "custom" ? response2.value : suggestion2.model;
|
|
110932
111122
|
const next2 = { ...existing, model: chosenModel2 };
|
|
110933
111123
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110934
|
-
await
|
|
111124
|
+
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110935
111125
|
`, "utf-8");
|
|
110936
111126
|
return { path: configPath, action: "added", model: chosenModel2, reason: suggestion2.reason };
|
|
110937
111127
|
}
|
|
@@ -110942,7 +111132,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110942
111132
|
}
|
|
110943
111133
|
const next2 = { ...existing ?? {}, model: suggestion.model };
|
|
110944
111134
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110945
|
-
await
|
|
111135
|
+
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110946
111136
|
`, "utf-8");
|
|
110947
111137
|
return {
|
|
110948
111138
|
path: configPath,
|
|
@@ -110964,7 +111154,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110964
111154
|
const chosenModel = response.action === "custom" ? response.value : suggestion.ok ? suggestion.model : "";
|
|
110965
111155
|
const next = { ...existing ?? {}, model: chosenModel };
|
|
110966
111156
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110967
|
-
await
|
|
111157
|
+
await writeFile39(configPath, `${JSON.stringify(next, null, 2)}
|
|
110968
111158
|
`, "utf-8");
|
|
110969
111159
|
return {
|
|
110970
111160
|
path: configPath,
|
|
@@ -111607,6 +111797,46 @@ function appendMigrationWarningMessages(target, warnings) {
|
|
|
111607
111797
|
}
|
|
111608
111798
|
}
|
|
111609
111799
|
}
|
|
111800
|
+
function appendFallbackSkillActionsToPlan(plan, skills, selectedProviders, installGlobally) {
|
|
111801
|
+
if (skills.length === 0)
|
|
111802
|
+
return plan;
|
|
111803
|
+
const existingSkillKeys = new Set(plan.actions.filter((action) => action.type === "skill").map((action) => `${action.provider}\x00${String(action.global)}\x00${action.item}`));
|
|
111804
|
+
const fallbackActions = [];
|
|
111805
|
+
for (const provider of selectedProviders.filter((entry) => getProvidersSupporting("skills").includes(entry))) {
|
|
111806
|
+
const global3 = resolvePortableTypeGlobal(provider, "skill", installGlobally);
|
|
111807
|
+
const basePath = getPortableBasePath(provider, "skills", { global: global3 });
|
|
111808
|
+
if (!basePath)
|
|
111809
|
+
continue;
|
|
111810
|
+
for (const skill of skills) {
|
|
111811
|
+
const key = `${provider}\x00${String(global3)}\x00${skill.name}`;
|
|
111812
|
+
if (existingSkillKeys.has(key))
|
|
111813
|
+
continue;
|
|
111814
|
+
existingSkillKeys.add(key);
|
|
111815
|
+
fallbackActions.push({
|
|
111816
|
+
action: "install",
|
|
111817
|
+
global: global3,
|
|
111818
|
+
isDirectoryItem: true,
|
|
111819
|
+
item: skill.name,
|
|
111820
|
+
provider,
|
|
111821
|
+
reason: "New item, not previously installed",
|
|
111822
|
+
reasonCode: "new-item",
|
|
111823
|
+
reasonCopy: "New - not previously installed",
|
|
111824
|
+
targetPath: join144(basePath, skill.name),
|
|
111825
|
+
type: "skill"
|
|
111826
|
+
});
|
|
111827
|
+
}
|
|
111828
|
+
}
|
|
111829
|
+
if (fallbackActions.length === 0)
|
|
111830
|
+
return plan;
|
|
111831
|
+
return {
|
|
111832
|
+
...plan,
|
|
111833
|
+
actions: [...plan.actions, ...fallbackActions],
|
|
111834
|
+
summary: {
|
|
111835
|
+
...plan.summary,
|
|
111836
|
+
install: plan.summary.install + fallbackActions.length
|
|
111837
|
+
}
|
|
111838
|
+
};
|
|
111839
|
+
}
|
|
111610
111840
|
async function runInstallMode(options2, discoveredItems, _selectedProviders, _installGlobally) {
|
|
111611
111841
|
const interactive = process.stdout.isTTY && !options2.yes;
|
|
111612
111842
|
if (!interactive) {
|
|
@@ -111776,6 +112006,39 @@ async function executeDeleteAction(action, options2) {
|
|
|
111776
112006
|
};
|
|
111777
112007
|
}
|
|
111778
112008
|
}
|
|
112009
|
+
function hasSuccessfulReplacementWrite(action, results) {
|
|
112010
|
+
return results.some((result) => result.success && !result.skipped && result.provider === action.provider && replacementTypeMatches(action.type, result.portableType) && replacementItemMatches(action, result) && result.path.length > 0 && resolve48(result.path) !== resolve48(action.targetPath));
|
|
112011
|
+
}
|
|
112012
|
+
function replacementTypeMatches(actionType, resultType) {
|
|
112013
|
+
return resultType === actionType || actionType === "command" && resultType === "skill";
|
|
112014
|
+
}
|
|
112015
|
+
function replacementItemMatches(action, result) {
|
|
112016
|
+
if (result.itemName === action.item || result.itemName === undefined)
|
|
112017
|
+
return true;
|
|
112018
|
+
const parts = result.path.replace(/\\/g, "/").split("/");
|
|
112019
|
+
const leaf = parts.at(-1) ?? "";
|
|
112020
|
+
const parent = parts.at(-2) ?? "";
|
|
112021
|
+
const leafName = leaf.replace(/\.[^.]+$/, "");
|
|
112022
|
+
return leafName === action.item || parent === action.item || action.type === "command" && parent === `source-command-${action.item}`;
|
|
112023
|
+
}
|
|
112024
|
+
function shouldRunDeleteAction(action, results) {
|
|
112025
|
+
if (action.reasonCode !== "path-migrated-cleanup")
|
|
112026
|
+
return true;
|
|
112027
|
+
return hasSuccessfulReplacementWrite(action, results);
|
|
112028
|
+
}
|
|
112029
|
+
function createSkippedPathMigrationCleanupResult2(action) {
|
|
112030
|
+
return {
|
|
112031
|
+
operation: "delete",
|
|
112032
|
+
portableType: action.type,
|
|
112033
|
+
itemName: action.item,
|
|
112034
|
+
provider: action.provider,
|
|
112035
|
+
providerDisplayName: providers[action.provider]?.displayName || action.provider,
|
|
112036
|
+
success: true,
|
|
112037
|
+
path: action.targetPath,
|
|
112038
|
+
skipped: true,
|
|
112039
|
+
skipReason: "Legacy path cleanup skipped because no successful replacement write was recorded"
|
|
112040
|
+
};
|
|
112041
|
+
}
|
|
111779
112042
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
111780
112043
|
if (!skillSourcePath)
|
|
111781
112044
|
return;
|
|
@@ -111784,7 +112047,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
111784
112047
|
return;
|
|
111785
112048
|
let sourceMetadata;
|
|
111786
112049
|
try {
|
|
111787
|
-
const content = await
|
|
112050
|
+
const content = await readFile67(sourceMetadataPath, "utf-8");
|
|
111788
112051
|
sourceMetadata = JSON.parse(content);
|
|
111789
112052
|
} catch (error) {
|
|
111790
112053
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -112064,7 +112327,7 @@ async function migrateCommand(options2) {
|
|
|
112064
112327
|
types: config.types?.filter((type) => type !== "skill")
|
|
112065
112328
|
})), portableTypes);
|
|
112066
112329
|
const reinstallEmptyDirs = options2.respectDeletions ? false : options2.reinstallEmptyDirs ?? true;
|
|
112067
|
-
const plan = reconcile({
|
|
112330
|
+
const plan = appendFallbackSkillActionsToPlan(reconcile({
|
|
112068
112331
|
sourceItems: sourceStates,
|
|
112069
112332
|
registry,
|
|
112070
112333
|
targetStates,
|
|
@@ -112072,13 +112335,13 @@ async function migrateCommand(options2) {
|
|
|
112072
112335
|
force: options2.force,
|
|
112073
112336
|
typeDirectoryStates,
|
|
112074
112337
|
respectDeletions: !reinstallEmptyDirs
|
|
112075
|
-
});
|
|
112338
|
+
}), effectiveSkills, selectedProviders, installGlobally);
|
|
112076
112339
|
reconcileSpinner.stop("Plan computed");
|
|
112077
112340
|
const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
112078
112341
|
renderBanners(plan.banners);
|
|
112079
112342
|
displayReconcilePlan(plan, { color: useColor });
|
|
112080
112343
|
if (options2.dryRun) {
|
|
112081
|
-
displayMigrationSummary(plan,
|
|
112344
|
+
displayMigrationSummary(plan, [], { color: useColor, dryRun: true });
|
|
112082
112345
|
return;
|
|
112083
112346
|
}
|
|
112084
112347
|
if (plan.hasConflicts) {
|
|
@@ -112087,7 +112350,7 @@ async function migrateCommand(options2) {
|
|
|
112087
112350
|
for (const action of conflictActions) {
|
|
112088
112351
|
if (!action.diff && action.targetPath && existsSync68(action.targetPath)) {
|
|
112089
112352
|
try {
|
|
112090
|
-
const targetContent = await
|
|
112353
|
+
const targetContent = await readFile67(action.targetPath, "utf-8");
|
|
112091
112354
|
const sourceItem = effectiveAgents.find((a3) => a3.name === action.item) || effectiveCommands.find((c2) => c2.name === action.item) || (effectiveConfigItem?.name === action.item ? effectiveConfigItem : null) || effectiveRuleItems.find((r2) => r2.name === action.item) || effectiveHookItems.find((h2) => h2.name === action.item);
|
|
112092
112355
|
if (sourceItem) {
|
|
112093
112356
|
const providerConfig = providers[action.provider];
|
|
@@ -112181,20 +112444,6 @@ async function migrateCommand(options2) {
|
|
|
112181
112444
|
writeTasks.push({ item, provider, type: "hooks", global: action.global });
|
|
112182
112445
|
}
|
|
112183
112446
|
}
|
|
112184
|
-
const plannedSkillActions = plannedExecActions.filter((action) => action.type === "skill").length;
|
|
112185
|
-
if (effectiveSkills.length > 0 && plannedSkillActions === 0) {
|
|
112186
|
-
const skillProviders = selectedProviders.filter((pv) => getProvidersSupporting("skills").includes(pv));
|
|
112187
|
-
for (const provider of skillProviders) {
|
|
112188
|
-
for (const skill of effectiveSkills) {
|
|
112189
|
-
writeTasks.push({
|
|
112190
|
-
item: skill,
|
|
112191
|
-
provider,
|
|
112192
|
-
type: "skill",
|
|
112193
|
-
global: resolvePortableTypeGlobal(provider, "skill", installGlobally)
|
|
112194
|
-
});
|
|
112195
|
-
}
|
|
112196
|
-
}
|
|
112197
|
-
}
|
|
112198
112447
|
const progressSink = createMigrateProgressSink(writeTasks.length + plannedDeleteActions.length);
|
|
112199
112448
|
const writtenPaths = new Set;
|
|
112200
112449
|
const recordSuccessfulWrites = (task, taskResults) => {
|
|
@@ -112316,6 +112565,11 @@ async function migrateCommand(options2) {
|
|
|
112316
112565
|
}
|
|
112317
112566
|
await processMetadataDeletions(skillSource, installGlobally);
|
|
112318
112567
|
for (const deleteAction of plannedDeleteActions) {
|
|
112568
|
+
if (!shouldRunDeleteAction(deleteAction, allResults)) {
|
|
112569
|
+
allResults.push(createSkippedPathMigrationCleanupResult2(deleteAction));
|
|
112570
|
+
progressSink.tick("Cleanup");
|
|
112571
|
+
continue;
|
|
112572
|
+
}
|
|
112319
112573
|
allResults.push(await executeDeleteAction(deleteAction, {
|
|
112320
112574
|
preservePaths: writtenPaths
|
|
112321
112575
|
}));
|
|
@@ -112517,32 +112771,6 @@ function progressLabelForType(type) {
|
|
|
112517
112771
|
return "Migrating";
|
|
112518
112772
|
}
|
|
112519
112773
|
}
|
|
112520
|
-
function buildDryRunFallbackResults(skills, selectedProviders, installGlobally, plannedActions) {
|
|
112521
|
-
const plannedSkillActions = plannedActions.filter((action) => action.type === "skill").length;
|
|
112522
|
-
if (skills.length === 0 || plannedSkillActions > 0) {
|
|
112523
|
-
return [];
|
|
112524
|
-
}
|
|
112525
|
-
const results = [];
|
|
112526
|
-
for (const provider of selectedProviders.filter((entry) => getProvidersSupporting("skills").includes(entry))) {
|
|
112527
|
-
const basePath = getPortableBasePath(provider, "skills", {
|
|
112528
|
-
global: resolvePortableTypeGlobal(provider, "skill", installGlobally)
|
|
112529
|
-
});
|
|
112530
|
-
if (!basePath)
|
|
112531
|
-
continue;
|
|
112532
|
-
for (const skill of skills) {
|
|
112533
|
-
results.push({
|
|
112534
|
-
itemName: skill.name,
|
|
112535
|
-
operation: "apply",
|
|
112536
|
-
path: join144(basePath, skill.name),
|
|
112537
|
-
portableType: "skill",
|
|
112538
|
-
provider,
|
|
112539
|
-
providerDisplayName: providers[provider].displayName,
|
|
112540
|
-
success: true
|
|
112541
|
-
});
|
|
112542
|
-
}
|
|
112543
|
-
}
|
|
112544
|
-
return results;
|
|
112545
|
-
}
|
|
112546
112774
|
// src/commands/new/new-command.ts
|
|
112547
112775
|
init_logger();
|
|
112548
112776
|
init_safe_prompts();
|
|
@@ -114105,7 +114333,7 @@ init_logger();
|
|
|
114105
114333
|
init_agents();
|
|
114106
114334
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
114107
114335
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
114108
|
-
import { readFile as
|
|
114336
|
+
import { readFile as readFile68 } from "node:fs/promises";
|
|
114109
114337
|
import { join as join151 } from "node:path";
|
|
114110
114338
|
|
|
114111
114339
|
// src/commands/skills/installed-skills-inventory.ts
|
|
@@ -114285,7 +114513,7 @@ async function handleValidate2(sourcePath) {
|
|
|
114285
114513
|
for (const skill of skills) {
|
|
114286
114514
|
const skillMdPath = join151(skill.path, "SKILL.md");
|
|
114287
114515
|
try {
|
|
114288
|
-
const content = await
|
|
114516
|
+
const content = await readFile68(skillMdPath, "utf-8");
|
|
114289
114517
|
const { data } = import_gray_matter12.default(content, {
|
|
114290
114518
|
engines: { javascript: { parse: () => ({}) } }
|
|
114291
114519
|
});
|
|
@@ -114866,7 +115094,7 @@ async function detectInstallations() {
|
|
|
114866
115094
|
|
|
114867
115095
|
// src/commands/uninstall/removal-handler.ts
|
|
114868
115096
|
import { readdirSync as readdirSync12, rmSync as rmSync5 } from "node:fs";
|
|
114869
|
-
import { basename as basename33, join as join153, resolve as resolve56, sep as
|
|
115097
|
+
import { basename as basename33, join as join153, resolve as resolve56, sep as sep13 } from "node:path";
|
|
114870
115098
|
init_logger();
|
|
114871
115099
|
init_safe_prompts();
|
|
114872
115100
|
init_safe_spinner();
|
|
@@ -115052,7 +115280,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
115052
115280
|
try {
|
|
115053
115281
|
const resolvedPath = resolve56(filePath);
|
|
115054
115282
|
const resolvedBase = resolve56(baseDir);
|
|
115055
|
-
if (!resolvedPath.startsWith(resolvedBase +
|
|
115283
|
+
if (!resolvedPath.startsWith(resolvedBase + sep13) && resolvedPath !== resolvedBase) {
|
|
115056
115284
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
115057
115285
|
return false;
|
|
115058
115286
|
}
|
|
@@ -115060,7 +115288,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
115060
115288
|
if (stats.isSymbolicLink()) {
|
|
115061
115289
|
const realPath = await import_fs_extra43.realpath(filePath);
|
|
115062
115290
|
const resolvedReal = resolve56(realPath);
|
|
115063
|
-
if (!resolvedReal.startsWith(resolvedBase +
|
|
115291
|
+
if (!resolvedReal.startsWith(resolvedBase + sep13) && resolvedReal !== resolvedBase) {
|
|
115064
115292
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
115065
115293
|
return false;
|
|
115066
115294
|
}
|
|
@@ -116046,7 +116274,7 @@ function spawnAndCollect3(command, args) {
|
|
|
116046
116274
|
}
|
|
116047
116275
|
|
|
116048
116276
|
// src/commands/watch/phases/issue-processor.ts
|
|
116049
|
-
import { mkdir as mkdir40, writeFile as
|
|
116277
|
+
import { mkdir as mkdir40, writeFile as writeFile41 } from "node:fs/promises";
|
|
116050
116278
|
import { join as join156 } from "node:path";
|
|
116051
116279
|
|
|
116052
116280
|
// src/commands/watch/phases/approval-detector.ts
|
|
@@ -116681,7 +116909,7 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
116681
116909
|
const planDir = join156(projectDir, "plans", "watch");
|
|
116682
116910
|
await mkdir40(planDir, { recursive: true });
|
|
116683
116911
|
const planFilePath = join156(planDir, `issue-${issue.number}-plan.md`);
|
|
116684
|
-
await
|
|
116912
|
+
await writeFile41(planFilePath, planResult.planText, "utf-8");
|
|
116685
116913
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
116686
116914
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
116687
116915
|
} catch (err) {
|
|
@@ -116826,7 +117054,7 @@ init_ck_config_manager();
|
|
|
116826
117054
|
init_file_io();
|
|
116827
117055
|
init_logger();
|
|
116828
117056
|
import { existsSync as existsSync74 } from "node:fs";
|
|
116829
|
-
import { mkdir as mkdir41, readFile as
|
|
117057
|
+
import { mkdir as mkdir41, readFile as readFile70 } from "node:fs/promises";
|
|
116830
117058
|
import { dirname as dirname52 } from "node:path";
|
|
116831
117059
|
var PROCESSED_ISSUES_CAP = 500;
|
|
116832
117060
|
async function readCkJson(projectDir) {
|
|
@@ -116834,7 +117062,7 @@ async function readCkJson(projectDir) {
|
|
|
116834
117062
|
try {
|
|
116835
117063
|
if (!existsSync74(configPath))
|
|
116836
117064
|
return {};
|
|
116837
|
-
const content = await
|
|
117065
|
+
const content = await readFile70(configPath, "utf-8");
|
|
116838
117066
|
return JSON.parse(content);
|
|
116839
117067
|
} catch (error) {
|
|
116840
117068
|
logger.warning(`Failed to parse .ck.json: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -117546,7 +117774,7 @@ init_types3();
|
|
|
117546
117774
|
init_logger();
|
|
117547
117775
|
init_path_resolver();
|
|
117548
117776
|
import { existsSync as existsSync89 } from "node:fs";
|
|
117549
|
-
import { mkdir as mkdir43, readFile as
|
|
117777
|
+
import { mkdir as mkdir43, readFile as readFile72, writeFile as writeFile44 } from "node:fs/promises";
|
|
117550
117778
|
import { join as join171 } from "node:path";
|
|
117551
117779
|
|
|
117552
117780
|
class VersionCacheManager {
|
|
@@ -117563,7 +117791,7 @@ class VersionCacheManager {
|
|
|
117563
117791
|
logger.debug("Version check cache not found");
|
|
117564
117792
|
return null;
|
|
117565
117793
|
}
|
|
117566
|
-
const content = await
|
|
117794
|
+
const content = await readFile72(cacheFile, "utf-8");
|
|
117567
117795
|
const cache5 = JSON.parse(content);
|
|
117568
117796
|
if (!cache5.lastCheck || !cache5.currentVersion || !cache5.latestVersion) {
|
|
117569
117797
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -117583,7 +117811,7 @@ class VersionCacheManager {
|
|
|
117583
117811
|
if (!existsSync89(cacheDir)) {
|
|
117584
117812
|
await mkdir43(cacheDir, { recursive: true, mode: 448 });
|
|
117585
117813
|
}
|
|
117586
|
-
await
|
|
117814
|
+
await writeFile44(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
|
|
117587
117815
|
logger.debug(`Version check cache saved to ${cacheFile}`);
|
|
117588
117816
|
} catch (error) {
|
|
117589
117817
|
logger.debug(`Failed to save version check cache: ${error}`);
|