claudekit-cli 4.4.0-dev.9 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -10774,7 +10774,33 @@ var init_hook_migration_compatibility = __esm(() => {
|
|
|
10774
10774
|
// src/commands/portable/converters/direct-copy.ts
|
|
10775
10775
|
import { readFileSync } from "node:fs";
|
|
10776
10776
|
import { extname } from "node:path";
|
|
10777
|
-
function
|
|
10777
|
+
function rewriteKiroPaths(content) {
|
|
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
|
+
}
|
|
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 = {}) {
|
|
10778
10804
|
let content;
|
|
10779
10805
|
try {
|
|
10780
10806
|
content = readFileSync(item.sourcePath, "utf-8");
|
|
@@ -10786,9 +10812,15 @@ function convertDirectCopy(item, provider) {
|
|
|
10786
10812
|
}
|
|
10787
10813
|
}
|
|
10788
10814
|
if (provider && provider !== "claude-code") {
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10815
|
+
if (provider === "kiro") {
|
|
10816
|
+
content = rewriteKiroPaths(content);
|
|
10817
|
+
} else if (provider === "antigravity") {
|
|
10818
|
+
content = rewriteAntigravityPaths(content, options2);
|
|
10819
|
+
} else {
|
|
10820
|
+
const targetDir = PROVIDER_CONFIG_DIR[provider];
|
|
10821
|
+
if (targetDir) {
|
|
10822
|
+
content = content.replace(/\.claude\//g, targetDir);
|
|
10823
|
+
}
|
|
10792
10824
|
}
|
|
10793
10825
|
}
|
|
10794
10826
|
if (provider === "codex" && item.type === "hooks") {
|
|
@@ -10816,7 +10848,6 @@ var init_direct_copy = __esm(() => {
|
|
|
10816
10848
|
opencode: ".opencode/",
|
|
10817
10849
|
droid: ".factory/",
|
|
10818
10850
|
windsurf: ".windsurf/",
|
|
10819
|
-
antigravity: ".agent/",
|
|
10820
10851
|
cursor: ".cursor/",
|
|
10821
10852
|
roo: ".roo/",
|
|
10822
10853
|
kilo: ".kilocode/",
|
|
@@ -11380,44 +11411,48 @@ var init_provider_registry = __esm(() => {
|
|
|
11380
11411
|
kiro: {
|
|
11381
11412
|
name: "kiro",
|
|
11382
11413
|
displayName: "Kiro IDE",
|
|
11383
|
-
subagents: "
|
|
11414
|
+
subagents: "full",
|
|
11384
11415
|
agents: {
|
|
11385
|
-
projectPath: ".kiro/
|
|
11386
|
-
globalPath:
|
|
11387
|
-
format: "
|
|
11416
|
+
projectPath: ".kiro/agents",
|
|
11417
|
+
globalPath: join(home, ".kiro/agents"),
|
|
11418
|
+
format: "fm-to-fm",
|
|
11388
11419
|
writeStrategy: "per-file",
|
|
11389
11420
|
fileExtension: ".md"
|
|
11390
11421
|
},
|
|
11391
11422
|
commands: null,
|
|
11392
11423
|
skills: {
|
|
11393
11424
|
projectPath: ".kiro/skills",
|
|
11394
|
-
globalPath:
|
|
11425
|
+
globalPath: join(home, ".kiro/skills"),
|
|
11395
11426
|
format: "direct-copy",
|
|
11396
11427
|
writeStrategy: "per-file",
|
|
11397
11428
|
fileExtension: ".md"
|
|
11398
11429
|
},
|
|
11399
11430
|
config: {
|
|
11400
11431
|
projectPath: ".kiro/steering/project.md",
|
|
11401
|
-
globalPath:
|
|
11432
|
+
globalPath: join(home, ".kiro/steering/project.md"),
|
|
11402
11433
|
format: "md-to-kiro-steering",
|
|
11403
11434
|
writeStrategy: "single-file",
|
|
11404
11435
|
fileExtension: ".md"
|
|
11405
11436
|
},
|
|
11406
11437
|
rules: {
|
|
11407
11438
|
projectPath: ".kiro/steering",
|
|
11408
|
-
globalPath:
|
|
11439
|
+
globalPath: join(home, ".kiro/steering"),
|
|
11409
11440
|
format: "md-to-kiro-steering",
|
|
11410
11441
|
writeStrategy: "per-file",
|
|
11411
11442
|
fileExtension: ".md"
|
|
11412
11443
|
},
|
|
11413
11444
|
hooks: null,
|
|
11414
11445
|
settingsJsonPath: null,
|
|
11415
|
-
detect: async () => hasAnyInstallSignal([
|
|
11446
|
+
detect: async () => hasBinaryInPath("kiro") || hasAnyInstallSignal([
|
|
11416
11447
|
join(cwd, ".kiro/steering"),
|
|
11417
11448
|
join(cwd, ".kiro/skills"),
|
|
11418
11449
|
join(cwd, ".kiro/hooks"),
|
|
11419
11450
|
join(cwd, ".kiro/agents"),
|
|
11420
|
-
join(cwd, ".kiro/settings/mcp.json")
|
|
11451
|
+
join(cwd, ".kiro/settings/mcp.json"),
|
|
11452
|
+
join(home, ".kiro/steering"),
|
|
11453
|
+
join(home, ".kiro/skills"),
|
|
11454
|
+
join(home, ".kiro/agents"),
|
|
11455
|
+
join(home, ".kiro/settings/mcp.json")
|
|
11421
11456
|
])
|
|
11422
11457
|
},
|
|
11423
11458
|
windsurf: {
|
|
@@ -11618,9 +11653,15 @@ var init_provider_registry = __esm(() => {
|
|
|
11618
11653
|
name: "antigravity",
|
|
11619
11654
|
displayName: "Antigravity",
|
|
11620
11655
|
subagents: "full",
|
|
11621
|
-
agents:
|
|
11656
|
+
agents: {
|
|
11657
|
+
projectPath: ".agents/agents.md",
|
|
11658
|
+
globalPath: null,
|
|
11659
|
+
format: "fm-strip",
|
|
11660
|
+
writeStrategy: "merge-single",
|
|
11661
|
+
fileExtension: ".md"
|
|
11662
|
+
},
|
|
11622
11663
|
commands: {
|
|
11623
|
-
projectPath: ".
|
|
11664
|
+
projectPath: ".agents/workflows",
|
|
11624
11665
|
globalPath: null,
|
|
11625
11666
|
format: "direct-copy",
|
|
11626
11667
|
writeStrategy: "per-file",
|
|
@@ -11628,8 +11669,8 @@ var init_provider_registry = __esm(() => {
|
|
|
11628
11669
|
nestedCommands: false
|
|
11629
11670
|
},
|
|
11630
11671
|
skills: {
|
|
11631
|
-
projectPath: ".
|
|
11632
|
-
globalPath: join(home, ".gemini/
|
|
11672
|
+
projectPath: ".agents/skills",
|
|
11673
|
+
globalPath: join(home, ".gemini/config/skills"),
|
|
11633
11674
|
format: "direct-copy",
|
|
11634
11675
|
writeStrategy: "per-file",
|
|
11635
11676
|
fileExtension: ".md"
|
|
@@ -11642,7 +11683,7 @@ var init_provider_registry = __esm(() => {
|
|
|
11642
11683
|
fileExtension: ".md"
|
|
11643
11684
|
},
|
|
11644
11685
|
rules: {
|
|
11645
|
-
projectPath: ".
|
|
11686
|
+
projectPath: ".agents/rules",
|
|
11646
11687
|
globalPath: null,
|
|
11647
11688
|
format: "md-strip",
|
|
11648
11689
|
writeStrategy: "per-file",
|
|
@@ -11651,10 +11692,18 @@ var init_provider_registry = __esm(() => {
|
|
|
11651
11692
|
hooks: null,
|
|
11652
11693
|
settingsJsonPath: null,
|
|
11653
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"),
|
|
11654
11700
|
join(cwd, ".agent/rules"),
|
|
11655
11701
|
join(cwd, ".agent/skills"),
|
|
11656
11702
|
join(cwd, ".agent/workflows"),
|
|
11657
11703
|
join(cwd, "GEMINI.md"),
|
|
11704
|
+
join(home, ".gemini/config"),
|
|
11705
|
+
join(home, ".gemini/config/skills"),
|
|
11706
|
+
join(home, ".gemini/config/plugins"),
|
|
11658
11707
|
join(home, ".gemini/antigravity"),
|
|
11659
11708
|
join(home, ".gemini/antigravity/skills")
|
|
11660
11709
|
])
|
|
@@ -11754,7 +11803,7 @@ function normalizeProjectPath(path2) {
|
|
|
11754
11803
|
const home2 = homedir2().replace(/\\/g, "/");
|
|
11755
11804
|
return normalized.startsWith(home2) ? normalized.replace(home2, "~") : normalized;
|
|
11756
11805
|
}
|
|
11757
|
-
function
|
|
11806
|
+
function splitTrailingPunctuation2(pathSuffix) {
|
|
11758
11807
|
const match = pathSuffix.match(/^(.+?)([.,;:!?]+)?$/);
|
|
11759
11808
|
return {
|
|
11760
11809
|
itemPath: match?.[1] ?? pathSuffix,
|
|
@@ -11777,7 +11826,7 @@ function getProviderPathTarget(provider, type, global2 = false) {
|
|
|
11777
11826
|
return {
|
|
11778
11827
|
path: isDirectory && !normalized.endsWith("/") ? `${normalized}/` : normalized,
|
|
11779
11828
|
isDirectory,
|
|
11780
|
-
rewriteSuffix: provider === "codex" && type === "commands" ? getCodexCommandSkillFilenameFromCommandPath : undefined
|
|
11829
|
+
rewriteSuffix: provider === "codex" && type === "commands" ? getCodexCommandSkillFilenameFromCommandPath : provider === "antigravity" && type === "commands" ? rewriteAntigravityCommandRefSuffix : undefined
|
|
11781
11830
|
};
|
|
11782
11831
|
}
|
|
11783
11832
|
function rewriteClaudeDirectoryRefs(input, sourceDir, target, fallbackPrefix, isInCodeBlock) {
|
|
@@ -11787,7 +11836,7 @@ function rewriteClaudeDirectoryRefs(input, sourceDir, target, fallbackPrefix, is
|
|
|
11787
11836
|
const offset = args[args.length - 2];
|
|
11788
11837
|
if (isInCodeBlock(offset))
|
|
11789
11838
|
return matched;
|
|
11790
|
-
const { itemPath, punctuation } =
|
|
11839
|
+
const { itemPath, punctuation } = splitTrailingPunctuation2(suffix);
|
|
11791
11840
|
if (!target)
|
|
11792
11841
|
return `${fallbackPrefix}${itemPath}${punctuation}`;
|
|
11793
11842
|
const rewrittenSuffix = target.rewriteSuffix ? target.rewriteSuffix(itemPath) : itemPath;
|
|
@@ -12040,13 +12089,14 @@ function convertMdStrip(item, provider, options2 = {}) {
|
|
|
12040
12089
|
var MAX_CONTENT_SIZE = 512000;
|
|
12041
12090
|
var init_md_strip = __esm(() => {
|
|
12042
12091
|
init_provider_registry();
|
|
12092
|
+
init_direct_copy();
|
|
12043
12093
|
});
|
|
12044
12094
|
|
|
12045
12095
|
// src/commands/portable/converters/fm-strip.ts
|
|
12046
12096
|
function convertFmStrip(item, provider) {
|
|
12047
12097
|
const warnings = [];
|
|
12048
12098
|
const heading = item.frontmatter.name || item.name;
|
|
12049
|
-
const isMergeProvider = ["goose", "gemini-cli", "amp"].includes(provider);
|
|
12099
|
+
const isMergeProvider = ["goose", "gemini-cli", "amp", "antigravity"].includes(provider);
|
|
12050
12100
|
let body = item.body;
|
|
12051
12101
|
if (PROVIDERS_WITH_BODY_REWRITING.includes(provider)) {
|
|
12052
12102
|
const stripped = stripClaudeRefs(body, { provider });
|
|
@@ -12095,7 +12145,7 @@ function buildMergedAgentsMd(sections, providerName) {
|
|
|
12095
12145
|
var PROVIDERS_WITH_BODY_REWRITING;
|
|
12096
12146
|
var init_fm_strip = __esm(() => {
|
|
12097
12147
|
init_md_strip();
|
|
12098
|
-
PROVIDERS_WITH_BODY_REWRITING = ["gemini-cli"];
|
|
12148
|
+
PROVIDERS_WITH_BODY_REWRITING = ["gemini-cli", "antigravity"];
|
|
12099
12149
|
});
|
|
12100
12150
|
|
|
12101
12151
|
// src/commands/portable/converters/fm-to-fm.ts
|
|
@@ -12167,6 +12217,68 @@ ${item.body}
|
|
|
12167
12217
|
warnings: []
|
|
12168
12218
|
};
|
|
12169
12219
|
}
|
|
12220
|
+
function mapKiroTools(toolsStr) {
|
|
12221
|
+
const warnings = [];
|
|
12222
|
+
if (!toolsStr || toolsStr.trim().length === 0) {
|
|
12223
|
+
return {
|
|
12224
|
+
tools: ["@builtin"],
|
|
12225
|
+
warnings: ["No Claude tools declared; granting Kiro built-in tools by default"]
|
|
12226
|
+
};
|
|
12227
|
+
}
|
|
12228
|
+
const tools = new Set;
|
|
12229
|
+
const unmapped = [];
|
|
12230
|
+
for (const rawTool of toolsStr.split(",")) {
|
|
12231
|
+
const tool = rawTool.trim();
|
|
12232
|
+
if (!tool)
|
|
12233
|
+
continue;
|
|
12234
|
+
const mapped = KIRO_TOOL_MAP[tool];
|
|
12235
|
+
if (mapped) {
|
|
12236
|
+
tools.add(mapped);
|
|
12237
|
+
continue;
|
|
12238
|
+
}
|
|
12239
|
+
const mcpMatch = /^mcp__(.+?)__(.+)$/.exec(tool);
|
|
12240
|
+
if (mcpMatch) {
|
|
12241
|
+
tools.add(`@${mcpMatch[1]}/${mcpMatch[2]}`);
|
|
12242
|
+
continue;
|
|
12243
|
+
}
|
|
12244
|
+
unmapped.push(tool);
|
|
12245
|
+
}
|
|
12246
|
+
if (unmapped.length > 0) {
|
|
12247
|
+
warnings.push(`Claude tools not mapped to Kiro custom subagent tools: ${unmapped.join(", ")}`);
|
|
12248
|
+
}
|
|
12249
|
+
if (tools.size === 0) {
|
|
12250
|
+
tools.add("@builtin");
|
|
12251
|
+
warnings.push("No mapped Kiro tools remained; granting Kiro built-in tools by default");
|
|
12252
|
+
}
|
|
12253
|
+
return { tools: Array.from(tools), warnings };
|
|
12254
|
+
}
|
|
12255
|
+
function pushYamlString(lines, key, value) {
|
|
12256
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
12257
|
+
lines.push(`${key}: ${JSON.stringify(value.trim())}`);
|
|
12258
|
+
}
|
|
12259
|
+
}
|
|
12260
|
+
function convertKiroAgent(item) {
|
|
12261
|
+
const mappedTools = mapKiroTools(item.frontmatter.tools);
|
|
12262
|
+
const stripped = stripClaudeRefs(item.body, { provider: "kiro" });
|
|
12263
|
+
const warnings = [...mappedTools.warnings, ...stripped.warnings];
|
|
12264
|
+
const name = item.name;
|
|
12265
|
+
const description = item.description || `Custom subagent: ${name}`;
|
|
12266
|
+
const fmLines = ["---"];
|
|
12267
|
+
pushYamlString(fmLines, "name", name);
|
|
12268
|
+
pushYamlString(fmLines, "description", description);
|
|
12269
|
+
fmLines.push(`tools: ${JSON.stringify(mappedTools.tools)}`);
|
|
12270
|
+
pushYamlString(fmLines, "model", typeof item.frontmatter.model === "string" ? item.frontmatter.model : "");
|
|
12271
|
+
fmLines.push("---");
|
|
12272
|
+
return {
|
|
12273
|
+
content: `${fmLines.join(`
|
|
12274
|
+
`)}
|
|
12275
|
+
|
|
12276
|
+
${stripped.content}
|
|
12277
|
+
`,
|
|
12278
|
+
filename: `${item.name}.md`,
|
|
12279
|
+
warnings
|
|
12280
|
+
};
|
|
12281
|
+
}
|
|
12170
12282
|
function replaceClaudePathsForOpenCode(content) {
|
|
12171
12283
|
return content.replace(/\.claude\//g, ".opencode/");
|
|
12172
12284
|
}
|
|
@@ -12241,6 +12353,8 @@ function convertFmToFm(item, provider) {
|
|
|
12241
12353
|
return convertForCopilot(item);
|
|
12242
12354
|
case "cursor":
|
|
12243
12355
|
return convertForCursor(item);
|
|
12356
|
+
case "kiro":
|
|
12357
|
+
return convertKiroAgent(item);
|
|
12244
12358
|
case "opencode":
|
|
12245
12359
|
if (item.type === "command")
|
|
12246
12360
|
return convertOpenCodeCommand(item);
|
|
@@ -12253,8 +12367,9 @@ function convertFmToFm(item, provider) {
|
|
|
12253
12367
|
};
|
|
12254
12368
|
}
|
|
12255
12369
|
}
|
|
12256
|
-
var COPILOT_TOOL_MAP, OPENCODE_TOOL_MAP;
|
|
12370
|
+
var COPILOT_TOOL_MAP, KIRO_TOOL_MAP, OPENCODE_TOOL_MAP;
|
|
12257
12371
|
var init_fm_to_fm = __esm(() => {
|
|
12372
|
+
init_md_strip();
|
|
12258
12373
|
COPILOT_TOOL_MAP = {
|
|
12259
12374
|
Read: "read",
|
|
12260
12375
|
Glob: "search",
|
|
@@ -12266,6 +12381,19 @@ var init_fm_to_fm = __esm(() => {
|
|
|
12266
12381
|
WebFetch: "fetch",
|
|
12267
12382
|
WebSearch: "fetch"
|
|
12268
12383
|
};
|
|
12384
|
+
KIRO_TOOL_MAP = {
|
|
12385
|
+
Read: "read",
|
|
12386
|
+
Glob: "read",
|
|
12387
|
+
Grep: "read",
|
|
12388
|
+
LS: "read",
|
|
12389
|
+
Edit: "write",
|
|
12390
|
+
Write: "write",
|
|
12391
|
+
MultiEdit: "write",
|
|
12392
|
+
NotebookEdit: "write",
|
|
12393
|
+
Bash: "shell",
|
|
12394
|
+
WebFetch: "web",
|
|
12395
|
+
WebSearch: "web"
|
|
12396
|
+
};
|
|
12269
12397
|
OPENCODE_TOOL_MAP = {
|
|
12270
12398
|
Read: "read",
|
|
12271
12399
|
Glob: "glob",
|
|
@@ -12419,48 +12547,37 @@ function detectLanguageGlob(itemName) {
|
|
|
12419
12547
|
function determineInclusionMode(item) {
|
|
12420
12548
|
const languageGlob = detectLanguageGlob(item.name);
|
|
12421
12549
|
if (languageGlob) {
|
|
12422
|
-
return { mode: "fileMatch",
|
|
12550
|
+
return { mode: "fileMatch", fileMatchPattern: languageGlob };
|
|
12423
12551
|
}
|
|
12424
12552
|
const fmDescription = String(item.frontmatter.description || "").toLowerCase();
|
|
12425
12553
|
const sortedLangs = Object.keys(LANGUAGE_GLOB_MAP).sort((a3, b3) => b3.length - a3.length);
|
|
12426
12554
|
for (const lang of sortedLangs) {
|
|
12427
12555
|
if (fmDescription.includes(` ${lang} `) || fmDescription.startsWith(`${lang} `) || fmDescription.endsWith(` ${lang}`)) {
|
|
12428
|
-
return { mode: "fileMatch",
|
|
12556
|
+
return { mode: "fileMatch", fileMatchPattern: LANGUAGE_GLOB_MAP[lang] };
|
|
12429
12557
|
}
|
|
12430
12558
|
}
|
|
12431
12559
|
return { mode: "always" };
|
|
12432
12560
|
}
|
|
12433
|
-
function buildSteeringFrontmatter(mode,
|
|
12561
|
+
function buildSteeringFrontmatter(mode, fileMatchPattern) {
|
|
12434
12562
|
const lines = ["---"];
|
|
12435
12563
|
lines.push(`inclusion: ${mode}`);
|
|
12436
|
-
if (mode === "fileMatch" &&
|
|
12437
|
-
lines.push(`
|
|
12564
|
+
if (mode === "fileMatch" && fileMatchPattern) {
|
|
12565
|
+
lines.push(`fileMatchPattern: "${fileMatchPattern}"`);
|
|
12438
12566
|
}
|
|
12439
12567
|
lines.push("---");
|
|
12440
12568
|
return lines.join(`
|
|
12441
12569
|
`);
|
|
12442
12570
|
}
|
|
12443
|
-
function checkUnsupportedFields(item) {
|
|
12444
|
-
const warnings = [];
|
|
12445
|
-
const presentFields = UNSUPPORTED_AGENT_FIELDS.filter((field) => item.frontmatter[field] !== undefined);
|
|
12446
|
-
if (presentFields.length > 0) {
|
|
12447
|
-
warnings.push(`Agent metadata not supported by Kiro (dropped): ${presentFields.join(", ")}`);
|
|
12448
|
-
}
|
|
12449
|
-
return warnings;
|
|
12450
|
-
}
|
|
12451
12571
|
function bodyStartsWithHeading(body) {
|
|
12452
12572
|
const trimmed = body.trimStart();
|
|
12453
12573
|
return /^#{1,6}\s+/.test(trimmed);
|
|
12454
12574
|
}
|
|
12455
12575
|
function convertMdToKiroSteering(item, provider) {
|
|
12456
12576
|
const warnings = [];
|
|
12457
|
-
if (item.type === "agent") {
|
|
12458
|
-
warnings.push(...checkUnsupportedFields(item));
|
|
12459
|
-
}
|
|
12460
12577
|
const stripped = stripClaudeRefs(item.body, { provider });
|
|
12461
12578
|
warnings.push(...stripped.warnings);
|
|
12462
|
-
const { mode,
|
|
12463
|
-
const frontmatter = buildSteeringFrontmatter(mode,
|
|
12579
|
+
const { mode, fileMatchPattern } = determineInclusionMode(item);
|
|
12580
|
+
const frontmatter = buildSteeringFrontmatter(mode, fileMatchPattern);
|
|
12464
12581
|
const heading = item.frontmatter.name || item.name;
|
|
12465
12582
|
const hasExistingHeading = bodyStartsWithHeading(stripped.content);
|
|
12466
12583
|
let content;
|
|
@@ -12477,8 +12594,8 @@ ${stripped.content}
|
|
|
12477
12594
|
${stripped.content}
|
|
12478
12595
|
`;
|
|
12479
12596
|
}
|
|
12480
|
-
if (mode === "fileMatch" &&
|
|
12481
|
-
warnings.push(`Using fileMatch mode with pattern: ${
|
|
12597
|
+
if (mode === "fileMatch" && fileMatchPattern) {
|
|
12598
|
+
warnings.push(`Using fileMatch mode with pattern: ${fileMatchPattern}`);
|
|
12482
12599
|
}
|
|
12483
12600
|
return {
|
|
12484
12601
|
content,
|
|
@@ -12486,7 +12603,7 @@ ${stripped.content}
|
|
|
12486
12603
|
warnings
|
|
12487
12604
|
};
|
|
12488
12605
|
}
|
|
12489
|
-
var LANGUAGE_GLOB_MAP
|
|
12606
|
+
var LANGUAGE_GLOB_MAP;
|
|
12490
12607
|
var init_md_to_kiro_steering = __esm(() => {
|
|
12491
12608
|
init_md_strip();
|
|
12492
12609
|
LANGUAGE_GLOB_MAP = {
|
|
@@ -12510,7 +12627,6 @@ var init_md_to_kiro_steering = __esm(() => {
|
|
|
12510
12627
|
vue: "**/*.vue",
|
|
12511
12628
|
svelte: "**/*.svelte"
|
|
12512
12629
|
};
|
|
12513
|
-
UNSUPPORTED_AGENT_FIELDS = ["model", "tools", "memory", "argumentHint"];
|
|
12514
12630
|
});
|
|
12515
12631
|
|
|
12516
12632
|
// src/commands/portable/converters/md-to-mdc.ts
|
|
@@ -12541,14 +12657,15 @@ var init_md_to_mdc = __esm(() => {
|
|
|
12541
12657
|
});
|
|
12542
12658
|
|
|
12543
12659
|
// src/commands/portable/converters/skill-md.ts
|
|
12544
|
-
function convertToSkillMd(item) {
|
|
12660
|
+
function convertToSkillMd(item, provider, options2 = {}) {
|
|
12545
12661
|
const fm = {
|
|
12546
12662
|
name: item.frontmatter.name || item.name,
|
|
12547
12663
|
description: item.description || ""
|
|
12548
12664
|
};
|
|
12665
|
+
const itemBody = provider === "antigravity" ? rewriteAntigravityPaths(item.body, options2) : item.body;
|
|
12549
12666
|
const body = `# ${fm.name}
|
|
12550
12667
|
|
|
12551
|
-
${
|
|
12668
|
+
${itemBody}`;
|
|
12552
12669
|
const content = import_gray_matter2.default.stringify(body, fm);
|
|
12553
12670
|
return {
|
|
12554
12671
|
content,
|
|
@@ -12558,6 +12675,7 @@ ${item.body}`;
|
|
|
12558
12675
|
}
|
|
12559
12676
|
var import_gray_matter2;
|
|
12560
12677
|
var init_skill_md = __esm(() => {
|
|
12678
|
+
init_direct_copy();
|
|
12561
12679
|
import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
12562
12680
|
});
|
|
12563
12681
|
|
|
@@ -12566,7 +12684,7 @@ function convertItem(item, format, provider, options2 = {}) {
|
|
|
12566
12684
|
try {
|
|
12567
12685
|
switch (format) {
|
|
12568
12686
|
case "direct-copy":
|
|
12569
|
-
return convertDirectCopy(item, provider);
|
|
12687
|
+
return convertDirectCopy(item, provider, { global: options2.global });
|
|
12570
12688
|
case "command-to-codex-skill":
|
|
12571
12689
|
return convertCommandToCodexSkill(item);
|
|
12572
12690
|
case "fm-to-fm":
|
|
@@ -12580,7 +12698,7 @@ function convertItem(item, format, provider, options2 = {}) {
|
|
|
12580
12698
|
case "md-to-toml":
|
|
12581
12699
|
return convertMdToToml(item);
|
|
12582
12700
|
case "skill-md":
|
|
12583
|
-
return convertToSkillMd(item);
|
|
12701
|
+
return convertToSkillMd(item, provider, { global: options2.global });
|
|
12584
12702
|
case "md-strip":
|
|
12585
12703
|
return convertMdStrip(item, provider, { global: options2.global });
|
|
12586
12704
|
case "md-to-mdc":
|
|
@@ -50107,6 +50225,18 @@ var init_ck_config_schema = __esm(() => {
|
|
|
50107
50225
|
description: "Separator color",
|
|
50108
50226
|
maxLength: 30,
|
|
50109
50227
|
pattern: "^[a-zA-Z]+$"
|
|
50228
|
+
},
|
|
50229
|
+
quotaLow: {
|
|
50230
|
+
type: "string",
|
|
50231
|
+
description: "Quota section color when all windows <85%",
|
|
50232
|
+
maxLength: 30,
|
|
50233
|
+
pattern: "^[a-zA-Z]+$"
|
|
50234
|
+
},
|
|
50235
|
+
quotaHigh: {
|
|
50236
|
+
type: "string",
|
|
50237
|
+
description: "Quota section color when any window >=85%",
|
|
50238
|
+
maxLength: 30,
|
|
50239
|
+
pattern: "^[a-zA-Z]+$"
|
|
50110
50240
|
}
|
|
50111
50241
|
},
|
|
50112
50242
|
additionalProperties: false
|
|
@@ -51900,7 +52030,7 @@ var init_migrate_provider_scopes = __esm(() => {
|
|
|
51900
52030
|
|
|
51901
52031
|
// src/commands/migrate/skill-directory-installer.ts
|
|
51902
52032
|
import { existsSync as existsSync22 } from "node:fs";
|
|
51903
|
-
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";
|
|
51904
52034
|
import { dirname as dirname11, join as join40, resolve as resolve15 } from "node:path";
|
|
51905
52035
|
async function canonicalize(path4) {
|
|
51906
52036
|
try {
|
|
@@ -51921,6 +52051,18 @@ async function canonicalize(path4) {
|
|
|
51921
52051
|
}
|
|
51922
52052
|
}
|
|
51923
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
|
+
}
|
|
51924
52066
|
async function installSkillDirectories(skills, targetProviders, options2) {
|
|
51925
52067
|
const results = [];
|
|
51926
52068
|
for (const provider of targetProviders) {
|
|
@@ -51992,6 +52134,7 @@ async function installSkillDirectories(skills, targetProviders, options2) {
|
|
|
51992
52134
|
try {
|
|
51993
52135
|
await cp(skill.path, targetDir, { recursive: true, force: true });
|
|
51994
52136
|
copied = true;
|
|
52137
|
+
await rewriteInstalledSkillMd(targetDir, provider, options2);
|
|
51995
52138
|
await addPortableInstallation(skill.name, "skill", provider, options2.global, targetDir, skill.path);
|
|
51996
52139
|
} catch (error) {
|
|
51997
52140
|
try {
|
|
@@ -52036,13 +52179,14 @@ async function installSkillDirectories(skills, targetProviders, options2) {
|
|
|
52036
52179
|
return results;
|
|
52037
52180
|
}
|
|
52038
52181
|
var init_skill_directory_installer = __esm(() => {
|
|
52182
|
+
init_direct_copy();
|
|
52039
52183
|
init_portable_registry();
|
|
52040
52184
|
init_provider_registry();
|
|
52041
52185
|
});
|
|
52042
52186
|
|
|
52043
52187
|
// src/commands/portable/config-discovery.ts
|
|
52044
52188
|
import { existsSync as existsSync23, readFileSync as readFileSync6 } from "node:fs";
|
|
52045
|
-
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";
|
|
52046
52190
|
import { homedir as homedir23 } from "node:os";
|
|
52047
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";
|
|
52048
52192
|
async function copyHooksCompanionDirs(sourceDir, targetDir) {
|
|
@@ -52160,7 +52304,7 @@ async function discoverConfig(sourcePath) {
|
|
|
52160
52304
|
if (!existsSync23(path4)) {
|
|
52161
52305
|
return null;
|
|
52162
52306
|
}
|
|
52163
|
-
const content = await
|
|
52307
|
+
const content = await readFile20(path4, "utf-8");
|
|
52164
52308
|
return {
|
|
52165
52309
|
name: "CLAUDE",
|
|
52166
52310
|
description: "Project configuration",
|
|
@@ -52217,7 +52361,7 @@ async function discoverHooks(sourcePath) {
|
|
|
52217
52361
|
continue;
|
|
52218
52362
|
}
|
|
52219
52363
|
try {
|
|
52220
|
-
const content = await
|
|
52364
|
+
const content = await readFile20(file.fullPath, "utf-8");
|
|
52221
52365
|
items.push({
|
|
52222
52366
|
name: file.name,
|
|
52223
52367
|
segments: file.name.split("/"),
|
|
@@ -52246,7 +52390,7 @@ async function readHooksNearHooksDir(hooksDir) {
|
|
|
52246
52390
|
if (!existsSync23(settingsPath))
|
|
52247
52391
|
return null;
|
|
52248
52392
|
try {
|
|
52249
|
-
const parsed = JSON.parse(await
|
|
52393
|
+
const parsed = JSON.parse(await readFile20(settingsPath, "utf-8"));
|
|
52250
52394
|
return parsed.hooks && typeof parsed.hooks === "object" ? parsed.hooks : null;
|
|
52251
52395
|
} catch {
|
|
52252
52396
|
return null;
|
|
@@ -52384,7 +52528,7 @@ async function discoverPortableFiles(dir, baseDir, options2) {
|
|
|
52384
52528
|
const normalizedPath = relPath.split(/[/\\]/).join("/");
|
|
52385
52529
|
const name = options2.stripExtension ? normalizedPath.replace(/\.[^.]+$/, "") : normalizedPath;
|
|
52386
52530
|
try {
|
|
52387
|
-
const content = await
|
|
52531
|
+
const content = await readFile20(fullPath, "utf-8");
|
|
52388
52532
|
items.push({
|
|
52389
52533
|
name,
|
|
52390
52534
|
description: `${options2.descriptionPrefix}: ${name}`,
|
|
@@ -54395,7 +54539,7 @@ var init_codex_path_safety = __esm(() => {
|
|
|
54395
54539
|
|
|
54396
54540
|
// src/commands/portable/codex-features-flag.ts
|
|
54397
54541
|
import { existsSync as existsSync25 } from "node:fs";
|
|
54398
|
-
import { readFile as
|
|
54542
|
+
import { readFile as readFile21, rename as rename7, unlink as unlink6, writeFile as writeFile12 } from "node:fs/promises";
|
|
54399
54543
|
import { dirname as dirname14, resolve as resolve18 } from "node:path";
|
|
54400
54544
|
async function ensureCodexHooksFeatureFlag(configTomlPath, isGlobal = false) {
|
|
54401
54545
|
const boundary = isGlobal ? getCodexGlobalBoundary() : dirname14(resolve18(configTomlPath));
|
|
@@ -54412,7 +54556,7 @@ async function _ensureFeatureFlagLocked(configTomlPath) {
|
|
|
54412
54556
|
let existing = "";
|
|
54413
54557
|
if (existsSync25(configTomlPath)) {
|
|
54414
54558
|
try {
|
|
54415
|
-
existing = await
|
|
54559
|
+
existing = await readFile21(configTomlPath, "utf8");
|
|
54416
54560
|
} catch (err) {
|
|
54417
54561
|
return {
|
|
54418
54562
|
status: "failed",
|
|
@@ -54544,7 +54688,7 @@ function stripAllManagedBlocks(content) {
|
|
|
54544
54688
|
async function atomicWrite(filePath, content) {
|
|
54545
54689
|
const tempPath = `${filePath}.ck-tmp`;
|
|
54546
54690
|
try {
|
|
54547
|
-
await
|
|
54691
|
+
await writeFile12(tempPath, content, "utf8");
|
|
54548
54692
|
await rename7(tempPath, filePath);
|
|
54549
54693
|
} catch (err) {
|
|
54550
54694
|
try {
|
|
@@ -54992,7 +55136,7 @@ var init_gemini_hook_event_map = __esm(() => {
|
|
|
54992
55136
|
|
|
54993
55137
|
// src/commands/portable/hooks-settings-merger.ts
|
|
54994
55138
|
import { existsSync as existsSync26 } from "node:fs";
|
|
54995
|
-
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";
|
|
54996
55140
|
import { homedir as homedir26 } from "node:os";
|
|
54997
55141
|
import { basename as basename14, dirname as dirname16, extname as extname4, join as join44, resolve as resolve20 } from "node:path";
|
|
54998
55142
|
function isCodexWrappableHookPath(filePath) {
|
|
@@ -55035,7 +55179,7 @@ async function inspectHooksSettings(settingsPath) {
|
|
|
55035
55179
|
if (!existsSync26(settingsPath)) {
|
|
55036
55180
|
return { status: "missing-file" };
|
|
55037
55181
|
}
|
|
55038
|
-
const raw = await
|
|
55182
|
+
const raw = await readFile22(settingsPath, "utf8");
|
|
55039
55183
|
const parsed = JSON.parse(raw);
|
|
55040
55184
|
if (!parsed.hooks || typeof parsed.hooks !== "object") {
|
|
55041
55185
|
return { status: "missing-hooks" };
|
|
@@ -55148,7 +55292,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks, options2 = {
|
|
|
55148
55292
|
let existingSettings = {};
|
|
55149
55293
|
let backupPath = null;
|
|
55150
55294
|
if (existsSync26(targetSettingsPath)) {
|
|
55151
|
-
const raw = await
|
|
55295
|
+
const raw = await readFile22(targetSettingsPath, "utf8");
|
|
55152
55296
|
try {
|
|
55153
55297
|
existingSettings = JSON.parse(raw);
|
|
55154
55298
|
} catch {
|
|
@@ -55157,7 +55301,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks, options2 = {
|
|
|
55157
55301
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
55158
55302
|
backupPath = `${targetSettingsPath}.${timestamp}.bak`;
|
|
55159
55303
|
try {
|
|
55160
|
-
await
|
|
55304
|
+
await writeFile13(backupPath, raw, "utf8");
|
|
55161
55305
|
} catch {
|
|
55162
55306
|
backupPath = null;
|
|
55163
55307
|
}
|
|
@@ -55174,7 +55318,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks, options2 = {
|
|
|
55174
55318
|
await mkdir13(dir, { recursive: true });
|
|
55175
55319
|
const tempPath = `${targetSettingsPath}.tmp`;
|
|
55176
55320
|
try {
|
|
55177
|
-
await
|
|
55321
|
+
await writeFile13(tempPath, JSON.stringify(existingSettings, null, 2), "utf8");
|
|
55178
55322
|
await rename8(tempPath, targetSettingsPath);
|
|
55179
55323
|
} catch (err) {
|
|
55180
55324
|
await rm6(tempPath, { force: true });
|
|
@@ -55728,7 +55872,7 @@ var init_generated_context_hooks = __esm(() => {
|
|
|
55728
55872
|
|
|
55729
55873
|
// src/commands/portable/migrated-hook-settings-cleanup.ts
|
|
55730
55874
|
import { existsSync as existsSync27, realpathSync } from "node:fs";
|
|
55731
|
-
import { readFile as
|
|
55875
|
+
import { readFile as readFile23, rename as rename9, rm as rm7, unlink as unlink7, writeFile as writeFile14 } from "node:fs/promises";
|
|
55732
55876
|
import { basename as basename16, isAbsolute as isAbsolute6, relative as relative10, resolve as resolve21 } from "node:path";
|
|
55733
55877
|
async function pruneSettingsHooks(settingsPath, hooksDir) {
|
|
55734
55878
|
const filesToRemove = new Set;
|
|
@@ -55737,7 +55881,7 @@ async function pruneSettingsHooks(settingsPath, hooksDir) {
|
|
|
55737
55881
|
return { hooksPruned: 0, filesToRemove, warnings };
|
|
55738
55882
|
let parsed;
|
|
55739
55883
|
try {
|
|
55740
|
-
parsed = JSON.parse(await
|
|
55884
|
+
parsed = JSON.parse(await readFile23(settingsPath, "utf8"));
|
|
55741
55885
|
} catch (error) {
|
|
55742
55886
|
warnings.push(`Could not parse ${settingsPath}; hook cleanup skipped (${error instanceof Error ? error.message : String(error)})`);
|
|
55743
55887
|
return { hooksPruned: 0, filesToRemove, warnings };
|
|
@@ -55839,7 +55983,7 @@ function resolvePathForContainment(pathValue) {
|
|
|
55839
55983
|
async function atomicWrite2(filePath, content) {
|
|
55840
55984
|
const tempPath = `${filePath}.ck-tmp`;
|
|
55841
55985
|
try {
|
|
55842
|
-
await
|
|
55986
|
+
await writeFile14(tempPath, `${content}
|
|
55843
55987
|
`, "utf8");
|
|
55844
55988
|
await rename9(tempPath, filePath);
|
|
55845
55989
|
} catch (error) {
|
|
@@ -55926,7 +56070,7 @@ var init_migrated_hooks_cleanup = __esm(() => {
|
|
|
55926
56070
|
|
|
55927
56071
|
// src/commands/portable/portable-manifest.ts
|
|
55928
56072
|
import { existsSync as existsSync28 } from "node:fs";
|
|
55929
|
-
import { readFile as
|
|
56073
|
+
import { readFile as readFile24 } from "node:fs/promises";
|
|
55930
56074
|
import path4 from "node:path";
|
|
55931
56075
|
async function loadPortableManifest(kitPath) {
|
|
55932
56076
|
const manifestPath = path4.join(kitPath, "portable-manifest.json");
|
|
@@ -55935,7 +56079,7 @@ async function loadPortableManifest(kitPath) {
|
|
|
55935
56079
|
logger.verbose("No portable-manifest.json found — no evolution tracking");
|
|
55936
56080
|
return null;
|
|
55937
56081
|
}
|
|
55938
|
-
const raw = await
|
|
56082
|
+
const raw = await readFile24(manifestPath, "utf-8");
|
|
55939
56083
|
let parsed;
|
|
55940
56084
|
try {
|
|
55941
56085
|
parsed = JSON.parse(raw);
|
|
@@ -56047,7 +56191,7 @@ var init_reconcile_registry_backfill = __esm(() => {
|
|
|
56047
56191
|
|
|
56048
56192
|
// src/commands/portable/reconcile-state-builders.ts
|
|
56049
56193
|
import { existsSync as existsSync29, readdirSync as readdirSync3, statSync as statSync5 } from "node:fs";
|
|
56050
|
-
import { readFile as
|
|
56194
|
+
import { readFile as readFile25 } from "node:fs/promises";
|
|
56051
56195
|
function getProviderPathKeyForPortableType2(type) {
|
|
56052
56196
|
switch (type) {
|
|
56053
56197
|
case "agent":
|
|
@@ -56248,7 +56392,7 @@ async function buildTargetStates(entries, options2) {
|
|
|
56248
56392
|
const state = { path: entryPath, exists };
|
|
56249
56393
|
if (exists) {
|
|
56250
56394
|
try {
|
|
56251
|
-
const content = await
|
|
56395
|
+
const content = await readFile25(entryPath, "utf-8");
|
|
56252
56396
|
state.currentChecksum = computeContentChecksum(content);
|
|
56253
56397
|
if (groupedEntries.some((entry) => usesMergeSingleChecksums(entry))) {
|
|
56254
56398
|
state.sectionChecksums = computeManagedSectionChecksums(content);
|
|
@@ -56869,7 +57013,7 @@ function detectPathMigrations(input) {
|
|
|
56869
57013
|
const actions = [];
|
|
56870
57014
|
const activeProviderConfigs = dedupeProviderConfigs(input.providerConfigs);
|
|
56871
57015
|
for (const migration of migrations) {
|
|
56872
|
-
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 }));
|
|
56873
57017
|
for (const entry of affectedEntries) {
|
|
56874
57018
|
const code = "path-migrated-cleanup";
|
|
56875
57019
|
actions.push({
|
|
@@ -56914,6 +57058,36 @@ var init_reconciler = __esm(() => {
|
|
|
56914
57058
|
type: "command",
|
|
56915
57059
|
from: ".codex/prompts",
|
|
56916
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"
|
|
56917
57091
|
}
|
|
56918
57092
|
];
|
|
56919
57093
|
});
|
|
@@ -57075,7 +57249,7 @@ __export(exports_skills_discovery, {
|
|
|
57075
57249
|
discoverSkillsEnriched: () => discoverSkillsEnriched,
|
|
57076
57250
|
discoverSkills: () => discoverSkills
|
|
57077
57251
|
});
|
|
57078
|
-
import { readFile as
|
|
57252
|
+
import { readFile as readFile26, readdir as readdir13, stat as stat9 } from "node:fs/promises";
|
|
57079
57253
|
import { homedir as homedir27 } from "node:os";
|
|
57080
57254
|
import { dirname as dirname17, join as join45 } from "node:path";
|
|
57081
57255
|
function getSkillSourcePath(globalOnly = false) {
|
|
@@ -57102,7 +57276,7 @@ async function hasSkillMd(dir) {
|
|
|
57102
57276
|
}
|
|
57103
57277
|
async function parseSkillMd(skillMdPath) {
|
|
57104
57278
|
try {
|
|
57105
|
-
const content = await
|
|
57279
|
+
const content = await readFile26(skillMdPath, "utf-8");
|
|
57106
57280
|
const { data } = import_gray_matter5.default(content, { engines: { javascript: { parse: () => ({}) } } });
|
|
57107
57281
|
const skillDir = dirname17(skillMdPath);
|
|
57108
57282
|
const dirName = skillDir.split(/[/\\]/).pop() || "";
|
|
@@ -57175,7 +57349,7 @@ async function discoverSkillsEnriched(sourcePath) {
|
|
|
57175
57349
|
for (const skill of base) {
|
|
57176
57350
|
const skillMdPath = join45(skill.path, "SKILL.md");
|
|
57177
57351
|
try {
|
|
57178
|
-
const content = await
|
|
57352
|
+
const content = await readFile26(skillMdPath, "utf-8");
|
|
57179
57353
|
const { data, content: body } = import_gray_matter5.default(content, {
|
|
57180
57354
|
engines: { javascript: { parse: () => ({}) } }
|
|
57181
57355
|
});
|
|
@@ -57319,7 +57493,7 @@ var init_migration_result_utils = __esm(() => {
|
|
|
57319
57493
|
|
|
57320
57494
|
// src/domains/web-server/routes/migration-routes.ts
|
|
57321
57495
|
import { existsSync as existsSync30 } from "node:fs";
|
|
57322
|
-
import { readFile as
|
|
57496
|
+
import { readFile as readFile27, rm as rm8 } from "node:fs/promises";
|
|
57323
57497
|
import { homedir as homedir28 } from "node:os";
|
|
57324
57498
|
import { basename as basename17, join as join46, resolve as resolve23 } from "node:path";
|
|
57325
57499
|
function resolveRegistryDeps(deps) {
|
|
@@ -57581,6 +57755,40 @@ async function executePlanDeleteAction(action, options2) {
|
|
|
57581
57755
|
};
|
|
57582
57756
|
}
|
|
57583
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
|
+
}
|
|
57584
57792
|
function countEnabledTypes(include) {
|
|
57585
57793
|
return MIGRATION_TYPES.filter((type) => include[type]).length;
|
|
57586
57794
|
}
|
|
@@ -58119,9 +58327,9 @@ function registerMigrationRoutes(app, deps) {
|
|
|
58119
58327
|
const readmePath = `${skill.path}/README.md`;
|
|
58120
58328
|
let content;
|
|
58121
58329
|
if (existsSync30(skillMdPath)) {
|
|
58122
|
-
content = await
|
|
58330
|
+
content = await readFile27(skillMdPath, "utf-8");
|
|
58123
58331
|
} else if (existsSync30(readmePath)) {
|
|
58124
|
-
content = await
|
|
58332
|
+
content = await readFile27(readmePath, "utf-8");
|
|
58125
58333
|
} else {
|
|
58126
58334
|
console.warn(`[migrate] Skill "${sanitizeUntrusted(skill.name, 80)}" has neither SKILL.md nor README.md, skipping`);
|
|
58127
58335
|
continue;
|
|
@@ -58547,6 +58755,16 @@ function registerMigrationRoutes(app, deps) {
|
|
|
58547
58755
|
}
|
|
58548
58756
|
const writtenPaths = new Set(allResults.filter((r2) => r2.success && !r2.skipped && r2.path.length > 0).map((r2) => resolve23(r2.path)));
|
|
58549
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
|
+
}
|
|
58550
58768
|
const deleteResult = await executePlanDeleteAction(deleteAction, {
|
|
58551
58769
|
preservePaths: writtenPaths,
|
|
58552
58770
|
removePortableInstallation: registryDeps.removePortableInstallation
|
|
@@ -61302,7 +61520,7 @@ var init_project_plan_data = __esm(() => {
|
|
|
61302
61520
|
|
|
61303
61521
|
// src/domains/web-server/routes/project-routes.ts
|
|
61304
61522
|
import { existsSync as existsSync37 } from "node:fs";
|
|
61305
|
-
import { readFile as
|
|
61523
|
+
import { readFile as readFile28 } from "node:fs/promises";
|
|
61306
61524
|
import { homedir as homedir31 } from "node:os";
|
|
61307
61525
|
import { basename as basename21, join as join55, resolve as resolve28 } from "node:path";
|
|
61308
61526
|
function registerProjectRoutes(app) {
|
|
@@ -61545,7 +61763,7 @@ async function buildProjectInfoFromRegistry(registered, cachedSettings, cachedSk
|
|
|
61545
61763
|
let metadata = {};
|
|
61546
61764
|
try {
|
|
61547
61765
|
if (hasClaudeDir && existsSync37(metadataPath)) {
|
|
61548
|
-
const content = await
|
|
61766
|
+
const content = await readFile28(metadataPath, "utf-8");
|
|
61549
61767
|
try {
|
|
61550
61768
|
metadata = JSON.parse(content);
|
|
61551
61769
|
} catch {}
|
|
@@ -61587,7 +61805,7 @@ async function detectAndBuildProjectInfo(path6, id, cachedSettings, cachedSkills
|
|
|
61587
61805
|
let metadata = {};
|
|
61588
61806
|
try {
|
|
61589
61807
|
if (existsSync37(metadataPath)) {
|
|
61590
|
-
const content = await
|
|
61808
|
+
const content = await readFile28(metadataPath, "utf-8");
|
|
61591
61809
|
try {
|
|
61592
61810
|
metadata = JSON.parse(content);
|
|
61593
61811
|
} catch {}
|
|
@@ -61643,7 +61861,7 @@ var init_project_routes = __esm(() => {
|
|
|
61643
61861
|
|
|
61644
61862
|
// src/domains/web-server/routes/session-routes.ts
|
|
61645
61863
|
import { existsSync as existsSync38 } from "node:fs";
|
|
61646
|
-
import { readFile as
|
|
61864
|
+
import { readFile as readFile29, readdir as readdir14, stat as stat10 } from "node:fs/promises";
|
|
61647
61865
|
import { homedir as homedir32 } from "node:os";
|
|
61648
61866
|
import { basename as basename22, join as join56 } from "node:path";
|
|
61649
61867
|
function toDateStr(d3) {
|
|
@@ -61802,7 +62020,7 @@ async function parseSessionDetail(filePath, limit, offset) {
|
|
|
61802
62020
|
summary: { messageCount: 0, toolCallCount: 0 }
|
|
61803
62021
|
};
|
|
61804
62022
|
}
|
|
61805
|
-
const raw = await
|
|
62023
|
+
const raw = await readFile29(filePath, "utf-8");
|
|
61806
62024
|
const lines = raw.split(`
|
|
61807
62025
|
`).filter((l2) => l2.trim());
|
|
61808
62026
|
const toolResultsMap = new Map;
|
|
@@ -62120,7 +62338,7 @@ var init_settings_routes = __esm(() => {
|
|
|
62120
62338
|
});
|
|
62121
62339
|
|
|
62122
62340
|
// src/domains/skills/skill-catalog-generator.ts
|
|
62123
|
-
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";
|
|
62124
62342
|
import { homedir as homedir34 } from "node:os";
|
|
62125
62343
|
import { dirname as dirname25, join as join57, relative as relative15 } from "node:path";
|
|
62126
62344
|
async function hasScripts(skillPath) {
|
|
@@ -62191,13 +62409,13 @@ class SkillCatalogGenerator {
|
|
|
62191
62409
|
await mkdir14(dirname25(CATALOG_PATH), { recursive: true });
|
|
62192
62410
|
const tmpPath = `${CATALOG_PATH}.tmp`;
|
|
62193
62411
|
const json = JSON.stringify(catalog, null, 2);
|
|
62194
|
-
await
|
|
62412
|
+
await writeFile15(tmpPath, json, "utf-8");
|
|
62195
62413
|
await rename10(tmpPath, CATALOG_PATH);
|
|
62196
62414
|
logger.verbose(`Catalog written: ${catalog.skillCount} skills`);
|
|
62197
62415
|
}
|
|
62198
62416
|
async read() {
|
|
62199
62417
|
try {
|
|
62200
|
-
const content = await
|
|
62418
|
+
const content = await readFile30(CATALOG_PATH, "utf-8");
|
|
62201
62419
|
const parsed = JSON.parse(content);
|
|
62202
62420
|
if (parsed.version !== CATALOG_VERSION) {
|
|
62203
62421
|
logger.verbose(`Catalog version mismatch (${parsed.version} vs ${CATALOG_VERSION})`);
|
|
@@ -62659,9 +62877,18 @@ var init_agents = __esm(() => {
|
|
|
62659
62877
|
antigravity: {
|
|
62660
62878
|
name: "antigravity",
|
|
62661
62879
|
displayName: "Antigravity",
|
|
62662
|
-
projectPath: ".
|
|
62663
|
-
globalPath: join59(home3, ".gemini/
|
|
62664
|
-
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
|
+
])
|
|
62665
62892
|
},
|
|
62666
62893
|
"github-copilot": {
|
|
62667
62894
|
name: "github-copilot",
|
|
@@ -62684,6 +62911,22 @@ var init_agents = __esm(() => {
|
|
|
62684
62911
|
globalPath: join59(home3, ".kilocode/skills"),
|
|
62685
62912
|
detect: async () => existsSync39(join59(home3, ".kilocode"))
|
|
62686
62913
|
},
|
|
62914
|
+
kiro: {
|
|
62915
|
+
name: "kiro",
|
|
62916
|
+
displayName: "Kiro",
|
|
62917
|
+
projectPath: ".kiro/skills",
|
|
62918
|
+
globalPath: join59(home3, ".kiro/skills"),
|
|
62919
|
+
detect: async () => hasAnyInstallSignal2([
|
|
62920
|
+
join59(process.cwd(), ".kiro/skills"),
|
|
62921
|
+
join59(process.cwd(), ".kiro/steering"),
|
|
62922
|
+
join59(process.cwd(), ".kiro/agents"),
|
|
62923
|
+
join59(process.cwd(), ".kiro/settings/mcp.json"),
|
|
62924
|
+
join59(home3, ".kiro/skills"),
|
|
62925
|
+
join59(home3, ".kiro/steering"),
|
|
62926
|
+
join59(home3, ".kiro/agents"),
|
|
62927
|
+
join59(home3, ".kiro/settings/mcp.json")
|
|
62928
|
+
])
|
|
62929
|
+
},
|
|
62687
62930
|
roo: {
|
|
62688
62931
|
name: "roo",
|
|
62689
62932
|
displayName: "Roo Code",
|
|
@@ -62717,9 +62960,9 @@ var init_agents = __esm(() => {
|
|
|
62717
62960
|
|
|
62718
62961
|
// src/commands/skills/skills-registry.ts
|
|
62719
62962
|
import { existsSync as existsSync40 } from "node:fs";
|
|
62720
|
-
import { mkdir as mkdir15, readFile as
|
|
62963
|
+
import { mkdir as mkdir15, readFile as readFile32, writeFile as writeFile16 } from "node:fs/promises";
|
|
62721
62964
|
import { homedir as homedir37 } from "node:os";
|
|
62722
|
-
import { dirname as dirname26, join as join60
|
|
62965
|
+
import { dirname as dirname26, join as join60 } from "node:path";
|
|
62723
62966
|
function getCliVersion3() {
|
|
62724
62967
|
try {
|
|
62725
62968
|
if (process.env.npm_package_version) {
|
|
@@ -62736,12 +62979,40 @@ function getCliVersion3() {
|
|
|
62736
62979
|
return "unknown";
|
|
62737
62980
|
}
|
|
62738
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
|
+
}
|
|
62739
63009
|
function migrateRegistryPaths(registry) {
|
|
62740
63010
|
let changed = false;
|
|
62741
63011
|
for (const entry of registry.installations) {
|
|
62742
63012
|
for (const migration of REGISTRY_PATH_MIGRATIONS) {
|
|
62743
|
-
|
|
62744
|
-
|
|
63013
|
+
const migratedPath = entry.agent === migration.agent ? migratePathBySegments(entry.path, migration.oldPath, migration.newPath) : null;
|
|
63014
|
+
if (migratedPath) {
|
|
63015
|
+
entry.path = migratedPath;
|
|
62745
63016
|
changed = true;
|
|
62746
63017
|
break;
|
|
62747
63018
|
}
|
|
@@ -62754,12 +63025,12 @@ async function readRegistry2() {
|
|
|
62754
63025
|
if (!existsSync40(REGISTRY_PATH)) {
|
|
62755
63026
|
return { version: "1.0", installations: [] };
|
|
62756
63027
|
}
|
|
62757
|
-
const content = await
|
|
63028
|
+
const content = await readFile32(REGISTRY_PATH, "utf-8");
|
|
62758
63029
|
const data = JSON.parse(content);
|
|
62759
63030
|
const registry = SkillRegistrySchema.parse(data);
|
|
62760
63031
|
if (migrateRegistryPaths(registry)) {
|
|
62761
63032
|
try {
|
|
62762
|
-
await
|
|
63033
|
+
await writeFile16(REGISTRY_PATH, JSON.stringify(registry, null, 2), "utf-8");
|
|
62763
63034
|
} catch {}
|
|
62764
63035
|
}
|
|
62765
63036
|
return registry;
|
|
@@ -62775,7 +63046,7 @@ async function writeRegistry2(registry) {
|
|
|
62775
63046
|
if (!existsSync40(dir)) {
|
|
62776
63047
|
await mkdir15(dir, { recursive: true });
|
|
62777
63048
|
}
|
|
62778
|
-
await
|
|
63049
|
+
await writeFile16(REGISTRY_PATH, JSON.stringify(registry, null, 2), "utf-8");
|
|
62779
63050
|
}
|
|
62780
63051
|
async function addInstallation(skill, agent, global3, path7, sourcePath) {
|
|
62781
63052
|
const registry = await readRegistry2();
|
|
@@ -62848,20 +63119,25 @@ var init_skills_registry = __esm(() => {
|
|
|
62848
63119
|
REGISTRY_PATH_MIGRATIONS = [
|
|
62849
63120
|
{
|
|
62850
63121
|
agent: "gemini-cli",
|
|
62851
|
-
|
|
62852
|
-
|
|
63122
|
+
oldPath: ".gemini/skills",
|
|
63123
|
+
newPath: ".agents/skills"
|
|
62853
63124
|
},
|
|
62854
63125
|
{
|
|
62855
|
-
agent: "
|
|
62856
|
-
|
|
62857
|
-
|
|
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"
|
|
62858
63134
|
}
|
|
62859
63135
|
];
|
|
62860
63136
|
});
|
|
62861
63137
|
|
|
62862
63138
|
// src/commands/skills/skills-installer.ts
|
|
62863
63139
|
import { existsSync as existsSync41 } from "node:fs";
|
|
62864
|
-
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";
|
|
62865
63141
|
import { homedir as homedir38 } from "node:os";
|
|
62866
63142
|
import { dirname as dirname27, join as join61, resolve as resolve30 } from "node:path";
|
|
62867
63143
|
function isSamePath2(path1, path22) {
|
|
@@ -62914,6 +63190,18 @@ async function cleanupLegacySkillPath(skillName, agent, global3) {
|
|
|
62914
63190
|
await writeRegistry2(registry);
|
|
62915
63191
|
}
|
|
62916
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
|
+
}
|
|
62917
63205
|
async function installSkillForAgent(skill, agent, options2) {
|
|
62918
63206
|
const agentConfig = agents[agent];
|
|
62919
63207
|
const targetPath = getInstallPath(skill.name, agent, options2);
|
|
@@ -62952,6 +63240,7 @@ async function installSkillForAgent(skill, agent, options2) {
|
|
|
62952
63240
|
recursive: true,
|
|
62953
63241
|
force: true
|
|
62954
63242
|
});
|
|
63243
|
+
await rewriteInstalledSkillMd2(targetPath, agent, options2);
|
|
62955
63244
|
await addInstallation(skill.name, agent, options2.global, targetPath, skill.path);
|
|
62956
63245
|
return {
|
|
62957
63246
|
agent,
|
|
@@ -62988,12 +63277,17 @@ function getInstallPreview(skill, targetAgents, options2) {
|
|
|
62988
63277
|
}
|
|
62989
63278
|
var LEGACY_SKILL_PATHS;
|
|
62990
63279
|
var init_skills_installer = __esm(() => {
|
|
63280
|
+
init_direct_copy();
|
|
62991
63281
|
init_agents();
|
|
62992
63282
|
init_skills_registry();
|
|
62993
63283
|
LEGACY_SKILL_PATHS = {
|
|
62994
63284
|
"gemini-cli": {
|
|
62995
63285
|
project: ".gemini/skills",
|
|
62996
63286
|
global: join61(homedir38(), ".gemini/skills")
|
|
63287
|
+
},
|
|
63288
|
+
antigravity: {
|
|
63289
|
+
project: ".agent/skills",
|
|
63290
|
+
global: join61(homedir38(), ".gemini/antigravity/skills")
|
|
62997
63291
|
}
|
|
62998
63292
|
};
|
|
62999
63293
|
});
|
|
@@ -63608,7 +63902,7 @@ var init_pnpm_detector = __esm(() => {
|
|
|
63608
63902
|
|
|
63609
63903
|
// src/domains/installation/package-managers/detection-core.ts
|
|
63610
63904
|
import { existsSync as existsSync43, realpathSync as realpathSync3 } from "node:fs";
|
|
63611
|
-
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";
|
|
63612
63906
|
import { platform as platform6 } from "node:os";
|
|
63613
63907
|
import { join as join63 } from "node:path";
|
|
63614
63908
|
function detectFromBinaryPath() {
|
|
@@ -63691,7 +63985,7 @@ async function readCachedPm() {
|
|
|
63691
63985
|
if (!existsSync43(cacheFile)) {
|
|
63692
63986
|
return null;
|
|
63693
63987
|
}
|
|
63694
|
-
const content = await
|
|
63988
|
+
const content = await readFile34(cacheFile, "utf-8");
|
|
63695
63989
|
const data = JSON.parse(content);
|
|
63696
63990
|
if (!data.packageManager || !data.detectedAt) {
|
|
63697
63991
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -63731,7 +64025,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
63731
64025
|
detectedAt: Date.now(),
|
|
63732
64026
|
version: version ?? undefined
|
|
63733
64027
|
};
|
|
63734
|
-
await
|
|
64028
|
+
await writeFile18(cacheFile, JSON.stringify(data, null, 2), "utf-8");
|
|
63735
64029
|
if (platform6() !== "win32") {
|
|
63736
64030
|
await chmod2(cacheFile, 384);
|
|
63737
64031
|
}
|
|
@@ -63942,7 +64236,7 @@ var package_default;
|
|
|
63942
64236
|
var init_package = __esm(() => {
|
|
63943
64237
|
package_default = {
|
|
63944
64238
|
name: "claudekit-cli",
|
|
63945
|
-
version: "4.
|
|
64239
|
+
version: "4.5.0",
|
|
63946
64240
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
63947
64241
|
type: "module",
|
|
63948
64242
|
repository: {
|
|
@@ -64444,7 +64738,7 @@ var init_package_manager_runner = __esm(() => {
|
|
|
64444
64738
|
// src/domains/installation/merger/zombie-wirings-pruner.ts
|
|
64445
64739
|
import { existsSync as existsSync44, readdirSync as readdirSync7 } from "node:fs";
|
|
64446
64740
|
import { homedir as homedir39 } from "node:os";
|
|
64447
|
-
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";
|
|
64448
64742
|
function pruneZombieEngineerWirings(settings, hookDir, preserveCommands = new Set) {
|
|
64449
64743
|
const pruned = [];
|
|
64450
64744
|
const normalizedPreserveCommands = new Set(Array.from(preserveCommands).map((command) => normalizeCommand(command)));
|
|
@@ -64543,7 +64837,7 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64543
64837
|
if (bashMatch) {
|
|
64544
64838
|
const rawPath = bashMatch[1].replace(/\\/g, "/");
|
|
64545
64839
|
const resolved = isAbsolute10(rawPath) || /^[A-Za-z]:[\\/]/.test(rawPath) ? rawPath : resolve32(hookDir, rawPath);
|
|
64546
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64840
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64547
64841
|
}
|
|
64548
64842
|
return null;
|
|
64549
64843
|
}
|
|
@@ -64553,7 +64847,7 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64553
64847
|
if (varOnlyQuoted) {
|
|
64554
64848
|
const [, envVar, rest] = varOnlyQuoted;
|
|
64555
64849
|
const resolved = resolveEnvPath(envVar, rest);
|
|
64556
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64850
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64557
64851
|
}
|
|
64558
64852
|
const quotedMatch = command.match(/(?:^|\s)node\s+["']([^"']+)["']/);
|
|
64559
64853
|
if (quotedMatch) {
|
|
@@ -64561,11 +64855,11 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64561
64855
|
const envPrefixMatch = rawArg.match(/^(\$HOME|\$\{HOME\}|%USERPROFILE%|\$CLAUDE_PROJECT_DIR|%CLAUDE_PROJECT_DIR%)[/\\](.*)/);
|
|
64562
64856
|
if (envPrefixMatch) {
|
|
64563
64857
|
const resolved = resolveEnvPath(envPrefixMatch[1], envPrefixMatch[2]);
|
|
64564
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64858
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64565
64859
|
}
|
|
64566
64860
|
const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
|
|
64567
64861
|
if (isAbsolute10(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
|
|
64568
|
-
return process.platform === "win32" ? tildeResolved.replace(/\//g,
|
|
64862
|
+
return process.platform === "win32" ? tildeResolved.replace(/\//g, sep10) : tildeResolved;
|
|
64569
64863
|
}
|
|
64570
64864
|
return resolve32(hookDir, tildeResolved);
|
|
64571
64865
|
}
|
|
@@ -64575,11 +64869,11 @@ function extractHookFilePath(command, hookDir) {
|
|
|
64575
64869
|
const envPrefixMatch = rawArg.match(/^(\$HOME|\$\{HOME\}|%USERPROFILE%|\$CLAUDE_PROJECT_DIR|%CLAUDE_PROJECT_DIR%)[/\\](.*)/);
|
|
64576
64870
|
if (envPrefixMatch) {
|
|
64577
64871
|
const resolved = resolveEnvPath(envPrefixMatch[1], envPrefixMatch[2]);
|
|
64578
|
-
return process.platform === "win32" ? resolved.replace(/\//g,
|
|
64872
|
+
return process.platform === "win32" ? resolved.replace(/\//g, sep10) : resolved;
|
|
64579
64873
|
}
|
|
64580
64874
|
const tildeResolved = rawArg.replace(/^~(?=\/)/, home5);
|
|
64581
64875
|
if (isAbsolute10(tildeResolved) || /^[A-Za-z]:[\\/]/.test(tildeResolved)) {
|
|
64582
|
-
return process.platform === "win32" ? tildeResolved.replace(/\//g,
|
|
64876
|
+
return process.platform === "win32" ? tildeResolved.replace(/\//g, sep10) : tildeResolved;
|
|
64583
64877
|
}
|
|
64584
64878
|
return resolve32(hookDir, tildeResolved);
|
|
64585
64879
|
}
|
|
@@ -66312,6 +66606,76 @@ var init_claudekit_scanner = __esm(() => {
|
|
|
66312
66606
|
import_fs_extra7 = __toESM(require_lib(), 1);
|
|
66313
66607
|
});
|
|
66314
66608
|
|
|
66609
|
+
// src/ui/node_modules/picocolors/picocolors.js
|
|
66610
|
+
var require_picocolors2 = __commonJS((exports, module) => {
|
|
66611
|
+
var p = process || {};
|
|
66612
|
+
var argv = p.argv || [];
|
|
66613
|
+
var env2 = p.env || {};
|
|
66614
|
+
var isColorSupported = !(!!env2.NO_COLOR || argv.includes("--no-color")) && (!!env2.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env2.TERM !== "dumb" || !!env2.CI);
|
|
66615
|
+
var formatter = (open5, close, replace = open5) => (input) => {
|
|
66616
|
+
let string = "" + input, index = string.indexOf(close, open5.length);
|
|
66617
|
+
return ~index ? open5 + replaceClose(string, close, replace, index) + close : open5 + string + close;
|
|
66618
|
+
};
|
|
66619
|
+
var replaceClose = (string, close, replace, index) => {
|
|
66620
|
+
let result = "", cursor = 0;
|
|
66621
|
+
do {
|
|
66622
|
+
result += string.substring(cursor, index) + replace;
|
|
66623
|
+
cursor = index + close.length;
|
|
66624
|
+
index = string.indexOf(close, cursor);
|
|
66625
|
+
} while (~index);
|
|
66626
|
+
return result + string.substring(cursor);
|
|
66627
|
+
};
|
|
66628
|
+
var createColors = (enabled = isColorSupported) => {
|
|
66629
|
+
let f3 = enabled ? formatter : () => String;
|
|
66630
|
+
return {
|
|
66631
|
+
isColorSupported: enabled,
|
|
66632
|
+
reset: f3("\x1B[0m", "\x1B[0m"),
|
|
66633
|
+
bold: f3("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
66634
|
+
dim: f3("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
66635
|
+
italic: f3("\x1B[3m", "\x1B[23m"),
|
|
66636
|
+
underline: f3("\x1B[4m", "\x1B[24m"),
|
|
66637
|
+
inverse: f3("\x1B[7m", "\x1B[27m"),
|
|
66638
|
+
hidden: f3("\x1B[8m", "\x1B[28m"),
|
|
66639
|
+
strikethrough: f3("\x1B[9m", "\x1B[29m"),
|
|
66640
|
+
black: f3("\x1B[30m", "\x1B[39m"),
|
|
66641
|
+
red: f3("\x1B[31m", "\x1B[39m"),
|
|
66642
|
+
green: f3("\x1B[32m", "\x1B[39m"),
|
|
66643
|
+
yellow: f3("\x1B[33m", "\x1B[39m"),
|
|
66644
|
+
blue: f3("\x1B[34m", "\x1B[39m"),
|
|
66645
|
+
magenta: f3("\x1B[35m", "\x1B[39m"),
|
|
66646
|
+
cyan: f3("\x1B[36m", "\x1B[39m"),
|
|
66647
|
+
white: f3("\x1B[37m", "\x1B[39m"),
|
|
66648
|
+
gray: f3("\x1B[90m", "\x1B[39m"),
|
|
66649
|
+
bgBlack: f3("\x1B[40m", "\x1B[49m"),
|
|
66650
|
+
bgRed: f3("\x1B[41m", "\x1B[49m"),
|
|
66651
|
+
bgGreen: f3("\x1B[42m", "\x1B[49m"),
|
|
66652
|
+
bgYellow: f3("\x1B[43m", "\x1B[49m"),
|
|
66653
|
+
bgBlue: f3("\x1B[44m", "\x1B[49m"),
|
|
66654
|
+
bgMagenta: f3("\x1B[45m", "\x1B[49m"),
|
|
66655
|
+
bgCyan: f3("\x1B[46m", "\x1B[49m"),
|
|
66656
|
+
bgWhite: f3("\x1B[47m", "\x1B[49m"),
|
|
66657
|
+
blackBright: f3("\x1B[90m", "\x1B[39m"),
|
|
66658
|
+
redBright: f3("\x1B[91m", "\x1B[39m"),
|
|
66659
|
+
greenBright: f3("\x1B[92m", "\x1B[39m"),
|
|
66660
|
+
yellowBright: f3("\x1B[93m", "\x1B[39m"),
|
|
66661
|
+
blueBright: f3("\x1B[94m", "\x1B[39m"),
|
|
66662
|
+
magentaBright: f3("\x1B[95m", "\x1B[39m"),
|
|
66663
|
+
cyanBright: f3("\x1B[96m", "\x1B[39m"),
|
|
66664
|
+
whiteBright: f3("\x1B[97m", "\x1B[39m"),
|
|
66665
|
+
bgBlackBright: f3("\x1B[100m", "\x1B[49m"),
|
|
66666
|
+
bgRedBright: f3("\x1B[101m", "\x1B[49m"),
|
|
66667
|
+
bgGreenBright: f3("\x1B[102m", "\x1B[49m"),
|
|
66668
|
+
bgYellowBright: f3("\x1B[103m", "\x1B[49m"),
|
|
66669
|
+
bgBlueBright: f3("\x1B[104m", "\x1B[49m"),
|
|
66670
|
+
bgMagentaBright: f3("\x1B[105m", "\x1B[49m"),
|
|
66671
|
+
bgCyanBright: f3("\x1B[106m", "\x1B[49m"),
|
|
66672
|
+
bgWhiteBright: f3("\x1B[107m", "\x1B[49m")
|
|
66673
|
+
};
|
|
66674
|
+
};
|
|
66675
|
+
module.exports = createColors();
|
|
66676
|
+
module.exports.createColors = createColors;
|
|
66677
|
+
});
|
|
66678
|
+
|
|
66315
66679
|
// src/ui/ck-cli-design/tokens.ts
|
|
66316
66680
|
import { homedir as homedir41, platform as platform7 } from "node:os";
|
|
66317
66681
|
import { resolve as resolve34, win32 } from "node:path";
|
|
@@ -66488,7 +66852,7 @@ function paint(value, tone, context) {
|
|
|
66488
66852
|
}
|
|
66489
66853
|
var import_picocolors14, PANEL_MIN_WIDTH = 60, PANEL_MAX_WIDTH = 72, DEFAULT_WIDTH, UNICODE_BOX, ASCII_BOX;
|
|
66490
66854
|
var init_tokens = __esm(() => {
|
|
66491
|
-
import_picocolors14 = __toESM(
|
|
66855
|
+
import_picocolors14 = __toESM(require_picocolors2(), 1);
|
|
66492
66856
|
DEFAULT_WIDTH = PANEL_MAX_WIDTH;
|
|
66493
66857
|
UNICODE_BOX = {
|
|
66494
66858
|
tl: "╔",
|
|
@@ -67069,7 +67433,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
67069
67433
|
|
|
67070
67434
|
// src/domains/versioning/release-cache.ts
|
|
67071
67435
|
import { existsSync as existsSync46 } from "node:fs";
|
|
67072
|
-
import { mkdir as mkdir18, readFile as
|
|
67436
|
+
import { mkdir as mkdir18, readFile as readFile37, unlink as unlink8, writeFile as writeFile20 } from "node:fs/promises";
|
|
67073
67437
|
import { join as join67 } from "node:path";
|
|
67074
67438
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
67075
67439
|
var init_release_cache = __esm(() => {
|
|
@@ -67094,7 +67458,7 @@ var init_release_cache = __esm(() => {
|
|
|
67094
67458
|
logger.debug(`Release cache not found for key: ${key}`);
|
|
67095
67459
|
return null;
|
|
67096
67460
|
}
|
|
67097
|
-
const content = await
|
|
67461
|
+
const content = await readFile37(cacheFile, "utf-8");
|
|
67098
67462
|
const parsed = JSON.parse(content);
|
|
67099
67463
|
const cacheEntry = ReleaseCacheEntrySchema.parse(parsed);
|
|
67100
67464
|
if (this.isExpired(cacheEntry.timestamp)) {
|
|
@@ -67120,7 +67484,7 @@ var init_release_cache = __esm(() => {
|
|
|
67120
67484
|
timestamp: Date.now(),
|
|
67121
67485
|
releases
|
|
67122
67486
|
};
|
|
67123
|
-
await
|
|
67487
|
+
await writeFile20(cacheFile, JSON.stringify(cacheEntry, null, 2), "utf-8");
|
|
67124
67488
|
logger.debug(`Release cache set for key: ${key}, cached ${releases.length} releases`);
|
|
67125
67489
|
} catch (error) {
|
|
67126
67490
|
logger.debug(`Failed to set release cache for key ${key}: ${error}`);
|
|
@@ -68496,7 +68860,7 @@ var init_update_cli = __esm(() => {
|
|
|
68496
68860
|
});
|
|
68497
68861
|
|
|
68498
68862
|
// src/domains/sync/config-version-checker.ts
|
|
68499
|
-
import { mkdir as mkdir19, readFile as
|
|
68863
|
+
import { mkdir as mkdir19, readFile as readFile39, unlink as unlink9, writeFile as writeFile21 } from "node:fs/promises";
|
|
68500
68864
|
import { join as join69 } from "node:path";
|
|
68501
68865
|
function parseCacheTtl() {
|
|
68502
68866
|
const envValue = process.env.CK_SYNC_CACHE_TTL;
|
|
@@ -68581,7 +68945,7 @@ class ConfigVersionChecker {
|
|
|
68581
68945
|
}
|
|
68582
68946
|
for (const cachePath of cachePaths) {
|
|
68583
68947
|
try {
|
|
68584
|
-
const data = await
|
|
68948
|
+
const data = await readFile39(cachePath, "utf8");
|
|
68585
68949
|
const parsed = JSON.parse(data);
|
|
68586
68950
|
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) {
|
|
68587
68951
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -68599,7 +68963,7 @@ class ConfigVersionChecker {
|
|
|
68599
68963
|
const cachePath = ConfigVersionChecker.getCacheFilePath(kitType, global3, channel);
|
|
68600
68964
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
68601
68965
|
await mkdir19(cacheDir, { recursive: true });
|
|
68602
|
-
await
|
|
68966
|
+
await writeFile21(cachePath, JSON.stringify(cache3, null, 2));
|
|
68603
68967
|
} catch (error) {
|
|
68604
68968
|
logger.debug(`Cache write failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
68605
68969
|
}
|
|
@@ -68761,7 +69125,7 @@ var init_config_version_checker = __esm(() => {
|
|
|
68761
69125
|
import { spawn as spawn3 } from "node:child_process";
|
|
68762
69126
|
import { execFile as execFile8 } from "node:child_process";
|
|
68763
69127
|
import { existsSync as existsSync48 } from "node:fs";
|
|
68764
|
-
import { readFile as
|
|
69128
|
+
import { readFile as readFile40 } from "node:fs/promises";
|
|
68765
69129
|
import { cpus, homedir as homedir42, totalmem } from "node:os";
|
|
68766
69130
|
import { join as join70 } from "node:path";
|
|
68767
69131
|
function runCommand(cmd, args, fallback2) {
|
|
@@ -69052,7 +69416,7 @@ async function getKitMetadata2(kitName) {
|
|
|
69052
69416
|
const metadataPath = join70(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
69053
69417
|
if (!existsSync48(metadataPath))
|
|
69054
69418
|
return null;
|
|
69055
|
-
const content = await
|
|
69419
|
+
const content = await readFile40(metadataPath, "utf-8");
|
|
69056
69420
|
const metadata = JSON.parse(content);
|
|
69057
69421
|
if (typeof metadata.kits?.[kitName]?.version === "string" && metadata.kits[kitName].version.trim()) {
|
|
69058
69422
|
return { version: metadata.kits[kitName].version };
|
|
@@ -74590,8 +74954,8 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74590
74954
|
logger.info(` Platform: ${platform10 === "win32" ? "Windows (PowerShell)" : "Unix (bash)"}`);
|
|
74591
74955
|
if (logger.isVerbose()) {
|
|
74592
74956
|
try {
|
|
74593
|
-
const { readFile:
|
|
74594
|
-
const scriptContent = await
|
|
74957
|
+
const { readFile: readFile49 } = await import("node:fs/promises");
|
|
74958
|
+
const scriptContent = await readFile49(scriptPath, "utf-8");
|
|
74595
74959
|
const previewLines = scriptContent.split(`
|
|
74596
74960
|
`).slice(0, 20);
|
|
74597
74961
|
logger.verbose("Script preview (first 20 lines):");
|
|
@@ -74787,11 +75151,11 @@ var init_skills_installer2 = __esm(() => {
|
|
|
74787
75151
|
|
|
74788
75152
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
74789
75153
|
import { existsSync as existsSync62 } from "node:fs";
|
|
74790
|
-
import { mkdir as mkdir23, readFile as
|
|
75154
|
+
import { mkdir as mkdir23, readFile as readFile49, writeFile as writeFile25 } from "node:fs/promises";
|
|
74791
75155
|
import { dirname as dirname33, join as join92 } from "node:path";
|
|
74792
75156
|
async function readJsonFile(filePath) {
|
|
74793
75157
|
try {
|
|
74794
|
-
const content = await
|
|
75158
|
+
const content = await readFile49(filePath, "utf-8");
|
|
74795
75159
|
return JSON.parse(content);
|
|
74796
75160
|
} catch (error) {
|
|
74797
75161
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -74805,7 +75169,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
74805
75169
|
try {
|
|
74806
75170
|
let content = "";
|
|
74807
75171
|
if (existsSync62(gitignorePath)) {
|
|
74808
|
-
content = await
|
|
75172
|
+
content = await readFile49(gitignorePath, "utf-8");
|
|
74809
75173
|
const lines = content.split(`
|
|
74810
75174
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
74811
75175
|
const geminiPatterns = [".gemini/", ".gemini", "/.gemini/", "/.gemini"];
|
|
@@ -74818,7 +75182,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
74818
75182
|
`) || content === "" ? "" : `
|
|
74819
75183
|
`;
|
|
74820
75184
|
const comment = "# Gemini CLI settings (contains user-specific config)";
|
|
74821
|
-
await
|
|
75185
|
+
await writeFile25(gitignorePath, `${content}${newLine}${comment}
|
|
74822
75186
|
${geminiPattern}
|
|
74823
75187
|
`, "utf-8");
|
|
74824
75188
|
logger.debug(`Added ${geminiPattern} to .gitignore`);
|
|
@@ -74843,7 +75207,7 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
74843
75207
|
}
|
|
74844
75208
|
const newSettings = { mcpServers };
|
|
74845
75209
|
try {
|
|
74846
|
-
await
|
|
75210
|
+
await writeFile25(geminiSettingsPath, JSON.stringify(newSettings, null, 2), "utf-8");
|
|
74847
75211
|
logger.debug(`Created new Gemini settings with mcpServers: ${geminiSettingsPath}`);
|
|
74848
75212
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
74849
75213
|
} catch (error) {
|
|
@@ -74873,7 +75237,7 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
74873
75237
|
mcpServers
|
|
74874
75238
|
};
|
|
74875
75239
|
try {
|
|
74876
|
-
await
|
|
75240
|
+
await writeFile25(geminiSettingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
74877
75241
|
logger.debug(`Merged mcpServers into: ${geminiSettingsPath}`);
|
|
74878
75242
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
74879
75243
|
} catch (error) {
|
|
@@ -77343,7 +77707,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
|
|
|
77343
77707
|
}
|
|
77344
77708
|
}
|
|
77345
77709
|
function spawnAndCollect(command, args, cwd2) {
|
|
77346
|
-
return new Promise((
|
|
77710
|
+
return new Promise((resolve57, reject) => {
|
|
77347
77711
|
const child = spawn5(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
|
|
77348
77712
|
const chunks = [];
|
|
77349
77713
|
const stderrChunks = [];
|
|
@@ -77356,7 +77720,7 @@ function spawnAndCollect(command, args, cwd2) {
|
|
|
77356
77720
|
reject(new Error(`${command} ${args[0] ?? ""} exited with code ${code2}: ${stderr}`));
|
|
77357
77721
|
return;
|
|
77358
77722
|
}
|
|
77359
|
-
|
|
77723
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
77360
77724
|
});
|
|
77361
77725
|
});
|
|
77362
77726
|
}
|
|
@@ -77374,7 +77738,7 @@ __export(exports_worktree_manager, {
|
|
|
77374
77738
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
77375
77739
|
});
|
|
77376
77740
|
import { existsSync as existsSync73 } from "node:fs";
|
|
77377
|
-
import { readFile as
|
|
77741
|
+
import { readFile as readFile69, writeFile as writeFile40 } from "node:fs/promises";
|
|
77378
77742
|
import { join as join154 } from "node:path";
|
|
77379
77743
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
77380
77744
|
const worktreePath = join154(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
@@ -77439,14 +77803,14 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
77439
77803
|
async function ensureGitignore(projectDir) {
|
|
77440
77804
|
const gitignorePath = join154(projectDir, ".gitignore");
|
|
77441
77805
|
try {
|
|
77442
|
-
const content = existsSync73(gitignorePath) ? await
|
|
77806
|
+
const content = existsSync73(gitignorePath) ? await readFile69(gitignorePath, "utf-8") : "";
|
|
77443
77807
|
if (!content.includes(".worktrees")) {
|
|
77444
77808
|
const newContent = content.endsWith(`
|
|
77445
77809
|
`) ? `${content}.worktrees/
|
|
77446
77810
|
` : `${content}
|
|
77447
77811
|
.worktrees/
|
|
77448
77812
|
`;
|
|
77449
|
-
await
|
|
77813
|
+
await writeFile40(gitignorePath, newContent, "utf-8");
|
|
77450
77814
|
logger.info("[worktree] Added .worktrees/ to .gitignore");
|
|
77451
77815
|
}
|
|
77452
77816
|
} catch (err) {
|
|
@@ -77542,7 +77906,7 @@ var init_content_validator = __esm(() => {
|
|
|
77542
77906
|
// src/commands/content/phases/context-cache-manager.ts
|
|
77543
77907
|
import { createHash as createHash9 } from "node:crypto";
|
|
77544
77908
|
import { existsSync as existsSync79, mkdirSync as mkdirSync5, readFileSync as readFileSync19, readdirSync as readdirSync13, statSync as statSync14 } from "node:fs";
|
|
77545
|
-
import { rename as rename16, writeFile as
|
|
77909
|
+
import { rename as rename16, writeFile as writeFile42 } from "node:fs/promises";
|
|
77546
77910
|
import { homedir as homedir54 } from "node:os";
|
|
77547
77911
|
import { basename as basename34, join as join161 } from "node:path";
|
|
77548
77912
|
function getCachedContext(repoPath) {
|
|
@@ -77569,7 +77933,7 @@ async function saveCachedContext(repoPath, cache5) {
|
|
|
77569
77933
|
}
|
|
77570
77934
|
const cachePath = getCacheFilePath(repoPath);
|
|
77571
77935
|
const tmpPath = `${cachePath}.tmp`;
|
|
77572
|
-
await
|
|
77936
|
+
await writeFile42(tmpPath, JSON.stringify(cache5, null, 2), "utf-8");
|
|
77573
77937
|
await rename16(tmpPath, cachePath);
|
|
77574
77938
|
}
|
|
77575
77939
|
function computeSourceHash(repoPath) {
|
|
@@ -79406,12 +79770,12 @@ var init_types6 = __esm(() => {
|
|
|
79406
79770
|
});
|
|
79407
79771
|
|
|
79408
79772
|
// src/commands/content/phases/state-manager.ts
|
|
79409
|
-
import { readFile as
|
|
79773
|
+
import { readFile as readFile71, rename as rename17, writeFile as writeFile43 } from "node:fs/promises";
|
|
79410
79774
|
import { join as join167 } from "node:path";
|
|
79411
79775
|
async function loadContentConfig(projectDir) {
|
|
79412
79776
|
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79413
79777
|
try {
|
|
79414
|
-
const raw2 = await
|
|
79778
|
+
const raw2 = await readFile71(configPath, "utf-8");
|
|
79415
79779
|
const json = JSON.parse(raw2);
|
|
79416
79780
|
return ContentConfigSchema.parse(json.content ?? {});
|
|
79417
79781
|
} catch {
|
|
@@ -79427,7 +79791,7 @@ async function saveContentConfig(projectDir, config) {
|
|
|
79427
79791
|
async function loadContentState(projectDir) {
|
|
79428
79792
|
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79429
79793
|
try {
|
|
79430
|
-
const raw2 = await
|
|
79794
|
+
const raw2 = await readFile71(configPath, "utf-8");
|
|
79431
79795
|
const json = JSON.parse(raw2);
|
|
79432
79796
|
const contentBlock = json.content ?? {};
|
|
79433
79797
|
return ContentStateSchema.parse(contentBlock.state ?? {});
|
|
@@ -79454,7 +79818,7 @@ async function saveContentState(projectDir, state) {
|
|
|
79454
79818
|
}
|
|
79455
79819
|
async function readJsonSafe(filePath) {
|
|
79456
79820
|
try {
|
|
79457
|
-
const raw2 = await
|
|
79821
|
+
const raw2 = await readFile71(filePath, "utf-8");
|
|
79458
79822
|
return JSON.parse(raw2);
|
|
79459
79823
|
} catch {
|
|
79460
79824
|
return {};
|
|
@@ -79462,7 +79826,7 @@ async function readJsonSafe(filePath) {
|
|
|
79462
79826
|
}
|
|
79463
79827
|
async function atomicWrite3(filePath, data) {
|
|
79464
79828
|
const tmpPath = `${filePath}.tmp`;
|
|
79465
|
-
await
|
|
79829
|
+
await writeFile43(tmpPath, JSON.stringify(data, null, 2), "utf-8");
|
|
79466
79830
|
await rename17(tmpPath, filePath);
|
|
79467
79831
|
}
|
|
79468
79832
|
var CK_CONFIG_FILE2 = ".ck.json";
|
|
@@ -80203,8 +80567,8 @@ function shouldRunCleanup(lastAt) {
|
|
|
80203
80567
|
return Date.now() - new Date(lastAt).getTime() >= 86400000;
|
|
80204
80568
|
}
|
|
80205
80569
|
function sleep2(ms) {
|
|
80206
|
-
return new Promise((
|
|
80207
|
-
setTimeout(
|
|
80570
|
+
return new Promise((resolve57) => {
|
|
80571
|
+
setTimeout(resolve57, ms);
|
|
80208
80572
|
});
|
|
80209
80573
|
}
|
|
80210
80574
|
var LOCK_DIR2, LOCK_FILE, MAX_CREATION_RETRIES = 3, MAX_PUBLISH_RETRIES_PER_CYCLE = 3, PUBLISH_RETRY_WINDOW_HOURS = 24;
|
|
@@ -81534,7 +81898,9 @@ var init_migrate_command_help = __esm(() => {
|
|
|
81534
81898
|
" Default mode is smart-detected: no/stale registry → install, valid registry → reconcile",
|
|
81535
81899
|
" --respect-deletions disables the auto-reinstall heuristic for empty directories",
|
|
81536
81900
|
" --force overrides skip decisions per item; --reinstall-empty-dirs is a per-directory heuristic",
|
|
81537
|
-
" Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills"
|
|
81901
|
+
" Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills",
|
|
81902
|
+
" Antigravity 2.0 agents migrate to .agents/agents.md; skills remain .agents/skills/<name>/SKILL.md",
|
|
81903
|
+
" Kiro agents migrate as custom subagents; rules/config migrate as steering files; skills copy to .kiro/skills; commands/hooks are skipped"
|
|
81538
81904
|
].join(`
|
|
81539
81905
|
`)
|
|
81540
81906
|
}
|
|
@@ -82007,7 +82373,7 @@ var init_skills_command_help = __esm(() => {
|
|
|
82007
82373
|
},
|
|
82008
82374
|
{
|
|
82009
82375
|
flags: "-a, --agent <agent>",
|
|
82010
|
-
description: "Target agent(s) - can be specified multiple times. Valid: claude-code, cursor, codex, opencode, goose, gemini-cli, antigravity, github-copilot, amp, kilo, roo, windsurf, cline, openhands"
|
|
82376
|
+
description: "Target agent(s) - can be specified multiple times. Valid: claude-code, cursor, codex, opencode, goose, gemini-cli, antigravity, github-copilot, amp, kilo, kiro, roo, windsurf, cline, openhands"
|
|
82011
82377
|
},
|
|
82012
82378
|
{
|
|
82013
82379
|
flags: "-g, --global",
|
|
@@ -82075,6 +82441,7 @@ var init_skills_command_help = __esm(() => {
|
|
|
82075
82441
|
github-copilot GitHub Copilot
|
|
82076
82442
|
amp Amp
|
|
82077
82443
|
kilo Kilo Code
|
|
82444
|
+
kiro Kiro
|
|
82078
82445
|
roo Roo Code
|
|
82079
82446
|
windsurf Windsurf IDE
|
|
82080
82447
|
cline Cline
|
|
@@ -82455,7 +82822,7 @@ function getPagerArgs(pagerCmd) {
|
|
|
82455
82822
|
return [];
|
|
82456
82823
|
}
|
|
82457
82824
|
async function trySystemPager(content) {
|
|
82458
|
-
return new Promise((
|
|
82825
|
+
return new Promise((resolve57) => {
|
|
82459
82826
|
const pagerCmd = process.env.PAGER || "less";
|
|
82460
82827
|
const pagerArgs = getPagerArgs(pagerCmd);
|
|
82461
82828
|
try {
|
|
@@ -82465,20 +82832,20 @@ async function trySystemPager(content) {
|
|
|
82465
82832
|
});
|
|
82466
82833
|
const timeout2 = setTimeout(() => {
|
|
82467
82834
|
pager.kill();
|
|
82468
|
-
|
|
82835
|
+
resolve57(false);
|
|
82469
82836
|
}, 30000);
|
|
82470
82837
|
pager.stdin.write(content);
|
|
82471
82838
|
pager.stdin.end();
|
|
82472
82839
|
pager.on("close", (code2) => {
|
|
82473
82840
|
clearTimeout(timeout2);
|
|
82474
|
-
|
|
82841
|
+
resolve57(code2 === 0);
|
|
82475
82842
|
});
|
|
82476
82843
|
pager.on("error", () => {
|
|
82477
82844
|
clearTimeout(timeout2);
|
|
82478
|
-
|
|
82845
|
+
resolve57(false);
|
|
82479
82846
|
});
|
|
82480
82847
|
} catch {
|
|
82481
|
-
|
|
82848
|
+
resolve57(false);
|
|
82482
82849
|
}
|
|
82483
82850
|
});
|
|
82484
82851
|
}
|
|
@@ -82505,16 +82872,16 @@ async function basicPager(content) {
|
|
|
82505
82872
|
break;
|
|
82506
82873
|
}
|
|
82507
82874
|
const remaining = lines.length - currentLine;
|
|
82508
|
-
await new Promise((
|
|
82875
|
+
await new Promise((resolve57) => {
|
|
82509
82876
|
rl.question(`-- More (${remaining} lines) [Enter/q] --`, (answer) => {
|
|
82510
82877
|
if (answer.toLowerCase() === "q") {
|
|
82511
82878
|
rl.close();
|
|
82512
82879
|
process.exitCode = 0;
|
|
82513
|
-
|
|
82880
|
+
resolve57();
|
|
82514
82881
|
return;
|
|
82515
82882
|
}
|
|
82516
82883
|
process.stdout.write("\x1B[1A\x1B[2K");
|
|
82517
|
-
|
|
82884
|
+
resolve57();
|
|
82518
82885
|
});
|
|
82519
82886
|
});
|
|
82520
82887
|
}
|
|
@@ -87316,7 +87683,7 @@ class CheckRunner {
|
|
|
87316
87683
|
});
|
|
87317
87684
|
}
|
|
87318
87685
|
async executeCheckersInParallel(checkers) {
|
|
87319
|
-
const
|
|
87686
|
+
const runChecker = async (checker) => {
|
|
87320
87687
|
logger.verbose(`Starting checker: ${checker.group}`);
|
|
87321
87688
|
const startTime = Date.now();
|
|
87322
87689
|
const results = await checker.run();
|
|
@@ -87330,8 +87697,19 @@ class CheckRunner {
|
|
|
87330
87697
|
duration: totalDuration
|
|
87331
87698
|
});
|
|
87332
87699
|
return results;
|
|
87333
|
-
}
|
|
87334
|
-
|
|
87700
|
+
};
|
|
87701
|
+
const indexedCheckers = checkers.map((checker, index) => ({ checker, index }));
|
|
87702
|
+
const networkCheckers = indexedCheckers.filter(({ checker }) => checker.group === "network");
|
|
87703
|
+
const otherCheckers = indexedCheckers.filter(({ checker }) => checker.group !== "network");
|
|
87704
|
+
const networkResults = networkCheckers.length ? await Promise.all(networkCheckers.map(async ({ checker, index }) => ({
|
|
87705
|
+
index,
|
|
87706
|
+
results: await runChecker(checker)
|
|
87707
|
+
}))) : [];
|
|
87708
|
+
const otherResults = await Promise.all(otherCheckers.map(async ({ checker, index }) => ({
|
|
87709
|
+
index,
|
|
87710
|
+
results: await runChecker(checker)
|
|
87711
|
+
})));
|
|
87712
|
+
return [...networkResults, ...otherResults].sort((a3, b3) => a3.index - b3.index).flatMap(({ results }) => results);
|
|
87335
87713
|
}
|
|
87336
87714
|
buildSummary(checks) {
|
|
87337
87715
|
let passed = 0;
|
|
@@ -88346,7 +88724,7 @@ import { join as join76, resolve as resolve36 } from "node:path";
|
|
|
88346
88724
|
// src/domains/health-checks/checkers/skill-budget-scanner.ts
|
|
88347
88725
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
88348
88726
|
import { existsSync as existsSync54 } from "node:fs";
|
|
88349
|
-
import { readFile as
|
|
88727
|
+
import { readFile as readFile41, readdir as readdir20 } from "node:fs/promises";
|
|
88350
88728
|
import { basename as basename25, join as join75, relative as relative16 } from "node:path";
|
|
88351
88729
|
var SKIP_DIRS5 = new Set([".git", ".venv", "__pycache__", "node_modules", "scripts", "common"]);
|
|
88352
88730
|
async function scanSkills2(skillsDir2) {
|
|
@@ -88357,7 +88735,7 @@ async function scanSkills2(skillsDir2) {
|
|
|
88357
88735
|
for (const dir of skillDirs) {
|
|
88358
88736
|
const file = join75(dir, "SKILL.md");
|
|
88359
88737
|
try {
|
|
88360
|
-
const content = await
|
|
88738
|
+
const content = await readFile41(file, "utf8");
|
|
88361
88739
|
const { data } = import_gray_matter11.default(content, { engines: { javascript: { parse: () => ({}) } } });
|
|
88362
88740
|
const rawName = typeof data.name === "string" ? data.name : "";
|
|
88363
88741
|
const fallbackId = relative16(skillsDir2, dir).replace(/\\/g, "/") || basename25(dir);
|
|
@@ -88401,7 +88779,7 @@ function normalizeSkillId(rawName, fallbackId) {
|
|
|
88401
88779
|
// src/domains/health-checks/checkers/skill-budget-settings.ts
|
|
88402
88780
|
init_settings_merger();
|
|
88403
88781
|
import { existsSync as existsSync55 } from "node:fs";
|
|
88404
|
-
import { mkdir as mkdir20, readFile as
|
|
88782
|
+
import { mkdir as mkdir20, readFile as readFile42 } from "node:fs/promises";
|
|
88405
88783
|
var CONTEXT_FLOOR_TOKENS = 200000;
|
|
88406
88784
|
var CHARS_PER_TOKEN = 4;
|
|
88407
88785
|
var DEFAULT_BUDGET_FRACTION = 0.03;
|
|
@@ -88412,7 +88790,7 @@ async function readProjectSettings(settingsPath) {
|
|
|
88412
88790
|
if (!existsSync55(settingsPath))
|
|
88413
88791
|
return { exists: false, settings: null };
|
|
88414
88792
|
try {
|
|
88415
|
-
const parsed = JSON.parse(await
|
|
88793
|
+
const parsed = JSON.parse(await readFile42(settingsPath, "utf8"));
|
|
88416
88794
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
88417
88795
|
return { exists: true, settings: null, error: "settings.json must contain a JSON object" };
|
|
88418
88796
|
}
|
|
@@ -88626,7 +89004,7 @@ function warn(id, name, message, skills, suggestion) {
|
|
|
88626
89004
|
init_logger();
|
|
88627
89005
|
init_path_resolver();
|
|
88628
89006
|
init_shared2();
|
|
88629
|
-
import { constants as constants2, access as access3, unlink as unlink10, writeFile as
|
|
89007
|
+
import { constants as constants2, access as access3, unlink as unlink10, writeFile as writeFile22 } from "node:fs/promises";
|
|
88630
89008
|
import { join as join77 } from "node:path";
|
|
88631
89009
|
async function checkGlobalDirReadable() {
|
|
88632
89010
|
const globalDir = PathResolver.getGlobalKitDir();
|
|
@@ -88686,7 +89064,7 @@ async function checkGlobalDirWritable() {
|
|
|
88686
89064
|
const random = Math.random().toString(36).substring(2);
|
|
88687
89065
|
const testFile = join77(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
88688
89066
|
try {
|
|
88689
|
-
await
|
|
89067
|
+
await writeFile22(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
88690
89068
|
} catch (error) {
|
|
88691
89069
|
return {
|
|
88692
89070
|
id: "ck-global-dir-writable",
|
|
@@ -88784,7 +89162,7 @@ async function checkHooksExist(projectDir) {
|
|
|
88784
89162
|
init_logger();
|
|
88785
89163
|
init_path_resolver();
|
|
88786
89164
|
import { existsSync as existsSync57 } from "node:fs";
|
|
88787
|
-
import { readFile as
|
|
89165
|
+
import { readFile as readFile43 } from "node:fs/promises";
|
|
88788
89166
|
import { join as join79 } from "node:path";
|
|
88789
89167
|
async function checkSettingsValid(projectDir) {
|
|
88790
89168
|
const globalSettings = join79(PathResolver.getGlobalKitDir(), "settings.json");
|
|
@@ -88802,7 +89180,7 @@ async function checkSettingsValid(projectDir) {
|
|
|
88802
89180
|
};
|
|
88803
89181
|
}
|
|
88804
89182
|
try {
|
|
88805
|
-
const content = await
|
|
89183
|
+
const content = await readFile43(settingsPath, "utf-8");
|
|
88806
89184
|
JSON.parse(content);
|
|
88807
89185
|
return {
|
|
88808
89186
|
id: "ck-settings-valid",
|
|
@@ -88859,7 +89237,7 @@ async function checkSettingsValid(projectDir) {
|
|
|
88859
89237
|
init_logger();
|
|
88860
89238
|
init_path_resolver();
|
|
88861
89239
|
import { existsSync as existsSync58 } from "node:fs";
|
|
88862
|
-
import { readFile as
|
|
89240
|
+
import { readFile as readFile44 } from "node:fs/promises";
|
|
88863
89241
|
import { homedir as homedir43 } from "node:os";
|
|
88864
89242
|
import { dirname as dirname31, join as join80, normalize as normalize6, resolve as resolve37 } from "node:path";
|
|
88865
89243
|
async function checkPathRefsValid(projectDir) {
|
|
@@ -88878,7 +89256,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
88878
89256
|
};
|
|
88879
89257
|
}
|
|
88880
89258
|
try {
|
|
88881
|
-
const content = await
|
|
89259
|
+
const content = await readFile44(claudeMdPath, "utf-8");
|
|
88882
89260
|
const refPattern = /@([^\s\)]+)/g;
|
|
88883
89261
|
const refs = [...content.matchAll(refPattern)].map((m2) => m2[1]);
|
|
88884
89262
|
if (refs.length === 0) {
|
|
@@ -89896,7 +90274,7 @@ import { platform as platform9 } from "node:os";
|
|
|
89896
90274
|
// src/domains/health-checks/platform/environment-checker.ts
|
|
89897
90275
|
init_environment();
|
|
89898
90276
|
init_path_resolver();
|
|
89899
|
-
import { constants as constants3, access as access4, mkdir as mkdir21, readFile as
|
|
90277
|
+
import { constants as constants3, access as access4, mkdir as mkdir21, readFile as readFile46, unlink as unlink11, writeFile as writeFile23 } from "node:fs/promises";
|
|
89900
90278
|
import { arch as arch2, homedir as homedir44, platform as platform8 } from "node:os";
|
|
89901
90279
|
import { join as join85, normalize as normalize7 } from "node:path";
|
|
89902
90280
|
function shouldSkipExpensiveOperations4() {
|
|
@@ -89992,8 +90370,8 @@ async function checkGlobalDirAccess() {
|
|
|
89992
90370
|
const testFile = join85(globalDir, ".ck-doctor-access-test");
|
|
89993
90371
|
try {
|
|
89994
90372
|
await mkdir21(globalDir, { recursive: true });
|
|
89995
|
-
await
|
|
89996
|
-
const content = await
|
|
90373
|
+
await writeFile23(testFile, "test", "utf-8");
|
|
90374
|
+
const content = await readFile46(testFile, "utf-8");
|
|
89997
90375
|
await unlink11(testFile);
|
|
89998
90376
|
if (content !== "test")
|
|
89999
90377
|
throw new Error("Read mismatch");
|
|
@@ -90066,7 +90444,7 @@ async function checkWSLBoundary() {
|
|
|
90066
90444
|
|
|
90067
90445
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
90068
90446
|
init_path_resolver();
|
|
90069
|
-
import { mkdir as mkdir22, symlink as symlink2, unlink as unlink12, writeFile as
|
|
90447
|
+
import { mkdir as mkdir22, symlink as symlink2, unlink as unlink12, writeFile as writeFile24 } from "node:fs/promises";
|
|
90070
90448
|
import { join as join86 } from "node:path";
|
|
90071
90449
|
async function checkLongPathSupport() {
|
|
90072
90450
|
if (shouldSkipExpensiveOperations4()) {
|
|
@@ -90123,7 +90501,7 @@ async function checkSymlinkSupport() {
|
|
|
90123
90501
|
const link = join86(testDir, ".ck-symlink-test-link");
|
|
90124
90502
|
try {
|
|
90125
90503
|
await mkdir22(testDir, { recursive: true });
|
|
90126
|
-
await
|
|
90504
|
+
await writeFile24(target, "test", "utf-8");
|
|
90127
90505
|
await symlink2(target, link);
|
|
90128
90506
|
await unlink12(link);
|
|
90129
90507
|
await unlink12(target);
|
|
@@ -90362,9 +90740,10 @@ function createDefaultDeps() {
|
|
|
90362
90740
|
};
|
|
90363
90741
|
}
|
|
90364
90742
|
function createDefaultDns() {
|
|
90743
|
+
const lookupFamily = (host, family) => dnsPromises.lookup(host, { family, all: true }).then((records) => records.map((record) => record.address));
|
|
90365
90744
|
return {
|
|
90366
|
-
resolve4: (host) =>
|
|
90367
|
-
resolve6: (host) =>
|
|
90745
|
+
resolve4: (host) => lookupFamily(host, 4),
|
|
90746
|
+
resolve6: (host) => lookupFamily(host, 6)
|
|
90368
90747
|
};
|
|
90369
90748
|
}
|
|
90370
90749
|
function createDefaultTcp() {
|
|
@@ -90545,11 +90924,25 @@ async function checkGitHubReachability(deps) {
|
|
|
90545
90924
|
}
|
|
90546
90925
|
function raceTimeout(promise, ms) {
|
|
90547
90926
|
return new Promise((resolve38, reject) => {
|
|
90548
|
-
|
|
90927
|
+
let settled = false;
|
|
90928
|
+
const timer = setTimeout(() => {
|
|
90929
|
+
setImmediate(() => {
|
|
90930
|
+
if (settled)
|
|
90931
|
+
return;
|
|
90932
|
+
settled = true;
|
|
90933
|
+
reject(new Error(`timeout after ${ms}ms`));
|
|
90934
|
+
});
|
|
90935
|
+
}, ms);
|
|
90549
90936
|
promise.then((v2) => {
|
|
90937
|
+
if (settled)
|
|
90938
|
+
return;
|
|
90939
|
+
settled = true;
|
|
90550
90940
|
clearTimeout(timer);
|
|
90551
90941
|
resolve38(v2);
|
|
90552
90942
|
}, (e2) => {
|
|
90943
|
+
if (settled)
|
|
90944
|
+
return;
|
|
90945
|
+
settled = true;
|
|
90553
90946
|
clearTimeout(timer);
|
|
90554
90947
|
reject(e2);
|
|
90555
90948
|
});
|
|
@@ -91211,13 +91604,13 @@ init_hook_health_checker();
|
|
|
91211
91604
|
init_config_version_checker();
|
|
91212
91605
|
|
|
91213
91606
|
// src/domains/sync/sync-engine.ts
|
|
91214
|
-
import { lstat as lstat6, readFile as
|
|
91607
|
+
import { lstat as lstat6, readFile as readFile48, readlink as readlink2, realpath as realpath8, stat as stat14 } from "node:fs/promises";
|
|
91215
91608
|
import { isAbsolute as isAbsolute11, join as join88, normalize as normalize8, relative as relative18 } from "node:path";
|
|
91216
91609
|
|
|
91217
91610
|
// src/services/file-operations/ownership-checker.ts
|
|
91218
91611
|
init_metadata_migration();
|
|
91219
91612
|
import { createHash as createHash6 } from "node:crypto";
|
|
91220
|
-
import { readFile as
|
|
91613
|
+
import { readFile as readFile47, stat as stat13 } from "node:fs/promises";
|
|
91221
91614
|
import { relative as relative17 } from "node:path";
|
|
91222
91615
|
|
|
91223
91616
|
// src/shared/concurrent-file-ops.ts
|
|
@@ -91232,7 +91625,7 @@ async function mapWithLimit(items, fn, concurrency = DEFAULT_CONCURRENCY) {
|
|
|
91232
91625
|
class OwnershipChecker {
|
|
91233
91626
|
static async calculateChecksum(filePath) {
|
|
91234
91627
|
try {
|
|
91235
|
-
return createHash6("sha256").update(await
|
|
91628
|
+
return createHash6("sha256").update(await readFile47(filePath)).digest("hex");
|
|
91236
91629
|
} catch (err) {
|
|
91237
91630
|
const message = err instanceof Error ? err.message : String(err);
|
|
91238
91631
|
throw new Error(operationError("Checksum calculation", filePath, message));
|
|
@@ -92649,7 +93042,7 @@ class SyncEngine {
|
|
|
92649
93042
|
if (lstats.size > MAX_SYNC_FILE_SIZE) {
|
|
92650
93043
|
throw new Error(`File too large for sync (${Math.round(lstats.size / 1024 / 1024)}MB > ${MAX_SYNC_FILE_SIZE / 1024 / 1024}MB limit)`);
|
|
92651
93044
|
}
|
|
92652
|
-
const buffer = await
|
|
93045
|
+
const buffer = await readFile48(filePath);
|
|
92653
93046
|
if (buffer.includes(0)) {
|
|
92654
93047
|
return { content: "", isBinary: true };
|
|
92655
93048
|
}
|
|
@@ -101977,7 +102370,7 @@ import { join as join121 } from "node:path";
|
|
|
101977
102370
|
|
|
101978
102371
|
// src/domains/installation/deletion-handler.ts
|
|
101979
102372
|
import { existsSync as existsSync65, lstatSync as lstatSync3, readdirSync as readdirSync9, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
101980
|
-
import { dirname as dirname37, join as join106, relative as relative21, resolve as
|
|
102373
|
+
import { dirname as dirname37, join as join106, relative as relative21, resolve as resolve42, sep as sep11 } from "node:path";
|
|
101981
102374
|
|
|
101982
102375
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
101983
102376
|
init_metadata_migration();
|
|
@@ -102202,8 +102595,8 @@ function expandGlobPatterns(patterns, claudeDir3) {
|
|
|
102202
102595
|
}
|
|
102203
102596
|
var MAX_CLEANUP_ITERATIONS = 50;
|
|
102204
102597
|
function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
102205
|
-
const normalizedClaudeDir =
|
|
102206
|
-
let currentDir =
|
|
102598
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102599
|
+
let currentDir = resolve42(dirname37(filePath));
|
|
102207
102600
|
let iterations = 0;
|
|
102208
102601
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
|
|
102209
102602
|
iterations++;
|
|
@@ -102212,7 +102605,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102212
102605
|
if (entries.length === 0) {
|
|
102213
102606
|
rmdirSync(currentDir);
|
|
102214
102607
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
102215
|
-
currentDir =
|
|
102608
|
+
currentDir = resolve42(dirname37(currentDir));
|
|
102216
102609
|
} else {
|
|
102217
102610
|
break;
|
|
102218
102611
|
}
|
|
@@ -102222,9 +102615,9 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102222
102615
|
}
|
|
102223
102616
|
}
|
|
102224
102617
|
function deletePath(fullPath, claudeDir3) {
|
|
102225
|
-
const normalizedPath =
|
|
102226
|
-
const normalizedClaudeDir =
|
|
102227
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
102618
|
+
const normalizedPath = resolve42(fullPath);
|
|
102619
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102620
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep11}`) && normalizedPath !== normalizedClaudeDir) {
|
|
102228
102621
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
102229
102622
|
}
|
|
102230
102623
|
try {
|
|
@@ -102296,9 +102689,9 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
102296
102689
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
102297
102690
|
for (const path16 of deletions) {
|
|
102298
102691
|
const fullPath = join106(claudeDir3, path16);
|
|
102299
|
-
const normalizedPath =
|
|
102300
|
-
const normalizedClaudeDir =
|
|
102301
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
102692
|
+
const normalizedPath = resolve42(fullPath);
|
|
102693
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102694
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep11}`)) {
|
|
102302
102695
|
logger.warning(`Skipping invalid path: ${path16}`);
|
|
102303
102696
|
result.errors.push(path16);
|
|
102304
102697
|
continue;
|
|
@@ -103396,8 +103789,8 @@ var path16 = {
|
|
|
103396
103789
|
win32: { sep: "\\" },
|
|
103397
103790
|
posix: { sep: "/" }
|
|
103398
103791
|
};
|
|
103399
|
-
var
|
|
103400
|
-
minimatch.sep =
|
|
103792
|
+
var sep12 = defaultPlatform === "win32" ? path16.win32.sep : path16.posix.sep;
|
|
103793
|
+
minimatch.sep = sep12;
|
|
103401
103794
|
var GLOBSTAR = Symbol("globstar **");
|
|
103402
103795
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
103403
103796
|
var qmark2 = "[^/]";
|
|
@@ -104086,7 +104479,7 @@ import { dirname as dirname40, join as join110 } from "node:path";
|
|
|
104086
104479
|
// src/domains/config/installed-settings-tracker.ts
|
|
104087
104480
|
init_shared();
|
|
104088
104481
|
import { existsSync as existsSync66 } from "node:fs";
|
|
104089
|
-
import { mkdir as mkdir31, readFile as
|
|
104482
|
+
import { mkdir as mkdir31, readFile as readFile52, writeFile as writeFile27 } from "node:fs/promises";
|
|
104090
104483
|
import { dirname as dirname39, join as join109 } from "node:path";
|
|
104091
104484
|
var CK_JSON_FILE = ".ck.json";
|
|
104092
104485
|
|
|
@@ -104111,7 +104504,7 @@ class InstalledSettingsTracker {
|
|
|
104111
104504
|
return { hooks: [], mcpServers: [] };
|
|
104112
104505
|
}
|
|
104113
104506
|
try {
|
|
104114
|
-
const content = await
|
|
104507
|
+
const content = await readFile52(ckJsonPath, "utf-8");
|
|
104115
104508
|
const data = parseJsonContent(content);
|
|
104116
104509
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
104117
104510
|
if (installed) {
|
|
@@ -104128,7 +104521,7 @@ class InstalledSettingsTracker {
|
|
|
104128
104521
|
try {
|
|
104129
104522
|
let data = {};
|
|
104130
104523
|
if (existsSync66(ckJsonPath)) {
|
|
104131
|
-
const content = await
|
|
104524
|
+
const content = await readFile52(ckJsonPath, "utf-8");
|
|
104132
104525
|
data = parseJsonContent(content);
|
|
104133
104526
|
}
|
|
104134
104527
|
if (!data.kits) {
|
|
@@ -104139,7 +104532,7 @@ class InstalledSettingsTracker {
|
|
|
104139
104532
|
}
|
|
104140
104533
|
data.kits[this.kitName].installedSettings = settings;
|
|
104141
104534
|
await mkdir31(dirname39(ckJsonPath), { recursive: true });
|
|
104142
|
-
await
|
|
104535
|
+
await writeFile27(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
104143
104536
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
104144
104537
|
} catch (error) {
|
|
104145
104538
|
logger.warning(`Failed to save installed settings: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -104184,7 +104577,19 @@ init_logger();
|
|
|
104184
104577
|
init_path_resolver();
|
|
104185
104578
|
var import_fs_extra15 = __toESM(require_lib(), 1);
|
|
104186
104579
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
104187
|
-
var
|
|
104580
|
+
var DYNAMIC_TEAM_HOOKS = [
|
|
104581
|
+
{
|
|
104582
|
+
event: "TaskCompleted",
|
|
104583
|
+
handler: "task-completed-handler.cjs",
|
|
104584
|
+
hookName: "task-completed-handler"
|
|
104585
|
+
},
|
|
104586
|
+
{
|
|
104587
|
+
event: "TeammateIdle",
|
|
104588
|
+
handler: "teammate-idle-handler.cjs",
|
|
104589
|
+
hookName: "teammate-idle-handler"
|
|
104590
|
+
}
|
|
104591
|
+
];
|
|
104592
|
+
var DYNAMIC_INJECTED_HOOKS = new Set(DYNAMIC_TEAM_HOOKS.map(({ hookName }) => hookName));
|
|
104188
104593
|
|
|
104189
104594
|
class SettingsProcessor {
|
|
104190
104595
|
static MIN_TEAM_HOOKS_VERSION = "2.1.33";
|
|
@@ -104344,7 +104749,7 @@ class SettingsProcessor {
|
|
|
104344
104749
|
}
|
|
104345
104750
|
await SettingsMerger.writeSettingsFile(destFile, mergeResult.merged);
|
|
104346
104751
|
logger.success("Merged settings.json (user customizations preserved)");
|
|
104347
|
-
await this.refreshInstalledSettingsTracking(sourceSettings, installedSettings);
|
|
104752
|
+
await this.refreshInstalledSettingsTracking(sourceSettings, installedSettings, destFile);
|
|
104348
104753
|
await this.injectTeamHooksIfSupported(destFile, mergeResult.merged);
|
|
104349
104754
|
}
|
|
104350
104755
|
async getDisabledHookNames() {
|
|
@@ -104604,23 +105009,28 @@ class SettingsProcessor {
|
|
|
104604
105009
|
}
|
|
104605
105010
|
return installedSettings;
|
|
104606
105011
|
}
|
|
104607
|
-
async refreshInstalledSettingsTracking(sourceSettings, previousInstalledSettings) {
|
|
105012
|
+
async refreshInstalledSettingsTracking(sourceSettings, previousInstalledSettings, destFile) {
|
|
104608
105013
|
if (!this.tracker)
|
|
104609
105014
|
return;
|
|
104610
105015
|
const trackingSource = structuredClone(sourceSettings);
|
|
104611
105016
|
this.fixHookCommandPaths(trackingSource);
|
|
104612
105017
|
const refreshedSettings = this.collectInstalledSettings(trackingSource);
|
|
104613
|
-
this.
|
|
105018
|
+
const disabledHooks = await this.getDisabledHookNames();
|
|
105019
|
+
await this.preserveDynamicInjectedHookTracking(previousInstalledSettings, refreshedSettings, destFile, disabledHooks);
|
|
104614
105020
|
await this.tracker.saveInstalledSettings(refreshedSettings);
|
|
104615
105021
|
logger.debug("Refreshed installed settings tracking baseline");
|
|
104616
105022
|
}
|
|
104617
|
-
preserveDynamicInjectedHookTracking(previousInstalledSettings, refreshedSettings) {
|
|
105023
|
+
async preserveDynamicInjectedHookTracking(previousInstalledSettings, refreshedSettings, destFile, disabledHooks) {
|
|
104618
105024
|
if (!previousInstalledSettings.hooks || !this.tracker)
|
|
104619
105025
|
return;
|
|
104620
105026
|
for (const command of previousInstalledSettings.hooks) {
|
|
104621
105027
|
const hookName = this.extractCkHookName(command);
|
|
104622
105028
|
if (!hookName || !DYNAMIC_INJECTED_HOOKS.has(hookName))
|
|
104623
105029
|
continue;
|
|
105030
|
+
if (disabledHooks.has(hookName))
|
|
105031
|
+
continue;
|
|
105032
|
+
if (!await this.dynamicTeamHookHandlerExists(destFile, `${hookName}.cjs`))
|
|
105033
|
+
continue;
|
|
104624
105034
|
this.tracker.trackHook(command, refreshedSettings);
|
|
104625
105035
|
}
|
|
104626
105036
|
}
|
|
@@ -104798,11 +105208,6 @@ class SettingsProcessor {
|
|
|
104798
105208
|
logger.debug("Claude Code version not detected, skipping team hooks injection");
|
|
104799
105209
|
return;
|
|
104800
105210
|
}
|
|
104801
|
-
if (!this.isVersionAtLeast(version, SettingsProcessor.MIN_TEAM_HOOKS_VERSION)) {
|
|
104802
|
-
logger.debug(`Claude Code ${version} does not support team hooks (requires >= 2.1.33), skipping injection`);
|
|
104803
|
-
return;
|
|
104804
|
-
}
|
|
104805
|
-
logger.debug(`Claude Code ${version} detected, checking team hooks`);
|
|
104806
105211
|
const settings = existingSettings ?? await SettingsMerger.readSettingsFile(destFile);
|
|
104807
105212
|
if (!settings) {
|
|
104808
105213
|
logger.warning("Failed to read settings file for team hooks injection");
|
|
@@ -104811,38 +105216,109 @@ class SettingsProcessor {
|
|
|
104811
105216
|
if (!settings.hooks) {
|
|
104812
105217
|
settings.hooks = {};
|
|
104813
105218
|
}
|
|
105219
|
+
if (!this.isVersionAtLeast(version, SettingsProcessor.MIN_TEAM_HOOKS_VERSION)) {
|
|
105220
|
+
const pruned = this.removeDynamicTeamHookRegistrations(settings);
|
|
105221
|
+
if (pruned > 0) {
|
|
105222
|
+
await SettingsMerger.writeSettingsFile(destFile, settings);
|
|
105223
|
+
logger.info(`Pruned ${pruned} team hook registration(s) unsupported by Claude Code ${version}`);
|
|
105224
|
+
} else {
|
|
105225
|
+
logger.debug(`Claude Code ${version} does not support team hooks (requires >= 2.1.33), skipping injection`);
|
|
105226
|
+
}
|
|
105227
|
+
return;
|
|
105228
|
+
}
|
|
105229
|
+
logger.debug(`Claude Code ${version} detected, checking team hooks`);
|
|
105230
|
+
let changed = false;
|
|
104814
105231
|
let injected = false;
|
|
104815
105232
|
const installedSettings = this.tracker ? await this.tracker.loadInstalledSettings() : { hooks: [], mcpServers: [] };
|
|
104816
|
-
const
|
|
104817
|
-
|
|
104818
|
-
{ event: "TeammateIdle", handler: "teammate-idle-handler.cjs" }
|
|
104819
|
-
];
|
|
104820
|
-
for (const { event, handler } of teamHooks) {
|
|
105233
|
+
const disabledHooks = await this.getDisabledHookNames();
|
|
105234
|
+
for (const { event, handler, hookName } of DYNAMIC_TEAM_HOOKS) {
|
|
104821
105235
|
const hookCommand = this.formatCommandPath("node ", this.isGlobal ? this.getCanonicalGlobalCommandRoot() : "$CLAUDE_PROJECT_DIR", `.claude/hooks/${handler}`);
|
|
104822
105236
|
const eventHooks = settings.hooks[event];
|
|
104823
|
-
if (
|
|
105237
|
+
if (disabledHooks.has(hookName)) {
|
|
105238
|
+
if (this.removeDynamicTeamHookRegistration(settings, event, hookName)) {
|
|
105239
|
+
changed = true;
|
|
105240
|
+
logger.info(`Skipped ${event} hook disabled in .ck.json`);
|
|
105241
|
+
}
|
|
104824
105242
|
continue;
|
|
104825
|
-
|
|
104826
|
-
|
|
105243
|
+
}
|
|
105244
|
+
if (!await this.dynamicTeamHookHandlerExists(destFile, handler)) {
|
|
105245
|
+
if (this.removeDynamicTeamHookRegistration(settings, event, hookName)) {
|
|
105246
|
+
changed = true;
|
|
105247
|
+
logger.info(`Pruned ${event} hook because ${handler} is not installed`);
|
|
105248
|
+
}
|
|
104827
105249
|
continue;
|
|
104828
105250
|
}
|
|
105251
|
+
if (eventHooks && eventHooks.length > 0)
|
|
105252
|
+
continue;
|
|
104829
105253
|
settings.hooks[event] = [{ hooks: [{ type: "command", command: hookCommand }] }];
|
|
104830
105254
|
logger.info(`Injected ${event} hook`);
|
|
105255
|
+
changed = true;
|
|
104831
105256
|
injected = true;
|
|
104832
105257
|
if (this.tracker) {
|
|
104833
105258
|
this.tracker.trackHook(hookCommand, installedSettings);
|
|
104834
105259
|
}
|
|
104835
105260
|
}
|
|
104836
|
-
if (
|
|
105261
|
+
if (changed) {
|
|
104837
105262
|
await SettingsMerger.writeSettingsFile(destFile, settings);
|
|
104838
105263
|
if (this.tracker) {
|
|
104839
105264
|
await this.tracker.saveInstalledSettings(installedSettings);
|
|
104840
105265
|
}
|
|
104841
|
-
|
|
105266
|
+
if (injected) {
|
|
105267
|
+
logger.success("Team hooks injected successfully");
|
|
105268
|
+
}
|
|
104842
105269
|
} else {
|
|
104843
105270
|
logger.debug("Team hooks already present, no injection needed");
|
|
104844
105271
|
}
|
|
104845
105272
|
}
|
|
105273
|
+
async dynamicTeamHookHandlerExists(destFile, handler) {
|
|
105274
|
+
return import_fs_extra15.pathExists(join110(dirname40(destFile), "hooks", handler));
|
|
105275
|
+
}
|
|
105276
|
+
removeDynamicTeamHookRegistrations(settings) {
|
|
105277
|
+
let removed = 0;
|
|
105278
|
+
for (const { event, hookName } of DYNAMIC_TEAM_HOOKS) {
|
|
105279
|
+
if (this.removeDynamicTeamHookRegistration(settings, event, hookName)) {
|
|
105280
|
+
removed++;
|
|
105281
|
+
}
|
|
105282
|
+
}
|
|
105283
|
+
return removed;
|
|
105284
|
+
}
|
|
105285
|
+
removeDynamicTeamHookRegistration(settings, event, hookName) {
|
|
105286
|
+
const hooks = settings.hooks;
|
|
105287
|
+
const entries = hooks?.[event];
|
|
105288
|
+
if (!entries)
|
|
105289
|
+
return false;
|
|
105290
|
+
let removed = false;
|
|
105291
|
+
const filteredEntries = [];
|
|
105292
|
+
for (const entry of entries) {
|
|
105293
|
+
if ("hooks" in entry && Array.isArray(entry.hooks)) {
|
|
105294
|
+
const keptHooks = entry.hooks.filter((hook) => {
|
|
105295
|
+
const command = typeof hook.command === "string" ? hook.command : "";
|
|
105296
|
+
if (this.extractCkHookName(command) === hookName) {
|
|
105297
|
+
removed = true;
|
|
105298
|
+
return false;
|
|
105299
|
+
}
|
|
105300
|
+
return true;
|
|
105301
|
+
});
|
|
105302
|
+
if (keptHooks.length > 0) {
|
|
105303
|
+
filteredEntries.push({ ...entry, hooks: keptHooks });
|
|
105304
|
+
}
|
|
105305
|
+
continue;
|
|
105306
|
+
}
|
|
105307
|
+
if ("command" in entry && typeof entry.command === "string" && this.extractCkHookName(entry.command) === hookName) {
|
|
105308
|
+
removed = true;
|
|
105309
|
+
continue;
|
|
105310
|
+
}
|
|
105311
|
+
filteredEntries.push(entry);
|
|
105312
|
+
}
|
|
105313
|
+
if (!removed)
|
|
105314
|
+
return false;
|
|
105315
|
+
if (filteredEntries.length > 0) {
|
|
105316
|
+
hooks[event] = filteredEntries;
|
|
105317
|
+
} else {
|
|
105318
|
+
delete hooks[event];
|
|
105319
|
+
}
|
|
105320
|
+
return true;
|
|
105321
|
+
}
|
|
104846
105322
|
}
|
|
104847
105323
|
|
|
104848
105324
|
// src/domains/installation/merger/copy-executor.ts
|
|
@@ -105856,7 +106332,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
105856
106332
|
init_logger();
|
|
105857
106333
|
init_skip_directories();
|
|
105858
106334
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
105859
|
-
import { join as join116, relative as relative26, resolve as
|
|
106335
|
+
import { join as join116, relative as relative26, resolve as resolve43 } from "node:path";
|
|
105860
106336
|
|
|
105861
106337
|
class FileScanner2 {
|
|
105862
106338
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -105936,8 +106412,8 @@ class FileScanner2 {
|
|
|
105936
106412
|
return customFiles;
|
|
105937
106413
|
}
|
|
105938
106414
|
static isSafePath(basePath, targetPath) {
|
|
105939
|
-
const resolvedBase =
|
|
105940
|
-
const resolvedTarget =
|
|
106415
|
+
const resolvedBase = resolve43(basePath);
|
|
106416
|
+
const resolvedTarget = resolve43(targetPath);
|
|
105941
106417
|
return resolvedTarget.startsWith(resolvedBase);
|
|
105942
106418
|
}
|
|
105943
106419
|
static toPosixPath(path17) {
|
|
@@ -105953,7 +106429,7 @@ import { join as join118 } from "node:path";
|
|
|
105953
106429
|
|
|
105954
106430
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
105955
106431
|
init_logger();
|
|
105956
|
-
import { readFile as
|
|
106432
|
+
import { readFile as readFile56, readdir as readdir30, writeFile as writeFile31 } from "node:fs/promises";
|
|
105957
106433
|
import { join as join117 } from "node:path";
|
|
105958
106434
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
105959
106435
|
".md",
|
|
@@ -106022,13 +106498,13 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
106022
106498
|
await processDirectory(fullPath);
|
|
106023
106499
|
} else if (entry.isFile() && shouldTransformFile(entry.name)) {
|
|
106024
106500
|
try {
|
|
106025
|
-
const content = await
|
|
106501
|
+
const content = await readFile56(fullPath, "utf-8");
|
|
106026
106502
|
const { transformed, changes } = transformCommandContent(content);
|
|
106027
106503
|
if (changes > 0) {
|
|
106028
106504
|
if (options2.dryRun) {
|
|
106029
106505
|
logger.debug(`[dry-run] Would transform ${changes} command ref(s) in ${fullPath}`);
|
|
106030
106506
|
} else {
|
|
106031
|
-
await
|
|
106507
|
+
await writeFile31(fullPath, transformed, "utf-8");
|
|
106032
106508
|
if (options2.verbose) {
|
|
106033
106509
|
logger.verbose(`Transformed ${changes} command ref(s) in ${fullPath}`);
|
|
106034
106510
|
}
|
|
@@ -106563,7 +107039,7 @@ init_skip_directories();
|
|
|
106563
107039
|
init_types3();
|
|
106564
107040
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
106565
107041
|
import { createHash as createHash7 } from "node:crypto";
|
|
106566
|
-
import { readFile as
|
|
107042
|
+
import { readFile as readFile58, readdir as readdir34, writeFile as writeFile32 } from "node:fs/promises";
|
|
106567
107043
|
import { join as join122, relative as relative27 } from "node:path";
|
|
106568
107044
|
|
|
106569
107045
|
class SkillsManifestManager {
|
|
@@ -106587,7 +107063,7 @@ class SkillsManifestManager {
|
|
|
106587
107063
|
}
|
|
106588
107064
|
static async writeManifest(skillsDir2, manifest) {
|
|
106589
107065
|
const manifestPath = join122(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
106590
|
-
await
|
|
107066
|
+
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
106591
107067
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
106592
107068
|
}
|
|
106593
107069
|
static async readManifest(skillsDir2) {
|
|
@@ -106597,7 +107073,7 @@ class SkillsManifestManager {
|
|
|
106597
107073
|
return null;
|
|
106598
107074
|
}
|
|
106599
107075
|
try {
|
|
106600
|
-
const content = await
|
|
107076
|
+
const content = await readFile58(manifestPath, "utf-8");
|
|
106601
107077
|
const data = JSON.parse(content);
|
|
106602
107078
|
const manifest = SkillsManifestSchema.parse(data);
|
|
106603
107079
|
logger.debug(`Read manifest from: ${manifestPath}`);
|
|
@@ -106669,7 +107145,7 @@ class SkillsManifestManager {
|
|
|
106669
107145
|
files.sort();
|
|
106670
107146
|
for (const file of files) {
|
|
106671
107147
|
const relativePath = relative27(dirPath, file);
|
|
106672
|
-
const content = await
|
|
107148
|
+
const content = await readFile58(file);
|
|
106673
107149
|
hash.update(relativePath);
|
|
106674
107150
|
hash.update(content);
|
|
106675
107151
|
}
|
|
@@ -107409,7 +107885,7 @@ import { relative as relative29 } from "node:path";
|
|
|
107409
107885
|
init_skip_directories();
|
|
107410
107886
|
import { createHash as createHash8 } from "node:crypto";
|
|
107411
107887
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
107412
|
-
import { readFile as
|
|
107888
|
+
import { readFile as readFile59, readdir as readdir38 } from "node:fs/promises";
|
|
107413
107889
|
import { join as join126, relative as relative28 } from "node:path";
|
|
107414
107890
|
async function getAllFiles(dirPath) {
|
|
107415
107891
|
const files = [];
|
|
@@ -107448,7 +107924,7 @@ async function hashDirectory(dirPath) {
|
|
|
107448
107924
|
files.sort();
|
|
107449
107925
|
for (const file of files) {
|
|
107450
107926
|
const relativePath = relative28(dirPath, file);
|
|
107451
|
-
const content = await
|
|
107927
|
+
const content = await readFile59(file);
|
|
107452
107928
|
hash.update(relativePath);
|
|
107453
107929
|
hash.update(content);
|
|
107454
107930
|
}
|
|
@@ -107782,7 +108258,7 @@ import { join as join131 } from "node:path";
|
|
|
107782
108258
|
|
|
107783
108259
|
// src/services/transformers/opencode-path-transformer.ts
|
|
107784
108260
|
init_logger();
|
|
107785
|
-
import { readFile as
|
|
108261
|
+
import { readFile as readFile60, readdir as readdir40, writeFile as writeFile33 } from "node:fs/promises";
|
|
107786
108262
|
import { platform as platform15 } from "node:os";
|
|
107787
108263
|
import { extname as extname6, join as join130 } from "node:path";
|
|
107788
108264
|
var IS_WINDOWS2 = platform15() === "win32";
|
|
@@ -107853,10 +108329,10 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
107853
108329
|
await processDirectory2(fullPath);
|
|
107854
108330
|
} else if (entry.isFile() && shouldTransformFile2(entry.name)) {
|
|
107855
108331
|
try {
|
|
107856
|
-
const content = await
|
|
108332
|
+
const content = await readFile60(fullPath, "utf-8");
|
|
107857
108333
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
107858
108334
|
if (changes > 0) {
|
|
107859
|
-
await
|
|
108335
|
+
await writeFile33(fullPath, transformed, "utf-8");
|
|
107860
108336
|
filesTransformed++;
|
|
107861
108337
|
totalChanges += changes;
|
|
107862
108338
|
if (options2.verbose) {
|
|
@@ -108084,7 +108560,7 @@ async function handlePostInstall(ctx) {
|
|
|
108084
108560
|
init_config_manager();
|
|
108085
108561
|
init_github_client();
|
|
108086
108562
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
108087
|
-
import { join as join135, resolve as
|
|
108563
|
+
import { join as join135, resolve as resolve46 } from "node:path";
|
|
108088
108564
|
|
|
108089
108565
|
// src/domains/github/kit-access-checker.ts
|
|
108090
108566
|
init_error2();
|
|
@@ -108254,7 +108730,7 @@ async function runPreflightChecks() {
|
|
|
108254
108730
|
// src/domains/installation/fresh-installer.ts
|
|
108255
108731
|
init_metadata_migration();
|
|
108256
108732
|
import { existsSync as existsSync67, readdirSync as readdirSync10, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
108257
|
-
import { basename as basename28, dirname as dirname42, join as join133, resolve as
|
|
108733
|
+
import { basename as basename28, dirname as dirname42, join as join133, resolve as resolve44 } from "node:path";
|
|
108258
108734
|
init_logger();
|
|
108259
108735
|
init_safe_spinner();
|
|
108260
108736
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -108306,15 +108782,15 @@ async function analyzeFreshInstallation(claudeDir3) {
|
|
|
108306
108782
|
};
|
|
108307
108783
|
}
|
|
108308
108784
|
function cleanupEmptyDirectories2(filePath, claudeDir3) {
|
|
108309
|
-
const normalizedClaudeDir =
|
|
108310
|
-
let currentDir =
|
|
108785
|
+
const normalizedClaudeDir = resolve44(claudeDir3);
|
|
108786
|
+
let currentDir = resolve44(dirname42(filePath));
|
|
108311
108787
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
|
|
108312
108788
|
try {
|
|
108313
108789
|
const entries = readdirSync10(currentDir);
|
|
108314
108790
|
if (entries.length === 0) {
|
|
108315
108791
|
rmdirSync2(currentDir);
|
|
108316
108792
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
108317
|
-
currentDir =
|
|
108793
|
+
currentDir = resolve44(dirname42(currentDir));
|
|
108318
108794
|
} else {
|
|
108319
108795
|
break;
|
|
108320
108796
|
}
|
|
@@ -108504,7 +108980,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
108504
108980
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
108505
108981
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
108506
108982
|
import { homedir as homedir47 } from "node:os";
|
|
108507
|
-
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as
|
|
108983
|
+
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as resolve45 } from "node:path";
|
|
108508
108984
|
var LEGACY_KIT_MARKERS = [
|
|
108509
108985
|
"metadata.json",
|
|
108510
108986
|
".ck.json",
|
|
@@ -108530,7 +109006,7 @@ function uniqueNormalizedPaths(paths) {
|
|
|
108530
109006
|
const seen = new Set;
|
|
108531
109007
|
const result = [];
|
|
108532
109008
|
for (const path17 of paths) {
|
|
108533
|
-
const normalized = normalize11(
|
|
109009
|
+
const normalized = normalize11(resolve45(path17));
|
|
108534
109010
|
if (seen.has(normalized))
|
|
108535
109011
|
continue;
|
|
108536
109012
|
seen.add(normalized);
|
|
@@ -108595,8 +109071,8 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
|
|
|
108595
109071
|
if (safeEnvPath(env2.CLAUDE_CONFIG_DIR)) {
|
|
108596
109072
|
return { status: "skipped", reason: "custom-global-dir", candidateDirs: [] };
|
|
108597
109073
|
}
|
|
108598
|
-
const targetDir = normalize11(
|
|
108599
|
-
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(
|
|
109074
|
+
const targetDir = normalize11(resolve45(options2.targetDir));
|
|
109075
|
+
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(resolve45(candidate)) !== targetDir);
|
|
108600
109076
|
const legacyDirs = [];
|
|
108601
109077
|
for (const candidate of candidateDirs) {
|
|
108602
109078
|
if (await hasKitMarkers(candidate)) {
|
|
@@ -108819,7 +109295,7 @@ async function handleSelection(ctx) {
|
|
|
108819
109295
|
}
|
|
108820
109296
|
}
|
|
108821
109297
|
}
|
|
108822
|
-
const resolvedDir =
|
|
109298
|
+
const resolvedDir = resolve46(targetDir);
|
|
108823
109299
|
if (ctx.options.global) {
|
|
108824
109300
|
try {
|
|
108825
109301
|
const repairResult = await repairLegacyWindowsGlobalKitDir({ targetDir: resolvedDir });
|
|
@@ -109015,8 +109491,8 @@ async function handleSelection(ctx) {
|
|
|
109015
109491
|
};
|
|
109016
109492
|
}
|
|
109017
109493
|
// src/commands/init/phases/sync-handler.ts
|
|
109018
|
-
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as
|
|
109019
|
-
import { dirname as dirname44, join as join136, resolve as
|
|
109494
|
+
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";
|
|
109495
|
+
import { dirname as dirname44, join as join136, resolve as resolve47 } from "node:path";
|
|
109020
109496
|
init_logger();
|
|
109021
109497
|
init_path_resolver();
|
|
109022
109498
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -109025,7 +109501,7 @@ async function handleSync(ctx) {
|
|
|
109025
109501
|
if (!ctx.options.sync) {
|
|
109026
109502
|
return ctx;
|
|
109027
109503
|
}
|
|
109028
|
-
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() :
|
|
109504
|
+
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve47(ctx.options.dir || ".");
|
|
109029
109505
|
const claudeDir3 = ctx.options.global ? resolvedDir : join136(resolvedDir, ".claude");
|
|
109030
109506
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
109031
109507
|
logger.error("Cannot sync: no .claude directory found");
|
|
@@ -109159,7 +109635,7 @@ async function acquireSyncLock(global3) {
|
|
|
109159
109635
|
}
|
|
109160
109636
|
logger.debug(`Lock stat failed: ${statError}`);
|
|
109161
109637
|
}
|
|
109162
|
-
await new Promise((
|
|
109638
|
+
await new Promise((resolve48) => setTimeout(resolve48, 100));
|
|
109163
109639
|
continue;
|
|
109164
109640
|
}
|
|
109165
109641
|
throw err;
|
|
@@ -109184,7 +109660,7 @@ async function executeSyncMerge(ctx) {
|
|
|
109184
109660
|
try {
|
|
109185
109661
|
const sourceMetadataPath = join136(upstreamDir, "metadata.json");
|
|
109186
109662
|
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
109187
|
-
const content = await
|
|
109663
|
+
const content = await readFile61(sourceMetadataPath, "utf-8");
|
|
109188
109664
|
sourceMetadata = JSON.parse(content);
|
|
109189
109665
|
deletions = sourceMetadata.deletions || [];
|
|
109190
109666
|
}
|
|
@@ -109325,7 +109801,7 @@ async function executeSyncMerge(ctx) {
|
|
|
109325
109801
|
try {
|
|
109326
109802
|
const tempPath = `${currentPath}.tmp.${Date.now()}`;
|
|
109327
109803
|
try {
|
|
109328
|
-
await
|
|
109804
|
+
await writeFile35(tempPath, result.result, "utf-8");
|
|
109329
109805
|
await rename12(tempPath, currentPath);
|
|
109330
109806
|
} catch (atomicError) {
|
|
109331
109807
|
await unlink13(tempPath).catch(() => {});
|
|
@@ -109512,7 +109988,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
109512
109988
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
109513
109989
|
init_logger();
|
|
109514
109990
|
init_types3();
|
|
109515
|
-
import { readFile as
|
|
109991
|
+
import { readFile as readFile62, readdir as readdir43, writeFile as writeFile36 } from "node:fs/promises";
|
|
109516
109992
|
import { join as join138, relative as relative31 } from "node:path";
|
|
109517
109993
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
109518
109994
|
".md",
|
|
@@ -109579,7 +110055,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
109579
110055
|
if (!shouldTransform)
|
|
109580
110056
|
continue;
|
|
109581
110057
|
try {
|
|
109582
|
-
const content = await
|
|
110058
|
+
const content = await readFile62(fullPath, "utf-8");
|
|
109583
110059
|
let newContent = content;
|
|
109584
110060
|
let changeCount = 0;
|
|
109585
110061
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -109595,7 +110071,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
109595
110071
|
if (options2.dryRun) {
|
|
109596
110072
|
logger.debug(`[dry-run] Would update ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
109597
110073
|
} else {
|
|
109598
|
-
await
|
|
110074
|
+
await writeFile36(fullPath, newContent, "utf-8");
|
|
109599
110075
|
logger.debug(`Updated ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
109600
110076
|
}
|
|
109601
110077
|
filesChanged++;
|
|
@@ -109701,7 +110177,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
109701
110177
|
|
|
109702
110178
|
// src/services/transformers/global-path-transformer.ts
|
|
109703
110179
|
init_logger();
|
|
109704
|
-
import { readFile as
|
|
110180
|
+
import { readFile as readFile63, readdir as readdir44, writeFile as writeFile37 } from "node:fs/promises";
|
|
109705
110181
|
import { homedir as homedir48, platform as platform16 } from "node:os";
|
|
109706
110182
|
import { extname as extname7, join as join139 } from "node:path";
|
|
109707
110183
|
var IS_WINDOWS3 = platform16() === "win32";
|
|
@@ -109852,12 +110328,12 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
109852
110328
|
await processDirectory2(fullPath);
|
|
109853
110329
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
109854
110330
|
try {
|
|
109855
|
-
const content = await
|
|
110331
|
+
const content = await readFile63(fullPath, "utf-8");
|
|
109856
110332
|
const { transformed, changes } = transformContent(content, {
|
|
109857
110333
|
targetClaudeDir: options2.targetClaudeDir
|
|
109858
110334
|
});
|
|
109859
110335
|
if (changes > 0) {
|
|
109860
|
-
await
|
|
110336
|
+
await writeFile37(fullPath, transformed, "utf-8");
|
|
109861
110337
|
filesTransformed++;
|
|
109862
110338
|
totalChanges += changes;
|
|
109863
110339
|
if (options2.verbose) {
|
|
@@ -110144,9 +110620,9 @@ async function initCommand(options2) {
|
|
|
110144
110620
|
init_dist2();
|
|
110145
110621
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
110146
110622
|
import { existsSync as existsSync68 } from "node:fs";
|
|
110147
|
-
import { readFile as
|
|
110623
|
+
import { readFile as readFile67, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
110148
110624
|
import { homedir as homedir52 } from "node:os";
|
|
110149
|
-
import { basename as basename30, join as join144, resolve as
|
|
110625
|
+
import { basename as basename30, join as join144, resolve as resolve48 } from "node:path";
|
|
110150
110626
|
init_logger();
|
|
110151
110627
|
|
|
110152
110628
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -110359,13 +110835,13 @@ init_model_taxonomy();
|
|
|
110359
110835
|
init_logger();
|
|
110360
110836
|
init_dist2();
|
|
110361
110837
|
init_model_taxonomy();
|
|
110362
|
-
import { mkdir as mkdir39, readFile as
|
|
110838
|
+
import { mkdir as mkdir39, readFile as readFile66, writeFile as writeFile39 } from "node:fs/promises";
|
|
110363
110839
|
import { homedir as homedir51 } from "node:os";
|
|
110364
110840
|
import { dirname as dirname45, join as join143 } from "node:path";
|
|
110365
110841
|
|
|
110366
110842
|
// src/commands/portable/models-dev-cache.ts
|
|
110367
110843
|
init_logger();
|
|
110368
|
-
import { mkdir as mkdir38, readFile as
|
|
110844
|
+
import { mkdir as mkdir38, readFile as readFile64, rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
|
|
110369
110845
|
import { homedir as homedir49 } from "node:os";
|
|
110370
110846
|
import { join as join141 } from "node:path";
|
|
110371
110847
|
|
|
@@ -110390,7 +110866,7 @@ function tmpFilePath(cacheDir) {
|
|
|
110390
110866
|
async function readCacheEntry(cacheDir) {
|
|
110391
110867
|
const filePath = cacheFilePath(cacheDir);
|
|
110392
110868
|
try {
|
|
110393
|
-
const raw2 = await
|
|
110869
|
+
const raw2 = await readFile64(filePath, "utf-8");
|
|
110394
110870
|
const parsed = JSON.parse(raw2);
|
|
110395
110871
|
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) {
|
|
110396
110872
|
return parsed;
|
|
@@ -110408,7 +110884,7 @@ async function writeCacheEntry(cacheDir, entry) {
|
|
|
110408
110884
|
await mkdir38(cacheDir, { recursive: true });
|
|
110409
110885
|
const tmp = tmpFilePath(cacheDir);
|
|
110410
110886
|
const dest = cacheFilePath(cacheDir);
|
|
110411
|
-
await
|
|
110887
|
+
await writeFile38(tmp, JSON.stringify(entry), "utf-8");
|
|
110412
110888
|
await rename14(tmp, dest);
|
|
110413
110889
|
}
|
|
110414
110890
|
async function fetchCatalog(fetcher) {
|
|
@@ -110458,7 +110934,7 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
110458
110934
|
|
|
110459
110935
|
// src/commands/portable/opencode-model-discovery.ts
|
|
110460
110936
|
init_logger();
|
|
110461
|
-
import { readFile as
|
|
110937
|
+
import { readFile as readFile65 } from "node:fs/promises";
|
|
110462
110938
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
110463
110939
|
import { join as join142 } from "node:path";
|
|
110464
110940
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
@@ -110472,7 +110948,7 @@ function resolveOpenCodeAuthPath(homeDir) {
|
|
|
110472
110948
|
async function readAuthedProviders(homeDir) {
|
|
110473
110949
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
110474
110950
|
try {
|
|
110475
|
-
const raw2 = await
|
|
110951
|
+
const raw2 = await readFile65(authPath, "utf-8");
|
|
110476
110952
|
const parsed = JSON.parse(raw2);
|
|
110477
110953
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
110478
110954
|
return Object.keys(parsed);
|
|
@@ -110674,7 +111150,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110674
111150
|
const configPath = getOpenCodeConfigPath(options2);
|
|
110675
111151
|
let existing = null;
|
|
110676
111152
|
try {
|
|
110677
|
-
const raw2 = await
|
|
111153
|
+
const raw2 = await readFile66(configPath, "utf-8");
|
|
110678
111154
|
const parsed = JSON.parse(raw2);
|
|
110679
111155
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
110680
111156
|
existing = parsed;
|
|
@@ -110715,7 +111191,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110715
111191
|
const chosenModel2 = response2.action === "custom" ? response2.value : suggestion2.model;
|
|
110716
111192
|
const next2 = { ...existing, model: chosenModel2 };
|
|
110717
111193
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110718
|
-
await
|
|
111194
|
+
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110719
111195
|
`, "utf-8");
|
|
110720
111196
|
return { path: configPath, action: "added", model: chosenModel2, reason: suggestion2.reason };
|
|
110721
111197
|
}
|
|
@@ -110726,7 +111202,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110726
111202
|
}
|
|
110727
111203
|
const next2 = { ...existing ?? {}, model: suggestion.model };
|
|
110728
111204
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110729
|
-
await
|
|
111205
|
+
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110730
111206
|
`, "utf-8");
|
|
110731
111207
|
return {
|
|
110732
111208
|
path: configPath,
|
|
@@ -110748,7 +111224,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110748
111224
|
const chosenModel = response.action === "custom" ? response.value : suggestion.ok ? suggestion.model : "";
|
|
110749
111225
|
const next = { ...existing ?? {}, model: chosenModel };
|
|
110750
111226
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110751
|
-
await
|
|
111227
|
+
await writeFile39(configPath, `${JSON.stringify(next, null, 2)}
|
|
110752
111228
|
`, "utf-8");
|
|
110753
111229
|
return {
|
|
110754
111230
|
path: configPath,
|
|
@@ -111391,6 +111867,46 @@ function appendMigrationWarningMessages(target, warnings) {
|
|
|
111391
111867
|
}
|
|
111392
111868
|
}
|
|
111393
111869
|
}
|
|
111870
|
+
function appendFallbackSkillActionsToPlan(plan, skills, selectedProviders, installGlobally) {
|
|
111871
|
+
if (skills.length === 0)
|
|
111872
|
+
return plan;
|
|
111873
|
+
const existingSkillKeys = new Set(plan.actions.filter((action) => action.type === "skill").map((action) => `${action.provider}\x00${String(action.global)}\x00${action.item}`));
|
|
111874
|
+
const fallbackActions = [];
|
|
111875
|
+
for (const provider of selectedProviders.filter((entry) => getProvidersSupporting("skills").includes(entry))) {
|
|
111876
|
+
const global3 = resolvePortableTypeGlobal(provider, "skill", installGlobally);
|
|
111877
|
+
const basePath = getPortableBasePath(provider, "skills", { global: global3 });
|
|
111878
|
+
if (!basePath)
|
|
111879
|
+
continue;
|
|
111880
|
+
for (const skill of skills) {
|
|
111881
|
+
const key = `${provider}\x00${String(global3)}\x00${skill.name}`;
|
|
111882
|
+
if (existingSkillKeys.has(key))
|
|
111883
|
+
continue;
|
|
111884
|
+
existingSkillKeys.add(key);
|
|
111885
|
+
fallbackActions.push({
|
|
111886
|
+
action: "install",
|
|
111887
|
+
global: global3,
|
|
111888
|
+
isDirectoryItem: true,
|
|
111889
|
+
item: skill.name,
|
|
111890
|
+
provider,
|
|
111891
|
+
reason: "New item, not previously installed",
|
|
111892
|
+
reasonCode: "new-item",
|
|
111893
|
+
reasonCopy: "New - not previously installed",
|
|
111894
|
+
targetPath: join144(basePath, skill.name),
|
|
111895
|
+
type: "skill"
|
|
111896
|
+
});
|
|
111897
|
+
}
|
|
111898
|
+
}
|
|
111899
|
+
if (fallbackActions.length === 0)
|
|
111900
|
+
return plan;
|
|
111901
|
+
return {
|
|
111902
|
+
...plan,
|
|
111903
|
+
actions: [...plan.actions, ...fallbackActions],
|
|
111904
|
+
summary: {
|
|
111905
|
+
...plan.summary,
|
|
111906
|
+
install: plan.summary.install + fallbackActions.length
|
|
111907
|
+
}
|
|
111908
|
+
};
|
|
111909
|
+
}
|
|
111394
111910
|
async function runInstallMode(options2, discoveredItems, _selectedProviders, _installGlobally) {
|
|
111395
111911
|
const interactive = process.stdout.isTTY && !options2.yes;
|
|
111396
111912
|
if (!interactive) {
|
|
@@ -111530,7 +112046,7 @@ function shouldExecuteAction2(action) {
|
|
|
111530
112046
|
}
|
|
111531
112047
|
async function executeDeleteAction(action, options2) {
|
|
111532
112048
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
111533
|
-
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(
|
|
112049
|
+
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve48(action.targetPath));
|
|
111534
112050
|
try {
|
|
111535
112051
|
if (!shouldPreserveTarget && action.targetPath && existsSync68(action.targetPath)) {
|
|
111536
112052
|
await rm18(action.targetPath, { recursive: true, force: true });
|
|
@@ -111560,15 +112076,48 @@ async function executeDeleteAction(action, options2) {
|
|
|
111560
112076
|
};
|
|
111561
112077
|
}
|
|
111562
112078
|
}
|
|
112079
|
+
function hasSuccessfulReplacementWrite(action, results) {
|
|
112080
|
+
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));
|
|
112081
|
+
}
|
|
112082
|
+
function replacementTypeMatches(actionType, resultType) {
|
|
112083
|
+
return resultType === actionType || actionType === "command" && resultType === "skill";
|
|
112084
|
+
}
|
|
112085
|
+
function replacementItemMatches(action, result) {
|
|
112086
|
+
if (result.itemName === action.item || result.itemName === undefined)
|
|
112087
|
+
return true;
|
|
112088
|
+
const parts = result.path.replace(/\\/g, "/").split("/");
|
|
112089
|
+
const leaf = parts.at(-1) ?? "";
|
|
112090
|
+
const parent = parts.at(-2) ?? "";
|
|
112091
|
+
const leafName = leaf.replace(/\.[^.]+$/, "");
|
|
112092
|
+
return leafName === action.item || parent === action.item || action.type === "command" && parent === `source-command-${action.item}`;
|
|
112093
|
+
}
|
|
112094
|
+
function shouldRunDeleteAction(action, results) {
|
|
112095
|
+
if (action.reasonCode !== "path-migrated-cleanup")
|
|
112096
|
+
return true;
|
|
112097
|
+
return hasSuccessfulReplacementWrite(action, results);
|
|
112098
|
+
}
|
|
112099
|
+
function createSkippedPathMigrationCleanupResult2(action) {
|
|
112100
|
+
return {
|
|
112101
|
+
operation: "delete",
|
|
112102
|
+
portableType: action.type,
|
|
112103
|
+
itemName: action.item,
|
|
112104
|
+
provider: action.provider,
|
|
112105
|
+
providerDisplayName: providers[action.provider]?.displayName || action.provider,
|
|
112106
|
+
success: true,
|
|
112107
|
+
path: action.targetPath,
|
|
112108
|
+
skipped: true,
|
|
112109
|
+
skipReason: "Legacy path cleanup skipped because no successful replacement write was recorded"
|
|
112110
|
+
};
|
|
112111
|
+
}
|
|
111563
112112
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
111564
112113
|
if (!skillSourcePath)
|
|
111565
112114
|
return;
|
|
111566
|
-
const sourceMetadataPath = join144(
|
|
112115
|
+
const sourceMetadataPath = join144(resolve48(skillSourcePath, ".."), "metadata.json");
|
|
111567
112116
|
if (!existsSync68(sourceMetadataPath))
|
|
111568
112117
|
return;
|
|
111569
112118
|
let sourceMetadata;
|
|
111570
112119
|
try {
|
|
111571
|
-
const content = await
|
|
112120
|
+
const content = await readFile67(sourceMetadataPath, "utf-8");
|
|
111572
112121
|
sourceMetadata = JSON.parse(content);
|
|
111573
112122
|
} catch (error) {
|
|
111574
112123
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -111848,7 +112397,7 @@ async function migrateCommand(options2) {
|
|
|
111848
112397
|
types: config.types?.filter((type) => type !== "skill")
|
|
111849
112398
|
})), portableTypes);
|
|
111850
112399
|
const reinstallEmptyDirs = options2.respectDeletions ? false : options2.reinstallEmptyDirs ?? true;
|
|
111851
|
-
const plan = reconcile({
|
|
112400
|
+
const plan = appendFallbackSkillActionsToPlan(reconcile({
|
|
111852
112401
|
sourceItems: sourceStates,
|
|
111853
112402
|
registry,
|
|
111854
112403
|
targetStates,
|
|
@@ -111856,13 +112405,13 @@ async function migrateCommand(options2) {
|
|
|
111856
112405
|
force: options2.force,
|
|
111857
112406
|
typeDirectoryStates,
|
|
111858
112407
|
respectDeletions: !reinstallEmptyDirs
|
|
111859
|
-
});
|
|
112408
|
+
}), effectiveSkills, selectedProviders, installGlobally);
|
|
111860
112409
|
reconcileSpinner.stop("Plan computed");
|
|
111861
112410
|
const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
111862
112411
|
renderBanners(plan.banners);
|
|
111863
112412
|
displayReconcilePlan(plan, { color: useColor });
|
|
111864
112413
|
if (options2.dryRun) {
|
|
111865
|
-
displayMigrationSummary(plan,
|
|
112414
|
+
displayMigrationSummary(plan, [], { color: useColor, dryRun: true });
|
|
111866
112415
|
return;
|
|
111867
112416
|
}
|
|
111868
112417
|
if (plan.hasConflicts) {
|
|
@@ -111871,7 +112420,7 @@ async function migrateCommand(options2) {
|
|
|
111871
112420
|
for (const action of conflictActions) {
|
|
111872
112421
|
if (!action.diff && action.targetPath && existsSync68(action.targetPath)) {
|
|
111873
112422
|
try {
|
|
111874
|
-
const targetContent = await
|
|
112423
|
+
const targetContent = await readFile67(action.targetPath, "utf-8");
|
|
111875
112424
|
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);
|
|
111876
112425
|
if (sourceItem) {
|
|
111877
112426
|
const providerConfig = providers[action.provider];
|
|
@@ -111965,26 +112514,12 @@ async function migrateCommand(options2) {
|
|
|
111965
112514
|
writeTasks.push({ item, provider, type: "hooks", global: action.global });
|
|
111966
112515
|
}
|
|
111967
112516
|
}
|
|
111968
|
-
const plannedSkillActions = plannedExecActions.filter((action) => action.type === "skill").length;
|
|
111969
|
-
if (effectiveSkills.length > 0 && plannedSkillActions === 0) {
|
|
111970
|
-
const skillProviders = selectedProviders.filter((pv) => getProvidersSupporting("skills").includes(pv));
|
|
111971
|
-
for (const provider of skillProviders) {
|
|
111972
|
-
for (const skill of effectiveSkills) {
|
|
111973
|
-
writeTasks.push({
|
|
111974
|
-
item: skill,
|
|
111975
|
-
provider,
|
|
111976
|
-
type: "skill",
|
|
111977
|
-
global: resolvePortableTypeGlobal(provider, "skill", installGlobally)
|
|
111978
|
-
});
|
|
111979
|
-
}
|
|
111980
|
-
}
|
|
111981
|
-
}
|
|
111982
112517
|
const progressSink = createMigrateProgressSink(writeTasks.length + plannedDeleteActions.length);
|
|
111983
112518
|
const writtenPaths = new Set;
|
|
111984
112519
|
const recordSuccessfulWrites = (task, taskResults) => {
|
|
111985
112520
|
for (const result of taskResults.filter((entry) => entry.success && !entry.skipped)) {
|
|
111986
112521
|
if (result.path.length > 0) {
|
|
111987
|
-
writtenPaths.add(
|
|
112522
|
+
writtenPaths.add(resolve48(result.path));
|
|
111988
112523
|
}
|
|
111989
112524
|
if (task.type === "hooks") {
|
|
111990
112525
|
const existing = successfulHookFiles.get(task.provider) ?? {
|
|
@@ -111995,7 +112530,7 @@ async function migrateCommand(options2) {
|
|
|
111995
112530
|
successfulHookFiles.set(task.provider, existing);
|
|
111996
112531
|
if (result.path.length > 0) {
|
|
111997
112532
|
const absExisting = successfulHookAbsPaths.get(task.provider) ?? [];
|
|
111998
|
-
absExisting.push(
|
|
112533
|
+
absExisting.push(resolve48(result.path));
|
|
111999
112534
|
successfulHookAbsPaths.set(task.provider, absExisting);
|
|
112000
112535
|
}
|
|
112001
112536
|
}
|
|
@@ -112100,6 +112635,11 @@ async function migrateCommand(options2) {
|
|
|
112100
112635
|
}
|
|
112101
112636
|
await processMetadataDeletions(skillSource, installGlobally);
|
|
112102
112637
|
for (const deleteAction of plannedDeleteActions) {
|
|
112638
|
+
if (!shouldRunDeleteAction(deleteAction, allResults)) {
|
|
112639
|
+
allResults.push(createSkippedPathMigrationCleanupResult2(deleteAction));
|
|
112640
|
+
progressSink.tick("Cleanup");
|
|
112641
|
+
continue;
|
|
112642
|
+
}
|
|
112103
112643
|
allResults.push(await executeDeleteAction(deleteAction, {
|
|
112104
112644
|
preservePaths: writtenPaths
|
|
112105
112645
|
}));
|
|
@@ -112138,7 +112678,7 @@ async function migrateCommand(options2) {
|
|
|
112138
112678
|
}
|
|
112139
112679
|
}
|
|
112140
112680
|
try {
|
|
112141
|
-
const kitRoot = (agentSource ?
|
|
112681
|
+
const kitRoot = (agentSource ? resolve48(agentSource, "..") : null) ?? (commandSource ? resolve48(commandSource, "..") : null) ?? (skillSource ? resolve48(skillSource, "..") : null) ?? null;
|
|
112142
112682
|
const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
|
|
112143
112683
|
if (manifest?.cliVersion) {
|
|
112144
112684
|
await updateAppliedManifestVersion(manifest.cliVersion);
|
|
@@ -112301,32 +112841,6 @@ function progressLabelForType(type) {
|
|
|
112301
112841
|
return "Migrating";
|
|
112302
112842
|
}
|
|
112303
112843
|
}
|
|
112304
|
-
function buildDryRunFallbackResults(skills, selectedProviders, installGlobally, plannedActions) {
|
|
112305
|
-
const plannedSkillActions = plannedActions.filter((action) => action.type === "skill").length;
|
|
112306
|
-
if (skills.length === 0 || plannedSkillActions > 0) {
|
|
112307
|
-
return [];
|
|
112308
|
-
}
|
|
112309
|
-
const results = [];
|
|
112310
|
-
for (const provider of selectedProviders.filter((entry) => getProvidersSupporting("skills").includes(entry))) {
|
|
112311
|
-
const basePath = getPortableBasePath(provider, "skills", {
|
|
112312
|
-
global: resolvePortableTypeGlobal(provider, "skill", installGlobally)
|
|
112313
|
-
});
|
|
112314
|
-
if (!basePath)
|
|
112315
|
-
continue;
|
|
112316
|
-
for (const skill of skills) {
|
|
112317
|
-
results.push({
|
|
112318
|
-
itemName: skill.name,
|
|
112319
|
-
operation: "apply",
|
|
112320
|
-
path: join144(basePath, skill.name),
|
|
112321
|
-
portableType: "skill",
|
|
112322
|
-
provider,
|
|
112323
|
-
providerDisplayName: providers[provider].displayName,
|
|
112324
|
-
success: true
|
|
112325
|
-
});
|
|
112326
|
-
}
|
|
112327
|
-
}
|
|
112328
|
-
return results;
|
|
112329
|
-
}
|
|
112330
112844
|
// src/commands/new/new-command.ts
|
|
112331
112845
|
init_logger();
|
|
112332
112846
|
init_safe_prompts();
|
|
@@ -112335,7 +112849,7 @@ var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
|
112335
112849
|
|
|
112336
112850
|
// src/commands/new/phases/directory-setup.ts
|
|
112337
112851
|
init_config_manager();
|
|
112338
|
-
import { resolve as
|
|
112852
|
+
import { resolve as resolve49 } from "node:path";
|
|
112339
112853
|
init_logger();
|
|
112340
112854
|
init_path_resolver();
|
|
112341
112855
|
init_types3();
|
|
@@ -112420,7 +112934,7 @@ async function directorySetup(validOptions, prompts) {
|
|
|
112420
112934
|
targetDir = await prompts.getDirectory(targetDir);
|
|
112421
112935
|
}
|
|
112422
112936
|
}
|
|
112423
|
-
const resolvedDir =
|
|
112937
|
+
const resolvedDir = resolve49(targetDir);
|
|
112424
112938
|
logger.info(`Target directory: ${resolvedDir}`);
|
|
112425
112939
|
if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
|
|
112426
112940
|
logger.warning("You're creating a project at HOME directory.");
|
|
@@ -112754,7 +113268,7 @@ Please use only one download method.`);
|
|
|
112754
113268
|
// src/commands/plan/plan-command.ts
|
|
112755
113269
|
init_output_manager();
|
|
112756
113270
|
import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
|
|
112757
|
-
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as
|
|
113271
|
+
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as resolve53 } from "node:path";
|
|
112758
113272
|
|
|
112759
113273
|
// src/commands/plan/plan-read-handlers.ts
|
|
112760
113274
|
init_config();
|
|
@@ -112764,7 +113278,7 @@ init_logger();
|
|
|
112764
113278
|
init_output_manager();
|
|
112765
113279
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
112766
113280
|
import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
|
|
112767
|
-
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as
|
|
113281
|
+
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as resolve51 } from "node:path";
|
|
112768
113282
|
|
|
112769
113283
|
// src/commands/plan/plan-dependencies.ts
|
|
112770
113284
|
init_config();
|
|
@@ -112822,14 +113336,14 @@ init_config();
|
|
|
112822
113336
|
init_plan_parser();
|
|
112823
113337
|
init_plan_scope();
|
|
112824
113338
|
init_plans_registry();
|
|
112825
|
-
import { isAbsolute as isAbsolute13, resolve as
|
|
113339
|
+
import { isAbsolute as isAbsolute13, resolve as resolve50 } from "node:path";
|
|
112826
113340
|
async function getGlobalPlansDirFromCwd() {
|
|
112827
113341
|
const projectRoot = findProjectRoot(process.cwd());
|
|
112828
113342
|
const { config } = await CkConfigManager.loadFull(projectRoot);
|
|
112829
113343
|
return resolveGlobalPlansDir(config);
|
|
112830
113344
|
}
|
|
112831
113345
|
function resolveTargetFromBase(target, baseDir) {
|
|
112832
|
-
const resolvedTarget = isAbsolute13(target) ?
|
|
113346
|
+
const resolvedTarget = isAbsolute13(target) ? resolve50(target) : resolve50(baseDir, target);
|
|
112833
113347
|
return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
|
|
112834
113348
|
}
|
|
112835
113349
|
|
|
@@ -112932,7 +113446,7 @@ async function handleStatus(target, options2) {
|
|
|
112932
113446
|
return;
|
|
112933
113447
|
}
|
|
112934
113448
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
112935
|
-
const t = effectiveTarget ?
|
|
113449
|
+
const t = effectiveTarget ? resolve51(effectiveTarget) : null;
|
|
112936
113450
|
const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(join148(t, "plan.md")) ? t : null;
|
|
112937
113451
|
if (plansDir) {
|
|
112938
113452
|
const planFiles = scanPlanDir(plansDir);
|
|
@@ -113117,7 +113631,7 @@ init_plan_parser();
|
|
|
113117
113631
|
init_plans_registry();
|
|
113118
113632
|
init_output_manager();
|
|
113119
113633
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
113120
|
-
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as
|
|
113634
|
+
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as resolve52 } from "node:path";
|
|
113121
113635
|
function quoteReadTarget(filePath) {
|
|
113122
113636
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
113123
113637
|
}
|
|
@@ -113160,13 +113674,13 @@ async function handleCreate(target, options2) {
|
|
|
113160
113674
|
return;
|
|
113161
113675
|
}
|
|
113162
113676
|
const globalBaseDir = options2.global ? await getGlobalPlansDirFromCwd() : undefined;
|
|
113163
|
-
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) :
|
|
113677
|
+
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve52(dir);
|
|
113164
113678
|
if (globalBaseDir && !resolvedDir) {
|
|
113165
113679
|
output.error("[X] Target directory must stay within the configured global plans root");
|
|
113166
113680
|
process.exitCode = 1;
|
|
113167
113681
|
return;
|
|
113168
113682
|
}
|
|
113169
|
-
const safeResolvedDir = resolvedDir ??
|
|
113683
|
+
const safeResolvedDir = resolvedDir ?? resolve52(dir);
|
|
113170
113684
|
const result = scaffoldPlan({
|
|
113171
113685
|
title: options2.title,
|
|
113172
113686
|
phases: phaseNames.map((name2) => ({ name: name2 })),
|
|
@@ -113345,19 +113859,19 @@ async function handleAddPhase(target, options2) {
|
|
|
113345
113859
|
// src/commands/plan/plan-command.ts
|
|
113346
113860
|
function resolveTargetPath(target, baseDir) {
|
|
113347
113861
|
if (!baseDir) {
|
|
113348
|
-
return
|
|
113862
|
+
return resolve53(target);
|
|
113349
113863
|
}
|
|
113350
113864
|
if (isAbsolute14(target)) {
|
|
113351
|
-
return
|
|
113865
|
+
return resolve53(target);
|
|
113352
113866
|
}
|
|
113353
|
-
const cwdCandidate =
|
|
113867
|
+
const cwdCandidate = resolve53(target);
|
|
113354
113868
|
if (existsSync71(cwdCandidate)) {
|
|
113355
113869
|
return cwdCandidate;
|
|
113356
113870
|
}
|
|
113357
|
-
return
|
|
113871
|
+
return resolve53(baseDir, target);
|
|
113358
113872
|
}
|
|
113359
113873
|
function resolvePlanFile(target, baseDir) {
|
|
113360
|
-
const t = target ? resolveTargetPath(target, baseDir) : baseDir ?
|
|
113874
|
+
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve53(baseDir) : process.cwd();
|
|
113361
113875
|
if (existsSync71(t)) {
|
|
113362
113876
|
const stat24 = statSync12(t);
|
|
113363
113877
|
if (stat24.isFile())
|
|
@@ -113421,7 +113935,7 @@ async function planCommand(action, target, options2) {
|
|
|
113421
113935
|
let resolvedTarget = target;
|
|
113422
113936
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
113423
113937
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
113424
|
-
const existsOnDisk = !looksLikePath && existsSync71(
|
|
113938
|
+
const existsOnDisk = !looksLikePath && existsSync71(resolve53(resolvedAction));
|
|
113425
113939
|
if (looksLikePath || existsOnDisk) {
|
|
113426
113940
|
resolvedTarget = resolvedAction;
|
|
113427
113941
|
resolvedAction = undefined;
|
|
@@ -113464,11 +113978,11 @@ init_logger();
|
|
|
113464
113978
|
init_safe_prompts();
|
|
113465
113979
|
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
113466
113980
|
import { existsSync as existsSync72 } from "node:fs";
|
|
113467
|
-
import { resolve as
|
|
113981
|
+
import { resolve as resolve54 } from "node:path";
|
|
113468
113982
|
async function handleAdd(projectPath, options2) {
|
|
113469
113983
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
113470
113984
|
intro("Add Project");
|
|
113471
|
-
const absolutePath =
|
|
113985
|
+
const absolutePath = resolve54(projectPath);
|
|
113472
113986
|
if (!existsSync72(absolutePath)) {
|
|
113473
113987
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
113474
113988
|
process.exitCode = 1;
|
|
@@ -113889,11 +114403,11 @@ init_logger();
|
|
|
113889
114403
|
init_agents();
|
|
113890
114404
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
113891
114405
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
113892
|
-
import { readFile as
|
|
114406
|
+
import { readFile as readFile68 } from "node:fs/promises";
|
|
113893
114407
|
import { join as join151 } from "node:path";
|
|
113894
114408
|
|
|
113895
114409
|
// src/commands/skills/installed-skills-inventory.ts
|
|
113896
|
-
import { join as join150, resolve as
|
|
114410
|
+
import { join as join150, resolve as resolve55 } from "node:path";
|
|
113897
114411
|
init_path_resolver();
|
|
113898
114412
|
var SCOPE_SORT_ORDER = {
|
|
113899
114413
|
project: 0,
|
|
@@ -113901,8 +114415,8 @@ var SCOPE_SORT_ORDER = {
|
|
|
113901
114415
|
};
|
|
113902
114416
|
async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
113903
114417
|
const projectDir = options2.projectDir ?? process.cwd();
|
|
113904
|
-
const globalDir =
|
|
113905
|
-
const projectClaudeDir =
|
|
114418
|
+
const globalDir = resolve55(options2.globalDir ?? PathResolver.getGlobalKitDir());
|
|
114419
|
+
const projectClaudeDir = resolve55(projectDir, ".claude");
|
|
113906
114420
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
113907
114421
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
113908
114422
|
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join150(projectClaudeDir, "skills")),
|
|
@@ -113945,6 +114459,7 @@ var AgentType = exports_external.enum([
|
|
|
113945
114459
|
"github-copilot",
|
|
113946
114460
|
"amp",
|
|
113947
114461
|
"kilo",
|
|
114462
|
+
"kiro",
|
|
113948
114463
|
"roo",
|
|
113949
114464
|
"windsurf",
|
|
113950
114465
|
"cline",
|
|
@@ -114068,7 +114583,7 @@ async function handleValidate2(sourcePath) {
|
|
|
114068
114583
|
for (const skill of skills) {
|
|
114069
114584
|
const skillMdPath = join151(skill.path, "SKILL.md");
|
|
114070
114585
|
try {
|
|
114071
|
-
const content = await
|
|
114586
|
+
const content = await readFile68(skillMdPath, "utf-8");
|
|
114072
114587
|
const { data } = import_gray_matter12.default(content, {
|
|
114073
114588
|
engines: { javascript: { parse: () => ({}) } }
|
|
114074
114589
|
});
|
|
@@ -114649,7 +115164,7 @@ async function detectInstallations() {
|
|
|
114649
115164
|
|
|
114650
115165
|
// src/commands/uninstall/removal-handler.ts
|
|
114651
115166
|
import { readdirSync as readdirSync12, rmSync as rmSync5 } from "node:fs";
|
|
114652
|
-
import { basename as basename33, join as join153, resolve as
|
|
115167
|
+
import { basename as basename33, join as join153, resolve as resolve56, sep as sep13 } from "node:path";
|
|
114653
115168
|
init_logger();
|
|
114654
115169
|
init_safe_prompts();
|
|
114655
115170
|
init_safe_spinner();
|
|
@@ -114833,17 +115348,17 @@ async function restoreUninstallBackup(backup) {
|
|
|
114833
115348
|
}
|
|
114834
115349
|
async function isPathSafeToRemove(filePath, baseDir) {
|
|
114835
115350
|
try {
|
|
114836
|
-
const resolvedPath =
|
|
114837
|
-
const resolvedBase =
|
|
114838
|
-
if (!resolvedPath.startsWith(resolvedBase +
|
|
115351
|
+
const resolvedPath = resolve56(filePath);
|
|
115352
|
+
const resolvedBase = resolve56(baseDir);
|
|
115353
|
+
if (!resolvedPath.startsWith(resolvedBase + sep13) && resolvedPath !== resolvedBase) {
|
|
114839
115354
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
114840
115355
|
return false;
|
|
114841
115356
|
}
|
|
114842
115357
|
const stats = await import_fs_extra43.lstat(filePath);
|
|
114843
115358
|
if (stats.isSymbolicLink()) {
|
|
114844
115359
|
const realPath = await import_fs_extra43.realpath(filePath);
|
|
114845
|
-
const resolvedReal =
|
|
114846
|
-
if (!resolvedReal.startsWith(resolvedBase +
|
|
115360
|
+
const resolvedReal = resolve56(realPath);
|
|
115361
|
+
if (!resolvedReal.startsWith(resolvedBase + sep13) && resolvedReal !== resolvedBase) {
|
|
114847
115362
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
114848
115363
|
return false;
|
|
114849
115364
|
}
|
|
@@ -115380,7 +115895,7 @@ function getDisclaimerMarker() {
|
|
|
115380
115895
|
return AI_DISCLAIMER;
|
|
115381
115896
|
}
|
|
115382
115897
|
function spawnAndCollect2(command, args) {
|
|
115383
|
-
return new Promise((
|
|
115898
|
+
return new Promise((resolve57, reject) => {
|
|
115384
115899
|
const child = spawn6(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115385
115900
|
const chunks = [];
|
|
115386
115901
|
const stderrChunks = [];
|
|
@@ -115393,7 +115908,7 @@ function spawnAndCollect2(command, args) {
|
|
|
115393
115908
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115394
115909
|
return;
|
|
115395
115910
|
}
|
|
115396
|
-
|
|
115911
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115397
115912
|
});
|
|
115398
115913
|
});
|
|
115399
115914
|
}
|
|
@@ -115501,7 +116016,7 @@ function formatResponse(content, showBranding) {
|
|
|
115501
116016
|
return disclaimer + formatted + branding;
|
|
115502
116017
|
}
|
|
115503
116018
|
async function postViaGh(owner, repo, issueNumber, body) {
|
|
115504
|
-
return new Promise((
|
|
116019
|
+
return new Promise((resolve57, reject) => {
|
|
115505
116020
|
const args = [
|
|
115506
116021
|
"issue",
|
|
115507
116022
|
"comment",
|
|
@@ -115523,7 +116038,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
|
|
|
115523
116038
|
reject(new Error(`gh exited with code ${code2}: ${stderr}`));
|
|
115524
116039
|
return;
|
|
115525
116040
|
}
|
|
115526
|
-
|
|
116041
|
+
resolve57();
|
|
115527
116042
|
});
|
|
115528
116043
|
});
|
|
115529
116044
|
}
|
|
@@ -115641,7 +116156,7 @@ After completing the implementation:
|
|
|
115641
116156
|
"--allowedTools",
|
|
115642
116157
|
tools
|
|
115643
116158
|
];
|
|
115644
|
-
await new Promise((
|
|
116159
|
+
await new Promise((resolve57, reject) => {
|
|
115645
116160
|
const child = spawn8("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
|
|
115646
116161
|
child.stdin.write(prompt);
|
|
115647
116162
|
child.stdin.end();
|
|
@@ -115666,7 +116181,7 @@ After completing the implementation:
|
|
|
115666
116181
|
reject(new Error(`Claude exited ${code2}: ${stderr.slice(0, 500)}`));
|
|
115667
116182
|
return;
|
|
115668
116183
|
}
|
|
115669
|
-
|
|
116184
|
+
resolve57();
|
|
115670
116185
|
});
|
|
115671
116186
|
});
|
|
115672
116187
|
}
|
|
@@ -115810,7 +116325,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
|
|
|
115810
116325
|
return processedThisHour < maxPerHour;
|
|
115811
116326
|
}
|
|
115812
116327
|
function spawnAndCollect3(command, args) {
|
|
115813
|
-
return new Promise((
|
|
116328
|
+
return new Promise((resolve57, reject) => {
|
|
115814
116329
|
const child = spawn9(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115815
116330
|
const chunks = [];
|
|
115816
116331
|
const stderrChunks = [];
|
|
@@ -115823,13 +116338,13 @@ function spawnAndCollect3(command, args) {
|
|
|
115823
116338
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115824
116339
|
return;
|
|
115825
116340
|
}
|
|
115826
|
-
|
|
116341
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115827
116342
|
});
|
|
115828
116343
|
});
|
|
115829
116344
|
}
|
|
115830
116345
|
|
|
115831
116346
|
// src/commands/watch/phases/issue-processor.ts
|
|
115832
|
-
import { mkdir as mkdir40, writeFile as
|
|
116347
|
+
import { mkdir as mkdir40, writeFile as writeFile41 } from "node:fs/promises";
|
|
115833
116348
|
import { join as join156 } from "node:path";
|
|
115834
116349
|
|
|
115835
116350
|
// src/commands/watch/phases/approval-detector.ts
|
|
@@ -115875,7 +116390,7 @@ async function invokeClaude(options2) {
|
|
|
115875
116390
|
return collectClaudeOutput(child, options2.timeoutSec, verbose);
|
|
115876
116391
|
}
|
|
115877
116392
|
function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
115878
|
-
return new Promise((
|
|
116393
|
+
return new Promise((resolve57, reject) => {
|
|
115879
116394
|
const chunks = [];
|
|
115880
116395
|
const stderrChunks = [];
|
|
115881
116396
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -115905,7 +116420,7 @@ function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
|
115905
116420
|
reject(new Error(`Claude exited with code ${code2}: ${stderr}`));
|
|
115906
116421
|
return;
|
|
115907
116422
|
}
|
|
115908
|
-
|
|
116423
|
+
resolve57(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
|
|
115909
116424
|
});
|
|
115910
116425
|
});
|
|
115911
116426
|
}
|
|
@@ -116464,7 +116979,7 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
116464
116979
|
const planDir = join156(projectDir, "plans", "watch");
|
|
116465
116980
|
await mkdir40(planDir, { recursive: true });
|
|
116466
116981
|
const planFilePath = join156(planDir, `issue-${issue.number}-plan.md`);
|
|
116467
|
-
await
|
|
116982
|
+
await writeFile41(planFilePath, planResult.planText, "utf-8");
|
|
116468
116983
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
116469
116984
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
116470
116985
|
} catch (err) {
|
|
@@ -116609,7 +117124,7 @@ init_ck_config_manager();
|
|
|
116609
117124
|
init_file_io();
|
|
116610
117125
|
init_logger();
|
|
116611
117126
|
import { existsSync as existsSync74 } from "node:fs";
|
|
116612
|
-
import { mkdir as mkdir41, readFile as
|
|
117127
|
+
import { mkdir as mkdir41, readFile as readFile70 } from "node:fs/promises";
|
|
116613
117128
|
import { dirname as dirname52 } from "node:path";
|
|
116614
117129
|
var PROCESSED_ISSUES_CAP = 500;
|
|
116615
117130
|
async function readCkJson(projectDir) {
|
|
@@ -116617,7 +117132,7 @@ async function readCkJson(projectDir) {
|
|
|
116617
117132
|
try {
|
|
116618
117133
|
if (!existsSync74(configPath))
|
|
116619
117134
|
return {};
|
|
116620
|
-
const content = await
|
|
117135
|
+
const content = await readFile70(configPath, "utf-8");
|
|
116621
117136
|
return JSON.parse(content);
|
|
116622
117137
|
} catch (error) {
|
|
116623
117138
|
logger.warning(`Failed to parse .ck.json: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -117169,7 +117684,7 @@ function formatQueueInfo(state) {
|
|
|
117169
117684
|
return "idle";
|
|
117170
117685
|
}
|
|
117171
117686
|
function sleep(ms) {
|
|
117172
|
-
return new Promise((
|
|
117687
|
+
return new Promise((resolve57) => setTimeout(resolve57, ms));
|
|
117173
117688
|
}
|
|
117174
117689
|
// src/cli/command-registry.ts
|
|
117175
117690
|
init_logger();
|
|
@@ -117329,7 +117844,7 @@ init_types3();
|
|
|
117329
117844
|
init_logger();
|
|
117330
117845
|
init_path_resolver();
|
|
117331
117846
|
import { existsSync as existsSync89 } from "node:fs";
|
|
117332
|
-
import { mkdir as mkdir43, readFile as
|
|
117847
|
+
import { mkdir as mkdir43, readFile as readFile72, writeFile as writeFile44 } from "node:fs/promises";
|
|
117333
117848
|
import { join as join171 } from "node:path";
|
|
117334
117849
|
|
|
117335
117850
|
class VersionCacheManager {
|
|
@@ -117346,7 +117861,7 @@ class VersionCacheManager {
|
|
|
117346
117861
|
logger.debug("Version check cache not found");
|
|
117347
117862
|
return null;
|
|
117348
117863
|
}
|
|
117349
|
-
const content = await
|
|
117864
|
+
const content = await readFile72(cacheFile, "utf-8");
|
|
117350
117865
|
const cache5 = JSON.parse(content);
|
|
117351
117866
|
if (!cache5.lastCheck || !cache5.currentVersion || !cache5.latestVersion) {
|
|
117352
117867
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -117366,7 +117881,7 @@ class VersionCacheManager {
|
|
|
117366
117881
|
if (!existsSync89(cacheDir)) {
|
|
117367
117882
|
await mkdir43(cacheDir, { recursive: true, mode: 448 });
|
|
117368
117883
|
}
|
|
117369
|
-
await
|
|
117884
|
+
await writeFile44(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
|
|
117370
117885
|
logger.debug(`Version check cache saved to ${cacheFile}`);
|
|
117371
117886
|
} catch (error) {
|
|
117372
117887
|
logger.debug(`Failed to save version check cache: ${error}`);
|