claudekit-cli 4.4.0-dev.9 → 4.5.0-dev.1
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
|
@@ -10652,7 +10652,7 @@ var require_gray_matter = __commonJS((exports, module) => {
|
|
|
10652
10652
|
// src/commands/portable/hook-migration-compatibility.ts
|
|
10653
10653
|
import path from "node:path";
|
|
10654
10654
|
function normalizeHookAssetPath(value) {
|
|
10655
|
-
return value.replace(/\\/g, "/").replace(/^["']|["']$/g, "").replace(/[),;]+$/, "").replace(/^\.\//, "").replace(/^\$HOME\/\.claude\/hooks\//, "").replace(/^\$HOME\/\.codex\/hooks\//, "").replace(/^~\/\.claude\/hooks\//, "").replace(/^~\/\.codex\/hooks\//, "").replace(/^\.claude\/hooks\//, "").replace(/^\.codex\/hooks\//, "").replace(/^hooks\//, "").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
10655
|
+
return value.trim().replace(/\\/g, "/").replace(/^["']|["']$/g, "").replace(/[),;]+$/, "").replace(/^["']|["']$/g, "").replace(/^\.\//, "").replace(/^\$CLAUDE_PROJECT_DIR"?\/\.claude\/hooks\//, "").replace(/^\$CLAUDE_PROJECT_DIR"?\/\.codex\/hooks\//, "").replace(/^\$\{CLAUDE_PROJECT_DIR\}"?\/\.claude\/hooks\//, "").replace(/^\$\{CLAUDE_PROJECT_DIR\}"?\/\.codex\/hooks\//, "").replace(/^%CLAUDE_PROJECT_DIR%"?\/\.claude\/hooks\//, "").replace(/^%CLAUDE_PROJECT_DIR%"?\/\.codex\/hooks\//, "").replace(/^\$HOME\/\.claude\/hooks\//, "").replace(/^\$HOME\/\.codex\/hooks\//, "").replace(/^%USERPROFILE%\/\.claude\/hooks\//, "").replace(/^%USERPROFILE%\/\.codex\/hooks\//, "").replace(/^~\/\.claude\/hooks\//, "").replace(/^~\/\.codex\/hooks\//, "").replace(/^\.claude\/hooks\//, "").replace(/^\.codex\/hooks\//, "").replace(/^hooks\//, "").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
10656
10656
|
}
|
|
10657
10657
|
function hookAssetBasename(value) {
|
|
10658
10658
|
return path.posix.basename(normalizeHookAssetPath(value));
|
|
@@ -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-dev.1",
|
|
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
|
}
|
|
@@ -67069,7 +67363,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
67069
67363
|
|
|
67070
67364
|
// src/domains/versioning/release-cache.ts
|
|
67071
67365
|
import { existsSync as existsSync46 } from "node:fs";
|
|
67072
|
-
import { mkdir as mkdir18, readFile as
|
|
67366
|
+
import { mkdir as mkdir18, readFile as readFile37, unlink as unlink8, writeFile as writeFile20 } from "node:fs/promises";
|
|
67073
67367
|
import { join as join67 } from "node:path";
|
|
67074
67368
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
67075
67369
|
var init_release_cache = __esm(() => {
|
|
@@ -67094,7 +67388,7 @@ var init_release_cache = __esm(() => {
|
|
|
67094
67388
|
logger.debug(`Release cache not found for key: ${key}`);
|
|
67095
67389
|
return null;
|
|
67096
67390
|
}
|
|
67097
|
-
const content = await
|
|
67391
|
+
const content = await readFile37(cacheFile, "utf-8");
|
|
67098
67392
|
const parsed = JSON.parse(content);
|
|
67099
67393
|
const cacheEntry = ReleaseCacheEntrySchema.parse(parsed);
|
|
67100
67394
|
if (this.isExpired(cacheEntry.timestamp)) {
|
|
@@ -67120,7 +67414,7 @@ var init_release_cache = __esm(() => {
|
|
|
67120
67414
|
timestamp: Date.now(),
|
|
67121
67415
|
releases
|
|
67122
67416
|
};
|
|
67123
|
-
await
|
|
67417
|
+
await writeFile20(cacheFile, JSON.stringify(cacheEntry, null, 2), "utf-8");
|
|
67124
67418
|
logger.debug(`Release cache set for key: ${key}, cached ${releases.length} releases`);
|
|
67125
67419
|
} catch (error) {
|
|
67126
67420
|
logger.debug(`Failed to set release cache for key ${key}: ${error}`);
|
|
@@ -68496,7 +68790,7 @@ var init_update_cli = __esm(() => {
|
|
|
68496
68790
|
});
|
|
68497
68791
|
|
|
68498
68792
|
// src/domains/sync/config-version-checker.ts
|
|
68499
|
-
import { mkdir as mkdir19, readFile as
|
|
68793
|
+
import { mkdir as mkdir19, readFile as readFile39, unlink as unlink9, writeFile as writeFile21 } from "node:fs/promises";
|
|
68500
68794
|
import { join as join69 } from "node:path";
|
|
68501
68795
|
function parseCacheTtl() {
|
|
68502
68796
|
const envValue = process.env.CK_SYNC_CACHE_TTL;
|
|
@@ -68581,7 +68875,7 @@ class ConfigVersionChecker {
|
|
|
68581
68875
|
}
|
|
68582
68876
|
for (const cachePath of cachePaths) {
|
|
68583
68877
|
try {
|
|
68584
|
-
const data = await
|
|
68878
|
+
const data = await readFile39(cachePath, "utf8");
|
|
68585
68879
|
const parsed = JSON.parse(data);
|
|
68586
68880
|
if (typeof parsed !== "object" || parsed === null || typeof parsed.lastCheck !== "number" || typeof parsed.latestVersion !== "string" || !parsed.latestVersion || parsed.lastCheck < 0 || parsed.lastCheck > Date.now() + 7 * 24 * 60 * 60 * 1000) {
|
|
68587
68881
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -68599,7 +68893,7 @@ class ConfigVersionChecker {
|
|
|
68599
68893
|
const cachePath = ConfigVersionChecker.getCacheFilePath(kitType, global3, channel);
|
|
68600
68894
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
68601
68895
|
await mkdir19(cacheDir, { recursive: true });
|
|
68602
|
-
await
|
|
68896
|
+
await writeFile21(cachePath, JSON.stringify(cache3, null, 2));
|
|
68603
68897
|
} catch (error) {
|
|
68604
68898
|
logger.debug(`Cache write failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
68605
68899
|
}
|
|
@@ -68761,7 +69055,7 @@ var init_config_version_checker = __esm(() => {
|
|
|
68761
69055
|
import { spawn as spawn3 } from "node:child_process";
|
|
68762
69056
|
import { execFile as execFile8 } from "node:child_process";
|
|
68763
69057
|
import { existsSync as existsSync48 } from "node:fs";
|
|
68764
|
-
import { readFile as
|
|
69058
|
+
import { readFile as readFile40 } from "node:fs/promises";
|
|
68765
69059
|
import { cpus, homedir as homedir42, totalmem } from "node:os";
|
|
68766
69060
|
import { join as join70 } from "node:path";
|
|
68767
69061
|
function runCommand(cmd, args, fallback2) {
|
|
@@ -69052,7 +69346,7 @@ async function getKitMetadata2(kitName) {
|
|
|
69052
69346
|
const metadataPath = join70(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
69053
69347
|
if (!existsSync48(metadataPath))
|
|
69054
69348
|
return null;
|
|
69055
|
-
const content = await
|
|
69349
|
+
const content = await readFile40(metadataPath, "utf-8");
|
|
69056
69350
|
const metadata = JSON.parse(content);
|
|
69057
69351
|
if (typeof metadata.kits?.[kitName]?.version === "string" && metadata.kits[kitName].version.trim()) {
|
|
69058
69352
|
return { version: metadata.kits[kitName].version };
|
|
@@ -74590,8 +74884,8 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
74590
74884
|
logger.info(` Platform: ${platform10 === "win32" ? "Windows (PowerShell)" : "Unix (bash)"}`);
|
|
74591
74885
|
if (logger.isVerbose()) {
|
|
74592
74886
|
try {
|
|
74593
|
-
const { readFile:
|
|
74594
|
-
const scriptContent = await
|
|
74887
|
+
const { readFile: readFile49 } = await import("node:fs/promises");
|
|
74888
|
+
const scriptContent = await readFile49(scriptPath, "utf-8");
|
|
74595
74889
|
const previewLines = scriptContent.split(`
|
|
74596
74890
|
`).slice(0, 20);
|
|
74597
74891
|
logger.verbose("Script preview (first 20 lines):");
|
|
@@ -74787,11 +75081,11 @@ var init_skills_installer2 = __esm(() => {
|
|
|
74787
75081
|
|
|
74788
75082
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
74789
75083
|
import { existsSync as existsSync62 } from "node:fs";
|
|
74790
|
-
import { mkdir as mkdir23, readFile as
|
|
75084
|
+
import { mkdir as mkdir23, readFile as readFile49, writeFile as writeFile25 } from "node:fs/promises";
|
|
74791
75085
|
import { dirname as dirname33, join as join92 } from "node:path";
|
|
74792
75086
|
async function readJsonFile(filePath) {
|
|
74793
75087
|
try {
|
|
74794
|
-
const content = await
|
|
75088
|
+
const content = await readFile49(filePath, "utf-8");
|
|
74795
75089
|
return JSON.parse(content);
|
|
74796
75090
|
} catch (error) {
|
|
74797
75091
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -74805,7 +75099,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
74805
75099
|
try {
|
|
74806
75100
|
let content = "";
|
|
74807
75101
|
if (existsSync62(gitignorePath)) {
|
|
74808
|
-
content = await
|
|
75102
|
+
content = await readFile49(gitignorePath, "utf-8");
|
|
74809
75103
|
const lines = content.split(`
|
|
74810
75104
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
74811
75105
|
const geminiPatterns = [".gemini/", ".gemini", "/.gemini/", "/.gemini"];
|
|
@@ -74818,7 +75112,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
74818
75112
|
`) || content === "" ? "" : `
|
|
74819
75113
|
`;
|
|
74820
75114
|
const comment = "# Gemini CLI settings (contains user-specific config)";
|
|
74821
|
-
await
|
|
75115
|
+
await writeFile25(gitignorePath, `${content}${newLine}${comment}
|
|
74822
75116
|
${geminiPattern}
|
|
74823
75117
|
`, "utf-8");
|
|
74824
75118
|
logger.debug(`Added ${geminiPattern} to .gitignore`);
|
|
@@ -74843,7 +75137,7 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
74843
75137
|
}
|
|
74844
75138
|
const newSettings = { mcpServers };
|
|
74845
75139
|
try {
|
|
74846
|
-
await
|
|
75140
|
+
await writeFile25(geminiSettingsPath, JSON.stringify(newSettings, null, 2), "utf-8");
|
|
74847
75141
|
logger.debug(`Created new Gemini settings with mcpServers: ${geminiSettingsPath}`);
|
|
74848
75142
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
74849
75143
|
} catch (error) {
|
|
@@ -74873,7 +75167,7 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
74873
75167
|
mcpServers
|
|
74874
75168
|
};
|
|
74875
75169
|
try {
|
|
74876
|
-
await
|
|
75170
|
+
await writeFile25(geminiSettingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
74877
75171
|
logger.debug(`Merged mcpServers into: ${geminiSettingsPath}`);
|
|
74878
75172
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
74879
75173
|
} catch (error) {
|
|
@@ -77343,7 +77637,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
|
|
|
77343
77637
|
}
|
|
77344
77638
|
}
|
|
77345
77639
|
function spawnAndCollect(command, args, cwd2) {
|
|
77346
|
-
return new Promise((
|
|
77640
|
+
return new Promise((resolve57, reject) => {
|
|
77347
77641
|
const child = spawn5(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
|
|
77348
77642
|
const chunks = [];
|
|
77349
77643
|
const stderrChunks = [];
|
|
@@ -77356,7 +77650,7 @@ function spawnAndCollect(command, args, cwd2) {
|
|
|
77356
77650
|
reject(new Error(`${command} ${args[0] ?? ""} exited with code ${code2}: ${stderr}`));
|
|
77357
77651
|
return;
|
|
77358
77652
|
}
|
|
77359
|
-
|
|
77653
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
77360
77654
|
});
|
|
77361
77655
|
});
|
|
77362
77656
|
}
|
|
@@ -77374,7 +77668,7 @@ __export(exports_worktree_manager, {
|
|
|
77374
77668
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
77375
77669
|
});
|
|
77376
77670
|
import { existsSync as existsSync73 } from "node:fs";
|
|
77377
|
-
import { readFile as
|
|
77671
|
+
import { readFile as readFile69, writeFile as writeFile40 } from "node:fs/promises";
|
|
77378
77672
|
import { join as join154 } from "node:path";
|
|
77379
77673
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
77380
77674
|
const worktreePath = join154(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
@@ -77439,14 +77733,14 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
77439
77733
|
async function ensureGitignore(projectDir) {
|
|
77440
77734
|
const gitignorePath = join154(projectDir, ".gitignore");
|
|
77441
77735
|
try {
|
|
77442
|
-
const content = existsSync73(gitignorePath) ? await
|
|
77736
|
+
const content = existsSync73(gitignorePath) ? await readFile69(gitignorePath, "utf-8") : "";
|
|
77443
77737
|
if (!content.includes(".worktrees")) {
|
|
77444
77738
|
const newContent = content.endsWith(`
|
|
77445
77739
|
`) ? `${content}.worktrees/
|
|
77446
77740
|
` : `${content}
|
|
77447
77741
|
.worktrees/
|
|
77448
77742
|
`;
|
|
77449
|
-
await
|
|
77743
|
+
await writeFile40(gitignorePath, newContent, "utf-8");
|
|
77450
77744
|
logger.info("[worktree] Added .worktrees/ to .gitignore");
|
|
77451
77745
|
}
|
|
77452
77746
|
} catch (err) {
|
|
@@ -77542,7 +77836,7 @@ var init_content_validator = __esm(() => {
|
|
|
77542
77836
|
// src/commands/content/phases/context-cache-manager.ts
|
|
77543
77837
|
import { createHash as createHash9 } from "node:crypto";
|
|
77544
77838
|
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
|
|
77839
|
+
import { rename as rename16, writeFile as writeFile42 } from "node:fs/promises";
|
|
77546
77840
|
import { homedir as homedir54 } from "node:os";
|
|
77547
77841
|
import { basename as basename34, join as join161 } from "node:path";
|
|
77548
77842
|
function getCachedContext(repoPath) {
|
|
@@ -77569,7 +77863,7 @@ async function saveCachedContext(repoPath, cache5) {
|
|
|
77569
77863
|
}
|
|
77570
77864
|
const cachePath = getCacheFilePath(repoPath);
|
|
77571
77865
|
const tmpPath = `${cachePath}.tmp`;
|
|
77572
|
-
await
|
|
77866
|
+
await writeFile42(tmpPath, JSON.stringify(cache5, null, 2), "utf-8");
|
|
77573
77867
|
await rename16(tmpPath, cachePath);
|
|
77574
77868
|
}
|
|
77575
77869
|
function computeSourceHash(repoPath) {
|
|
@@ -79406,12 +79700,12 @@ var init_types6 = __esm(() => {
|
|
|
79406
79700
|
});
|
|
79407
79701
|
|
|
79408
79702
|
// src/commands/content/phases/state-manager.ts
|
|
79409
|
-
import { readFile as
|
|
79703
|
+
import { readFile as readFile71, rename as rename17, writeFile as writeFile43 } from "node:fs/promises";
|
|
79410
79704
|
import { join as join167 } from "node:path";
|
|
79411
79705
|
async function loadContentConfig(projectDir) {
|
|
79412
79706
|
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79413
79707
|
try {
|
|
79414
|
-
const raw2 = await
|
|
79708
|
+
const raw2 = await readFile71(configPath, "utf-8");
|
|
79415
79709
|
const json = JSON.parse(raw2);
|
|
79416
79710
|
return ContentConfigSchema.parse(json.content ?? {});
|
|
79417
79711
|
} catch {
|
|
@@ -79427,7 +79721,7 @@ async function saveContentConfig(projectDir, config) {
|
|
|
79427
79721
|
async function loadContentState(projectDir) {
|
|
79428
79722
|
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79429
79723
|
try {
|
|
79430
|
-
const raw2 = await
|
|
79724
|
+
const raw2 = await readFile71(configPath, "utf-8");
|
|
79431
79725
|
const json = JSON.parse(raw2);
|
|
79432
79726
|
const contentBlock = json.content ?? {};
|
|
79433
79727
|
return ContentStateSchema.parse(contentBlock.state ?? {});
|
|
@@ -79454,7 +79748,7 @@ async function saveContentState(projectDir, state) {
|
|
|
79454
79748
|
}
|
|
79455
79749
|
async function readJsonSafe(filePath) {
|
|
79456
79750
|
try {
|
|
79457
|
-
const raw2 = await
|
|
79751
|
+
const raw2 = await readFile71(filePath, "utf-8");
|
|
79458
79752
|
return JSON.parse(raw2);
|
|
79459
79753
|
} catch {
|
|
79460
79754
|
return {};
|
|
@@ -79462,7 +79756,7 @@ async function readJsonSafe(filePath) {
|
|
|
79462
79756
|
}
|
|
79463
79757
|
async function atomicWrite3(filePath, data) {
|
|
79464
79758
|
const tmpPath = `${filePath}.tmp`;
|
|
79465
|
-
await
|
|
79759
|
+
await writeFile43(tmpPath, JSON.stringify(data, null, 2), "utf-8");
|
|
79466
79760
|
await rename17(tmpPath, filePath);
|
|
79467
79761
|
}
|
|
79468
79762
|
var CK_CONFIG_FILE2 = ".ck.json";
|
|
@@ -80203,8 +80497,8 @@ function shouldRunCleanup(lastAt) {
|
|
|
80203
80497
|
return Date.now() - new Date(lastAt).getTime() >= 86400000;
|
|
80204
80498
|
}
|
|
80205
80499
|
function sleep2(ms) {
|
|
80206
|
-
return new Promise((
|
|
80207
|
-
setTimeout(
|
|
80500
|
+
return new Promise((resolve57) => {
|
|
80501
|
+
setTimeout(resolve57, ms);
|
|
80208
80502
|
});
|
|
80209
80503
|
}
|
|
80210
80504
|
var LOCK_DIR2, LOCK_FILE, MAX_CREATION_RETRIES = 3, MAX_PUBLISH_RETRIES_PER_CYCLE = 3, PUBLISH_RETRY_WINDOW_HOURS = 24;
|
|
@@ -81534,7 +81828,9 @@ var init_migrate_command_help = __esm(() => {
|
|
|
81534
81828
|
" Default mode is smart-detected: no/stale registry → install, valid registry → reconcile",
|
|
81535
81829
|
" --respect-deletions disables the auto-reinstall heuristic for empty directories",
|
|
81536
81830
|
" --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"
|
|
81831
|
+
" Codex commands migrate as skills: project scope writes .agents/skills, global scope writes ~/.agents/skills",
|
|
81832
|
+
" Antigravity 2.0 agents migrate to .agents/agents.md; skills remain .agents/skills/<name>/SKILL.md",
|
|
81833
|
+
" Kiro agents migrate as custom subagents; rules/config migrate as steering files; skills copy to .kiro/skills; commands/hooks are skipped"
|
|
81538
81834
|
].join(`
|
|
81539
81835
|
`)
|
|
81540
81836
|
}
|
|
@@ -82007,7 +82303,7 @@ var init_skills_command_help = __esm(() => {
|
|
|
82007
82303
|
},
|
|
82008
82304
|
{
|
|
82009
82305
|
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"
|
|
82306
|
+
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
82307
|
},
|
|
82012
82308
|
{
|
|
82013
82309
|
flags: "-g, --global",
|
|
@@ -82075,6 +82371,7 @@ var init_skills_command_help = __esm(() => {
|
|
|
82075
82371
|
github-copilot GitHub Copilot
|
|
82076
82372
|
amp Amp
|
|
82077
82373
|
kilo Kilo Code
|
|
82374
|
+
kiro Kiro
|
|
82078
82375
|
roo Roo Code
|
|
82079
82376
|
windsurf Windsurf IDE
|
|
82080
82377
|
cline Cline
|
|
@@ -82455,7 +82752,7 @@ function getPagerArgs(pagerCmd) {
|
|
|
82455
82752
|
return [];
|
|
82456
82753
|
}
|
|
82457
82754
|
async function trySystemPager(content) {
|
|
82458
|
-
return new Promise((
|
|
82755
|
+
return new Promise((resolve57) => {
|
|
82459
82756
|
const pagerCmd = process.env.PAGER || "less";
|
|
82460
82757
|
const pagerArgs = getPagerArgs(pagerCmd);
|
|
82461
82758
|
try {
|
|
@@ -82465,20 +82762,20 @@ async function trySystemPager(content) {
|
|
|
82465
82762
|
});
|
|
82466
82763
|
const timeout2 = setTimeout(() => {
|
|
82467
82764
|
pager.kill();
|
|
82468
|
-
|
|
82765
|
+
resolve57(false);
|
|
82469
82766
|
}, 30000);
|
|
82470
82767
|
pager.stdin.write(content);
|
|
82471
82768
|
pager.stdin.end();
|
|
82472
82769
|
pager.on("close", (code2) => {
|
|
82473
82770
|
clearTimeout(timeout2);
|
|
82474
|
-
|
|
82771
|
+
resolve57(code2 === 0);
|
|
82475
82772
|
});
|
|
82476
82773
|
pager.on("error", () => {
|
|
82477
82774
|
clearTimeout(timeout2);
|
|
82478
|
-
|
|
82775
|
+
resolve57(false);
|
|
82479
82776
|
});
|
|
82480
82777
|
} catch {
|
|
82481
|
-
|
|
82778
|
+
resolve57(false);
|
|
82482
82779
|
}
|
|
82483
82780
|
});
|
|
82484
82781
|
}
|
|
@@ -82505,16 +82802,16 @@ async function basicPager(content) {
|
|
|
82505
82802
|
break;
|
|
82506
82803
|
}
|
|
82507
82804
|
const remaining = lines.length - currentLine;
|
|
82508
|
-
await new Promise((
|
|
82805
|
+
await new Promise((resolve57) => {
|
|
82509
82806
|
rl.question(`-- More (${remaining} lines) [Enter/q] --`, (answer) => {
|
|
82510
82807
|
if (answer.toLowerCase() === "q") {
|
|
82511
82808
|
rl.close();
|
|
82512
82809
|
process.exitCode = 0;
|
|
82513
|
-
|
|
82810
|
+
resolve57();
|
|
82514
82811
|
return;
|
|
82515
82812
|
}
|
|
82516
82813
|
process.stdout.write("\x1B[1A\x1B[2K");
|
|
82517
|
-
|
|
82814
|
+
resolve57();
|
|
82518
82815
|
});
|
|
82519
82816
|
});
|
|
82520
82817
|
}
|
|
@@ -87316,7 +87613,7 @@ class CheckRunner {
|
|
|
87316
87613
|
});
|
|
87317
87614
|
}
|
|
87318
87615
|
async executeCheckersInParallel(checkers) {
|
|
87319
|
-
const
|
|
87616
|
+
const runChecker = async (checker) => {
|
|
87320
87617
|
logger.verbose(`Starting checker: ${checker.group}`);
|
|
87321
87618
|
const startTime = Date.now();
|
|
87322
87619
|
const results = await checker.run();
|
|
@@ -87330,8 +87627,19 @@ class CheckRunner {
|
|
|
87330
87627
|
duration: totalDuration
|
|
87331
87628
|
});
|
|
87332
87629
|
return results;
|
|
87333
|
-
}
|
|
87334
|
-
|
|
87630
|
+
};
|
|
87631
|
+
const indexedCheckers = checkers.map((checker, index) => ({ checker, index }));
|
|
87632
|
+
const networkCheckers = indexedCheckers.filter(({ checker }) => checker.group === "network");
|
|
87633
|
+
const otherCheckers = indexedCheckers.filter(({ checker }) => checker.group !== "network");
|
|
87634
|
+
const networkResults = networkCheckers.length ? await Promise.all(networkCheckers.map(async ({ checker, index }) => ({
|
|
87635
|
+
index,
|
|
87636
|
+
results: await runChecker(checker)
|
|
87637
|
+
}))) : [];
|
|
87638
|
+
const otherResults = await Promise.all(otherCheckers.map(async ({ checker, index }) => ({
|
|
87639
|
+
index,
|
|
87640
|
+
results: await runChecker(checker)
|
|
87641
|
+
})));
|
|
87642
|
+
return [...networkResults, ...otherResults].sort((a3, b3) => a3.index - b3.index).flatMap(({ results }) => results);
|
|
87335
87643
|
}
|
|
87336
87644
|
buildSummary(checks) {
|
|
87337
87645
|
let passed = 0;
|
|
@@ -88346,7 +88654,7 @@ import { join as join76, resolve as resolve36 } from "node:path";
|
|
|
88346
88654
|
// src/domains/health-checks/checkers/skill-budget-scanner.ts
|
|
88347
88655
|
var import_gray_matter11 = __toESM(require_gray_matter(), 1);
|
|
88348
88656
|
import { existsSync as existsSync54 } from "node:fs";
|
|
88349
|
-
import { readFile as
|
|
88657
|
+
import { readFile as readFile41, readdir as readdir20 } from "node:fs/promises";
|
|
88350
88658
|
import { basename as basename25, join as join75, relative as relative16 } from "node:path";
|
|
88351
88659
|
var SKIP_DIRS5 = new Set([".git", ".venv", "__pycache__", "node_modules", "scripts", "common"]);
|
|
88352
88660
|
async function scanSkills2(skillsDir2) {
|
|
@@ -88357,7 +88665,7 @@ async function scanSkills2(skillsDir2) {
|
|
|
88357
88665
|
for (const dir of skillDirs) {
|
|
88358
88666
|
const file = join75(dir, "SKILL.md");
|
|
88359
88667
|
try {
|
|
88360
|
-
const content = await
|
|
88668
|
+
const content = await readFile41(file, "utf8");
|
|
88361
88669
|
const { data } = import_gray_matter11.default(content, { engines: { javascript: { parse: () => ({}) } } });
|
|
88362
88670
|
const rawName = typeof data.name === "string" ? data.name : "";
|
|
88363
88671
|
const fallbackId = relative16(skillsDir2, dir).replace(/\\/g, "/") || basename25(dir);
|
|
@@ -88401,7 +88709,7 @@ function normalizeSkillId(rawName, fallbackId) {
|
|
|
88401
88709
|
// src/domains/health-checks/checkers/skill-budget-settings.ts
|
|
88402
88710
|
init_settings_merger();
|
|
88403
88711
|
import { existsSync as existsSync55 } from "node:fs";
|
|
88404
|
-
import { mkdir as mkdir20, readFile as
|
|
88712
|
+
import { mkdir as mkdir20, readFile as readFile42 } from "node:fs/promises";
|
|
88405
88713
|
var CONTEXT_FLOOR_TOKENS = 200000;
|
|
88406
88714
|
var CHARS_PER_TOKEN = 4;
|
|
88407
88715
|
var DEFAULT_BUDGET_FRACTION = 0.03;
|
|
@@ -88412,7 +88720,7 @@ async function readProjectSettings(settingsPath) {
|
|
|
88412
88720
|
if (!existsSync55(settingsPath))
|
|
88413
88721
|
return { exists: false, settings: null };
|
|
88414
88722
|
try {
|
|
88415
|
-
const parsed = JSON.parse(await
|
|
88723
|
+
const parsed = JSON.parse(await readFile42(settingsPath, "utf8"));
|
|
88416
88724
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
88417
88725
|
return { exists: true, settings: null, error: "settings.json must contain a JSON object" };
|
|
88418
88726
|
}
|
|
@@ -88626,7 +88934,7 @@ function warn(id, name, message, skills, suggestion) {
|
|
|
88626
88934
|
init_logger();
|
|
88627
88935
|
init_path_resolver();
|
|
88628
88936
|
init_shared2();
|
|
88629
|
-
import { constants as constants2, access as access3, unlink as unlink10, writeFile as
|
|
88937
|
+
import { constants as constants2, access as access3, unlink as unlink10, writeFile as writeFile22 } from "node:fs/promises";
|
|
88630
88938
|
import { join as join77 } from "node:path";
|
|
88631
88939
|
async function checkGlobalDirReadable() {
|
|
88632
88940
|
const globalDir = PathResolver.getGlobalKitDir();
|
|
@@ -88686,7 +88994,7 @@ async function checkGlobalDirWritable() {
|
|
|
88686
88994
|
const random = Math.random().toString(36).substring(2);
|
|
88687
88995
|
const testFile = join77(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
88688
88996
|
try {
|
|
88689
|
-
await
|
|
88997
|
+
await writeFile22(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
88690
88998
|
} catch (error) {
|
|
88691
88999
|
return {
|
|
88692
89000
|
id: "ck-global-dir-writable",
|
|
@@ -88784,7 +89092,7 @@ async function checkHooksExist(projectDir) {
|
|
|
88784
89092
|
init_logger();
|
|
88785
89093
|
init_path_resolver();
|
|
88786
89094
|
import { existsSync as existsSync57 } from "node:fs";
|
|
88787
|
-
import { readFile as
|
|
89095
|
+
import { readFile as readFile43 } from "node:fs/promises";
|
|
88788
89096
|
import { join as join79 } from "node:path";
|
|
88789
89097
|
async function checkSettingsValid(projectDir) {
|
|
88790
89098
|
const globalSettings = join79(PathResolver.getGlobalKitDir(), "settings.json");
|
|
@@ -88802,7 +89110,7 @@ async function checkSettingsValid(projectDir) {
|
|
|
88802
89110
|
};
|
|
88803
89111
|
}
|
|
88804
89112
|
try {
|
|
88805
|
-
const content = await
|
|
89113
|
+
const content = await readFile43(settingsPath, "utf-8");
|
|
88806
89114
|
JSON.parse(content);
|
|
88807
89115
|
return {
|
|
88808
89116
|
id: "ck-settings-valid",
|
|
@@ -88859,7 +89167,7 @@ async function checkSettingsValid(projectDir) {
|
|
|
88859
89167
|
init_logger();
|
|
88860
89168
|
init_path_resolver();
|
|
88861
89169
|
import { existsSync as existsSync58 } from "node:fs";
|
|
88862
|
-
import { readFile as
|
|
89170
|
+
import { readFile as readFile44 } from "node:fs/promises";
|
|
88863
89171
|
import { homedir as homedir43 } from "node:os";
|
|
88864
89172
|
import { dirname as dirname31, join as join80, normalize as normalize6, resolve as resolve37 } from "node:path";
|
|
88865
89173
|
async function checkPathRefsValid(projectDir) {
|
|
@@ -88878,7 +89186,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
88878
89186
|
};
|
|
88879
89187
|
}
|
|
88880
89188
|
try {
|
|
88881
|
-
const content = await
|
|
89189
|
+
const content = await readFile44(claudeMdPath, "utf-8");
|
|
88882
89190
|
const refPattern = /@([^\s\)]+)/g;
|
|
88883
89191
|
const refs = [...content.matchAll(refPattern)].map((m2) => m2[1]);
|
|
88884
89192
|
if (refs.length === 0) {
|
|
@@ -89896,7 +90204,7 @@ import { platform as platform9 } from "node:os";
|
|
|
89896
90204
|
// src/domains/health-checks/platform/environment-checker.ts
|
|
89897
90205
|
init_environment();
|
|
89898
90206
|
init_path_resolver();
|
|
89899
|
-
import { constants as constants3, access as access4, mkdir as mkdir21, readFile as
|
|
90207
|
+
import { constants as constants3, access as access4, mkdir as mkdir21, readFile as readFile46, unlink as unlink11, writeFile as writeFile23 } from "node:fs/promises";
|
|
89900
90208
|
import { arch as arch2, homedir as homedir44, platform as platform8 } from "node:os";
|
|
89901
90209
|
import { join as join85, normalize as normalize7 } from "node:path";
|
|
89902
90210
|
function shouldSkipExpensiveOperations4() {
|
|
@@ -89992,8 +90300,8 @@ async function checkGlobalDirAccess() {
|
|
|
89992
90300
|
const testFile = join85(globalDir, ".ck-doctor-access-test");
|
|
89993
90301
|
try {
|
|
89994
90302
|
await mkdir21(globalDir, { recursive: true });
|
|
89995
|
-
await
|
|
89996
|
-
const content = await
|
|
90303
|
+
await writeFile23(testFile, "test", "utf-8");
|
|
90304
|
+
const content = await readFile46(testFile, "utf-8");
|
|
89997
90305
|
await unlink11(testFile);
|
|
89998
90306
|
if (content !== "test")
|
|
89999
90307
|
throw new Error("Read mismatch");
|
|
@@ -90066,7 +90374,7 @@ async function checkWSLBoundary() {
|
|
|
90066
90374
|
|
|
90067
90375
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
90068
90376
|
init_path_resolver();
|
|
90069
|
-
import { mkdir as mkdir22, symlink as symlink2, unlink as unlink12, writeFile as
|
|
90377
|
+
import { mkdir as mkdir22, symlink as symlink2, unlink as unlink12, writeFile as writeFile24 } from "node:fs/promises";
|
|
90070
90378
|
import { join as join86 } from "node:path";
|
|
90071
90379
|
async function checkLongPathSupport() {
|
|
90072
90380
|
if (shouldSkipExpensiveOperations4()) {
|
|
@@ -90123,7 +90431,7 @@ async function checkSymlinkSupport() {
|
|
|
90123
90431
|
const link = join86(testDir, ".ck-symlink-test-link");
|
|
90124
90432
|
try {
|
|
90125
90433
|
await mkdir22(testDir, { recursive: true });
|
|
90126
|
-
await
|
|
90434
|
+
await writeFile24(target, "test", "utf-8");
|
|
90127
90435
|
await symlink2(target, link);
|
|
90128
90436
|
await unlink12(link);
|
|
90129
90437
|
await unlink12(target);
|
|
@@ -90362,9 +90670,10 @@ function createDefaultDeps() {
|
|
|
90362
90670
|
};
|
|
90363
90671
|
}
|
|
90364
90672
|
function createDefaultDns() {
|
|
90673
|
+
const lookupFamily = (host, family) => dnsPromises.lookup(host, { family, all: true }).then((records) => records.map((record) => record.address));
|
|
90365
90674
|
return {
|
|
90366
|
-
resolve4: (host) =>
|
|
90367
|
-
resolve6: (host) =>
|
|
90675
|
+
resolve4: (host) => lookupFamily(host, 4),
|
|
90676
|
+
resolve6: (host) => lookupFamily(host, 6)
|
|
90368
90677
|
};
|
|
90369
90678
|
}
|
|
90370
90679
|
function createDefaultTcp() {
|
|
@@ -90545,11 +90854,25 @@ async function checkGitHubReachability(deps) {
|
|
|
90545
90854
|
}
|
|
90546
90855
|
function raceTimeout(promise, ms) {
|
|
90547
90856
|
return new Promise((resolve38, reject) => {
|
|
90548
|
-
|
|
90857
|
+
let settled = false;
|
|
90858
|
+
const timer = setTimeout(() => {
|
|
90859
|
+
setImmediate(() => {
|
|
90860
|
+
if (settled)
|
|
90861
|
+
return;
|
|
90862
|
+
settled = true;
|
|
90863
|
+
reject(new Error(`timeout after ${ms}ms`));
|
|
90864
|
+
});
|
|
90865
|
+
}, ms);
|
|
90549
90866
|
promise.then((v2) => {
|
|
90867
|
+
if (settled)
|
|
90868
|
+
return;
|
|
90869
|
+
settled = true;
|
|
90550
90870
|
clearTimeout(timer);
|
|
90551
90871
|
resolve38(v2);
|
|
90552
90872
|
}, (e2) => {
|
|
90873
|
+
if (settled)
|
|
90874
|
+
return;
|
|
90875
|
+
settled = true;
|
|
90553
90876
|
clearTimeout(timer);
|
|
90554
90877
|
reject(e2);
|
|
90555
90878
|
});
|
|
@@ -91211,13 +91534,13 @@ init_hook_health_checker();
|
|
|
91211
91534
|
init_config_version_checker();
|
|
91212
91535
|
|
|
91213
91536
|
// src/domains/sync/sync-engine.ts
|
|
91214
|
-
import { lstat as lstat6, readFile as
|
|
91537
|
+
import { lstat as lstat6, readFile as readFile48, readlink as readlink2, realpath as realpath8, stat as stat14 } from "node:fs/promises";
|
|
91215
91538
|
import { isAbsolute as isAbsolute11, join as join88, normalize as normalize8, relative as relative18 } from "node:path";
|
|
91216
91539
|
|
|
91217
91540
|
// src/services/file-operations/ownership-checker.ts
|
|
91218
91541
|
init_metadata_migration();
|
|
91219
91542
|
import { createHash as createHash6 } from "node:crypto";
|
|
91220
|
-
import { readFile as
|
|
91543
|
+
import { readFile as readFile47, stat as stat13 } from "node:fs/promises";
|
|
91221
91544
|
import { relative as relative17 } from "node:path";
|
|
91222
91545
|
|
|
91223
91546
|
// src/shared/concurrent-file-ops.ts
|
|
@@ -91232,7 +91555,7 @@ async function mapWithLimit(items, fn, concurrency = DEFAULT_CONCURRENCY) {
|
|
|
91232
91555
|
class OwnershipChecker {
|
|
91233
91556
|
static async calculateChecksum(filePath) {
|
|
91234
91557
|
try {
|
|
91235
|
-
return createHash6("sha256").update(await
|
|
91558
|
+
return createHash6("sha256").update(await readFile47(filePath)).digest("hex");
|
|
91236
91559
|
} catch (err) {
|
|
91237
91560
|
const message = err instanceof Error ? err.message : String(err);
|
|
91238
91561
|
throw new Error(operationError("Checksum calculation", filePath, message));
|
|
@@ -92649,7 +92972,7 @@ class SyncEngine {
|
|
|
92649
92972
|
if (lstats.size > MAX_SYNC_FILE_SIZE) {
|
|
92650
92973
|
throw new Error(`File too large for sync (${Math.round(lstats.size / 1024 / 1024)}MB > ${MAX_SYNC_FILE_SIZE / 1024 / 1024}MB limit)`);
|
|
92651
92974
|
}
|
|
92652
|
-
const buffer = await
|
|
92975
|
+
const buffer = await readFile48(filePath);
|
|
92653
92976
|
if (buffer.includes(0)) {
|
|
92654
92977
|
return { content: "", isBinary: true };
|
|
92655
92978
|
}
|
|
@@ -101977,7 +102300,7 @@ import { join as join121 } from "node:path";
|
|
|
101977
102300
|
|
|
101978
102301
|
// src/domains/installation/deletion-handler.ts
|
|
101979
102302
|
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
|
|
102303
|
+
import { dirname as dirname37, join as join106, relative as relative21, resolve as resolve42, sep as sep11 } from "node:path";
|
|
101981
102304
|
|
|
101982
102305
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
101983
102306
|
init_metadata_migration();
|
|
@@ -102202,8 +102525,8 @@ function expandGlobPatterns(patterns, claudeDir3) {
|
|
|
102202
102525
|
}
|
|
102203
102526
|
var MAX_CLEANUP_ITERATIONS = 50;
|
|
102204
102527
|
function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
102205
|
-
const normalizedClaudeDir =
|
|
102206
|
-
let currentDir =
|
|
102528
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102529
|
+
let currentDir = resolve42(dirname37(filePath));
|
|
102207
102530
|
let iterations = 0;
|
|
102208
102531
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
|
|
102209
102532
|
iterations++;
|
|
@@ -102212,7 +102535,7 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102212
102535
|
if (entries.length === 0) {
|
|
102213
102536
|
rmdirSync(currentDir);
|
|
102214
102537
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
102215
|
-
currentDir =
|
|
102538
|
+
currentDir = resolve42(dirname37(currentDir));
|
|
102216
102539
|
} else {
|
|
102217
102540
|
break;
|
|
102218
102541
|
}
|
|
@@ -102222,9 +102545,9 @@ function cleanupEmptyDirectories(filePath, claudeDir3) {
|
|
|
102222
102545
|
}
|
|
102223
102546
|
}
|
|
102224
102547
|
function deletePath(fullPath, claudeDir3) {
|
|
102225
|
-
const normalizedPath =
|
|
102226
|
-
const normalizedClaudeDir =
|
|
102227
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
102548
|
+
const normalizedPath = resolve42(fullPath);
|
|
102549
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102550
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep11}`) && normalizedPath !== normalizedClaudeDir) {
|
|
102228
102551
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
102229
102552
|
}
|
|
102230
102553
|
try {
|
|
@@ -102296,9 +102619,9 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
102296
102619
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
102297
102620
|
for (const path16 of deletions) {
|
|
102298
102621
|
const fullPath = join106(claudeDir3, path16);
|
|
102299
|
-
const normalizedPath =
|
|
102300
|
-
const normalizedClaudeDir =
|
|
102301
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
102622
|
+
const normalizedPath = resolve42(fullPath);
|
|
102623
|
+
const normalizedClaudeDir = resolve42(claudeDir3);
|
|
102624
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep11}`)) {
|
|
102302
102625
|
logger.warning(`Skipping invalid path: ${path16}`);
|
|
102303
102626
|
result.errors.push(path16);
|
|
102304
102627
|
continue;
|
|
@@ -103396,8 +103719,8 @@ var path16 = {
|
|
|
103396
103719
|
win32: { sep: "\\" },
|
|
103397
103720
|
posix: { sep: "/" }
|
|
103398
103721
|
};
|
|
103399
|
-
var
|
|
103400
|
-
minimatch.sep =
|
|
103722
|
+
var sep12 = defaultPlatform === "win32" ? path16.win32.sep : path16.posix.sep;
|
|
103723
|
+
minimatch.sep = sep12;
|
|
103401
103724
|
var GLOBSTAR = Symbol("globstar **");
|
|
103402
103725
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
103403
103726
|
var qmark2 = "[^/]";
|
|
@@ -104086,7 +104409,7 @@ import { dirname as dirname40, join as join110 } from "node:path";
|
|
|
104086
104409
|
// src/domains/config/installed-settings-tracker.ts
|
|
104087
104410
|
init_shared();
|
|
104088
104411
|
import { existsSync as existsSync66 } from "node:fs";
|
|
104089
|
-
import { mkdir as mkdir31, readFile as
|
|
104412
|
+
import { mkdir as mkdir31, readFile as readFile52, writeFile as writeFile27 } from "node:fs/promises";
|
|
104090
104413
|
import { dirname as dirname39, join as join109 } from "node:path";
|
|
104091
104414
|
var CK_JSON_FILE = ".ck.json";
|
|
104092
104415
|
|
|
@@ -104111,7 +104434,7 @@ class InstalledSettingsTracker {
|
|
|
104111
104434
|
return { hooks: [], mcpServers: [] };
|
|
104112
104435
|
}
|
|
104113
104436
|
try {
|
|
104114
|
-
const content = await
|
|
104437
|
+
const content = await readFile52(ckJsonPath, "utf-8");
|
|
104115
104438
|
const data = parseJsonContent(content);
|
|
104116
104439
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
104117
104440
|
if (installed) {
|
|
@@ -104128,7 +104451,7 @@ class InstalledSettingsTracker {
|
|
|
104128
104451
|
try {
|
|
104129
104452
|
let data = {};
|
|
104130
104453
|
if (existsSync66(ckJsonPath)) {
|
|
104131
|
-
const content = await
|
|
104454
|
+
const content = await readFile52(ckJsonPath, "utf-8");
|
|
104132
104455
|
data = parseJsonContent(content);
|
|
104133
104456
|
}
|
|
104134
104457
|
if (!data.kits) {
|
|
@@ -104139,7 +104462,7 @@ class InstalledSettingsTracker {
|
|
|
104139
104462
|
}
|
|
104140
104463
|
data.kits[this.kitName].installedSettings = settings;
|
|
104141
104464
|
await mkdir31(dirname39(ckJsonPath), { recursive: true });
|
|
104142
|
-
await
|
|
104465
|
+
await writeFile27(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
104143
104466
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
104144
104467
|
} catch (error) {
|
|
104145
104468
|
logger.warning(`Failed to save installed settings: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -104184,7 +104507,19 @@ init_logger();
|
|
|
104184
104507
|
init_path_resolver();
|
|
104185
104508
|
var import_fs_extra15 = __toESM(require_lib(), 1);
|
|
104186
104509
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
104187
|
-
var
|
|
104510
|
+
var DYNAMIC_TEAM_HOOKS = [
|
|
104511
|
+
{
|
|
104512
|
+
event: "TaskCompleted",
|
|
104513
|
+
handler: "task-completed-handler.cjs",
|
|
104514
|
+
hookName: "task-completed-handler"
|
|
104515
|
+
},
|
|
104516
|
+
{
|
|
104517
|
+
event: "TeammateIdle",
|
|
104518
|
+
handler: "teammate-idle-handler.cjs",
|
|
104519
|
+
hookName: "teammate-idle-handler"
|
|
104520
|
+
}
|
|
104521
|
+
];
|
|
104522
|
+
var DYNAMIC_INJECTED_HOOKS = new Set(DYNAMIC_TEAM_HOOKS.map(({ hookName }) => hookName));
|
|
104188
104523
|
|
|
104189
104524
|
class SettingsProcessor {
|
|
104190
104525
|
static MIN_TEAM_HOOKS_VERSION = "2.1.33";
|
|
@@ -104344,7 +104679,7 @@ class SettingsProcessor {
|
|
|
104344
104679
|
}
|
|
104345
104680
|
await SettingsMerger.writeSettingsFile(destFile, mergeResult.merged);
|
|
104346
104681
|
logger.success("Merged settings.json (user customizations preserved)");
|
|
104347
|
-
await this.refreshInstalledSettingsTracking(sourceSettings, installedSettings);
|
|
104682
|
+
await this.refreshInstalledSettingsTracking(sourceSettings, installedSettings, destFile);
|
|
104348
104683
|
await this.injectTeamHooksIfSupported(destFile, mergeResult.merged);
|
|
104349
104684
|
}
|
|
104350
104685
|
async getDisabledHookNames() {
|
|
@@ -104604,23 +104939,28 @@ class SettingsProcessor {
|
|
|
104604
104939
|
}
|
|
104605
104940
|
return installedSettings;
|
|
104606
104941
|
}
|
|
104607
|
-
async refreshInstalledSettingsTracking(sourceSettings, previousInstalledSettings) {
|
|
104942
|
+
async refreshInstalledSettingsTracking(sourceSettings, previousInstalledSettings, destFile) {
|
|
104608
104943
|
if (!this.tracker)
|
|
104609
104944
|
return;
|
|
104610
104945
|
const trackingSource = structuredClone(sourceSettings);
|
|
104611
104946
|
this.fixHookCommandPaths(trackingSource);
|
|
104612
104947
|
const refreshedSettings = this.collectInstalledSettings(trackingSource);
|
|
104613
|
-
this.
|
|
104948
|
+
const disabledHooks = await this.getDisabledHookNames();
|
|
104949
|
+
await this.preserveDynamicInjectedHookTracking(previousInstalledSettings, refreshedSettings, destFile, disabledHooks);
|
|
104614
104950
|
await this.tracker.saveInstalledSettings(refreshedSettings);
|
|
104615
104951
|
logger.debug("Refreshed installed settings tracking baseline");
|
|
104616
104952
|
}
|
|
104617
|
-
preserveDynamicInjectedHookTracking(previousInstalledSettings, refreshedSettings) {
|
|
104953
|
+
async preserveDynamicInjectedHookTracking(previousInstalledSettings, refreshedSettings, destFile, disabledHooks) {
|
|
104618
104954
|
if (!previousInstalledSettings.hooks || !this.tracker)
|
|
104619
104955
|
return;
|
|
104620
104956
|
for (const command of previousInstalledSettings.hooks) {
|
|
104621
104957
|
const hookName = this.extractCkHookName(command);
|
|
104622
104958
|
if (!hookName || !DYNAMIC_INJECTED_HOOKS.has(hookName))
|
|
104623
104959
|
continue;
|
|
104960
|
+
if (disabledHooks.has(hookName))
|
|
104961
|
+
continue;
|
|
104962
|
+
if (!await this.dynamicTeamHookHandlerExists(destFile, `${hookName}.cjs`))
|
|
104963
|
+
continue;
|
|
104624
104964
|
this.tracker.trackHook(command, refreshedSettings);
|
|
104625
104965
|
}
|
|
104626
104966
|
}
|
|
@@ -104798,11 +105138,6 @@ class SettingsProcessor {
|
|
|
104798
105138
|
logger.debug("Claude Code version not detected, skipping team hooks injection");
|
|
104799
105139
|
return;
|
|
104800
105140
|
}
|
|
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
105141
|
const settings = existingSettings ?? await SettingsMerger.readSettingsFile(destFile);
|
|
104807
105142
|
if (!settings) {
|
|
104808
105143
|
logger.warning("Failed to read settings file for team hooks injection");
|
|
@@ -104811,38 +105146,109 @@ class SettingsProcessor {
|
|
|
104811
105146
|
if (!settings.hooks) {
|
|
104812
105147
|
settings.hooks = {};
|
|
104813
105148
|
}
|
|
105149
|
+
if (!this.isVersionAtLeast(version, SettingsProcessor.MIN_TEAM_HOOKS_VERSION)) {
|
|
105150
|
+
const pruned = this.removeDynamicTeamHookRegistrations(settings);
|
|
105151
|
+
if (pruned > 0) {
|
|
105152
|
+
await SettingsMerger.writeSettingsFile(destFile, settings);
|
|
105153
|
+
logger.info(`Pruned ${pruned} team hook registration(s) unsupported by Claude Code ${version}`);
|
|
105154
|
+
} else {
|
|
105155
|
+
logger.debug(`Claude Code ${version} does not support team hooks (requires >= 2.1.33), skipping injection`);
|
|
105156
|
+
}
|
|
105157
|
+
return;
|
|
105158
|
+
}
|
|
105159
|
+
logger.debug(`Claude Code ${version} detected, checking team hooks`);
|
|
105160
|
+
let changed = false;
|
|
104814
105161
|
let injected = false;
|
|
104815
105162
|
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) {
|
|
105163
|
+
const disabledHooks = await this.getDisabledHookNames();
|
|
105164
|
+
for (const { event, handler, hookName } of DYNAMIC_TEAM_HOOKS) {
|
|
104821
105165
|
const hookCommand = this.formatCommandPath("node ", this.isGlobal ? this.getCanonicalGlobalCommandRoot() : "$CLAUDE_PROJECT_DIR", `.claude/hooks/${handler}`);
|
|
104822
105166
|
const eventHooks = settings.hooks[event];
|
|
104823
|
-
if (
|
|
105167
|
+
if (disabledHooks.has(hookName)) {
|
|
105168
|
+
if (this.removeDynamicTeamHookRegistration(settings, event, hookName)) {
|
|
105169
|
+
changed = true;
|
|
105170
|
+
logger.info(`Skipped ${event} hook disabled in .ck.json`);
|
|
105171
|
+
}
|
|
104824
105172
|
continue;
|
|
104825
|
-
|
|
104826
|
-
|
|
105173
|
+
}
|
|
105174
|
+
if (!await this.dynamicTeamHookHandlerExists(destFile, handler)) {
|
|
105175
|
+
if (this.removeDynamicTeamHookRegistration(settings, event, hookName)) {
|
|
105176
|
+
changed = true;
|
|
105177
|
+
logger.info(`Pruned ${event} hook because ${handler} is not installed`);
|
|
105178
|
+
}
|
|
104827
105179
|
continue;
|
|
104828
105180
|
}
|
|
105181
|
+
if (eventHooks && eventHooks.length > 0)
|
|
105182
|
+
continue;
|
|
104829
105183
|
settings.hooks[event] = [{ hooks: [{ type: "command", command: hookCommand }] }];
|
|
104830
105184
|
logger.info(`Injected ${event} hook`);
|
|
105185
|
+
changed = true;
|
|
104831
105186
|
injected = true;
|
|
104832
105187
|
if (this.tracker) {
|
|
104833
105188
|
this.tracker.trackHook(hookCommand, installedSettings);
|
|
104834
105189
|
}
|
|
104835
105190
|
}
|
|
104836
|
-
if (
|
|
105191
|
+
if (changed) {
|
|
104837
105192
|
await SettingsMerger.writeSettingsFile(destFile, settings);
|
|
104838
105193
|
if (this.tracker) {
|
|
104839
105194
|
await this.tracker.saveInstalledSettings(installedSettings);
|
|
104840
105195
|
}
|
|
104841
|
-
|
|
105196
|
+
if (injected) {
|
|
105197
|
+
logger.success("Team hooks injected successfully");
|
|
105198
|
+
}
|
|
104842
105199
|
} else {
|
|
104843
105200
|
logger.debug("Team hooks already present, no injection needed");
|
|
104844
105201
|
}
|
|
104845
105202
|
}
|
|
105203
|
+
async dynamicTeamHookHandlerExists(destFile, handler) {
|
|
105204
|
+
return import_fs_extra15.pathExists(join110(dirname40(destFile), "hooks", handler));
|
|
105205
|
+
}
|
|
105206
|
+
removeDynamicTeamHookRegistrations(settings) {
|
|
105207
|
+
let removed = 0;
|
|
105208
|
+
for (const { event, hookName } of DYNAMIC_TEAM_HOOKS) {
|
|
105209
|
+
if (this.removeDynamicTeamHookRegistration(settings, event, hookName)) {
|
|
105210
|
+
removed++;
|
|
105211
|
+
}
|
|
105212
|
+
}
|
|
105213
|
+
return removed;
|
|
105214
|
+
}
|
|
105215
|
+
removeDynamicTeamHookRegistration(settings, event, hookName) {
|
|
105216
|
+
const hooks = settings.hooks;
|
|
105217
|
+
const entries = hooks?.[event];
|
|
105218
|
+
if (!entries)
|
|
105219
|
+
return false;
|
|
105220
|
+
let removed = false;
|
|
105221
|
+
const filteredEntries = [];
|
|
105222
|
+
for (const entry of entries) {
|
|
105223
|
+
if ("hooks" in entry && Array.isArray(entry.hooks)) {
|
|
105224
|
+
const keptHooks = entry.hooks.filter((hook) => {
|
|
105225
|
+
const command = typeof hook.command === "string" ? hook.command : "";
|
|
105226
|
+
if (this.extractCkHookName(command) === hookName) {
|
|
105227
|
+
removed = true;
|
|
105228
|
+
return false;
|
|
105229
|
+
}
|
|
105230
|
+
return true;
|
|
105231
|
+
});
|
|
105232
|
+
if (keptHooks.length > 0) {
|
|
105233
|
+
filteredEntries.push({ ...entry, hooks: keptHooks });
|
|
105234
|
+
}
|
|
105235
|
+
continue;
|
|
105236
|
+
}
|
|
105237
|
+
if ("command" in entry && typeof entry.command === "string" && this.extractCkHookName(entry.command) === hookName) {
|
|
105238
|
+
removed = true;
|
|
105239
|
+
continue;
|
|
105240
|
+
}
|
|
105241
|
+
filteredEntries.push(entry);
|
|
105242
|
+
}
|
|
105243
|
+
if (!removed)
|
|
105244
|
+
return false;
|
|
105245
|
+
if (filteredEntries.length > 0) {
|
|
105246
|
+
hooks[event] = filteredEntries;
|
|
105247
|
+
} else {
|
|
105248
|
+
delete hooks[event];
|
|
105249
|
+
}
|
|
105250
|
+
return true;
|
|
105251
|
+
}
|
|
104846
105252
|
}
|
|
104847
105253
|
|
|
104848
105254
|
// src/domains/installation/merger/copy-executor.ts
|
|
@@ -105856,7 +106262,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
105856
106262
|
init_logger();
|
|
105857
106263
|
init_skip_directories();
|
|
105858
106264
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
105859
|
-
import { join as join116, relative as relative26, resolve as
|
|
106265
|
+
import { join as join116, relative as relative26, resolve as resolve43 } from "node:path";
|
|
105860
106266
|
|
|
105861
106267
|
class FileScanner2 {
|
|
105862
106268
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -105936,8 +106342,8 @@ class FileScanner2 {
|
|
|
105936
106342
|
return customFiles;
|
|
105937
106343
|
}
|
|
105938
106344
|
static isSafePath(basePath, targetPath) {
|
|
105939
|
-
const resolvedBase =
|
|
105940
|
-
const resolvedTarget =
|
|
106345
|
+
const resolvedBase = resolve43(basePath);
|
|
106346
|
+
const resolvedTarget = resolve43(targetPath);
|
|
105941
106347
|
return resolvedTarget.startsWith(resolvedBase);
|
|
105942
106348
|
}
|
|
105943
106349
|
static toPosixPath(path17) {
|
|
@@ -105953,7 +106359,7 @@ import { join as join118 } from "node:path";
|
|
|
105953
106359
|
|
|
105954
106360
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
105955
106361
|
init_logger();
|
|
105956
|
-
import { readFile as
|
|
106362
|
+
import { readFile as readFile56, readdir as readdir30, writeFile as writeFile31 } from "node:fs/promises";
|
|
105957
106363
|
import { join as join117 } from "node:path";
|
|
105958
106364
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
105959
106365
|
".md",
|
|
@@ -106022,13 +106428,13 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
106022
106428
|
await processDirectory(fullPath);
|
|
106023
106429
|
} else if (entry.isFile() && shouldTransformFile(entry.name)) {
|
|
106024
106430
|
try {
|
|
106025
|
-
const content = await
|
|
106431
|
+
const content = await readFile56(fullPath, "utf-8");
|
|
106026
106432
|
const { transformed, changes } = transformCommandContent(content);
|
|
106027
106433
|
if (changes > 0) {
|
|
106028
106434
|
if (options2.dryRun) {
|
|
106029
106435
|
logger.debug(`[dry-run] Would transform ${changes} command ref(s) in ${fullPath}`);
|
|
106030
106436
|
} else {
|
|
106031
|
-
await
|
|
106437
|
+
await writeFile31(fullPath, transformed, "utf-8");
|
|
106032
106438
|
if (options2.verbose) {
|
|
106033
106439
|
logger.verbose(`Transformed ${changes} command ref(s) in ${fullPath}`);
|
|
106034
106440
|
}
|
|
@@ -106563,7 +106969,7 @@ init_skip_directories();
|
|
|
106563
106969
|
init_types3();
|
|
106564
106970
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
106565
106971
|
import { createHash as createHash7 } from "node:crypto";
|
|
106566
|
-
import { readFile as
|
|
106972
|
+
import { readFile as readFile58, readdir as readdir34, writeFile as writeFile32 } from "node:fs/promises";
|
|
106567
106973
|
import { join as join122, relative as relative27 } from "node:path";
|
|
106568
106974
|
|
|
106569
106975
|
class SkillsManifestManager {
|
|
@@ -106587,7 +106993,7 @@ class SkillsManifestManager {
|
|
|
106587
106993
|
}
|
|
106588
106994
|
static async writeManifest(skillsDir2, manifest) {
|
|
106589
106995
|
const manifestPath = join122(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
106590
|
-
await
|
|
106996
|
+
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
106591
106997
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
106592
106998
|
}
|
|
106593
106999
|
static async readManifest(skillsDir2) {
|
|
@@ -106597,7 +107003,7 @@ class SkillsManifestManager {
|
|
|
106597
107003
|
return null;
|
|
106598
107004
|
}
|
|
106599
107005
|
try {
|
|
106600
|
-
const content = await
|
|
107006
|
+
const content = await readFile58(manifestPath, "utf-8");
|
|
106601
107007
|
const data = JSON.parse(content);
|
|
106602
107008
|
const manifest = SkillsManifestSchema.parse(data);
|
|
106603
107009
|
logger.debug(`Read manifest from: ${manifestPath}`);
|
|
@@ -106669,7 +107075,7 @@ class SkillsManifestManager {
|
|
|
106669
107075
|
files.sort();
|
|
106670
107076
|
for (const file of files) {
|
|
106671
107077
|
const relativePath = relative27(dirPath, file);
|
|
106672
|
-
const content = await
|
|
107078
|
+
const content = await readFile58(file);
|
|
106673
107079
|
hash.update(relativePath);
|
|
106674
107080
|
hash.update(content);
|
|
106675
107081
|
}
|
|
@@ -107409,7 +107815,7 @@ import { relative as relative29 } from "node:path";
|
|
|
107409
107815
|
init_skip_directories();
|
|
107410
107816
|
import { createHash as createHash8 } from "node:crypto";
|
|
107411
107817
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
107412
|
-
import { readFile as
|
|
107818
|
+
import { readFile as readFile59, readdir as readdir38 } from "node:fs/promises";
|
|
107413
107819
|
import { join as join126, relative as relative28 } from "node:path";
|
|
107414
107820
|
async function getAllFiles(dirPath) {
|
|
107415
107821
|
const files = [];
|
|
@@ -107448,7 +107854,7 @@ async function hashDirectory(dirPath) {
|
|
|
107448
107854
|
files.sort();
|
|
107449
107855
|
for (const file of files) {
|
|
107450
107856
|
const relativePath = relative28(dirPath, file);
|
|
107451
|
-
const content = await
|
|
107857
|
+
const content = await readFile59(file);
|
|
107452
107858
|
hash.update(relativePath);
|
|
107453
107859
|
hash.update(content);
|
|
107454
107860
|
}
|
|
@@ -107782,7 +108188,7 @@ import { join as join131 } from "node:path";
|
|
|
107782
108188
|
|
|
107783
108189
|
// src/services/transformers/opencode-path-transformer.ts
|
|
107784
108190
|
init_logger();
|
|
107785
|
-
import { readFile as
|
|
108191
|
+
import { readFile as readFile60, readdir as readdir40, writeFile as writeFile33 } from "node:fs/promises";
|
|
107786
108192
|
import { platform as platform15 } from "node:os";
|
|
107787
108193
|
import { extname as extname6, join as join130 } from "node:path";
|
|
107788
108194
|
var IS_WINDOWS2 = platform15() === "win32";
|
|
@@ -107853,10 +108259,10 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
107853
108259
|
await processDirectory2(fullPath);
|
|
107854
108260
|
} else if (entry.isFile() && shouldTransformFile2(entry.name)) {
|
|
107855
108261
|
try {
|
|
107856
|
-
const content = await
|
|
108262
|
+
const content = await readFile60(fullPath, "utf-8");
|
|
107857
108263
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
107858
108264
|
if (changes > 0) {
|
|
107859
|
-
await
|
|
108265
|
+
await writeFile33(fullPath, transformed, "utf-8");
|
|
107860
108266
|
filesTransformed++;
|
|
107861
108267
|
totalChanges += changes;
|
|
107862
108268
|
if (options2.verbose) {
|
|
@@ -108084,7 +108490,7 @@ async function handlePostInstall(ctx) {
|
|
|
108084
108490
|
init_config_manager();
|
|
108085
108491
|
init_github_client();
|
|
108086
108492
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
108087
|
-
import { join as join135, resolve as
|
|
108493
|
+
import { join as join135, resolve as resolve46 } from "node:path";
|
|
108088
108494
|
|
|
108089
108495
|
// src/domains/github/kit-access-checker.ts
|
|
108090
108496
|
init_error2();
|
|
@@ -108254,7 +108660,7 @@ async function runPreflightChecks() {
|
|
|
108254
108660
|
// src/domains/installation/fresh-installer.ts
|
|
108255
108661
|
init_metadata_migration();
|
|
108256
108662
|
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
|
|
108663
|
+
import { basename as basename28, dirname as dirname42, join as join133, resolve as resolve44 } from "node:path";
|
|
108258
108664
|
init_logger();
|
|
108259
108665
|
init_safe_spinner();
|
|
108260
108666
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -108306,15 +108712,15 @@ async function analyzeFreshInstallation(claudeDir3) {
|
|
|
108306
108712
|
};
|
|
108307
108713
|
}
|
|
108308
108714
|
function cleanupEmptyDirectories2(filePath, claudeDir3) {
|
|
108309
|
-
const normalizedClaudeDir =
|
|
108310
|
-
let currentDir =
|
|
108715
|
+
const normalizedClaudeDir = resolve44(claudeDir3);
|
|
108716
|
+
let currentDir = resolve44(dirname42(filePath));
|
|
108311
108717
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
|
|
108312
108718
|
try {
|
|
108313
108719
|
const entries = readdirSync10(currentDir);
|
|
108314
108720
|
if (entries.length === 0) {
|
|
108315
108721
|
rmdirSync2(currentDir);
|
|
108316
108722
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
108317
|
-
currentDir =
|
|
108723
|
+
currentDir = resolve44(dirname42(currentDir));
|
|
108318
108724
|
} else {
|
|
108319
108725
|
break;
|
|
108320
108726
|
}
|
|
@@ -108504,7 +108910,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
108504
108910
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
108505
108911
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
108506
108912
|
import { homedir as homedir47 } from "node:os";
|
|
108507
|
-
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as
|
|
108913
|
+
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as resolve45 } from "node:path";
|
|
108508
108914
|
var LEGACY_KIT_MARKERS = [
|
|
108509
108915
|
"metadata.json",
|
|
108510
108916
|
".ck.json",
|
|
@@ -108530,7 +108936,7 @@ function uniqueNormalizedPaths(paths) {
|
|
|
108530
108936
|
const seen = new Set;
|
|
108531
108937
|
const result = [];
|
|
108532
108938
|
for (const path17 of paths) {
|
|
108533
|
-
const normalized = normalize11(
|
|
108939
|
+
const normalized = normalize11(resolve45(path17));
|
|
108534
108940
|
if (seen.has(normalized))
|
|
108535
108941
|
continue;
|
|
108536
108942
|
seen.add(normalized);
|
|
@@ -108595,8 +109001,8 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
|
|
|
108595
109001
|
if (safeEnvPath(env2.CLAUDE_CONFIG_DIR)) {
|
|
108596
109002
|
return { status: "skipped", reason: "custom-global-dir", candidateDirs: [] };
|
|
108597
109003
|
}
|
|
108598
|
-
const targetDir = normalize11(
|
|
108599
|
-
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(
|
|
109004
|
+
const targetDir = normalize11(resolve45(options2.targetDir));
|
|
109005
|
+
const candidateDirs = getLegacyWindowsGlobalKitDirCandidates(env2, options2.homeDir).filter((candidate) => normalize11(resolve45(candidate)) !== targetDir);
|
|
108600
109006
|
const legacyDirs = [];
|
|
108601
109007
|
for (const candidate of candidateDirs) {
|
|
108602
109008
|
if (await hasKitMarkers(candidate)) {
|
|
@@ -108819,7 +109225,7 @@ async function handleSelection(ctx) {
|
|
|
108819
109225
|
}
|
|
108820
109226
|
}
|
|
108821
109227
|
}
|
|
108822
|
-
const resolvedDir =
|
|
109228
|
+
const resolvedDir = resolve46(targetDir);
|
|
108823
109229
|
if (ctx.options.global) {
|
|
108824
109230
|
try {
|
|
108825
109231
|
const repairResult = await repairLegacyWindowsGlobalKitDir({ targetDir: resolvedDir });
|
|
@@ -109015,8 +109421,8 @@ async function handleSelection(ctx) {
|
|
|
109015
109421
|
};
|
|
109016
109422
|
}
|
|
109017
109423
|
// 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
|
|
109424
|
+
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile61, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile35 } from "node:fs/promises";
|
|
109425
|
+
import { dirname as dirname44, join as join136, resolve as resolve47 } from "node:path";
|
|
109020
109426
|
init_logger();
|
|
109021
109427
|
init_path_resolver();
|
|
109022
109428
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -109025,7 +109431,7 @@ async function handleSync(ctx) {
|
|
|
109025
109431
|
if (!ctx.options.sync) {
|
|
109026
109432
|
return ctx;
|
|
109027
109433
|
}
|
|
109028
|
-
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() :
|
|
109434
|
+
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve47(ctx.options.dir || ".");
|
|
109029
109435
|
const claudeDir3 = ctx.options.global ? resolvedDir : join136(resolvedDir, ".claude");
|
|
109030
109436
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
109031
109437
|
logger.error("Cannot sync: no .claude directory found");
|
|
@@ -109159,7 +109565,7 @@ async function acquireSyncLock(global3) {
|
|
|
109159
109565
|
}
|
|
109160
109566
|
logger.debug(`Lock stat failed: ${statError}`);
|
|
109161
109567
|
}
|
|
109162
|
-
await new Promise((
|
|
109568
|
+
await new Promise((resolve48) => setTimeout(resolve48, 100));
|
|
109163
109569
|
continue;
|
|
109164
109570
|
}
|
|
109165
109571
|
throw err;
|
|
@@ -109184,7 +109590,7 @@ async function executeSyncMerge(ctx) {
|
|
|
109184
109590
|
try {
|
|
109185
109591
|
const sourceMetadataPath = join136(upstreamDir, "metadata.json");
|
|
109186
109592
|
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
109187
|
-
const content = await
|
|
109593
|
+
const content = await readFile61(sourceMetadataPath, "utf-8");
|
|
109188
109594
|
sourceMetadata = JSON.parse(content);
|
|
109189
109595
|
deletions = sourceMetadata.deletions || [];
|
|
109190
109596
|
}
|
|
@@ -109325,7 +109731,7 @@ async function executeSyncMerge(ctx) {
|
|
|
109325
109731
|
try {
|
|
109326
109732
|
const tempPath = `${currentPath}.tmp.${Date.now()}`;
|
|
109327
109733
|
try {
|
|
109328
|
-
await
|
|
109734
|
+
await writeFile35(tempPath, result.result, "utf-8");
|
|
109329
109735
|
await rename12(tempPath, currentPath);
|
|
109330
109736
|
} catch (atomicError) {
|
|
109331
109737
|
await unlink13(tempPath).catch(() => {});
|
|
@@ -109512,7 +109918,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
109512
109918
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
109513
109919
|
init_logger();
|
|
109514
109920
|
init_types3();
|
|
109515
|
-
import { readFile as
|
|
109921
|
+
import { readFile as readFile62, readdir as readdir43, writeFile as writeFile36 } from "node:fs/promises";
|
|
109516
109922
|
import { join as join138, relative as relative31 } from "node:path";
|
|
109517
109923
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
109518
109924
|
".md",
|
|
@@ -109579,7 +109985,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
109579
109985
|
if (!shouldTransform)
|
|
109580
109986
|
continue;
|
|
109581
109987
|
try {
|
|
109582
|
-
const content = await
|
|
109988
|
+
const content = await readFile62(fullPath, "utf-8");
|
|
109583
109989
|
let newContent = content;
|
|
109584
109990
|
let changeCount = 0;
|
|
109585
109991
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -109595,7 +110001,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
109595
110001
|
if (options2.dryRun) {
|
|
109596
110002
|
logger.debug(`[dry-run] Would update ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
109597
110003
|
} else {
|
|
109598
|
-
await
|
|
110004
|
+
await writeFile36(fullPath, newContent, "utf-8");
|
|
109599
110005
|
logger.debug(`Updated ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
109600
110006
|
}
|
|
109601
110007
|
filesChanged++;
|
|
@@ -109701,7 +110107,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
109701
110107
|
|
|
109702
110108
|
// src/services/transformers/global-path-transformer.ts
|
|
109703
110109
|
init_logger();
|
|
109704
|
-
import { readFile as
|
|
110110
|
+
import { readFile as readFile63, readdir as readdir44, writeFile as writeFile37 } from "node:fs/promises";
|
|
109705
110111
|
import { homedir as homedir48, platform as platform16 } from "node:os";
|
|
109706
110112
|
import { extname as extname7, join as join139 } from "node:path";
|
|
109707
110113
|
var IS_WINDOWS3 = platform16() === "win32";
|
|
@@ -109852,12 +110258,12 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
109852
110258
|
await processDirectory2(fullPath);
|
|
109853
110259
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
109854
110260
|
try {
|
|
109855
|
-
const content = await
|
|
110261
|
+
const content = await readFile63(fullPath, "utf-8");
|
|
109856
110262
|
const { transformed, changes } = transformContent(content, {
|
|
109857
110263
|
targetClaudeDir: options2.targetClaudeDir
|
|
109858
110264
|
});
|
|
109859
110265
|
if (changes > 0) {
|
|
109860
|
-
await
|
|
110266
|
+
await writeFile37(fullPath, transformed, "utf-8");
|
|
109861
110267
|
filesTransformed++;
|
|
109862
110268
|
totalChanges += changes;
|
|
109863
110269
|
if (options2.verbose) {
|
|
@@ -110144,9 +110550,9 @@ async function initCommand(options2) {
|
|
|
110144
110550
|
init_dist2();
|
|
110145
110551
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
110146
110552
|
import { existsSync as existsSync68 } from "node:fs";
|
|
110147
|
-
import { readFile as
|
|
110553
|
+
import { readFile as readFile67, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
110148
110554
|
import { homedir as homedir52 } from "node:os";
|
|
110149
|
-
import { basename as basename30, join as join144, resolve as
|
|
110555
|
+
import { basename as basename30, join as join144, resolve as resolve48 } from "node:path";
|
|
110150
110556
|
init_logger();
|
|
110151
110557
|
|
|
110152
110558
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -110359,13 +110765,13 @@ init_model_taxonomy();
|
|
|
110359
110765
|
init_logger();
|
|
110360
110766
|
init_dist2();
|
|
110361
110767
|
init_model_taxonomy();
|
|
110362
|
-
import { mkdir as mkdir39, readFile as
|
|
110768
|
+
import { mkdir as mkdir39, readFile as readFile66, writeFile as writeFile39 } from "node:fs/promises";
|
|
110363
110769
|
import { homedir as homedir51 } from "node:os";
|
|
110364
110770
|
import { dirname as dirname45, join as join143 } from "node:path";
|
|
110365
110771
|
|
|
110366
110772
|
// src/commands/portable/models-dev-cache.ts
|
|
110367
110773
|
init_logger();
|
|
110368
|
-
import { mkdir as mkdir38, readFile as
|
|
110774
|
+
import { mkdir as mkdir38, readFile as readFile64, rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
|
|
110369
110775
|
import { homedir as homedir49 } from "node:os";
|
|
110370
110776
|
import { join as join141 } from "node:path";
|
|
110371
110777
|
|
|
@@ -110390,7 +110796,7 @@ function tmpFilePath(cacheDir) {
|
|
|
110390
110796
|
async function readCacheEntry(cacheDir) {
|
|
110391
110797
|
const filePath = cacheFilePath(cacheDir);
|
|
110392
110798
|
try {
|
|
110393
|
-
const raw2 = await
|
|
110799
|
+
const raw2 = await readFile64(filePath, "utf-8");
|
|
110394
110800
|
const parsed = JSON.parse(raw2);
|
|
110395
110801
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && "fetchedAt" in parsed && typeof parsed.fetchedAt === "string" && "payload" in parsed && typeof parsed.payload === "object" && parsed.payload !== null) {
|
|
110396
110802
|
return parsed;
|
|
@@ -110408,7 +110814,7 @@ async function writeCacheEntry(cacheDir, entry) {
|
|
|
110408
110814
|
await mkdir38(cacheDir, { recursive: true });
|
|
110409
110815
|
const tmp = tmpFilePath(cacheDir);
|
|
110410
110816
|
const dest = cacheFilePath(cacheDir);
|
|
110411
|
-
await
|
|
110817
|
+
await writeFile38(tmp, JSON.stringify(entry), "utf-8");
|
|
110412
110818
|
await rename14(tmp, dest);
|
|
110413
110819
|
}
|
|
110414
110820
|
async function fetchCatalog(fetcher) {
|
|
@@ -110458,7 +110864,7 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
110458
110864
|
|
|
110459
110865
|
// src/commands/portable/opencode-model-discovery.ts
|
|
110460
110866
|
init_logger();
|
|
110461
|
-
import { readFile as
|
|
110867
|
+
import { readFile as readFile65 } from "node:fs/promises";
|
|
110462
110868
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
110463
110869
|
import { join as join142 } from "node:path";
|
|
110464
110870
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
@@ -110472,7 +110878,7 @@ function resolveOpenCodeAuthPath(homeDir) {
|
|
|
110472
110878
|
async function readAuthedProviders(homeDir) {
|
|
110473
110879
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
110474
110880
|
try {
|
|
110475
|
-
const raw2 = await
|
|
110881
|
+
const raw2 = await readFile65(authPath, "utf-8");
|
|
110476
110882
|
const parsed = JSON.parse(raw2);
|
|
110477
110883
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
110478
110884
|
return Object.keys(parsed);
|
|
@@ -110674,7 +111080,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110674
111080
|
const configPath = getOpenCodeConfigPath(options2);
|
|
110675
111081
|
let existing = null;
|
|
110676
111082
|
try {
|
|
110677
|
-
const raw2 = await
|
|
111083
|
+
const raw2 = await readFile66(configPath, "utf-8");
|
|
110678
111084
|
const parsed = JSON.parse(raw2);
|
|
110679
111085
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
110680
111086
|
existing = parsed;
|
|
@@ -110715,7 +111121,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110715
111121
|
const chosenModel2 = response2.action === "custom" ? response2.value : suggestion2.model;
|
|
110716
111122
|
const next2 = { ...existing, model: chosenModel2 };
|
|
110717
111123
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110718
|
-
await
|
|
111124
|
+
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110719
111125
|
`, "utf-8");
|
|
110720
111126
|
return { path: configPath, action: "added", model: chosenModel2, reason: suggestion2.reason };
|
|
110721
111127
|
}
|
|
@@ -110726,7 +111132,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110726
111132
|
}
|
|
110727
111133
|
const next2 = { ...existing ?? {}, model: suggestion.model };
|
|
110728
111134
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110729
|
-
await
|
|
111135
|
+
await writeFile39(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110730
111136
|
`, "utf-8");
|
|
110731
111137
|
return {
|
|
110732
111138
|
path: configPath,
|
|
@@ -110748,7 +111154,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110748
111154
|
const chosenModel = response.action === "custom" ? response.value : suggestion.ok ? suggestion.model : "";
|
|
110749
111155
|
const next = { ...existing ?? {}, model: chosenModel };
|
|
110750
111156
|
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110751
|
-
await
|
|
111157
|
+
await writeFile39(configPath, `${JSON.stringify(next, null, 2)}
|
|
110752
111158
|
`, "utf-8");
|
|
110753
111159
|
return {
|
|
110754
111160
|
path: configPath,
|
|
@@ -111385,11 +111791,80 @@ function logHookCleanupResults(results) {
|
|
|
111385
111791
|
function appendMigrationWarningMessages(target, warnings) {
|
|
111386
111792
|
if (!warnings)
|
|
111387
111793
|
return;
|
|
111794
|
+
for (const message of formatMigrationWarningMessages(warnings)) {
|
|
111795
|
+
if (!target.includes(message))
|
|
111796
|
+
target.push(message);
|
|
111797
|
+
}
|
|
111798
|
+
}
|
|
111799
|
+
function formatMigrationWarningMessages(warnings) {
|
|
111800
|
+
const unsupportedEvents = collectWarningValues(warnings, "unsupported-event", "event");
|
|
111801
|
+
const excludedHooks = collectWarningValues(warnings, "excluded-hook", "hookFile");
|
|
111802
|
+
const missingHooks = collectWarningValues(warnings, "missing-hook-file", "hookFile").filter((hookFile) => !isGeneratedContextHookName(hookFile));
|
|
111803
|
+
const groupedReasons = new Set(["unsupported-event", "excluded-hook", "missing-hook-file"]);
|
|
111804
|
+
const messages = [];
|
|
111805
|
+
if (unsupportedEvents.length > 0) {
|
|
111806
|
+
messages.push(`Skipped Codex-incompatible Claude hook event(s): ${summarizeValues(unsupportedEvents)}.`);
|
|
111807
|
+
}
|
|
111808
|
+
if (excludedHooks.length > 0) {
|
|
111809
|
+
messages.push(`Skipped Claude-only/generated hook file(s) for Codex: ${summarizeValues(excludedHooks)}.`);
|
|
111810
|
+
}
|
|
111811
|
+
if (missingHooks.length > 0) {
|
|
111812
|
+
messages.push(`Skipped hook registration(s) whose files are not installed: ${summarizeValues(missingHooks)}. Run \`ck init --restore-ck-hooks\` if these hooks should exist.`);
|
|
111813
|
+
}
|
|
111388
111814
|
for (const warning2 of warnings) {
|
|
111389
|
-
if (!
|
|
111390
|
-
|
|
111815
|
+
if (!groupedReasons.has(warning2.reason) && !messages.includes(warning2.message)) {
|
|
111816
|
+
messages.push(warning2.message);
|
|
111817
|
+
}
|
|
111818
|
+
}
|
|
111819
|
+
return messages;
|
|
111820
|
+
}
|
|
111821
|
+
function collectWarningValues(warnings, reason, field) {
|
|
111822
|
+
return Array.from(new Set(warnings.filter((warning2) => warning2.reason === reason).map((warning2) => warning2[field]).filter((value) => typeof value === "string" && value.length > 0))).sort((a3, b3) => a3.localeCompare(b3));
|
|
111823
|
+
}
|
|
111824
|
+
function summarizeValues(values, maxValues = 8) {
|
|
111825
|
+
const visible = values.slice(0, maxValues);
|
|
111826
|
+
const suffix = values.length > visible.length ? `, and ${values.length - visible.length} more` : "";
|
|
111827
|
+
return `${visible.join(", ")}${suffix}`;
|
|
111828
|
+
}
|
|
111829
|
+
function appendFallbackSkillActionsToPlan(plan, skills, selectedProviders, installGlobally) {
|
|
111830
|
+
if (skills.length === 0)
|
|
111831
|
+
return plan;
|
|
111832
|
+
const existingSkillKeys = new Set(plan.actions.filter((action) => action.type === "skill").map((action) => `${action.provider}\x00${String(action.global)}\x00${action.item}`));
|
|
111833
|
+
const fallbackActions = [];
|
|
111834
|
+
for (const provider of selectedProviders.filter((entry) => getProvidersSupporting("skills").includes(entry))) {
|
|
111835
|
+
const global3 = resolvePortableTypeGlobal(provider, "skill", installGlobally);
|
|
111836
|
+
const basePath = getPortableBasePath(provider, "skills", { global: global3 });
|
|
111837
|
+
if (!basePath)
|
|
111838
|
+
continue;
|
|
111839
|
+
for (const skill of skills) {
|
|
111840
|
+
const key = `${provider}\x00${String(global3)}\x00${skill.name}`;
|
|
111841
|
+
if (existingSkillKeys.has(key))
|
|
111842
|
+
continue;
|
|
111843
|
+
existingSkillKeys.add(key);
|
|
111844
|
+
fallbackActions.push({
|
|
111845
|
+
action: "install",
|
|
111846
|
+
global: global3,
|
|
111847
|
+
isDirectoryItem: true,
|
|
111848
|
+
item: skill.name,
|
|
111849
|
+
provider,
|
|
111850
|
+
reason: "New item, not previously installed",
|
|
111851
|
+
reasonCode: "new-item",
|
|
111852
|
+
reasonCopy: "New - not previously installed",
|
|
111853
|
+
targetPath: join144(basePath, skill.name),
|
|
111854
|
+
type: "skill"
|
|
111855
|
+
});
|
|
111391
111856
|
}
|
|
111392
111857
|
}
|
|
111858
|
+
if (fallbackActions.length === 0)
|
|
111859
|
+
return plan;
|
|
111860
|
+
return {
|
|
111861
|
+
...plan,
|
|
111862
|
+
actions: [...plan.actions, ...fallbackActions],
|
|
111863
|
+
summary: {
|
|
111864
|
+
...plan.summary,
|
|
111865
|
+
install: plan.summary.install + fallbackActions.length
|
|
111866
|
+
}
|
|
111867
|
+
};
|
|
111393
111868
|
}
|
|
111394
111869
|
async function runInstallMode(options2, discoveredItems, _selectedProviders, _installGlobally) {
|
|
111395
111870
|
const interactive = process.stdout.isTTY && !options2.yes;
|
|
@@ -111530,7 +112005,7 @@ function shouldExecuteAction2(action) {
|
|
|
111530
112005
|
}
|
|
111531
112006
|
async function executeDeleteAction(action, options2) {
|
|
111532
112007
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
111533
|
-
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(
|
|
112008
|
+
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve48(action.targetPath));
|
|
111534
112009
|
try {
|
|
111535
112010
|
if (!shouldPreserveTarget && action.targetPath && existsSync68(action.targetPath)) {
|
|
111536
112011
|
await rm18(action.targetPath, { recursive: true, force: true });
|
|
@@ -111560,15 +112035,48 @@ async function executeDeleteAction(action, options2) {
|
|
|
111560
112035
|
};
|
|
111561
112036
|
}
|
|
111562
112037
|
}
|
|
112038
|
+
function hasSuccessfulReplacementWrite(action, results) {
|
|
112039
|
+
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));
|
|
112040
|
+
}
|
|
112041
|
+
function replacementTypeMatches(actionType, resultType) {
|
|
112042
|
+
return resultType === actionType || actionType === "command" && resultType === "skill";
|
|
112043
|
+
}
|
|
112044
|
+
function replacementItemMatches(action, result) {
|
|
112045
|
+
if (result.itemName === action.item || result.itemName === undefined)
|
|
112046
|
+
return true;
|
|
112047
|
+
const parts = result.path.replace(/\\/g, "/").split("/");
|
|
112048
|
+
const leaf = parts.at(-1) ?? "";
|
|
112049
|
+
const parent = parts.at(-2) ?? "";
|
|
112050
|
+
const leafName = leaf.replace(/\.[^.]+$/, "");
|
|
112051
|
+
return leafName === action.item || parent === action.item || action.type === "command" && parent === `source-command-${action.item}`;
|
|
112052
|
+
}
|
|
112053
|
+
function shouldRunDeleteAction(action, results) {
|
|
112054
|
+
if (action.reasonCode !== "path-migrated-cleanup")
|
|
112055
|
+
return true;
|
|
112056
|
+
return hasSuccessfulReplacementWrite(action, results);
|
|
112057
|
+
}
|
|
112058
|
+
function createSkippedPathMigrationCleanupResult2(action) {
|
|
112059
|
+
return {
|
|
112060
|
+
operation: "delete",
|
|
112061
|
+
portableType: action.type,
|
|
112062
|
+
itemName: action.item,
|
|
112063
|
+
provider: action.provider,
|
|
112064
|
+
providerDisplayName: providers[action.provider]?.displayName || action.provider,
|
|
112065
|
+
success: true,
|
|
112066
|
+
path: action.targetPath,
|
|
112067
|
+
skipped: true,
|
|
112068
|
+
skipReason: "Legacy path cleanup skipped because no successful replacement write was recorded"
|
|
112069
|
+
};
|
|
112070
|
+
}
|
|
111563
112071
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
111564
112072
|
if (!skillSourcePath)
|
|
111565
112073
|
return;
|
|
111566
|
-
const sourceMetadataPath = join144(
|
|
112074
|
+
const sourceMetadataPath = join144(resolve48(skillSourcePath, ".."), "metadata.json");
|
|
111567
112075
|
if (!existsSync68(sourceMetadataPath))
|
|
111568
112076
|
return;
|
|
111569
112077
|
let sourceMetadata;
|
|
111570
112078
|
try {
|
|
111571
|
-
const content = await
|
|
112079
|
+
const content = await readFile67(sourceMetadataPath, "utf-8");
|
|
111572
112080
|
sourceMetadata = JSON.parse(content);
|
|
111573
112081
|
} catch (error) {
|
|
111574
112082
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -111624,7 +112132,7 @@ async function migrateCommand(options2) {
|
|
|
111624
112132
|
logger.warning(`[migrate] Skipping ${skippedShellHooks.length} shell hook(s) not supported for migration (node-runnable only): ${skippedShellHooks.join(", ")}`);
|
|
111625
112133
|
}
|
|
111626
112134
|
if (disabledGeneratedHooks.length > 0) {
|
|
111627
|
-
logger.
|
|
112135
|
+
logger.verbose(`[migrate] Disabling ${disabledGeneratedHooks.length} generated-context hook(s): ${disabledGeneratedHooks.map((item) => item.name).join(", ")}`);
|
|
111628
112136
|
}
|
|
111629
112137
|
spinner.stop("Discovery complete");
|
|
111630
112138
|
const hasItems = agents2.length > 0 || commands.length > 0 || skills.length > 0 || configItem !== null || ruleItems.length > 0 || hookItems.length > 0;
|
|
@@ -111848,7 +112356,7 @@ async function migrateCommand(options2) {
|
|
|
111848
112356
|
types: config.types?.filter((type) => type !== "skill")
|
|
111849
112357
|
})), portableTypes);
|
|
111850
112358
|
const reinstallEmptyDirs = options2.respectDeletions ? false : options2.reinstallEmptyDirs ?? true;
|
|
111851
|
-
const plan = reconcile({
|
|
112359
|
+
const plan = appendFallbackSkillActionsToPlan(reconcile({
|
|
111852
112360
|
sourceItems: sourceStates,
|
|
111853
112361
|
registry,
|
|
111854
112362
|
targetStates,
|
|
@@ -111856,13 +112364,13 @@ async function migrateCommand(options2) {
|
|
|
111856
112364
|
force: options2.force,
|
|
111857
112365
|
typeDirectoryStates,
|
|
111858
112366
|
respectDeletions: !reinstallEmptyDirs
|
|
111859
|
-
});
|
|
112367
|
+
}), effectiveSkills, selectedProviders, installGlobally);
|
|
111860
112368
|
reconcileSpinner.stop("Plan computed");
|
|
111861
112369
|
const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
111862
112370
|
renderBanners(plan.banners);
|
|
111863
112371
|
displayReconcilePlan(plan, { color: useColor });
|
|
111864
112372
|
if (options2.dryRun) {
|
|
111865
|
-
displayMigrationSummary(plan,
|
|
112373
|
+
displayMigrationSummary(plan, [], { color: useColor, dryRun: true });
|
|
111866
112374
|
return;
|
|
111867
112375
|
}
|
|
111868
112376
|
if (plan.hasConflicts) {
|
|
@@ -111871,7 +112379,7 @@ async function migrateCommand(options2) {
|
|
|
111871
112379
|
for (const action of conflictActions) {
|
|
111872
112380
|
if (!action.diff && action.targetPath && existsSync68(action.targetPath)) {
|
|
111873
112381
|
try {
|
|
111874
|
-
const targetContent = await
|
|
112382
|
+
const targetContent = await readFile67(action.targetPath, "utf-8");
|
|
111875
112383
|
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
112384
|
if (sourceItem) {
|
|
111877
112385
|
const providerConfig = providers[action.provider];
|
|
@@ -111965,26 +112473,12 @@ async function migrateCommand(options2) {
|
|
|
111965
112473
|
writeTasks.push({ item, provider, type: "hooks", global: action.global });
|
|
111966
112474
|
}
|
|
111967
112475
|
}
|
|
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
112476
|
const progressSink = createMigrateProgressSink(writeTasks.length + plannedDeleteActions.length);
|
|
111983
112477
|
const writtenPaths = new Set;
|
|
111984
112478
|
const recordSuccessfulWrites = (task, taskResults) => {
|
|
111985
112479
|
for (const result of taskResults.filter((entry) => entry.success && !entry.skipped)) {
|
|
111986
112480
|
if (result.path.length > 0) {
|
|
111987
|
-
writtenPaths.add(
|
|
112481
|
+
writtenPaths.add(resolve48(result.path));
|
|
111988
112482
|
}
|
|
111989
112483
|
if (task.type === "hooks") {
|
|
111990
112484
|
const existing = successfulHookFiles.get(task.provider) ?? {
|
|
@@ -111995,7 +112489,7 @@ async function migrateCommand(options2) {
|
|
|
111995
112489
|
successfulHookFiles.set(task.provider, existing);
|
|
111996
112490
|
if (result.path.length > 0) {
|
|
111997
112491
|
const absExisting = successfulHookAbsPaths.get(task.provider) ?? [];
|
|
111998
|
-
absExisting.push(
|
|
112492
|
+
absExisting.push(resolve48(result.path));
|
|
111999
112493
|
successfulHookAbsPaths.set(task.provider, absExisting);
|
|
112000
112494
|
}
|
|
112001
112495
|
}
|
|
@@ -112100,6 +112594,11 @@ async function migrateCommand(options2) {
|
|
|
112100
112594
|
}
|
|
112101
112595
|
await processMetadataDeletions(skillSource, installGlobally);
|
|
112102
112596
|
for (const deleteAction of plannedDeleteActions) {
|
|
112597
|
+
if (!shouldRunDeleteAction(deleteAction, allResults)) {
|
|
112598
|
+
allResults.push(createSkippedPathMigrationCleanupResult2(deleteAction));
|
|
112599
|
+
progressSink.tick("Cleanup");
|
|
112600
|
+
continue;
|
|
112601
|
+
}
|
|
112103
112602
|
allResults.push(await executeDeleteAction(deleteAction, {
|
|
112104
112603
|
preservePaths: writtenPaths
|
|
112105
112604
|
}));
|
|
@@ -112138,7 +112637,7 @@ async function migrateCommand(options2) {
|
|
|
112138
112637
|
}
|
|
112139
112638
|
}
|
|
112140
112639
|
try {
|
|
112141
|
-
const kitRoot = (agentSource ?
|
|
112640
|
+
const kitRoot = (agentSource ? resolve48(agentSource, "..") : null) ?? (commandSource ? resolve48(commandSource, "..") : null) ?? (skillSource ? resolve48(skillSource, "..") : null) ?? null;
|
|
112142
112641
|
const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
|
|
112143
112642
|
if (manifest?.cliVersion) {
|
|
112144
112643
|
await updateAppliedManifestVersion(manifest.cliVersion);
|
|
@@ -112301,32 +112800,6 @@ function progressLabelForType(type) {
|
|
|
112301
112800
|
return "Migrating";
|
|
112302
112801
|
}
|
|
112303
112802
|
}
|
|
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
112803
|
// src/commands/new/new-command.ts
|
|
112331
112804
|
init_logger();
|
|
112332
112805
|
init_safe_prompts();
|
|
@@ -112335,7 +112808,7 @@ var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
|
112335
112808
|
|
|
112336
112809
|
// src/commands/new/phases/directory-setup.ts
|
|
112337
112810
|
init_config_manager();
|
|
112338
|
-
import { resolve as
|
|
112811
|
+
import { resolve as resolve49 } from "node:path";
|
|
112339
112812
|
init_logger();
|
|
112340
112813
|
init_path_resolver();
|
|
112341
112814
|
init_types3();
|
|
@@ -112420,7 +112893,7 @@ async function directorySetup(validOptions, prompts) {
|
|
|
112420
112893
|
targetDir = await prompts.getDirectory(targetDir);
|
|
112421
112894
|
}
|
|
112422
112895
|
}
|
|
112423
|
-
const resolvedDir =
|
|
112896
|
+
const resolvedDir = resolve49(targetDir);
|
|
112424
112897
|
logger.info(`Target directory: ${resolvedDir}`);
|
|
112425
112898
|
if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
|
|
112426
112899
|
logger.warning("You're creating a project at HOME directory.");
|
|
@@ -112754,7 +113227,7 @@ Please use only one download method.`);
|
|
|
112754
113227
|
// src/commands/plan/plan-command.ts
|
|
112755
113228
|
init_output_manager();
|
|
112756
113229
|
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
|
|
113230
|
+
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as resolve53 } from "node:path";
|
|
112758
113231
|
|
|
112759
113232
|
// src/commands/plan/plan-read-handlers.ts
|
|
112760
113233
|
init_config();
|
|
@@ -112764,7 +113237,7 @@ init_logger();
|
|
|
112764
113237
|
init_output_manager();
|
|
112765
113238
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
112766
113239
|
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
|
|
113240
|
+
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as resolve51 } from "node:path";
|
|
112768
113241
|
|
|
112769
113242
|
// src/commands/plan/plan-dependencies.ts
|
|
112770
113243
|
init_config();
|
|
@@ -112822,14 +113295,14 @@ init_config();
|
|
|
112822
113295
|
init_plan_parser();
|
|
112823
113296
|
init_plan_scope();
|
|
112824
113297
|
init_plans_registry();
|
|
112825
|
-
import { isAbsolute as isAbsolute13, resolve as
|
|
113298
|
+
import { isAbsolute as isAbsolute13, resolve as resolve50 } from "node:path";
|
|
112826
113299
|
async function getGlobalPlansDirFromCwd() {
|
|
112827
113300
|
const projectRoot = findProjectRoot(process.cwd());
|
|
112828
113301
|
const { config } = await CkConfigManager.loadFull(projectRoot);
|
|
112829
113302
|
return resolveGlobalPlansDir(config);
|
|
112830
113303
|
}
|
|
112831
113304
|
function resolveTargetFromBase(target, baseDir) {
|
|
112832
|
-
const resolvedTarget = isAbsolute13(target) ?
|
|
113305
|
+
const resolvedTarget = isAbsolute13(target) ? resolve50(target) : resolve50(baseDir, target);
|
|
112833
113306
|
return isWithinDir(resolvedTarget, baseDir) ? resolvedTarget : null;
|
|
112834
113307
|
}
|
|
112835
113308
|
|
|
@@ -112932,7 +113405,7 @@ async function handleStatus(target, options2) {
|
|
|
112932
113405
|
return;
|
|
112933
113406
|
}
|
|
112934
113407
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
112935
|
-
const t = effectiveTarget ?
|
|
113408
|
+
const t = effectiveTarget ? resolve51(effectiveTarget) : null;
|
|
112936
113409
|
const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(join148(t, "plan.md")) ? t : null;
|
|
112937
113410
|
if (plansDir) {
|
|
112938
113411
|
const planFiles = scanPlanDir(plansDir);
|
|
@@ -113117,7 +113590,7 @@ init_plan_parser();
|
|
|
113117
113590
|
init_plans_registry();
|
|
113118
113591
|
init_output_manager();
|
|
113119
113592
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
113120
|
-
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as
|
|
113593
|
+
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as resolve52 } from "node:path";
|
|
113121
113594
|
function quoteReadTarget(filePath) {
|
|
113122
113595
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
113123
113596
|
}
|
|
@@ -113160,13 +113633,13 @@ async function handleCreate(target, options2) {
|
|
|
113160
113633
|
return;
|
|
113161
113634
|
}
|
|
113162
113635
|
const globalBaseDir = options2.global ? await getGlobalPlansDirFromCwd() : undefined;
|
|
113163
|
-
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) :
|
|
113636
|
+
const resolvedDir = globalBaseDir ? resolveTargetFromBase(dir, globalBaseDir) : resolve52(dir);
|
|
113164
113637
|
if (globalBaseDir && !resolvedDir) {
|
|
113165
113638
|
output.error("[X] Target directory must stay within the configured global plans root");
|
|
113166
113639
|
process.exitCode = 1;
|
|
113167
113640
|
return;
|
|
113168
113641
|
}
|
|
113169
|
-
const safeResolvedDir = resolvedDir ??
|
|
113642
|
+
const safeResolvedDir = resolvedDir ?? resolve52(dir);
|
|
113170
113643
|
const result = scaffoldPlan({
|
|
113171
113644
|
title: options2.title,
|
|
113172
113645
|
phases: phaseNames.map((name2) => ({ name: name2 })),
|
|
@@ -113345,19 +113818,19 @@ async function handleAddPhase(target, options2) {
|
|
|
113345
113818
|
// src/commands/plan/plan-command.ts
|
|
113346
113819
|
function resolveTargetPath(target, baseDir) {
|
|
113347
113820
|
if (!baseDir) {
|
|
113348
|
-
return
|
|
113821
|
+
return resolve53(target);
|
|
113349
113822
|
}
|
|
113350
113823
|
if (isAbsolute14(target)) {
|
|
113351
|
-
return
|
|
113824
|
+
return resolve53(target);
|
|
113352
113825
|
}
|
|
113353
|
-
const cwdCandidate =
|
|
113826
|
+
const cwdCandidate = resolve53(target);
|
|
113354
113827
|
if (existsSync71(cwdCandidate)) {
|
|
113355
113828
|
return cwdCandidate;
|
|
113356
113829
|
}
|
|
113357
|
-
return
|
|
113830
|
+
return resolve53(baseDir, target);
|
|
113358
113831
|
}
|
|
113359
113832
|
function resolvePlanFile(target, baseDir) {
|
|
113360
|
-
const t = target ? resolveTargetPath(target, baseDir) : baseDir ?
|
|
113833
|
+
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve53(baseDir) : process.cwd();
|
|
113361
113834
|
if (existsSync71(t)) {
|
|
113362
113835
|
const stat24 = statSync12(t);
|
|
113363
113836
|
if (stat24.isFile())
|
|
@@ -113421,7 +113894,7 @@ async function planCommand(action, target, options2) {
|
|
|
113421
113894
|
let resolvedTarget = target;
|
|
113422
113895
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
113423
113896
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
113424
|
-
const existsOnDisk = !looksLikePath && existsSync71(
|
|
113897
|
+
const existsOnDisk = !looksLikePath && existsSync71(resolve53(resolvedAction));
|
|
113425
113898
|
if (looksLikePath || existsOnDisk) {
|
|
113426
113899
|
resolvedTarget = resolvedAction;
|
|
113427
113900
|
resolvedAction = undefined;
|
|
@@ -113464,11 +113937,11 @@ init_logger();
|
|
|
113464
113937
|
init_safe_prompts();
|
|
113465
113938
|
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
113466
113939
|
import { existsSync as existsSync72 } from "node:fs";
|
|
113467
|
-
import { resolve as
|
|
113940
|
+
import { resolve as resolve54 } from "node:path";
|
|
113468
113941
|
async function handleAdd(projectPath, options2) {
|
|
113469
113942
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
113470
113943
|
intro("Add Project");
|
|
113471
|
-
const absolutePath =
|
|
113944
|
+
const absolutePath = resolve54(projectPath);
|
|
113472
113945
|
if (!existsSync72(absolutePath)) {
|
|
113473
113946
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
113474
113947
|
process.exitCode = 1;
|
|
@@ -113889,11 +114362,11 @@ init_logger();
|
|
|
113889
114362
|
init_agents();
|
|
113890
114363
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
113891
114364
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
113892
|
-
import { readFile as
|
|
114365
|
+
import { readFile as readFile68 } from "node:fs/promises";
|
|
113893
114366
|
import { join as join151 } from "node:path";
|
|
113894
114367
|
|
|
113895
114368
|
// src/commands/skills/installed-skills-inventory.ts
|
|
113896
|
-
import { join as join150, resolve as
|
|
114369
|
+
import { join as join150, resolve as resolve55 } from "node:path";
|
|
113897
114370
|
init_path_resolver();
|
|
113898
114371
|
var SCOPE_SORT_ORDER = {
|
|
113899
114372
|
project: 0,
|
|
@@ -113901,8 +114374,8 @@ var SCOPE_SORT_ORDER = {
|
|
|
113901
114374
|
};
|
|
113902
114375
|
async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
113903
114376
|
const projectDir = options2.projectDir ?? process.cwd();
|
|
113904
|
-
const globalDir =
|
|
113905
|
-
const projectClaudeDir =
|
|
114377
|
+
const globalDir = resolve55(options2.globalDir ?? PathResolver.getGlobalKitDir());
|
|
114378
|
+
const projectClaudeDir = resolve55(projectDir, ".claude");
|
|
113906
114379
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
113907
114380
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
113908
114381
|
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join150(projectClaudeDir, "skills")),
|
|
@@ -113945,6 +114418,7 @@ var AgentType = exports_external.enum([
|
|
|
113945
114418
|
"github-copilot",
|
|
113946
114419
|
"amp",
|
|
113947
114420
|
"kilo",
|
|
114421
|
+
"kiro",
|
|
113948
114422
|
"roo",
|
|
113949
114423
|
"windsurf",
|
|
113950
114424
|
"cline",
|
|
@@ -114068,7 +114542,7 @@ async function handleValidate2(sourcePath) {
|
|
|
114068
114542
|
for (const skill of skills) {
|
|
114069
114543
|
const skillMdPath = join151(skill.path, "SKILL.md");
|
|
114070
114544
|
try {
|
|
114071
|
-
const content = await
|
|
114545
|
+
const content = await readFile68(skillMdPath, "utf-8");
|
|
114072
114546
|
const { data } = import_gray_matter12.default(content, {
|
|
114073
114547
|
engines: { javascript: { parse: () => ({}) } }
|
|
114074
114548
|
});
|
|
@@ -114649,7 +115123,7 @@ async function detectInstallations() {
|
|
|
114649
115123
|
|
|
114650
115124
|
// src/commands/uninstall/removal-handler.ts
|
|
114651
115125
|
import { readdirSync as readdirSync12, rmSync as rmSync5 } from "node:fs";
|
|
114652
|
-
import { basename as basename33, join as join153, resolve as
|
|
115126
|
+
import { basename as basename33, join as join153, resolve as resolve56, sep as sep13 } from "node:path";
|
|
114653
115127
|
init_logger();
|
|
114654
115128
|
init_safe_prompts();
|
|
114655
115129
|
init_safe_spinner();
|
|
@@ -114833,17 +115307,17 @@ async function restoreUninstallBackup(backup) {
|
|
|
114833
115307
|
}
|
|
114834
115308
|
async function isPathSafeToRemove(filePath, baseDir) {
|
|
114835
115309
|
try {
|
|
114836
|
-
const resolvedPath =
|
|
114837
|
-
const resolvedBase =
|
|
114838
|
-
if (!resolvedPath.startsWith(resolvedBase +
|
|
115310
|
+
const resolvedPath = resolve56(filePath);
|
|
115311
|
+
const resolvedBase = resolve56(baseDir);
|
|
115312
|
+
if (!resolvedPath.startsWith(resolvedBase + sep13) && resolvedPath !== resolvedBase) {
|
|
114839
115313
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
114840
115314
|
return false;
|
|
114841
115315
|
}
|
|
114842
115316
|
const stats = await import_fs_extra43.lstat(filePath);
|
|
114843
115317
|
if (stats.isSymbolicLink()) {
|
|
114844
115318
|
const realPath = await import_fs_extra43.realpath(filePath);
|
|
114845
|
-
const resolvedReal =
|
|
114846
|
-
if (!resolvedReal.startsWith(resolvedBase +
|
|
115319
|
+
const resolvedReal = resolve56(realPath);
|
|
115320
|
+
if (!resolvedReal.startsWith(resolvedBase + sep13) && resolvedReal !== resolvedBase) {
|
|
114847
115321
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
114848
115322
|
return false;
|
|
114849
115323
|
}
|
|
@@ -115380,7 +115854,7 @@ function getDisclaimerMarker() {
|
|
|
115380
115854
|
return AI_DISCLAIMER;
|
|
115381
115855
|
}
|
|
115382
115856
|
function spawnAndCollect2(command, args) {
|
|
115383
|
-
return new Promise((
|
|
115857
|
+
return new Promise((resolve57, reject) => {
|
|
115384
115858
|
const child = spawn6(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115385
115859
|
const chunks = [];
|
|
115386
115860
|
const stderrChunks = [];
|
|
@@ -115393,7 +115867,7 @@ function spawnAndCollect2(command, args) {
|
|
|
115393
115867
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115394
115868
|
return;
|
|
115395
115869
|
}
|
|
115396
|
-
|
|
115870
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115397
115871
|
});
|
|
115398
115872
|
});
|
|
115399
115873
|
}
|
|
@@ -115501,7 +115975,7 @@ function formatResponse(content, showBranding) {
|
|
|
115501
115975
|
return disclaimer + formatted + branding;
|
|
115502
115976
|
}
|
|
115503
115977
|
async function postViaGh(owner, repo, issueNumber, body) {
|
|
115504
|
-
return new Promise((
|
|
115978
|
+
return new Promise((resolve57, reject) => {
|
|
115505
115979
|
const args = [
|
|
115506
115980
|
"issue",
|
|
115507
115981
|
"comment",
|
|
@@ -115523,7 +115997,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
|
|
|
115523
115997
|
reject(new Error(`gh exited with code ${code2}: ${stderr}`));
|
|
115524
115998
|
return;
|
|
115525
115999
|
}
|
|
115526
|
-
|
|
116000
|
+
resolve57();
|
|
115527
116001
|
});
|
|
115528
116002
|
});
|
|
115529
116003
|
}
|
|
@@ -115641,7 +116115,7 @@ After completing the implementation:
|
|
|
115641
116115
|
"--allowedTools",
|
|
115642
116116
|
tools
|
|
115643
116117
|
];
|
|
115644
|
-
await new Promise((
|
|
116118
|
+
await new Promise((resolve57, reject) => {
|
|
115645
116119
|
const child = spawn8("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
|
|
115646
116120
|
child.stdin.write(prompt);
|
|
115647
116121
|
child.stdin.end();
|
|
@@ -115666,7 +116140,7 @@ After completing the implementation:
|
|
|
115666
116140
|
reject(new Error(`Claude exited ${code2}: ${stderr.slice(0, 500)}`));
|
|
115667
116141
|
return;
|
|
115668
116142
|
}
|
|
115669
|
-
|
|
116143
|
+
resolve57();
|
|
115670
116144
|
});
|
|
115671
116145
|
});
|
|
115672
116146
|
}
|
|
@@ -115810,7 +116284,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
|
|
|
115810
116284
|
return processedThisHour < maxPerHour;
|
|
115811
116285
|
}
|
|
115812
116286
|
function spawnAndCollect3(command, args) {
|
|
115813
|
-
return new Promise((
|
|
116287
|
+
return new Promise((resolve57, reject) => {
|
|
115814
116288
|
const child = spawn9(command, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
115815
116289
|
const chunks = [];
|
|
115816
116290
|
const stderrChunks = [];
|
|
@@ -115823,13 +116297,13 @@ function spawnAndCollect3(command, args) {
|
|
|
115823
116297
|
reject(new Error(`${command} exited with code ${code2}: ${stderr}`));
|
|
115824
116298
|
return;
|
|
115825
116299
|
}
|
|
115826
|
-
|
|
116300
|
+
resolve57(Buffer.concat(chunks).toString("utf-8"));
|
|
115827
116301
|
});
|
|
115828
116302
|
});
|
|
115829
116303
|
}
|
|
115830
116304
|
|
|
115831
116305
|
// src/commands/watch/phases/issue-processor.ts
|
|
115832
|
-
import { mkdir as mkdir40, writeFile as
|
|
116306
|
+
import { mkdir as mkdir40, writeFile as writeFile41 } from "node:fs/promises";
|
|
115833
116307
|
import { join as join156 } from "node:path";
|
|
115834
116308
|
|
|
115835
116309
|
// src/commands/watch/phases/approval-detector.ts
|
|
@@ -115875,7 +116349,7 @@ async function invokeClaude(options2) {
|
|
|
115875
116349
|
return collectClaudeOutput(child, options2.timeoutSec, verbose);
|
|
115876
116350
|
}
|
|
115877
116351
|
function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
115878
|
-
return new Promise((
|
|
116352
|
+
return new Promise((resolve57, reject) => {
|
|
115879
116353
|
const chunks = [];
|
|
115880
116354
|
const stderrChunks = [];
|
|
115881
116355
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -115905,7 +116379,7 @@ function collectClaudeOutput(child, timeoutSec, verbose = false) {
|
|
|
115905
116379
|
reject(new Error(`Claude exited with code ${code2}: ${stderr}`));
|
|
115906
116380
|
return;
|
|
115907
116381
|
}
|
|
115908
|
-
|
|
116382
|
+
resolve57(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
|
|
115909
116383
|
});
|
|
115910
116384
|
});
|
|
115911
116385
|
}
|
|
@@ -116464,7 +116938,7 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
116464
116938
|
const planDir = join156(projectDir, "plans", "watch");
|
|
116465
116939
|
await mkdir40(planDir, { recursive: true });
|
|
116466
116940
|
const planFilePath = join156(planDir, `issue-${issue.number}-plan.md`);
|
|
116467
|
-
await
|
|
116941
|
+
await writeFile41(planFilePath, planResult.planText, "utf-8");
|
|
116468
116942
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
116469
116943
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
116470
116944
|
} catch (err) {
|
|
@@ -116609,7 +117083,7 @@ init_ck_config_manager();
|
|
|
116609
117083
|
init_file_io();
|
|
116610
117084
|
init_logger();
|
|
116611
117085
|
import { existsSync as existsSync74 } from "node:fs";
|
|
116612
|
-
import { mkdir as mkdir41, readFile as
|
|
117086
|
+
import { mkdir as mkdir41, readFile as readFile70 } from "node:fs/promises";
|
|
116613
117087
|
import { dirname as dirname52 } from "node:path";
|
|
116614
117088
|
var PROCESSED_ISSUES_CAP = 500;
|
|
116615
117089
|
async function readCkJson(projectDir) {
|
|
@@ -116617,7 +117091,7 @@ async function readCkJson(projectDir) {
|
|
|
116617
117091
|
try {
|
|
116618
117092
|
if (!existsSync74(configPath))
|
|
116619
117093
|
return {};
|
|
116620
|
-
const content = await
|
|
117094
|
+
const content = await readFile70(configPath, "utf-8");
|
|
116621
117095
|
return JSON.parse(content);
|
|
116622
117096
|
} catch (error) {
|
|
116623
117097
|
logger.warning(`Failed to parse .ck.json: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -117169,7 +117643,7 @@ function formatQueueInfo(state) {
|
|
|
117169
117643
|
return "idle";
|
|
117170
117644
|
}
|
|
117171
117645
|
function sleep(ms) {
|
|
117172
|
-
return new Promise((
|
|
117646
|
+
return new Promise((resolve57) => setTimeout(resolve57, ms));
|
|
117173
117647
|
}
|
|
117174
117648
|
// src/cli/command-registry.ts
|
|
117175
117649
|
init_logger();
|
|
@@ -117329,7 +117803,7 @@ init_types3();
|
|
|
117329
117803
|
init_logger();
|
|
117330
117804
|
init_path_resolver();
|
|
117331
117805
|
import { existsSync as existsSync89 } from "node:fs";
|
|
117332
|
-
import { mkdir as mkdir43, readFile as
|
|
117806
|
+
import { mkdir as mkdir43, readFile as readFile72, writeFile as writeFile44 } from "node:fs/promises";
|
|
117333
117807
|
import { join as join171 } from "node:path";
|
|
117334
117808
|
|
|
117335
117809
|
class VersionCacheManager {
|
|
@@ -117346,7 +117820,7 @@ class VersionCacheManager {
|
|
|
117346
117820
|
logger.debug("Version check cache not found");
|
|
117347
117821
|
return null;
|
|
117348
117822
|
}
|
|
117349
|
-
const content = await
|
|
117823
|
+
const content = await readFile72(cacheFile, "utf-8");
|
|
117350
117824
|
const cache5 = JSON.parse(content);
|
|
117351
117825
|
if (!cache5.lastCheck || !cache5.currentVersion || !cache5.latestVersion) {
|
|
117352
117826
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -117366,7 +117840,7 @@ class VersionCacheManager {
|
|
|
117366
117840
|
if (!existsSync89(cacheDir)) {
|
|
117367
117841
|
await mkdir43(cacheDir, { recursive: true, mode: 448 });
|
|
117368
117842
|
}
|
|
117369
|
-
await
|
|
117843
|
+
await writeFile44(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
|
|
117370
117844
|
logger.debug(`Version check cache saved to ${cacheFile}`);
|
|
117371
117845
|
} catch (error) {
|
|
117372
117846
|
logger.debug(`Failed to save version check cache: ${error}`);
|