agentsmesh 0.18.0 → 0.18.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/CHANGELOG.md +24 -0
- package/dist/canonical.js +103 -129
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +130 -130
- package/dist/engine.js +103 -129
- package/dist/engine.js.map +1 -1
- package/dist/index.js +103 -129
- package/dist/index.js.map +1 -1
- package/dist/targets.js +103 -129
- package/dist/targets.js.map +1 -1
- package/package.json +3 -2
package/dist/engine.js
CHANGED
|
@@ -7065,55 +7065,117 @@ async function findDirectorySkills(skillsDir) {
|
|
|
7065
7065
|
}
|
|
7066
7066
|
return skills;
|
|
7067
7067
|
}
|
|
7068
|
+
async function importSkillsDirectory(sourceSkillsDirs, options, recognizers = []) {
|
|
7069
|
+
for (const sourceDir of sourceSkillsDirs) {
|
|
7070
|
+
const absSkillsDir = join(options.projectRoot, sourceDir);
|
|
7071
|
+
const directorySkills = await findDirectorySkills(absSkillsDir);
|
|
7072
|
+
if (directorySkills.size === 0) continue;
|
|
7073
|
+
let importedAny = false;
|
|
7074
|
+
for (const [skillName, skillDir] of directorySkills) {
|
|
7075
|
+
const skillMdPath = join(skillDir, "SKILL.md");
|
|
7076
|
+
const rawContent = await readFileSafe(skillMdPath);
|
|
7077
|
+
if (rawContent === null) continue;
|
|
7078
|
+
importedAny = true;
|
|
7079
|
+
const { frontmatter, body: rawBody } = parseFrontmatter(rawContent);
|
|
7080
|
+
const ctx = {
|
|
7081
|
+
skillName,
|
|
7082
|
+
skillDir,
|
|
7083
|
+
skillMdPath,
|
|
7084
|
+
rawContent,
|
|
7085
|
+
frontmatter,
|
|
7086
|
+
rawBody,
|
|
7087
|
+
options
|
|
7088
|
+
};
|
|
7089
|
+
let handled = false;
|
|
7090
|
+
for (const recognizer of recognizers) {
|
|
7091
|
+
const claimed = await recognizer.recognize(ctx);
|
|
7092
|
+
if (claimed) {
|
|
7093
|
+
handled = true;
|
|
7094
|
+
break;
|
|
7095
|
+
}
|
|
7096
|
+
}
|
|
7097
|
+
if (!handled) {
|
|
7098
|
+
await importDirectorySkill(skillName, skillDir, options);
|
|
7099
|
+
}
|
|
7100
|
+
}
|
|
7101
|
+
if (importedAny) return;
|
|
7102
|
+
}
|
|
7103
|
+
}
|
|
7104
|
+
function projectedAgentRecognizer(config) {
|
|
7105
|
+
return {
|
|
7106
|
+
async recognize(ctx) {
|
|
7107
|
+
const projectedAgent = parseProjectedAgentSkillFrontmatter(ctx.frontmatter, ctx.skillName);
|
|
7108
|
+
if (!projectedAgent) return false;
|
|
7109
|
+
const { options } = ctx;
|
|
7110
|
+
await removePathIfExists(
|
|
7111
|
+
join(options.projectRoot, options.destCanonicalSkillsDir, ctx.skillName)
|
|
7112
|
+
);
|
|
7113
|
+
const destAgentsDir = join(options.projectRoot, config.canonicalAgentsDir);
|
|
7114
|
+
await mkdirp(destAgentsDir);
|
|
7115
|
+
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
7116
|
+
const normalizedBody = options.normalize(ctx.rawBody, ctx.skillMdPath, agentPath);
|
|
7117
|
+
await writeFileAtomic(agentPath, serializeImportedAgent(projectedAgent, normalizedBody));
|
|
7118
|
+
options.results.push({
|
|
7119
|
+
fromTool: options.targetName,
|
|
7120
|
+
fromPath: ctx.skillMdPath,
|
|
7121
|
+
toPath: `${config.canonicalAgentsDir}/${projectedAgent.name}.md`,
|
|
7122
|
+
feature: "agents"
|
|
7123
|
+
});
|
|
7124
|
+
return true;
|
|
7125
|
+
}
|
|
7126
|
+
};
|
|
7127
|
+
}
|
|
7128
|
+
function commandSkillRecognizer(config) {
|
|
7129
|
+
return {
|
|
7130
|
+
async recognize(ctx) {
|
|
7131
|
+
const command = parseCommandSkillFrontmatter(ctx.frontmatter, ctx.skillName);
|
|
7132
|
+
if (!command) return false;
|
|
7133
|
+
const { options } = ctx;
|
|
7134
|
+
await removePathIfExists(
|
|
7135
|
+
join(options.projectRoot, options.destCanonicalSkillsDir, ctx.skillName)
|
|
7136
|
+
);
|
|
7137
|
+
const destCommandsDir = join(options.projectRoot, config.canonicalCommandsDir);
|
|
7138
|
+
await mkdirp(destCommandsDir);
|
|
7139
|
+
const commandPath = join(destCommandsDir, `${command.name}.md`);
|
|
7140
|
+
const normalizedBody = options.normalize(ctx.rawBody, ctx.skillMdPath, commandPath);
|
|
7141
|
+
await writeFileAtomic(commandPath, serializeImportedCommand(command, normalizedBody));
|
|
7142
|
+
options.results.push({
|
|
7143
|
+
fromTool: options.targetName,
|
|
7144
|
+
fromPath: ctx.skillMdPath,
|
|
7145
|
+
toPath: `${config.canonicalCommandsDir}/${command.name}.md`,
|
|
7146
|
+
feature: "commands"
|
|
7147
|
+
});
|
|
7148
|
+
return true;
|
|
7149
|
+
}
|
|
7150
|
+
};
|
|
7151
|
+
}
|
|
7068
7152
|
var init_skill_import_pipeline = __esm({
|
|
7069
7153
|
"src/targets/import/shared/skill-import-pipeline.ts"() {
|
|
7070
7154
|
init_fs();
|
|
7071
7155
|
init_markdown();
|
|
7072
7156
|
init_import_metadata();
|
|
7073
7157
|
init_reserved();
|
|
7158
|
+
init_projected_agent_skill();
|
|
7159
|
+
init_command_skill();
|
|
7160
|
+
init_scoped_agents_import();
|
|
7074
7161
|
}
|
|
7075
7162
|
});
|
|
7163
|
+
|
|
7164
|
+
// src/targets/cline/skills-adapter.ts
|
|
7076
7165
|
async function importClineSkills(projectRoot, results, normalize, skillsRelDir = CLINE_SKILLS_DIR) {
|
|
7077
|
-
const skillsDir = join(projectRoot, skillsRelDir);
|
|
7078
|
-
const directorySkills = await findDirectorySkills(skillsDir);
|
|
7079
7166
|
const options = {
|
|
7080
7167
|
projectRoot,
|
|
7081
|
-
sourceSkillsDir: skillsRelDir,
|
|
7082
7168
|
destCanonicalSkillsDir: CLINE_CANONICAL_SKILLS_DIR,
|
|
7083
7169
|
targetName: "cline",
|
|
7084
7170
|
normalize,
|
|
7085
7171
|
results
|
|
7086
7172
|
};
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
if (!content) continue;
|
|
7091
|
-
const rawParsed = parseFrontmatter(content);
|
|
7092
|
-
const projectedAgent = parseProjectedAgentSkillFrontmatter(rawParsed.frontmatter, skillName);
|
|
7093
|
-
if (projectedAgent) {
|
|
7094
|
-
const destAgentsDir = join(projectRoot, CLINE_CANONICAL_AGENTS_DIR);
|
|
7095
|
-
await mkdirp(destAgentsDir);
|
|
7096
|
-
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
7097
|
-
await writeFileAtomic(
|
|
7098
|
-
agentPath,
|
|
7099
|
-
serializeImportedAgent(projectedAgent, normalize(rawParsed.body, skillMdPath, agentPath))
|
|
7100
|
-
);
|
|
7101
|
-
results.push({
|
|
7102
|
-
fromTool: "cline",
|
|
7103
|
-
fromPath: skillMdPath,
|
|
7104
|
-
toPath: `${CLINE_CANONICAL_AGENTS_DIR}/${projectedAgent.name}.md`,
|
|
7105
|
-
feature: "agents"
|
|
7106
|
-
});
|
|
7107
|
-
continue;
|
|
7108
|
-
}
|
|
7109
|
-
await importDirectorySkill(skillName, skillDir, options);
|
|
7110
|
-
}
|
|
7173
|
+
await importSkillsDirectory([skillsRelDir], options, [
|
|
7174
|
+
projectedAgentRecognizer({ canonicalAgentsDir: CLINE_CANONICAL_AGENTS_DIR })
|
|
7175
|
+
]);
|
|
7111
7176
|
}
|
|
7112
7177
|
var init_skills_adapter = __esm({
|
|
7113
7178
|
"src/targets/cline/skills-adapter.ts"() {
|
|
7114
|
-
init_fs();
|
|
7115
|
-
init_markdown();
|
|
7116
|
-
init_projected_agent_skill();
|
|
7117
7179
|
init_skill_import_pipeline();
|
|
7118
7180
|
init_constants8();
|
|
7119
7181
|
}
|
|
@@ -7776,82 +7838,23 @@ var init_mcp_helpers = __esm({
|
|
|
7776
7838
|
init_constants28();
|
|
7777
7839
|
}
|
|
7778
7840
|
});
|
|
7841
|
+
|
|
7842
|
+
// src/targets/codex-cli/skills-adapter.ts
|
|
7779
7843
|
async function importSkills(projectRoot, results, normalize) {
|
|
7780
7844
|
const options = {
|
|
7781
7845
|
projectRoot,
|
|
7782
|
-
sourceSkillsDir: CODEX_SKILLS_DIR,
|
|
7783
7846
|
destCanonicalSkillsDir: CODEX_CANONICAL_SKILLS_DIR,
|
|
7784
7847
|
targetName: CODEX_TARGET,
|
|
7785
7848
|
normalize,
|
|
7786
7849
|
results
|
|
7787
7850
|
};
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
withFileTypes: true
|
|
7793
|
-
}).catch(() => null);
|
|
7794
|
-
if (entries === null) continue;
|
|
7795
|
-
let importedAny = false;
|
|
7796
|
-
for (const ent of entries) {
|
|
7797
|
-
if (!ent.isDirectory() && !ent.isSymbolicLink()) continue;
|
|
7798
|
-
const skillPath = join(skillsDir, ent.name);
|
|
7799
|
-
const skillMdPath = join(skillPath, "SKILL.md");
|
|
7800
|
-
const skillMdContent = await readFileSafe(skillMdPath);
|
|
7801
|
-
if (!skillMdContent) continue;
|
|
7802
|
-
importedAny = true;
|
|
7803
|
-
const skillName = ent.name;
|
|
7804
|
-
const destSkillPath = join(projectRoot, CODEX_CANONICAL_SKILLS_DIR, skillName, "SKILL.md");
|
|
7805
|
-
const normalized = normalize(skillMdContent, skillMdPath, destSkillPath);
|
|
7806
|
-
const { frontmatter, body } = parseFrontmatter(normalized);
|
|
7807
|
-
const command = parseCommandSkillFrontmatter(frontmatter, ent.name);
|
|
7808
|
-
if (command) {
|
|
7809
|
-
await removePathIfExists(join(projectRoot, CODEX_CANONICAL_SKILLS_DIR, skillName));
|
|
7810
|
-
const destCommandsDir = join(projectRoot, CODEX_CANONICAL_COMMANDS_DIR);
|
|
7811
|
-
await mkdirp(destCommandsDir);
|
|
7812
|
-
const commandPath = join(destCommandsDir, `${command.name}.md`);
|
|
7813
|
-
await writeFileAtomic(
|
|
7814
|
-
commandPath,
|
|
7815
|
-
serializeImportedCommand(command, normalize(body, skillMdPath, commandPath))
|
|
7816
|
-
);
|
|
7817
|
-
results.push({
|
|
7818
|
-
fromTool: CODEX_TARGET,
|
|
7819
|
-
fromPath: skillMdPath,
|
|
7820
|
-
toPath: `${CODEX_CANONICAL_COMMANDS_DIR}/${command.name}.md`,
|
|
7821
|
-
feature: "commands"
|
|
7822
|
-
});
|
|
7823
|
-
continue;
|
|
7824
|
-
}
|
|
7825
|
-
const projectedAgent = parseProjectedAgentSkillFrontmatter(frontmatter, ent.name);
|
|
7826
|
-
if (projectedAgent) {
|
|
7827
|
-
await removePathIfExists(join(projectRoot, CODEX_CANONICAL_SKILLS_DIR, skillName));
|
|
7828
|
-
const destAgentsDir = join(projectRoot, CODEX_CANONICAL_AGENTS_DIR);
|
|
7829
|
-
await mkdirp(destAgentsDir);
|
|
7830
|
-
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
7831
|
-
await writeFileAtomic(
|
|
7832
|
-
agentPath,
|
|
7833
|
-
serializeImportedAgent(projectedAgent, normalize(body, skillMdPath, agentPath))
|
|
7834
|
-
);
|
|
7835
|
-
results.push({
|
|
7836
|
-
fromTool: CODEX_TARGET,
|
|
7837
|
-
fromPath: skillMdPath,
|
|
7838
|
-
toPath: `${CODEX_CANONICAL_AGENTS_DIR}/${projectedAgent.name}.md`,
|
|
7839
|
-
feature: "agents"
|
|
7840
|
-
});
|
|
7841
|
-
continue;
|
|
7842
|
-
}
|
|
7843
|
-
await importDirectorySkill(skillName, skillPath, options);
|
|
7844
|
-
}
|
|
7845
|
-
if (importedAny) return;
|
|
7846
|
-
}
|
|
7851
|
+
await importSkillsDirectory([CODEX_SKILLS_DIR, CODEX_SKILLS_FALLBACK_DIR], options, [
|
|
7852
|
+
commandSkillRecognizer({ canonicalCommandsDir: CODEX_CANONICAL_COMMANDS_DIR }),
|
|
7853
|
+
projectedAgentRecognizer({ canonicalAgentsDir: CODEX_CANONICAL_AGENTS_DIR })
|
|
7854
|
+
]);
|
|
7847
7855
|
}
|
|
7848
7856
|
var init_skills_adapter2 = __esm({
|
|
7849
7857
|
"src/targets/codex-cli/skills-adapter.ts"() {
|
|
7850
|
-
init_fs();
|
|
7851
|
-
init_markdown();
|
|
7852
|
-
init_command_skill();
|
|
7853
|
-
init_projected_agent_skill();
|
|
7854
|
-
init_scoped_agents_import();
|
|
7855
7858
|
init_skill_import_pipeline();
|
|
7856
7859
|
init_constants28();
|
|
7857
7860
|
}
|
|
@@ -9205,7 +9208,6 @@ async function importSkills2(projectRoot, results, normalize, skillsDirRel = COP
|
|
|
9205
9208
|
const directorySkills = await findDirectorySkills(skillsDir);
|
|
9206
9209
|
const options = {
|
|
9207
9210
|
projectRoot,
|
|
9208
|
-
sourceSkillsDir: skillsDirRel,
|
|
9209
9211
|
destCanonicalSkillsDir: COPILOT_CANONICAL_SKILLS_DIR,
|
|
9210
9212
|
targetName: COPILOT_TARGET,
|
|
9211
9213
|
normalize,
|
|
@@ -10737,7 +10739,6 @@ async function importSkills3(projectRoot, results, normalize, skillsRelDir = CUR
|
|
|
10737
10739
|
const directorySkills = await findDirectorySkills(skillsDir);
|
|
10738
10740
|
const options = {
|
|
10739
10741
|
projectRoot,
|
|
10740
|
-
sourceSkillsDir: skillsRelDir,
|
|
10741
10742
|
destCanonicalSkillsDir: CURSOR_CANONICAL_SKILLS_DIR,
|
|
10742
10743
|
targetName: "cursor",
|
|
10743
10744
|
normalize,
|
|
@@ -17672,49 +17673,22 @@ var init_importer_workflows = __esm({
|
|
|
17672
17673
|
init_constants31();
|
|
17673
17674
|
}
|
|
17674
17675
|
});
|
|
17676
|
+
|
|
17677
|
+
// src/targets/windsurf/skills-adapter.ts
|
|
17675
17678
|
async function importSkills4(projectRoot, results, normalize, skillsRelDir = WINDSURF_SKILLS_DIR) {
|
|
17676
|
-
const skillsDir = join(projectRoot, skillsRelDir);
|
|
17677
|
-
const directorySkills = await findDirectorySkills(skillsDir);
|
|
17678
17679
|
const options = {
|
|
17679
17680
|
projectRoot,
|
|
17680
|
-
sourceSkillsDir: skillsRelDir,
|
|
17681
17681
|
destCanonicalSkillsDir: WINDSURF_CANONICAL_SKILLS_DIR,
|
|
17682
17682
|
targetName: "windsurf",
|
|
17683
17683
|
normalize,
|
|
17684
17684
|
results
|
|
17685
17685
|
};
|
|
17686
|
-
|
|
17687
|
-
|
|
17688
|
-
|
|
17689
|
-
if (!content) continue;
|
|
17690
|
-
const rawParsed = parseFrontmatter(content);
|
|
17691
|
-
const projectedAgent = parseProjectedAgentSkillFrontmatter(rawParsed.frontmatter, skillName);
|
|
17692
|
-
if (projectedAgent) {
|
|
17693
|
-
await removePathIfExists(join(projectRoot, WINDSURF_CANONICAL_SKILLS_DIR, skillName));
|
|
17694
|
-
const destAgentsDir = join(projectRoot, WINDSURF_CANONICAL_AGENTS_DIR);
|
|
17695
|
-
await mkdirp(destAgentsDir);
|
|
17696
|
-
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
17697
|
-
await writeFileAtomic(
|
|
17698
|
-
agentPath,
|
|
17699
|
-
serializeImportedAgent(projectedAgent, normalize(rawParsed.body, skillMdPath, agentPath))
|
|
17700
|
-
);
|
|
17701
|
-
results.push({
|
|
17702
|
-
fromTool: "windsurf",
|
|
17703
|
-
fromPath: skillMdPath,
|
|
17704
|
-
toPath: `${WINDSURF_CANONICAL_AGENTS_DIR}/${projectedAgent.name}.md`,
|
|
17705
|
-
feature: "agents"
|
|
17706
|
-
});
|
|
17707
|
-
continue;
|
|
17708
|
-
}
|
|
17709
|
-
await importDirectorySkill(skillName, skillDir, options);
|
|
17710
|
-
}
|
|
17686
|
+
await importSkillsDirectory([skillsRelDir], options, [
|
|
17687
|
+
projectedAgentRecognizer({ canonicalAgentsDir: WINDSURF_CANONICAL_AGENTS_DIR })
|
|
17688
|
+
]);
|
|
17711
17689
|
}
|
|
17712
17690
|
var init_skills_adapter5 = __esm({
|
|
17713
17691
|
"src/targets/windsurf/skills-adapter.ts"() {
|
|
17714
|
-
init_fs();
|
|
17715
|
-
init_markdown();
|
|
17716
|
-
init_projected_agent_skill();
|
|
17717
|
-
init_scoped_agents_import();
|
|
17718
17692
|
init_skill_import_pipeline();
|
|
17719
17693
|
init_constants31();
|
|
17720
17694
|
}
|