claudekit-cli 3.41.4-dev.17 → 3.41.4-dev.18
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 +440 -354
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10624,352 +10624,6 @@ var init_direct_copy = __esm(() => {
|
|
|
10624
10624
|
};
|
|
10625
10625
|
});
|
|
10626
10626
|
|
|
10627
|
-
// src/commands/portable/converters/fm-strip.ts
|
|
10628
|
-
function convertFmStrip(item, provider) {
|
|
10629
|
-
const warnings = [];
|
|
10630
|
-
const heading = item.frontmatter.name || item.name;
|
|
10631
|
-
const isMergeProvider = ["goose", "gemini-cli", "amp"].includes(provider);
|
|
10632
|
-
let content;
|
|
10633
|
-
if (isMergeProvider) {
|
|
10634
|
-
content = `## Agent: ${heading}
|
|
10635
|
-
|
|
10636
|
-
${item.body}
|
|
10637
|
-
`;
|
|
10638
|
-
} else {
|
|
10639
|
-
content = `# ${heading}
|
|
10640
|
-
|
|
10641
|
-
${item.body}
|
|
10642
|
-
`;
|
|
10643
|
-
}
|
|
10644
|
-
if (provider === "windsurf" && content.length > 12000) {
|
|
10645
|
-
const originalLen = content.length;
|
|
10646
|
-
const truncated = content.slice(0, 11950);
|
|
10647
|
-
content = `${truncated}
|
|
10648
|
-
|
|
10649
|
-
[truncated — original ${originalLen} chars exceeded 12K limit]
|
|
10650
|
-
`;
|
|
10651
|
-
warnings.push(`Content truncated from ${originalLen} to 12K chars for Windsurf`);
|
|
10652
|
-
}
|
|
10653
|
-
return {
|
|
10654
|
-
content,
|
|
10655
|
-
filename: isMergeProvider ? "AGENTS.md" : `${item.name}.md`,
|
|
10656
|
-
warnings
|
|
10657
|
-
};
|
|
10658
|
-
}
|
|
10659
|
-
function buildMergedAgentsMd(sections, providerName) {
|
|
10660
|
-
const header = `# Agents
|
|
10661
|
-
|
|
10662
|
-
> Ported from Claude Code agents via ClaudeKit CLI (ck agents)
|
|
10663
|
-
> Target: ${providerName}
|
|
10664
|
-
|
|
10665
|
-
`;
|
|
10666
|
-
return header + sections.join(`
|
|
10667
|
-
---
|
|
10668
|
-
|
|
10669
|
-
`);
|
|
10670
|
-
}
|
|
10671
|
-
|
|
10672
|
-
// src/commands/portable/converters/fm-to-fm.ts
|
|
10673
|
-
function convertForCopilot(item) {
|
|
10674
|
-
const warnings = [];
|
|
10675
|
-
const fm = {};
|
|
10676
|
-
fm.name = item.frontmatter.name || item.name;
|
|
10677
|
-
if (item.description)
|
|
10678
|
-
fm.description = item.description;
|
|
10679
|
-
if (item.frontmatter.model)
|
|
10680
|
-
fm.model = item.frontmatter.model;
|
|
10681
|
-
if (item.frontmatter.tools) {
|
|
10682
|
-
const sourceTools = item.frontmatter.tools.split(",").map((t) => t.trim());
|
|
10683
|
-
const mappedTools = new Set;
|
|
10684
|
-
for (const tool of sourceTools) {
|
|
10685
|
-
const mapped = COPILOT_TOOL_MAP[tool];
|
|
10686
|
-
if (mapped) {
|
|
10687
|
-
mappedTools.add(mapped);
|
|
10688
|
-
}
|
|
10689
|
-
}
|
|
10690
|
-
if (mappedTools.size > 0) {
|
|
10691
|
-
fm.tools = Array.from(mappedTools);
|
|
10692
|
-
}
|
|
10693
|
-
}
|
|
10694
|
-
const fmLines = ["---"];
|
|
10695
|
-
for (const [key, value] of Object.entries(fm)) {
|
|
10696
|
-
if (Array.isArray(value)) {
|
|
10697
|
-
fmLines.push(`${key}:`);
|
|
10698
|
-
for (const v2 of value) {
|
|
10699
|
-
fmLines.push(` - ${v2}`);
|
|
10700
|
-
}
|
|
10701
|
-
} else {
|
|
10702
|
-
fmLines.push(`${key}: ${JSON.stringify(value)}`);
|
|
10703
|
-
}
|
|
10704
|
-
}
|
|
10705
|
-
fmLines.push("---");
|
|
10706
|
-
const content = `${fmLines.join(`
|
|
10707
|
-
`)}
|
|
10708
|
-
|
|
10709
|
-
${item.body}
|
|
10710
|
-
`;
|
|
10711
|
-
if (content.length > 30000) {
|
|
10712
|
-
warnings.push(`Content exceeds Copilot 30K char limit (${content.length} chars)`);
|
|
10713
|
-
}
|
|
10714
|
-
return {
|
|
10715
|
-
content,
|
|
10716
|
-
filename: `${item.name}.agent.md`,
|
|
10717
|
-
warnings
|
|
10718
|
-
};
|
|
10719
|
-
}
|
|
10720
|
-
function convertForCursor(item) {
|
|
10721
|
-
const fm = {};
|
|
10722
|
-
if (item.description)
|
|
10723
|
-
fm.description = item.description;
|
|
10724
|
-
fm.alwaysApply = false;
|
|
10725
|
-
const fmLines = ["---"];
|
|
10726
|
-
for (const [key, value] of Object.entries(fm)) {
|
|
10727
|
-
fmLines.push(`${key}: ${JSON.stringify(value)}`);
|
|
10728
|
-
}
|
|
10729
|
-
fmLines.push("---");
|
|
10730
|
-
const content = `${fmLines.join(`
|
|
10731
|
-
`)}
|
|
10732
|
-
|
|
10733
|
-
${item.body}
|
|
10734
|
-
`;
|
|
10735
|
-
return {
|
|
10736
|
-
content,
|
|
10737
|
-
filename: `${item.name}.mdc`,
|
|
10738
|
-
warnings: []
|
|
10739
|
-
};
|
|
10740
|
-
}
|
|
10741
|
-
function replaceClaudePathsForOpenCode(content) {
|
|
10742
|
-
return content.replace(/\.claude\//g, ".opencode/");
|
|
10743
|
-
}
|
|
10744
|
-
function convertOpenCodeAgent(item) {
|
|
10745
|
-
const warnings = [];
|
|
10746
|
-
const agentName = item.frontmatter.name || item.name;
|
|
10747
|
-
const mode = agentName === "brainstormer" ? "primary" : "subagent";
|
|
10748
|
-
let toolsObj = null;
|
|
10749
|
-
if (item.frontmatter.tools) {
|
|
10750
|
-
const sourceTools = item.frontmatter.tools.split(",").map((t) => t.trim());
|
|
10751
|
-
const mapped = new Set;
|
|
10752
|
-
for (const tool of sourceTools) {
|
|
10753
|
-
const key = OPENCODE_TOOL_MAP[tool];
|
|
10754
|
-
if (key)
|
|
10755
|
-
mapped.add(key);
|
|
10756
|
-
}
|
|
10757
|
-
if (mapped.size > 0) {
|
|
10758
|
-
toolsObj = {};
|
|
10759
|
-
for (const key of mapped) {
|
|
10760
|
-
toolsObj[key] = true;
|
|
10761
|
-
}
|
|
10762
|
-
}
|
|
10763
|
-
}
|
|
10764
|
-
const fmLines = ["---"];
|
|
10765
|
-
const desc = (item.description || `Agent: ${agentName}`).replace(/\n/g, " ").trim();
|
|
10766
|
-
const truncatedDesc = desc.length > 200 ? `${desc.slice(0, 197)}...` : desc;
|
|
10767
|
-
fmLines.push(`description: ${JSON.stringify(truncatedDesc)}`);
|
|
10768
|
-
fmLines.push(`mode: ${mode}`);
|
|
10769
|
-
if (toolsObj) {
|
|
10770
|
-
fmLines.push("tools:");
|
|
10771
|
-
for (const [key, val] of Object.entries(toolsObj)) {
|
|
10772
|
-
fmLines.push(` ${key}: ${val}`);
|
|
10773
|
-
}
|
|
10774
|
-
}
|
|
10775
|
-
fmLines.push("---");
|
|
10776
|
-
const body = replaceClaudePathsForOpenCode(item.body);
|
|
10777
|
-
const content = `${fmLines.join(`
|
|
10778
|
-
`)}
|
|
10779
|
-
|
|
10780
|
-
${body}
|
|
10781
|
-
`;
|
|
10782
|
-
return {
|
|
10783
|
-
content,
|
|
10784
|
-
filename: `${item.name}.md`,
|
|
10785
|
-
warnings
|
|
10786
|
-
};
|
|
10787
|
-
}
|
|
10788
|
-
function convertOpenCodeCommand(item) {
|
|
10789
|
-
const fmLines = ["---"];
|
|
10790
|
-
const desc = (item.description || `Command: ${item.name}`).replace(/\n/g, " ").trim();
|
|
10791
|
-
const truncatedDesc = desc.length > 200 ? `${desc.slice(0, 197)}...` : desc;
|
|
10792
|
-
fmLines.push(`description: ${JSON.stringify(truncatedDesc)}`);
|
|
10793
|
-
if (item.frontmatter.agent) {
|
|
10794
|
-
fmLines.push(`agent: ${JSON.stringify(item.frontmatter.agent)}`);
|
|
10795
|
-
}
|
|
10796
|
-
fmLines.push("---");
|
|
10797
|
-
const body = replaceClaudePathsForOpenCode(item.body);
|
|
10798
|
-
const content = `${fmLines.join(`
|
|
10799
|
-
`)}
|
|
10800
|
-
|
|
10801
|
-
${body}
|
|
10802
|
-
`;
|
|
10803
|
-
return {
|
|
10804
|
-
content,
|
|
10805
|
-
filename: `${item.name}.md`,
|
|
10806
|
-
warnings: []
|
|
10807
|
-
};
|
|
10808
|
-
}
|
|
10809
|
-
function convertFmToFm(item, provider) {
|
|
10810
|
-
switch (provider) {
|
|
10811
|
-
case "github-copilot":
|
|
10812
|
-
return convertForCopilot(item);
|
|
10813
|
-
case "cursor":
|
|
10814
|
-
return convertForCursor(item);
|
|
10815
|
-
case "opencode":
|
|
10816
|
-
if (item.type === "command")
|
|
10817
|
-
return convertOpenCodeCommand(item);
|
|
10818
|
-
return convertOpenCodeAgent(item);
|
|
10819
|
-
default:
|
|
10820
|
-
return {
|
|
10821
|
-
content: item.body,
|
|
10822
|
-
filename: `${item.name}.md`,
|
|
10823
|
-
warnings: [`No FM-to-FM converter for provider "${provider}", using body only`]
|
|
10824
|
-
};
|
|
10825
|
-
}
|
|
10826
|
-
}
|
|
10827
|
-
var COPILOT_TOOL_MAP, OPENCODE_TOOL_MAP;
|
|
10828
|
-
var init_fm_to_fm = __esm(() => {
|
|
10829
|
-
COPILOT_TOOL_MAP = {
|
|
10830
|
-
Read: "read",
|
|
10831
|
-
Glob: "search",
|
|
10832
|
-
Grep: "search",
|
|
10833
|
-
Edit: "edit",
|
|
10834
|
-
Write: "edit",
|
|
10835
|
-
MultiEdit: "edit",
|
|
10836
|
-
Bash: "run_in_terminal",
|
|
10837
|
-
WebFetch: "fetch",
|
|
10838
|
-
WebSearch: "fetch"
|
|
10839
|
-
};
|
|
10840
|
-
OPENCODE_TOOL_MAP = {
|
|
10841
|
-
Read: "read",
|
|
10842
|
-
Glob: "glob",
|
|
10843
|
-
Grep: "grep",
|
|
10844
|
-
Edit: "edit",
|
|
10845
|
-
Write: "write",
|
|
10846
|
-
MultiEdit: "patch",
|
|
10847
|
-
Bash: "bash",
|
|
10848
|
-
WebFetch: "webfetch",
|
|
10849
|
-
WebSearch: "websearch",
|
|
10850
|
-
NotebookEdit: "edit"
|
|
10851
|
-
};
|
|
10852
|
-
});
|
|
10853
|
-
|
|
10854
|
-
// src/commands/portable/converters/fm-to-json.ts
|
|
10855
|
-
function mapToolsToGroups(toolsStr) {
|
|
10856
|
-
const tools = toolsStr.split(",").map((t) => t.trim());
|
|
10857
|
-
const groups = new Set;
|
|
10858
|
-
for (const tool of tools) {
|
|
10859
|
-
const group = CLINE_GROUP_MAP[tool];
|
|
10860
|
-
if (group)
|
|
10861
|
-
groups.add(group);
|
|
10862
|
-
}
|
|
10863
|
-
if (groups.size > 0)
|
|
10864
|
-
groups.add("mcp");
|
|
10865
|
-
return Array.from(groups);
|
|
10866
|
-
}
|
|
10867
|
-
function toSlug(name) {
|
|
10868
|
-
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
10869
|
-
}
|
|
10870
|
-
function convertFmToJson(item) {
|
|
10871
|
-
const mode = {
|
|
10872
|
-
slug: toSlug(item.name),
|
|
10873
|
-
name: item.frontmatter.name || item.name,
|
|
10874
|
-
roleDefinition: item.body,
|
|
10875
|
-
groups: item.frontmatter.tools ? mapToolsToGroups(item.frontmatter.tools) : ["read", "edit", "command", "mcp"],
|
|
10876
|
-
customInstructions: ""
|
|
10877
|
-
};
|
|
10878
|
-
return {
|
|
10879
|
-
content: JSON.stringify(mode, null, 2),
|
|
10880
|
-
filename: `${toSlug(item.name)}.json`,
|
|
10881
|
-
warnings: []
|
|
10882
|
-
};
|
|
10883
|
-
}
|
|
10884
|
-
function buildClineModesJson(modes) {
|
|
10885
|
-
return JSON.stringify({ customModes: modes }, null, 2);
|
|
10886
|
-
}
|
|
10887
|
-
var CLINE_GROUP_MAP;
|
|
10888
|
-
var init_fm_to_json = __esm(() => {
|
|
10889
|
-
CLINE_GROUP_MAP = {
|
|
10890
|
-
Read: "read",
|
|
10891
|
-
Glob: "read",
|
|
10892
|
-
Grep: "read",
|
|
10893
|
-
Edit: "edit",
|
|
10894
|
-
Write: "edit",
|
|
10895
|
-
MultiEdit: "edit",
|
|
10896
|
-
Bash: "command",
|
|
10897
|
-
WebFetch: "browser",
|
|
10898
|
-
WebSearch: "browser"
|
|
10899
|
-
};
|
|
10900
|
-
});
|
|
10901
|
-
|
|
10902
|
-
// src/commands/portable/converters/fm-to-yaml.ts
|
|
10903
|
-
function mapToolsToGroups2(toolsStr) {
|
|
10904
|
-
const tools = toolsStr.split(",").map((t) => t.trim());
|
|
10905
|
-
const groups = new Set;
|
|
10906
|
-
for (const tool of tools) {
|
|
10907
|
-
const group = TOOL_GROUP_MAP[tool];
|
|
10908
|
-
if (group)
|
|
10909
|
-
groups.add(group);
|
|
10910
|
-
}
|
|
10911
|
-
if (groups.size > 0)
|
|
10912
|
-
groups.add("mcp");
|
|
10913
|
-
return Array.from(groups);
|
|
10914
|
-
}
|
|
10915
|
-
function toSlug2(name) {
|
|
10916
|
-
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
10917
|
-
}
|
|
10918
|
-
function yamlEscape(str2) {
|
|
10919
|
-
return str2.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
10920
|
-
}
|
|
10921
|
-
function convertFmToYaml(item) {
|
|
10922
|
-
const slug = toSlug2(item.name);
|
|
10923
|
-
const displayName = item.frontmatter.name || item.name;
|
|
10924
|
-
const description = item.description || "";
|
|
10925
|
-
const groups = item.frontmatter.tools ? mapToolsToGroups2(item.frontmatter.tools) : ["read", "edit", "command", "browser", "mcp"];
|
|
10926
|
-
const lines = [];
|
|
10927
|
-
lines.push(` - slug: "${slug}"`);
|
|
10928
|
-
lines.push(` name: "${yamlEscape(displayName)}"`);
|
|
10929
|
-
if (description) {
|
|
10930
|
-
lines.push(` description: "${yamlEscape(description.slice(0, 200))}"`);
|
|
10931
|
-
}
|
|
10932
|
-
lines.push(" roleDefinition: |");
|
|
10933
|
-
for (const line of item.body.split(`
|
|
10934
|
-
`)) {
|
|
10935
|
-
lines.push(` ${line}`);
|
|
10936
|
-
}
|
|
10937
|
-
lines.push(' customInstructions: ""');
|
|
10938
|
-
lines.push(" groups:");
|
|
10939
|
-
for (const group of groups) {
|
|
10940
|
-
lines.push(` - ${group}`);
|
|
10941
|
-
}
|
|
10942
|
-
return {
|
|
10943
|
-
content: lines.join(`
|
|
10944
|
-
`),
|
|
10945
|
-
filename: slug,
|
|
10946
|
-
warnings: []
|
|
10947
|
-
};
|
|
10948
|
-
}
|
|
10949
|
-
function buildYamlModesFile(convertedEntries) {
|
|
10950
|
-
const lines = ["customModes:"];
|
|
10951
|
-
for (const entry of convertedEntries) {
|
|
10952
|
-
lines.push(entry);
|
|
10953
|
-
}
|
|
10954
|
-
return `${lines.join(`
|
|
10955
|
-
`)}
|
|
10956
|
-
`;
|
|
10957
|
-
}
|
|
10958
|
-
var TOOL_GROUP_MAP;
|
|
10959
|
-
var init_fm_to_yaml = __esm(() => {
|
|
10960
|
-
TOOL_GROUP_MAP = {
|
|
10961
|
-
Read: "read",
|
|
10962
|
-
Glob: "read",
|
|
10963
|
-
Grep: "read",
|
|
10964
|
-
Edit: "edit",
|
|
10965
|
-
Write: "edit",
|
|
10966
|
-
MultiEdit: "edit",
|
|
10967
|
-
Bash: "command",
|
|
10968
|
-
WebFetch: "browser",
|
|
10969
|
-
WebSearch: "browser"
|
|
10970
|
-
};
|
|
10971
|
-
});
|
|
10972
|
-
|
|
10973
10627
|
// src/commands/portable/provider-registry.ts
|
|
10974
10628
|
var exports_provider_registry = {};
|
|
10975
10629
|
__export(exports_provider_registry, {
|
|
@@ -11669,8 +11323,17 @@ var init_provider_registry = __esm(() => {
|
|
|
11669
11323
|
writeStrategy: "merge-single",
|
|
11670
11324
|
fileExtension: ".md"
|
|
11671
11325
|
},
|
|
11672
|
-
hooks:
|
|
11673
|
-
|
|
11326
|
+
hooks: {
|
|
11327
|
+
projectPath: ".gemini/hooks",
|
|
11328
|
+
globalPath: join(home, ".gemini/hooks"),
|
|
11329
|
+
format: "direct-copy",
|
|
11330
|
+
writeStrategy: "per-file",
|
|
11331
|
+
fileExtension: ""
|
|
11332
|
+
},
|
|
11333
|
+
settingsJsonPath: {
|
|
11334
|
+
projectPath: ".gemini/settings.json",
|
|
11335
|
+
globalPath: join(home, ".gemini/settings.json")
|
|
11336
|
+
},
|
|
11674
11337
|
detect: async () => hasAnyInstallSignal([
|
|
11675
11338
|
join(cwd, ".gemini/commands"),
|
|
11676
11339
|
join(cwd, "GEMINI.md"),
|
|
@@ -12132,6 +11795,363 @@ var init_md_strip = __esm(() => {
|
|
|
12132
11795
|
init_provider_registry();
|
|
12133
11796
|
});
|
|
12134
11797
|
|
|
11798
|
+
// src/commands/portable/converters/fm-strip.ts
|
|
11799
|
+
function convertFmStrip(item, provider) {
|
|
11800
|
+
const warnings = [];
|
|
11801
|
+
const heading = item.frontmatter.name || item.name;
|
|
11802
|
+
const isMergeProvider = ["goose", "gemini-cli", "amp"].includes(provider);
|
|
11803
|
+
let body = item.body;
|
|
11804
|
+
if (PROVIDERS_WITH_BODY_REWRITING.includes(provider)) {
|
|
11805
|
+
const stripped = stripClaudeRefs(body, { provider });
|
|
11806
|
+
body = stripped.content;
|
|
11807
|
+
warnings.push(...stripped.warnings);
|
|
11808
|
+
}
|
|
11809
|
+
let content;
|
|
11810
|
+
if (isMergeProvider) {
|
|
11811
|
+
content = `## Agent: ${heading}
|
|
11812
|
+
|
|
11813
|
+
${body}
|
|
11814
|
+
`;
|
|
11815
|
+
} else {
|
|
11816
|
+
content = `# ${heading}
|
|
11817
|
+
|
|
11818
|
+
${body}
|
|
11819
|
+
`;
|
|
11820
|
+
}
|
|
11821
|
+
if (provider === "windsurf" && content.length > 12000) {
|
|
11822
|
+
const originalLen = content.length;
|
|
11823
|
+
const truncated = content.slice(0, 11950);
|
|
11824
|
+
content = `${truncated}
|
|
11825
|
+
|
|
11826
|
+
[truncated — original ${originalLen} chars exceeded 12K limit]
|
|
11827
|
+
`;
|
|
11828
|
+
warnings.push(`Content truncated from ${originalLen} to 12K chars for Windsurf`);
|
|
11829
|
+
}
|
|
11830
|
+
return {
|
|
11831
|
+
content,
|
|
11832
|
+
filename: isMergeProvider ? "AGENTS.md" : `${item.name}.md`,
|
|
11833
|
+
warnings
|
|
11834
|
+
};
|
|
11835
|
+
}
|
|
11836
|
+
function buildMergedAgentsMd(sections, providerName) {
|
|
11837
|
+
const header = `# Agents
|
|
11838
|
+
|
|
11839
|
+
> Ported from Claude Code agents via ClaudeKit CLI (ck agents)
|
|
11840
|
+
> Target: ${providerName}
|
|
11841
|
+
|
|
11842
|
+
`;
|
|
11843
|
+
return header + sections.join(`
|
|
11844
|
+
---
|
|
11845
|
+
|
|
11846
|
+
`);
|
|
11847
|
+
}
|
|
11848
|
+
var PROVIDERS_WITH_BODY_REWRITING;
|
|
11849
|
+
var init_fm_strip = __esm(() => {
|
|
11850
|
+
init_md_strip();
|
|
11851
|
+
PROVIDERS_WITH_BODY_REWRITING = ["gemini-cli"];
|
|
11852
|
+
});
|
|
11853
|
+
|
|
11854
|
+
// src/commands/portable/converters/fm-to-fm.ts
|
|
11855
|
+
function convertForCopilot(item) {
|
|
11856
|
+
const warnings = [];
|
|
11857
|
+
const fm = {};
|
|
11858
|
+
fm.name = item.frontmatter.name || item.name;
|
|
11859
|
+
if (item.description)
|
|
11860
|
+
fm.description = item.description;
|
|
11861
|
+
if (item.frontmatter.model)
|
|
11862
|
+
fm.model = item.frontmatter.model;
|
|
11863
|
+
if (item.frontmatter.tools) {
|
|
11864
|
+
const sourceTools = item.frontmatter.tools.split(",").map((t) => t.trim());
|
|
11865
|
+
const mappedTools = new Set;
|
|
11866
|
+
for (const tool of sourceTools) {
|
|
11867
|
+
const mapped = COPILOT_TOOL_MAP[tool];
|
|
11868
|
+
if (mapped) {
|
|
11869
|
+
mappedTools.add(mapped);
|
|
11870
|
+
}
|
|
11871
|
+
}
|
|
11872
|
+
if (mappedTools.size > 0) {
|
|
11873
|
+
fm.tools = Array.from(mappedTools);
|
|
11874
|
+
}
|
|
11875
|
+
}
|
|
11876
|
+
const fmLines = ["---"];
|
|
11877
|
+
for (const [key, value] of Object.entries(fm)) {
|
|
11878
|
+
if (Array.isArray(value)) {
|
|
11879
|
+
fmLines.push(`${key}:`);
|
|
11880
|
+
for (const v2 of value) {
|
|
11881
|
+
fmLines.push(` - ${v2}`);
|
|
11882
|
+
}
|
|
11883
|
+
} else {
|
|
11884
|
+
fmLines.push(`${key}: ${JSON.stringify(value)}`);
|
|
11885
|
+
}
|
|
11886
|
+
}
|
|
11887
|
+
fmLines.push("---");
|
|
11888
|
+
const content = `${fmLines.join(`
|
|
11889
|
+
`)}
|
|
11890
|
+
|
|
11891
|
+
${item.body}
|
|
11892
|
+
`;
|
|
11893
|
+
if (content.length > 30000) {
|
|
11894
|
+
warnings.push(`Content exceeds Copilot 30K char limit (${content.length} chars)`);
|
|
11895
|
+
}
|
|
11896
|
+
return {
|
|
11897
|
+
content,
|
|
11898
|
+
filename: `${item.name}.agent.md`,
|
|
11899
|
+
warnings
|
|
11900
|
+
};
|
|
11901
|
+
}
|
|
11902
|
+
function convertForCursor(item) {
|
|
11903
|
+
const fm = {};
|
|
11904
|
+
if (item.description)
|
|
11905
|
+
fm.description = item.description;
|
|
11906
|
+
fm.alwaysApply = false;
|
|
11907
|
+
const fmLines = ["---"];
|
|
11908
|
+
for (const [key, value] of Object.entries(fm)) {
|
|
11909
|
+
fmLines.push(`${key}: ${JSON.stringify(value)}`);
|
|
11910
|
+
}
|
|
11911
|
+
fmLines.push("---");
|
|
11912
|
+
const content = `${fmLines.join(`
|
|
11913
|
+
`)}
|
|
11914
|
+
|
|
11915
|
+
${item.body}
|
|
11916
|
+
`;
|
|
11917
|
+
return {
|
|
11918
|
+
content,
|
|
11919
|
+
filename: `${item.name}.mdc`,
|
|
11920
|
+
warnings: []
|
|
11921
|
+
};
|
|
11922
|
+
}
|
|
11923
|
+
function replaceClaudePathsForOpenCode(content) {
|
|
11924
|
+
return content.replace(/\.claude\//g, ".opencode/");
|
|
11925
|
+
}
|
|
11926
|
+
function convertOpenCodeAgent(item) {
|
|
11927
|
+
const warnings = [];
|
|
11928
|
+
const agentName = item.frontmatter.name || item.name;
|
|
11929
|
+
const mode = agentName === "brainstormer" ? "primary" : "subagent";
|
|
11930
|
+
let toolsObj = null;
|
|
11931
|
+
if (item.frontmatter.tools) {
|
|
11932
|
+
const sourceTools = item.frontmatter.tools.split(",").map((t) => t.trim());
|
|
11933
|
+
const mapped = new Set;
|
|
11934
|
+
for (const tool of sourceTools) {
|
|
11935
|
+
const key = OPENCODE_TOOL_MAP[tool];
|
|
11936
|
+
if (key)
|
|
11937
|
+
mapped.add(key);
|
|
11938
|
+
}
|
|
11939
|
+
if (mapped.size > 0) {
|
|
11940
|
+
toolsObj = {};
|
|
11941
|
+
for (const key of mapped) {
|
|
11942
|
+
toolsObj[key] = true;
|
|
11943
|
+
}
|
|
11944
|
+
}
|
|
11945
|
+
}
|
|
11946
|
+
const fmLines = ["---"];
|
|
11947
|
+
const desc = (item.description || `Agent: ${agentName}`).replace(/\n/g, " ").trim();
|
|
11948
|
+
const truncatedDesc = desc.length > 200 ? `${desc.slice(0, 197)}...` : desc;
|
|
11949
|
+
fmLines.push(`description: ${JSON.stringify(truncatedDesc)}`);
|
|
11950
|
+
fmLines.push(`mode: ${mode}`);
|
|
11951
|
+
if (toolsObj) {
|
|
11952
|
+
fmLines.push("tools:");
|
|
11953
|
+
for (const [key, val] of Object.entries(toolsObj)) {
|
|
11954
|
+
fmLines.push(` ${key}: ${val}`);
|
|
11955
|
+
}
|
|
11956
|
+
}
|
|
11957
|
+
fmLines.push("---");
|
|
11958
|
+
const body = replaceClaudePathsForOpenCode(item.body);
|
|
11959
|
+
const content = `${fmLines.join(`
|
|
11960
|
+
`)}
|
|
11961
|
+
|
|
11962
|
+
${body}
|
|
11963
|
+
`;
|
|
11964
|
+
return {
|
|
11965
|
+
content,
|
|
11966
|
+
filename: `${item.name}.md`,
|
|
11967
|
+
warnings
|
|
11968
|
+
};
|
|
11969
|
+
}
|
|
11970
|
+
function convertOpenCodeCommand(item) {
|
|
11971
|
+
const fmLines = ["---"];
|
|
11972
|
+
const desc = (item.description || `Command: ${item.name}`).replace(/\n/g, " ").trim();
|
|
11973
|
+
const truncatedDesc = desc.length > 200 ? `${desc.slice(0, 197)}...` : desc;
|
|
11974
|
+
fmLines.push(`description: ${JSON.stringify(truncatedDesc)}`);
|
|
11975
|
+
if (item.frontmatter.agent) {
|
|
11976
|
+
fmLines.push(`agent: ${JSON.stringify(item.frontmatter.agent)}`);
|
|
11977
|
+
}
|
|
11978
|
+
fmLines.push("---");
|
|
11979
|
+
const body = replaceClaudePathsForOpenCode(item.body);
|
|
11980
|
+
const content = `${fmLines.join(`
|
|
11981
|
+
`)}
|
|
11982
|
+
|
|
11983
|
+
${body}
|
|
11984
|
+
`;
|
|
11985
|
+
return {
|
|
11986
|
+
content,
|
|
11987
|
+
filename: `${item.name}.md`,
|
|
11988
|
+
warnings: []
|
|
11989
|
+
};
|
|
11990
|
+
}
|
|
11991
|
+
function convertFmToFm(item, provider) {
|
|
11992
|
+
switch (provider) {
|
|
11993
|
+
case "github-copilot":
|
|
11994
|
+
return convertForCopilot(item);
|
|
11995
|
+
case "cursor":
|
|
11996
|
+
return convertForCursor(item);
|
|
11997
|
+
case "opencode":
|
|
11998
|
+
if (item.type === "command")
|
|
11999
|
+
return convertOpenCodeCommand(item);
|
|
12000
|
+
return convertOpenCodeAgent(item);
|
|
12001
|
+
default:
|
|
12002
|
+
return {
|
|
12003
|
+
content: item.body,
|
|
12004
|
+
filename: `${item.name}.md`,
|
|
12005
|
+
warnings: [`No FM-to-FM converter for provider "${provider}", using body only`]
|
|
12006
|
+
};
|
|
12007
|
+
}
|
|
12008
|
+
}
|
|
12009
|
+
var COPILOT_TOOL_MAP, OPENCODE_TOOL_MAP;
|
|
12010
|
+
var init_fm_to_fm = __esm(() => {
|
|
12011
|
+
COPILOT_TOOL_MAP = {
|
|
12012
|
+
Read: "read",
|
|
12013
|
+
Glob: "search",
|
|
12014
|
+
Grep: "search",
|
|
12015
|
+
Edit: "edit",
|
|
12016
|
+
Write: "edit",
|
|
12017
|
+
MultiEdit: "edit",
|
|
12018
|
+
Bash: "run_in_terminal",
|
|
12019
|
+
WebFetch: "fetch",
|
|
12020
|
+
WebSearch: "fetch"
|
|
12021
|
+
};
|
|
12022
|
+
OPENCODE_TOOL_MAP = {
|
|
12023
|
+
Read: "read",
|
|
12024
|
+
Glob: "glob",
|
|
12025
|
+
Grep: "grep",
|
|
12026
|
+
Edit: "edit",
|
|
12027
|
+
Write: "write",
|
|
12028
|
+
MultiEdit: "patch",
|
|
12029
|
+
Bash: "bash",
|
|
12030
|
+
WebFetch: "webfetch",
|
|
12031
|
+
WebSearch: "websearch",
|
|
12032
|
+
NotebookEdit: "edit"
|
|
12033
|
+
};
|
|
12034
|
+
});
|
|
12035
|
+
|
|
12036
|
+
// src/commands/portable/converters/fm-to-json.ts
|
|
12037
|
+
function mapToolsToGroups(toolsStr) {
|
|
12038
|
+
const tools = toolsStr.split(",").map((t) => t.trim());
|
|
12039
|
+
const groups = new Set;
|
|
12040
|
+
for (const tool of tools) {
|
|
12041
|
+
const group = CLINE_GROUP_MAP[tool];
|
|
12042
|
+
if (group)
|
|
12043
|
+
groups.add(group);
|
|
12044
|
+
}
|
|
12045
|
+
if (groups.size > 0)
|
|
12046
|
+
groups.add("mcp");
|
|
12047
|
+
return Array.from(groups);
|
|
12048
|
+
}
|
|
12049
|
+
function toSlug(name) {
|
|
12050
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
12051
|
+
}
|
|
12052
|
+
function convertFmToJson(item) {
|
|
12053
|
+
const mode = {
|
|
12054
|
+
slug: toSlug(item.name),
|
|
12055
|
+
name: item.frontmatter.name || item.name,
|
|
12056
|
+
roleDefinition: item.body,
|
|
12057
|
+
groups: item.frontmatter.tools ? mapToolsToGroups(item.frontmatter.tools) : ["read", "edit", "command", "mcp"],
|
|
12058
|
+
customInstructions: ""
|
|
12059
|
+
};
|
|
12060
|
+
return {
|
|
12061
|
+
content: JSON.stringify(mode, null, 2),
|
|
12062
|
+
filename: `${toSlug(item.name)}.json`,
|
|
12063
|
+
warnings: []
|
|
12064
|
+
};
|
|
12065
|
+
}
|
|
12066
|
+
function buildClineModesJson(modes) {
|
|
12067
|
+
return JSON.stringify({ customModes: modes }, null, 2);
|
|
12068
|
+
}
|
|
12069
|
+
var CLINE_GROUP_MAP;
|
|
12070
|
+
var init_fm_to_json = __esm(() => {
|
|
12071
|
+
CLINE_GROUP_MAP = {
|
|
12072
|
+
Read: "read",
|
|
12073
|
+
Glob: "read",
|
|
12074
|
+
Grep: "read",
|
|
12075
|
+
Edit: "edit",
|
|
12076
|
+
Write: "edit",
|
|
12077
|
+
MultiEdit: "edit",
|
|
12078
|
+
Bash: "command",
|
|
12079
|
+
WebFetch: "browser",
|
|
12080
|
+
WebSearch: "browser"
|
|
12081
|
+
};
|
|
12082
|
+
});
|
|
12083
|
+
|
|
12084
|
+
// src/commands/portable/converters/fm-to-yaml.ts
|
|
12085
|
+
function mapToolsToGroups2(toolsStr) {
|
|
12086
|
+
const tools = toolsStr.split(",").map((t) => t.trim());
|
|
12087
|
+
const groups = new Set;
|
|
12088
|
+
for (const tool of tools) {
|
|
12089
|
+
const group = TOOL_GROUP_MAP[tool];
|
|
12090
|
+
if (group)
|
|
12091
|
+
groups.add(group);
|
|
12092
|
+
}
|
|
12093
|
+
if (groups.size > 0)
|
|
12094
|
+
groups.add("mcp");
|
|
12095
|
+
return Array.from(groups);
|
|
12096
|
+
}
|
|
12097
|
+
function toSlug2(name) {
|
|
12098
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
12099
|
+
}
|
|
12100
|
+
function yamlEscape(str2) {
|
|
12101
|
+
return str2.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
|
|
12102
|
+
}
|
|
12103
|
+
function convertFmToYaml(item) {
|
|
12104
|
+
const slug = toSlug2(item.name);
|
|
12105
|
+
const displayName = item.frontmatter.name || item.name;
|
|
12106
|
+
const description = item.description || "";
|
|
12107
|
+
const groups = item.frontmatter.tools ? mapToolsToGroups2(item.frontmatter.tools) : ["read", "edit", "command", "browser", "mcp"];
|
|
12108
|
+
const lines = [];
|
|
12109
|
+
lines.push(` - slug: "${slug}"`);
|
|
12110
|
+
lines.push(` name: "${yamlEscape(displayName)}"`);
|
|
12111
|
+
if (description) {
|
|
12112
|
+
lines.push(` description: "${yamlEscape(description.slice(0, 200))}"`);
|
|
12113
|
+
}
|
|
12114
|
+
lines.push(" roleDefinition: |");
|
|
12115
|
+
for (const line of item.body.split(`
|
|
12116
|
+
`)) {
|
|
12117
|
+
lines.push(` ${line}`);
|
|
12118
|
+
}
|
|
12119
|
+
lines.push(' customInstructions: ""');
|
|
12120
|
+
lines.push(" groups:");
|
|
12121
|
+
for (const group of groups) {
|
|
12122
|
+
lines.push(` - ${group}`);
|
|
12123
|
+
}
|
|
12124
|
+
return {
|
|
12125
|
+
content: lines.join(`
|
|
12126
|
+
`),
|
|
12127
|
+
filename: slug,
|
|
12128
|
+
warnings: []
|
|
12129
|
+
};
|
|
12130
|
+
}
|
|
12131
|
+
function buildYamlModesFile(convertedEntries) {
|
|
12132
|
+
const lines = ["customModes:"];
|
|
12133
|
+
for (const entry of convertedEntries) {
|
|
12134
|
+
lines.push(entry);
|
|
12135
|
+
}
|
|
12136
|
+
return `${lines.join(`
|
|
12137
|
+
`)}
|
|
12138
|
+
`;
|
|
12139
|
+
}
|
|
12140
|
+
var TOOL_GROUP_MAP;
|
|
12141
|
+
var init_fm_to_yaml = __esm(() => {
|
|
12142
|
+
TOOL_GROUP_MAP = {
|
|
12143
|
+
Read: "read",
|
|
12144
|
+
Glob: "read",
|
|
12145
|
+
Grep: "read",
|
|
12146
|
+
Edit: "edit",
|
|
12147
|
+
Write: "edit",
|
|
12148
|
+
MultiEdit: "edit",
|
|
12149
|
+
Bash: "command",
|
|
12150
|
+
WebFetch: "browser",
|
|
12151
|
+
WebSearch: "browser"
|
|
12152
|
+
};
|
|
12153
|
+
});
|
|
12154
|
+
|
|
12135
12155
|
// src/commands/portable/converters/md-to-kiro-steering.ts
|
|
12136
12156
|
function detectLanguageGlob(itemName) {
|
|
12137
12157
|
const normalized = itemName.toLowerCase();
|
|
@@ -12341,6 +12361,7 @@ function convertItem(item, format, provider) {
|
|
|
12341
12361
|
}
|
|
12342
12362
|
var init_converters = __esm(() => {
|
|
12343
12363
|
init_direct_copy();
|
|
12364
|
+
init_fm_strip();
|
|
12344
12365
|
init_fm_to_codex_toml();
|
|
12345
12366
|
init_fm_to_fm();
|
|
12346
12367
|
init_fm_to_json();
|
|
@@ -14425,6 +14446,7 @@ var init_portable_installer = __esm(() => {
|
|
|
14425
14446
|
init_zod();
|
|
14426
14447
|
init_checksum_utils();
|
|
14427
14448
|
init_codex_toml_installer();
|
|
14449
|
+
init_fm_strip();
|
|
14428
14450
|
init_fm_to_json();
|
|
14429
14451
|
init_fm_to_yaml();
|
|
14430
14452
|
init_converters();
|
|
@@ -51075,6 +51097,52 @@ var init_config_discovery = __esm(() => {
|
|
|
51075
51097
|
SHELL_HOOK_EXTENSIONS = new Set([".sh", ".ps1", ".bat", ".cmd"]);
|
|
51076
51098
|
});
|
|
51077
51099
|
|
|
51100
|
+
// src/commands/portable/converters/gemini-hook-event-map.ts
|
|
51101
|
+
function mapEventName(claudeEvent) {
|
|
51102
|
+
return GEMINI_EVENT_MAP[claudeEvent] ?? claudeEvent;
|
|
51103
|
+
}
|
|
51104
|
+
function rewriteMatcherToolNames(matcher) {
|
|
51105
|
+
if (!matcher)
|
|
51106
|
+
return matcher;
|
|
51107
|
+
const parts = matcher.split("|").map((p) => p.trim());
|
|
51108
|
+
const mapped = new Set;
|
|
51109
|
+
for (const part of parts) {
|
|
51110
|
+
const directMap = GEMINI_TOOL_NAME_MAP[part];
|
|
51111
|
+
if (directMap) {
|
|
51112
|
+
mapped.add(directMap);
|
|
51113
|
+
} else {
|
|
51114
|
+
mapped.add(part);
|
|
51115
|
+
}
|
|
51116
|
+
}
|
|
51117
|
+
return Array.from(mapped).join("|");
|
|
51118
|
+
}
|
|
51119
|
+
function requiresHookMapping(provider) {
|
|
51120
|
+
return provider === "gemini-cli";
|
|
51121
|
+
}
|
|
51122
|
+
var GEMINI_EVENT_MAP, GEMINI_TOOL_NAME_MAP;
|
|
51123
|
+
var init_gemini_hook_event_map = __esm(() => {
|
|
51124
|
+
GEMINI_EVENT_MAP = {
|
|
51125
|
+
PreToolUse: "BeforeTool",
|
|
51126
|
+
PostToolUse: "AfterTool",
|
|
51127
|
+
SubagentStart: "BeforeAgent",
|
|
51128
|
+
SubagentStop: "AfterAgent",
|
|
51129
|
+
Stop: "SessionEnd",
|
|
51130
|
+
Notification: "Notification",
|
|
51131
|
+
PreCompact: "PreCompress"
|
|
51132
|
+
};
|
|
51133
|
+
GEMINI_TOOL_NAME_MAP = {
|
|
51134
|
+
Read: "read_file",
|
|
51135
|
+
Glob: "glob",
|
|
51136
|
+
Grep: "grep_search",
|
|
51137
|
+
Edit: "replace",
|
|
51138
|
+
Write: "write_file",
|
|
51139
|
+
MultiEdit: "replace",
|
|
51140
|
+
Bash: "run_shell_command",
|
|
51141
|
+
WebFetch: "web_fetch",
|
|
51142
|
+
WebSearch: "google_web_search"
|
|
51143
|
+
};
|
|
51144
|
+
});
|
|
51145
|
+
|
|
51078
51146
|
// src/commands/portable/hooks-settings-merger.ts
|
|
51079
51147
|
import { existsSync as existsSync24, mkdirSync, renameSync, rmSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
51080
51148
|
import { readFile as readFile20 } from "node:fs/promises";
|
|
@@ -51134,6 +51202,24 @@ function filterToInstalledHooks(hooks, installedFiles) {
|
|
|
51134
51202
|
}
|
|
51135
51203
|
return filtered;
|
|
51136
51204
|
}
|
|
51205
|
+
function mapHookEventsForProvider(hooks, targetProvider) {
|
|
51206
|
+
if (!requiresHookMapping(targetProvider))
|
|
51207
|
+
return hooks;
|
|
51208
|
+
const mapped = {};
|
|
51209
|
+
for (const [event, groups] of Object.entries(hooks)) {
|
|
51210
|
+
const mappedEvent = mapEventName(event);
|
|
51211
|
+
const mappedGroups = groups.map((group) => ({
|
|
51212
|
+
...group,
|
|
51213
|
+
matcher: group.matcher ? rewriteMatcherToolNames(group.matcher) : group.matcher
|
|
51214
|
+
}));
|
|
51215
|
+
if (mapped[mappedEvent]) {
|
|
51216
|
+
mapped[mappedEvent].push(...mappedGroups);
|
|
51217
|
+
} else {
|
|
51218
|
+
mapped[mappedEvent] = mappedGroups;
|
|
51219
|
+
}
|
|
51220
|
+
}
|
|
51221
|
+
return mapped;
|
|
51222
|
+
}
|
|
51137
51223
|
function extractFilenameFromCommand(command) {
|
|
51138
51224
|
const normalized = command.replace(/\s*[|>&].*$/, "").trim();
|
|
51139
51225
|
const quotedMatch = normalized.match(/["']([^"']+\.(?:js|cjs|mjs|ts))["']/);
|
|
@@ -51154,13 +51240,11 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks) {
|
|
|
51154
51240
|
let existingSettings = {};
|
|
51155
51241
|
let backupPath = null;
|
|
51156
51242
|
if (existsSync24(targetSettingsPath)) {
|
|
51157
|
-
|
|
51243
|
+
const raw = await readFile20(targetSettingsPath, "utf8");
|
|
51158
51244
|
try {
|
|
51159
|
-
raw = await readFile20(targetSettingsPath, "utf8");
|
|
51160
51245
|
existingSettings = JSON.parse(raw);
|
|
51161
51246
|
} catch {
|
|
51162
51247
|
existingSettings = {};
|
|
51163
|
-
raw = "";
|
|
51164
51248
|
}
|
|
51165
51249
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
51166
51250
|
backupPath = `${targetSettingsPath}.${timestamp}.bak`;
|
|
@@ -51311,8 +51395,9 @@ async function migrateHooksSettings(options2) {
|
|
|
51311
51395
|
const targetHooksDir = isGlobal ? targetConfig.hooks?.globalPath ?? "" : targetConfig.hooks?.projectPath ?? "";
|
|
51312
51396
|
const filtered = filterToInstalledHooks(sourceHooks, installedHookFiles);
|
|
51313
51397
|
const rewritten = rewriteHookPaths(filtered, sourceHooksDir, targetHooksDir);
|
|
51398
|
+
const eventMapped = mapHookEventsForProvider(rewritten, targetProvider);
|
|
51314
51399
|
let hooksRegistered = 0;
|
|
51315
|
-
for (const groups of Object.values(
|
|
51400
|
+
for (const groups of Object.values(eventMapped)) {
|
|
51316
51401
|
for (const group of groups) {
|
|
51317
51402
|
hooksRegistered += group.hooks.length;
|
|
51318
51403
|
}
|
|
@@ -51329,7 +51414,7 @@ async function migrateHooksSettings(options2) {
|
|
|
51329
51414
|
};
|
|
51330
51415
|
}
|
|
51331
51416
|
try {
|
|
51332
|
-
const { backupPath } = await mergeHooksIntoSettings(resolvedTargetPath,
|
|
51417
|
+
const { backupPath } = await mergeHooksIntoSettings(resolvedTargetPath, eventMapped);
|
|
51333
51418
|
return {
|
|
51334
51419
|
status: "registered",
|
|
51335
51420
|
success: true,
|
|
@@ -51351,6 +51436,7 @@ async function migrateHooksSettings(options2) {
|
|
|
51351
51436
|
}
|
|
51352
51437
|
}
|
|
51353
51438
|
var init_hooks_settings_merger = __esm(() => {
|
|
51439
|
+
init_gemini_hook_event_map();
|
|
51354
51440
|
init_provider_registry();
|
|
51355
51441
|
});
|
|
51356
51442
|
|
|
@@ -60447,7 +60533,7 @@ var package_default;
|
|
|
60447
60533
|
var init_package = __esm(() => {
|
|
60448
60534
|
package_default = {
|
|
60449
60535
|
name: "claudekit-cli",
|
|
60450
|
-
version: "3.41.4-dev.
|
|
60536
|
+
version: "3.41.4-dev.18",
|
|
60451
60537
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
60452
60538
|
type: "module",
|
|
60453
60539
|
repository: {
|