agentsmesh 0.2.0 → 0.2.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 +22 -17
- package/LICENSE +1 -1
- package/README.md +44 -44
- package/dist/cli.js +348 -348
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -99,7 +99,7 @@ var logger = {
|
|
|
99
99
|
process.stdout.write(c(C.green, "\u2713 ") + msg + "\n");
|
|
100
100
|
},
|
|
101
101
|
debug(msg) {
|
|
102
|
-
if (process.env.
|
|
102
|
+
if (process.env.AGENTSMESH_DEBUG === "1") {
|
|
103
103
|
process.stdout.write(c(C.cyan, "[debug] ") + msg + "\n");
|
|
104
104
|
}
|
|
105
105
|
},
|
|
@@ -135,13 +135,13 @@ var GLOBAL_FLAGS = [
|
|
|
135
135
|
var COMMANDS = [
|
|
136
136
|
{
|
|
137
137
|
name: "init",
|
|
138
|
-
usage: "
|
|
139
|
-
description: "Create
|
|
138
|
+
usage: "agentsmesh init [flags]",
|
|
139
|
+
description: "Create agentsmesh.yaml, agentsmesh.local.yaml, and canonical .agentsmesh scaffold",
|
|
140
140
|
flags: [{ name: "--yes", description: "Auto-import detected tool configs without prompting" }]
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
name: "generate",
|
|
144
|
-
usage: "
|
|
144
|
+
usage: "agentsmesh generate [flags]",
|
|
145
145
|
description: "Generate target files from canonical sources",
|
|
146
146
|
flags: [
|
|
147
147
|
{ name: "--targets <csv>", description: "Limit generation to target IDs (comma-separated)" },
|
|
@@ -154,13 +154,13 @@ var COMMANDS = [
|
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
156
|
name: "import",
|
|
157
|
-
usage: "
|
|
158
|
-
description: "Import existing tool config into canonical .
|
|
157
|
+
usage: "agentsmesh import --from <target>",
|
|
158
|
+
description: "Import existing tool config into canonical .agentsmesh files",
|
|
159
159
|
flags: [{ name: "--from <target>", description: "Source tool ID to import from (required)" }]
|
|
160
160
|
},
|
|
161
161
|
{
|
|
162
162
|
name: "install",
|
|
163
|
-
usage: "
|
|
163
|
+
usage: "agentsmesh install <source> [flags]",
|
|
164
164
|
description: "Install canonical resources from local/remote sources",
|
|
165
165
|
flags: [
|
|
166
166
|
{
|
|
@@ -169,7 +169,7 @@ var COMMANDS = [
|
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
name: "--sync",
|
|
172
|
-
description: "Reinstall missing packs recorded in .
|
|
172
|
+
description: "Reinstall missing packs recorded in .agentsmesh/installs.yaml"
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
name: "--path <dir>",
|
|
@@ -200,13 +200,13 @@ var COMMANDS = [
|
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
name: "diff",
|
|
203
|
-
usage: "
|
|
203
|
+
usage: "agentsmesh diff [flags]",
|
|
204
204
|
description: "Show patch-style output for what generate would change",
|
|
205
205
|
flags: [{ name: "--targets <csv>", description: "Limit diff to target IDs (comma-separated)" }]
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
208
|
name: "lint",
|
|
209
|
-
usage: "
|
|
209
|
+
usage: "agentsmesh lint [flags]",
|
|
210
210
|
description: "Validate canonical files against target constraints",
|
|
211
211
|
flags: [
|
|
212
212
|
{ name: "--targets <csv>", description: "Limit linting to target IDs (comma-separated)" }
|
|
@@ -214,7 +214,7 @@ var COMMANDS = [
|
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
name: "watch",
|
|
217
|
-
usage: "
|
|
217
|
+
usage: "agentsmesh watch [flags]",
|
|
218
218
|
description: "Watch canonical files and regenerate on change",
|
|
219
219
|
flags: [
|
|
220
220
|
{
|
|
@@ -225,19 +225,19 @@ var COMMANDS = [
|
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
name: "check",
|
|
228
|
-
usage: "
|
|
229
|
-
description: "Verify canonical files still match .
|
|
228
|
+
usage: "agentsmesh check",
|
|
229
|
+
description: "Verify canonical files still match .agentsmesh/.lock",
|
|
230
230
|
flags: []
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
name: "merge",
|
|
234
|
-
usage: "
|
|
235
|
-
description: "Resolve .
|
|
234
|
+
usage: "agentsmesh merge",
|
|
235
|
+
description: "Resolve .agentsmesh/.lock merge conflicts from current canonical state",
|
|
236
236
|
flags: []
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
name: "matrix",
|
|
240
|
-
usage: "
|
|
240
|
+
usage: "agentsmesh matrix [flags]",
|
|
241
241
|
description: "Print compatibility matrix for enabled features and targets",
|
|
242
242
|
flags: [
|
|
243
243
|
{ name: "--targets <csv>", description: "Limit matrix columns to target IDs" },
|
|
@@ -255,7 +255,7 @@ function printHelp() {
|
|
|
255
255
|
Usage: ${command.usage}
|
|
256
256
|
${formatFlags(command.flags)}`;
|
|
257
257
|
}).join("\n\n");
|
|
258
|
-
logger.info(`
|
|
258
|
+
logger.info(`agentsmesh <command> [flags]
|
|
259
259
|
|
|
260
260
|
Global flags:
|
|
261
261
|
${formatFlags(GLOBAL_FLAGS)}
|
|
@@ -263,7 +263,7 @@ ${formatFlags(GLOBAL_FLAGS)}
|
|
|
263
263
|
Commands:
|
|
264
264
|
${commandLines}
|
|
265
265
|
|
|
266
|
-
Tip: run "
|
|
266
|
+
Tip: run "agentsmesh <command> --help" for this same command reference.`);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
// src/cli/version.ts
|
|
@@ -278,7 +278,7 @@ function getVersion() {
|
|
|
278
278
|
return pkg.version;
|
|
279
279
|
}
|
|
280
280
|
function printVersion() {
|
|
281
|
-
process.stdout.write(`
|
|
281
|
+
process.stdout.write(`agentsmesh v${pkg.version}
|
|
282
282
|
`);
|
|
283
283
|
}
|
|
284
284
|
|
|
@@ -424,7 +424,7 @@ import { basename, dirname as dirname3, join as join3, relative } from "path";
|
|
|
424
424
|
|
|
425
425
|
// src/targets/codex-cli/command-skill.ts
|
|
426
426
|
init_markdown();
|
|
427
|
-
var CODEX_COMMAND_SKILL_PREFIX = "
|
|
427
|
+
var CODEX_COMMAND_SKILL_PREFIX = "am-command-";
|
|
428
428
|
var LEGACY_CODEX_COMMAND_SKILL_PREFIX = "ab-command-";
|
|
429
429
|
function toStringArray(value) {
|
|
430
430
|
if (Array.isArray(value)) {
|
|
@@ -442,26 +442,26 @@ function serializeCommandSkill(command) {
|
|
|
442
442
|
const frontmatter = {
|
|
443
443
|
name: commandSkillDirName(command.name),
|
|
444
444
|
description: command.description || void 0,
|
|
445
|
-
"x-
|
|
446
|
-
"x-
|
|
447
|
-
"x-
|
|
445
|
+
"x-agentsmesh-kind": "command",
|
|
446
|
+
"x-agentsmesh-name": command.name,
|
|
447
|
+
"x-agentsmesh-allowed-tools": command.allowedTools.length > 0 ? command.allowedTools : void 0
|
|
448
448
|
};
|
|
449
449
|
if (frontmatter.description === void 0) delete frontmatter.description;
|
|
450
|
-
if (frontmatter["x-
|
|
451
|
-
delete frontmatter["x-
|
|
450
|
+
if (frontmatter["x-agentsmesh-allowed-tools"] === void 0) {
|
|
451
|
+
delete frontmatter["x-agentsmesh-allowed-tools"];
|
|
452
452
|
}
|
|
453
453
|
return serializeFrontmatter(frontmatter, command.body.trim() || "");
|
|
454
454
|
}
|
|
455
455
|
function parseCommandSkillFrontmatter(frontmatter, dirName) {
|
|
456
|
-
if (frontmatter["x-
|
|
457
|
-
const metadataName = typeof frontmatter["x-
|
|
456
|
+
if (frontmatter["x-agentsmesh-kind"] !== "command") return null;
|
|
457
|
+
const metadataName = typeof frontmatter["x-agentsmesh-name"] === "string" ? frontmatter["x-agentsmesh-name"] : "";
|
|
458
458
|
const derivedName = dirName.startsWith(CODEX_COMMAND_SKILL_PREFIX) ? dirName.slice(CODEX_COMMAND_SKILL_PREFIX.length) : dirName.startsWith(LEGACY_CODEX_COMMAND_SKILL_PREFIX) ? dirName.slice(LEGACY_CODEX_COMMAND_SKILL_PREFIX.length) : "";
|
|
459
459
|
const name = (metadataName || derivedName).trim();
|
|
460
460
|
if (!name) return null;
|
|
461
461
|
return {
|
|
462
462
|
name,
|
|
463
463
|
description: typeof frontmatter.description === "string" ? frontmatter.description : "",
|
|
464
|
-
allowedTools: toStringArray(frontmatter["x-
|
|
464
|
+
allowedTools: toStringArray(frontmatter["x-agentsmesh-allowed-tools"])
|
|
465
465
|
};
|
|
466
466
|
}
|
|
467
467
|
function serializeImportedCommand(command, body) {
|
|
@@ -476,7 +476,7 @@ function serializeImportedCommand(command, body) {
|
|
|
476
476
|
|
|
477
477
|
// src/targets/projected-agent-skill.ts
|
|
478
478
|
init_markdown();
|
|
479
|
-
var PROJECTED_AGENT_SKILL_PREFIX = "
|
|
479
|
+
var PROJECTED_AGENT_SKILL_PREFIX = "am-agent-";
|
|
480
480
|
var LEGACY_PROJECTED_AGENT_SKILL_PREFIX = "ab-agent-";
|
|
481
481
|
function toStringArray2(value) {
|
|
482
482
|
if (Array.isArray(value)) {
|
|
@@ -505,17 +505,17 @@ function serializeProjectedAgentSkill(agent) {
|
|
|
505
505
|
const frontmatter = {
|
|
506
506
|
name: projectedAgentSkillDirName(agent.name),
|
|
507
507
|
description: agent.description || void 0,
|
|
508
|
-
"x-
|
|
509
|
-
"x-
|
|
510
|
-
"x-
|
|
511
|
-
"x-
|
|
512
|
-
"x-
|
|
513
|
-
"x-
|
|
514
|
-
"x-
|
|
515
|
-
"x-
|
|
516
|
-
"x-
|
|
517
|
-
"x-
|
|
518
|
-
"x-
|
|
508
|
+
"x-agentsmesh-kind": "agent",
|
|
509
|
+
"x-agentsmesh-name": agent.name,
|
|
510
|
+
"x-agentsmesh-tools": agent.tools.length > 0 ? agent.tools : void 0,
|
|
511
|
+
"x-agentsmesh-disallowed-tools": agent.disallowedTools.length > 0 ? agent.disallowedTools : void 0,
|
|
512
|
+
"x-agentsmesh-model": agent.model || void 0,
|
|
513
|
+
"x-agentsmesh-permission-mode": agent.permissionMode || void 0,
|
|
514
|
+
"x-agentsmesh-max-turns": agent.maxTurns > 0 ? agent.maxTurns : void 0,
|
|
515
|
+
"x-agentsmesh-mcp-servers": agent.mcpServers.length > 0 ? agent.mcpServers : void 0,
|
|
516
|
+
"x-agentsmesh-hooks": Object.keys(agent.hooks).length > 0 ? agent.hooks : void 0,
|
|
517
|
+
"x-agentsmesh-skills": agent.skills.length > 0 ? agent.skills : void 0,
|
|
518
|
+
"x-agentsmesh-memory": agent.memory || void 0
|
|
519
519
|
};
|
|
520
520
|
Object.keys(frontmatter).forEach((key) => {
|
|
521
521
|
if (frontmatter[key] === void 0) delete frontmatter[key];
|
|
@@ -523,23 +523,23 @@ function serializeProjectedAgentSkill(agent) {
|
|
|
523
523
|
return serializeFrontmatter(frontmatter, agent.body.trim() || "");
|
|
524
524
|
}
|
|
525
525
|
function parseProjectedAgentSkillFrontmatter(frontmatter, dirName) {
|
|
526
|
-
if (frontmatter["x-
|
|
527
|
-
const metadataName = typeof frontmatter["x-
|
|
526
|
+
if (frontmatter["x-agentsmesh-kind"] !== "agent") return null;
|
|
527
|
+
const metadataName = typeof frontmatter["x-agentsmesh-name"] === "string" ? frontmatter["x-agentsmesh-name"] : "";
|
|
528
528
|
const derivedName = dirName.startsWith(PROJECTED_AGENT_SKILL_PREFIX) ? dirName.slice(PROJECTED_AGENT_SKILL_PREFIX.length) : dirName.startsWith(LEGACY_PROJECTED_AGENT_SKILL_PREFIX) ? dirName.slice(LEGACY_PROJECTED_AGENT_SKILL_PREFIX.length) : "";
|
|
529
529
|
const name = (metadataName || derivedName).trim();
|
|
530
530
|
if (!name) return null;
|
|
531
531
|
return {
|
|
532
532
|
name,
|
|
533
533
|
description: typeof frontmatter.description === "string" ? frontmatter.description : "",
|
|
534
|
-
tools: toStringArray2(frontmatter["x-
|
|
535
|
-
disallowedTools: toStringArray2(frontmatter["x-
|
|
536
|
-
model: typeof frontmatter["x-
|
|
537
|
-
permissionMode: typeof frontmatter["x-
|
|
538
|
-
maxTurns: typeof frontmatter["x-
|
|
539
|
-
mcpServers: toStringArray2(frontmatter["x-
|
|
540
|
-
hooks: toHooks(frontmatter["x-
|
|
541
|
-
skills: toStringArray2(frontmatter["x-
|
|
542
|
-
memory: typeof frontmatter["x-
|
|
534
|
+
tools: toStringArray2(frontmatter["x-agentsmesh-tools"]),
|
|
535
|
+
disallowedTools: toStringArray2(frontmatter["x-agentsmesh-disallowed-tools"]),
|
|
536
|
+
model: typeof frontmatter["x-agentsmesh-model"] === "string" ? frontmatter["x-agentsmesh-model"] : "",
|
|
537
|
+
permissionMode: typeof frontmatter["x-agentsmesh-permission-mode"] === "string" ? frontmatter["x-agentsmesh-permission-mode"] : "",
|
|
538
|
+
maxTurns: typeof frontmatter["x-agentsmesh-max-turns"] === "number" ? frontmatter["x-agentsmesh-max-turns"] : Number(frontmatter["x-agentsmesh-max-turns"] ?? 0),
|
|
539
|
+
mcpServers: toStringArray2(frontmatter["x-agentsmesh-mcp-servers"]),
|
|
540
|
+
hooks: toHooks(frontmatter["x-agentsmesh-hooks"]),
|
|
541
|
+
skills: toStringArray2(frontmatter["x-agentsmesh-skills"]),
|
|
542
|
+
memory: typeof frontmatter["x-agentsmesh-memory"] === "string" ? frontmatter["x-agentsmesh-memory"] : ""
|
|
543
543
|
};
|
|
544
544
|
}
|
|
545
545
|
function serializeImportedAgent(agent, body) {
|
|
@@ -563,10 +563,10 @@ function serializeImportedAgent(agent, body) {
|
|
|
563
563
|
}
|
|
564
564
|
|
|
565
565
|
// src/core/import-reference-map-shared.ts
|
|
566
|
-
var AB_RULES = ".
|
|
567
|
-
var AB_COMMANDS = ".
|
|
568
|
-
var AB_AGENTS = ".
|
|
569
|
-
var AB_SKILLS = ".
|
|
566
|
+
var AB_RULES = ".agentsmesh/rules";
|
|
567
|
+
var AB_COMMANDS = ".agentsmesh/commands";
|
|
568
|
+
var AB_AGENTS = ".agentsmesh/agents";
|
|
569
|
+
var AB_SKILLS = ".agentsmesh/skills";
|
|
570
570
|
function rel(projectRoot, absPath) {
|
|
571
571
|
return relative(projectRoot, absPath).replace(/\\/g, "/");
|
|
572
572
|
}
|
|
@@ -647,9 +647,9 @@ async function addScopedAgentsMappings(refs, projectRoot) {
|
|
|
647
647
|
}
|
|
648
648
|
|
|
649
649
|
// src/core/import-reference-map-builders.ts
|
|
650
|
-
var AB_RULES2 = ".
|
|
651
|
-
var AB_COMMANDS2 = ".
|
|
652
|
-
var AB_AGENTS2 = ".
|
|
650
|
+
var AB_RULES2 = ".agentsmesh/rules";
|
|
651
|
+
var AB_COMMANDS2 = ".agentsmesh/commands";
|
|
652
|
+
var AB_AGENTS2 = ".agentsmesh/agents";
|
|
653
653
|
function addCopilotInstructionMapping(refs, fromPath) {
|
|
654
654
|
if (fromPath.endsWith(".instructions.md")) {
|
|
655
655
|
refs.set(fromPath, `${AB_RULES2}/${basename2(fromPath, ".instructions.md")}.md`);
|
|
@@ -886,7 +886,7 @@ function rootFallbackPath(token, projectRoot) {
|
|
|
886
886
|
import { existsSync, realpathSync } from "fs";
|
|
887
887
|
import { isAbsolute, win32 as win322 } from "path";
|
|
888
888
|
var ROOT_RELATIVE_PREFIXES = [
|
|
889
|
-
".
|
|
889
|
+
".agentsmesh/",
|
|
890
890
|
".claude/",
|
|
891
891
|
".cursor/",
|
|
892
892
|
".github/",
|
|
@@ -913,7 +913,7 @@ var EXTERNAL_REF_PATTERNS = [
|
|
|
913
913
|
/\/\/[A-Za-z0-9][\w.-]*\.[A-Za-z]{2,}[^\s<>()\]]*/g
|
|
914
914
|
];
|
|
915
915
|
var FENCED_CODE_BLOCK = /^(?:```|~~~)[^\n]*\n[\s\S]*?^(?:```|~~~)/gm;
|
|
916
|
-
var PATH_TOKEN = /(?:\.\.[\\/]|\.\/|\.\\|\/[A-Za-z0-9._-]|[A-Za-z]:[\\/][A-Za-z0-9._-]|\.
|
|
916
|
+
var PATH_TOKEN = /(?:\.\.[\\/]|\.\/|\.\\|\/[A-Za-z0-9._-]|[A-Za-z]:[\\/][A-Za-z0-9._-]|\.agentsmesh[\\/]|\.claude[\\/]|\.cursor[\\/]|\.github[\\/]|\.continue[\\/]|\.junie[\\/]|\.gemini[\\/]|\.clinerules[\\/]|\.cline[\\/]|\.agents[\\/]|\.windsurf[\\/]|(?:[A-Za-z0-9._-]+[\\/])+|[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+)[A-Za-z0-9._@%+~:\\/-]*/g;
|
|
917
917
|
var LINE_NUMBER_SUFFIX = /(?::(\d+)){1,2}$/;
|
|
918
918
|
function resolveProjectPath(token, projectRoot, sourceFile) {
|
|
919
919
|
const api = pathApi(projectRoot);
|
|
@@ -1191,9 +1191,9 @@ async function importFileDirectory(opts) {
|
|
|
1191
1191
|
// src/targets/claude-code/importer-mappers.ts
|
|
1192
1192
|
init_markdown();
|
|
1193
1193
|
import { basename as basename4, join as join5 } from "path";
|
|
1194
|
-
var AB_RULES3 = ".
|
|
1195
|
-
var AB_COMMANDS3 = ".
|
|
1196
|
-
var AB_AGENTS3 = ".
|
|
1194
|
+
var AB_RULES3 = ".agentsmesh/rules";
|
|
1195
|
+
var AB_COMMANDS3 = ".agentsmesh/commands";
|
|
1196
|
+
var AB_AGENTS3 = ".agentsmesh/agents";
|
|
1197
1197
|
async function mapClaudeRuleFile(srcPath, destDir, normalizeTo) {
|
|
1198
1198
|
const name = basename4(srcPath, ".md");
|
|
1199
1199
|
const destPath = join5(destDir, `${name}.md`);
|
|
@@ -1250,9 +1250,9 @@ function hasHookText(entry) {
|
|
|
1250
1250
|
import { stringify as yamlStringify2 } from "yaml";
|
|
1251
1251
|
var CLAUDE_SETTINGS = ".claude/settings.json";
|
|
1252
1252
|
var CLAUDE_MCP_JSON = ".mcp.json";
|
|
1253
|
-
var AB_MCP = ".
|
|
1254
|
-
var AB_PERMISSIONS = ".
|
|
1255
|
-
var AB_HOOKS = ".
|
|
1253
|
+
var AB_MCP = ".agentsmesh/mcp.json";
|
|
1254
|
+
var AB_PERMISSIONS = ".agentsmesh/permissions.yaml";
|
|
1255
|
+
var AB_HOOKS = ".agentsmesh/hooks.yaml";
|
|
1256
1256
|
function claudeHooksToCanonical(hooks) {
|
|
1257
1257
|
const result = {};
|
|
1258
1258
|
for (const [event, entries] of Object.entries(hooks)) {
|
|
@@ -1367,11 +1367,11 @@ var CLAUDE_COMMANDS_DIR = ".claude/commands";
|
|
|
1367
1367
|
var CLAUDE_AGENTS_DIR = ".claude/agents";
|
|
1368
1368
|
var CLAUDE_SKILLS_DIR = ".claude/skills";
|
|
1369
1369
|
var CLAUDEIGNORE = ".claudeignore";
|
|
1370
|
-
var AB_RULES4 = ".
|
|
1371
|
-
var AB_COMMANDS4 = ".
|
|
1372
|
-
var AB_AGENTS4 = ".
|
|
1373
|
-
var AB_SKILLS2 = ".
|
|
1374
|
-
var AB_IGNORE = ".
|
|
1370
|
+
var AB_RULES4 = ".agentsmesh/rules";
|
|
1371
|
+
var AB_COMMANDS4 = ".agentsmesh/commands";
|
|
1372
|
+
var AB_AGENTS4 = ".agentsmesh/agents";
|
|
1373
|
+
var AB_SKILLS2 = ".agentsmesh/skills";
|
|
1374
|
+
var AB_IGNORE = ".agentsmesh/ignore";
|
|
1375
1375
|
async function importFromClaudeCode(projectRoot) {
|
|
1376
1376
|
const results = [];
|
|
1377
1377
|
const normalize = await createImportReferenceNormalizer("claude-code", projectRoot);
|
|
@@ -1526,8 +1526,8 @@ function toStringRecord(value) {
|
|
|
1526
1526
|
}
|
|
1527
1527
|
|
|
1528
1528
|
// src/targets/cline/importer-mappers.ts
|
|
1529
|
-
var
|
|
1530
|
-
var
|
|
1529
|
+
var AGENTSMESH_RULES = ".agentsmesh/rules";
|
|
1530
|
+
var AGENTSMESH_COMMANDS = ".agentsmesh/commands";
|
|
1531
1531
|
async function mapClineRuleFile(srcPath, destDir, normalizeTo) {
|
|
1532
1532
|
if (srcPath.includes("/workflows/")) return null;
|
|
1533
1533
|
const name = basename6(srcPath, ".md");
|
|
@@ -1545,7 +1545,7 @@ async function mapClineRuleFile(srcPath, destDir, normalizeTo) {
|
|
|
1545
1545
|
});
|
|
1546
1546
|
return {
|
|
1547
1547
|
destPath,
|
|
1548
|
-
toPath: `${
|
|
1548
|
+
toPath: `${AGENTSMESH_RULES}/${name}.md`,
|
|
1549
1549
|
feature: "rules",
|
|
1550
1550
|
content: await serializeImportedRuleWithFallback(destPath, canonicalFm, body)
|
|
1551
1551
|
};
|
|
@@ -1574,7 +1574,7 @@ async function mapClineWorkflowFile(srcPath, destDir, normalizeTo) {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
return {
|
|
1576
1576
|
destPath,
|
|
1577
|
-
toPath: `${
|
|
1577
|
+
toPath: `${AGENTSMESH_COMMANDS}/${name}.md`,
|
|
1578
1578
|
feature: "commands",
|
|
1579
1579
|
content: await serializeImportedCommandWithFallback(
|
|
1580
1580
|
destPath,
|
|
@@ -1600,7 +1600,7 @@ var CLINE_HOOKS_DIR = ".clinerules/hooks";
|
|
|
1600
1600
|
|
|
1601
1601
|
// src/targets/cline/mcp-mapper.ts
|
|
1602
1602
|
import { join as join9 } from "path";
|
|
1603
|
-
var
|
|
1603
|
+
var AGENTSMESH_MCP = ".agentsmesh/mcp.json";
|
|
1604
1604
|
function mapClineServerToCanonical(raw) {
|
|
1605
1605
|
if (!raw || typeof raw !== "object") return null;
|
|
1606
1606
|
const obj = raw;
|
|
@@ -1640,15 +1640,15 @@ async function importClineMcp(projectRoot, results) {
|
|
|
1640
1640
|
if (server) mcpServers[n] = server;
|
|
1641
1641
|
}
|
|
1642
1642
|
if (Object.keys(mcpServers).length > 0) {
|
|
1643
|
-
await mkdirp(join9(projectRoot, ".
|
|
1643
|
+
await mkdirp(join9(projectRoot, ".agentsmesh"));
|
|
1644
1644
|
await writeFileAtomic(
|
|
1645
|
-
join9(projectRoot,
|
|
1645
|
+
join9(projectRoot, AGENTSMESH_MCP),
|
|
1646
1646
|
JSON.stringify({ mcpServers }, null, 2)
|
|
1647
1647
|
);
|
|
1648
1648
|
results.push({
|
|
1649
1649
|
fromTool: "cline",
|
|
1650
1650
|
fromPath: mcpPath,
|
|
1651
|
-
toPath:
|
|
1651
|
+
toPath: AGENTSMESH_MCP,
|
|
1652
1652
|
feature: "mcp"
|
|
1653
1653
|
});
|
|
1654
1654
|
}
|
|
@@ -1659,8 +1659,8 @@ async function importClineMcp(projectRoot, results) {
|
|
|
1659
1659
|
import { readdir as readdir2 } from "fs/promises";
|
|
1660
1660
|
import { join as join10 } from "path";
|
|
1661
1661
|
init_markdown();
|
|
1662
|
-
var
|
|
1663
|
-
var
|
|
1662
|
+
var AGENTSMESH_AGENTS = ".agentsmesh/agents";
|
|
1663
|
+
var AGENTSMESH_SKILLS = ".agentsmesh/skills";
|
|
1664
1664
|
async function importClineSkills(projectRoot, results, normalize) {
|
|
1665
1665
|
const skillsDir = join10(projectRoot, CLINE_SKILLS_DIR);
|
|
1666
1666
|
const skillDirs = [];
|
|
@@ -1683,7 +1683,7 @@ async function importClineSkills(projectRoot, results, normalize) {
|
|
|
1683
1683
|
const rawParsed = parseFrontmatter(content);
|
|
1684
1684
|
const projectedAgent = parseProjectedAgentSkillFrontmatter(rawParsed.frontmatter, name);
|
|
1685
1685
|
if (projectedAgent) {
|
|
1686
|
-
const destAgentsDir = join10(projectRoot,
|
|
1686
|
+
const destAgentsDir = join10(projectRoot, AGENTSMESH_AGENTS);
|
|
1687
1687
|
await mkdirp(destAgentsDir);
|
|
1688
1688
|
const agentPath = join10(destAgentsDir, `${projectedAgent.name}.md`);
|
|
1689
1689
|
await writeFileAtomic(
|
|
@@ -1693,15 +1693,15 @@ async function importClineSkills(projectRoot, results, normalize) {
|
|
|
1693
1693
|
results.push({
|
|
1694
1694
|
fromTool: "cline",
|
|
1695
1695
|
fromPath: skillMdPath,
|
|
1696
|
-
toPath: `${
|
|
1696
|
+
toPath: `${AGENTSMESH_AGENTS}/${projectedAgent.name}.md`,
|
|
1697
1697
|
feature: "agents"
|
|
1698
1698
|
});
|
|
1699
1699
|
continue;
|
|
1700
1700
|
}
|
|
1701
|
-
const destSkillPath = join10(projectRoot,
|
|
1701
|
+
const destSkillPath = join10(projectRoot, AGENTSMESH_SKILLS, name, "SKILL.md");
|
|
1702
1702
|
const normalized = normalize(content, skillMdPath, destSkillPath);
|
|
1703
1703
|
const { frontmatter, body } = parseFrontmatter(normalized);
|
|
1704
|
-
const destSkillDir = join10(projectRoot,
|
|
1704
|
+
const destSkillDir = join10(projectRoot, AGENTSMESH_SKILLS, name);
|
|
1705
1705
|
await mkdirp(destSkillDir);
|
|
1706
1706
|
const canonicalFm = {
|
|
1707
1707
|
description: typeof frontmatter.description === "string" ? frontmatter.description : void 0
|
|
@@ -1712,7 +1712,7 @@ async function importClineSkills(projectRoot, results, normalize) {
|
|
|
1712
1712
|
results.push({
|
|
1713
1713
|
fromTool: "cline",
|
|
1714
1714
|
fromPath: skillMdPath,
|
|
1715
|
-
toPath: `${
|
|
1715
|
+
toPath: `${AGENTSMESH_SKILLS}/${name}/SKILL.md`,
|
|
1716
1716
|
feature: "skills"
|
|
1717
1717
|
});
|
|
1718
1718
|
const allFiles = await readDirRecursive(skillPath);
|
|
@@ -1727,7 +1727,7 @@ async function importClineSkills(projectRoot, results, normalize) {
|
|
|
1727
1727
|
results.push({
|
|
1728
1728
|
fromTool: "cline",
|
|
1729
1729
|
fromPath: absPath,
|
|
1730
|
-
toPath: `${
|
|
1730
|
+
toPath: `${AGENTSMESH_SKILLS}/${name}/${relPath}`,
|
|
1731
1731
|
feature: "skills"
|
|
1732
1732
|
});
|
|
1733
1733
|
}
|
|
@@ -1735,13 +1735,13 @@ async function importClineSkills(projectRoot, results, normalize) {
|
|
|
1735
1735
|
}
|
|
1736
1736
|
|
|
1737
1737
|
// src/targets/cline/importer.ts
|
|
1738
|
-
var
|
|
1739
|
-
var
|
|
1740
|
-
var
|
|
1738
|
+
var AGENTSMESH_RULES2 = ".agentsmesh/rules";
|
|
1739
|
+
var AGENTSMESH_COMMANDS2 = ".agentsmesh/commands";
|
|
1740
|
+
var AGENTSMESH_IGNORE = ".agentsmesh/ignore";
|
|
1741
1741
|
async function importFromCline(projectRoot) {
|
|
1742
1742
|
const results = [];
|
|
1743
1743
|
const normalize = await createImportReferenceNormalizer("cline", projectRoot);
|
|
1744
|
-
const destRulesDir = join11(projectRoot,
|
|
1744
|
+
const destRulesDir = join11(projectRoot, AGENTSMESH_RULES2);
|
|
1745
1745
|
const clineRulesPath = join11(projectRoot, CLINE_RULES_DIR);
|
|
1746
1746
|
const clineRulesRaw = join11(projectRoot, CLINE_RULES_DIR);
|
|
1747
1747
|
let clineRulesIsFile = false;
|
|
@@ -1765,7 +1765,7 @@ async function importFromCline(projectRoot) {
|
|
|
1765
1765
|
results.push({
|
|
1766
1766
|
fromTool: "cline",
|
|
1767
1767
|
fromPath: clineRulesRaw,
|
|
1768
|
-
toPath: `${
|
|
1768
|
+
toPath: `${AGENTSMESH_RULES2}/_root.md`,
|
|
1769
1769
|
feature: "rules"
|
|
1770
1770
|
});
|
|
1771
1771
|
}
|
|
@@ -1790,7 +1790,7 @@ async function importFromCline(projectRoot) {
|
|
|
1790
1790
|
results.push({
|
|
1791
1791
|
fromTool: "cline",
|
|
1792
1792
|
fromPath: agentsMdPath,
|
|
1793
|
-
toPath: `${
|
|
1793
|
+
toPath: `${AGENTSMESH_RULES2}/_root.md`,
|
|
1794
1794
|
feature: "rules"
|
|
1795
1795
|
});
|
|
1796
1796
|
} else {
|
|
@@ -1811,7 +1811,7 @@ async function importFromCline(projectRoot) {
|
|
|
1811
1811
|
results.push({
|
|
1812
1812
|
fromTool: "cline",
|
|
1813
1813
|
fromPath: first,
|
|
1814
|
-
toPath: `${
|
|
1814
|
+
toPath: `${AGENTSMESH_RULES2}/_root.md`,
|
|
1815
1815
|
feature: "rules"
|
|
1816
1816
|
});
|
|
1817
1817
|
}
|
|
@@ -1829,7 +1829,7 @@ async function importFromCline(projectRoot) {
|
|
|
1829
1829
|
results.push({
|
|
1830
1830
|
fromTool: "cline",
|
|
1831
1831
|
fromPath: rootPath,
|
|
1832
|
-
toPath: `${
|
|
1832
|
+
toPath: `${AGENTSMESH_RULES2}/_root.md`,
|
|
1833
1833
|
feature: "rules"
|
|
1834
1834
|
});
|
|
1835
1835
|
}
|
|
@@ -1857,19 +1857,19 @@ async function importFromCline(projectRoot) {
|
|
|
1857
1857
|
if (t && !t.startsWith("#")) patterns.push(t);
|
|
1858
1858
|
}
|
|
1859
1859
|
if (patterns.length > 0) {
|
|
1860
|
-
await mkdirp(join11(projectRoot, ".
|
|
1861
|
-
const destIgnorePath = join11(projectRoot,
|
|
1860
|
+
await mkdirp(join11(projectRoot, ".agentsmesh"));
|
|
1861
|
+
const destIgnorePath = join11(projectRoot, AGENTSMESH_IGNORE);
|
|
1862
1862
|
await writeFileAtomic(destIgnorePath, patterns.join("\n"));
|
|
1863
1863
|
results.push({
|
|
1864
1864
|
fromTool: "cline",
|
|
1865
1865
|
fromPath: ignorePath,
|
|
1866
|
-
toPath:
|
|
1866
|
+
toPath: AGENTSMESH_IGNORE,
|
|
1867
1867
|
feature: "ignore"
|
|
1868
1868
|
});
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
await importClineMcp(projectRoot, results);
|
|
1872
|
-
const destCommandsDir = join11(projectRoot,
|
|
1872
|
+
const destCommandsDir = join11(projectRoot, AGENTSMESH_COMMANDS2);
|
|
1873
1873
|
if (!clineRulesIsFile) {
|
|
1874
1874
|
results.push(
|
|
1875
1875
|
...await importFileDirectory({
|
|
@@ -1893,9 +1893,9 @@ init_markdown();
|
|
|
1893
1893
|
// src/targets/cursor/importer-mappers.ts
|
|
1894
1894
|
init_markdown();
|
|
1895
1895
|
import { basename as basename7, join as join12 } from "path";
|
|
1896
|
-
var AB_RULES5 = ".
|
|
1897
|
-
var AB_COMMANDS5 = ".
|
|
1898
|
-
var AB_AGENTS5 = ".
|
|
1896
|
+
var AB_RULES5 = ".agentsmesh/rules";
|
|
1897
|
+
var AB_COMMANDS5 = ".agentsmesh/commands";
|
|
1898
|
+
var AB_AGENTS5 = ".agentsmesh/agents";
|
|
1899
1899
|
async function mapCursorRuleFile(srcPath, destDir, normalizeTo, onRootRule) {
|
|
1900
1900
|
const name = basename7(srcPath, ".mdc");
|
|
1901
1901
|
const destPath = join12(destDir, `${name}.md`);
|
|
@@ -1951,9 +1951,9 @@ var CURSOR_SETTINGS = ".cursor/settings.json";
|
|
|
1951
1951
|
var CURSOR_HOOKS = ".cursor/hooks.json";
|
|
1952
1952
|
var CURSORIGNORE = ".cursorignore";
|
|
1953
1953
|
var CURSORINDEXINGIGNORE = ".cursorindexingignore";
|
|
1954
|
-
var AB_PERMISSIONS2 = ".
|
|
1955
|
-
var AB_HOOKS2 = ".
|
|
1956
|
-
var AB_IGNORE2 = ".
|
|
1954
|
+
var AB_PERMISSIONS2 = ".agentsmesh/permissions.yaml";
|
|
1955
|
+
var AB_HOOKS2 = ".agentsmesh/hooks.yaml";
|
|
1956
|
+
var AB_IGNORE2 = ".agentsmesh/ignore";
|
|
1957
1957
|
function cursorHooksToCanonical(hooks) {
|
|
1958
1958
|
const result = {};
|
|
1959
1959
|
for (const [event, entries] of Object.entries(hooks)) {
|
|
@@ -2081,7 +2081,7 @@ async function importIgnore2(projectRoot, results) {
|
|
|
2081
2081
|
// src/targets/cursor/skills-helpers.ts
|
|
2082
2082
|
import { join as join14, basename as basename8, dirname as dirname8, relative as relative3 } from "path";
|
|
2083
2083
|
var CURSOR_SKILLS_DIR = ".cursor/skills";
|
|
2084
|
-
var AB_SKILLS3 = ".
|
|
2084
|
+
var AB_SKILLS3 = ".agentsmesh/skills";
|
|
2085
2085
|
async function importSkills2(projectRoot, results, normalize) {
|
|
2086
2086
|
const destBase = join14(projectRoot, AB_SKILLS3);
|
|
2087
2087
|
const skillsDir = join14(projectRoot, CURSOR_SKILLS_DIR);
|
|
@@ -2135,10 +2135,10 @@ var CURSOR_RULES_DIR = ".cursor/rules";
|
|
|
2135
2135
|
var CURSOR_COMMANDS_DIR = ".cursor/commands";
|
|
2136
2136
|
var CURSOR_AGENTS_DIR = ".cursor/agents";
|
|
2137
2137
|
var CURSOR_MCP = ".cursor/mcp.json";
|
|
2138
|
-
var AB_RULES6 = ".
|
|
2139
|
-
var AB_COMMANDS6 = ".
|
|
2140
|
-
var AB_AGENTS6 = ".
|
|
2141
|
-
var AB_MCP2 = ".
|
|
2138
|
+
var AB_RULES6 = ".agentsmesh/rules";
|
|
2139
|
+
var AB_COMMANDS6 = ".agentsmesh/commands";
|
|
2140
|
+
var AB_AGENTS6 = ".agentsmesh/agents";
|
|
2141
|
+
var AB_MCP2 = ".agentsmesh/mcp.json";
|
|
2142
2142
|
async function importFromCursor(projectRoot) {
|
|
2143
2143
|
const results = [];
|
|
2144
2144
|
const normalize = await createImportReferenceNormalizer("cursor", projectRoot);
|
|
@@ -2284,11 +2284,11 @@ init_markdown();
|
|
|
2284
2284
|
|
|
2285
2285
|
// src/targets/codex-cli/codex-rules-embed.ts
|
|
2286
2286
|
import { Buffer as Buffer2 } from "buffer";
|
|
2287
|
-
var MARKER = "
|
|
2288
|
-
var JSON_PREFIX = "#
|
|
2289
|
-
var B64_BEGIN = "#
|
|
2290
|
-
var B64_END = "#
|
|
2291
|
-
var B64_LINE = "#
|
|
2287
|
+
var MARKER = "am-codex-rule:v1";
|
|
2288
|
+
var JSON_PREFIX = "# am-json: ";
|
|
2289
|
+
var B64_BEGIN = "# am-body-b64-begin";
|
|
2290
|
+
var B64_END = "# am-body-b64-end";
|
|
2291
|
+
var B64_LINE = "# am64:";
|
|
2292
2292
|
function tryParseEmbeddedCanonicalFromCodexRules(content) {
|
|
2293
2293
|
if (!content.includes(MARKER)) return null;
|
|
2294
2294
|
const jsonLine = content.split("\n").find((l) => l.startsWith(JSON_PREFIX));
|
|
@@ -2329,7 +2329,7 @@ function tryParseEmbeddedCanonicalFromCodexRules(content) {
|
|
|
2329
2329
|
}
|
|
2330
2330
|
|
|
2331
2331
|
// src/targets/codex-cli/import-codex-non-root-rules.ts
|
|
2332
|
-
var AB_RULES7 = ".
|
|
2332
|
+
var AB_RULES7 = ".agentsmesh/rules";
|
|
2333
2333
|
async function importCodexNonRootRuleFiles(projectRoot, destDir, normalize) {
|
|
2334
2334
|
const results = [];
|
|
2335
2335
|
const codexRulesPath = join16(projectRoot, CODEX_RULES_DIR);
|
|
@@ -2400,7 +2400,7 @@ async function importCodexNonRootRuleFiles(projectRoot, destDir, normalize) {
|
|
|
2400
2400
|
// src/targets/codex-cli/mcp-helpers.ts
|
|
2401
2401
|
import { join as join17 } from "path";
|
|
2402
2402
|
import { parse as parseToml } from "smol-toml";
|
|
2403
|
-
var AB_MCP3 = ".
|
|
2403
|
+
var AB_MCP3 = ".agentsmesh/mcp.json";
|
|
2404
2404
|
function mapTomlServerToCanonical(raw) {
|
|
2405
2405
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
|
|
2406
2406
|
const obj = raw;
|
|
@@ -2440,7 +2440,7 @@ async function importMcp2(projectRoot, results) {
|
|
|
2440
2440
|
if (server) mcpServers[name] = server;
|
|
2441
2441
|
}
|
|
2442
2442
|
if (Object.keys(mcpServers).length === 0) return;
|
|
2443
|
-
await mkdirp(join17(projectRoot, ".
|
|
2443
|
+
await mkdirp(join17(projectRoot, ".agentsmesh"));
|
|
2444
2444
|
await writeFileAtomic(join17(projectRoot, AB_MCP3), JSON.stringify({ mcpServers }, null, 2));
|
|
2445
2445
|
results.push({
|
|
2446
2446
|
fromTool: "codex-cli",
|
|
@@ -2469,9 +2469,9 @@ async function removePathIfExists(path) {
|
|
|
2469
2469
|
}
|
|
2470
2470
|
|
|
2471
2471
|
// src/targets/codex-cli/skills-helpers.ts
|
|
2472
|
-
var AB_COMMANDS7 = ".
|
|
2473
|
-
var AB_AGENTS7 = ".
|
|
2474
|
-
var AB_SKILLS4 = ".
|
|
2472
|
+
var AB_COMMANDS7 = ".agentsmesh/commands";
|
|
2473
|
+
var AB_AGENTS7 = ".agentsmesh/agents";
|
|
2474
|
+
var AB_SKILLS4 = ".agentsmesh/skills";
|
|
2475
2475
|
async function importSkills3(projectRoot, results, normalize) {
|
|
2476
2476
|
for (const skillsRoot of [CODEX_SKILLS_DIR, CODEX_SKILLS_FALLBACK_DIR]) {
|
|
2477
2477
|
const skillsDir = join18(projectRoot, skillsRoot);
|
|
@@ -2569,7 +2569,7 @@ async function importSkills3(projectRoot, results, normalize) {
|
|
|
2569
2569
|
|
|
2570
2570
|
// src/targets/codex-cli/importer.ts
|
|
2571
2571
|
import { parse as parseToml2 } from "smol-toml";
|
|
2572
|
-
var AB_RULES8 = ".
|
|
2572
|
+
var AB_RULES8 = ".agentsmesh/rules";
|
|
2573
2573
|
async function importFromCodex(projectRoot) {
|
|
2574
2574
|
const results = [];
|
|
2575
2575
|
const normalize = await createImportReferenceNormalizer("codex-cli", projectRoot);
|
|
@@ -2582,7 +2582,7 @@ async function importFromCodex(projectRoot) {
|
|
|
2582
2582
|
}
|
|
2583
2583
|
async function importAgents3(projectRoot, results, normalize) {
|
|
2584
2584
|
const agentsPath = join19(projectRoot, CODEX_AGENTS_DIR);
|
|
2585
|
-
const agentsDestDir = join19(projectRoot, ".
|
|
2585
|
+
const agentsDestDir = join19(projectRoot, ".agentsmesh/agents");
|
|
2586
2586
|
try {
|
|
2587
2587
|
const agentFiles = await readDirRecursive(agentsPath);
|
|
2588
2588
|
const tomlFiles = agentFiles.filter((f) => f.endsWith(".toml"));
|
|
@@ -2619,7 +2619,7 @@ async function importAgents3(projectRoot, results, normalize) {
|
|
|
2619
2619
|
results.push({
|
|
2620
2620
|
fromTool: "codex-cli",
|
|
2621
2621
|
fromPath: srcPath,
|
|
2622
|
-
toPath: `.
|
|
2622
|
+
toPath: `.agentsmesh/agents/${name}.md`,
|
|
2623
2623
|
feature: "agents"
|
|
2624
2624
|
});
|
|
2625
2625
|
}
|
|
@@ -2710,9 +2710,9 @@ var WINDSURF_SKILLS_DIR = ".windsurf/skills";
|
|
|
2710
2710
|
import { join as join20, basename as basename11 } from "path";
|
|
2711
2711
|
import { readdir as readdir4 } from "fs/promises";
|
|
2712
2712
|
init_markdown();
|
|
2713
|
-
var
|
|
2714
|
-
var
|
|
2715
|
-
var
|
|
2713
|
+
var AGENTSMESH_COMMANDS3 = ".agentsmesh/commands";
|
|
2714
|
+
var AGENTSMESH_AGENTS2 = ".agentsmesh/agents";
|
|
2715
|
+
var AGENTSMESH_SKILLS2 = ".agentsmesh/skills";
|
|
2716
2716
|
function toStringArray5(value) {
|
|
2717
2717
|
if (Array.isArray(value)) {
|
|
2718
2718
|
return value.filter((entry) => typeof entry === "string").map((entry) => entry.trim()).filter(Boolean);
|
|
@@ -2726,7 +2726,7 @@ async function importWorkflows(projectRoot, results, normalize) {
|
|
|
2726
2726
|
const workflowsDir = join20(projectRoot, WINDSURF_WORKFLOWS_DIR);
|
|
2727
2727
|
const workflowFiles = await readDirRecursive(workflowsDir);
|
|
2728
2728
|
const workflowMdFiles = workflowFiles.filter((f) => f.endsWith(".md"));
|
|
2729
|
-
const destCommandsDir = join20(projectRoot,
|
|
2729
|
+
const destCommandsDir = join20(projectRoot, AGENTSMESH_COMMANDS3);
|
|
2730
2730
|
for (const srcPath of workflowMdFiles) {
|
|
2731
2731
|
const content = await readFileSafe(srcPath);
|
|
2732
2732
|
if (!content) continue;
|
|
@@ -2752,7 +2752,7 @@ async function importWorkflows(projectRoot, results, normalize) {
|
|
|
2752
2752
|
results.push({
|
|
2753
2753
|
fromTool: "windsurf",
|
|
2754
2754
|
fromPath: srcPath,
|
|
2755
|
-
toPath: `${
|
|
2755
|
+
toPath: `${AGENTSMESH_COMMANDS3}/${name}.md`,
|
|
2756
2756
|
feature: "commands"
|
|
2757
2757
|
});
|
|
2758
2758
|
}
|
|
@@ -2770,8 +2770,8 @@ async function importSkills4(projectRoot, results, normalize) {
|
|
|
2770
2770
|
const rawParsed = parseFrontmatter(skillContent);
|
|
2771
2771
|
const projectedAgent = parseProjectedAgentSkillFrontmatter(rawParsed.frontmatter, ent.name);
|
|
2772
2772
|
if (projectedAgent) {
|
|
2773
|
-
await removePathIfExists(join20(projectRoot,
|
|
2774
|
-
const destAgentsDir = join20(projectRoot,
|
|
2773
|
+
await removePathIfExists(join20(projectRoot, AGENTSMESH_SKILLS2, ent.name));
|
|
2774
|
+
const destAgentsDir = join20(projectRoot, AGENTSMESH_AGENTS2);
|
|
2775
2775
|
await mkdirp(destAgentsDir);
|
|
2776
2776
|
const agentPath = join20(destAgentsDir, `${projectedAgent.name}.md`);
|
|
2777
2777
|
await writeFileAtomic(
|
|
@@ -2781,12 +2781,12 @@ async function importSkills4(projectRoot, results, normalize) {
|
|
|
2781
2781
|
results.push({
|
|
2782
2782
|
fromTool: "windsurf",
|
|
2783
2783
|
fromPath: skillMdPath,
|
|
2784
|
-
toPath: `${
|
|
2784
|
+
toPath: `${AGENTSMESH_AGENTS2}/${projectedAgent.name}.md`,
|
|
2785
2785
|
feature: "agents"
|
|
2786
2786
|
});
|
|
2787
2787
|
continue;
|
|
2788
2788
|
}
|
|
2789
|
-
const destSkillDir = join20(projectRoot,
|
|
2789
|
+
const destSkillDir = join20(projectRoot, AGENTSMESH_SKILLS2, ent.name);
|
|
2790
2790
|
const destSkillPath = join20(destSkillDir, "SKILL.md");
|
|
2791
2791
|
const normalized = normalize(skillContent, skillMdPath, destSkillPath);
|
|
2792
2792
|
await mkdirp(destSkillDir);
|
|
@@ -2794,7 +2794,7 @@ async function importSkills4(projectRoot, results, normalize) {
|
|
|
2794
2794
|
results.push({
|
|
2795
2795
|
fromTool: "windsurf",
|
|
2796
2796
|
fromPath: skillMdPath,
|
|
2797
|
-
toPath: `${
|
|
2797
|
+
toPath: `${AGENTSMESH_SKILLS2}/${ent.name}/SKILL.md`,
|
|
2798
2798
|
feature: "skills"
|
|
2799
2799
|
});
|
|
2800
2800
|
const allSkillFiles = await readDirRecursive(skillPath);
|
|
@@ -2809,7 +2809,7 @@ async function importSkills4(projectRoot, results, normalize) {
|
|
|
2809
2809
|
results.push({
|
|
2810
2810
|
fromTool: "windsurf",
|
|
2811
2811
|
fromPath: absPath,
|
|
2812
|
-
toPath: `${
|
|
2812
|
+
toPath: `${AGENTSMESH_SKILLS2}/${ent.name}/${relPath}`,
|
|
2813
2813
|
feature: "skills"
|
|
2814
2814
|
});
|
|
2815
2815
|
}
|
|
@@ -2819,15 +2819,15 @@ async function importSkills4(projectRoot, results, normalize) {
|
|
|
2819
2819
|
}
|
|
2820
2820
|
|
|
2821
2821
|
// src/targets/windsurf/importer.ts
|
|
2822
|
-
var
|
|
2823
|
-
var
|
|
2824
|
-
var
|
|
2825
|
-
var
|
|
2822
|
+
var AGENTSMESH_RULES3 = ".agentsmesh/rules";
|
|
2823
|
+
var AGENTSMESH_IGNORE2 = ".agentsmesh/ignore";
|
|
2824
|
+
var AGENTSMESH_HOOKS = ".agentsmesh/hooks.yaml";
|
|
2825
|
+
var AGENTSMESH_MCP2 = ".agentsmesh/mcp.json";
|
|
2826
2826
|
async function importFromWindsurf(projectRoot) {
|
|
2827
2827
|
const results = [];
|
|
2828
2828
|
const normalize = await createImportReferenceNormalizer("windsurf", projectRoot);
|
|
2829
2829
|
const normalizeCodex = await createImportReferenceNormalizer("codex-cli", projectRoot);
|
|
2830
|
-
const destRulesDir = join21(projectRoot,
|
|
2830
|
+
const destRulesDir = join21(projectRoot, AGENTSMESH_RULES3);
|
|
2831
2831
|
const rootPath = join21(projectRoot, WINDSURF_RULES_ROOT);
|
|
2832
2832
|
const rootContent = await readFileSafe(rootPath);
|
|
2833
2833
|
if (rootContent !== null) {
|
|
@@ -2839,7 +2839,7 @@ async function importFromWindsurf(projectRoot) {
|
|
|
2839
2839
|
results.push({
|
|
2840
2840
|
fromTool: "windsurf",
|
|
2841
2841
|
fromPath: rootPath,
|
|
2842
|
-
toPath: `${
|
|
2842
|
+
toPath: `${AGENTSMESH_RULES3}/_root.md`,
|
|
2843
2843
|
feature: "rules"
|
|
2844
2844
|
});
|
|
2845
2845
|
}
|
|
@@ -2859,7 +2859,7 @@ async function importFromWindsurf(projectRoot) {
|
|
|
2859
2859
|
results.push({
|
|
2860
2860
|
fromTool: "windsurf",
|
|
2861
2861
|
fromPath: agentsMdPath,
|
|
2862
|
-
toPath: `${
|
|
2862
|
+
toPath: `${AGENTSMESH_RULES3}/_root.md`,
|
|
2863
2863
|
feature: "rules"
|
|
2864
2864
|
});
|
|
2865
2865
|
}
|
|
@@ -2882,7 +2882,7 @@ async function importFromWindsurf(projectRoot) {
|
|
|
2882
2882
|
const destPath = join21(destRulesDir, `${ruleName}.md`);
|
|
2883
2883
|
return {
|
|
2884
2884
|
destPath,
|
|
2885
|
-
toPath: `${
|
|
2885
|
+
toPath: `${AGENTSMESH_RULES3}/${ruleName}.md`,
|
|
2886
2886
|
feature: "rules",
|
|
2887
2887
|
content: await serializeImportedRuleWithFallback(
|
|
2888
2888
|
destPath,
|
|
@@ -2913,7 +2913,7 @@ async function importFromWindsurf(projectRoot) {
|
|
|
2913
2913
|
}
|
|
2914
2914
|
return {
|
|
2915
2915
|
destPath,
|
|
2916
|
-
toPath: `${
|
|
2916
|
+
toPath: `${AGENTSMESH_RULES3}/${name}.md`,
|
|
2917
2917
|
feature: "rules",
|
|
2918
2918
|
content: await serializeImportedRuleWithFallback(
|
|
2919
2919
|
destPath,
|
|
@@ -2938,13 +2938,13 @@ async function importFromWindsurf(projectRoot) {
|
|
|
2938
2938
|
if (t && !t.startsWith("#")) patterns.push(t);
|
|
2939
2939
|
}
|
|
2940
2940
|
if (patterns.length > 0) {
|
|
2941
|
-
await mkdirp(join21(projectRoot, ".
|
|
2942
|
-
const destIgnorePath = join21(projectRoot,
|
|
2941
|
+
await mkdirp(join21(projectRoot, ".agentsmesh"));
|
|
2942
|
+
const destIgnorePath = join21(projectRoot, AGENTSMESH_IGNORE2);
|
|
2943
2943
|
await writeFileAtomic(destIgnorePath, patterns.join("\n"));
|
|
2944
2944
|
results.push({
|
|
2945
2945
|
fromTool: "windsurf",
|
|
2946
2946
|
fromPath: ignorePath,
|
|
2947
|
-
toPath:
|
|
2947
|
+
toPath: AGENTSMESH_IGNORE2,
|
|
2948
2948
|
feature: "ignore"
|
|
2949
2949
|
});
|
|
2950
2950
|
}
|
|
@@ -2964,13 +2964,13 @@ async function importHooks(projectRoot, results) {
|
|
|
2964
2964
|
if (!parsed.hooks || typeof parsed.hooks !== "object" || Array.isArray(parsed.hooks)) return;
|
|
2965
2965
|
const canonical = windsurfHooksToCanonical(parsed.hooks);
|
|
2966
2966
|
if (Object.keys(canonical).length === 0) return;
|
|
2967
|
-
const destPath = join21(projectRoot,
|
|
2967
|
+
const destPath = join21(projectRoot, AGENTSMESH_HOOKS);
|
|
2968
2968
|
await mkdirp(dirname12(destPath));
|
|
2969
2969
|
await writeFileAtomic(destPath, yamlStringify4(canonical));
|
|
2970
2970
|
results.push({
|
|
2971
2971
|
fromTool: "windsurf",
|
|
2972
2972
|
fromPath: hooksPath,
|
|
2973
|
-
toPath:
|
|
2973
|
+
toPath: AGENTSMESH_HOOKS,
|
|
2974
2974
|
feature: "hooks"
|
|
2975
2975
|
});
|
|
2976
2976
|
} catch {
|
|
@@ -3033,13 +3033,13 @@ async function importMcp3(projectRoot, results) {
|
|
|
3033
3033
|
try {
|
|
3034
3034
|
const parsed = JSON.parse(content);
|
|
3035
3035
|
if (!parsed.mcpServers || typeof parsed.mcpServers !== "object") continue;
|
|
3036
|
-
const destPath = join21(projectRoot,
|
|
3036
|
+
const destPath = join21(projectRoot, AGENTSMESH_MCP2);
|
|
3037
3037
|
await mkdirp(dirname12(destPath));
|
|
3038
3038
|
await writeFileAtomic(destPath, JSON.stringify({ mcpServers: parsed.mcpServers }, null, 2));
|
|
3039
3039
|
results.push({
|
|
3040
3040
|
fromTool: "windsurf",
|
|
3041
3041
|
fromPath: srcPath,
|
|
3042
|
-
toPath:
|
|
3042
|
+
toPath: AGENTSMESH_MCP2,
|
|
3043
3043
|
feature: "mcp"
|
|
3044
3044
|
});
|
|
3045
3045
|
return;
|
|
@@ -3080,20 +3080,20 @@ function serializeCommandPrompt(command) {
|
|
|
3080
3080
|
const frontmatter = {
|
|
3081
3081
|
agent: "agent",
|
|
3082
3082
|
description: command.description || void 0,
|
|
3083
|
-
"x-
|
|
3084
|
-
"x-
|
|
3085
|
-
"x-
|
|
3083
|
+
"x-agentsmesh-kind": "command",
|
|
3084
|
+
"x-agentsmesh-name": command.name,
|
|
3085
|
+
"x-agentsmesh-allowed-tools": command.allowedTools.length > 0 ? command.allowedTools : void 0
|
|
3086
3086
|
};
|
|
3087
3087
|
if (frontmatter.description === void 0) delete frontmatter.description;
|
|
3088
|
-
if (frontmatter["x-
|
|
3089
|
-
delete frontmatter["x-
|
|
3088
|
+
if (frontmatter["x-agentsmesh-allowed-tools"] === void 0) {
|
|
3089
|
+
delete frontmatter["x-agentsmesh-allowed-tools"];
|
|
3090
3090
|
}
|
|
3091
3091
|
return serializeFrontmatter(frontmatter, command.body.trim() || "");
|
|
3092
3092
|
}
|
|
3093
3093
|
function parseCommandPromptFrontmatter(frontmatter, promptPath) {
|
|
3094
|
-
const nameFromMetadata = typeof frontmatter["x-
|
|
3094
|
+
const nameFromMetadata = typeof frontmatter["x-agentsmesh-name"] === "string" ? frontmatter["x-agentsmesh-name"] : "";
|
|
3095
3095
|
const name = (nameFromMetadata || basename13(promptPath, ".prompt.md")).trim();
|
|
3096
|
-
const allowedToolsFromMetadata = toStringArray6(frontmatter["x-
|
|
3096
|
+
const allowedToolsFromMetadata = toStringArray6(frontmatter["x-agentsmesh-allowed-tools"]);
|
|
3097
3097
|
const allowedTools = allowedToolsFromMetadata.length > 0 ? allowedToolsFromMetadata : toStringArray6(frontmatter.tools);
|
|
3098
3098
|
return {
|
|
3099
3099
|
name,
|
|
@@ -3114,7 +3114,7 @@ function serializeImportedCommand2(command, body) {
|
|
|
3114
3114
|
// src/targets/copilot/hook-parser.ts
|
|
3115
3115
|
import { join as join22, dirname as dirname13, basename as basename14 } from "path";
|
|
3116
3116
|
import { stringify as yamlStringify5 } from "yaml";
|
|
3117
|
-
var AB_HOOKS3 = ".
|
|
3117
|
+
var AB_HOOKS3 = ".agentsmesh/hooks.yaml";
|
|
3118
3118
|
function mapCopilotHookEvent(event) {
|
|
3119
3119
|
switch (event) {
|
|
3120
3120
|
case "preToolUse":
|
|
@@ -3135,7 +3135,7 @@ function extractMatcher(comment) {
|
|
|
3135
3135
|
return match?.[1]?.trim() || "*";
|
|
3136
3136
|
}
|
|
3137
3137
|
function extractWrapperCommand(content) {
|
|
3138
|
-
const metadataMatch = content.match(/^#
|
|
3138
|
+
const metadataMatch = content.match(/^# agentsmesh-command:\s*(.+)$/m);
|
|
3139
3139
|
if (metadataMatch?.[1]) return metadataMatch[1].trim();
|
|
3140
3140
|
return content.replace(/^#!.*\n/, "").replace(/^#.*\n/gm, "").replace(/^HOOK_DIR=.*\n/gm, "").replace(/^set -e\n?/m, "").trim();
|
|
3141
3141
|
}
|
|
@@ -3205,7 +3205,7 @@ async function importHooks2(projectRoot, results) {
|
|
|
3205
3205
|
// src/targets/copilot/agents-skills-helpers.ts
|
|
3206
3206
|
import { join as join23, basename as basename15, dirname as dirname14 } from "path";
|
|
3207
3207
|
init_markdown();
|
|
3208
|
-
var AB_AGENTS8 = ".
|
|
3208
|
+
var AB_AGENTS8 = ".agentsmesh/agents";
|
|
3209
3209
|
async function importAgents4(projectRoot, results, normalize) {
|
|
3210
3210
|
const agentsDir = join23(projectRoot, COPILOT_AGENTS_DIR);
|
|
3211
3211
|
let files;
|
|
@@ -3251,7 +3251,7 @@ async function importSkills5(projectRoot, results, normalize) {
|
|
|
3251
3251
|
const content = await readFileSafe(skillMdPath);
|
|
3252
3252
|
if (!content) continue;
|
|
3253
3253
|
const skillName = basename15(dirname14(skillMdPath));
|
|
3254
|
-
const destSkillDir = join23(projectRoot, ".
|
|
3254
|
+
const destSkillDir = join23(projectRoot, ".agentsmesh", "skills", skillName);
|
|
3255
3255
|
const allSkillFiles = await readDirRecursive(dirname14(skillMdPath));
|
|
3256
3256
|
for (const absPath of allSkillFiles) {
|
|
3257
3257
|
const fileContent = await readFileSafe(absPath);
|
|
@@ -3263,7 +3263,7 @@ async function importSkills5(projectRoot, results, normalize) {
|
|
|
3263
3263
|
results.push({
|
|
3264
3264
|
fromTool: "copilot",
|
|
3265
3265
|
fromPath: absPath,
|
|
3266
|
-
toPath: `.
|
|
3266
|
+
toPath: `.agentsmesh/skills/${skillName}/${relPath}`,
|
|
3267
3267
|
feature: "skills"
|
|
3268
3268
|
});
|
|
3269
3269
|
}
|
|
@@ -3271,12 +3271,12 @@ async function importSkills5(projectRoot, results, normalize) {
|
|
|
3271
3271
|
}
|
|
3272
3272
|
|
|
3273
3273
|
// src/targets/copilot/importer.ts
|
|
3274
|
-
var
|
|
3275
|
-
var AB_COMMANDS8 = ".
|
|
3274
|
+
var AGENTSMESH_RULES4 = ".agentsmesh/rules";
|
|
3275
|
+
var AB_COMMANDS8 = ".agentsmesh/commands";
|
|
3276
3276
|
async function importFromCopilot(projectRoot) {
|
|
3277
3277
|
const results = [];
|
|
3278
3278
|
const normalize = await createImportReferenceNormalizer("copilot", projectRoot);
|
|
3279
|
-
const destDir = join24(projectRoot,
|
|
3279
|
+
const destDir = join24(projectRoot, AGENTSMESH_RULES4);
|
|
3280
3280
|
const instructionsPath = join24(projectRoot, COPILOT_INSTRUCTIONS);
|
|
3281
3281
|
const instructionsContent = await readFileSafe(instructionsPath);
|
|
3282
3282
|
if (instructionsContent !== null) {
|
|
@@ -3292,7 +3292,7 @@ async function importFromCopilot(projectRoot) {
|
|
|
3292
3292
|
results.push({
|
|
3293
3293
|
fromTool: "copilot",
|
|
3294
3294
|
fromPath: instructionsPath,
|
|
3295
|
-
toPath: `${
|
|
3295
|
+
toPath: `${AGENTSMESH_RULES4}/_root.md`,
|
|
3296
3296
|
feature: "rules"
|
|
3297
3297
|
});
|
|
3298
3298
|
}
|
|
@@ -3319,7 +3319,7 @@ async function importFromCopilot(projectRoot) {
|
|
|
3319
3319
|
});
|
|
3320
3320
|
return {
|
|
3321
3321
|
destPath,
|
|
3322
|
-
toPath: `${
|
|
3322
|
+
toPath: `${AGENTSMESH_RULES4}/${destFileName}`,
|
|
3323
3323
|
feature: "rules",
|
|
3324
3324
|
content: await serializeImportedRuleWithFallback(destPath, canonicalFm, body)
|
|
3325
3325
|
};
|
|
@@ -3351,7 +3351,7 @@ async function importFromCopilot(projectRoot) {
|
|
|
3351
3351
|
});
|
|
3352
3352
|
return {
|
|
3353
3353
|
destPath,
|
|
3354
|
-
toPath: `${
|
|
3354
|
+
toPath: `${AGENTSMESH_RULES4}/${base}.md`,
|
|
3355
3355
|
feature: "rules",
|
|
3356
3356
|
content: await serializeImportedRuleWithFallback(destPath, canonicalFm, body)
|
|
3357
3357
|
};
|
|
@@ -3399,7 +3399,7 @@ init_markdown();
|
|
|
3399
3399
|
import { readdir as readdir5 } from "fs/promises";
|
|
3400
3400
|
import { dirname as dirname15, join as join25, relative as relative7 } from "path";
|
|
3401
3401
|
init_markdown();
|
|
3402
|
-
var AB_SKILLS5 = ".
|
|
3402
|
+
var AB_SKILLS5 = ".agentsmesh/skills";
|
|
3403
3403
|
function generateEmbeddedSkills(canonical, skillsDir) {
|
|
3404
3404
|
const outputs = [];
|
|
3405
3405
|
for (const skill of canonical.skills) {
|
|
@@ -3480,7 +3480,7 @@ import { basename as basename17 } from "path";
|
|
|
3480
3480
|
var CONTINUE_RULES_DIR = ".continue/rules";
|
|
3481
3481
|
var CONTINUE_PROMPTS_DIR = ".continue/prompts";
|
|
3482
3482
|
var CONTINUE_MCP_DIR = ".continue/mcpServers";
|
|
3483
|
-
var CONTINUE_MCP_FILE = `${CONTINUE_MCP_DIR}/
|
|
3483
|
+
var CONTINUE_MCP_FILE = `${CONTINUE_MCP_DIR}/agentsmesh.json`;
|
|
3484
3484
|
var CONTINUE_ROOT_RULE = `${CONTINUE_RULES_DIR}/_root.md`;
|
|
3485
3485
|
var CONTINUE_SKILLS_DIR = ".continue/skills";
|
|
3486
3486
|
|
|
@@ -3500,24 +3500,24 @@ function continueCommandRulePath(name) {
|
|
|
3500
3500
|
function serializeCommandRule(command) {
|
|
3501
3501
|
const frontmatter = {
|
|
3502
3502
|
description: command.description || void 0,
|
|
3503
|
-
"x-
|
|
3504
|
-
"x-
|
|
3505
|
-
"x-
|
|
3503
|
+
"x-agentsmesh-kind": "command",
|
|
3504
|
+
"x-agentsmesh-name": command.name,
|
|
3505
|
+
"x-agentsmesh-allowed-tools": command.allowedTools.length > 0 ? command.allowedTools : void 0
|
|
3506
3506
|
};
|
|
3507
3507
|
if (frontmatter.description === void 0) delete frontmatter.description;
|
|
3508
|
-
if (frontmatter["x-
|
|
3509
|
-
delete frontmatter["x-
|
|
3508
|
+
if (frontmatter["x-agentsmesh-allowed-tools"] === void 0) {
|
|
3509
|
+
delete frontmatter["x-agentsmesh-allowed-tools"];
|
|
3510
3510
|
}
|
|
3511
3511
|
return serializeFrontmatter(frontmatter, command.body.trim() || "");
|
|
3512
3512
|
}
|
|
3513
3513
|
function parseCommandRuleFrontmatter(frontmatter, filePath) {
|
|
3514
3514
|
const fileName = basename17(filePath, ".md");
|
|
3515
|
-
const fromMetadata = typeof frontmatter["x-
|
|
3515
|
+
const fromMetadata = typeof frontmatter["x-agentsmesh-name"] === "string" ? frontmatter["x-agentsmesh-name"] : "";
|
|
3516
3516
|
const name = (fromMetadata || fileName).trim();
|
|
3517
3517
|
return {
|
|
3518
3518
|
name,
|
|
3519
3519
|
description: typeof frontmatter.description === "string" ? frontmatter.description : "",
|
|
3520
|
-
allowedTools: toStringArray7(frontmatter["x-
|
|
3520
|
+
allowedTools: toStringArray7(frontmatter["x-agentsmesh-allowed-tools"])
|
|
3521
3521
|
};
|
|
3522
3522
|
}
|
|
3523
3523
|
function serializeImportedCommand3(command, body) {
|
|
@@ -3531,9 +3531,9 @@ function serializeImportedCommand3(command, body) {
|
|
|
3531
3531
|
}
|
|
3532
3532
|
|
|
3533
3533
|
// src/targets/continue/importer.ts
|
|
3534
|
-
var AB_RULES9 = ".
|
|
3535
|
-
var AB_COMMANDS9 = ".
|
|
3536
|
-
var AB_MCP4 = ".
|
|
3534
|
+
var AB_RULES9 = ".agentsmesh/rules";
|
|
3535
|
+
var AB_COMMANDS9 = ".agentsmesh/commands";
|
|
3536
|
+
var AB_MCP4 = ".agentsmesh/mcp.json";
|
|
3537
3537
|
function readMcpServers(content, extension) {
|
|
3538
3538
|
const parsed = extension === ".json" ? JSON.parse(content) : parseYaml(content) ?? {};
|
|
3539
3539
|
const rawServers = parsed.mcpServers;
|
|
@@ -3647,12 +3647,12 @@ async function importMcp4(projectRoot, results) {
|
|
|
3647
3647
|
// src/targets/junie/importer.ts
|
|
3648
3648
|
import { basename as basename19, join as join27 } from "path";
|
|
3649
3649
|
init_markdown();
|
|
3650
|
-
var AB_RULE = ".
|
|
3651
|
-
var AB_RULES_DIR = ".
|
|
3652
|
-
var AB_COMMANDS_DIR = ".
|
|
3653
|
-
var AB_AGENTS_DIR = ".
|
|
3654
|
-
var AB_MCP5 = ".
|
|
3655
|
-
var AB_IGNORE3 = ".
|
|
3650
|
+
var AB_RULE = ".agentsmesh/rules/_root.md";
|
|
3651
|
+
var AB_RULES_DIR = ".agentsmesh/rules";
|
|
3652
|
+
var AB_COMMANDS_DIR = ".agentsmesh/commands";
|
|
3653
|
+
var AB_AGENTS_DIR = ".agentsmesh/agents";
|
|
3654
|
+
var AB_MCP5 = ".agentsmesh/mcp.json";
|
|
3655
|
+
var AB_IGNORE3 = ".agentsmesh/ignore";
|
|
3656
3656
|
function readMcpServers2(content) {
|
|
3657
3657
|
const parsed = JSON.parse(content);
|
|
3658
3658
|
const rawServers = parsed.mcpServers;
|
|
@@ -3860,9 +3860,9 @@ var GEMINI_SYSTEM = ".gemini/system.md";
|
|
|
3860
3860
|
var GEMINI_DEFAULT_POLICIES_FILE = `${GEMINI_POLICIES_DIR}/permissions.toml`;
|
|
3861
3861
|
|
|
3862
3862
|
// src/targets/gemini-cli/format-helpers.ts
|
|
3863
|
-
var
|
|
3864
|
-
var
|
|
3865
|
-
var
|
|
3863
|
+
var AGENTSMESH_MCP3 = ".agentsmesh/mcp.json";
|
|
3864
|
+
var AGENTSMESH_HOOKS2 = ".agentsmesh/hooks.yaml";
|
|
3865
|
+
var AGENTSMESH_IGNORE3 = ".agentsmesh/ignore";
|
|
3866
3866
|
function mapGeminiHookEvent(event) {
|
|
3867
3867
|
switch (event) {
|
|
3868
3868
|
case "BeforeTool":
|
|
@@ -3912,25 +3912,25 @@ async function importGeminiSettings(projectRoot, results) {
|
|
|
3912
3912
|
if (!settings) return;
|
|
3913
3913
|
const mcpServers = settings.mcpServers;
|
|
3914
3914
|
if (mcpServers !== void 0 && typeof mcpServers === "object" && mcpServers !== null && Object.keys(mcpServers).length > 0) {
|
|
3915
|
-
const mcpPath = join28(projectRoot,
|
|
3916
|
-
await mkdirp(join28(projectRoot, ".
|
|
3915
|
+
const mcpPath = join28(projectRoot, AGENTSMESH_MCP3);
|
|
3916
|
+
await mkdirp(join28(projectRoot, ".agentsmesh"));
|
|
3917
3917
|
await writeFileAtomic(mcpPath, JSON.stringify({ mcpServers }, null, 2));
|
|
3918
3918
|
results.push({
|
|
3919
3919
|
fromTool: "gemini-cli",
|
|
3920
3920
|
fromPath: settingsPath,
|
|
3921
|
-
toPath:
|
|
3921
|
+
toPath: AGENTSMESH_MCP3,
|
|
3922
3922
|
feature: "mcp"
|
|
3923
3923
|
});
|
|
3924
3924
|
}
|
|
3925
3925
|
const ignorePatterns = settings.ignorePatterns;
|
|
3926
3926
|
if (Array.isArray(ignorePatterns) && ignorePatterns.length > 0 && ignorePatterns.every((p) => typeof p === "string")) {
|
|
3927
|
-
const ignorePath = join28(projectRoot,
|
|
3928
|
-
await mkdirp(join28(projectRoot, ".
|
|
3927
|
+
const ignorePath = join28(projectRoot, AGENTSMESH_IGNORE3);
|
|
3928
|
+
await mkdirp(join28(projectRoot, ".agentsmesh"));
|
|
3929
3929
|
await writeFileAtomic(ignorePath, ignorePatterns.join("\n") + "\n");
|
|
3930
3930
|
results.push({
|
|
3931
3931
|
fromTool: "gemini-cli",
|
|
3932
3932
|
fromPath: settingsPath,
|
|
3933
|
-
toPath:
|
|
3933
|
+
toPath: AGENTSMESH_IGNORE3,
|
|
3934
3934
|
feature: "ignore"
|
|
3935
3935
|
});
|
|
3936
3936
|
}
|
|
@@ -3967,13 +3967,13 @@ async function importGeminiSettings(projectRoot, results) {
|
|
|
3967
3967
|
);
|
|
3968
3968
|
if (mappedHooks.length > 0) {
|
|
3969
3969
|
const hooksYaml = Object.fromEntries(mappedHooks);
|
|
3970
|
-
const hooksPath = join28(projectRoot,
|
|
3971
|
-
await mkdirp(join28(projectRoot, ".
|
|
3970
|
+
const hooksPath = join28(projectRoot, AGENTSMESH_HOOKS2);
|
|
3971
|
+
await mkdirp(join28(projectRoot, ".agentsmesh"));
|
|
3972
3972
|
await writeFileAtomic(hooksPath, stringifyYaml(hooksYaml, { lineWidth: 0 }).trimEnd());
|
|
3973
3973
|
results.push({
|
|
3974
3974
|
fromTool: "gemini-cli",
|
|
3975
3975
|
fromPath: settingsPath,
|
|
3976
|
-
toPath:
|
|
3976
|
+
toPath: AGENTSMESH_HOOKS2,
|
|
3977
3977
|
feature: "hooks"
|
|
3978
3978
|
});
|
|
3979
3979
|
}
|
|
@@ -3985,13 +3985,13 @@ async function importGeminiIgnore(projectRoot, results) {
|
|
|
3985
3985
|
if (geminiIgnoreContent !== null && geminiIgnoreContent.trim()) {
|
|
3986
3986
|
const patterns = geminiIgnoreContent.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
3987
3987
|
if (patterns.length > 0) {
|
|
3988
|
-
await mkdirp(join28(projectRoot, ".
|
|
3989
|
-
const ignorePath = join28(projectRoot,
|
|
3988
|
+
await mkdirp(join28(projectRoot, ".agentsmesh"));
|
|
3989
|
+
const ignorePath = join28(projectRoot, AGENTSMESH_IGNORE3);
|
|
3990
3990
|
await writeFileAtomic(ignorePath, patterns.join("\n") + "\n");
|
|
3991
3991
|
results.push({
|
|
3992
3992
|
fromTool: "gemini-cli",
|
|
3993
3993
|
fromPath: geminiIgnorePath,
|
|
3994
|
-
toPath:
|
|
3994
|
+
toPath: AGENTSMESH_IGNORE3,
|
|
3995
3995
|
feature: "ignore"
|
|
3996
3996
|
});
|
|
3997
3997
|
}
|
|
@@ -3999,8 +3999,8 @@ async function importGeminiIgnore(projectRoot, results) {
|
|
|
3999
3999
|
}
|
|
4000
4000
|
|
|
4001
4001
|
// src/targets/gemini-cli/importer-mappers.ts
|
|
4002
|
-
var
|
|
4003
|
-
var
|
|
4002
|
+
var AGENTSMESH_RULES5 = ".agentsmesh/rules";
|
|
4003
|
+
var AGENTSMESH_COMMANDS4 = ".agentsmesh/commands";
|
|
4004
4004
|
async function mapGeminiRuleFile(srcPath, destDir, normalizeTo) {
|
|
4005
4005
|
const destFileName = `${basename20(srcPath, ".md")}.md`;
|
|
4006
4006
|
const destPath = join29(destDir, destFileName);
|
|
@@ -4016,7 +4016,7 @@ async function mapGeminiRuleFile(srcPath, destDir, normalizeTo) {
|
|
|
4016
4016
|
});
|
|
4017
4017
|
return {
|
|
4018
4018
|
destPath,
|
|
4019
|
-
toPath: `${
|
|
4019
|
+
toPath: `${AGENTSMESH_RULES5}/${destFileName}`,
|
|
4020
4020
|
feature: "rules",
|
|
4021
4021
|
content: await serializeImportedRuleWithFallback(destPath, canonicalFm, body)
|
|
4022
4022
|
};
|
|
@@ -4033,7 +4033,7 @@ async function mapGeminiCommandFile(srcPath, destDir, normalizeTo, geminiCommand
|
|
|
4033
4033
|
const allowedTools = fromCamel.length > 0 ? fromCamel : fromKebab;
|
|
4034
4034
|
return {
|
|
4035
4035
|
destPath,
|
|
4036
|
-
toPath: `${
|
|
4036
|
+
toPath: `${AGENTSMESH_COMMANDS4}/${name}.md`,
|
|
4037
4037
|
feature: "commands",
|
|
4038
4038
|
content: await serializeImportedCommandWithFallback(
|
|
4039
4039
|
destPath,
|
|
@@ -4063,7 +4063,7 @@ function parseTomlCommand(normalized) {
|
|
|
4063
4063
|
import { parse as parseToml5 } from "smol-toml";
|
|
4064
4064
|
import { stringify as stringifyYaml2 } from "yaml";
|
|
4065
4065
|
import { join as join30 } from "path";
|
|
4066
|
-
var AB_PERMISSIONS3 = ".
|
|
4066
|
+
var AB_PERMISSIONS3 = ".agentsmesh/permissions.yaml";
|
|
4067
4067
|
function unescapeRegexLiteral(value) {
|
|
4068
4068
|
return value.replace(/\\(.)/g, "$1");
|
|
4069
4069
|
}
|
|
@@ -4152,7 +4152,7 @@ async function importGeminiPolicies(projectRoot) {
|
|
|
4152
4152
|
}
|
|
4153
4153
|
}
|
|
4154
4154
|
if (allow.length === 0 && deny.length === 0) return results;
|
|
4155
|
-
await mkdirp(join30(projectRoot, ".
|
|
4155
|
+
await mkdirp(join30(projectRoot, ".agentsmesh"));
|
|
4156
4156
|
const outPath = join30(projectRoot, AB_PERMISSIONS3);
|
|
4157
4157
|
const yaml = stringifyYaml2({ allow, deny });
|
|
4158
4158
|
await writeFileAtomic(outPath, yaml.trimEnd() + "\n");
|
|
@@ -4166,15 +4166,15 @@ async function importGeminiPolicies(projectRoot) {
|
|
|
4166
4166
|
}
|
|
4167
4167
|
|
|
4168
4168
|
// src/targets/gemini-cli/importer.ts
|
|
4169
|
-
var
|
|
4170
|
-
var
|
|
4171
|
-
var
|
|
4172
|
-
var
|
|
4169
|
+
var AGENTSMESH_RULES6 = ".agentsmesh/rules";
|
|
4170
|
+
var AGENTSMESH_COMMANDS5 = ".agentsmesh/commands";
|
|
4171
|
+
var AGENTSMESH_AGENTS3 = ".agentsmesh/agents";
|
|
4172
|
+
var AGENTSMESH_SKILLS3 = ".agentsmesh/skills";
|
|
4173
4173
|
async function importFromGemini(projectRoot) {
|
|
4174
4174
|
const results = [];
|
|
4175
4175
|
const normalize = await createImportReferenceNormalizer("gemini-cli", projectRoot);
|
|
4176
|
-
const rulesDir = join31(projectRoot,
|
|
4177
|
-
const commandsDir = join31(projectRoot,
|
|
4176
|
+
const rulesDir = join31(projectRoot, AGENTSMESH_RULES6);
|
|
4177
|
+
const commandsDir = join31(projectRoot, AGENTSMESH_COMMANDS5);
|
|
4178
4178
|
const geminiRootPath = join31(projectRoot, GEMINI_ROOT);
|
|
4179
4179
|
const compatAgentsRootPath = join31(projectRoot, GEMINI_COMPAT_AGENTS);
|
|
4180
4180
|
const compatInnerRootPath = join31(projectRoot, GEMINI_COMPAT_INNER_ROOT);
|
|
@@ -4204,7 +4204,7 @@ async function importFromGemini(projectRoot) {
|
|
|
4204
4204
|
results.push({
|
|
4205
4205
|
fromTool: "gemini-cli",
|
|
4206
4206
|
fromPath: rootSourcePath,
|
|
4207
|
-
toPath: `${
|
|
4207
|
+
toPath: `${AGENTSMESH_RULES6}/_root.md`,
|
|
4208
4208
|
feature: "rules"
|
|
4209
4209
|
});
|
|
4210
4210
|
}
|
|
@@ -4240,7 +4240,7 @@ async function importFromGemini(projectRoot) {
|
|
|
4240
4240
|
const rawParsed = parseFrontmatter(content);
|
|
4241
4241
|
const projectedAgent = parseProjectedAgentSkillFrontmatter(rawParsed.frontmatter, skillName);
|
|
4242
4242
|
if (projectedAgent) {
|
|
4243
|
-
const agentsDir = join31(projectRoot,
|
|
4243
|
+
const agentsDir = join31(projectRoot, AGENTSMESH_AGENTS3);
|
|
4244
4244
|
await mkdirp(agentsDir);
|
|
4245
4245
|
const agentPath = join31(agentsDir, `${projectedAgent.name}.md`);
|
|
4246
4246
|
await writeFileAtomic(
|
|
@@ -4250,20 +4250,20 @@ async function importFromGemini(projectRoot) {
|
|
|
4250
4250
|
results.push({
|
|
4251
4251
|
fromTool: "gemini-cli",
|
|
4252
4252
|
fromPath: srcPath,
|
|
4253
|
-
toPath: `${
|
|
4253
|
+
toPath: `${AGENTSMESH_AGENTS3}/${projectedAgent.name}.md`,
|
|
4254
4254
|
feature: "agents"
|
|
4255
4255
|
});
|
|
4256
4256
|
continue;
|
|
4257
4257
|
}
|
|
4258
|
-
const destPath = join31(projectRoot,
|
|
4258
|
+
const destPath = join31(projectRoot, AGENTSMESH_SKILLS3, skillName, "SKILL.md");
|
|
4259
4259
|
const normalized = normalize(content, srcPath, destPath);
|
|
4260
|
-
const skillDir = join31(projectRoot,
|
|
4260
|
+
const skillDir = join31(projectRoot, AGENTSMESH_SKILLS3, skillName);
|
|
4261
4261
|
await mkdirp(skillDir);
|
|
4262
4262
|
await writeFileAtomic(destPath, normalized);
|
|
4263
4263
|
results.push({
|
|
4264
4264
|
fromTool: "gemini-cli",
|
|
4265
4265
|
fromPath: srcPath,
|
|
4266
|
-
toPath: `${
|
|
4266
|
+
toPath: `${AGENTSMESH_SKILLS3}/${skillName}/SKILL.md`,
|
|
4267
4267
|
feature: "skills"
|
|
4268
4268
|
});
|
|
4269
4269
|
const allSkillFiles = await readDirRecursive(dirname16(srcPath));
|
|
@@ -4278,7 +4278,7 @@ async function importFromGemini(projectRoot) {
|
|
|
4278
4278
|
results.push({
|
|
4279
4279
|
fromTool: "gemini-cli",
|
|
4280
4280
|
fromPath: absPath,
|
|
4281
|
-
toPath: `${
|
|
4281
|
+
toPath: `${AGENTSMESH_SKILLS3}/${skillName}/${relPath}`,
|
|
4282
4282
|
feature: "skills"
|
|
4283
4283
|
});
|
|
4284
4284
|
}
|
|
@@ -4293,7 +4293,7 @@ async function importFromGemini(projectRoot) {
|
|
|
4293
4293
|
if (!content) continue;
|
|
4294
4294
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
4295
4295
|
const name = typeof frontmatter.name === "string" ? frontmatter.name : basename21(srcPath, ".md");
|
|
4296
|
-
const agentsDir = join31(projectRoot,
|
|
4296
|
+
const agentsDir = join31(projectRoot, AGENTSMESH_AGENTS3);
|
|
4297
4297
|
await mkdirp(agentsDir);
|
|
4298
4298
|
const destPath = join31(agentsDir, `${name}.md`);
|
|
4299
4299
|
const normalizedBody = normalize(body, srcPath, destPath);
|
|
@@ -4312,7 +4312,7 @@ async function importFromGemini(projectRoot) {
|
|
|
4312
4312
|
results.push({
|
|
4313
4313
|
fromTool: "gemini-cli",
|
|
4314
4314
|
fromPath: srcPath,
|
|
4315
|
-
toPath: `${
|
|
4315
|
+
toPath: `${AGENTSMESH_AGENTS3}/${name}.md`,
|
|
4316
4316
|
feature: "agents"
|
|
4317
4317
|
});
|
|
4318
4318
|
}
|
|
@@ -4551,7 +4551,7 @@ function lintRules9(canonical, projectRoot, _projectFiles) {
|
|
|
4551
4551
|
if (unsupported.length > 0) {
|
|
4552
4552
|
diags.push({
|
|
4553
4553
|
level: "warning",
|
|
4554
|
-
file: ".
|
|
4554
|
+
file: ".agentsmesh",
|
|
4555
4555
|
target: TARGET9,
|
|
4556
4556
|
message: `Windsurf cannot project these features yet: ${unsupported.join(", ")}.`
|
|
4557
4557
|
});
|
|
@@ -4740,7 +4740,7 @@ var extendSourceSchema = z.object({
|
|
|
4740
4740
|
version: z.string().optional(),
|
|
4741
4741
|
target: targetSchema.optional(),
|
|
4742
4742
|
features: z.array(featureSchema),
|
|
4743
|
-
/** Repo-relative POSIX path for discovery (skill packs, nested .
|
|
4743
|
+
/** Repo-relative POSIX path for discovery (skill packs, nested .agentsmesh). */
|
|
4744
4744
|
path: z.string().optional(),
|
|
4745
4745
|
pick: extendPickSchema.optional()
|
|
4746
4746
|
});
|
|
@@ -4770,8 +4770,8 @@ var configSchema = z.object({
|
|
|
4770
4770
|
});
|
|
4771
4771
|
|
|
4772
4772
|
// src/config/loader.ts
|
|
4773
|
-
var CONFIG_FILENAME = "
|
|
4774
|
-
var LOCAL_CONFIG_FILENAME = "
|
|
4773
|
+
var CONFIG_FILENAME = "agentsmesh.yaml";
|
|
4774
|
+
var LOCAL_CONFIG_FILENAME = "agentsmesh.local.yaml";
|
|
4775
4775
|
async function findConfigPath(startDir) {
|
|
4776
4776
|
let dir = resolve2(startDir);
|
|
4777
4777
|
while (true) {
|
|
@@ -4790,7 +4790,7 @@ async function loadConfig(configPath) {
|
|
|
4790
4790
|
const content = await readFileSafe(configPath);
|
|
4791
4791
|
if (content === null) {
|
|
4792
4792
|
throw new Error(
|
|
4793
|
-
`Config file not found: ${configPath}. Create
|
|
4793
|
+
`Config file not found: ${configPath}. Create agentsmesh.yaml in project root.`
|
|
4794
4794
|
);
|
|
4795
4795
|
}
|
|
4796
4796
|
const raw = parseYaml2(content);
|
|
@@ -4848,7 +4848,7 @@ async function loadConfigFromDir(startDir) {
|
|
|
4848
4848
|
const configPath = await findConfigPath(startDir);
|
|
4849
4849
|
if (configPath === null) {
|
|
4850
4850
|
throw new Error(
|
|
4851
|
-
`No
|
|
4851
|
+
`No agentsmesh.yaml found from ${startDir}. Run 'agentsmesh init' to create one.`
|
|
4852
4852
|
);
|
|
4853
4853
|
}
|
|
4854
4854
|
const configDir = dirname17(configPath);
|
|
@@ -4865,7 +4865,7 @@ async function loadConfigFromDir(startDir) {
|
|
|
4865
4865
|
} else {
|
|
4866
4866
|
const issues = parsed.error.issues.map((i) => i.message).join("; ");
|
|
4867
4867
|
logger.warn(
|
|
4868
|
-
`Ignoring invalid
|
|
4868
|
+
`Ignoring invalid agentsmesh.local.yaml at ${localPath}: ${issues}. Using project config instead.`
|
|
4869
4869
|
);
|
|
4870
4870
|
}
|
|
4871
4871
|
}
|
|
@@ -4917,7 +4917,7 @@ async function fetchGitRemoteExtend(parsed, extendName, options, cacheDir, build
|
|
|
4917
4917
|
const allowFallback = options.allowOfflineFallback !== false;
|
|
4918
4918
|
if (allowFallback && await hasCachedRepo(cacheRepoDir)) {
|
|
4919
4919
|
console.warn(
|
|
4920
|
-
`[
|
|
4920
|
+
`[agentsmesh] Remote fetch failed for ${extendName}; using cached version. Error: ${err instanceof Error ? err.message : String(err)}`
|
|
4921
4921
|
);
|
|
4922
4922
|
return readCachedRepo(cacheRepoDir);
|
|
4923
4923
|
}
|
|
@@ -4935,7 +4935,7 @@ async function hasCachedRepo(repoDir) {
|
|
|
4935
4935
|
}
|
|
4936
4936
|
function resolveCloneUrl(parsed) {
|
|
4937
4937
|
if ("cloneUrl" in parsed) {
|
|
4938
|
-
const token = process.env.
|
|
4938
|
+
const token = process.env.AGENTSMESH_GITLAB_TOKEN;
|
|
4939
4939
|
if (token) {
|
|
4940
4940
|
const url = new URL(parsed.cloneUrl);
|
|
4941
4941
|
if (url.protocol === "https:") {
|
|
@@ -4992,7 +4992,7 @@ async function resolveLatestTag(org, repo, token) {
|
|
|
4992
4992
|
return data.tag_name;
|
|
4993
4993
|
}
|
|
4994
4994
|
async function fetchGithubRemoteExtend(parsed, extendName, options, cacheDir, buildCacheKey2, allowDefaultBranchFallback = false) {
|
|
4995
|
-
const token = options.token ?? process.env.
|
|
4995
|
+
const token = options.token ?? process.env.AGENTSMESH_GITHUB_TOKEN;
|
|
4996
4996
|
const refresh = options.refresh === true;
|
|
4997
4997
|
let tag = parsed.tag;
|
|
4998
4998
|
if (tag === "latest") {
|
|
@@ -5023,7 +5023,7 @@ async function fetchGithubRemoteExtend(parsed, extendName, options, cacheDir, bu
|
|
|
5023
5023
|
const topDir2 = await findExtractTopDir(extractDir);
|
|
5024
5024
|
if (topDir2) {
|
|
5025
5025
|
console.warn(
|
|
5026
|
-
`[
|
|
5026
|
+
`[agentsmesh] Network failed for ${extendName}; using cached version. Error: ${err instanceof Error ? err.message : String(err)}`
|
|
5027
5027
|
);
|
|
5028
5028
|
return { resolvedPath: join34(extractDir, topDir2), version: tag };
|
|
5029
5029
|
}
|
|
@@ -5178,7 +5178,7 @@ async function cleanInstallCache(source, cacheDir) {
|
|
|
5178
5178
|
}
|
|
5179
5179
|
async function sweepStaleCache(cacheDir, maxAgeMs) {
|
|
5180
5180
|
const dir = cacheDir ?? getCacheDir();
|
|
5181
|
-
const threshold = maxAgeMs ?? Number(process.env.
|
|
5181
|
+
const threshold = maxAgeMs ?? Number(process.env.AGENTSMESH_CACHE_MAX_AGE_DAYS ?? 30) * 864e5;
|
|
5182
5182
|
let entries;
|
|
5183
5183
|
try {
|
|
5184
5184
|
entries = await readdir7(dir);
|
|
@@ -5210,9 +5210,9 @@ function buildCacheKey(provider, identifier, ref) {
|
|
|
5210
5210
|
return `${safe(provider)}_${safe(identifier)}_${safe(ref)}`;
|
|
5211
5211
|
}
|
|
5212
5212
|
function getCacheDir() {
|
|
5213
|
-
const env = process.env.
|
|
5213
|
+
const env = process.env.AGENTSMESH_CACHE;
|
|
5214
5214
|
if (env) return env;
|
|
5215
|
-
return join36(homedir(), ".
|
|
5215
|
+
return join36(homedir(), ".agentsmesh", "cache");
|
|
5216
5216
|
}
|
|
5217
5217
|
async function fetchRemoteExtend(source, extendName, options = {}) {
|
|
5218
5218
|
const parsed = parseRemoteSource(source);
|
|
@@ -5285,7 +5285,7 @@ async function resolveExtendPaths(config, configDir, options = {}) {
|
|
|
5285
5285
|
const resolvedPath = resolve3(configDir, ext.source);
|
|
5286
5286
|
if (!await exists(resolvedPath)) {
|
|
5287
5287
|
throw new Error(
|
|
5288
|
-
`Extend "${ext.name}": path does not exist: ${resolvedPath}. Check extends.source in
|
|
5288
|
+
`Extend "${ext.name}": path does not exist: ${resolvedPath}. Check extends.source in agentsmesh.yaml.`
|
|
5289
5289
|
);
|
|
5290
5290
|
}
|
|
5291
5291
|
result.push({
|
|
@@ -5648,7 +5648,7 @@ async function parseIgnore(ignorePath) {
|
|
|
5648
5648
|
|
|
5649
5649
|
// src/canonical/loader.ts
|
|
5650
5650
|
async function loadCanonicalFiles(projectRoot) {
|
|
5651
|
-
const abDir = join38(projectRoot, ".
|
|
5651
|
+
const abDir = join38(projectRoot, ".agentsmesh");
|
|
5652
5652
|
const [rules, commands, agents, skills, mcp, permissions, hooks, ignore] = await Promise.all([
|
|
5653
5653
|
parseRules(join38(abDir, "rules")),
|
|
5654
5654
|
parseCommands(join38(abDir, "commands")),
|
|
@@ -5973,7 +5973,7 @@ async function loadSkillsForPartialSlice(sliceRoot) {
|
|
|
5973
5973
|
return [];
|
|
5974
5974
|
}
|
|
5975
5975
|
async function loadCanonicalSliceAtPath(sliceRoot) {
|
|
5976
|
-
const ab = join41(sliceRoot, ".
|
|
5976
|
+
const ab = join41(sliceRoot, ".agentsmesh");
|
|
5977
5977
|
if (await exists(ab)) {
|
|
5978
5978
|
return loadCanonicalFiles(sliceRoot);
|
|
5979
5979
|
}
|
|
@@ -5984,7 +5984,7 @@ async function loadCanonicalSliceAtPath(sliceRoot) {
|
|
|
5984
5984
|
partial.skills = await loadSkillsForPartialSlice(sliceRoot);
|
|
5985
5985
|
if (isCanonicalSliceEmpty(partial)) {
|
|
5986
5986
|
throw new Error(
|
|
5987
|
-
`No installable resources at ${sliceRoot}. Expected .
|
|
5987
|
+
`No installable resources at ${sliceRoot}. Expected .agentsmesh/, or rules/, commands/, agents/, or Anthropic-style skills (SKILL.md).`
|
|
5988
5988
|
);
|
|
5989
5989
|
}
|
|
5990
5990
|
return partial;
|
|
@@ -6006,8 +6006,8 @@ function emptyCanonical2() {
|
|
|
6006
6006
|
async function loadCanonicalForExtend(ext) {
|
|
6007
6007
|
const base = ext.resolvedPath;
|
|
6008
6008
|
if (!ext.path) {
|
|
6009
|
-
const
|
|
6010
|
-
if (!await exists(
|
|
6009
|
+
const agentsmeshDir = join42(base, ".agentsmesh");
|
|
6010
|
+
if (!await exists(agentsmeshDir)) {
|
|
6011
6011
|
if (await isSkillPackLayout(base)) {
|
|
6012
6012
|
const skills = await loadSkillsAtExtendPath(base);
|
|
6013
6013
|
return { ...emptyCanonical2(), skills };
|
|
@@ -6016,11 +6016,11 @@ async function loadCanonicalForExtend(ext) {
|
|
|
6016
6016
|
if (!targetName) {
|
|
6017
6017
|
throw new Error(
|
|
6018
6018
|
`Extend "${ext.name}": No supported agent configuration found in ${base}.
|
|
6019
|
-
Expected one of: .
|
|
6019
|
+
Expected one of: .agentsmesh/, ${KNOWN_NATIVE_PATHS.join(", ")}.`
|
|
6020
6020
|
);
|
|
6021
6021
|
}
|
|
6022
6022
|
logger.info(
|
|
6023
|
-
`[
|
|
6023
|
+
`[agentsmesh] Extend "${ext.name}": ${ext.target ? "specified" : "detected"} ${targetName} format, importing to .agentsmesh/...`
|
|
6024
6024
|
);
|
|
6025
6025
|
await importNativeToCanonical(base, targetName);
|
|
6026
6026
|
}
|
|
@@ -6031,10 +6031,10 @@ Expected one of: .agentsbridge/, ${KNOWN_NATIVE_PATHS.join(", ")}.`
|
|
|
6031
6031
|
throw new Error(`Extend "${ext.name}": path does not exist: ${rawRoot}`);
|
|
6032
6032
|
}
|
|
6033
6033
|
if (ext.target) {
|
|
6034
|
-
const
|
|
6035
|
-
if (!await exists(
|
|
6034
|
+
const agentsmeshDir = join42(base, ".agentsmesh");
|
|
6035
|
+
if (!await exists(agentsmeshDir)) {
|
|
6036
6036
|
logger.info(
|
|
6037
|
-
`[
|
|
6037
|
+
`[agentsmesh] Extend "${ext.name}": path "${ext.path}" with target "${ext.target}" \u2014 importing at extend root, then loading canonical.`
|
|
6038
6038
|
);
|
|
6039
6039
|
await importNativeToCanonical(base, ext.target);
|
|
6040
6040
|
}
|
|
@@ -6063,7 +6063,7 @@ function applyExtendPick(canonical, features, pick, extendName) {
|
|
|
6063
6063
|
for (const n of pick.skills) {
|
|
6064
6064
|
if (!prev.some((s) => s.name === n)) {
|
|
6065
6065
|
logger.warn(
|
|
6066
|
-
`[
|
|
6066
|
+
`[agentsmesh] pick name "${n}" not found in skills from extend "${extendName}".`
|
|
6067
6067
|
);
|
|
6068
6068
|
}
|
|
6069
6069
|
}
|
|
@@ -6075,7 +6075,7 @@ function applyExtendPick(canonical, features, pick, extendName) {
|
|
|
6075
6075
|
for (const n of pick.commands) {
|
|
6076
6076
|
if (!prev.some((c2) => c2.name === n)) {
|
|
6077
6077
|
logger.warn(
|
|
6078
|
-
`[
|
|
6078
|
+
`[agentsmesh] pick name "${n}" not found in commands from extend "${extendName}".`
|
|
6079
6079
|
);
|
|
6080
6080
|
}
|
|
6081
6081
|
}
|
|
@@ -6087,7 +6087,7 @@ function applyExtendPick(canonical, features, pick, extendName) {
|
|
|
6087
6087
|
for (const n of pick.agents) {
|
|
6088
6088
|
if (!prev.some((a) => a.name === n)) {
|
|
6089
6089
|
logger.warn(
|
|
6090
|
-
`[
|
|
6090
|
+
`[agentsmesh] pick name "${n}" not found in agents from extend "${extendName}".`
|
|
6091
6091
|
);
|
|
6092
6092
|
}
|
|
6093
6093
|
}
|
|
@@ -6103,7 +6103,7 @@ function applyExtendPick(canonical, features, pick, extendName) {
|
|
|
6103
6103
|
for (const n of pick.rules) {
|
|
6104
6104
|
if (!prev.some((r) => stem(r.source) === n)) {
|
|
6105
6105
|
logger.warn(
|
|
6106
|
-
`[
|
|
6106
|
+
`[agentsmesh] pick name "${n}" not found in rules from extend "${extendName}".`
|
|
6107
6107
|
);
|
|
6108
6108
|
}
|
|
6109
6109
|
}
|
|
@@ -6300,7 +6300,7 @@ async function loadCanonicalWithExtends(config, configDir, options = {}) {
|
|
|
6300
6300
|
const picked = applyExtendPick(filtered, ext.features, ext.pick, ext.name);
|
|
6301
6301
|
merged = mergeCanonicalFiles(merged, picked);
|
|
6302
6302
|
}
|
|
6303
|
-
const packsCanonical = await loadPacksCanonical(join45(configDir, ".
|
|
6303
|
+
const packsCanonical = await loadPacksCanonical(join45(configDir, ".agentsmesh"));
|
|
6304
6304
|
merged = mergeCanonicalFiles(merged, packsCanonical);
|
|
6305
6305
|
const localCanonical = await loadCanonicalFiles(configDir);
|
|
6306
6306
|
merged = mergeCanonicalFiles(merged, localCanonical);
|
|
@@ -6429,7 +6429,7 @@ async function buildExtendChecksums(resolvedExtends) {
|
|
|
6429
6429
|
result[ext.name] = ext.version;
|
|
6430
6430
|
continue;
|
|
6431
6431
|
}
|
|
6432
|
-
const abDir = join46(ext.resolvedPath, ".
|
|
6432
|
+
const abDir = join46(ext.resolvedPath, ".agentsmesh");
|
|
6433
6433
|
const checksums = await buildChecksums(abDir);
|
|
6434
6434
|
const fingerprint = Object.keys(checksums).sort().map((p) => `${p}:${checksums[p]}`).join("\n");
|
|
6435
6435
|
const h = hashContent(fingerprint);
|
|
@@ -6871,7 +6871,7 @@ function generateHooks3(canonical) {
|
|
|
6871
6871
|
if (Object.keys(hooks).length === 0) return [];
|
|
6872
6872
|
return [
|
|
6873
6873
|
{
|
|
6874
|
-
path: `${COPILOT_HOOKS_DIR}/
|
|
6874
|
+
path: `${COPILOT_HOOKS_DIR}/agentsmesh.json`,
|
|
6875
6875
|
content: JSON.stringify({ version: 1, hooks }, null, 2)
|
|
6876
6876
|
}
|
|
6877
6877
|
];
|
|
@@ -7079,7 +7079,7 @@ function generateRules6(canonical) {
|
|
|
7079
7079
|
const content = nonEmpty.join("\n\n---\n\n");
|
|
7080
7080
|
const outputs = [{ path: GEMINI_ROOT, content }];
|
|
7081
7081
|
if (root) {
|
|
7082
|
-
const compatAgentsContent = root.body.trim().replace(/\.
|
|
7082
|
+
const compatAgentsContent = root.body.trim().replace(/\.agentsmesh\/skills\//g, ".agents/skills/");
|
|
7083
7083
|
outputs.push({ path: GEMINI_COMPAT_AGENTS, content: compatAgentsContent });
|
|
7084
7084
|
}
|
|
7085
7085
|
return outputs;
|
|
@@ -7331,8 +7331,8 @@ function safeEventName(event) {
|
|
|
7331
7331
|
function buildHookScript(command, matcher) {
|
|
7332
7332
|
return [
|
|
7333
7333
|
"#!/usr/bin/env bash",
|
|
7334
|
-
`#
|
|
7335
|
-
`#
|
|
7334
|
+
`# agentsmesh-matcher: ${matcher}`,
|
|
7335
|
+
`# agentsmesh-command: ${command}`,
|
|
7336
7336
|
"set -e",
|
|
7337
7337
|
command,
|
|
7338
7338
|
""
|
|
@@ -7467,7 +7467,7 @@ function toSafeCodexRulesContent(body) {
|
|
|
7467
7467
|
if (looksLikeCodexRulesDsl(trimmed)) return `${trimmed}
|
|
7468
7468
|
`;
|
|
7469
7469
|
const lines = [
|
|
7470
|
-
"#
|
|
7470
|
+
"# agentsmesh: canonical execution rule body is not Codex DSL",
|
|
7471
7471
|
"# The original body is preserved below as comments.",
|
|
7472
7472
|
"# Replace with Codex rules DSL (for example prefix_rule(...)) to enforce behavior.",
|
|
7473
7473
|
"#",
|
|
@@ -7777,7 +7777,7 @@ function addDirectoryMapping2(refs, from, to) {
|
|
|
7777
7777
|
function addSkillDirectoryMappings(refs, canonicalPath, targetPath) {
|
|
7778
7778
|
let fromDir = posix2.dirname(canonicalPath);
|
|
7779
7779
|
let toDir = posix2.dirname(targetPath);
|
|
7780
|
-
while (fromDir !== ".
|
|
7780
|
+
while (fromDir !== ".agentsmesh/skills" && fromDir !== ".") {
|
|
7781
7781
|
addDirectoryMapping2(refs, fromDir, toDir);
|
|
7782
7782
|
fromDir = posix2.dirname(fromDir);
|
|
7783
7783
|
toDir = posix2.dirname(toDir);
|
|
@@ -7897,24 +7897,24 @@ function buildReferenceMap(target10, canonical, config) {
|
|
|
7897
7897
|
const refs = /* @__PURE__ */ new Map();
|
|
7898
7898
|
for (const rule of canonical.rules) {
|
|
7899
7899
|
const path = ruleTargetPath(target10, rule);
|
|
7900
|
-
if (path) refs.set(`.
|
|
7900
|
+
if (path) refs.set(`.agentsmesh/rules/${basename36(rule.source)}`, path);
|
|
7901
7901
|
}
|
|
7902
7902
|
for (const command of canonical.commands) {
|
|
7903
7903
|
const path = commandTargetPath(target10, command.name, config);
|
|
7904
|
-
if (path) refs.set(`.
|
|
7904
|
+
if (path) refs.set(`.agentsmesh/commands/${command.name}.md`, path);
|
|
7905
7905
|
}
|
|
7906
7906
|
for (const agent of canonical.agents) {
|
|
7907
7907
|
const path = agentTargetPath(target10, agent.name, config);
|
|
7908
|
-
if (path) refs.set(`.
|
|
7908
|
+
if (path) refs.set(`.agentsmesh/agents/${agent.name}.md`, path);
|
|
7909
7909
|
}
|
|
7910
7910
|
const skillDir = SKILL_DIRS[target10];
|
|
7911
7911
|
if (!skillDir) return refs;
|
|
7912
7912
|
for (const skill of canonical.skills) {
|
|
7913
|
-
addDirectoryMapping3(refs, `.
|
|
7914
|
-
refs.set(`.
|
|
7913
|
+
addDirectoryMapping3(refs, `.agentsmesh/skills/${skill.name}`, `${skillDir}/${skill.name}`);
|
|
7914
|
+
refs.set(`.agentsmesh/skills/${skill.name}/SKILL.md`, `${skillDir}/${skill.name}/SKILL.md`);
|
|
7915
7915
|
for (const file of skill.supportingFiles) {
|
|
7916
7916
|
const relativePath = file.relativePath.replace(/\\/g, "/");
|
|
7917
|
-
const canonicalPath = `.
|
|
7917
|
+
const canonicalPath = `.agentsmesh/skills/${skill.name}/${relativePath}`;
|
|
7918
7918
|
const targetPath = `${skillDir}/${skill.name}/${relativePath}`;
|
|
7919
7919
|
refs.set(canonicalPath, targetPath);
|
|
7920
7920
|
addSkillDirectoryMappings(refs, canonicalPath, targetPath);
|
|
@@ -7981,16 +7981,16 @@ import { dirname as dirname19, join as join48 } from "path";
|
|
|
7981
7981
|
// src/core/output-source-map.ts
|
|
7982
7982
|
import { join as join47, normalize as normalizePath2 } from "path";
|
|
7983
7983
|
function canonicalRulePath(rule) {
|
|
7984
|
-
return `.
|
|
7984
|
+
return `.agentsmesh/rules/${rule.source.split("/").pop()}`;
|
|
7985
7985
|
}
|
|
7986
7986
|
function canonicalCommandPath(command) {
|
|
7987
|
-
return `.
|
|
7987
|
+
return `.agentsmesh/commands/${command.name}.md`;
|
|
7988
7988
|
}
|
|
7989
7989
|
function canonicalAgentPath(agent) {
|
|
7990
|
-
return `.
|
|
7990
|
+
return `.agentsmesh/agents/${agent.name}.md`;
|
|
7991
7991
|
}
|
|
7992
7992
|
function canonicalSkillPath(skill) {
|
|
7993
|
-
return `.
|
|
7993
|
+
return `.agentsmesh/skills/${skill.name}/SKILL.md`;
|
|
7994
7994
|
}
|
|
7995
7995
|
function directoryScopedRuleDir2(globs) {
|
|
7996
7996
|
if (globs.length === 0) return null;
|
|
@@ -8063,7 +8063,7 @@ function buildOutputSourceMap(target10, canonical, config) {
|
|
|
8063
8063
|
const skillTargetPath = refs.get(canonicalSkillPath(skill));
|
|
8064
8064
|
if (skillTargetPath) sourceMap.set(skillTargetPath, skill.source);
|
|
8065
8065
|
for (const file of skill.supportingFiles) {
|
|
8066
|
-
const canonicalPath = `.
|
|
8066
|
+
const canonicalPath = `.agentsmesh/skills/${skill.name}/${file.relativePath.replace(/\\/g, "/")}`;
|
|
8067
8067
|
const targetPath = refs.get(canonicalPath);
|
|
8068
8068
|
if (targetPath) sourceMap.set(targetPath, file.absolutePath);
|
|
8069
8069
|
}
|
|
@@ -8241,8 +8241,8 @@ function wrapperPath(event, index) {
|
|
|
8241
8241
|
function buildWrapper(command, matcher) {
|
|
8242
8242
|
return [
|
|
8243
8243
|
"#!/usr/bin/env bash",
|
|
8244
|
-
`#
|
|
8245
|
-
`#
|
|
8244
|
+
`# agentsmesh-matcher: ${matcher}`,
|
|
8245
|
+
`# agentsmesh-command: ${command}`,
|
|
8246
8246
|
"set -e",
|
|
8247
8247
|
command,
|
|
8248
8248
|
""
|
|
@@ -8614,11 +8614,11 @@ function formatVerboseDetails(canonical) {
|
|
|
8614
8614
|
if (count > 0) lines.push(`hooks: ${count} entries in hooks.yaml`);
|
|
8615
8615
|
}
|
|
8616
8616
|
if (canonical.ignore.length > 0) {
|
|
8617
|
-
lines.push("ignore: .
|
|
8617
|
+
lines.push("ignore: .agentsmesh/ignore");
|
|
8618
8618
|
}
|
|
8619
8619
|
if (canonical.permissions) {
|
|
8620
8620
|
const total = canonical.permissions.allow.length + canonical.permissions.deny.length;
|
|
8621
|
-
if (total > 0) lines.push("permissions: .
|
|
8621
|
+
if (total > 0) lines.push("permissions: .agentsmesh/permissions.yaml");
|
|
8622
8622
|
}
|
|
8623
8623
|
if (lines.length === 0) return "";
|
|
8624
8624
|
return "\nPer-file details:\n" + lines.join("\n") + "\n";
|
|
@@ -8634,7 +8634,7 @@ async function runMatrix(flags, projectRoot) {
|
|
|
8634
8634
|
const targets = targetFilter ?? config.targets;
|
|
8635
8635
|
const rows = buildCompatibilityMatrix(config, canonical);
|
|
8636
8636
|
if (rows.length === 0) {
|
|
8637
|
-
logger.info("No features enabled. Enable features in
|
|
8637
|
+
logger.info("No features enabled. Enable features in agentsmesh.yaml.");
|
|
8638
8638
|
return;
|
|
8639
8639
|
}
|
|
8640
8640
|
const table = formatMatrix(rows, targets);
|
|
@@ -8658,7 +8658,7 @@ function ensurePathInsideRoot(rootDir, relativePath, target10) {
|
|
|
8658
8658
|
}
|
|
8659
8659
|
async function runGenerate(flags, projectRoot, options = {}) {
|
|
8660
8660
|
if (flags.features !== void 0) {
|
|
8661
|
-
throw new Error("--features is no longer supported. Configure features in
|
|
8661
|
+
throw new Error("--features is no longer supported. Configure features in agentsmesh.yaml.");
|
|
8662
8662
|
}
|
|
8663
8663
|
const root = projectRoot ?? process.cwd();
|
|
8664
8664
|
const checkOnly = flags.check === true;
|
|
@@ -8670,7 +8670,7 @@ async function runGenerate(flags, projectRoot, options = {}) {
|
|
|
8670
8670
|
const { config, configDir } = await loadConfigFromDir(root);
|
|
8671
8671
|
const lockFeatures = config.collaboration?.lock_features ?? [];
|
|
8672
8672
|
if (config.collaboration?.strategy === "lock" && !force && lockFeatures.length > 0) {
|
|
8673
|
-
const abDir = join52(configDir, ".
|
|
8673
|
+
const abDir = join52(configDir, ".agentsmesh");
|
|
8674
8674
|
const existingLock = await readLock(abDir);
|
|
8675
8675
|
if (existingLock !== null) {
|
|
8676
8676
|
const currentChecksums = await buildChecksums(abDir);
|
|
@@ -8684,7 +8684,7 @@ async function runGenerate(flags, projectRoot, options = {}) {
|
|
|
8684
8684
|
for (const violation of violations) {
|
|
8685
8685
|
logger.error(` ${violation}`);
|
|
8686
8686
|
}
|
|
8687
|
-
logger.error("Run '
|
|
8687
|
+
logger.error("Run 'agentsmesh generate --force' to accept these changes.");
|
|
8688
8688
|
throw new Error("Locked feature violation. Use --force to override.");
|
|
8689
8689
|
}
|
|
8690
8690
|
}
|
|
@@ -8705,7 +8705,7 @@ async function runGenerate(flags, projectRoot, options = {}) {
|
|
|
8705
8705
|
return 0;
|
|
8706
8706
|
}
|
|
8707
8707
|
if (!dryRun) {
|
|
8708
|
-
const abDir = join52(configDir, ".
|
|
8708
|
+
const abDir = join52(configDir, ".agentsmesh");
|
|
8709
8709
|
const checksums = await buildChecksums(abDir);
|
|
8710
8710
|
const extendChecksums = resolvedExtends.length > 0 ? await buildExtendChecksums(resolvedExtends) : {};
|
|
8711
8711
|
const packChecksums = await buildPackChecksums(join52(abDir, "packs"));
|
|
@@ -8719,10 +8719,10 @@ async function runGenerate(flags, projectRoot, options = {}) {
|
|
|
8719
8719
|
packs: packChecksums
|
|
8720
8720
|
});
|
|
8721
8721
|
try {
|
|
8722
|
-
await ensureCacheSymlink(getCacheDir(), join52(configDir, ".
|
|
8722
|
+
await ensureCacheSymlink(getCacheDir(), join52(configDir, ".agentsmeshcache"));
|
|
8723
8723
|
} catch (err) {
|
|
8724
8724
|
logger.warn(
|
|
8725
|
-
`Could not create .
|
|
8725
|
+
`Could not create .agentsmeshcache symlink: ${err instanceof Error ? err.message : String(err)}`
|
|
8726
8726
|
);
|
|
8727
8727
|
}
|
|
8728
8728
|
}
|
|
@@ -8740,7 +8740,7 @@ async function runGenerate(flags, projectRoot, options = {}) {
|
|
|
8740
8740
|
for (const r of drifted) {
|
|
8741
8741
|
logger.error(`[check] ${r.status} ${r.path} (${r.target})`);
|
|
8742
8742
|
}
|
|
8743
|
-
logger.error("Generated files are out of sync. Run '
|
|
8743
|
+
logger.error("Generated files are out of sync. Run 'agentsmesh generate' to update them.");
|
|
8744
8744
|
return 1;
|
|
8745
8745
|
}
|
|
8746
8746
|
for (const r of results) {
|
|
@@ -8761,7 +8761,7 @@ async function runGenerate(flags, projectRoot, options = {}) {
|
|
|
8761
8761
|
} else {
|
|
8762
8762
|
logger.info(`Nothing changed. (${unchanged} unchanged)`);
|
|
8763
8763
|
}
|
|
8764
|
-
const abDir = join52(configDir, ".
|
|
8764
|
+
const abDir = join52(configDir, ".agentsmesh");
|
|
8765
8765
|
const checksums = await buildChecksums(abDir);
|
|
8766
8766
|
const extendChecksums = resolvedExtends.length > 0 ? await buildExtendChecksums(resolvedExtends) : {};
|
|
8767
8767
|
const packChecksums = await buildPackChecksums(join52(abDir, "packs"));
|
|
@@ -8775,10 +8775,10 @@ async function runGenerate(flags, projectRoot, options = {}) {
|
|
|
8775
8775
|
packs: packChecksums
|
|
8776
8776
|
});
|
|
8777
8777
|
try {
|
|
8778
|
-
await ensureCacheSymlink(getCacheDir(), join52(configDir, ".
|
|
8778
|
+
await ensureCacheSymlink(getCacheDir(), join52(configDir, ".agentsmeshcache"));
|
|
8779
8779
|
} catch (err) {
|
|
8780
8780
|
logger.warn(
|
|
8781
|
-
`Could not create .
|
|
8781
|
+
`Could not create .agentsmeshcache symlink: ${err instanceof Error ? err.message : String(err)}`
|
|
8782
8782
|
);
|
|
8783
8783
|
}
|
|
8784
8784
|
}
|
|
@@ -8992,9 +8992,9 @@ async function detectExistingConfigs(projectRoot) {
|
|
|
8992
8992
|
}
|
|
8993
8993
|
|
|
8994
8994
|
// src/cli/commands/init.ts
|
|
8995
|
-
var CONFIG_FILENAME2 = "
|
|
8996
|
-
var LOCAL_CONFIG_FILENAME2 = "
|
|
8997
|
-
var GITIGNORE_ENTRIES = ["
|
|
8995
|
+
var CONFIG_FILENAME2 = "agentsmesh.yaml";
|
|
8996
|
+
var LOCAL_CONFIG_FILENAME2 = "agentsmesh.local.yaml";
|
|
8997
|
+
var GITIGNORE_ENTRIES = ["agentsmesh.local.yaml", ".agentsmeshcache"];
|
|
8998
8998
|
var IMPORTERS = {
|
|
8999
8999
|
"claude-code": importFromClaudeCode,
|
|
9000
9000
|
cursor: importFromCursor,
|
|
@@ -9016,29 +9016,29 @@ async function appendToGitignore(projectRoot) {
|
|
|
9016
9016
|
await writeFileAtomic(gitignorePath, current + suffix + toAdd.join("\n") + "\n");
|
|
9017
9017
|
}
|
|
9018
9018
|
async function writeScaffold(projectRoot) {
|
|
9019
|
-
const ab = (rel2) => join54(projectRoot, ".
|
|
9019
|
+
const ab = (rel2) => join54(projectRoot, ".agentsmesh", rel2);
|
|
9020
9020
|
await mkdirp(ab("rules"));
|
|
9021
9021
|
await writeFileAtomic(ab("rules/_root.md"), TEMPLATE_ROOT_RULE);
|
|
9022
|
-
logger.success("Created .
|
|
9022
|
+
logger.success("Created .agentsmesh/rules/_root.md");
|
|
9023
9023
|
await writeFileAtomic(ab("rules/example.md"), TEMPLATE_EXAMPLE_RULE);
|
|
9024
|
-
logger.success("Created .
|
|
9024
|
+
logger.success("Created .agentsmesh/rules/example.md");
|
|
9025
9025
|
await mkdirp(ab("commands"));
|
|
9026
9026
|
await writeFileAtomic(ab("commands/example.md"), TEMPLATE_EXAMPLE_COMMAND);
|
|
9027
|
-
logger.success("Created .
|
|
9027
|
+
logger.success("Created .agentsmesh/commands/example.md");
|
|
9028
9028
|
await mkdirp(ab("agents"));
|
|
9029
9029
|
await writeFileAtomic(ab("agents/example.md"), TEMPLATE_EXAMPLE_AGENT);
|
|
9030
|
-
logger.success("Created .
|
|
9030
|
+
logger.success("Created .agentsmesh/agents/example.md");
|
|
9031
9031
|
await mkdirp(ab("skills/example"));
|
|
9032
9032
|
await writeFileAtomic(ab("skills/example/SKILL.md"), TEMPLATE_EXAMPLE_SKILL);
|
|
9033
|
-
logger.success("Created .
|
|
9033
|
+
logger.success("Created .agentsmesh/skills/example/SKILL.md");
|
|
9034
9034
|
await writeFileAtomic(ab("mcp.json"), TEMPLATE_MCP);
|
|
9035
|
-
logger.success("Created .
|
|
9035
|
+
logger.success("Created .agentsmesh/mcp.json");
|
|
9036
9036
|
await writeFileAtomic(ab("hooks.yaml"), TEMPLATE_HOOKS);
|
|
9037
|
-
logger.success("Created .
|
|
9037
|
+
logger.success("Created .agentsmesh/hooks.yaml");
|
|
9038
9038
|
await writeFileAtomic(ab("permissions.yaml"), TEMPLATE_PERMISSIONS);
|
|
9039
|
-
logger.success("Created .
|
|
9039
|
+
logger.success("Created .agentsmesh/permissions.yaml");
|
|
9040
9040
|
await writeFileAtomic(ab("ignore"), TEMPLATE_IGNORE);
|
|
9041
|
-
logger.success("Created .
|
|
9041
|
+
logger.success("Created .agentsmesh/ignore");
|
|
9042
9042
|
}
|
|
9043
9043
|
async function runInit(projectRoot, options = {}) {
|
|
9044
9044
|
const configPath = join54(projectRoot, CONFIG_FILENAME2);
|
|
@@ -9067,7 +9067,7 @@ async function runInit(projectRoot, options = {}) {
|
|
|
9067
9067
|
logger.success(`Created ${CONFIG_FILENAME2} (targets: ${existing.join(", ")})`);
|
|
9068
9068
|
} else {
|
|
9069
9069
|
logger.info(
|
|
9070
|
-
`Run '
|
|
9070
|
+
`Run 'agentsmesh init --yes' to auto-import, or 'agentsmesh import --from <tool>' manually.`
|
|
9071
9071
|
);
|
|
9072
9072
|
await writeScaffold(projectRoot);
|
|
9073
9073
|
await writeFileAtomic(configPath, buildConfig([]));
|
|
@@ -9091,7 +9091,7 @@ async function runImport(flags, projectRoot) {
|
|
|
9091
9091
|
const root = projectRoot ?? process.cwd();
|
|
9092
9092
|
const from = flags.from;
|
|
9093
9093
|
if (typeof from !== "string" || !from) {
|
|
9094
|
-
throw new Error("--from is required. Example:
|
|
9094
|
+
throw new Error("--from is required. Example: agentsmesh import --from claude-code");
|
|
9095
9095
|
}
|
|
9096
9096
|
const normalized = from.toLowerCase().trim();
|
|
9097
9097
|
if (!isBuiltinTargetId(normalized)) {
|
|
@@ -9108,7 +9108,7 @@ async function runImport(flags, projectRoot) {
|
|
|
9108
9108
|
logger.success(`${fromRel} \u2192 ${r.toPath}`);
|
|
9109
9109
|
}
|
|
9110
9110
|
logger.info(
|
|
9111
|
-
`Imported ${results.length} file(s). Run '
|
|
9111
|
+
`Imported ${results.length} file(s). Run 'agentsmesh generate' to sync to other tools.`
|
|
9112
9112
|
);
|
|
9113
9113
|
}
|
|
9114
9114
|
|
|
@@ -9250,7 +9250,7 @@ function lintMcp(canonical, target10) {
|
|
|
9250
9250
|
if (target10 === "cursor" && usesCursorSensitiveInterpolation(server)) {
|
|
9251
9251
|
diagnostics.push({
|
|
9252
9252
|
level: "warning",
|
|
9253
|
-
file: ".
|
|
9253
|
+
file: ".agentsmesh/mcp.json",
|
|
9254
9254
|
target: target10,
|
|
9255
9255
|
message: `MCP server "${name}" uses env vars or URL/header interpolation; Cursor handling may differ from canonical MCP.`
|
|
9256
9256
|
});
|
|
@@ -9258,7 +9258,7 @@ function lintMcp(canonical, target10) {
|
|
|
9258
9258
|
if (target10 === "codex-cli" && typeof server.description === "string" && server.description) {
|
|
9259
9259
|
diagnostics.push({
|
|
9260
9260
|
level: "warning",
|
|
9261
|
-
file: ".
|
|
9261
|
+
file: ".agentsmesh/mcp.json",
|
|
9262
9262
|
target: target10,
|
|
9263
9263
|
message: `MCP server "${name}" has a description, but codex-cli does not project MCP descriptions into .codex/config.toml.`
|
|
9264
9264
|
});
|
|
@@ -9266,7 +9266,7 @@ function lintMcp(canonical, target10) {
|
|
|
9266
9266
|
if (target10 === "codex-cli" && isUrlMcpServer(server)) {
|
|
9267
9267
|
diagnostics.push({
|
|
9268
9268
|
level: "warning",
|
|
9269
|
-
file: ".
|
|
9269
|
+
file: ".agentsmesh/mcp.json",
|
|
9270
9270
|
target: target10,
|
|
9271
9271
|
message: `MCP server "${name}" uses ${server.type} transport; codex-cli only generates stdio MCP servers.`
|
|
9272
9272
|
});
|
|
@@ -9274,7 +9274,7 @@ function lintMcp(canonical, target10) {
|
|
|
9274
9274
|
if (target10 === "junie" && isUrlMcpServer(server)) {
|
|
9275
9275
|
diagnostics.push({
|
|
9276
9276
|
level: "warning",
|
|
9277
|
-
file: ".
|
|
9277
|
+
file: ".agentsmesh/mcp.json",
|
|
9278
9278
|
target: target10,
|
|
9279
9279
|
message: `MCP server "${name}" uses ${server.type} transport; Junie project mcp.json currently documents stdio MCP servers only.`
|
|
9280
9280
|
});
|
|
@@ -9292,7 +9292,7 @@ function lintPermissions(canonical, target10) {
|
|
|
9292
9292
|
return [
|
|
9293
9293
|
{
|
|
9294
9294
|
level: "warning",
|
|
9295
|
-
file: ".
|
|
9295
|
+
file: ".agentsmesh/permissions.yaml",
|
|
9296
9296
|
target: target10,
|
|
9297
9297
|
message: "Cursor permissions are partial; tool-level allow/deny may lose fidelity."
|
|
9298
9298
|
}
|
|
@@ -9306,7 +9306,7 @@ function lintHooks(canonical, target10) {
|
|
|
9306
9306
|
const supported = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse", "Notification"]);
|
|
9307
9307
|
return Object.keys(canonical.hooks).filter((event) => !supported.has(event)).map((event) => ({
|
|
9308
9308
|
level: "warning",
|
|
9309
|
-
file: ".
|
|
9309
|
+
file: ".agentsmesh/hooks.yaml",
|
|
9310
9310
|
target: target10,
|
|
9311
9311
|
message: `${event} is not supported by gemini-cli; only PreToolUse, PostToolUse, and Notification are projected.`
|
|
9312
9312
|
}));
|
|
@@ -9315,7 +9315,7 @@ function lintHooks(canonical, target10) {
|
|
|
9315
9315
|
const supported = /* @__PURE__ */ new Set(["PreToolUse", "PostToolUse", "Notification", "UserPromptSubmit"]);
|
|
9316
9316
|
return Object.keys(canonical.hooks).filter((event) => !supported.has(event)).map((event) => ({
|
|
9317
9317
|
level: "warning",
|
|
9318
|
-
file: ".
|
|
9318
|
+
file: ".agentsmesh/hooks.yaml",
|
|
9319
9319
|
target: target10,
|
|
9320
9320
|
message: `${event} is not supported by Copilot hooks; only PreToolUse, PostToolUse, Notification, and UserPromptSubmit are projected.`
|
|
9321
9321
|
}));
|
|
@@ -9324,7 +9324,7 @@ function lintHooks(canonical, target10) {
|
|
|
9324
9324
|
}
|
|
9325
9325
|
|
|
9326
9326
|
// src/core/linter.ts
|
|
9327
|
-
var EXCLUDE_DIRS = ["node_modules", ".git", "dist", "coverage", ".
|
|
9327
|
+
var EXCLUDE_DIRS = ["node_modules", ".git", "dist", "coverage", ".agentsmesh"];
|
|
9328
9328
|
async function getProjectFiles(projectRoot) {
|
|
9329
9329
|
const all = await readDirRecursive(projectRoot);
|
|
9330
9330
|
const filtered = all.filter((p) => {
|
|
@@ -9402,7 +9402,7 @@ import chokidar from "chokidar";
|
|
|
9402
9402
|
var DEBOUNCE_MS = 300;
|
|
9403
9403
|
function shouldIgnoreWatchPath(configDir, changedPath) {
|
|
9404
9404
|
const relPath = relative18(configDir, changedPath).replace(/\\/g, "/");
|
|
9405
|
-
return relPath.endsWith(".
|
|
9405
|
+
return relPath.endsWith(".agentsmesh/.lock") || relPath.endsWith(".agentsmesh/.lock.tmp");
|
|
9406
9406
|
}
|
|
9407
9407
|
function featureFingerprint(features, rulesCount, commandsCount, agentsCount, skillsCount, mcpServerCount, permissionsCount, hooksCount, ignoreCount) {
|
|
9408
9408
|
return JSON.stringify({
|
|
@@ -9421,9 +9421,9 @@ async function runWatch(flags, projectRoot) {
|
|
|
9421
9421
|
const root = projectRoot ?? process.cwd();
|
|
9422
9422
|
const { configDir } = await loadConfigFromDir(root);
|
|
9423
9423
|
const paths = [
|
|
9424
|
-
join55(configDir, ".
|
|
9425
|
-
join55(configDir, "
|
|
9426
|
-
join55(configDir, "
|
|
9424
|
+
join55(configDir, ".agentsmesh"),
|
|
9425
|
+
join55(configDir, "agentsmesh.yaml"),
|
|
9426
|
+
join55(configDir, "agentsmesh.local.yaml")
|
|
9427
9427
|
];
|
|
9428
9428
|
let debounceTimer = null;
|
|
9429
9429
|
let lastFingerprint = null;
|
|
@@ -9484,7 +9484,7 @@ async function runWatch(flags, projectRoot) {
|
|
|
9484
9484
|
if (shouldIgnoreWatchPath(configDir, changedPath)) return;
|
|
9485
9485
|
schedule();
|
|
9486
9486
|
});
|
|
9487
|
-
logger.info("Watching .
|
|
9487
|
+
logger.info("Watching .agentsmesh/ and agentsmesh.yaml...");
|
|
9488
9488
|
pendingRun = run();
|
|
9489
9489
|
await pendingRun;
|
|
9490
9490
|
pendingRun = null;
|
|
@@ -9507,10 +9507,10 @@ async function runCheck(flags, projectRoot) {
|
|
|
9507
9507
|
void flags;
|
|
9508
9508
|
const root = projectRoot ?? process.cwd();
|
|
9509
9509
|
const { config, configDir } = await loadConfigFromDir(root);
|
|
9510
|
-
const abDir = join56(configDir, ".
|
|
9510
|
+
const abDir = join56(configDir, ".agentsmesh");
|
|
9511
9511
|
const lock = await readLock(abDir);
|
|
9512
9512
|
if (lock === null) {
|
|
9513
|
-
logger.error("Not initialized for collaboration. Run '
|
|
9513
|
+
logger.error("Not initialized for collaboration. Run 'agentsmesh generate' first.");
|
|
9514
9514
|
return 1;
|
|
9515
9515
|
}
|
|
9516
9516
|
const current = await buildChecksums(abDir);
|
|
@@ -9571,7 +9571,7 @@ async function runCheck(flags, projectRoot) {
|
|
|
9571
9571
|
logger.error(` ${p} was removed${suffix}`);
|
|
9572
9572
|
}
|
|
9573
9573
|
logger.info(
|
|
9574
|
-
"Run '
|
|
9574
|
+
"Run 'agentsmesh merge' to resolve, or 'agentsmesh generate --force' to accept current state."
|
|
9575
9575
|
);
|
|
9576
9576
|
return 1;
|
|
9577
9577
|
}
|
|
@@ -9615,7 +9615,7 @@ async function runMerge(flags, projectRoot) {
|
|
|
9615
9615
|
void flags;
|
|
9616
9616
|
const root = projectRoot ?? process.cwd();
|
|
9617
9617
|
const { config, configDir } = await loadConfigFromDir(root);
|
|
9618
|
-
const abDir = join58(configDir, ".
|
|
9618
|
+
const abDir = join58(configDir, ".agentsmesh");
|
|
9619
9619
|
const hasConflict = await hasLockConflict(abDir);
|
|
9620
9620
|
if (!hasConflict) {
|
|
9621
9621
|
logger.info("No conflicts to resolve.");
|
|
@@ -10127,7 +10127,7 @@ async function parseInstallSource(raw, configDir, explicitPath) {
|
|
|
10127
10127
|
if (!await exists(absLocal)) {
|
|
10128
10128
|
throw new Error(`Path does not exist: ${absLocal}`);
|
|
10129
10129
|
}
|
|
10130
|
-
const abMarker = `${sep2}.
|
|
10130
|
+
const abMarker = `${sep2}.agentsmesh${sep2}`;
|
|
10131
10131
|
const idx = absLocal.indexOf(abMarker);
|
|
10132
10132
|
if (idx >= 0) {
|
|
10133
10133
|
const root = absLocal.slice(0, idx);
|
|
@@ -10282,7 +10282,7 @@ function mergeExtendList(existing, incoming) {
|
|
|
10282
10282
|
|
|
10283
10283
|
// src/install/yaml-writer.ts
|
|
10284
10284
|
import { parse as parseYaml7, stringify } from "yaml";
|
|
10285
|
-
async function
|
|
10285
|
+
async function writeAgentsmeshWithNewExtend(configPath, currentConfig, entry) {
|
|
10286
10286
|
const content = await readFileSafe(configPath);
|
|
10287
10287
|
if (content === null) throw new Error(`Missing config: ${configPath}`);
|
|
10288
10288
|
const raw = parseYaml7(content);
|
|
@@ -10303,9 +10303,9 @@ async function writeInstallAsExtend(args) {
|
|
|
10303
10303
|
${JSON.stringify(entry, null, 2)}`);
|
|
10304
10304
|
return;
|
|
10305
10305
|
}
|
|
10306
|
-
const configPath = join59(configDir, "
|
|
10307
|
-
await
|
|
10308
|
-
logger.success(`Wrote extends entry "${entry.name}" to
|
|
10306
|
+
const configPath = join59(configDir, "agentsmesh.yaml");
|
|
10307
|
+
await writeAgentsmeshWithNewExtend(configPath, config, entry);
|
|
10308
|
+
logger.success(`Wrote extends entry "${entry.name}" to agentsmesh.yaml.`);
|
|
10309
10309
|
}
|
|
10310
10310
|
function toNewExtendEntry(args) {
|
|
10311
10311
|
return {
|
|
@@ -10568,7 +10568,7 @@ function sameInstallIdentity(a, b) {
|
|
|
10568
10568
|
return a.source === b.source && a.target === b.target && a.as === b.as && sameFeatures2(a.features, b.features);
|
|
10569
10569
|
}
|
|
10570
10570
|
function manifestPath(configDir) {
|
|
10571
|
-
return join62(configDir, ".
|
|
10571
|
+
return join62(configDir, ".agentsmesh", "installs.yaml");
|
|
10572
10572
|
}
|
|
10573
10573
|
async function readInstallManifest(configDir) {
|
|
10574
10574
|
const content = await readFileSafe(manifestPath(configDir));
|
|
@@ -10641,7 +10641,7 @@ async function installAsPack(args) {
|
|
|
10641
10641
|
manualAs,
|
|
10642
10642
|
renameExistingPack
|
|
10643
10643
|
} = args;
|
|
10644
|
-
const packsDir = join63(configDir, ".
|
|
10644
|
+
const packsDir = join63(configDir, ".agentsmesh", "packs");
|
|
10645
10645
|
const selectedCanonical = applySelection(narrowed, selected);
|
|
10646
10646
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
10647
10647
|
const parsedTarget = yamlTarget !== void 0 ? targetSchema.parse(yamlTarget) : void 0;
|
|
@@ -10688,7 +10688,7 @@ async function installAsPack(args) {
|
|
|
10688
10688
|
persistedPick = mergedMeta.pick;
|
|
10689
10689
|
persistedPath = mergedMeta.path;
|
|
10690
10690
|
persistedPaths = mergedMeta.paths;
|
|
10691
|
-
logger.success(`Updated pack "${mergedMeta.name}" in .
|
|
10691
|
+
logger.success(`Updated pack "${mergedMeta.name}" in .agentsmesh/packs/.`);
|
|
10692
10692
|
} else {
|
|
10693
10693
|
const collidingMeta = await readPackMetadata(join63(packsDir, packName));
|
|
10694
10694
|
if (collidingMeta) {
|
|
@@ -10709,7 +10709,7 @@ async function installAsPack(args) {
|
|
|
10709
10709
|
...pathScope(pathInRepo),
|
|
10710
10710
|
...manualAs !== void 0 && { as: manualAs }
|
|
10711
10711
|
});
|
|
10712
|
-
logger.success(`Installed pack "${packName}" to .
|
|
10712
|
+
logger.success(`Installed pack "${packName}" to .agentsmesh/packs/.`);
|
|
10713
10713
|
}
|
|
10714
10714
|
await upsertInstallManifestEntry(
|
|
10715
10715
|
configDir,
|
|
@@ -10736,12 +10736,12 @@ import { join as join64 } from "path";
|
|
|
10736
10736
|
async function syncInstalledPacks(args) {
|
|
10737
10737
|
const installs = await readInstallManifest(args.configDir);
|
|
10738
10738
|
if (installs.length === 0) {
|
|
10739
|
-
logger.info("No recorded installs found in .
|
|
10739
|
+
logger.info("No recorded installs found in .agentsmesh/installs.yaml.");
|
|
10740
10740
|
return;
|
|
10741
10741
|
}
|
|
10742
10742
|
const missing = [];
|
|
10743
10743
|
for (const entry of installs) {
|
|
10744
|
-
const packDir = join64(args.configDir, ".
|
|
10744
|
+
const packDir = join64(args.configDir, ".agentsmesh", "packs", entry.name);
|
|
10745
10745
|
if (!await exists(packDir)) {
|
|
10746
10746
|
missing.push(entry);
|
|
10747
10747
|
}
|
|
@@ -10753,7 +10753,7 @@ async function syncInstalledPacks(args) {
|
|
|
10753
10753
|
for (const entry of missing) {
|
|
10754
10754
|
await args.reinstall(entry);
|
|
10755
10755
|
}
|
|
10756
|
-
logger.success(`Reinstalled ${missing.length} pack(s) from .
|
|
10756
|
+
logger.success(`Reinstalled ${missing.length} pack(s) from .agentsmesh/installs.yaml.`);
|
|
10757
10757
|
}
|
|
10758
10758
|
async function maybeRunInstallSync(args) {
|
|
10759
10759
|
if (!args.sync) return false;
|
|
@@ -10923,9 +10923,9 @@ import { basename as basename41, dirname as dirname23, join as join65, relative
|
|
|
10923
10923
|
import { cp, mkdtemp, stat as stat5, rm as rm7 } from "fs/promises";
|
|
10924
10924
|
import { tmpdir } from "os";
|
|
10925
10925
|
async function createStageRoot() {
|
|
10926
|
-
const stageBase = await mkdtemp(join65(tmpdir(), "
|
|
10926
|
+
const stageBase = await mkdtemp(join65(tmpdir(), "am-install-manual-"));
|
|
10927
10927
|
const discoveryRoot = join65(stageBase, "repo");
|
|
10928
|
-
await mkdirp(join65(discoveryRoot, ".
|
|
10928
|
+
await mkdirp(join65(discoveryRoot, ".agentsmesh"));
|
|
10929
10929
|
return {
|
|
10930
10930
|
discoveryRoot,
|
|
10931
10931
|
cleanup: async () => {
|
|
@@ -11034,7 +11034,7 @@ async function stageSkills(sourceRoot, destinationDir, options = {}) {
|
|
|
11034
11034
|
async function stageManualInstallScope(sourceRoot, as, options = {}) {
|
|
11035
11035
|
const staged = await createStageRoot();
|
|
11036
11036
|
try {
|
|
11037
|
-
const destDir = join65(staged.discoveryRoot, ".
|
|
11037
|
+
const destDir = join65(staged.discoveryRoot, ".agentsmesh", as);
|
|
11038
11038
|
if (as === "skills") {
|
|
11039
11039
|
await stageSkills(sourceRoot, destDir, options);
|
|
11040
11040
|
} else {
|
|
@@ -11359,7 +11359,7 @@ function addUnique(target10, value) {
|
|
|
11359
11359
|
return next;
|
|
11360
11360
|
}
|
|
11361
11361
|
async function makeStageRoot(repoRoot) {
|
|
11362
|
-
const stageBase = await mkdtemp2(join69(tmpdir2(), "
|
|
11362
|
+
const stageBase = await mkdtemp2(join69(tmpdir2(), "am-install-native-"));
|
|
11363
11363
|
const stageRoot = join69(stageBase, "repo");
|
|
11364
11364
|
const cleanup = async () => {
|
|
11365
11365
|
await rm8(stageBase, { recursive: true, force: true });
|
|
@@ -11375,30 +11375,30 @@ async function makeStageRoot(repoRoot) {
|
|
|
11375
11375
|
function buildPickFromResults(results, stageRoot) {
|
|
11376
11376
|
let pick;
|
|
11377
11377
|
for (const result of results) {
|
|
11378
|
-
if (result.feature === "rules" && result.toPath.startsWith(".
|
|
11378
|
+
if (result.feature === "rules" && result.toPath.startsWith(".agentsmesh/rules/")) {
|
|
11379
11379
|
pick = {
|
|
11380
11380
|
...pick,
|
|
11381
11381
|
rules: addUnique(pick?.rules, basename45(result.toPath, ".md"))
|
|
11382
11382
|
};
|
|
11383
11383
|
continue;
|
|
11384
11384
|
}
|
|
11385
|
-
if (result.feature === "commands" && result.toPath.startsWith(".
|
|
11385
|
+
if (result.feature === "commands" && result.toPath.startsWith(".agentsmesh/commands/")) {
|
|
11386
11386
|
pick = {
|
|
11387
11387
|
...pick,
|
|
11388
11388
|
commands: addUnique(pick?.commands, basename45(result.toPath, ".md"))
|
|
11389
11389
|
};
|
|
11390
11390
|
continue;
|
|
11391
11391
|
}
|
|
11392
|
-
if (result.feature === "agents" && result.toPath.startsWith(".
|
|
11392
|
+
if (result.feature === "agents" && result.toPath.startsWith(".agentsmesh/agents/")) {
|
|
11393
11393
|
pick = {
|
|
11394
11394
|
...pick,
|
|
11395
11395
|
agents: addUnique(pick?.agents, basename45(result.toPath, ".md"))
|
|
11396
11396
|
};
|
|
11397
11397
|
continue;
|
|
11398
11398
|
}
|
|
11399
|
-
if (result.feature === "skills" && result.toPath.startsWith(".
|
|
11399
|
+
if (result.feature === "skills" && result.toPath.startsWith(".agentsmesh/skills/")) {
|
|
11400
11400
|
const rel2 = normalizePath3(
|
|
11401
|
-
relative24(join69(stageRoot, ".
|
|
11401
|
+
relative24(join69(stageRoot, ".agentsmesh", "skills"), join69(stageRoot, result.toPath))
|
|
11402
11402
|
);
|
|
11403
11403
|
const skillName = rel2.split("/")[0];
|
|
11404
11404
|
if (skillName) {
|
|
@@ -11458,8 +11458,8 @@ async function prepareInstallDiscovery(repoRoot, contentRoot, pathInRepo, option
|
|
|
11458
11458
|
}
|
|
11459
11459
|
const posixPath = pathInRepo.replace(/\\/g, "/").replace(/^\/+|\/+$/g, "");
|
|
11460
11460
|
validateTargetMatchesPath(explicitTarget, posixPath);
|
|
11461
|
-
const
|
|
11462
|
-
const hasAbRoot = await exists(
|
|
11461
|
+
const agentsmeshAtRoot = join70(repoRoot, ".agentsmesh");
|
|
11462
|
+
const hasAbRoot = await exists(agentsmeshAtRoot);
|
|
11463
11463
|
const pathHint = posixPath ? targetHintFromNativePath(posixPath) : void 0;
|
|
11464
11464
|
const detectedTarget = !hasAbRoot && !explicitTarget ? await detectNativeFormat(repoRoot) ?? void 0 : void 0;
|
|
11465
11465
|
if (!explicitTarget && pathHint && detectedTarget && pathHint !== detectedTarget) {
|
|
@@ -11468,7 +11468,7 @@ async function prepareInstallDiscovery(repoRoot, contentRoot, pathInRepo, option
|
|
|
11468
11468
|
);
|
|
11469
11469
|
}
|
|
11470
11470
|
const effectiveTarget = explicitTarget ?? pathHint ?? detectedTarget;
|
|
11471
|
-
const shouldStageNativeScope = Boolean(posixPath) && Boolean(effectiveTarget) && !posixPath.startsWith(".
|
|
11471
|
+
const shouldStageNativeScope = Boolean(posixPath) && Boolean(effectiveTarget) && !posixPath.startsWith(".agentsmesh");
|
|
11472
11472
|
if (!hasAbRoot && effectiveTarget) {
|
|
11473
11473
|
if (shouldStageNativeScope) {
|
|
11474
11474
|
const staged2 = await stageNativeInstallScope(repoRoot, posixPath, effectiveTarget);
|
|
@@ -11676,12 +11676,12 @@ async function runInstall(flags, args, projectRoot, replay) {
|
|
|
11676
11676
|
}
|
|
11677
11677
|
if (!sourceArg) {
|
|
11678
11678
|
throw new Error(
|
|
11679
|
-
"Missing source. Usage:
|
|
11679
|
+
"Missing source. Usage: agentsmesh install <source> [--path ...] [--target ...]"
|
|
11680
11680
|
);
|
|
11681
11681
|
}
|
|
11682
11682
|
const tty = process.stdin.isTTY;
|
|
11683
11683
|
if (!tty && !force && !dryRun) {
|
|
11684
|
-
throw new Error("Non-interactive terminal: use --force or --dry-run for
|
|
11684
|
+
throw new Error("Non-interactive terminal: use --force or --dry-run for agentsmesh install.");
|
|
11685
11685
|
}
|
|
11686
11686
|
const { config, configDir } = await loadConfigFromDir(projectRoot);
|
|
11687
11687
|
const parsed = await parseInstallSource(sourceArg, configDir, explicitPath);
|
|
@@ -11774,7 +11774,7 @@ async function runInstall(flags, args, projectRoot, replay) {
|
|
|
11774
11774
|
if (dryRun) return;
|
|
11775
11775
|
} else {
|
|
11776
11776
|
if (dryRun) {
|
|
11777
|
-
logger.info(`[dry-run] Would install pack "${entryName}" to .
|
|
11777
|
+
logger.info(`[dry-run] Would install pack "${entryName}" to .agentsmesh/packs/.`);
|
|
11778
11778
|
return;
|
|
11779
11779
|
}
|
|
11780
11780
|
await installAsPack({
|
|
@@ -11795,7 +11795,7 @@ async function runInstall(flags, args, projectRoot, replay) {
|
|
|
11795
11795
|
}
|
|
11796
11796
|
const genCode = await runGenerate({}, configDir);
|
|
11797
11797
|
if (genCode !== 0) {
|
|
11798
|
-
logger.warn("Generate failed after install. Fix the issue and run
|
|
11798
|
+
logger.warn("Generate failed after install. Fix the issue and run agentsmesh generate.");
|
|
11799
11799
|
}
|
|
11800
11800
|
} finally {
|
|
11801
11801
|
if (prep.cleanup) {
|
|
@@ -11925,7 +11925,7 @@ function isMainModule() {
|
|
|
11925
11925
|
const invokedResolved = resolve6(process.cwd(), invoked);
|
|
11926
11926
|
return invokedResolved === ourPath || realpathSync3(invokedResolved) === realpathSync3(ourPath);
|
|
11927
11927
|
} catch {
|
|
11928
|
-
return invoked.endsWith("cli.js") || invoked.includes("
|
|
11928
|
+
return invoked.endsWith("cli.js") || invoked.includes("agentsmesh");
|
|
11929
11929
|
}
|
|
11930
11930
|
}
|
|
11931
11931
|
if (isMainModule()) {
|