agentsmesh 0.22.0 → 0.23.0
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 +187 -0
- package/README.md +68 -18
- package/dist/canonical.d.ts +2 -2
- package/dist/canonical.js +317 -44
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +270 -259
- package/dist/engine.d.ts +5 -2
- package/dist/engine.js +1290 -145
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2783 -600
- package/dist/index.js.map +1 -1
- package/dist/init-YKxF2zpQ.d.ts +494 -0
- package/dist/lessons.d.ts +88 -137
- package/dist/lessons.js +2680 -221
- package/dist/lessons.js.map +1 -1
- package/dist/{schema-CLmR2JOb.d.ts → schema-CzaoYJlG.d.ts} +9 -1
- package/dist/{target-descriptor-CkLWz3Xk.d.ts → target-descriptor-D6vLDI1w.d.ts} +62 -2
- package/dist/targets.d.ts +3 -3
- package/dist/targets.js +271 -30
- package/dist/targets.js.map +1 -1
- package/package.json +1 -3
- package/schemas/installs.json +12 -0
package/dist/canonical.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { join, basename, dirname, relative, extname, resolve, posix, win32 } from 'path';
|
|
2
2
|
import { access, readdir, readFile, realpath, stat, rm, mkdir, lstat, unlink, writeFile, rename, chmod, mkdtemp, cp } from 'fs/promises';
|
|
3
|
+
import { setTimeout } from 'timers/promises';
|
|
3
4
|
import { constants, existsSync, realpathSync, statSync } from 'fs';
|
|
4
5
|
import { stringify, parse } from 'yaml';
|
|
5
6
|
import { z } from 'zod';
|
|
@@ -220,6 +221,27 @@ var init_fs_traverse = __esm({
|
|
|
220
221
|
MAX_SEGMENT_REPETITIONS = 3;
|
|
221
222
|
}
|
|
222
223
|
});
|
|
224
|
+
async function renameWithRetry(from, to, options = {}) {
|
|
225
|
+
const attempts = options.attempts ?? 5;
|
|
226
|
+
const delayMs = options.delayMs ?? 50;
|
|
227
|
+
for (let attempt = 0; ; attempt++) {
|
|
228
|
+
try {
|
|
229
|
+
await rename(from, to);
|
|
230
|
+
return;
|
|
231
|
+
} catch (err) {
|
|
232
|
+
const code = err.code;
|
|
233
|
+
const transient = code !== void 0 && TRANSIENT_RENAME_CODES.has(code);
|
|
234
|
+
if (!transient || attempt >= attempts - 1) throw err;
|
|
235
|
+
await setTimeout(delayMs * 2 ** attempt);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
var TRANSIENT_RENAME_CODES;
|
|
240
|
+
var init_rename_retry = __esm({
|
|
241
|
+
"src/utils/filesystem/rename-retry.ts"() {
|
|
242
|
+
TRANSIENT_RENAME_CODES = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY", "ENOTEMPTY", "EEXIST"]);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
223
245
|
async function readFileSafe(path) {
|
|
224
246
|
try {
|
|
225
247
|
const data = await readFile(path, "utf-8");
|
|
@@ -306,6 +328,7 @@ var init_fs = __esm({
|
|
|
306
328
|
init_fs_text_encoding();
|
|
307
329
|
init_fs_traverse();
|
|
308
330
|
init_fs_text_encoding();
|
|
331
|
+
init_rename_retry();
|
|
309
332
|
}
|
|
310
333
|
});
|
|
311
334
|
function parseFrontmatter(content) {
|
|
@@ -487,7 +510,7 @@ function validateCapabilityImplementations(descriptor31, capabilities17, ctx, pa
|
|
|
487
510
|
});
|
|
488
511
|
}
|
|
489
512
|
}
|
|
490
|
-
var capabilityLevelSchema, capabilitiesSchema, generatorsSchema, pathResolversSchema, layoutSchema, globalSupportSchema, legacyGlobalKeys, generatorRequirements, settingsBackedFeatures, conversionDefaultsSchema, metadataSchema, targetDescriptorSchemaBase;
|
|
513
|
+
var capabilityLevelSchema, capabilitiesSchema, generatorsSchema, pathResolversSchema, layoutSchema, globalSupportSchema, legacyGlobalKeys, generatorRequirements, settingsBackedFeatures, conversionDefaultsSchema, metadataSchema, nativePickStrategySchema, nativeInstallSchema, targetDescriptorSchemaBase;
|
|
491
514
|
var init_target_descriptor_schema = __esm({
|
|
492
515
|
"src/targets/catalog/target-descriptor.schema.ts"() {
|
|
493
516
|
capabilityLevelSchema = z.union([
|
|
@@ -561,6 +584,22 @@ var init_target_descriptor_schema = __esm({
|
|
|
561
584
|
officialUrl: z.string().min(1),
|
|
562
585
|
shortDescription: z.string().min(1)
|
|
563
586
|
}).passthrough();
|
|
587
|
+
nativePickStrategySchema = z.discriminatedUnion("kind", [
|
|
588
|
+
z.object({ kind: z.literal("basename"), suffix: z.string().min(1) }),
|
|
589
|
+
z.object({ kind: z.literal("skillDir") }),
|
|
590
|
+
z.object({ kind: z.literal("firstSegment") })
|
|
591
|
+
]);
|
|
592
|
+
nativeInstallSchema = z.object({
|
|
593
|
+
pickPaths: z.array(
|
|
594
|
+
z.object({
|
|
595
|
+
prefix: z.string().min(1),
|
|
596
|
+
feature: z.enum(["commands", "rules", "agents", "skills"]),
|
|
597
|
+
strategy: nativePickStrategySchema
|
|
598
|
+
})
|
|
599
|
+
).optional(),
|
|
600
|
+
inferPick: z.function().optional(),
|
|
601
|
+
dialectHints: z.array(z.object({ frontmatterKey: z.string().min(1) })).optional()
|
|
602
|
+
}).strict();
|
|
564
603
|
targetDescriptorSchemaBase = z.object({
|
|
565
604
|
id: z.string().regex(/^[a-z][a-z0-9-]*$/, "Target id must be lowercase with hyphens"),
|
|
566
605
|
metadata: metadataSchema,
|
|
@@ -572,6 +611,7 @@ var init_target_descriptor_schema = __esm({
|
|
|
572
611
|
globalSupport: globalSupportSchema.optional(),
|
|
573
612
|
buildImportPaths: z.function(),
|
|
574
613
|
detectionPaths: z.array(z.string()),
|
|
614
|
+
nativeInstall: nativeInstallSchema.optional(),
|
|
575
615
|
excludeFromStarterInit: z.boolean().optional(),
|
|
576
616
|
conversionDefaults: conversionDefaultsSchema.optional(),
|
|
577
617
|
emitScopedSettings: z.function().optional(),
|
|
@@ -2010,9 +2050,8 @@ function shouldRewritePathToken(fullContent, start, end, matchText, rewriteBareP
|
|
|
2010
2050
|
const before = fullContent[start - 1];
|
|
2011
2051
|
const after = fullContent[end];
|
|
2012
2052
|
if (isMarkdownReferenceDefinitionDestination(fullContent, start, candidateEnd)) return true;
|
|
2013
|
-
if (before === "
|
|
2014
|
-
|
|
2015
|
-
}
|
|
2053
|
+
if (before === "`" && after === "`") return true;
|
|
2054
|
+
if (before === "'" && after === "'" || before === '"' && after === '"') return false;
|
|
2016
2055
|
if (before === "<" && after === ">") return true;
|
|
2017
2056
|
if (before === "[" && after === "]") {
|
|
2018
2057
|
if (!rewriteBarePathTokens && !isRootRelativePathToken(normalizedCandidate) && markdownBracketLabelDuplicatesDestination(fullContent, start, matchText)) {
|
|
@@ -3260,12 +3299,12 @@ var init_augment_code = __esm({
|
|
|
3260
3299
|
});
|
|
3261
3300
|
|
|
3262
3301
|
// src/targets/claude-code/constants.ts
|
|
3263
|
-
var CLAUDE_CODE_TARGET, CLAUDE_ROOT,
|
|
3302
|
+
var CLAUDE_CODE_TARGET, CLAUDE_ROOT, CLAUDE_NESTED_ROOT, CLAUDE_RULES_DIR, CLAUDE_COMMANDS_DIR, CLAUDE_AGENTS_DIR, CLAUDE_SKILLS_DIR, CLAUDE_SETTINGS, CLAUDE_HOOKS_JSON, CLAUDE_OUTPUT_STYLES_DIR, CLAUDE_IGNORE, CLAUDE_MCP_JSON, CLAUDE_GLOBAL_MCP_JSON, CLAUDE_CANONICAL_RULES_DIR, CLAUDE_CANONICAL_COMMANDS_DIR, CLAUDE_CANONICAL_AGENTS_DIR, CLAUDE_CANONICAL_SKILLS_DIR, CLAUDE_CANONICAL_MCP, CLAUDE_CANONICAL_PERMISSIONS, CLAUDE_CANONICAL_HOOKS, CLAUDE_CANONICAL_IGNORE;
|
|
3264
3303
|
var init_constants7 = __esm({
|
|
3265
3304
|
"src/targets/claude-code/constants.ts"() {
|
|
3266
3305
|
CLAUDE_CODE_TARGET = "claude-code";
|
|
3267
|
-
CLAUDE_ROOT = "
|
|
3268
|
-
|
|
3306
|
+
CLAUDE_ROOT = "CLAUDE.md";
|
|
3307
|
+
CLAUDE_NESTED_ROOT = ".claude/CLAUDE.md";
|
|
3269
3308
|
CLAUDE_RULES_DIR = ".claude/rules";
|
|
3270
3309
|
CLAUDE_COMMANDS_DIR = ".claude/commands";
|
|
3271
3310
|
CLAUDE_AGENTS_DIR = ".claude/agents";
|
|
@@ -5127,7 +5166,8 @@ var init_amp2 = __esm({
|
|
|
5127
5166
|
markAsRoot: true
|
|
5128
5167
|
}
|
|
5129
5168
|
},
|
|
5130
|
-
emitScopedSettings(canonical, _scope) {
|
|
5169
|
+
emitScopedSettings(canonical, _scope, enabledFeatures) {
|
|
5170
|
+
if (!enabledFeatures.has("mcp")) return [];
|
|
5131
5171
|
if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
|
|
5132
5172
|
return [
|
|
5133
5173
|
{
|
|
@@ -5879,12 +5919,12 @@ function mergeAugmentSettings(existing, newContent) {
|
|
|
5879
5919
|
if (overlay.hooks !== void 0) base.hooks = overlay.hooks;
|
|
5880
5920
|
return JSON.stringify(base, null, 2);
|
|
5881
5921
|
}
|
|
5882
|
-
function buildSettingsContent(canonical) {
|
|
5922
|
+
function buildSettingsContent(canonical, enabledFeatures) {
|
|
5883
5923
|
const settings = {};
|
|
5884
|
-
if (canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
|
|
5924
|
+
if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
|
|
5885
5925
|
settings.mcpServers = canonical.mcp.mcpServers;
|
|
5886
5926
|
}
|
|
5887
|
-
if (canonical.hooks && Object.keys(canonical.hooks).length > 0) {
|
|
5927
|
+
if (enabledFeatures.has("hooks") && canonical.hooks && Object.keys(canonical.hooks).length > 0) {
|
|
5888
5928
|
settings.hooks = serializeHooksForSettings(canonical.hooks);
|
|
5889
5929
|
}
|
|
5890
5930
|
if (Object.keys(settings).length === 0) return null;
|
|
@@ -6013,8 +6053,8 @@ var init_augment_code2 = __esm({
|
|
|
6013
6053
|
],
|
|
6014
6054
|
layout: globalLayout5
|
|
6015
6055
|
},
|
|
6016
|
-
emitScopedSettings(canonical) {
|
|
6017
|
-
const content = buildSettingsContent(canonical);
|
|
6056
|
+
emitScopedSettings(canonical, _scope, enabledFeatures) {
|
|
6057
|
+
const content = buildSettingsContent(canonical, enabledFeatures);
|
|
6018
6058
|
if (content === null) return [];
|
|
6019
6059
|
return [{ path: AUGMENT_CODE_SETTINGS_FILE, content }];
|
|
6020
6060
|
},
|
|
@@ -6562,7 +6602,10 @@ var init_claude_code2 = __esm({
|
|
|
6562
6602
|
skillDir: ".claude/skills",
|
|
6563
6603
|
managedOutputs: {
|
|
6564
6604
|
dirs: [".claude/agents", ".claude/commands", ".claude/rules", ".claude/skills"],
|
|
6565
|
-
|
|
6605
|
+
// CLAUDE_NESTED_ROOT is the pre-migration project location; listing it here lets
|
|
6606
|
+
// `cleanupStaleGeneratedOutputs` evict a leftover `.claude/CLAUDE.md` once generation
|
|
6607
|
+
// writes the root `CLAUDE.md`, so Claude Code never concatenates both into context.
|
|
6608
|
+
files: [CLAUDE_ROOT, CLAUDE_NESTED_ROOT, ".claude/settings.json", ".claudeignore", ".mcp.json"]
|
|
6566
6609
|
},
|
|
6567
6610
|
paths: {
|
|
6568
6611
|
rulePath(slug, _rule) {
|
|
@@ -6577,7 +6620,7 @@ var init_claude_code2 = __esm({
|
|
|
6577
6620
|
}
|
|
6578
6621
|
};
|
|
6579
6622
|
globalLayout6 = {
|
|
6580
|
-
rootInstructionPath:
|
|
6623
|
+
rootInstructionPath: CLAUDE_NESTED_ROOT,
|
|
6581
6624
|
skillDir: ".claude/skills",
|
|
6582
6625
|
renderPrimaryRootInstruction: renderClaudeGlobalPrimaryInstructions,
|
|
6583
6626
|
managedOutputs: {
|
|
@@ -6590,7 +6633,7 @@ var init_claude_code2 = __esm({
|
|
|
6590
6633
|
".agents/skills"
|
|
6591
6634
|
],
|
|
6592
6635
|
files: [
|
|
6593
|
-
|
|
6636
|
+
CLAUDE_NESTED_ROOT,
|
|
6594
6637
|
".claude/settings.json",
|
|
6595
6638
|
CLAUDE_GLOBAL_MCP_JSON,
|
|
6596
6639
|
CLAUDE_HOOKS_JSON,
|
|
@@ -6598,6 +6641,7 @@ var init_claude_code2 = __esm({
|
|
|
6598
6641
|
]
|
|
6599
6642
|
},
|
|
6600
6643
|
rewriteGeneratedPath(path) {
|
|
6644
|
+
if (path === CLAUDE_ROOT) return CLAUDE_NESTED_ROOT;
|
|
6601
6645
|
if (path === CLAUDE_MCP_JSON) return CLAUDE_GLOBAL_MCP_JSON;
|
|
6602
6646
|
return path;
|
|
6603
6647
|
},
|
|
@@ -6661,10 +6705,11 @@ var init_claude_code2 = __esm({
|
|
|
6661
6705
|
importer: {
|
|
6662
6706
|
rules: [
|
|
6663
6707
|
{
|
|
6664
|
-
// Root rule:
|
|
6708
|
+
// Root rule: project prefers root CLAUDE.md, falls back to nested .claude/CLAUDE.md;
|
|
6709
|
+
// global reads the nested .claude/CLAUDE.md.
|
|
6665
6710
|
feature: "rules",
|
|
6666
6711
|
mode: "singleFile",
|
|
6667
|
-
source: { project: [CLAUDE_ROOT,
|
|
6712
|
+
source: { project: [CLAUDE_ROOT, CLAUDE_NESTED_ROOT], global: [CLAUDE_NESTED_ROOT] },
|
|
6668
6713
|
canonicalDir: CLAUDE_CANONICAL_RULES_DIR,
|
|
6669
6714
|
canonicalRootFilename: "_root.md",
|
|
6670
6715
|
markAsRoot: true
|
|
@@ -6710,7 +6755,23 @@ var init_claude_code2 = __esm({
|
|
|
6710
6755
|
}
|
|
6711
6756
|
},
|
|
6712
6757
|
buildImportPaths: buildClaudeCodeImportPaths,
|
|
6713
|
-
detectionPaths: [
|
|
6758
|
+
detectionPaths: [CLAUDE_ROOT, CLAUDE_NESTED_ROOT, ".claude/rules", ".claude/commands"],
|
|
6759
|
+
nativeInstall: {
|
|
6760
|
+
pickPaths: [
|
|
6761
|
+
{
|
|
6762
|
+
prefix: ".claude/commands",
|
|
6763
|
+
feature: "commands",
|
|
6764
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
6765
|
+
},
|
|
6766
|
+
{ prefix: ".claude/rules", feature: "rules", strategy: { kind: "basename", suffix: ".md" } },
|
|
6767
|
+
{
|
|
6768
|
+
prefix: ".claude/agents",
|
|
6769
|
+
feature: "agents",
|
|
6770
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
6771
|
+
},
|
|
6772
|
+
{ prefix: ".claude/skills/", feature: "skills", strategy: { kind: "firstSegment" } }
|
|
6773
|
+
]
|
|
6774
|
+
}
|
|
6714
6775
|
};
|
|
6715
6776
|
}
|
|
6716
6777
|
});
|
|
@@ -7589,6 +7650,16 @@ var init_cline2 = __esm({
|
|
|
7589
7650
|
},
|
|
7590
7651
|
buildImportPaths: buildClineImportPaths,
|
|
7591
7652
|
detectionPaths: [".clinerules", ".cline"],
|
|
7653
|
+
nativeInstall: {
|
|
7654
|
+
pickPaths: [
|
|
7655
|
+
{ prefix: CLINE_SKILLS_DIR, feature: "skills", strategy: { kind: "skillDir" } },
|
|
7656
|
+
{
|
|
7657
|
+
prefix: CLINE_WORKFLOWS_DIR,
|
|
7658
|
+
feature: "commands",
|
|
7659
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
7660
|
+
}
|
|
7661
|
+
]
|
|
7662
|
+
},
|
|
7592
7663
|
conversionDefaults: { agentsToSkills: true }
|
|
7593
7664
|
};
|
|
7594
7665
|
}
|
|
@@ -8507,6 +8578,11 @@ var init_codex_cli2 = __esm({
|
|
|
8507
8578
|
".codex/agents",
|
|
8508
8579
|
".codex/rules"
|
|
8509
8580
|
],
|
|
8581
|
+
nativeInstall: {
|
|
8582
|
+
pickPaths: [
|
|
8583
|
+
{ prefix: ".codex", feature: "rules", strategy: { kind: "basename", suffix: ".md" } }
|
|
8584
|
+
]
|
|
8585
|
+
},
|
|
8510
8586
|
excludeFromStarterInit: true,
|
|
8511
8587
|
conversionDefaults: { commandsToSkills: true, agentsToSkills: false }
|
|
8512
8588
|
};
|
|
@@ -9010,6 +9086,21 @@ var init_continue2 = __esm({
|
|
|
9010
9086
|
},
|
|
9011
9087
|
buildImportPaths: buildContinueImportPaths,
|
|
9012
9088
|
detectionPaths: [".continue/rules", ".continue/skills", ".continue/mcpServers"],
|
|
9089
|
+
nativeInstall: {
|
|
9090
|
+
pickPaths: [
|
|
9091
|
+
{
|
|
9092
|
+
prefix: ".continue/rules",
|
|
9093
|
+
feature: "rules",
|
|
9094
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
9095
|
+
},
|
|
9096
|
+
{
|
|
9097
|
+
prefix: ".continue/prompts",
|
|
9098
|
+
feature: "commands",
|
|
9099
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
9100
|
+
},
|
|
9101
|
+
{ prefix: ".continue/skills", feature: "skills", strategy: { kind: "skillDir" } }
|
|
9102
|
+
]
|
|
9103
|
+
},
|
|
9013
9104
|
conversionDefaults: { agentsToSkills: true }
|
|
9014
9105
|
};
|
|
9015
9106
|
}
|
|
@@ -9377,6 +9468,80 @@ var init_importer10 = __esm({
|
|
|
9377
9468
|
init_copilot2();
|
|
9378
9469
|
}
|
|
9379
9470
|
});
|
|
9471
|
+
async function skillNamesFromNativeSkillDir(scanRoot) {
|
|
9472
|
+
const files = await readDirRecursive(scanRoot);
|
|
9473
|
+
const names = /* @__PURE__ */ new Set();
|
|
9474
|
+
for (const f of files) {
|
|
9475
|
+
if (basename(f) === "SKILL.md") {
|
|
9476
|
+
names.add(basename(dirname(f)));
|
|
9477
|
+
continue;
|
|
9478
|
+
}
|
|
9479
|
+
const rel2 = relative(scanRoot, f).replace(/\\/g, "/");
|
|
9480
|
+
if (!rel2.includes("/") && f.toLowerCase().endsWith(".md")) {
|
|
9481
|
+
names.add(basename(f, ".md"));
|
|
9482
|
+
}
|
|
9483
|
+
}
|
|
9484
|
+
return [...names].filter(Boolean).sort();
|
|
9485
|
+
}
|
|
9486
|
+
var init_native_skill_scan = __esm({
|
|
9487
|
+
"src/install/native/native-skill-scan.ts"() {
|
|
9488
|
+
init_fs();
|
|
9489
|
+
}
|
|
9490
|
+
});
|
|
9491
|
+
async function inferCopilotPickFromPath(repoRoot, posixPath) {
|
|
9492
|
+
const scan = join(repoRoot, ...posixPath.split("/"));
|
|
9493
|
+
if (posixPath.startsWith(COPILOT_PROMPTS_DIR)) {
|
|
9494
|
+
const files = await readDirRecursive(scan);
|
|
9495
|
+
const commands = [
|
|
9496
|
+
...new Set(
|
|
9497
|
+
files.filter((f) => f.toLowerCase().endsWith(".prompt.md")).map((f) => basename(f, ".prompt.md"))
|
|
9498
|
+
)
|
|
9499
|
+
].sort();
|
|
9500
|
+
return commands.length ? { commands } : {};
|
|
9501
|
+
}
|
|
9502
|
+
if (posixPath.startsWith(".github/copilot") && !posixPath.includes("copilot-instructions.md")) {
|
|
9503
|
+
const files = await readDirRecursive(scan);
|
|
9504
|
+
const rules = [
|
|
9505
|
+
...new Set(
|
|
9506
|
+
files.filter((f) => f.includes(".instructions.md")).map((f) => basename(f).replace(/\.instructions\.md$/i, ""))
|
|
9507
|
+
)
|
|
9508
|
+
].sort();
|
|
9509
|
+
return rules.length ? { rules } : {};
|
|
9510
|
+
}
|
|
9511
|
+
if (posixPath.startsWith(".github/instructions")) {
|
|
9512
|
+
const files = await readDirRecursive(scan);
|
|
9513
|
+
const names = /* @__PURE__ */ new Set();
|
|
9514
|
+
for (const f of files) {
|
|
9515
|
+
const b = basename(f);
|
|
9516
|
+
if (b.toLowerCase().endsWith(".instructions.md"))
|
|
9517
|
+
names.add(b.replace(/\.instructions\.md$/i, ""));
|
|
9518
|
+
else if (b.toLowerCase().endsWith(".md")) names.add(basename(f, ".md"));
|
|
9519
|
+
}
|
|
9520
|
+
const rules = [...names].sort();
|
|
9521
|
+
return rules.length ? { rules } : {};
|
|
9522
|
+
}
|
|
9523
|
+
if (posixPath.startsWith(".github/skills")) {
|
|
9524
|
+
const skills = await skillNamesFromNativeSkillDir(scan);
|
|
9525
|
+
return skills.length ? { skills } : {};
|
|
9526
|
+
}
|
|
9527
|
+
if (posixPath.startsWith(".github/agents")) {
|
|
9528
|
+
const files = await readDirRecursive(scan);
|
|
9529
|
+
const agents = [
|
|
9530
|
+
...new Set(
|
|
9531
|
+
files.filter((f) => f.toLowerCase().endsWith(".agent.md")).map((f) => basename(f, ".agent.md"))
|
|
9532
|
+
)
|
|
9533
|
+
].sort();
|
|
9534
|
+
return agents.length ? { agents } : {};
|
|
9535
|
+
}
|
|
9536
|
+
return {};
|
|
9537
|
+
}
|
|
9538
|
+
var init_native_path_pick_infer_copilot = __esm({
|
|
9539
|
+
"src/install/native/native-path-pick-infer-copilot.ts"() {
|
|
9540
|
+
init_fs();
|
|
9541
|
+
init_constants29();
|
|
9542
|
+
init_native_skill_scan();
|
|
9543
|
+
}
|
|
9544
|
+
});
|
|
9380
9545
|
function pruneUndefined3(record) {
|
|
9381
9546
|
for (const key of Object.keys(record)) {
|
|
9382
9547
|
if (record[key] === void 0) delete record[key];
|
|
@@ -9666,6 +9831,7 @@ var init_copilot2 = __esm({
|
|
|
9666
9831
|
init_generator11();
|
|
9667
9832
|
init_constants29();
|
|
9668
9833
|
init_importer10();
|
|
9834
|
+
init_native_path_pick_infer_copilot();
|
|
9669
9835
|
init_import_mappers4();
|
|
9670
9836
|
init_linter10();
|
|
9671
9837
|
init_import_map_builders();
|
|
@@ -9880,7 +10046,8 @@ var init_copilot2 = __esm({
|
|
|
9880
10046
|
".github/skills",
|
|
9881
10047
|
".github/agents",
|
|
9882
10048
|
".github/hooks"
|
|
9883
|
-
]
|
|
10049
|
+
],
|
|
10050
|
+
nativeInstall: { inferPick: inferCopilotPickFromPath }
|
|
9884
10051
|
};
|
|
9885
10052
|
}
|
|
9886
10053
|
});
|
|
@@ -11380,6 +11547,23 @@ var init_cursor2 = __esm({
|
|
|
11380
11547
|
},
|
|
11381
11548
|
buildImportPaths: buildCursorImportPaths,
|
|
11382
11549
|
detectionPaths: [".cursor/rules", ".cursor/mcp.json"],
|
|
11550
|
+
nativeInstall: {
|
|
11551
|
+
pickPaths: [
|
|
11552
|
+
{ prefix: ".cursor/rules", feature: "rules", strategy: { kind: "basename", suffix: ".mdc" } },
|
|
11553
|
+
{
|
|
11554
|
+
prefix: ".cursor/commands",
|
|
11555
|
+
feature: "commands",
|
|
11556
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
11557
|
+
},
|
|
11558
|
+
{
|
|
11559
|
+
prefix: ".cursor/agents",
|
|
11560
|
+
feature: "agents",
|
|
11561
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
11562
|
+
},
|
|
11563
|
+
{ prefix: ".cursor/skills", feature: "skills", strategy: { kind: "skillDir" } }
|
|
11564
|
+
],
|
|
11565
|
+
dialectHints: [{ frontmatterKey: "alwaysApply" }]
|
|
11566
|
+
},
|
|
11383
11567
|
preservesManualActivation: true
|
|
11384
11568
|
};
|
|
11385
11569
|
}
|
|
@@ -12141,18 +12325,18 @@ function mapHookEvent2(event) {
|
|
|
12141
12325
|
return null;
|
|
12142
12326
|
}
|
|
12143
12327
|
}
|
|
12144
|
-
function generateGeminiSettingsFiles(canonical) {
|
|
12328
|
+
function generateGeminiSettingsFiles(canonical, enabledFeatures) {
|
|
12145
12329
|
const settings = {};
|
|
12146
12330
|
let hasAnyNativeSettings = false;
|
|
12147
|
-
if (canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
|
|
12331
|
+
if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
|
|
12148
12332
|
settings.mcpServers = canonical.mcp.mcpServers;
|
|
12149
12333
|
hasAnyNativeSettings = true;
|
|
12150
12334
|
}
|
|
12151
|
-
if (canonical.agents.length > 0) {
|
|
12335
|
+
if (enabledFeatures.has("agents") && canonical.agents.length > 0) {
|
|
12152
12336
|
settings.experimental = { enableAgents: true };
|
|
12153
12337
|
hasAnyNativeSettings = true;
|
|
12154
12338
|
}
|
|
12155
|
-
if (canonical.hooks) {
|
|
12339
|
+
if (enabledFeatures.has("hooks") && canonical.hooks) {
|
|
12156
12340
|
const hookEntries = Object.entries(canonical.hooks).flatMap(([event, entries]) => {
|
|
12157
12341
|
const mappedEvent = mapHookEvent2(event);
|
|
12158
12342
|
if (!mappedEvent || !Array.isArray(entries)) return [];
|
|
@@ -12768,6 +12952,36 @@ var init_importer15 = __esm({
|
|
|
12768
12952
|
init_importer_skills_agents();
|
|
12769
12953
|
}
|
|
12770
12954
|
});
|
|
12955
|
+
function isUnderGeminiCommands(pathInRepoPosix) {
|
|
12956
|
+
const p = pathInRepoPosix.replace(/^\/+|\/+$/g, "");
|
|
12957
|
+
return p === ".gemini/commands" || p.startsWith(".gemini/commands/");
|
|
12958
|
+
}
|
|
12959
|
+
async function inferGeminiCommandNamesFromFiles(repoRoot, pathInRepoPosix) {
|
|
12960
|
+
const commandsRoot = join(repoRoot, ...GEMINI_COMMANDS_DIR.split("/"));
|
|
12961
|
+
const scanDir = join(repoRoot, ...pathInRepoPosix.split("/"));
|
|
12962
|
+
const files = await readDirRecursive(scanDir);
|
|
12963
|
+
const names = [];
|
|
12964
|
+
for (const f of files) {
|
|
12965
|
+
if (!/\.(toml|md)$/i.test(f)) continue;
|
|
12966
|
+
const rel2 = relative(commandsRoot, f).replace(/\\/g, "/");
|
|
12967
|
+
if (rel2.startsWith("..") || rel2 === "") continue;
|
|
12968
|
+
const noExt = rel2.replace(/\.(toml|md)$/i, "");
|
|
12969
|
+
const name = noExt.split("/").filter(Boolean).join(":");
|
|
12970
|
+
if (name) names.push(name);
|
|
12971
|
+
}
|
|
12972
|
+
return [...new Set(names)].sort();
|
|
12973
|
+
}
|
|
12974
|
+
async function inferGeminiPick(repoRoot, posixPath) {
|
|
12975
|
+
if (!isUnderGeminiCommands(posixPath)) return {};
|
|
12976
|
+
const commands = await inferGeminiCommandNamesFromFiles(repoRoot, posixPath);
|
|
12977
|
+
return commands.length ? { commands } : {};
|
|
12978
|
+
}
|
|
12979
|
+
var init_gemini_install_commands = __esm({
|
|
12980
|
+
"src/install/native/gemini-install-commands.ts"() {
|
|
12981
|
+
init_fs();
|
|
12982
|
+
init_constants30();
|
|
12983
|
+
}
|
|
12984
|
+
});
|
|
12771
12985
|
async function mapGeminiRuleFile(relativePath, destDir, normalizeTo) {
|
|
12772
12986
|
const relativeMdPath = relativePath.replace(/\\/g, "/");
|
|
12773
12987
|
const destPath = join(destDir, relativeMdPath);
|
|
@@ -12879,12 +13093,12 @@ var init_lint12 = __esm({
|
|
|
12879
13093
|
});
|
|
12880
13094
|
|
|
12881
13095
|
// src/targets/gemini-cli/scoped-settings-emit.ts
|
|
12882
|
-
function emitScopedGeminiSettings(canonical, scope) {
|
|
13096
|
+
function emitScopedGeminiSettings(canonical, scope, enabledFeatures) {
|
|
12883
13097
|
if (scope === "project") {
|
|
12884
13098
|
const caps = getTargetCapabilities("gemini-cli", scope);
|
|
12885
13099
|
if (caps?.ignore.flavor !== "settings-embedded") return [];
|
|
12886
13100
|
}
|
|
12887
|
-
return generateGeminiSettingsFiles(canonical);
|
|
13101
|
+
return generateGeminiSettingsFiles(canonical, enabledFeatures);
|
|
12888
13102
|
}
|
|
12889
13103
|
var init_scoped_settings_emit = __esm({
|
|
12890
13104
|
"src/targets/gemini-cli/scoped-settings-emit.ts"() {
|
|
@@ -12902,6 +13116,7 @@ var init_gemini_cli2 = __esm({
|
|
|
12902
13116
|
init_policies_generator();
|
|
12903
13117
|
init_constants30();
|
|
12904
13118
|
init_importer15();
|
|
13119
|
+
init_gemini_install_commands();
|
|
12905
13120
|
init_import_mappers6();
|
|
12906
13121
|
init_linter15();
|
|
12907
13122
|
init_import_map_builders();
|
|
@@ -13097,6 +13312,7 @@ var init_gemini_cli2 = __esm({
|
|
|
13097
13312
|
},
|
|
13098
13313
|
buildImportPaths: buildGeminiCliImportPaths,
|
|
13099
13314
|
detectionPaths: ["GEMINI.md", ".gemini"],
|
|
13315
|
+
nativeInstall: { inferPick: inferGeminiPick },
|
|
13100
13316
|
conversionDefaults: { agentsToSkills: false }
|
|
13101
13317
|
};
|
|
13102
13318
|
}
|
|
@@ -13938,7 +14154,23 @@ var init_junie2 = __esm({
|
|
|
13938
14154
|
".junie/skills",
|
|
13939
14155
|
".junie/mcp/mcp.json",
|
|
13940
14156
|
".aiignore"
|
|
13941
|
-
]
|
|
14157
|
+
],
|
|
14158
|
+
nativeInstall: {
|
|
14159
|
+
pickPaths: [
|
|
14160
|
+
{
|
|
14161
|
+
prefix: ".junie/commands",
|
|
14162
|
+
feature: "commands",
|
|
14163
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
14164
|
+
},
|
|
14165
|
+
{ prefix: ".junie/rules", feature: "rules", strategy: { kind: "basename", suffix: ".md" } },
|
|
14166
|
+
{
|
|
14167
|
+
prefix: ".junie/agents",
|
|
14168
|
+
feature: "agents",
|
|
14169
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
14170
|
+
},
|
|
14171
|
+
{ prefix: ".junie/skills", feature: "skills", strategy: { kind: "skillDir" } }
|
|
14172
|
+
]
|
|
14173
|
+
}
|
|
13942
14174
|
};
|
|
13943
14175
|
}
|
|
13944
14176
|
});
|
|
@@ -18288,6 +18520,16 @@ var init_windsurf2 = __esm({
|
|
|
18288
18520
|
},
|
|
18289
18521
|
buildImportPaths: buildWindsurfImportPaths,
|
|
18290
18522
|
detectionPaths: [".windsurfrules", ".windsurf"],
|
|
18523
|
+
nativeInstall: {
|
|
18524
|
+
pickPaths: [
|
|
18525
|
+
{
|
|
18526
|
+
prefix: ".windsurf/rules",
|
|
18527
|
+
feature: "rules",
|
|
18528
|
+
strategy: { kind: "basename", suffix: ".md" }
|
|
18529
|
+
}
|
|
18530
|
+
],
|
|
18531
|
+
dialectHints: [{ frontmatterKey: "trigger" }]
|
|
18532
|
+
},
|
|
18291
18533
|
conversionDefaults: { agentsToSkills: true }
|
|
18292
18534
|
};
|
|
18293
18535
|
}
|
|
@@ -18562,7 +18804,8 @@ var init_zed2 = __esm({
|
|
|
18562
18804
|
markAsRoot: true
|
|
18563
18805
|
}
|
|
18564
18806
|
},
|
|
18565
|
-
emitScopedSettings(canonical, _scope) {
|
|
18807
|
+
emitScopedSettings(canonical, _scope, enabledFeatures) {
|
|
18808
|
+
if (!enabledFeatures.has("mcp")) return [];
|
|
18566
18809
|
if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
|
|
18567
18810
|
const contextServers = {};
|
|
18568
18811
|
for (const [name, server] of Object.entries(canonical.mcp.mcpServers)) {
|
|
@@ -18617,7 +18860,10 @@ function getBuiltinTargetDefinition(target31) {
|
|
|
18617
18860
|
function getTargetCapabilities(target31, scope = "project") {
|
|
18618
18861
|
const descriptor31 = getBuiltinTargetDefinition(target31) ?? getDescriptor(target31);
|
|
18619
18862
|
if (!descriptor31) return void 0;
|
|
18620
|
-
|
|
18863
|
+
if (scope === "global" && !descriptor31.globalSupport) {
|
|
18864
|
+
return normalizeTargetCapabilities(ALL_NONE_CAPABILITIES);
|
|
18865
|
+
}
|
|
18866
|
+
const raw = scope === "global" ? descriptor31.globalSupport.capabilities : descriptor31.capabilities;
|
|
18621
18867
|
return normalizeTargetCapabilities(raw);
|
|
18622
18868
|
}
|
|
18623
18869
|
function getTargetDetectionPaths(target31, scope = "project") {
|
|
@@ -18673,6 +18919,7 @@ function isConversionUpgrading(descriptor31, feature, config, scope) {
|
|
|
18673
18919
|
function getEffectiveTargetSupportLevel(target31, feature, config, scope = "project") {
|
|
18674
18920
|
const baseLevel = getTargetCapabilities(target31, scope)?.[feature]?.level ?? "none";
|
|
18675
18921
|
const descriptor31 = getBuiltinTargetDefinition(target31) ?? getDescriptor(target31);
|
|
18922
|
+
if (scope === "global" && descriptor31 && !descriptor31.globalSupport) return "none";
|
|
18676
18923
|
if (baseLevel === "none" && isConversionUpgrading(descriptor31, feature, config, scope)) {
|
|
18677
18924
|
return "embedded";
|
|
18678
18925
|
}
|
|
@@ -18686,7 +18933,7 @@ function resolveTargetFeatureGenerator(target31, feature, config, scope = "proje
|
|
|
18686
18933
|
const pick = PICK_FEATURE_GENERATOR[feature];
|
|
18687
18934
|
return pick === null ? void 0 : pick(descriptor31.generators);
|
|
18688
18935
|
}
|
|
18689
|
-
var BUILTIN_TARGETS, _builtinTargetsMap, PICK_FEATURE_GENERATOR;
|
|
18936
|
+
var ALL_NONE_CAPABILITIES, BUILTIN_TARGETS, _builtinTargetsMap, PICK_FEATURE_GENERATOR;
|
|
18690
18937
|
var init_builtin_targets = __esm({
|
|
18691
18938
|
"src/targets/catalog/builtin-targets.ts"() {
|
|
18692
18939
|
init_conversions();
|
|
@@ -18724,6 +18971,17 @@ var init_builtin_targets = __esm({
|
|
|
18724
18971
|
init_warp2();
|
|
18725
18972
|
init_windsurf2();
|
|
18726
18973
|
init_zed2();
|
|
18974
|
+
ALL_NONE_CAPABILITIES = {
|
|
18975
|
+
rules: "none",
|
|
18976
|
+
additionalRules: "none",
|
|
18977
|
+
commands: "none",
|
|
18978
|
+
agents: "none",
|
|
18979
|
+
skills: "none",
|
|
18980
|
+
mcp: "none",
|
|
18981
|
+
hooks: "none",
|
|
18982
|
+
ignore: "none",
|
|
18983
|
+
permissions: "none"
|
|
18984
|
+
};
|
|
18727
18985
|
BUILTIN_TARGETS = [
|
|
18728
18986
|
descriptor,
|
|
18729
18987
|
descriptor2,
|
|
@@ -18818,7 +19076,7 @@ async function fetchGitRemoteExtend(parsed, extendName, options, cacheDir, build
|
|
|
18818
19076
|
await cloneRepo(resolveCloneUrl(parsed), stagedRepoDir);
|
|
18819
19077
|
if (parsed.ref) await checkoutRef(stagedRepoDir, parsed.ref);
|
|
18820
19078
|
await rm(cacheRoot, { recursive: true, force: true });
|
|
18821
|
-
await
|
|
19079
|
+
await renameWithRetry(stagedRoot, cacheRoot);
|
|
18822
19080
|
return readCachedRepo(cacheRepoDir);
|
|
18823
19081
|
} catch (err) {
|
|
18824
19082
|
await rm(stagedRoot, { recursive: true, force: true });
|
|
@@ -19380,6 +19638,23 @@ function assertNoBasenameCollisions(feature, paths, stripExt) {
|
|
|
19380
19638
|
}
|
|
19381
19639
|
}
|
|
19382
19640
|
|
|
19641
|
+
// src/utils/output/color.ts
|
|
19642
|
+
function noColorRequested() {
|
|
19643
|
+
const value = process.env.NO_COLOR;
|
|
19644
|
+
return value !== void 0 && value !== "";
|
|
19645
|
+
}
|
|
19646
|
+
function forceColorRequested() {
|
|
19647
|
+
const value = process.env.FORCE_COLOR;
|
|
19648
|
+
if (value === void 0) return void 0;
|
|
19649
|
+
return value !== "0" && value !== "false";
|
|
19650
|
+
}
|
|
19651
|
+
function colorEnabled(stream = process.stdout) {
|
|
19652
|
+
const forced = forceColorRequested();
|
|
19653
|
+
if (forced !== void 0) return forced;
|
|
19654
|
+
if (noColorRequested()) return false;
|
|
19655
|
+
return stream.isTTY === true;
|
|
19656
|
+
}
|
|
19657
|
+
|
|
19383
19658
|
// src/utils/output/logger.ts
|
|
19384
19659
|
var C = {
|
|
19385
19660
|
green: "\x1B[32m",
|
|
@@ -19388,16 +19663,14 @@ var C = {
|
|
|
19388
19663
|
cyan: "\x1B[36m",
|
|
19389
19664
|
reset: "\x1B[0m"
|
|
19390
19665
|
};
|
|
19391
|
-
function
|
|
19392
|
-
|
|
19393
|
-
process.stdout.write(text);
|
|
19394
|
-
}
|
|
19666
|
+
function outStream() {
|
|
19667
|
+
return process.stdout;
|
|
19395
19668
|
}
|
|
19396
|
-
function
|
|
19397
|
-
|
|
19669
|
+
function out(text) {
|
|
19670
|
+
outStream().write(text);
|
|
19398
19671
|
}
|
|
19399
|
-
function c(code, text) {
|
|
19400
|
-
return
|
|
19672
|
+
function c(code, text, stream) {
|
|
19673
|
+
return colorEnabled(stream) ? `${code}${text}${C.reset}` : text;
|
|
19401
19674
|
}
|
|
19402
19675
|
function pad(str, width) {
|
|
19403
19676
|
const len = [...str].length;
|
|
@@ -19405,20 +19678,20 @@ function pad(str, width) {
|
|
|
19405
19678
|
}
|
|
19406
19679
|
var logger = {
|
|
19407
19680
|
info(msg) {
|
|
19408
|
-
out(c(C.cyan, msg) + "\n");
|
|
19681
|
+
out(c(C.cyan, msg, outStream()) + "\n");
|
|
19409
19682
|
},
|
|
19410
19683
|
warn(msg) {
|
|
19411
|
-
process.stderr.write(c(C.yellow, "\u26A0 ") + msg + "\n");
|
|
19684
|
+
process.stderr.write(c(C.yellow, "\u26A0 ", process.stderr) + msg + "\n");
|
|
19412
19685
|
},
|
|
19413
19686
|
error(msg) {
|
|
19414
|
-
process.stderr.write(c(C.red, "\u2717 ") + msg + "\n");
|
|
19687
|
+
process.stderr.write(c(C.red, "\u2717 ", process.stderr) + msg + "\n");
|
|
19415
19688
|
},
|
|
19416
19689
|
success(msg) {
|
|
19417
|
-
out(c(C.green, "\u2713 ") + msg + "\n");
|
|
19690
|
+
out(c(C.green, "\u2713 ", outStream()) + msg + "\n");
|
|
19418
19691
|
},
|
|
19419
19692
|
debug(msg) {
|
|
19420
19693
|
if (process.env.AGENTSMESH_DEBUG === "1") {
|
|
19421
|
-
out(c(C.cyan, "[debug] ") + msg + "\n");
|
|
19694
|
+
out(c(C.cyan, "[debug] ", outStream()) + msg + "\n");
|
|
19422
19695
|
}
|
|
19423
19696
|
},
|
|
19424
19697
|
table(rows) {
|