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/targets.js
CHANGED
|
@@ -6941,55 +6941,117 @@ async function findDirectorySkills(skillsDir) {
|
|
|
6941
6941
|
}
|
|
6942
6942
|
return skills;
|
|
6943
6943
|
}
|
|
6944
|
+
async function importSkillsDirectory(sourceSkillsDirs, options, recognizers = []) {
|
|
6945
|
+
for (const sourceDir of sourceSkillsDirs) {
|
|
6946
|
+
const absSkillsDir = join(options.projectRoot, sourceDir);
|
|
6947
|
+
const directorySkills = await findDirectorySkills(absSkillsDir);
|
|
6948
|
+
if (directorySkills.size === 0) continue;
|
|
6949
|
+
let importedAny = false;
|
|
6950
|
+
for (const [skillName, skillDir] of directorySkills) {
|
|
6951
|
+
const skillMdPath = join(skillDir, "SKILL.md");
|
|
6952
|
+
const rawContent = await readFileSafe(skillMdPath);
|
|
6953
|
+
if (rawContent === null) continue;
|
|
6954
|
+
importedAny = true;
|
|
6955
|
+
const { frontmatter, body: rawBody } = parseFrontmatter(rawContent);
|
|
6956
|
+
const ctx = {
|
|
6957
|
+
skillName,
|
|
6958
|
+
skillDir,
|
|
6959
|
+
skillMdPath,
|
|
6960
|
+
rawContent,
|
|
6961
|
+
frontmatter,
|
|
6962
|
+
rawBody,
|
|
6963
|
+
options
|
|
6964
|
+
};
|
|
6965
|
+
let handled = false;
|
|
6966
|
+
for (const recognizer of recognizers) {
|
|
6967
|
+
const claimed = await recognizer.recognize(ctx);
|
|
6968
|
+
if (claimed) {
|
|
6969
|
+
handled = true;
|
|
6970
|
+
break;
|
|
6971
|
+
}
|
|
6972
|
+
}
|
|
6973
|
+
if (!handled) {
|
|
6974
|
+
await importDirectorySkill(skillName, skillDir, options);
|
|
6975
|
+
}
|
|
6976
|
+
}
|
|
6977
|
+
if (importedAny) return;
|
|
6978
|
+
}
|
|
6979
|
+
}
|
|
6980
|
+
function projectedAgentRecognizer(config) {
|
|
6981
|
+
return {
|
|
6982
|
+
async recognize(ctx) {
|
|
6983
|
+
const projectedAgent = parseProjectedAgentSkillFrontmatter(ctx.frontmatter, ctx.skillName);
|
|
6984
|
+
if (!projectedAgent) return false;
|
|
6985
|
+
const { options } = ctx;
|
|
6986
|
+
await removePathIfExists(
|
|
6987
|
+
join(options.projectRoot, options.destCanonicalSkillsDir, ctx.skillName)
|
|
6988
|
+
);
|
|
6989
|
+
const destAgentsDir = join(options.projectRoot, config.canonicalAgentsDir);
|
|
6990
|
+
await mkdirp(destAgentsDir);
|
|
6991
|
+
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
6992
|
+
const normalizedBody = options.normalize(ctx.rawBody, ctx.skillMdPath, agentPath);
|
|
6993
|
+
await writeFileAtomic(agentPath, serializeImportedAgent(projectedAgent, normalizedBody));
|
|
6994
|
+
options.results.push({
|
|
6995
|
+
fromTool: options.targetName,
|
|
6996
|
+
fromPath: ctx.skillMdPath,
|
|
6997
|
+
toPath: `${config.canonicalAgentsDir}/${projectedAgent.name}.md`,
|
|
6998
|
+
feature: "agents"
|
|
6999
|
+
});
|
|
7000
|
+
return true;
|
|
7001
|
+
}
|
|
7002
|
+
};
|
|
7003
|
+
}
|
|
7004
|
+
function commandSkillRecognizer(config) {
|
|
7005
|
+
return {
|
|
7006
|
+
async recognize(ctx) {
|
|
7007
|
+
const command = parseCommandSkillFrontmatter(ctx.frontmatter, ctx.skillName);
|
|
7008
|
+
if (!command) return false;
|
|
7009
|
+
const { options } = ctx;
|
|
7010
|
+
await removePathIfExists(
|
|
7011
|
+
join(options.projectRoot, options.destCanonicalSkillsDir, ctx.skillName)
|
|
7012
|
+
);
|
|
7013
|
+
const destCommandsDir = join(options.projectRoot, config.canonicalCommandsDir);
|
|
7014
|
+
await mkdirp(destCommandsDir);
|
|
7015
|
+
const commandPath = join(destCommandsDir, `${command.name}.md`);
|
|
7016
|
+
const normalizedBody = options.normalize(ctx.rawBody, ctx.skillMdPath, commandPath);
|
|
7017
|
+
await writeFileAtomic(commandPath, serializeImportedCommand(command, normalizedBody));
|
|
7018
|
+
options.results.push({
|
|
7019
|
+
fromTool: options.targetName,
|
|
7020
|
+
fromPath: ctx.skillMdPath,
|
|
7021
|
+
toPath: `${config.canonicalCommandsDir}/${command.name}.md`,
|
|
7022
|
+
feature: "commands"
|
|
7023
|
+
});
|
|
7024
|
+
return true;
|
|
7025
|
+
}
|
|
7026
|
+
};
|
|
7027
|
+
}
|
|
6944
7028
|
var init_skill_import_pipeline = __esm({
|
|
6945
7029
|
"src/targets/import/shared/skill-import-pipeline.ts"() {
|
|
6946
7030
|
init_fs();
|
|
6947
7031
|
init_markdown();
|
|
6948
7032
|
init_import_metadata();
|
|
6949
7033
|
init_reserved();
|
|
7034
|
+
init_projected_agent_skill();
|
|
7035
|
+
init_command_skill();
|
|
7036
|
+
init_scoped_agents_import();
|
|
6950
7037
|
}
|
|
6951
7038
|
});
|
|
7039
|
+
|
|
7040
|
+
// src/targets/cline/skills-adapter.ts
|
|
6952
7041
|
async function importClineSkills(projectRoot, results, normalize, skillsRelDir = CLINE_SKILLS_DIR) {
|
|
6953
|
-
const skillsDir = join(projectRoot, skillsRelDir);
|
|
6954
|
-
const directorySkills = await findDirectorySkills(skillsDir);
|
|
6955
7042
|
const options = {
|
|
6956
7043
|
projectRoot,
|
|
6957
|
-
sourceSkillsDir: skillsRelDir,
|
|
6958
7044
|
destCanonicalSkillsDir: CLINE_CANONICAL_SKILLS_DIR,
|
|
6959
7045
|
targetName: "cline",
|
|
6960
7046
|
normalize,
|
|
6961
7047
|
results
|
|
6962
7048
|
};
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
if (!content) continue;
|
|
6967
|
-
const rawParsed = parseFrontmatter(content);
|
|
6968
|
-
const projectedAgent = parseProjectedAgentSkillFrontmatter(rawParsed.frontmatter, skillName);
|
|
6969
|
-
if (projectedAgent) {
|
|
6970
|
-
const destAgentsDir = join(projectRoot, CLINE_CANONICAL_AGENTS_DIR);
|
|
6971
|
-
await mkdirp(destAgentsDir);
|
|
6972
|
-
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
6973
|
-
await writeFileAtomic(
|
|
6974
|
-
agentPath,
|
|
6975
|
-
serializeImportedAgent(projectedAgent, normalize(rawParsed.body, skillMdPath, agentPath))
|
|
6976
|
-
);
|
|
6977
|
-
results.push({
|
|
6978
|
-
fromTool: "cline",
|
|
6979
|
-
fromPath: skillMdPath,
|
|
6980
|
-
toPath: `${CLINE_CANONICAL_AGENTS_DIR}/${projectedAgent.name}.md`,
|
|
6981
|
-
feature: "agents"
|
|
6982
|
-
});
|
|
6983
|
-
continue;
|
|
6984
|
-
}
|
|
6985
|
-
await importDirectorySkill(skillName, skillDir, options);
|
|
6986
|
-
}
|
|
7049
|
+
await importSkillsDirectory([skillsRelDir], options, [
|
|
7050
|
+
projectedAgentRecognizer({ canonicalAgentsDir: CLINE_CANONICAL_AGENTS_DIR })
|
|
7051
|
+
]);
|
|
6987
7052
|
}
|
|
6988
7053
|
var init_skills_adapter = __esm({
|
|
6989
7054
|
"src/targets/cline/skills-adapter.ts"() {
|
|
6990
|
-
init_fs();
|
|
6991
|
-
init_markdown();
|
|
6992
|
-
init_projected_agent_skill();
|
|
6993
7055
|
init_skill_import_pipeline();
|
|
6994
7056
|
init_constants8();
|
|
6995
7057
|
}
|
|
@@ -7652,82 +7714,23 @@ var init_mcp_helpers = __esm({
|
|
|
7652
7714
|
init_constants28();
|
|
7653
7715
|
}
|
|
7654
7716
|
});
|
|
7717
|
+
|
|
7718
|
+
// src/targets/codex-cli/skills-adapter.ts
|
|
7655
7719
|
async function importSkills(projectRoot, results, normalize) {
|
|
7656
7720
|
const options = {
|
|
7657
7721
|
projectRoot,
|
|
7658
|
-
sourceSkillsDir: CODEX_SKILLS_DIR,
|
|
7659
7722
|
destCanonicalSkillsDir: CODEX_CANONICAL_SKILLS_DIR,
|
|
7660
7723
|
targetName: CODEX_TARGET,
|
|
7661
7724
|
normalize,
|
|
7662
7725
|
results
|
|
7663
7726
|
};
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
withFileTypes: true
|
|
7669
|
-
}).catch(() => null);
|
|
7670
|
-
if (entries === null) continue;
|
|
7671
|
-
let importedAny = false;
|
|
7672
|
-
for (const ent of entries) {
|
|
7673
|
-
if (!ent.isDirectory() && !ent.isSymbolicLink()) continue;
|
|
7674
|
-
const skillPath = join(skillsDir, ent.name);
|
|
7675
|
-
const skillMdPath = join(skillPath, "SKILL.md");
|
|
7676
|
-
const skillMdContent = await readFileSafe(skillMdPath);
|
|
7677
|
-
if (!skillMdContent) continue;
|
|
7678
|
-
importedAny = true;
|
|
7679
|
-
const skillName = ent.name;
|
|
7680
|
-
const destSkillPath = join(projectRoot, CODEX_CANONICAL_SKILLS_DIR, skillName, "SKILL.md");
|
|
7681
|
-
const normalized = normalize(skillMdContent, skillMdPath, destSkillPath);
|
|
7682
|
-
const { frontmatter, body } = parseFrontmatter(normalized);
|
|
7683
|
-
const command = parseCommandSkillFrontmatter(frontmatter, ent.name);
|
|
7684
|
-
if (command) {
|
|
7685
|
-
await removePathIfExists(join(projectRoot, CODEX_CANONICAL_SKILLS_DIR, skillName));
|
|
7686
|
-
const destCommandsDir = join(projectRoot, CODEX_CANONICAL_COMMANDS_DIR);
|
|
7687
|
-
await mkdirp(destCommandsDir);
|
|
7688
|
-
const commandPath = join(destCommandsDir, `${command.name}.md`);
|
|
7689
|
-
await writeFileAtomic(
|
|
7690
|
-
commandPath,
|
|
7691
|
-
serializeImportedCommand(command, normalize(body, skillMdPath, commandPath))
|
|
7692
|
-
);
|
|
7693
|
-
results.push({
|
|
7694
|
-
fromTool: CODEX_TARGET,
|
|
7695
|
-
fromPath: skillMdPath,
|
|
7696
|
-
toPath: `${CODEX_CANONICAL_COMMANDS_DIR}/${command.name}.md`,
|
|
7697
|
-
feature: "commands"
|
|
7698
|
-
});
|
|
7699
|
-
continue;
|
|
7700
|
-
}
|
|
7701
|
-
const projectedAgent = parseProjectedAgentSkillFrontmatter(frontmatter, ent.name);
|
|
7702
|
-
if (projectedAgent) {
|
|
7703
|
-
await removePathIfExists(join(projectRoot, CODEX_CANONICAL_SKILLS_DIR, skillName));
|
|
7704
|
-
const destAgentsDir = join(projectRoot, CODEX_CANONICAL_AGENTS_DIR);
|
|
7705
|
-
await mkdirp(destAgentsDir);
|
|
7706
|
-
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
7707
|
-
await writeFileAtomic(
|
|
7708
|
-
agentPath,
|
|
7709
|
-
serializeImportedAgent(projectedAgent, normalize(body, skillMdPath, agentPath))
|
|
7710
|
-
);
|
|
7711
|
-
results.push({
|
|
7712
|
-
fromTool: CODEX_TARGET,
|
|
7713
|
-
fromPath: skillMdPath,
|
|
7714
|
-
toPath: `${CODEX_CANONICAL_AGENTS_DIR}/${projectedAgent.name}.md`,
|
|
7715
|
-
feature: "agents"
|
|
7716
|
-
});
|
|
7717
|
-
continue;
|
|
7718
|
-
}
|
|
7719
|
-
await importDirectorySkill(skillName, skillPath, options);
|
|
7720
|
-
}
|
|
7721
|
-
if (importedAny) return;
|
|
7722
|
-
}
|
|
7727
|
+
await importSkillsDirectory([CODEX_SKILLS_DIR, CODEX_SKILLS_FALLBACK_DIR], options, [
|
|
7728
|
+
commandSkillRecognizer({ canonicalCommandsDir: CODEX_CANONICAL_COMMANDS_DIR }),
|
|
7729
|
+
projectedAgentRecognizer({ canonicalAgentsDir: CODEX_CANONICAL_AGENTS_DIR })
|
|
7730
|
+
]);
|
|
7723
7731
|
}
|
|
7724
7732
|
var init_skills_adapter2 = __esm({
|
|
7725
7733
|
"src/targets/codex-cli/skills-adapter.ts"() {
|
|
7726
|
-
init_fs();
|
|
7727
|
-
init_markdown();
|
|
7728
|
-
init_command_skill();
|
|
7729
|
-
init_projected_agent_skill();
|
|
7730
|
-
init_scoped_agents_import();
|
|
7731
7734
|
init_skill_import_pipeline();
|
|
7732
7735
|
init_constants28();
|
|
7733
7736
|
}
|
|
@@ -9081,7 +9084,6 @@ async function importSkills2(projectRoot, results, normalize, skillsDirRel = COP
|
|
|
9081
9084
|
const directorySkills = await findDirectorySkills(skillsDir);
|
|
9082
9085
|
const options = {
|
|
9083
9086
|
projectRoot,
|
|
9084
|
-
sourceSkillsDir: skillsDirRel,
|
|
9085
9087
|
destCanonicalSkillsDir: COPILOT_CANONICAL_SKILLS_DIR,
|
|
9086
9088
|
targetName: COPILOT_TARGET,
|
|
9087
9089
|
normalize,
|
|
@@ -10600,7 +10602,6 @@ async function importSkills3(projectRoot, results, normalize, skillsRelDir = CUR
|
|
|
10600
10602
|
const directorySkills = await findDirectorySkills(skillsDir);
|
|
10601
10603
|
const options = {
|
|
10602
10604
|
projectRoot,
|
|
10603
|
-
sourceSkillsDir: skillsRelDir,
|
|
10604
10605
|
destCanonicalSkillsDir: CURSOR_CANONICAL_SKILLS_DIR,
|
|
10605
10606
|
targetName: "cursor",
|
|
10606
10607
|
normalize,
|
|
@@ -17535,49 +17536,22 @@ var init_importer_workflows = __esm({
|
|
|
17535
17536
|
init_constants31();
|
|
17536
17537
|
}
|
|
17537
17538
|
});
|
|
17539
|
+
|
|
17540
|
+
// src/targets/windsurf/skills-adapter.ts
|
|
17538
17541
|
async function importSkills4(projectRoot, results, normalize, skillsRelDir = WINDSURF_SKILLS_DIR) {
|
|
17539
|
-
const skillsDir = join(projectRoot, skillsRelDir);
|
|
17540
|
-
const directorySkills = await findDirectorySkills(skillsDir);
|
|
17541
17542
|
const options = {
|
|
17542
17543
|
projectRoot,
|
|
17543
|
-
sourceSkillsDir: skillsRelDir,
|
|
17544
17544
|
destCanonicalSkillsDir: WINDSURF_CANONICAL_SKILLS_DIR,
|
|
17545
17545
|
targetName: "windsurf",
|
|
17546
17546
|
normalize,
|
|
17547
17547
|
results
|
|
17548
17548
|
};
|
|
17549
|
-
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
if (!content) continue;
|
|
17553
|
-
const rawParsed = parseFrontmatter(content);
|
|
17554
|
-
const projectedAgent = parseProjectedAgentSkillFrontmatter(rawParsed.frontmatter, skillName);
|
|
17555
|
-
if (projectedAgent) {
|
|
17556
|
-
await removePathIfExists(join(projectRoot, WINDSURF_CANONICAL_SKILLS_DIR, skillName));
|
|
17557
|
-
const destAgentsDir = join(projectRoot, WINDSURF_CANONICAL_AGENTS_DIR);
|
|
17558
|
-
await mkdirp(destAgentsDir);
|
|
17559
|
-
const agentPath = join(destAgentsDir, `${projectedAgent.name}.md`);
|
|
17560
|
-
await writeFileAtomic(
|
|
17561
|
-
agentPath,
|
|
17562
|
-
serializeImportedAgent(projectedAgent, normalize(rawParsed.body, skillMdPath, agentPath))
|
|
17563
|
-
);
|
|
17564
|
-
results.push({
|
|
17565
|
-
fromTool: "windsurf",
|
|
17566
|
-
fromPath: skillMdPath,
|
|
17567
|
-
toPath: `${WINDSURF_CANONICAL_AGENTS_DIR}/${projectedAgent.name}.md`,
|
|
17568
|
-
feature: "agents"
|
|
17569
|
-
});
|
|
17570
|
-
continue;
|
|
17571
|
-
}
|
|
17572
|
-
await importDirectorySkill(skillName, skillDir, options);
|
|
17573
|
-
}
|
|
17549
|
+
await importSkillsDirectory([skillsRelDir], options, [
|
|
17550
|
+
projectedAgentRecognizer({ canonicalAgentsDir: WINDSURF_CANONICAL_AGENTS_DIR })
|
|
17551
|
+
]);
|
|
17574
17552
|
}
|
|
17575
17553
|
var init_skills_adapter5 = __esm({
|
|
17576
17554
|
"src/targets/windsurf/skills-adapter.ts"() {
|
|
17577
|
-
init_fs();
|
|
17578
|
-
init_markdown();
|
|
17579
|
-
init_projected_agent_skill();
|
|
17580
|
-
init_scoped_agents_import();
|
|
17581
17555
|
init_skill_import_pipeline();
|
|
17582
17556
|
init_constants31();
|
|
17583
17557
|
}
|