agentsmesh 0.21.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/dist/targets.js CHANGED
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  import { stringify, parse } from 'yaml';
3
3
  import { basename, join, win32, posix, relative, dirname, extname } from 'path';
4
4
  import { readFile, readdir, stat, mkdir, lstat, unlink, writeFile, rename, chmod, rm, realpath, access } from 'fs/promises';
5
+ import 'timers/promises';
5
6
  import { existsSync, realpathSync, constants, statSync } from 'fs';
6
7
  import { parse as parse$1 } from 'smol-toml';
7
8
  import { Buffer } from 'buffer';
@@ -38,7 +39,7 @@ function validateCapabilityImplementations(descriptor31, capabilities17, ctx, pa
38
39
  function validateDescriptor(value) {
39
40
  return targetDescriptorSchema.parse(value);
40
41
  }
41
- var capabilityLevelSchema, capabilitiesSchema, generatorsSchema, pathResolversSchema, layoutSchema, globalSupportSchema, legacyGlobalKeys, generatorRequirements, settingsBackedFeatures, conversionDefaultsSchema, metadataSchema, targetDescriptorSchemaBase, targetDescriptorSchema;
42
+ var capabilityLevelSchema, capabilitiesSchema, generatorsSchema, pathResolversSchema, layoutSchema, globalSupportSchema, legacyGlobalKeys, generatorRequirements, settingsBackedFeatures, conversionDefaultsSchema, metadataSchema, nativePickStrategySchema, nativeInstallSchema, targetDescriptorSchemaBase, targetDescriptorSchema;
42
43
  var init_target_descriptor_schema = __esm({
43
44
  "src/targets/catalog/target-descriptor.schema.ts"() {
44
45
  capabilityLevelSchema = z.union([
@@ -112,6 +113,22 @@ var init_target_descriptor_schema = __esm({
112
113
  officialUrl: z.string().min(1),
113
114
  shortDescription: z.string().min(1)
114
115
  }).passthrough();
116
+ nativePickStrategySchema = z.discriminatedUnion("kind", [
117
+ z.object({ kind: z.literal("basename"), suffix: z.string().min(1) }),
118
+ z.object({ kind: z.literal("skillDir") }),
119
+ z.object({ kind: z.literal("firstSegment") })
120
+ ]);
121
+ nativeInstallSchema = z.object({
122
+ pickPaths: z.array(
123
+ z.object({
124
+ prefix: z.string().min(1),
125
+ feature: z.enum(["commands", "rules", "agents", "skills"]),
126
+ strategy: nativePickStrategySchema
127
+ })
128
+ ).optional(),
129
+ inferPick: z.function().optional(),
130
+ dialectHints: z.array(z.object({ frontmatterKey: z.string().min(1) })).optional()
131
+ }).strict();
115
132
  targetDescriptorSchemaBase = z.object({
116
133
  id: z.string().regex(/^[a-z][a-z0-9-]*$/, "Target id must be lowercase with hyphens"),
117
134
  metadata: metadataSchema,
@@ -123,6 +140,7 @@ var init_target_descriptor_schema = __esm({
123
140
  globalSupport: globalSupportSchema.optional(),
124
141
  buildImportPaths: z.function(),
125
142
  detectionPaths: z.array(z.string()),
143
+ nativeInstall: nativeInstallSchema.optional(),
126
144
  excludeFromStarterInit: z.boolean().optional(),
127
145
  conversionDefaults: conversionDefaultsSchema.optional(),
128
146
  emitScopedSettings: z.function().optional(),
@@ -675,6 +693,10 @@ var init_fs_traverse = __esm({
675
693
  MAX_SEGMENT_REPETITIONS = 3;
676
694
  }
677
695
  });
696
+ var init_rename_retry = __esm({
697
+ "src/utils/filesystem/rename-retry.ts"() {
698
+ }
699
+ });
678
700
  async function readFileSafe(path) {
679
701
  try {
680
702
  const data = await readFile(path, "utf-8");
@@ -761,6 +783,7 @@ var init_fs = __esm({
761
783
  init_fs_text_encoding();
762
784
  init_fs_traverse();
763
785
  init_fs_text_encoding();
786
+ init_rename_retry();
764
787
  }
765
788
  });
766
789
  function escapeRegExp(value) {
@@ -885,7 +908,7 @@ ${legacy}`, "");
885
908
  }
886
909
  return result.trim();
887
910
  }
888
- var ROOT_INSTRUCTION_BODY_V1, ROOT_INSTRUCTION_BODY_V2, ROOT_INSTRUCTION_BODY_V3, ROOT_INSTRUCTION_BODY_V4, ROOT_INSTRUCTION_BODY_V5, ROOT_INSTRUCTION_BODY_V6, ROOT_INSTRUCTION_BODY_V7, ROOT_INSTRUCTION_BODY_V8, ROOT_INSTRUCTION_BODY, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_SECTION, AGENTSMESH_CONTRACT_WITH_V1_BODY, AGENTSMESH_CONTRACT_WITH_V2_BODY, AGENTSMESH_CONTRACT_WITH_V3_BODY, AGENTSMESH_CONTRACT_WITH_V4_BODY, AGENTSMESH_CONTRACT_WITH_V5_BODY, AGENTSMESH_CONTRACT_WITH_V6_BODY, AGENTSMESH_CONTRACT_WITH_V7_BODY, AGENTSMESH_CONTRACT_WITH_V8_BODY, AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_FORMS;
911
+ var ROOT_INSTRUCTION_BODY_V1, ROOT_INSTRUCTION_BODY_V2, ROOT_INSTRUCTION_BODY_V3, ROOT_INSTRUCTION_BODY_V4, ROOT_INSTRUCTION_BODY_V5, ROOT_INSTRUCTION_BODY_V6, ROOT_INSTRUCTION_BODY_V7, ROOT_INSTRUCTION_BODY_V8, ROOT_INSTRUCTION_BODY_V9, ROOT_INSTRUCTION_BODY_V10, ROOT_INSTRUCTION_BODY, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_AGENTSMESH_ROOT_INSTRUCTION_SECTION, AGENTSMESH_CONTRACT_WITH_V1_BODY, AGENTSMESH_CONTRACT_WITH_V2_BODY, AGENTSMESH_CONTRACT_WITH_V3_BODY, AGENTSMESH_CONTRACT_WITH_V4_BODY, AGENTSMESH_CONTRACT_WITH_V5_BODY, AGENTSMESH_CONTRACT_WITH_V6_BODY, AGENTSMESH_CONTRACT_WITH_V7_BODY, AGENTSMESH_CONTRACT_WITH_V8_BODY, AGENTSMESH_CONTRACT_WITH_V9_BODY, AGENTSMESH_CONTRACT_WITH_V10_BODY, AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH, LEGACY_FORMS;
889
912
  var init_root_instruction_paragraph = __esm({
890
913
  "src/targets/projection/root-instruction-paragraph.ts"() {
891
914
  init_managed_blocks();
@@ -897,7 +920,9 @@ var init_root_instruction_paragraph = __esm({
897
920
  ROOT_INSTRUCTION_BODY_V6 = "Create canonical files in `.agentsmesh`: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Then run `agentsmesh generate`.";
898
921
  ROOT_INSTRUCTION_BODY_V7 = "`.agentsmesh` is the only folder you edit or add these files in: `rules/_root.md` and `rules/*.md` are Markdown rules; `commands/*.md`, `agents/*.md`, and `skills/*/SKILL.md` plus supporting files use Claude-style frontmatter Markdown; `mcp.json` is MCP JSON; `hooks.yaml` and `permissions.yaml` are YAML; `ignore` is gitignore-style text. Do not edit generated tool files; run `agentsmesh generate`.";
899
922
  ROOT_INSTRUCTION_BODY_V8 = "`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, and `merge` as needed; never edit generated tool files.";
900
- ROOT_INSTRUCTION_BODY = "`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, `merge`, and `refresh` as needed; never edit generated tool files.";
923
+ ROOT_INSTRUCTION_BODY_V9 = "`agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, `merge`, and `refresh` as needed; never edit generated tool files.";
924
+ ROOT_INSTRUCTION_BODY_V10 = "**MUST follow when changing any rule, agent, command, skill, hook, MCP server, permission, or ignore pattern.** `agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally), and `.agentsmesh` is the only place to add or edit canonical items: `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, `merge`, and `refresh` as needed; never edit generated tool files.";
925
+ ROOT_INSTRUCTION_BODY = "**NEVER edit generated files** (`.claude/`, `.cursor/`, `AGENTS.md`, `.github/copilot-instructions.md`, and similar target outputs) \u2014 `agentsmesh generate` overwrites them. **All changes MUST go through `.agentsmesh` first**: edit `rules/_root.md`, `rules/*.md`, `commands/*.md`, `agents/*.md`, `skills/*/SKILL.md` plus supporting files, `mcp.json`, `hooks.yaml`, `permissions.yaml`, and `ignore`; `agentsmesh.yaml` selects targets/features (`agentsmesh.local.yaml` overrides locally); if missing run `agentsmesh init`, use `agentsmesh import --from <tool>` for native configs, `agentsmesh install <source>` or `install --sync` for reusable packs, then run `agentsmesh generate`. Use `diff`, `lint`, `check`, `watch`, `matrix`, `merge`, and `refresh` as needed.";
901
926
  LEGACY_AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH = ROOT_INSTRUCTION_BODY_V1;
902
927
  LEGACY_AGENTSMESH_ROOT_INSTRUCTION_SECTION = `## Project-Specific Rules
903
928
 
@@ -926,12 +951,20 @@ ${ROOT_INSTRUCTION_BODY_V7}`;
926
951
  AGENTSMESH_CONTRACT_WITH_V8_BODY = `## AgentsMesh Generation Contract
927
952
 
928
953
  ${ROOT_INSTRUCTION_BODY_V8}`;
954
+ AGENTSMESH_CONTRACT_WITH_V9_BODY = `## AgentsMesh Generation Contract
955
+
956
+ ${ROOT_INSTRUCTION_BODY_V9}`;
957
+ AGENTSMESH_CONTRACT_WITH_V10_BODY = `## AgentsMesh Generation Contract
958
+
959
+ ${ROOT_INSTRUCTION_BODY_V10}`;
929
960
  AGENTSMESH_ROOT_INSTRUCTION_PARAGRAPH = `${ROOT_CONTRACT_START}
930
961
  ## AgentsMesh Generation Contract
931
962
 
932
963
  ${ROOT_INSTRUCTION_BODY}
933
964
  ${ROOT_CONTRACT_END}`;
934
965
  LEGACY_FORMS = [
966
+ AGENTSMESH_CONTRACT_WITH_V10_BODY,
967
+ AGENTSMESH_CONTRACT_WITH_V9_BODY,
935
968
  AGENTSMESH_CONTRACT_WITH_V8_BODY,
936
969
  AGENTSMESH_CONTRACT_WITH_V7_BODY,
937
970
  AGENTSMESH_CONTRACT_WITH_V6_BODY,
@@ -1835,9 +1868,8 @@ function shouldRewritePathToken(fullContent, start, end, matchText, rewriteBareP
1835
1868
  const before = fullContent[start - 1];
1836
1869
  const after = fullContent[end];
1837
1870
  if (isMarkdownReferenceDefinitionDestination(fullContent, start, candidateEnd)) return true;
1838
- if (before === "'" && after === "'" || before === '"' && after === '"' || before === "`" && after === "`") {
1839
- return true;
1840
- }
1871
+ if (before === "`" && after === "`") return true;
1872
+ if (before === "'" && after === "'" || before === '"' && after === '"') return false;
1841
1873
  if (before === "<" && after === ">") return true;
1842
1874
  if (before === "[" && after === "]") {
1843
1875
  if (!rewriteBarePathTokens && !isRootRelativePathToken(normalizedCandidate) && markdownBracketLabelDuplicatesDestination(fullContent, start, matchText)) {
@@ -3134,12 +3166,12 @@ var init_augment_code = __esm({
3134
3166
  });
3135
3167
 
3136
3168
  // src/targets/claude-code/constants.ts
3137
- var CLAUDE_CODE_TARGET, CLAUDE_ROOT, CLAUDE_LEGACY_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;
3169
+ 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;
3138
3170
  var init_constants7 = __esm({
3139
3171
  "src/targets/claude-code/constants.ts"() {
3140
3172
  CLAUDE_CODE_TARGET = "claude-code";
3141
- CLAUDE_ROOT = ".claude/CLAUDE.md";
3142
- CLAUDE_LEGACY_ROOT = "CLAUDE.md";
3173
+ CLAUDE_ROOT = "CLAUDE.md";
3174
+ CLAUDE_NESTED_ROOT = ".claude/CLAUDE.md";
3143
3175
  CLAUDE_RULES_DIR = ".claude/rules";
3144
3176
  CLAUDE_COMMANDS_DIR = ".claude/commands";
3145
3177
  CLAUDE_AGENTS_DIR = ".claude/agents";
@@ -5001,7 +5033,8 @@ var init_amp2 = __esm({
5001
5033
  markAsRoot: true
5002
5034
  }
5003
5035
  },
5004
- emitScopedSettings(canonical, _scope) {
5036
+ emitScopedSettings(canonical, _scope, enabledFeatures) {
5037
+ if (!enabledFeatures.has("mcp")) return [];
5005
5038
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
5006
5039
  return [
5007
5040
  {
@@ -5753,12 +5786,12 @@ function mergeAugmentSettings(existing, newContent) {
5753
5786
  if (overlay.hooks !== void 0) base.hooks = overlay.hooks;
5754
5787
  return JSON.stringify(base, null, 2);
5755
5788
  }
5756
- function buildSettingsContent(canonical) {
5789
+ function buildSettingsContent(canonical, enabledFeatures) {
5757
5790
  const settings = {};
5758
- if (canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
5791
+ if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
5759
5792
  settings.mcpServers = canonical.mcp.mcpServers;
5760
5793
  }
5761
- if (canonical.hooks && Object.keys(canonical.hooks).length > 0) {
5794
+ if (enabledFeatures.has("hooks") && canonical.hooks && Object.keys(canonical.hooks).length > 0) {
5762
5795
  settings.hooks = serializeHooksForSettings(canonical.hooks);
5763
5796
  }
5764
5797
  if (Object.keys(settings).length === 0) return null;
@@ -5887,8 +5920,8 @@ var init_augment_code2 = __esm({
5887
5920
  ],
5888
5921
  layout: globalLayout5
5889
5922
  },
5890
- emitScopedSettings(canonical) {
5891
- const content = buildSettingsContent(canonical);
5923
+ emitScopedSettings(canonical, _scope, enabledFeatures) {
5924
+ const content = buildSettingsContent(canonical, enabledFeatures);
5892
5925
  if (content === null) return [];
5893
5926
  return [{ path: AUGMENT_CODE_SETTINGS_FILE, content }];
5894
5927
  },
@@ -6462,7 +6495,10 @@ var init_claude_code2 = __esm({
6462
6495
  skillDir: ".claude/skills",
6463
6496
  managedOutputs: {
6464
6497
  dirs: [".claude/agents", ".claude/commands", ".claude/rules", ".claude/skills"],
6465
- files: [".claude/CLAUDE.md", ".claude/settings.json", ".claudeignore", ".mcp.json"]
6498
+ // CLAUDE_NESTED_ROOT is the pre-migration project location; listing it here lets
6499
+ // `cleanupStaleGeneratedOutputs` evict a leftover `.claude/CLAUDE.md` once generation
6500
+ // writes the root `CLAUDE.md`, so Claude Code never concatenates both into context.
6501
+ files: [CLAUDE_ROOT, CLAUDE_NESTED_ROOT, ".claude/settings.json", ".claudeignore", ".mcp.json"]
6466
6502
  },
6467
6503
  paths: {
6468
6504
  rulePath(slug, _rule) {
@@ -6477,7 +6513,7 @@ var init_claude_code2 = __esm({
6477
6513
  }
6478
6514
  };
6479
6515
  globalLayout6 = {
6480
- rootInstructionPath: CLAUDE_ROOT,
6516
+ rootInstructionPath: CLAUDE_NESTED_ROOT,
6481
6517
  skillDir: ".claude/skills",
6482
6518
  renderPrimaryRootInstruction: renderClaudeGlobalPrimaryInstructions,
6483
6519
  managedOutputs: {
@@ -6490,7 +6526,7 @@ var init_claude_code2 = __esm({
6490
6526
  ".agents/skills"
6491
6527
  ],
6492
6528
  files: [
6493
- ".claude/CLAUDE.md",
6529
+ CLAUDE_NESTED_ROOT,
6494
6530
  ".claude/settings.json",
6495
6531
  CLAUDE_GLOBAL_MCP_JSON,
6496
6532
  CLAUDE_HOOKS_JSON,
@@ -6498,6 +6534,7 @@ var init_claude_code2 = __esm({
6498
6534
  ]
6499
6535
  },
6500
6536
  rewriteGeneratedPath(path) {
6537
+ if (path === CLAUDE_ROOT) return CLAUDE_NESTED_ROOT;
6501
6538
  if (path === CLAUDE_MCP_JSON) return CLAUDE_GLOBAL_MCP_JSON;
6502
6539
  return path;
6503
6540
  },
@@ -6561,10 +6598,11 @@ var init_claude_code2 = __esm({
6561
6598
  importer: {
6562
6599
  rules: [
6563
6600
  {
6564
- // Root rule: prefer .claude/CLAUDE.md, fall back to legacy CLAUDE.md (project only).
6601
+ // Root rule: project prefers root CLAUDE.md, falls back to nested .claude/CLAUDE.md;
6602
+ // global reads the nested .claude/CLAUDE.md.
6565
6603
  feature: "rules",
6566
6604
  mode: "singleFile",
6567
- source: { project: [CLAUDE_ROOT, CLAUDE_LEGACY_ROOT], global: [CLAUDE_ROOT] },
6605
+ source: { project: [CLAUDE_ROOT, CLAUDE_NESTED_ROOT], global: [CLAUDE_NESTED_ROOT] },
6568
6606
  canonicalDir: CLAUDE_CANONICAL_RULES_DIR,
6569
6607
  canonicalRootFilename: "_root.md",
6570
6608
  markAsRoot: true
@@ -6610,7 +6648,23 @@ var init_claude_code2 = __esm({
6610
6648
  }
6611
6649
  },
6612
6650
  buildImportPaths: buildClaudeCodeImportPaths,
6613
- detectionPaths: ["CLAUDE.md", ".claude/rules", ".claude/commands"]
6651
+ detectionPaths: [CLAUDE_ROOT, CLAUDE_NESTED_ROOT, ".claude/rules", ".claude/commands"],
6652
+ nativeInstall: {
6653
+ pickPaths: [
6654
+ {
6655
+ prefix: ".claude/commands",
6656
+ feature: "commands",
6657
+ strategy: { kind: "basename", suffix: ".md" }
6658
+ },
6659
+ { prefix: ".claude/rules", feature: "rules", strategy: { kind: "basename", suffix: ".md" } },
6660
+ {
6661
+ prefix: ".claude/agents",
6662
+ feature: "agents",
6663
+ strategy: { kind: "basename", suffix: ".md" }
6664
+ },
6665
+ { prefix: ".claude/skills/", feature: "skills", strategy: { kind: "firstSegment" } }
6666
+ ]
6667
+ }
6614
6668
  };
6615
6669
  }
6616
6670
  });
@@ -7489,6 +7543,16 @@ var init_cline2 = __esm({
7489
7543
  },
7490
7544
  buildImportPaths: buildClineImportPaths,
7491
7545
  detectionPaths: [".clinerules", ".cline"],
7546
+ nativeInstall: {
7547
+ pickPaths: [
7548
+ { prefix: CLINE_SKILLS_DIR, feature: "skills", strategy: { kind: "skillDir" } },
7549
+ {
7550
+ prefix: CLINE_WORKFLOWS_DIR,
7551
+ feature: "commands",
7552
+ strategy: { kind: "basename", suffix: ".md" }
7553
+ }
7554
+ ]
7555
+ },
7492
7556
  conversionDefaults: { agentsToSkills: true }
7493
7557
  };
7494
7558
  }
@@ -8407,6 +8471,11 @@ var init_codex_cli2 = __esm({
8407
8471
  ".codex/agents",
8408
8472
  ".codex/rules"
8409
8473
  ],
8474
+ nativeInstall: {
8475
+ pickPaths: [
8476
+ { prefix: ".codex", feature: "rules", strategy: { kind: "basename", suffix: ".md" } }
8477
+ ]
8478
+ },
8410
8479
  excludeFromStarterInit: true,
8411
8480
  conversionDefaults: { commandsToSkills: true, agentsToSkills: false }
8412
8481
  };
@@ -8910,6 +8979,21 @@ var init_continue2 = __esm({
8910
8979
  },
8911
8980
  buildImportPaths: buildContinueImportPaths,
8912
8981
  detectionPaths: [".continue/rules", ".continue/skills", ".continue/mcpServers"],
8982
+ nativeInstall: {
8983
+ pickPaths: [
8984
+ {
8985
+ prefix: ".continue/rules",
8986
+ feature: "rules",
8987
+ strategy: { kind: "basename", suffix: ".md" }
8988
+ },
8989
+ {
8990
+ prefix: ".continue/prompts",
8991
+ feature: "commands",
8992
+ strategy: { kind: "basename", suffix: ".md" }
8993
+ },
8994
+ { prefix: ".continue/skills", feature: "skills", strategy: { kind: "skillDir" } }
8995
+ ]
8996
+ },
8913
8997
  conversionDefaults: { agentsToSkills: true }
8914
8998
  };
8915
8999
  }
@@ -9277,6 +9361,80 @@ var init_importer10 = __esm({
9277
9361
  init_copilot2();
9278
9362
  }
9279
9363
  });
9364
+ async function skillNamesFromNativeSkillDir(scanRoot) {
9365
+ const files = await readDirRecursive(scanRoot);
9366
+ const names = /* @__PURE__ */ new Set();
9367
+ for (const f of files) {
9368
+ if (basename(f) === "SKILL.md") {
9369
+ names.add(basename(dirname(f)));
9370
+ continue;
9371
+ }
9372
+ const rel2 = relative(scanRoot, f).replace(/\\/g, "/");
9373
+ if (!rel2.includes("/") && f.toLowerCase().endsWith(".md")) {
9374
+ names.add(basename(f, ".md"));
9375
+ }
9376
+ }
9377
+ return [...names].filter(Boolean).sort();
9378
+ }
9379
+ var init_native_skill_scan = __esm({
9380
+ "src/install/native/native-skill-scan.ts"() {
9381
+ init_fs();
9382
+ }
9383
+ });
9384
+ async function inferCopilotPickFromPath(repoRoot, posixPath) {
9385
+ const scan = join(repoRoot, ...posixPath.split("/"));
9386
+ if (posixPath.startsWith(COPILOT_PROMPTS_DIR)) {
9387
+ const files = await readDirRecursive(scan);
9388
+ const commands = [
9389
+ ...new Set(
9390
+ files.filter((f) => f.toLowerCase().endsWith(".prompt.md")).map((f) => basename(f, ".prompt.md"))
9391
+ )
9392
+ ].sort();
9393
+ return commands.length ? { commands } : {};
9394
+ }
9395
+ if (posixPath.startsWith(".github/copilot") && !posixPath.includes("copilot-instructions.md")) {
9396
+ const files = await readDirRecursive(scan);
9397
+ const rules = [
9398
+ ...new Set(
9399
+ files.filter((f) => f.includes(".instructions.md")).map((f) => basename(f).replace(/\.instructions\.md$/i, ""))
9400
+ )
9401
+ ].sort();
9402
+ return rules.length ? { rules } : {};
9403
+ }
9404
+ if (posixPath.startsWith(".github/instructions")) {
9405
+ const files = await readDirRecursive(scan);
9406
+ const names = /* @__PURE__ */ new Set();
9407
+ for (const f of files) {
9408
+ const b = basename(f);
9409
+ if (b.toLowerCase().endsWith(".instructions.md"))
9410
+ names.add(b.replace(/\.instructions\.md$/i, ""));
9411
+ else if (b.toLowerCase().endsWith(".md")) names.add(basename(f, ".md"));
9412
+ }
9413
+ const rules = [...names].sort();
9414
+ return rules.length ? { rules } : {};
9415
+ }
9416
+ if (posixPath.startsWith(".github/skills")) {
9417
+ const skills = await skillNamesFromNativeSkillDir(scan);
9418
+ return skills.length ? { skills } : {};
9419
+ }
9420
+ if (posixPath.startsWith(".github/agents")) {
9421
+ const files = await readDirRecursive(scan);
9422
+ const agents = [
9423
+ ...new Set(
9424
+ files.filter((f) => f.toLowerCase().endsWith(".agent.md")).map((f) => basename(f, ".agent.md"))
9425
+ )
9426
+ ].sort();
9427
+ return agents.length ? { agents } : {};
9428
+ }
9429
+ return {};
9430
+ }
9431
+ var init_native_path_pick_infer_copilot = __esm({
9432
+ "src/install/native/native-path-pick-infer-copilot.ts"() {
9433
+ init_fs();
9434
+ init_constants29();
9435
+ init_native_skill_scan();
9436
+ }
9437
+ });
9280
9438
  function pruneUndefined3(record) {
9281
9439
  for (const key of Object.keys(record)) {
9282
9440
  if (record[key] === void 0) delete record[key];
@@ -9566,6 +9724,7 @@ var init_copilot2 = __esm({
9566
9724
  init_generator11();
9567
9725
  init_constants29();
9568
9726
  init_importer10();
9727
+ init_native_path_pick_infer_copilot();
9569
9728
  init_import_mappers4();
9570
9729
  init_linter10();
9571
9730
  init_import_map_builders();
@@ -9780,7 +9939,8 @@ var init_copilot2 = __esm({
9780
9939
  ".github/skills",
9781
9940
  ".github/agents",
9782
9941
  ".github/hooks"
9783
- ]
9942
+ ],
9943
+ nativeInstall: { inferPick: inferCopilotPickFromPath }
9784
9944
  };
9785
9945
  }
9786
9946
  });
@@ -11280,6 +11440,23 @@ var init_cursor2 = __esm({
11280
11440
  },
11281
11441
  buildImportPaths: buildCursorImportPaths,
11282
11442
  detectionPaths: [".cursor/rules", ".cursor/mcp.json"],
11443
+ nativeInstall: {
11444
+ pickPaths: [
11445
+ { prefix: ".cursor/rules", feature: "rules", strategy: { kind: "basename", suffix: ".mdc" } },
11446
+ {
11447
+ prefix: ".cursor/commands",
11448
+ feature: "commands",
11449
+ strategy: { kind: "basename", suffix: ".md" }
11450
+ },
11451
+ {
11452
+ prefix: ".cursor/agents",
11453
+ feature: "agents",
11454
+ strategy: { kind: "basename", suffix: ".md" }
11455
+ },
11456
+ { prefix: ".cursor/skills", feature: "skills", strategy: { kind: "skillDir" } }
11457
+ ],
11458
+ dialectHints: [{ frontmatterKey: "alwaysApply" }]
11459
+ },
11283
11460
  preservesManualActivation: true
11284
11461
  };
11285
11462
  }
@@ -12041,18 +12218,18 @@ function mapHookEvent2(event) {
12041
12218
  return null;
12042
12219
  }
12043
12220
  }
12044
- function generateGeminiSettingsFiles(canonical) {
12221
+ function generateGeminiSettingsFiles(canonical, enabledFeatures) {
12045
12222
  const settings = {};
12046
12223
  let hasAnyNativeSettings = false;
12047
- if (canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
12224
+ if (enabledFeatures.has("mcp") && canonical.mcp && Object.keys(canonical.mcp.mcpServers).length > 0) {
12048
12225
  settings.mcpServers = canonical.mcp.mcpServers;
12049
12226
  hasAnyNativeSettings = true;
12050
12227
  }
12051
- if (canonical.agents.length > 0) {
12228
+ if (enabledFeatures.has("agents") && canonical.agents.length > 0) {
12052
12229
  settings.experimental = { enableAgents: true };
12053
12230
  hasAnyNativeSettings = true;
12054
12231
  }
12055
- if (canonical.hooks) {
12232
+ if (enabledFeatures.has("hooks") && canonical.hooks) {
12056
12233
  const hookEntries = Object.entries(canonical.hooks).flatMap(([event, entries]) => {
12057
12234
  const mappedEvent = mapHookEvent2(event);
12058
12235
  if (!mappedEvent || !Array.isArray(entries)) return [];
@@ -12668,6 +12845,36 @@ var init_importer15 = __esm({
12668
12845
  init_importer_skills_agents();
12669
12846
  }
12670
12847
  });
12848
+ function isUnderGeminiCommands(pathInRepoPosix) {
12849
+ const p = pathInRepoPosix.replace(/^\/+|\/+$/g, "");
12850
+ return p === ".gemini/commands" || p.startsWith(".gemini/commands/");
12851
+ }
12852
+ async function inferGeminiCommandNamesFromFiles(repoRoot, pathInRepoPosix) {
12853
+ const commandsRoot = join(repoRoot, ...GEMINI_COMMANDS_DIR.split("/"));
12854
+ const scanDir = join(repoRoot, ...pathInRepoPosix.split("/"));
12855
+ const files = await readDirRecursive(scanDir);
12856
+ const names = [];
12857
+ for (const f of files) {
12858
+ if (!/\.(toml|md)$/i.test(f)) continue;
12859
+ const rel2 = relative(commandsRoot, f).replace(/\\/g, "/");
12860
+ if (rel2.startsWith("..") || rel2 === "") continue;
12861
+ const noExt = rel2.replace(/\.(toml|md)$/i, "");
12862
+ const name = noExt.split("/").filter(Boolean).join(":");
12863
+ if (name) names.push(name);
12864
+ }
12865
+ return [...new Set(names)].sort();
12866
+ }
12867
+ async function inferGeminiPick(repoRoot, posixPath) {
12868
+ if (!isUnderGeminiCommands(posixPath)) return {};
12869
+ const commands = await inferGeminiCommandNamesFromFiles(repoRoot, posixPath);
12870
+ return commands.length ? { commands } : {};
12871
+ }
12872
+ var init_gemini_install_commands = __esm({
12873
+ "src/install/native/gemini-install-commands.ts"() {
12874
+ init_fs();
12875
+ init_constants30();
12876
+ }
12877
+ });
12671
12878
  async function mapGeminiRuleFile(relativePath, destDir, normalizeTo) {
12672
12879
  const relativeMdPath = relativePath.replace(/\\/g, "/");
12673
12880
  const destPath = join(destDir, relativeMdPath);
@@ -12779,12 +12986,12 @@ var init_lint12 = __esm({
12779
12986
  });
12780
12987
 
12781
12988
  // src/targets/gemini-cli/scoped-settings-emit.ts
12782
- function emitScopedGeminiSettings(canonical, scope) {
12989
+ function emitScopedGeminiSettings(canonical, scope, enabledFeatures) {
12783
12990
  if (scope === "project") {
12784
12991
  const caps = getTargetCapabilities("gemini-cli", scope);
12785
12992
  if (caps?.ignore.flavor !== "settings-embedded") return [];
12786
12993
  }
12787
- return generateGeminiSettingsFiles(canonical);
12994
+ return generateGeminiSettingsFiles(canonical, enabledFeatures);
12788
12995
  }
12789
12996
  var init_scoped_settings_emit = __esm({
12790
12997
  "src/targets/gemini-cli/scoped-settings-emit.ts"() {
@@ -12802,6 +13009,7 @@ var init_gemini_cli2 = __esm({
12802
13009
  init_policies_generator();
12803
13010
  init_constants30();
12804
13011
  init_importer15();
13012
+ init_gemini_install_commands();
12805
13013
  init_import_mappers6();
12806
13014
  init_linter15();
12807
13015
  init_import_map_builders();
@@ -12997,6 +13205,7 @@ var init_gemini_cli2 = __esm({
12997
13205
  },
12998
13206
  buildImportPaths: buildGeminiCliImportPaths,
12999
13207
  detectionPaths: ["GEMINI.md", ".gemini"],
13208
+ nativeInstall: { inferPick: inferGeminiPick },
13000
13209
  conversionDefaults: { agentsToSkills: false }
13001
13210
  };
13002
13211
  }
@@ -13838,7 +14047,23 @@ var init_junie2 = __esm({
13838
14047
  ".junie/skills",
13839
14048
  ".junie/mcp/mcp.json",
13840
14049
  ".aiignore"
13841
- ]
14050
+ ],
14051
+ nativeInstall: {
14052
+ pickPaths: [
14053
+ {
14054
+ prefix: ".junie/commands",
14055
+ feature: "commands",
14056
+ strategy: { kind: "basename", suffix: ".md" }
14057
+ },
14058
+ { prefix: ".junie/rules", feature: "rules", strategy: { kind: "basename", suffix: ".md" } },
14059
+ {
14060
+ prefix: ".junie/agents",
14061
+ feature: "agents",
14062
+ strategy: { kind: "basename", suffix: ".md" }
14063
+ },
14064
+ { prefix: ".junie/skills", feature: "skills", strategy: { kind: "skillDir" } }
14065
+ ]
14066
+ }
13842
14067
  };
13843
14068
  }
13844
14069
  });
@@ -15693,9 +15918,18 @@ function generateIgnore12(canonical) {
15693
15918
  if (!canonical.ignore || canonical.ignore.length === 0) return [];
15694
15919
  return [{ path: QWEN_IGNORE, content: canonical.ignore.join("\n") }];
15695
15920
  }
15921
+ function renderQwenGlobalInstructions(canonical) {
15922
+ const root = canonical.rules.find((rule) => rule.root);
15923
+ const nonRootRules = canonical.rules.filter((rule) => {
15924
+ if (rule.root) return false;
15925
+ return rule.targets.length === 0 || rule.targets.includes(QWEN_CODE_TARGET);
15926
+ });
15927
+ return appendEmbeddedRulesBlock(root?.body.trim() ?? "", nonRootRules);
15928
+ }
15696
15929
  var init_generator26 = __esm({
15697
15930
  "src/targets/qwen-code/generator.ts"() {
15698
15931
  init_markdown();
15932
+ init_managed_blocks();
15699
15933
  init_constants21();
15700
15934
  }
15701
15935
  });
@@ -15778,6 +16012,7 @@ var init_qwen_code2 = __esm({
15778
16012
  };
15779
16013
  globalLayout22 = {
15780
16014
  rootInstructionPath: QWEN_GLOBAL_ROOT,
16015
+ renderPrimaryRootInstruction: renderQwenGlobalInstructions,
15781
16016
  skillDir: QWEN_GLOBAL_SKILLS_DIR,
15782
16017
  managedOutputs: {
15783
16018
  dirs: [QWEN_GLOBAL_COMMANDS_DIR, QWEN_GLOBAL_AGENTS_DIR, QWEN_GLOBAL_SKILLS_DIR],
@@ -18178,6 +18413,16 @@ var init_windsurf2 = __esm({
18178
18413
  },
18179
18414
  buildImportPaths: buildWindsurfImportPaths,
18180
18415
  detectionPaths: [".windsurfrules", ".windsurf"],
18416
+ nativeInstall: {
18417
+ pickPaths: [
18418
+ {
18419
+ prefix: ".windsurf/rules",
18420
+ feature: "rules",
18421
+ strategy: { kind: "basename", suffix: ".md" }
18422
+ }
18423
+ ],
18424
+ dialectHints: [{ frontmatterKey: "trigger" }]
18425
+ },
18181
18426
  conversionDefaults: { agentsToSkills: true }
18182
18427
  };
18183
18428
  }
@@ -18452,7 +18697,8 @@ var init_zed2 = __esm({
18452
18697
  markAsRoot: true
18453
18698
  }
18454
18699
  },
18455
- emitScopedSettings(canonical, _scope) {
18700
+ emitScopedSettings(canonical, _scope, enabledFeatures) {
18701
+ if (!enabledFeatures.has("mcp")) return [];
18456
18702
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
18457
18703
  const contextServers = {};
18458
18704
  for (const [name, server] of Object.entries(canonical.mcp.mcpServers)) {
@@ -18507,7 +18753,10 @@ function getBuiltinTargetDefinition(target31) {
18507
18753
  function getTargetCapabilities(target31, scope = "project") {
18508
18754
  const descriptor31 = getBuiltinTargetDefinition(target31) ?? getDescriptor(target31);
18509
18755
  if (!descriptor31) return void 0;
18510
- const raw = scope === "global" ? descriptor31.globalSupport?.capabilities ?? descriptor31.capabilities : descriptor31.capabilities;
18756
+ if (scope === "global" && !descriptor31.globalSupport) {
18757
+ return normalizeTargetCapabilities(ALL_NONE_CAPABILITIES);
18758
+ }
18759
+ const raw = scope === "global" ? descriptor31.globalSupport.capabilities : descriptor31.capabilities;
18511
18760
  return normalizeTargetCapabilities(raw);
18512
18761
  }
18513
18762
  function getTargetDetectionPaths(target31, scope = "project") {
@@ -18563,6 +18812,7 @@ function isConversionUpgrading(descriptor31, feature, config, scope) {
18563
18812
  function getEffectiveTargetSupportLevel(target31, feature, config, scope = "project") {
18564
18813
  const baseLevel = getTargetCapabilities(target31, scope)?.[feature]?.level ?? "none";
18565
18814
  const descriptor31 = getBuiltinTargetDefinition(target31) ?? getDescriptor(target31);
18815
+ if (scope === "global" && descriptor31 && !descriptor31.globalSupport) return "none";
18566
18816
  if (baseLevel === "none" && isConversionUpgrading(descriptor31, feature, config, scope)) {
18567
18817
  return "embedded";
18568
18818
  }
@@ -18576,7 +18826,7 @@ function resolveTargetFeatureGenerator(target31, feature, config, scope = "proje
18576
18826
  const pick = PICK_FEATURE_GENERATOR[feature];
18577
18827
  return pick === null ? void 0 : pick(descriptor31.generators);
18578
18828
  }
18579
- var BUILTIN_TARGETS, _builtinTargetsMap, PICK_FEATURE_GENERATOR;
18829
+ var ALL_NONE_CAPABILITIES, BUILTIN_TARGETS, _builtinTargetsMap, PICK_FEATURE_GENERATOR;
18580
18830
  var init_builtin_targets = __esm({
18581
18831
  "src/targets/catalog/builtin-targets.ts"() {
18582
18832
  init_conversions();
@@ -18614,6 +18864,17 @@ var init_builtin_targets = __esm({
18614
18864
  init_warp2();
18615
18865
  init_windsurf2();
18616
18866
  init_zed2();
18867
+ ALL_NONE_CAPABILITIES = {
18868
+ rules: "none",
18869
+ additionalRules: "none",
18870
+ commands: "none",
18871
+ agents: "none",
18872
+ skills: "none",
18873
+ mcp: "none",
18874
+ hooks: "none",
18875
+ ignore: "none",
18876
+ permissions: "none"
18877
+ };
18617
18878
  BUILTIN_TARGETS = [
18618
18879
  descriptor,
18619
18880
  descriptor2,