agentsmesh 0.8.0 → 0.10.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/canonical.js CHANGED
@@ -1,11 +1,12 @@
1
- import { access, readdir, realpath, stat, readFile, rm, mkdir, writeFile, rename, lstat } from 'fs/promises';
2
- import { join, basename, dirname, resolve, relative, normalize, extname, win32, isAbsolute, posix } from 'path';
1
+ import { access, readdir, realpath, stat, readFile, rm, mkdir, writeFile, rename, lstat, unlink } from 'fs/promises';
2
+ import { join, basename, dirname, resolve, relative, posix, win32, extname } from 'path';
3
3
  import { constants, existsSync, realpathSync, statSync } from 'fs';
4
4
  import { parse, stringify } from 'yaml';
5
5
  import { parse as parse$1 } from 'smol-toml';
6
6
  import { Buffer } from 'buffer';
7
7
  import { z } from 'zod';
8
8
  import { homedir } from 'os';
9
+ import { createHash } from 'crypto';
9
10
  import { execFile } from 'child_process';
10
11
  import { URL } from 'url';
11
12
  import { promisify } from 'util';
@@ -16,9 +17,9 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
16
17
  var __esm = (fn, res) => function __init() {
17
18
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
19
  };
19
- var __export = (target13, all) => {
20
+ var __export = (target14, all) => {
20
21
  for (var name in all)
21
- __defProp(target13, name, { get: all[name], enumerable: true });
22
+ __defProp(target14, name, { get: all[name], enumerable: true });
22
23
  };
23
24
 
24
25
  // src/core/errors.ts
@@ -104,6 +105,11 @@ async function writeFileAtomic(path, content) {
104
105
  { errnoCode: "EISDIR" }
105
106
  );
106
107
  }
108
+ if (info.isSymbolicLink()) {
109
+ await unlink(path).catch((e) => {
110
+ if (e.code !== "ENOENT") throw e;
111
+ });
112
+ }
107
113
  } catch (err) {
108
114
  if (err instanceof FileSystemError) throw err;
109
115
  const e = err;
@@ -112,7 +118,15 @@ async function writeFileAtomic(path, content) {
112
118
  const tmpPath = `${path}.tmp`;
113
119
  const payload = shouldNormalizeLineEndings(path) ? normalizeLineEndings(content) : content;
114
120
  try {
115
- await writeFile(tmpPath, payload, "utf-8");
121
+ try {
122
+ const tmpInfo = await lstat(tmpPath);
123
+ if (tmpInfo.isSymbolicLink()) {
124
+ await unlink(tmpPath);
125
+ }
126
+ } catch (tmpErr) {
127
+ if (tmpErr.code !== "ENOENT") throw tmpErr;
128
+ }
129
+ await writeFile(tmpPath, payload, { encoding: "utf-8", flag: "w" });
116
130
  await rename(tmpPath, path);
117
131
  } catch (err) {
118
132
  await rm(tmpPath, { force: true }).catch(() => {
@@ -280,31 +294,68 @@ var init_hook_command = __esm({
280
294
  "src/core/hook-command.ts"() {
281
295
  }
282
296
  });
297
+ function pathApi(projectRoot) {
298
+ return projectRoot.includes("\\") || WINDOWS_ABSOLUTE_PATH.test(projectRoot) ? win32 : posix;
299
+ }
300
+ function normalizeSeparators(token) {
301
+ return token.replace(/\\/g, "/");
302
+ }
303
+ function normalizeForProject(projectRoot, filePath) {
304
+ const api = pathApi(projectRoot);
305
+ const normalized = api.normalize(
306
+ api === win32 ? filePath.replace(/\//g, "\\") : normalizeSeparators(filePath)
307
+ );
308
+ return normalized.endsWith(api.sep) && normalized.length > 1 ? normalized.slice(0, -1) : normalized;
309
+ }
310
+ function isAbsoluteForProject(projectRoot, filePath) {
311
+ return pathApi(projectRoot).isAbsolute(filePath) || WINDOWS_ABSOLUTE_PATH.test(filePath);
312
+ }
313
+ function stripTrailingPunctuation(token) {
314
+ let candidate = token;
315
+ let suffix = "";
316
+ while (TRAILING_PUNCTUATION.test(candidate)) {
317
+ suffix = candidate.at(-1) + suffix;
318
+ candidate = candidate.slice(0, -1);
319
+ }
320
+ return { candidate, suffix };
321
+ }
322
+ function rootFallbackPath(token, projectRoot) {
323
+ const api = pathApi(projectRoot);
324
+ const stripped = token.replace(/^(\.\.\/)+/, "").replace(/^\.\//, "");
325
+ return stripped && stripped !== token ? normalizeForProject(projectRoot, api.join(projectRoot, stripped)) : null;
326
+ }
327
+ var WINDOWS_ABSOLUTE_PATH, TRAILING_PUNCTUATION;
328
+ var init_path_helpers = __esm({
329
+ "src/core/path-helpers.ts"() {
330
+ WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]/;
331
+ TRAILING_PUNCTUATION = /[.!?:;]+$/;
332
+ }
333
+ });
283
334
 
284
335
  // src/config/core/conversions.ts
285
- function usesCommandSkillProjection(target13) {
286
- return Object.prototype.hasOwnProperty.call(DEFAULT_COMMANDS_TO_SKILLS, target13);
336
+ function usesCommandSkillProjection(target14) {
337
+ return Object.prototype.hasOwnProperty.call(DEFAULT_COMMANDS_TO_SKILLS, target14);
287
338
  }
288
- function usesAgentSkillProjection(target13) {
289
- return Object.prototype.hasOwnProperty.call(DEFAULT_AGENTS_TO_SKILLS, target13);
339
+ function usesAgentSkillProjection(target14) {
340
+ return Object.prototype.hasOwnProperty.call(DEFAULT_AGENTS_TO_SKILLS, target14);
290
341
  }
291
342
  function resolveConversionValue(value, scope) {
292
343
  if (value === void 0) return void 0;
293
344
  if (typeof value === "boolean") return value;
294
345
  return value[scope];
295
346
  }
296
- function shouldConvertCommandsToSkills(config, target13, defaultEnabled, scope = "project") {
297
- const raw = config.conversions?.commands_to_skills?.[target13];
347
+ function shouldConvertCommandsToSkills(config, target14, defaultEnabled, scope = "project") {
348
+ const raw = config.conversions?.commands_to_skills?.[target14];
298
349
  const configVal = resolveConversionValue(raw, scope);
299
350
  if (configVal !== void 0) return configVal;
300
- if (usesCommandSkillProjection(target13)) return DEFAULT_COMMANDS_TO_SKILLS[target13];
351
+ if (usesCommandSkillProjection(target14)) return DEFAULT_COMMANDS_TO_SKILLS[target14];
301
352
  return defaultEnabled ?? false;
302
353
  }
303
- function shouldConvertAgentsToSkills(config, target13, defaultEnabled, scope = "project") {
304
- const raw = config.conversions?.agents_to_skills?.[target13];
354
+ function shouldConvertAgentsToSkills(config, target14, defaultEnabled, scope = "project") {
355
+ const raw = config.conversions?.agents_to_skills?.[target14];
305
356
  const configVal = resolveConversionValue(raw, scope);
306
357
  if (configVal !== void 0) return configVal;
307
- if (usesAgentSkillProjection(target13)) return DEFAULT_AGENTS_TO_SKILLS[target13];
358
+ if (usesAgentSkillProjection(target14)) return DEFAULT_AGENTS_TO_SKILLS[target14];
308
359
  return defaultEnabled ?? false;
309
360
  }
310
361
  var DEFAULT_COMMANDS_TO_SKILLS, DEFAULT_AGENTS_TO_SKILLS;
@@ -355,11 +406,11 @@ var init_capabilities = __esm({
355
406
  // src/targets/catalog/shared-artifact-owner.ts
356
407
  function findSharedArtifactOwnershipConflicts(descriptors) {
357
408
  const owners = [];
358
- for (const descriptor13 of descriptors) {
359
- if (!descriptor13.sharedArtifacts) continue;
360
- for (const [prefix, role] of Object.entries(descriptor13.sharedArtifacts)) {
409
+ for (const descriptor14 of descriptors) {
410
+ if (!descriptor14.sharedArtifacts) continue;
411
+ for (const [prefix, role] of Object.entries(descriptor14.sharedArtifacts)) {
361
412
  if (role !== "owner") continue;
362
- owners.push({ targetId: descriptor13.id, prefix });
413
+ owners.push({ targetId: descriptor14.id, prefix });
363
414
  }
364
415
  }
365
416
  const conflicts = [];
@@ -410,6 +461,7 @@ var init_builtin_target_ids_generated = __esm({
410
461
  "cursor",
411
462
  "gemini-cli",
412
463
  "junie",
464
+ "kilo-code",
413
465
  "kiro",
414
466
  "roo-code",
415
467
  "windsurf"
@@ -891,6 +943,37 @@ var init_generator = __esm({
891
943
  init_constants();
892
944
  }
893
945
  });
946
+ async function writeMcpWithMerge(projectRoot, canonicalPath, imported) {
947
+ const destPath = join(projectRoot, canonicalPath);
948
+ const existing = await readExistingServers(destPath);
949
+ const merged = { ...existing, ...imported };
950
+ await mkdirp(dirname(destPath));
951
+ await writeFileAtomic(destPath, JSON.stringify({ mcpServers: merged }, null, 2));
952
+ }
953
+ async function readExistingServers(path) {
954
+ const content = await readFileSafe(path);
955
+ if (content === null) return {};
956
+ let parsed;
957
+ try {
958
+ parsed = JSON.parse(content);
959
+ } catch {
960
+ return {};
961
+ }
962
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
963
+ const raw = parsed.mcpServers;
964
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
965
+ const out = {};
966
+ for (const [name, value] of Object.entries(raw)) {
967
+ if (!value || typeof value !== "object" || Array.isArray(value)) continue;
968
+ out[name] = value;
969
+ }
970
+ return out;
971
+ }
972
+ var init_mcp_merge = __esm({
973
+ "src/targets/import/mcp-merge.ts"() {
974
+ init_fs();
975
+ }
976
+ });
894
977
 
895
978
  // src/targets/import/shared-import-helpers.ts
896
979
  function toGlobsArray(v) {
@@ -1136,18 +1219,24 @@ async function runDirectory(spec, sources, projectRoot, fromTool, normalize) {
1136
1219
  }
1137
1220
  return results;
1138
1221
  }
1222
+ function resolveCanonicalFilePath(spec) {
1223
+ const filename = spec.canonicalFilename;
1224
+ if (filename.includes("/") || filename.includes("\\")) return filename;
1225
+ return posix.join(spec.canonicalDir, filename);
1226
+ }
1139
1227
  async function runFlatFile(spec, sources, projectRoot, fromTool) {
1140
1228
  if (!spec.canonicalFilename) {
1141
1229
  throw new Error(`flatFile spec for ${spec.feature} must set canonicalFilename`);
1142
1230
  }
1231
+ const canonicalPath = resolveCanonicalFilePath(spec);
1143
1232
  for (const rel2 of sources) {
1144
1233
  const srcPath = join(projectRoot, rel2);
1145
1234
  const content = await readFileSafe(srcPath);
1146
1235
  if (content === null) continue;
1147
- const destPath = join(projectRoot, spec.canonicalFilename);
1236
+ const destPath = join(projectRoot, canonicalPath);
1148
1237
  await mkdirp(dirname(destPath));
1149
1238
  await writeFileAtomic(destPath, content.trimEnd());
1150
- return [{ fromTool, fromPath: srcPath, toPath: spec.canonicalFilename, feature: spec.feature }];
1239
+ return [{ fromTool, fromPath: srcPath, toPath: canonicalPath, feature: spec.feature }];
1151
1240
  }
1152
1241
  return [];
1153
1242
  }
@@ -1192,24 +1281,19 @@ async function runMcpJson(spec, sources, projectRoot, fromTool) {
1192
1281
  if (!spec.canonicalFilename) {
1193
1282
  throw new Error(`mcpJson spec for ${spec.feature} must set canonicalFilename`);
1194
1283
  }
1284
+ const canonicalPath = resolveCanonicalFilePath(spec);
1195
1285
  for (const rel2 of sources) {
1196
1286
  const srcPath = join(projectRoot, rel2);
1197
1287
  const content = await readFileSafe(srcPath);
1198
1288
  if (content === null) continue;
1199
- const servers = parseMcpJson(content);
1200
- if (Object.keys(servers).length === 0) return [];
1201
- const destPath = join(projectRoot, spec.canonicalFilename);
1202
- await mkdirp(dirname(destPath));
1203
- await writeFileAtomic(destPath, JSON.stringify({ mcpServers: servers }, null, 2));
1204
- return [{ fromTool, fromPath: srcPath, toPath: spec.canonicalFilename, feature: spec.feature }];
1289
+ const imported = parseMcpJson(content);
1290
+ if (Object.keys(imported).length === 0) return [];
1291
+ await writeMcpWithMerge(projectRoot, canonicalPath, imported);
1292
+ return [{ fromTool, fromPath: srcPath, toPath: canonicalPath, feature: spec.feature }];
1205
1293
  }
1206
1294
  return [];
1207
1295
  }
1208
- async function runSpec(spec, scope, projectRoot, fromTool, normalize) {
1209
- const primary = resolveScopedSources(spec.source, scope);
1210
- const fallback = resolveScopedSources(spec.fallbacks, scope);
1211
- const sources = primary.length > 0 ? primary : fallback;
1212
- if (sources.length === 0) return [];
1296
+ function dispatchSpec(spec, sources, projectRoot, fromTool, normalize) {
1213
1297
  switch (spec.mode) {
1214
1298
  case "singleFile":
1215
1299
  return runSingleFile(spec, sources, projectRoot, fromTool, normalize);
@@ -1221,20 +1305,33 @@ async function runSpec(spec, scope, projectRoot, fromTool, normalize) {
1221
1305
  return runMcpJson(spec, sources, projectRoot, fromTool);
1222
1306
  }
1223
1307
  }
1308
+ async function runSpec(spec, scope, projectRoot, fromTool, normalize) {
1309
+ const primary = resolveScopedSources(spec.source, scope);
1310
+ const fallback = resolveScopedSources(spec.fallbacks, scope);
1311
+ if (primary.length === 0 && fallback.length === 0) return [];
1312
+ if (primary.length > 0) {
1313
+ const results = await dispatchSpec(spec, primary, projectRoot, fromTool, normalize);
1314
+ if (results.length > 0) return results;
1315
+ }
1316
+ if (fallback.length > 0) {
1317
+ return dispatchSpec(spec, fallback, projectRoot, fromTool, normalize);
1318
+ }
1319
+ return [];
1320
+ }
1224
1321
  function specsForFeature(importer, feature) {
1225
1322
  const value = importer[feature];
1226
1323
  if (!value) return [];
1227
1324
  if (Array.isArray(value)) return value;
1228
1325
  return [value];
1229
1326
  }
1230
- async function runDescriptorImport(descriptor13, projectRoot, scope, options) {
1231
- const importer = descriptor13.importer;
1327
+ async function runDescriptorImport(descriptor14, projectRoot, scope, options) {
1328
+ const importer = descriptor14.importer;
1232
1329
  if (!importer) return [];
1233
- const normalize = options?.normalize ?? await createImportReferenceNormalizer(descriptor13.id, projectRoot, scope);
1330
+ const normalize = options?.normalize ?? await createImportReferenceNormalizer(descriptor14.id, projectRoot, scope);
1234
1331
  const results = [];
1235
1332
  for (const feature of IMPORT_FEATURE_ORDER) {
1236
1333
  for (const spec of specsForFeature(importer, feature)) {
1237
- results.push(...await runSpec(spec, scope, projectRoot, descriptor13.id, normalize));
1334
+ results.push(...await runSpec(spec, scope, projectRoot, descriptor14.id, normalize));
1238
1335
  }
1239
1336
  }
1240
1337
  return results;
@@ -1243,6 +1340,7 @@ var init_descriptor_import_runner = __esm({
1243
1340
  "src/targets/import/descriptor-import-runner.ts"() {
1244
1341
  init_import_rewriter();
1245
1342
  init_fs();
1343
+ init_mcp_merge();
1246
1344
  init_markdown();
1247
1345
  init_shared_import_helpers();
1248
1346
  init_import_metadata();
@@ -1698,22 +1796,22 @@ var init_projected_agent_skill = __esm({
1698
1796
  }
1699
1797
  });
1700
1798
  function rel(projectRoot, absPath) {
1701
- return relative(projectRoot, absPath).replace(/\\/g, "/");
1799
+ return pathApi(projectRoot).relative(projectRoot, absPath).replace(/\\/g, "/");
1702
1800
  }
1703
1801
  async function listFiles(projectRoot, dir) {
1704
- return readDirRecursive(join(projectRoot, dir)).catch(() => []);
1802
+ return readDirRecursive(pathApi(projectRoot).join(projectRoot, dir)).catch(() => []);
1705
1803
  }
1706
1804
  function addDirectoryMapping(refs, from, to) {
1707
1805
  refs.set(from, to);
1708
1806
  refs.set(`${from}/`, `${to}/`);
1709
1807
  }
1710
1808
  function addAncestorMappings(refs, fromPath, toPath, stopDir) {
1711
- let fromDir = dirname(fromPath);
1712
- let toDir = dirname(toPath);
1809
+ let fromDir = posix.dirname(fromPath);
1810
+ let toDir = posix.dirname(toPath);
1713
1811
  while (fromDir !== stopDir && fromDir !== ".") {
1714
1812
  addDirectoryMapping(refs, fromDir, toDir);
1715
- fromDir = dirname(fromDir);
1716
- toDir = dirname(toDir);
1813
+ fromDir = posix.dirname(fromDir);
1814
+ toDir = posix.dirname(toDir);
1717
1815
  }
1718
1816
  }
1719
1817
  function addSimpleFileMapping(refs, fromPath, canonicalDir, extension) {
@@ -1757,18 +1855,18 @@ async function targetRootSegments() {
1757
1855
  if (targetRootSegmentsCache !== void 0) return targetRootSegmentsCache;
1758
1856
  const { BUILTIN_TARGETS: BUILTIN_TARGETS2 } = await Promise.resolve().then(() => (init_builtin_targets(), builtin_targets_exports));
1759
1857
  const roots = /* @__PURE__ */ new Set();
1760
- for (const descriptor13 of BUILTIN_TARGETS2) {
1858
+ for (const descriptor14 of BUILTIN_TARGETS2) {
1761
1859
  for (const path of [
1762
- descriptor13.project.rootInstructionPath,
1763
- descriptor13.project.skillDir,
1764
- ...descriptor13.project.managedOutputs?.dirs ?? [],
1765
- ...descriptor13.project.managedOutputs?.files ?? [],
1766
- ...descriptor13.detectionPaths,
1767
- descriptor13.globalSupport?.layout.rootInstructionPath,
1768
- descriptor13.globalSupport?.layout.skillDir,
1769
- ...descriptor13.globalSupport?.layout.managedOutputs?.dirs ?? [],
1770
- ...descriptor13.globalSupport?.layout.managedOutputs?.files ?? [],
1771
- ...descriptor13.globalSupport?.detectionPaths ?? []
1860
+ descriptor14.project.rootInstructionPath,
1861
+ descriptor14.project.skillDir,
1862
+ ...descriptor14.project.managedOutputs?.dirs ?? [],
1863
+ ...descriptor14.project.managedOutputs?.files ?? [],
1864
+ ...descriptor14.detectionPaths,
1865
+ descriptor14.globalSupport?.layout.rootInstructionPath,
1866
+ descriptor14.globalSupport?.layout.skillDir,
1867
+ ...descriptor14.globalSupport?.layout.managedOutputs?.dirs ?? [],
1868
+ ...descriptor14.globalSupport?.layout.managedOutputs?.files ?? [],
1869
+ ...descriptor14.globalSupport?.detectionPaths ?? []
1772
1870
  ]) {
1773
1871
  if (path !== void 0) {
1774
1872
  const segment = firstPathSegment(path);
@@ -1785,8 +1883,9 @@ function hasHiddenSegment(relPath) {
1785
1883
  async function listScopedAgentsFiles(projectRoot) {
1786
1884
  const files = [];
1787
1885
  const targetRootSegmentsSet = await targetRootSegments();
1886
+ const api = pathApi(projectRoot);
1788
1887
  async function walk(relDir) {
1789
- const absDir = join(projectRoot, relDir);
1888
+ const absDir = api.join(projectRoot, relDir);
1790
1889
  const entries = await readdir(absDir, { withFileTypes: true }).catch(() => []);
1791
1890
  for (const entry of entries) {
1792
1891
  const relPath = relDir ? `${relDir}/${entry.name}` : entry.name;
@@ -1795,7 +1894,7 @@ async function listScopedAgentsFiles(projectRoot) {
1795
1894
  await walk(relPath);
1796
1895
  continue;
1797
1896
  }
1798
- if (entry.isSymbolicLink() && await stat(join(projectRoot, relPath)).then(
1897
+ if (entry.isSymbolicLink() && await stat(api.join(projectRoot, relPath)).then(
1799
1898
  (info) => info.isDirectory(),
1800
1899
  () => false
1801
1900
  )) {
@@ -1804,7 +1903,7 @@ async function listScopedAgentsFiles(projectRoot) {
1804
1903
  continue;
1805
1904
  }
1806
1905
  if (entry.name === "AGENTS.md" || entry.name === "AGENTS.override.md") {
1807
- files.push(join(projectRoot, relPath));
1906
+ files.push(api.join(projectRoot, relPath));
1808
1907
  }
1809
1908
  }
1810
1909
  }
@@ -1818,7 +1917,7 @@ async function addScopedAgentsMappings(refs, projectRoot) {
1818
1917
  const isNestedAgents = relPath.endsWith("/AGENTS.md") && relPath !== "AGENTS.md" && !relPath.endsWith("/AGENTS.override.md");
1819
1918
  const isNestedOverride = relPath.endsWith("/AGENTS.override.md") && relPath !== "AGENTS.override.md";
1820
1919
  if (!isNestedAgents && !isNestedOverride) continue;
1821
- const parentDir = dirname(relPath);
1920
+ const parentDir = posix.dirname(relPath);
1822
1921
  if (hasHiddenSegment(parentDir)) continue;
1823
1922
  const ruleName = parentDir.replace(/\//g, "-");
1824
1923
  refs.set(relPath, `${AB_RULES}/${ruleName}.md`);
@@ -1827,6 +1926,7 @@ async function addScopedAgentsMappings(refs, projectRoot) {
1827
1926
  var AB_RULES, AB_COMMANDS, AB_AGENTS, AB_SKILLS2, targetRootSegmentsCache;
1828
1927
  var init_import_map_shared = __esm({
1829
1928
  "src/core/reference/import-map-shared.ts"() {
1929
+ init_path_helpers();
1830
1930
  init_fs();
1831
1931
  init_command_skill();
1832
1932
  init_projected_agent_skill();
@@ -2281,9 +2381,100 @@ var init_junie = __esm({
2281
2381
  }
2282
2382
  });
2283
2383
 
2384
+ // src/targets/kilo-code/constants.ts
2385
+ var KILO_CODE_TARGET, KILO_CODE_DIR, KILO_CODE_ROOT_RULE, KILO_CODE_RULES_DIR, KILO_CODE_COMMANDS_DIR, KILO_CODE_AGENTS_DIR, KILO_CODE_SKILLS_DIR, KILO_CODE_MCP_FILE, KILO_CODE_IGNORE, KILO_CODE_LEGACY_DIR, KILO_CODE_LEGACY_RULES_DIR, KILO_CODE_LEGACY_WORKFLOWS_DIR, KILO_CODE_LEGACY_SKILLS_DIR, KILO_CODE_LEGACY_MCP_FILE, KILO_CODE_LEGACY_MODES_FILE, KILO_CODE_GLOBAL_DIR, KILO_CODE_GLOBAL_AGENTS_MD, KILO_CODE_GLOBAL_RULES_DIR, KILO_CODE_GLOBAL_COMMANDS_DIR, KILO_CODE_GLOBAL_AGENTS_DIR, KILO_CODE_GLOBAL_SKILLS_DIR, KILO_CODE_GLOBAL_MCP_FILE, KILO_CODE_GLOBAL_IGNORE, KILO_CODE_GLOBAL_AGENTS_SKILLS_DIR, KILO_CODE_CANONICAL_RULES_DIR, KILO_CODE_CANONICAL_COMMANDS_DIR, KILO_CODE_CANONICAL_AGENTS_DIR, KILO_CODE_CANONICAL_MCP, KILO_CODE_CANONICAL_IGNORE;
2386
+ var init_constants8 = __esm({
2387
+ "src/targets/kilo-code/constants.ts"() {
2388
+ KILO_CODE_TARGET = "kilo-code";
2389
+ KILO_CODE_DIR = ".kilo";
2390
+ KILO_CODE_ROOT_RULE = "AGENTS.md";
2391
+ KILO_CODE_RULES_DIR = `${KILO_CODE_DIR}/rules`;
2392
+ KILO_CODE_COMMANDS_DIR = `${KILO_CODE_DIR}/commands`;
2393
+ KILO_CODE_AGENTS_DIR = `${KILO_CODE_DIR}/agents`;
2394
+ KILO_CODE_SKILLS_DIR = `${KILO_CODE_DIR}/skills`;
2395
+ KILO_CODE_MCP_FILE = `${KILO_CODE_DIR}/mcp.json`;
2396
+ KILO_CODE_IGNORE = ".kilocodeignore";
2397
+ KILO_CODE_LEGACY_DIR = ".kilocode";
2398
+ KILO_CODE_LEGACY_RULES_DIR = `${KILO_CODE_LEGACY_DIR}/rules`;
2399
+ KILO_CODE_LEGACY_WORKFLOWS_DIR = `${KILO_CODE_LEGACY_DIR}/workflows`;
2400
+ KILO_CODE_LEGACY_SKILLS_DIR = `${KILO_CODE_LEGACY_DIR}/skills`;
2401
+ KILO_CODE_LEGACY_MCP_FILE = `${KILO_CODE_LEGACY_DIR}/mcp.json`;
2402
+ KILO_CODE_LEGACY_MODES_FILE = ".kilocodemodes";
2403
+ KILO_CODE_GLOBAL_DIR = ".kilo";
2404
+ KILO_CODE_GLOBAL_AGENTS_MD = `${KILO_CODE_GLOBAL_DIR}/AGENTS.md`;
2405
+ KILO_CODE_GLOBAL_RULES_DIR = `${KILO_CODE_GLOBAL_DIR}/rules`;
2406
+ KILO_CODE_GLOBAL_COMMANDS_DIR = `${KILO_CODE_GLOBAL_DIR}/commands`;
2407
+ KILO_CODE_GLOBAL_AGENTS_DIR = `${KILO_CODE_GLOBAL_DIR}/agents`;
2408
+ KILO_CODE_GLOBAL_SKILLS_DIR = `${KILO_CODE_GLOBAL_DIR}/skills`;
2409
+ KILO_CODE_GLOBAL_MCP_FILE = `${KILO_CODE_GLOBAL_DIR}/mcp.json`;
2410
+ KILO_CODE_GLOBAL_IGNORE = ".kilocodeignore";
2411
+ KILO_CODE_GLOBAL_AGENTS_SKILLS_DIR = ".agents/skills";
2412
+ KILO_CODE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
2413
+ KILO_CODE_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
2414
+ KILO_CODE_CANONICAL_AGENTS_DIR = ".agentsmesh/agents";
2415
+ KILO_CODE_CANONICAL_MCP = ".agentsmesh/mcp.json";
2416
+ KILO_CODE_CANONICAL_IGNORE = ".agentsmesh/ignore";
2417
+ }
2418
+ });
2419
+ async function buildKiloCodeImportPaths(refs, projectRoot, scope = "project") {
2420
+ if (scope === "global") {
2421
+ refs.set(KILO_CODE_GLOBAL_AGENTS_MD, `${AB_RULES2}/_root.md`);
2422
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_RULES_DIR)) {
2423
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_RULES2, ".md");
2424
+ }
2425
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_COMMANDS_DIR)) {
2426
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS2, ".md");
2427
+ }
2428
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_AGENTS_DIR)) {
2429
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS2, ".md");
2430
+ }
2431
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_SKILLS_DIR)) {
2432
+ addSkillLikeMapping(refs, rel(projectRoot, absPath), KILO_CODE_GLOBAL_SKILLS_DIR);
2433
+ }
2434
+ refs.set(KILO_CODE_GLOBAL_MCP_FILE, ".agentsmesh/mcp.json");
2435
+ return;
2436
+ }
2437
+ refs.set(KILO_CODE_ROOT_RULE, `${AB_RULES2}/_root.md`);
2438
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_RULES_DIR)) {
2439
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_RULES2, ".md");
2440
+ }
2441
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_COMMANDS_DIR)) {
2442
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS2, ".md");
2443
+ }
2444
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_AGENTS_DIR)) {
2445
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS2, ".md");
2446
+ }
2447
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_SKILLS_DIR)) {
2448
+ addSkillLikeMapping(refs, rel(projectRoot, absPath), KILO_CODE_SKILLS_DIR);
2449
+ }
2450
+ refs.set(KILO_CODE_MCP_FILE, ".agentsmesh/mcp.json");
2451
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_LEGACY_RULES_DIR)) {
2452
+ const relPath = rel(projectRoot, absPath);
2453
+ if (basename(relPath) === "00-root.md") {
2454
+ refs.set(relPath, `${AB_RULES2}/_root.md`);
2455
+ continue;
2456
+ }
2457
+ addSimpleFileMapping(refs, relPath, AB_RULES2, ".md");
2458
+ }
2459
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_LEGACY_WORKFLOWS_DIR)) {
2460
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS2, ".md");
2461
+ }
2462
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_LEGACY_SKILLS_DIR)) {
2463
+ addSkillLikeMapping(refs, rel(projectRoot, absPath), KILO_CODE_LEGACY_SKILLS_DIR);
2464
+ }
2465
+ refs.set(KILO_CODE_LEGACY_MCP_FILE, ".agentsmesh/mcp.json");
2466
+ }
2467
+ var init_kilo_code = __esm({
2468
+ "src/core/reference/import-maps/kilo-code.ts"() {
2469
+ init_import_map_shared();
2470
+ init_constants8();
2471
+ init_constants2();
2472
+ }
2473
+ });
2474
+
2284
2475
  // src/targets/kiro/constants.ts
2285
2476
  var KIRO_TARGET, KIRO_AGENTS_MD, KIRO_DIR, KIRO_STEERING_DIR, KIRO_SKILLS_DIR, KIRO_AGENTS_DIR, KIRO_HOOKS_DIR, KIRO_SETTINGS_DIR, KIRO_MCP_FILE, KIRO_IGNORE, KIRO_GLOBAL_STEERING_DIR, KIRO_GLOBAL_STEERING_AGENTS_MD, KIRO_GLOBAL_SKILLS_DIR, KIRO_GLOBAL_AGENTS_DIR, KIRO_GLOBAL_MCP_FILE, KIRO_GLOBAL_IGNORE, KIRO_GLOBAL_AGENTS_SKILLS_DIR, KIRO_CANONICAL_ROOT_RULE, KIRO_CANONICAL_RULES_DIR, KIRO_CANONICAL_AGENTS_DIR, KIRO_CANONICAL_MCP, KIRO_CANONICAL_HOOKS, KIRO_CANONICAL_IGNORE;
2286
- var init_constants8 = __esm({
2477
+ var init_constants9 = __esm({
2287
2478
  "src/targets/kiro/constants.ts"() {
2288
2479
  KIRO_TARGET = "kiro";
2289
2480
  KIRO_AGENTS_MD = "AGENTS.md";
@@ -2342,14 +2533,14 @@ async function buildKiroImportPaths(refs, projectRoot, scope = "project") {
2342
2533
  var init_kiro = __esm({
2343
2534
  "src/core/reference/import-maps/kiro.ts"() {
2344
2535
  init_import_map_shared();
2345
- init_constants8();
2536
+ init_constants9();
2346
2537
  init_constants2();
2347
2538
  }
2348
2539
  });
2349
2540
 
2350
2541
  // src/targets/roo-code/constants.ts
2351
2542
  var ROO_CODE_TARGET, ROO_CODE_DIR, ROO_CODE_ROOT_RULE, ROO_CODE_ROOT_RULE_FALLBACK, ROO_CODE_RULES_DIR, ROO_CODE_COMMANDS_DIR, ROO_CODE_SKILLS_DIR, ROO_CODE_MCP_FILE, ROO_CODE_IGNORE, ROO_CODE_MODES_FILE, ROO_CODE_GLOBAL_MODES_FILE, ROO_CODE_GLOBAL_DIR, ROO_CODE_GLOBAL_RULES_DIR, ROO_CODE_GLOBAL_COMMANDS_DIR, ROO_CODE_GLOBAL_SKILLS_DIR, ROO_CODE_GLOBAL_MCP_FILE, ROO_CODE_GLOBAL_IGNORE, ROO_CODE_GLOBAL_AGENTS_MD, ROO_CODE_GLOBAL_AGENTS_SKILLS_DIR, ROO_CODE_CANONICAL_RULES_DIR, ROO_CODE_CANONICAL_COMMANDS_DIR, ROO_CODE_CANONICAL_MCP, ROO_CODE_CANONICAL_IGNORE;
2352
- var init_constants9 = __esm({
2543
+ var init_constants10 = __esm({
2353
2544
  "src/targets/roo-code/constants.ts"() {
2354
2545
  ROO_CODE_TARGET = "roo-code";
2355
2546
  ROO_CODE_DIR = ".roo";
@@ -2416,7 +2607,7 @@ async function buildRooCodeImportPaths(refs, projectRoot, scope = "project") {
2416
2607
  var init_roo_code = __esm({
2417
2608
  "src/core/reference/import-maps/roo-code.ts"() {
2418
2609
  init_import_map_shared();
2419
- init_constants9();
2610
+ init_constants10();
2420
2611
  init_constants2();
2421
2612
  }
2422
2613
  });
@@ -2455,6 +2646,7 @@ var init_import_maps = __esm({
2455
2646
  init_cursor();
2456
2647
  init_gemini_cli();
2457
2648
  init_junie();
2649
+ init_kilo_code();
2458
2650
  init_kiro();
2459
2651
  init_roo_code();
2460
2652
  init_windsurf();
@@ -2943,7 +3135,7 @@ var init_claude_code2 = __esm({
2943
3135
  init_skill_mirror();
2944
3136
  init_global_instructions();
2945
3137
  init_global_extras();
2946
- init_importer12();
3138
+ init_importer13();
2947
3139
  init_import_mappers2();
2948
3140
  init_linter2();
2949
3141
  init_import_map_builders();
@@ -3747,11 +3939,11 @@ var init_linter3 = __esm({
3747
3939
  });
3748
3940
 
3749
3941
  // src/core/lint/shared/helpers.ts
3750
- function createWarning(file, target13, message) {
3942
+ function createWarning(file, target14, message) {
3751
3943
  return {
3752
3944
  level: "warning",
3753
3945
  file,
3754
- target: target13,
3946
+ target: target14,
3755
3947
  message
3756
3948
  };
3757
3949
  }
@@ -3761,12 +3953,12 @@ function formatOxfordComma(items) {
3761
3953
  if (items.length === 2) return `${items[0]} and ${items[1]}`;
3762
3954
  return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
3763
3955
  }
3764
- function createUnsupportedHookWarning(event, target13, supportedEvents, options) {
3765
- const by = options?.unsupportedBy ?? target13;
3956
+ function createUnsupportedHookWarning(event, target14, supportedEvents, options) {
3957
+ const by = options?.unsupportedBy ?? target14;
3766
3958
  const supported = formatOxfordComma(supportedEvents);
3767
3959
  return createWarning(
3768
3960
  ".agentsmesh/hooks.yaml",
3769
- target13,
3961
+ target14,
3770
3962
  `${event} is not supported by ${by}; only ${supported} are projected.`
3771
3963
  );
3772
3964
  }
@@ -3950,7 +4142,7 @@ var init_cline2 = __esm({
3950
4142
 
3951
4143
  // src/targets/codex-cli/constants.ts
3952
4144
  var CODEX_TARGET, CODEX_MD, AGENTS_MD, CODEX_GLOBAL_AGENTS_MD, CODEX_GLOBAL_AGENTS_OVERRIDE_MD, CODEX_SKILLS_DIR, CODEX_SKILLS_FALLBACK_DIR, CODEX_CONFIG_TOML, CODEX_INSTRUCTIONS_DIR, CODEX_RULES_DIR, CODEX_AGENTS_DIR, CODEX_CANONICAL_RULES_DIR, CODEX_CANONICAL_COMMANDS_DIR, CODEX_CANONICAL_AGENTS_DIR, CODEX_CANONICAL_SKILLS_DIR, CODEX_CANONICAL_MCP, CODEX_RULE_EMBED_MARKER, CODEX_RULE_EMBED_JSON_PREFIX, CODEX_RULE_EMBED_B64_BEGIN, CODEX_RULE_EMBED_B64_END, CODEX_RULE_EMBED_B64_LINE, CODEX_RULE_INDEX_START, CODEX_RULE_INDEX_END;
3953
- var init_constants10 = __esm({
4145
+ var init_constants11 = __esm({
3954
4146
  "src/targets/codex-cli/constants.ts"() {
3955
4147
  CODEX_TARGET = "codex-cli";
3956
4148
  CODEX_MD = "codex.md";
@@ -4013,7 +4205,7 @@ function summarizeRule(rule) {
4013
4205
  scopes.push(`Enforced in \`${CODEX_RULES_DIR}/${ruleSlug3(rule.source)}.rules\`.`);
4014
4206
  }
4015
4207
  if (rule.targets.length > 0) {
4016
- scopes.push(`Targeted to ${rule.targets.map((target13) => `\`${target13}\``).join(", ")}.`);
4208
+ scopes.push(`Targeted to ${rule.targets.map((target14) => `\`${target14}\``).join(", ")}.`);
4017
4209
  }
4018
4210
  return scopes.join(" ");
4019
4211
  }
@@ -4043,7 +4235,7 @@ function stripCodexRuleIndex(content) {
4043
4235
  var init_instruction_mirror = __esm({
4044
4236
  "src/targets/codex-cli/instruction-mirror.ts"() {
4045
4237
  init_markdown();
4046
- init_constants10();
4238
+ init_constants11();
4047
4239
  }
4048
4240
  });
4049
4241
  function looksLikeCodexRulesDsl(body) {
@@ -4109,7 +4301,7 @@ function renderCodexGlobalInstructions(canonical) {
4109
4301
  var init_rules = __esm({
4110
4302
  "src/targets/codex-cli/generator/rules.ts"() {
4111
4303
  init_managed_blocks();
4112
- init_constants10();
4304
+ init_constants11();
4113
4305
  init_instruction_mirror();
4114
4306
  }
4115
4307
  });
@@ -4150,7 +4342,7 @@ function generateCommands4(canonical) {
4150
4342
  var init_skills = __esm({
4151
4343
  "src/targets/codex-cli/generator/skills.ts"() {
4152
4344
  init_markdown();
4153
- init_constants10();
4345
+ init_constants11();
4154
4346
  init_command_skill();
4155
4347
  }
4156
4348
  });
@@ -4191,7 +4383,7 @@ ${body}
4191
4383
  }
4192
4384
  var init_agents = __esm({
4193
4385
  "src/targets/codex-cli/generator/agents.ts"() {
4194
- init_constants10();
4386
+ init_constants11();
4195
4387
  }
4196
4388
  });
4197
4389
 
@@ -4243,7 +4435,7 @@ function needsTomlQuoting(key) {
4243
4435
  var init_mcp = __esm({
4244
4436
  "src/targets/codex-cli/generator/mcp.ts"() {
4245
4437
  init_mcp_servers();
4246
- init_constants10();
4438
+ init_constants11();
4247
4439
  }
4248
4440
  });
4249
4441
 
@@ -4302,11 +4494,7 @@ async function importMcp(projectRoot, results) {
4302
4494
  if (server) mcpServers[name] = server;
4303
4495
  }
4304
4496
  if (Object.keys(mcpServers).length === 0) return;
4305
- await mkdirp(join(projectRoot, ".agentsmesh"));
4306
- await writeFileAtomic(
4307
- join(projectRoot, CODEX_CANONICAL_MCP),
4308
- JSON.stringify({ mcpServers }, null, 2)
4309
- );
4497
+ await writeMcpWithMerge(projectRoot, CODEX_CANONICAL_MCP, mcpServers);
4310
4498
  results.push({
4311
4499
  fromTool: CODEX_TARGET,
4312
4500
  fromPath: configPath,
@@ -4317,7 +4505,8 @@ async function importMcp(projectRoot, results) {
4317
4505
  var init_mcp_helpers = __esm({
4318
4506
  "src/targets/codex-cli/mcp-helpers.ts"() {
4319
4507
  init_fs();
4320
- init_constants10();
4508
+ init_mcp_merge();
4509
+ init_constants11();
4321
4510
  }
4322
4511
  });
4323
4512
  function shouldImportScopedAgentsRule(relDir) {
@@ -4411,7 +4600,7 @@ var init_skills_adapter2 = __esm({
4411
4600
  init_projected_agent_skill();
4412
4601
  init_scoped_agents_import();
4413
4602
  init_skill_import_pipeline();
4414
- init_constants10();
4603
+ init_constants11();
4415
4604
  }
4416
4605
  });
4417
4606
  async function importCodexAgentsFromToml(projectRoot, results, normalize) {
@@ -4464,7 +4653,7 @@ var init_importer_agents = __esm({
4464
4653
  "src/targets/codex-cli/importer-agents.ts"() {
4465
4654
  init_fs();
4466
4655
  init_projected_agent_skill();
4467
- init_constants10();
4656
+ init_constants11();
4468
4657
  }
4469
4658
  });
4470
4659
  function tryParseEmbeddedCanonicalFromCodexRules(content) {
@@ -4507,7 +4696,7 @@ function tryParseEmbeddedCanonicalFromCodexRules(content) {
4507
4696
  }
4508
4697
  var init_codex_rules_embed = __esm({
4509
4698
  "src/targets/codex-cli/codex-rules-embed.ts"() {
4510
- init_constants10();
4699
+ init_constants11();
4511
4700
  }
4512
4701
  });
4513
4702
  async function importCodexNonRootRuleFiles(projectRoot, destDir, normalize) {
@@ -4581,7 +4770,7 @@ var init_import_codex_non_root_rules = __esm({
4581
4770
  init_fs();
4582
4771
  init_markdown();
4583
4772
  init_import_metadata();
4584
- init_constants10();
4773
+ init_constants11();
4585
4774
  init_codex_rules_embed();
4586
4775
  }
4587
4776
  });
@@ -4703,7 +4892,7 @@ var init_importer_rules2 = __esm({
4703
4892
  init_embedded_rules();
4704
4893
  init_import_orchestrator();
4705
4894
  init_scoped_agents_import();
4706
- init_constants10();
4895
+ init_constants11();
4707
4896
  init_import_codex_non_root_rules();
4708
4897
  init_instruction_mirror();
4709
4898
  }
@@ -4728,7 +4917,7 @@ async function importFromCodex(projectRoot, options) {
4728
4917
  var init_importer3 = __esm({
4729
4918
  "src/targets/codex-cli/importer.ts"() {
4730
4919
  init_import_rewriter();
4731
- init_constants10();
4920
+ init_constants11();
4732
4921
  init_mcp_helpers();
4733
4922
  init_skills_adapter2();
4734
4923
  init_importer_agents();
@@ -4753,7 +4942,7 @@ function lintRules4(canonical, projectRoot, _projectFiles) {
4753
4942
  }
4754
4943
  var init_linter4 = __esm({
4755
4944
  "src/targets/codex-cli/linter.ts"() {
4756
- init_constants10();
4945
+ init_constants11();
4757
4946
  }
4758
4947
  });
4759
4948
 
@@ -4803,7 +4992,7 @@ var target4, project4, global3, globalCapabilities4, descriptor4;
4803
4992
  var init_codex_cli2 = __esm({
4804
4993
  "src/targets/codex-cli/index.ts"() {
4805
4994
  init_generator5();
4806
- init_constants10();
4995
+ init_constants11();
4807
4996
  init_importer3();
4808
4997
  init_linter4();
4809
4998
  init_lint2();
@@ -5067,10 +5256,7 @@ async function importMcp2(projectRoot, results) {
5067
5256
  importedFrom.push(srcPath);
5068
5257
  }
5069
5258
  if (Object.keys(merged).length === 0) return;
5070
- await writeFileAtomic(
5071
- join(projectRoot, CONTINUE_CANONICAL_MCP),
5072
- JSON.stringify({ mcpServers: merged }, null, 2)
5073
- );
5259
+ await writeMcpWithMerge(projectRoot, CONTINUE_CANONICAL_MCP, merged);
5074
5260
  for (const fromPath of importedFrom) {
5075
5261
  results.push({
5076
5262
  fromTool: CONTINUE_TARGET,
@@ -5094,6 +5280,7 @@ var init_importer4 = __esm({
5094
5280
  init_fs();
5095
5281
  init_embedded_skill();
5096
5282
  init_descriptor_import_runner();
5283
+ init_mcp_merge();
5097
5284
  init_shared_import_helpers();
5098
5285
  init_constants5();
5099
5286
  init_continue2();
@@ -5424,7 +5611,7 @@ var init_continue2 = __esm({
5424
5611
 
5425
5612
  // src/targets/copilot/constants.ts
5426
5613
  var COPILOT_TARGET, COPILOT_INSTRUCTIONS, COPILOT_CONTEXT_DIR, COPILOT_INSTRUCTIONS_DIR, COPILOT_PROMPTS_DIR, COPILOT_HOOKS_DIR, COPILOT_SKILLS_DIR, COPILOT_AGENTS_DIR, COPILOT_CANONICAL_RULES_DIR, COPILOT_CANONICAL_COMMANDS_DIR, COPILOT_CANONICAL_AGENTS_DIR, COPILOT_CANONICAL_SKILLS_DIR, COPILOT_CANONICAL_HOOKS, COPILOT_LEGACY_HOOKS_DIR, COPILOT_GLOBAL_INSTRUCTIONS, COPILOT_GLOBAL_AGENTS_DIR, COPILOT_GLOBAL_SKILLS_DIR, COPILOT_GLOBAL_PROMPTS_DIR, COPILOT_GLOBAL_AGENTS_MD, COPILOT_GLOBAL_CLAUDE_SKILLS_DIR, COPILOT_GLOBAL_AGENTS_SKILLS_DIR;
5427
- var init_constants11 = __esm({
5614
+ var init_constants12 = __esm({
5428
5615
  "src/targets/copilot/constants.ts"() {
5429
5616
  COPILOT_TARGET = "copilot";
5430
5617
  COPILOT_INSTRUCTIONS = ".github/copilot-instructions.md";
@@ -5489,7 +5676,7 @@ function parseCommandPromptFrontmatter(frontmatter, promptPath) {
5489
5676
  var init_command_prompt = __esm({
5490
5677
  "src/targets/copilot/command-prompt.ts"() {
5491
5678
  init_markdown();
5492
- init_constants11();
5679
+ init_constants12();
5493
5680
  }
5494
5681
  });
5495
5682
 
@@ -5641,7 +5828,7 @@ function generateHooks3(canonical) {
5641
5828
  var init_generator7 = __esm({
5642
5829
  "src/targets/copilot/generator.ts"() {
5643
5830
  init_markdown();
5644
- init_constants11();
5831
+ init_constants12();
5645
5832
  init_command_prompt();
5646
5833
  init_hook_entry();
5647
5834
  }
@@ -5735,7 +5922,7 @@ async function importHooks(projectRoot, results) {
5735
5922
  var init_hook_parser = __esm({
5736
5923
  "src/targets/copilot/hook-parser.ts"() {
5737
5924
  init_fs();
5738
- init_constants11();
5925
+ init_constants12();
5739
5926
  }
5740
5927
  });
5741
5928
  async function importSkills2(projectRoot, results, normalize, skillsDirRel = COPILOT_SKILLS_DIR) {
@@ -5756,7 +5943,7 @@ async function importSkills2(projectRoot, results, normalize, skillsDirRel = COP
5756
5943
  var init_skills_adapter3 = __esm({
5757
5944
  "src/targets/copilot/skills-adapter.ts"() {
5758
5945
  init_skill_import_pipeline();
5759
- init_constants11();
5946
+ init_constants12();
5760
5947
  }
5761
5948
  });
5762
5949
 
@@ -5779,7 +5966,7 @@ var init_importer5 = __esm({
5779
5966
  "src/targets/copilot/importer.ts"() {
5780
5967
  init_import_rewriter();
5781
5968
  init_descriptor_import_runner();
5782
- init_constants11();
5969
+ init_constants12();
5783
5970
  init_hook_parser();
5784
5971
  init_skills_adapter3();
5785
5972
  init_copilot2();
@@ -5798,7 +5985,7 @@ var init_import_mappers4 = __esm({
5798
5985
  init_import_metadata();
5799
5986
  init_shared_import_helpers();
5800
5987
  init_command_prompt();
5801
- init_constants11();
5988
+ init_constants12();
5802
5989
  copilotLegacyRuleMapper = async ({
5803
5990
  relativePath,
5804
5991
  normalizeTo,
@@ -5915,7 +6102,7 @@ function lintRules6(canonical, projectRoot, projectFiles, options) {
5915
6102
  var init_linter6 = __esm({
5916
6103
  "src/targets/copilot/linter.ts"() {
5917
6104
  init_validate_rules();
5918
- init_constants11();
6105
+ init_constants12();
5919
6106
  }
5920
6107
  });
5921
6108
 
@@ -6032,7 +6219,7 @@ var SCRIPT_PREFIX_RE;
6032
6219
  var init_hook_assets = __esm({
6033
6220
  "src/targets/copilot/hook-assets.ts"() {
6034
6221
  init_fs();
6035
- init_constants11();
6222
+ init_constants12();
6036
6223
  init_hook_entry();
6037
6224
  SCRIPT_PREFIX_RE = /^(?<prefix>\s*(?:(?:bash|sh|zsh)\s+)?)["']?(?<path>(?:\.\.\/|\.\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?<suffix>(?:\s.*)?)$/;
6038
6225
  }
@@ -6046,7 +6233,7 @@ var generateCopilotGlobalExtras;
6046
6233
  var init_scope_extras2 = __esm({
6047
6234
  "src/targets/copilot/scope-extras.ts"() {
6048
6235
  init_fs();
6049
- init_constants11();
6236
+ init_constants12();
6050
6237
  generateCopilotGlobalExtras = async (canonical, projectRoot, scope, enabledFeatures) => {
6051
6238
  if (scope !== "global" || !enabledFeatures.has("rules")) return [];
6052
6239
  const root = canonical.rules.find((r) => r.root);
@@ -6069,7 +6256,7 @@ var target6, project6, global4, globalCapabilities6, descriptor6;
6069
6256
  var init_copilot2 = __esm({
6070
6257
  "src/targets/copilot/index.ts"() {
6071
6258
  init_generator7();
6072
- init_constants11();
6259
+ init_constants12();
6073
6260
  init_importer5();
6074
6261
  init_import_mappers4();
6075
6262
  init_linter6();
@@ -6838,8 +7025,8 @@ async function hasGlobalCursorArtifacts(projectRoot) {
6838
7025
  join(projectRoot, CURSOR_COMMANDS_DIR)
6839
7026
  ];
6840
7027
  for (const p of candidates) {
6841
- const stat6 = await readFileSafe(p);
6842
- if (stat6 !== null && stat6.trim() !== "") return true;
7028
+ const stat7 = await readFileSafe(p);
7029
+ if (stat7 !== null && stat7.trim() !== "") return true;
6843
7030
  }
6844
7031
  const skillFiles = await readDirRecursive(join(projectRoot, CURSOR_GLOBAL_SKILLS_DIR));
6845
7032
  if (skillFiles.some((f) => f.endsWith(".md"))) return true;
@@ -6997,9 +7184,8 @@ async function importMcp3(projectRoot, results) {
6997
7184
  return;
6998
7185
  }
6999
7186
  if (!parsed || typeof parsed !== "object" || !("mcpServers" in parsed)) return;
7000
- const destPath = join(projectRoot, CURSOR_CANONICAL_MCP);
7001
- await mkdirp(dirname(destPath));
7002
- await writeFileAtomic(destPath, content);
7187
+ const servers = parsed.mcpServers;
7188
+ await writeMcpWithMerge(projectRoot, CURSOR_CANONICAL_MCP, servers);
7003
7189
  results.push({
7004
7190
  fromTool: "cursor",
7005
7191
  fromPath: mcpPath,
@@ -7026,6 +7212,7 @@ var init_importer6 = __esm({
7026
7212
  init_import_rewriter();
7027
7213
  init_fs();
7028
7214
  init_descriptor_import_runner();
7215
+ init_mcp_merge();
7029
7216
  init_importer_rules3();
7030
7217
  init_settings_helpers();
7031
7218
  init_skills_adapter4();
@@ -7327,7 +7514,7 @@ var init_cursor2 = __esm({
7327
7514
 
7328
7515
  // src/targets/gemini-cli/constants.ts
7329
7516
  var GEMINI_TARGET, GEMINI_ROOT, GEMINI_COMPAT_AGENTS, GEMINI_RULES_DIR, GEMINI_COMPAT_INNER_ROOT, GEMINI_COMMANDS_DIR, GEMINI_POLICIES_DIR, GEMINI_SETTINGS, GEMINI_IGNORE, GEMINI_SKILLS_DIR, GEMINI_AGENTS_DIR, GEMINI_SYSTEM, GEMINI_DEFAULT_POLICIES_FILE, GEMINI_CANONICAL_RULES_DIR, GEMINI_CANONICAL_COMMANDS_DIR, GEMINI_CANONICAL_AGENTS_DIR, GEMINI_CANONICAL_SKILLS_DIR, GEMINI_CANONICAL_MCP, GEMINI_CANONICAL_HOOKS, GEMINI_CANONICAL_IGNORE, GEMINI_CANONICAL_PERMISSIONS, GEMINI_GLOBAL_ROOT, GEMINI_GLOBAL_COMPAT_AGENTS, GEMINI_GLOBAL_SETTINGS, GEMINI_GLOBAL_COMMANDS_DIR, GEMINI_GLOBAL_SKILLS_DIR, GEMINI_GLOBAL_AGENTS_DIR;
7330
- var init_constants12 = __esm({
7517
+ var init_constants13 = __esm({
7331
7518
  "src/targets/gemini-cli/constants.ts"() {
7332
7519
  GEMINI_TARGET = "gemini-cli";
7333
7520
  GEMINI_ROOT = "GEMINI.md";
@@ -7379,7 +7566,7 @@ function generateRules8(canonical) {
7379
7566
  var init_rules3 = __esm({
7380
7567
  "src/targets/gemini-cli/generator/rules.ts"() {
7381
7568
  init_managed_blocks();
7382
- init_constants12();
7569
+ init_constants13();
7383
7570
  }
7384
7571
  });
7385
7572
  function canonicalCommandNameToGeminiTomlPath(cmdName, commandsDir) {
@@ -7419,7 +7606,7 @@ function generateCommands8(canonical) {
7419
7606
  }
7420
7607
  var init_commands2 = __esm({
7421
7608
  "src/targets/gemini-cli/generator/commands.ts"() {
7422
- init_constants12();
7609
+ init_constants13();
7423
7610
  init_command_namespace();
7424
7611
  }
7425
7612
  });
@@ -7447,7 +7634,7 @@ function generateAgents6(canonical) {
7447
7634
  var init_agents3 = __esm({
7448
7635
  "src/targets/gemini-cli/generator/agents.ts"() {
7449
7636
  init_markdown();
7450
- init_constants12();
7637
+ init_constants13();
7451
7638
  }
7452
7639
  });
7453
7640
 
@@ -7478,7 +7665,7 @@ function generateSkills8(canonical) {
7478
7665
  var init_skills3 = __esm({
7479
7666
  "src/targets/gemini-cli/generator/skills.ts"() {
7480
7667
  init_markdown();
7481
- init_constants12();
7668
+ init_constants13();
7482
7669
  }
7483
7670
  });
7484
7671
 
@@ -7539,7 +7726,7 @@ function generateGeminiSettingsFiles(canonical) {
7539
7726
  var init_settings = __esm({
7540
7727
  "src/targets/gemini-cli/generator/settings.ts"() {
7541
7728
  init_hook_command();
7542
- init_constants12();
7729
+ init_constants13();
7543
7730
  }
7544
7731
  });
7545
7732
 
@@ -7550,7 +7737,7 @@ function generateIgnore4(canonical) {
7550
7737
  }
7551
7738
  var init_ignore2 = __esm({
7552
7739
  "src/targets/gemini-cli/generator/ignore.ts"() {
7553
- init_constants12();
7740
+ init_constants13();
7554
7741
  }
7555
7742
  });
7556
7743
 
@@ -7651,7 +7838,7 @@ function generateGeminiPermissionsPolicies(canonical) {
7651
7838
  }
7652
7839
  var init_policies_generator = __esm({
7653
7840
  "src/targets/gemini-cli/policies-generator.ts"() {
7654
- init_constants12();
7841
+ init_constants13();
7655
7842
  }
7656
7843
  });
7657
7844
  function mapGeminiHookEvent(event) {
@@ -7779,7 +7966,7 @@ var init_format_helpers_settings = __esm({
7779
7966
  "src/targets/gemini-cli/format-helpers-settings.ts"() {
7780
7967
  init_hook_command();
7781
7968
  init_fs();
7782
- init_constants12();
7969
+ init_constants13();
7783
7970
  init_format_helpers_shared();
7784
7971
  }
7785
7972
  });
@@ -7804,7 +7991,7 @@ async function importGeminiIgnore(projectRoot, results) {
7804
7991
  var init_format_helpers = __esm({
7805
7992
  "src/targets/gemini-cli/format-helpers.ts"() {
7806
7993
  init_fs();
7807
- init_constants12();
7994
+ init_constants13();
7808
7995
  init_format_helpers_shared();
7809
7996
  init_format_helpers_settings();
7810
7997
  }
@@ -7912,7 +8099,7 @@ async function importGeminiPolicies(projectRoot) {
7912
8099
  var init_policies_importer = __esm({
7913
8100
  "src/targets/gemini-cli/policies-importer.ts"() {
7914
8101
  init_fs();
7915
- init_constants12();
8102
+ init_constants13();
7916
8103
  }
7917
8104
  });
7918
8105
  function stripProjectRootCanonicalPrefix(content, projectRoot) {
@@ -8038,7 +8225,7 @@ var init_importer_skills_agents = __esm({
8038
8225
  init_markdown();
8039
8226
  init_import_metadata();
8040
8227
  init_projected_agent_skill();
8041
- init_constants12();
8228
+ init_constants13();
8042
8229
  }
8043
8230
  });
8044
8231
  async function importRootRule2(projectRoot, results, normalize) {
@@ -8114,7 +8301,7 @@ var init_importer7 = __esm({
8114
8301
  init_import_metadata();
8115
8302
  init_embedded_rules();
8116
8303
  init_descriptor_import_runner();
8117
- init_constants12();
8304
+ init_constants13();
8118
8305
  init_gemini_cli2();
8119
8306
  init_format_helpers();
8120
8307
  init_policies_importer();
@@ -8182,7 +8369,7 @@ var init_importer_mappers3 = __esm({
8182
8369
  init_import_metadata();
8183
8370
  init_shared_import_helpers();
8184
8371
  init_format_helpers();
8185
- init_constants12();
8372
+ init_constants13();
8186
8373
  }
8187
8374
  });
8188
8375
 
@@ -8206,7 +8393,7 @@ function lintRules8(canonical, projectRoot, projectFiles, options) {
8206
8393
  var init_linter8 = __esm({
8207
8394
  "src/targets/gemini-cli/linter.ts"() {
8208
8395
  init_validate_rules();
8209
- init_constants12();
8396
+ init_constants13();
8210
8397
  }
8211
8398
  });
8212
8399
 
@@ -8287,7 +8474,7 @@ var init_gemini_cli2 = __esm({
8287
8474
  init_generator11();
8288
8475
  init_capabilities();
8289
8476
  init_policies_generator();
8290
- init_constants12();
8477
+ init_constants13();
8291
8478
  init_importer7();
8292
8479
  init_import_mappers6();
8293
8480
  init_linter8();
@@ -8861,23 +9048,567 @@ var init_junie2 = __esm({
8861
9048
  };
8862
9049
  }
8863
9050
  });
8864
- function toKebab(value) {
8865
- return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
9051
+ function generateRules10(canonical) {
9052
+ const outputs = [];
9053
+ const root = canonical.rules.find((rule) => rule.root);
9054
+ if (root) {
9055
+ outputs.push({
9056
+ path: KILO_CODE_ROOT_RULE,
9057
+ content: root.body.trim() ? root.body : ""
9058
+ });
9059
+ }
9060
+ for (const rule of canonical.rules) {
9061
+ if (rule.root) continue;
9062
+ if (rule.targets.length > 0 && !rule.targets.includes(KILO_CODE_TARGET)) continue;
9063
+ const slug = basename(rule.source, ".md");
9064
+ const frontmatter = {};
9065
+ if (rule.description) frontmatter.description = rule.description;
9066
+ if (rule.globs.length > 0) frontmatter.globs = rule.globs;
9067
+ const content = Object.keys(frontmatter).length > 0 ? serializeFrontmatter(frontmatter, rule.body.trim() || "") : rule.body.trim() || "";
9068
+ outputs.push({
9069
+ path: `${KILO_CODE_RULES_DIR}/${slug}.md`,
9070
+ content
9071
+ });
9072
+ }
9073
+ return outputs;
8866
9074
  }
8867
- function hookText(entry) {
8868
- return entry.type === "prompt" ? entry.prompt : entry.command;
9075
+ function generateCommands10(canonical) {
9076
+ return canonical.commands.map((command) => {
9077
+ const frontmatter = {};
9078
+ if (command.description) frontmatter.description = command.description;
9079
+ return {
9080
+ path: `${KILO_CODE_COMMANDS_DIR}/${command.name}.md`,
9081
+ content: serializeFrontmatter(frontmatter, command.body.trim() || "")
9082
+ };
9083
+ });
8869
9084
  }
8870
- function toWhen(event, matcher) {
8871
- const type = CANONICAL_TO_KIRO[event];
8872
- if (event === "PreToolUse" || event === "PostToolUse") {
8873
- return { type, tools: [matcher || "*"] };
8874
- }
8875
- return { type };
9085
+ function generateAgents8(canonical) {
9086
+ return canonical.agents.map((agent) => {
9087
+ const slug = basename(agent.source, ".md");
9088
+ const frontmatter = { mode: "subagent" };
9089
+ if (agent.description) frontmatter.description = agent.description;
9090
+ if (agent.model) frontmatter.model = agent.model;
9091
+ if (agent.tools.length > 0) frontmatter.tools = agent.tools;
9092
+ if (agent.disallowedTools.length > 0) frontmatter.disallowedTools = agent.disallowedTools;
9093
+ return {
9094
+ path: `${KILO_CODE_AGENTS_DIR}/${slug}.md`,
9095
+ content: serializeFrontmatter(frontmatter, agent.body.trim() || "")
9096
+ };
9097
+ });
8876
9098
  }
8877
- function generateKiroHooks(hooks) {
8878
- const outputs = [];
8879
- for (const [event, entries] of Object.entries(hooks)) {
8880
- const mappedEvent = event;
9099
+ function generateMcp8(canonical) {
9100
+ if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
9101
+ return [
9102
+ {
9103
+ path: KILO_CODE_MCP_FILE,
9104
+ content: JSON.stringify({ mcpServers: canonical.mcp.mcpServers }, null, 2)
9105
+ }
9106
+ ];
9107
+ }
9108
+ function generateIgnore6(canonical) {
9109
+ if (canonical.ignore.length === 0) return [];
9110
+ return [{ path: KILO_CODE_IGNORE, content: canonical.ignore.join("\n") }];
9111
+ }
9112
+ function generateSkills10(canonical) {
9113
+ return generateEmbeddedSkills(canonical, KILO_CODE_SKILLS_DIR);
9114
+ }
9115
+ var init_generator13 = __esm({
9116
+ "src/targets/kilo-code/generator.ts"() {
9117
+ init_embedded_skill();
9118
+ init_markdown();
9119
+ init_constants8();
9120
+ }
9121
+ });
9122
+ var kiloNonRootRuleMapper, kiloCommandMapper, kiloAgentMapper;
9123
+ var init_import_mappers7 = __esm({
9124
+ "src/targets/kilo-code/import-mappers.ts"() {
9125
+ init_markdown();
9126
+ init_import_metadata();
9127
+ init_constants8();
9128
+ kiloNonRootRuleMapper = async ({
9129
+ relativePath,
9130
+ normalizeTo,
9131
+ destDir
9132
+ }) => {
9133
+ const destPath = join(destDir, relativePath);
9134
+ const { frontmatter, body } = parseFrontmatter(normalizeTo(destPath));
9135
+ return {
9136
+ destPath,
9137
+ toPath: `${KILO_CODE_CANONICAL_RULES_DIR}/${relativePath}`,
9138
+ content: await serializeImportedRuleWithFallback(
9139
+ destPath,
9140
+ {
9141
+ root: false,
9142
+ description: typeof frontmatter.description === "string" ? frontmatter.description : void 0,
9143
+ globs: Array.isArray(frontmatter.globs) ? frontmatter.globs : void 0
9144
+ },
9145
+ body
9146
+ )
9147
+ };
9148
+ };
9149
+ kiloCommandMapper = async ({
9150
+ relativePath,
9151
+ normalizeTo,
9152
+ destDir
9153
+ }) => {
9154
+ const destPath = join(destDir, relativePath);
9155
+ const { frontmatter, body } = parseFrontmatter(normalizeTo(destPath));
9156
+ return {
9157
+ destPath,
9158
+ toPath: `${KILO_CODE_CANONICAL_COMMANDS_DIR}/${relativePath}`,
9159
+ content: await serializeImportedCommandWithFallback(
9160
+ destPath,
9161
+ {
9162
+ hasDescription: Object.prototype.hasOwnProperty.call(frontmatter, "description"),
9163
+ description: typeof frontmatter.description === "string" ? frontmatter.description : void 0,
9164
+ hasAllowedTools: false,
9165
+ allowedTools: []
9166
+ },
9167
+ body
9168
+ )
9169
+ };
9170
+ };
9171
+ kiloAgentMapper = async ({
9172
+ relativePath,
9173
+ normalizeTo,
9174
+ destDir
9175
+ }) => {
9176
+ const destPath = join(destDir, relativePath);
9177
+ const { frontmatter, body } = parseFrontmatter(normalizeTo(destPath));
9178
+ return {
9179
+ destPath,
9180
+ toPath: `${KILO_CODE_CANONICAL_AGENTS_DIR}/${relativePath}`,
9181
+ content: await serializeImportedAgentWithFallback(destPath, frontmatter, body)
9182
+ };
9183
+ };
9184
+ }
9185
+ });
9186
+ async function pathExists(absolutePath) {
9187
+ try {
9188
+ await stat(absolutePath);
9189
+ return true;
9190
+ } catch {
9191
+ return false;
9192
+ }
9193
+ }
9194
+ async function importLegacyRules(projectRoot, results, normalize) {
9195
+ const srcDir = join(projectRoot, KILO_CODE_LEGACY_RULES_DIR);
9196
+ if (!await pathExists(srcDir)) return;
9197
+ const destDir = join(projectRoot, KILO_CODE_CANONICAL_RULES_DIR);
9198
+ const rootSourceFile = join(srcDir, LEGACY_ROOT_RULE_FILE);
9199
+ const hasCurrentRoot = results.some((result) => result.toPath === CANONICAL_ROOT_RULE_PATH);
9200
+ const rootContent = hasCurrentRoot ? null : await readFileSafe(rootSourceFile);
9201
+ if (rootContent !== null) {
9202
+ const destPath = join(projectRoot, CANONICAL_ROOT_RULE_PATH);
9203
+ const normalized = normalize(rootContent, rootSourceFile, destPath);
9204
+ const { body } = parseFrontmatter(normalized);
9205
+ const serialized = await serializeImportedRuleWithFallback(destPath, { root: true }, body);
9206
+ await writeFileAtomic(destPath, serialized);
9207
+ results.push({
9208
+ feature: "rules",
9209
+ fromTool: KILO_CODE_TARGET,
9210
+ fromPath: `${KILO_CODE_LEGACY_RULES_DIR}/${LEGACY_ROOT_RULE_FILE}`,
9211
+ toPath: CANONICAL_ROOT_RULE_PATH
9212
+ });
9213
+ }
9214
+ results.push(
9215
+ ...await importFileDirectory({
9216
+ srcDir,
9217
+ destDir,
9218
+ extensions: [".md"],
9219
+ fromTool: KILO_CODE_TARGET,
9220
+ normalize,
9221
+ mapEntry: async ({ srcPath, relativePath, content, normalizeTo }) => {
9222
+ const mapping = await kiloNonRootRuleMapper({
9223
+ absolutePath: srcPath,
9224
+ relativePath,
9225
+ content,
9226
+ destDir,
9227
+ normalizeTo
9228
+ });
9229
+ if (relativePath === LEGACY_ROOT_RULE_FILE) return null;
9230
+ if (!mapping) return null;
9231
+ return { ...mapping, feature: "rules" };
9232
+ }
9233
+ })
9234
+ );
9235
+ }
9236
+ async function importLegacyWorkflows(projectRoot, results, normalize) {
9237
+ const srcDir = join(projectRoot, KILO_CODE_LEGACY_WORKFLOWS_DIR);
9238
+ if (!await pathExists(srcDir)) return;
9239
+ const destDir = join(projectRoot, KILO_CODE_CANONICAL_COMMANDS_DIR);
9240
+ results.push(
9241
+ ...await importFileDirectory({
9242
+ srcDir,
9243
+ destDir,
9244
+ extensions: [".md"],
9245
+ fromTool: KILO_CODE_TARGET,
9246
+ normalize,
9247
+ mapEntry: async ({ srcPath, relativePath, content, normalizeTo }) => {
9248
+ const mapping = await kiloCommandMapper({
9249
+ absolutePath: srcPath,
9250
+ relativePath,
9251
+ content,
9252
+ destDir,
9253
+ normalizeTo
9254
+ });
9255
+ if (!mapping) return null;
9256
+ return { ...mapping, feature: "commands" };
9257
+ }
9258
+ })
9259
+ );
9260
+ }
9261
+ async function importLegacyModes(projectRoot, results, normalize) {
9262
+ const sourceFile = join(projectRoot, KILO_CODE_LEGACY_MODES_FILE);
9263
+ const content = await readFileSafe(sourceFile);
9264
+ if (content === null) return;
9265
+ let parsed;
9266
+ try {
9267
+ parsed = parse(content);
9268
+ } catch {
9269
+ return;
9270
+ }
9271
+ if (!parsed || !Array.isArray(parsed.customModes)) return;
9272
+ for (const raw of parsed.customModes) {
9273
+ if (!raw || typeof raw !== "object") continue;
9274
+ const mode = raw;
9275
+ if (typeof mode.slug !== "string" || mode.slug.length === 0) continue;
9276
+ const slug = mode.slug;
9277
+ const destPath = join(projectRoot, KILO_CODE_CANONICAL_AGENTS_DIR, `${slug}.md`);
9278
+ const description = typeof mode.description === "string" ? mode.description : "";
9279
+ const role = typeof mode.roleDefinition === "string" ? mode.roleDefinition.trim() : "";
9280
+ const whenToUse = typeof mode.whenToUse === "string" ? mode.whenToUse.trim() : "";
9281
+ const body = whenToUse ? `${role}
9282
+
9283
+ ## When to use
9284
+
9285
+ ${whenToUse}` : role;
9286
+ const frontmatter = {};
9287
+ if (description) frontmatter.description = description;
9288
+ if (typeof mode.name === "string" && mode.name.length > 0) frontmatter.name = mode.name;
9289
+ const serialized = await serializeImportedAgentWithFallback(destPath, frontmatter, body);
9290
+ const normalized = normalize(serialized, sourceFile, destPath);
9291
+ await writeFileAtomic(destPath, normalized);
9292
+ results.push({
9293
+ feature: "agents",
9294
+ fromTool: KILO_CODE_TARGET,
9295
+ fromPath: sourceFile,
9296
+ toPath: `${KILO_CODE_CANONICAL_AGENTS_DIR}/${slug}.md`
9297
+ });
9298
+ }
9299
+ }
9300
+ async function importFromKiloCode(projectRoot, options = {}) {
9301
+ const scope = options.scope ?? "project";
9302
+ const results = [];
9303
+ const normalize = await createImportReferenceNormalizer(KILO_CODE_TARGET, projectRoot, scope);
9304
+ results.push(...await runDescriptorImport(descriptor10, projectRoot, scope, { normalize }));
9305
+ await importEmbeddedSkills(
9306
+ projectRoot,
9307
+ KILO_CODE_SKILLS_DIR,
9308
+ KILO_CODE_TARGET,
9309
+ results,
9310
+ normalize
9311
+ );
9312
+ if (scope === "project") {
9313
+ await importLegacyRules(projectRoot, results, normalize);
9314
+ await importLegacyWorkflows(projectRoot, results, normalize);
9315
+ await importLegacyModes(projectRoot, results, normalize);
9316
+ await importEmbeddedSkills(
9317
+ projectRoot,
9318
+ KILO_CODE_LEGACY_SKILLS_DIR,
9319
+ KILO_CODE_TARGET,
9320
+ results,
9321
+ normalize
9322
+ );
9323
+ }
9324
+ return results;
9325
+ }
9326
+ var CANONICAL_ROOT_RULE_PATH, LEGACY_ROOT_RULE_FILE;
9327
+ var init_importer9 = __esm({
9328
+ "src/targets/kilo-code/importer.ts"() {
9329
+ init_import_rewriter();
9330
+ init_embedded_skill();
9331
+ init_import_orchestrator();
9332
+ init_descriptor_import_runner();
9333
+ init_fs();
9334
+ init_import_metadata();
9335
+ init_markdown();
9336
+ init_import_mappers7();
9337
+ init_constants8();
9338
+ init_kilo_code2();
9339
+ CANONICAL_ROOT_RULE_PATH = `${KILO_CODE_CANONICAL_RULES_DIR}/_root.md`;
9340
+ LEGACY_ROOT_RULE_FILE = "00-root.md";
9341
+ }
9342
+ });
9343
+
9344
+ // src/targets/kilo-code/linter.ts
9345
+ function lintRules10(canonical, projectRoot, projectFiles, options) {
9346
+ return validateRules(canonical, projectRoot, projectFiles, {
9347
+ checkGlobMatches: options?.scope !== "global"
9348
+ }).map((diagnostic) => ({
9349
+ ...diagnostic,
9350
+ target: KILO_CODE_TARGET
9351
+ }));
9352
+ }
9353
+ var init_linter10 = __esm({
9354
+ "src/targets/kilo-code/linter.ts"() {
9355
+ init_validate_rules();
9356
+ init_constants8();
9357
+ }
9358
+ });
9359
+
9360
+ // src/targets/kilo-code/lint.ts
9361
+ function lintHooks4(canonical) {
9362
+ if (!canonical.hooks) return [];
9363
+ const hasEntries = Object.values(canonical.hooks).some(
9364
+ (entries) => Array.isArray(entries) && entries.length > 0
9365
+ );
9366
+ if (!hasEntries) return [];
9367
+ return [
9368
+ createWarning(
9369
+ ".agentsmesh/hooks.yaml",
9370
+ "kilo-code",
9371
+ "kilo-code does not support user-defined lifecycle hooks; canonical hooks are not projected."
9372
+ )
9373
+ ];
9374
+ }
9375
+ function lintPermissions2(canonical) {
9376
+ if (!canonical.permissions) return [];
9377
+ const { allow, deny } = canonical.permissions;
9378
+ const ask = canonical.permissions.ask ?? [];
9379
+ if (allow.length === 0 && deny.length === 0 && ask.length === 0) return [];
9380
+ return [
9381
+ createWarning(
9382
+ ".agentsmesh/permissions.yaml",
9383
+ "kilo-code",
9384
+ "kilo-code permissions live in kilo.jsonc, which agentsmesh does not generate in v1; canonical permissions are not projected."
9385
+ )
9386
+ ];
9387
+ }
9388
+ var init_lint8 = __esm({
9389
+ "src/targets/kilo-code/lint.ts"() {
9390
+ init_helpers();
9391
+ }
9392
+ });
9393
+
9394
+ // src/targets/kilo-code/index.ts
9395
+ var target10, project10, globalLayout3, capabilities, descriptor10;
9396
+ var init_kilo_code2 = __esm({
9397
+ "src/targets/kilo-code/index.ts"() {
9398
+ init_generator13();
9399
+ init_constants8();
9400
+ init_skill_mirror();
9401
+ init_importer9();
9402
+ init_import_mappers7();
9403
+ init_linter10();
9404
+ init_lint8();
9405
+ init_import_map_builders();
9406
+ target10 = {
9407
+ name: KILO_CODE_TARGET,
9408
+ primaryRootInstructionPath: KILO_CODE_ROOT_RULE,
9409
+ generateRules: generateRules10,
9410
+ generateCommands: generateCommands10,
9411
+ generateAgents: generateAgents8,
9412
+ generateSkills: generateSkills10,
9413
+ generateMcp: generateMcp8,
9414
+ generateIgnore: generateIgnore6,
9415
+ importFrom: importFromKiloCode
9416
+ };
9417
+ project10 = {
9418
+ rootInstructionPath: KILO_CODE_ROOT_RULE,
9419
+ skillDir: KILO_CODE_SKILLS_DIR,
9420
+ managedOutputs: {
9421
+ dirs: [KILO_CODE_RULES_DIR, KILO_CODE_COMMANDS_DIR, KILO_CODE_AGENTS_DIR, KILO_CODE_SKILLS_DIR],
9422
+ files: [KILO_CODE_ROOT_RULE, KILO_CODE_MCP_FILE, KILO_CODE_IGNORE]
9423
+ },
9424
+ paths: {
9425
+ rulePath(slug, _rule) {
9426
+ return `${KILO_CODE_RULES_DIR}/${slug}.md`;
9427
+ },
9428
+ commandPath(name, _config) {
9429
+ return `${KILO_CODE_COMMANDS_DIR}/${name}.md`;
9430
+ },
9431
+ agentPath(name, _config) {
9432
+ return `${KILO_CODE_AGENTS_DIR}/${name}.md`;
9433
+ }
9434
+ }
9435
+ };
9436
+ globalLayout3 = {
9437
+ rootInstructionPath: KILO_CODE_GLOBAL_AGENTS_MD,
9438
+ skillDir: KILO_CODE_GLOBAL_SKILLS_DIR,
9439
+ managedOutputs: {
9440
+ dirs: [
9441
+ KILO_CODE_GLOBAL_RULES_DIR,
9442
+ KILO_CODE_GLOBAL_COMMANDS_DIR,
9443
+ KILO_CODE_GLOBAL_AGENTS_DIR,
9444
+ KILO_CODE_GLOBAL_SKILLS_DIR,
9445
+ KILO_CODE_GLOBAL_AGENTS_SKILLS_DIR
9446
+ ],
9447
+ files: [KILO_CODE_GLOBAL_AGENTS_MD, KILO_CODE_GLOBAL_MCP_FILE, KILO_CODE_GLOBAL_IGNORE]
9448
+ },
9449
+ rewriteGeneratedPath(path) {
9450
+ if (path === KILO_CODE_ROOT_RULE) return KILO_CODE_GLOBAL_AGENTS_MD;
9451
+ return path;
9452
+ },
9453
+ mirrorGlobalPath(path, activeTargets) {
9454
+ return mirrorSkillsToAgents(path, KILO_CODE_GLOBAL_SKILLS_DIR, activeTargets);
9455
+ },
9456
+ paths: {
9457
+ rulePath(slug, _rule) {
9458
+ return `${KILO_CODE_GLOBAL_RULES_DIR}/${slug}.md`;
9459
+ },
9460
+ commandPath(name, _config) {
9461
+ return `${KILO_CODE_GLOBAL_COMMANDS_DIR}/${name}.md`;
9462
+ },
9463
+ agentPath(name, _config) {
9464
+ return `${KILO_CODE_GLOBAL_AGENTS_DIR}/${name}.md`;
9465
+ }
9466
+ }
9467
+ };
9468
+ capabilities = {
9469
+ rules: "native",
9470
+ additionalRules: "native",
9471
+ commands: "native",
9472
+ agents: "native",
9473
+ skills: "native",
9474
+ mcp: "native",
9475
+ hooks: "none",
9476
+ ignore: "native",
9477
+ permissions: "none"
9478
+ };
9479
+ descriptor10 = {
9480
+ id: KILO_CODE_TARGET,
9481
+ generators: target10,
9482
+ capabilities,
9483
+ emptyImportMessage: "No Kilo Code config found (AGENTS.md, .kilo/rules, .kilo/commands, .kilo/agents, .kilo/skills, .kilo/mcp.json, .kilocodeignore, .kilocode/, or .kilocodemodes).",
9484
+ lintRules: lintRules10,
9485
+ lint: {
9486
+ hooks: lintHooks4,
9487
+ permissions: lintPermissions2
9488
+ },
9489
+ project: project10,
9490
+ globalSupport: {
9491
+ capabilities,
9492
+ detectionPaths: [
9493
+ KILO_CODE_GLOBAL_AGENTS_MD,
9494
+ KILO_CODE_GLOBAL_RULES_DIR,
9495
+ KILO_CODE_GLOBAL_COMMANDS_DIR,
9496
+ KILO_CODE_GLOBAL_AGENTS_DIR,
9497
+ KILO_CODE_GLOBAL_SKILLS_DIR,
9498
+ KILO_CODE_GLOBAL_MCP_FILE,
9499
+ KILO_CODE_GLOBAL_IGNORE
9500
+ ],
9501
+ layout: globalLayout3
9502
+ },
9503
+ importer: {
9504
+ rules: [
9505
+ {
9506
+ // Root rule: prefer AGENTS.md (new) → in legacy projects users
9507
+ // historically used .kilocode/rules/00-root.md, but those import
9508
+ // through the descriptor's directory mapper as a regular rule with
9509
+ // slug `00-root` (we don't promote them to root). The legacy global
9510
+ // rules dir falls back to AGENTS.md only.
9511
+ feature: "rules",
9512
+ mode: "singleFile",
9513
+ source: {
9514
+ project: [KILO_CODE_ROOT_RULE],
9515
+ global: [KILO_CODE_GLOBAL_AGENTS_MD]
9516
+ },
9517
+ canonicalDir: KILO_CODE_CANONICAL_RULES_DIR,
9518
+ canonicalRootFilename: "_root.md",
9519
+ markAsRoot: true
9520
+ },
9521
+ {
9522
+ feature: "rules",
9523
+ mode: "directory",
9524
+ source: {
9525
+ project: [KILO_CODE_RULES_DIR],
9526
+ global: [KILO_CODE_GLOBAL_RULES_DIR]
9527
+ },
9528
+ canonicalDir: KILO_CODE_CANONICAL_RULES_DIR,
9529
+ extensions: [".md"],
9530
+ map: kiloNonRootRuleMapper
9531
+ }
9532
+ ],
9533
+ commands: {
9534
+ feature: "commands",
9535
+ mode: "directory",
9536
+ source: {
9537
+ project: [KILO_CODE_COMMANDS_DIR],
9538
+ global: [KILO_CODE_GLOBAL_COMMANDS_DIR]
9539
+ },
9540
+ canonicalDir: KILO_CODE_CANONICAL_COMMANDS_DIR,
9541
+ extensions: [".md"],
9542
+ map: kiloCommandMapper
9543
+ },
9544
+ agents: {
9545
+ feature: "agents",
9546
+ mode: "directory",
9547
+ source: {
9548
+ project: [KILO_CODE_AGENTS_DIR],
9549
+ global: [KILO_CODE_GLOBAL_AGENTS_DIR]
9550
+ },
9551
+ canonicalDir: KILO_CODE_CANONICAL_AGENTS_DIR,
9552
+ extensions: [".md"],
9553
+ map: kiloAgentMapper
9554
+ },
9555
+ mcp: {
9556
+ feature: "mcp",
9557
+ mode: "mcpJson",
9558
+ source: {
9559
+ project: [KILO_CODE_MCP_FILE, KILO_CODE_LEGACY_MCP_FILE],
9560
+ global: [KILO_CODE_GLOBAL_MCP_FILE]
9561
+ },
9562
+ canonicalDir: ".agentsmesh",
9563
+ canonicalFilename: KILO_CODE_CANONICAL_MCP
9564
+ },
9565
+ ignore: {
9566
+ feature: "ignore",
9567
+ mode: "flatFile",
9568
+ source: {
9569
+ project: [KILO_CODE_IGNORE],
9570
+ global: [KILO_CODE_GLOBAL_IGNORE]
9571
+ },
9572
+ canonicalDir: ".agentsmesh",
9573
+ canonicalFilename: KILO_CODE_CANONICAL_IGNORE
9574
+ }
9575
+ },
9576
+ buildImportPaths: buildKiloCodeImportPaths,
9577
+ detectionPaths: [
9578
+ KILO_CODE_RULES_DIR,
9579
+ KILO_CODE_COMMANDS_DIR,
9580
+ KILO_CODE_AGENTS_DIR,
9581
+ KILO_CODE_SKILLS_DIR,
9582
+ KILO_CODE_MCP_FILE,
9583
+ KILO_CODE_LEGACY_RULES_DIR,
9584
+ KILO_CODE_LEGACY_WORKFLOWS_DIR,
9585
+ KILO_CODE_LEGACY_SKILLS_DIR,
9586
+ KILO_CODE_LEGACY_MCP_FILE,
9587
+ KILO_CODE_LEGACY_MODES_FILE,
9588
+ KILO_CODE_IGNORE,
9589
+ "kilo.jsonc",
9590
+ "kilo.json"
9591
+ ]
9592
+ };
9593
+ }
9594
+ });
9595
+ function toKebab(value) {
9596
+ return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
9597
+ }
9598
+ function hookText(entry) {
9599
+ return entry.type === "prompt" ? entry.prompt : entry.command;
9600
+ }
9601
+ function toWhen(event, matcher) {
9602
+ const type = CANONICAL_TO_KIRO[event];
9603
+ if (event === "PreToolUse" || event === "PostToolUse") {
9604
+ return { type, tools: [matcher || "*"] };
9605
+ }
9606
+ return { type };
9607
+ }
9608
+ function generateKiroHooks(hooks) {
9609
+ const outputs = [];
9610
+ for (const [event, entries] of Object.entries(hooks)) {
9611
+ const mappedEvent = event;
8881
9612
  if (!(mappedEvent in CANONICAL_TO_KIRO) || !Array.isArray(entries)) continue;
8882
9613
  let index = 1;
8883
9614
  for (const entry of entries) {
@@ -8968,7 +9699,7 @@ function steeringFrontmatter(rule) {
8968
9699
  if (rule.description) frontmatter.description = rule.description;
8969
9700
  return frontmatter;
8970
9701
  }
8971
- function generateRules10(canonical) {
9702
+ function generateRules11(canonical) {
8972
9703
  const outputs = [];
8973
9704
  const root = canonical.rules.find((rule) => rule.root);
8974
9705
  if (root) {
@@ -8985,10 +9716,10 @@ function generateRules10(canonical) {
8985
9716
  }
8986
9717
  return outputs;
8987
9718
  }
8988
- function generateSkills10(canonical) {
9719
+ function generateSkills11(canonical) {
8989
9720
  return generateEmbeddedSkills(canonical, KIRO_SKILLS_DIR);
8990
9721
  }
8991
- function generateMcp8(canonical) {
9722
+ function generateMcp9(canonical) {
8992
9723
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
8993
9724
  return [
8994
9725
  {
@@ -9004,7 +9735,7 @@ function generateHooks5(canonical) {
9004
9735
  content: hook.content
9005
9736
  }));
9006
9737
  }
9007
- function generateAgents8(canonical) {
9738
+ function generateAgents9(canonical) {
9008
9739
  return canonical.agents.map((agent) => {
9009
9740
  const frontmatter = {
9010
9741
  name: agent.name,
@@ -9019,16 +9750,16 @@ function generateAgents8(canonical) {
9019
9750
  return { path: `${KIRO_AGENTS_DIR}/${agent.name}.md`, content };
9020
9751
  });
9021
9752
  }
9022
- function generateIgnore6(canonical) {
9753
+ function generateIgnore7(canonical) {
9023
9754
  if (canonical.ignore.length === 0) return [];
9024
9755
  return [{ path: KIRO_IGNORE, content: canonical.ignore.join("\n") }];
9025
9756
  }
9026
- var init_generator13 = __esm({
9757
+ var init_generator14 = __esm({
9027
9758
  "src/targets/kiro/generator.ts"() {
9028
9759
  init_embedded_skill();
9029
9760
  init_markdown();
9030
9761
  init_hook_format();
9031
- init_constants8();
9762
+ init_constants9();
9032
9763
  }
9033
9764
  });
9034
9765
  function canonicalRuleMeta(frontmatter) {
@@ -9117,12 +9848,12 @@ async function importFromKiro(projectRoot, options = {}) {
9117
9848
  const normalize = await createImportReferenceNormalizer(KIRO_TARGET, projectRoot, scope);
9118
9849
  await importRoot(projectRoot, results, normalize, scope);
9119
9850
  await importNonRootRules(projectRoot, results, normalize);
9120
- results.push(...await runDescriptorImport(descriptor10, projectRoot, scope, { normalize }));
9851
+ results.push(...await runDescriptorImport(descriptor11, projectRoot, scope, { normalize }));
9121
9852
  await importEmbeddedSkills(projectRoot, KIRO_SKILLS_DIR, KIRO_TARGET, results, normalize);
9122
9853
  if (scope === "project") await importHooks2(projectRoot, results);
9123
9854
  return results;
9124
9855
  }
9125
- var init_importer9 = __esm({
9856
+ var init_importer10 = __esm({
9126
9857
  "src/targets/kiro/importer.ts"() {
9127
9858
  init_import_rewriter();
9128
9859
  init_embedded_skill();
@@ -9133,13 +9864,13 @@ var init_importer9 = __esm({
9133
9864
  init_fs();
9134
9865
  init_markdown();
9135
9866
  init_hook_format();
9136
- init_constants8();
9867
+ init_constants9();
9137
9868
  init_kiro2();
9138
9869
  }
9139
9870
  });
9140
9871
 
9141
9872
  // src/targets/kiro/linter.ts
9142
- function lintRules10(canonical, projectRoot, projectFiles, options) {
9873
+ function lintRules11(canonical, projectRoot, projectFiles, options) {
9143
9874
  return validateRules(canonical, projectRoot, projectFiles, {
9144
9875
  checkGlobMatches: options?.scope !== "global"
9145
9876
  }).map((diagnostic) => ({
@@ -9147,15 +9878,15 @@ function lintRules10(canonical, projectRoot, projectFiles, options) {
9147
9878
  target: KIRO_TARGET
9148
9879
  }));
9149
9880
  }
9150
- var init_linter10 = __esm({
9881
+ var init_linter11 = __esm({
9151
9882
  "src/targets/kiro/linter.ts"() {
9152
9883
  init_validate_rules();
9153
- init_constants8();
9884
+ init_constants9();
9154
9885
  }
9155
9886
  });
9156
9887
 
9157
9888
  // src/targets/kiro/lint.ts
9158
- function lintHooks4(canonical) {
9889
+ function lintHooks5(canonical) {
9159
9890
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
9160
9891
  const supported = ["PreToolUse", "PostToolUse", "UserPromptSubmit", "SubagentStop"];
9161
9892
  const supportedSet = new Set(supported);
@@ -9163,35 +9894,35 @@ function lintHooks4(canonical) {
9163
9894
  (event) => createUnsupportedHookWarning(event, "kiro", supported, { unsupportedBy: "Kiro hooks" })
9164
9895
  );
9165
9896
  }
9166
- var init_lint8 = __esm({
9897
+ var init_lint9 = __esm({
9167
9898
  "src/targets/kiro/lint.ts"() {
9168
9899
  init_helpers();
9169
9900
  }
9170
9901
  });
9171
9902
 
9172
9903
  // src/targets/kiro/index.ts
9173
- var target10, project10, global8, globalCapabilities10, descriptor10;
9904
+ var target11, project11, global8, globalCapabilities10, descriptor11;
9174
9905
  var init_kiro2 = __esm({
9175
9906
  "src/targets/kiro/index.ts"() {
9176
- init_generator13();
9907
+ init_generator14();
9177
9908
  init_skill_mirror();
9178
- init_importer9();
9179
- init_linter10();
9180
- init_lint8();
9909
+ init_importer10();
9910
+ init_linter11();
9911
+ init_lint9();
9181
9912
  init_import_map_builders();
9182
- init_constants8();
9183
- target10 = {
9913
+ init_constants9();
9914
+ target11 = {
9184
9915
  name: KIRO_TARGET,
9185
9916
  primaryRootInstructionPath: KIRO_AGENTS_MD,
9186
- generateRules: generateRules10,
9187
- generateAgents: generateAgents8,
9188
- generateSkills: generateSkills10,
9189
- generateMcp: generateMcp8,
9917
+ generateRules: generateRules11,
9918
+ generateAgents: generateAgents9,
9919
+ generateSkills: generateSkills11,
9920
+ generateMcp: generateMcp9,
9190
9921
  generateHooks: generateHooks5,
9191
- generateIgnore: generateIgnore6,
9922
+ generateIgnore: generateIgnore7,
9192
9923
  importFrom: importFromKiro
9193
9924
  };
9194
- project10 = {
9925
+ project11 = {
9195
9926
  rootInstructionPath: KIRO_AGENTS_MD,
9196
9927
  skillDir: KIRO_SKILLS_DIR,
9197
9928
  managedOutputs: {
@@ -9272,9 +10003,9 @@ var init_kiro2 = __esm({
9272
10003
  ignore: "native",
9273
10004
  permissions: "none"
9274
10005
  };
9275
- descriptor10 = {
10006
+ descriptor11 = {
9276
10007
  id: KIRO_TARGET,
9277
- generators: target10,
10008
+ generators: target11,
9278
10009
  capabilities: {
9279
10010
  rules: "native",
9280
10011
  additionalRules: "native",
@@ -9287,11 +10018,11 @@ var init_kiro2 = __esm({
9287
10018
  permissions: "none"
9288
10019
  },
9289
10020
  emptyImportMessage: "No Kiro config found (AGENTS.md, .kiro/steering, .kiro/skills, .kiro/agents, .kiro/hooks, .kiro/settings/mcp.json, or .kiroignore).",
9290
- lintRules: lintRules10,
10021
+ lintRules: lintRules11,
9291
10022
  lint: {
9292
- hooks: lintHooks4
10023
+ hooks: lintHooks5
9293
10024
  },
9294
- project: project10,
10025
+ project: project11,
9295
10026
  globalSupport: {
9296
10027
  capabilities: globalCapabilities10,
9297
10028
  detectionPaths: [
@@ -9340,7 +10071,7 @@ var init_kiro2 = __esm({
9340
10071
  };
9341
10072
  }
9342
10073
  });
9343
- function generateRules11(canonical) {
10074
+ function generateRules12(canonical) {
9344
10075
  const outputs = [];
9345
10076
  const root = canonical.rules.find((rule) => rule.root);
9346
10077
  if (root) {
@@ -9360,7 +10091,7 @@ function generateRules11(canonical) {
9360
10091
  }
9361
10092
  return outputs;
9362
10093
  }
9363
- function generateCommands10(canonical) {
10094
+ function generateCommands11(canonical) {
9364
10095
  return canonical.commands.map((command) => {
9365
10096
  const frontmatter = {};
9366
10097
  if (command.description) frontmatter.description = command.description;
@@ -9370,7 +10101,7 @@ function generateCommands10(canonical) {
9370
10101
  };
9371
10102
  });
9372
10103
  }
9373
- function generateMcp9(canonical) {
10104
+ function generateMcp10(canonical) {
9374
10105
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
9375
10106
  return [
9376
10107
  {
@@ -9379,14 +10110,14 @@ function generateMcp9(canonical) {
9379
10110
  }
9380
10111
  ];
9381
10112
  }
9382
- function generateIgnore7(canonical) {
10113
+ function generateIgnore8(canonical) {
9383
10114
  if (canonical.ignore.length === 0) return [];
9384
10115
  return [{ path: ROO_CODE_IGNORE, content: canonical.ignore.join("\n") }];
9385
10116
  }
9386
- function generateSkills11(canonical) {
10117
+ function generateSkills12(canonical) {
9387
10118
  return generateEmbeddedSkills(canonical, ROO_CODE_SKILLS_DIR);
9388
10119
  }
9389
- function generateAgents9(canonical) {
10120
+ function generateAgents10(canonical) {
9390
10121
  if (canonical.agents.length === 0) return [];
9391
10122
  const customModes = canonical.agents.map((agent) => {
9392
10123
  const slug = basename(agent.source, ".md");
@@ -9397,19 +10128,19 @@ function generateAgents9(canonical) {
9397
10128
  });
9398
10129
  return [{ path: ROO_CODE_MODES_FILE, content: stringify({ customModes }) }];
9399
10130
  }
9400
- var init_generator14 = __esm({
10131
+ var init_generator15 = __esm({
9401
10132
  "src/targets/roo-code/generator.ts"() {
9402
10133
  init_embedded_skill();
9403
10134
  init_markdown();
9404
- init_constants9();
10135
+ init_constants10();
9405
10136
  }
9406
10137
  });
9407
10138
  var rooNonRootRuleMapper, rooCommandMapper;
9408
- var init_import_mappers7 = __esm({
10139
+ var init_import_mappers8 = __esm({
9409
10140
  "src/targets/roo-code/import-mappers.ts"() {
9410
10141
  init_markdown();
9411
10142
  init_import_metadata();
9412
- init_constants9();
10143
+ init_constants10();
9413
10144
  rooNonRootRuleMapper = async ({
9414
10145
  relativePath,
9415
10146
  normalizeTo,
@@ -9493,25 +10224,25 @@ async function importFromRooCode(projectRoot, options = {}) {
9493
10224
  const scope = options.scope ?? "project";
9494
10225
  const results = [];
9495
10226
  const normalize = await createImportReferenceNormalizer(ROO_CODE_TARGET, projectRoot, scope);
9496
- results.push(...await runDescriptorImport(descriptor11, projectRoot, scope, { normalize }));
10227
+ results.push(...await runDescriptorImport(descriptor12, projectRoot, scope, { normalize }));
9497
10228
  await importPerModeRules(projectRoot, results, normalize);
9498
10229
  await importEmbeddedSkills(projectRoot, ROO_CODE_SKILLS_DIR, ROO_CODE_TARGET, results, normalize);
9499
10230
  return results;
9500
10231
  }
9501
- var init_importer10 = __esm({
10232
+ var init_importer11 = __esm({
9502
10233
  "src/targets/roo-code/importer.ts"() {
9503
10234
  init_import_rewriter();
9504
10235
  init_embedded_skill();
9505
10236
  init_import_orchestrator();
9506
10237
  init_descriptor_import_runner();
9507
- init_import_mappers7();
9508
- init_constants9();
10238
+ init_import_mappers8();
10239
+ init_constants10();
9509
10240
  init_roo_code2();
9510
10241
  }
9511
10242
  });
9512
10243
 
9513
10244
  // src/targets/roo-code/linter.ts
9514
- function lintRules11(canonical, projectRoot, projectFiles, options) {
10245
+ function lintRules12(canonical, projectRoot, projectFiles, options) {
9515
10246
  return validateRules(canonical, projectRoot, projectFiles, {
9516
10247
  checkGlobMatches: options?.scope !== "global"
9517
10248
  }).map((diagnostic) => ({
@@ -9519,10 +10250,10 @@ function lintRules11(canonical, projectRoot, projectFiles, options) {
9519
10250
  target: ROO_CODE_TARGET
9520
10251
  }));
9521
10252
  }
9522
- var init_linter11 = __esm({
10253
+ var init_linter12 = __esm({
9523
10254
  "src/targets/roo-code/linter.ts"() {
9524
10255
  init_validate_rules();
9525
- init_constants9();
10256
+ init_constants10();
9526
10257
  }
9527
10258
  });
9528
10259
  function computeStatus5(existing, content) {
@@ -9530,29 +10261,29 @@ function computeStatus5(existing, content) {
9530
10261
  if (existing !== content) return "updated";
9531
10262
  return "unchanged";
9532
10263
  }
9533
- var target11, project11, generateRooGlobalExtras, global9, globalCapabilities11, descriptor11;
10264
+ var target12, project12, generateRooGlobalExtras, global9, globalCapabilities11, descriptor12;
9534
10265
  var init_roo_code2 = __esm({
9535
10266
  "src/targets/roo-code/index.ts"() {
9536
10267
  init_fs();
9537
- init_generator14();
9538
- init_constants9();
10268
+ init_generator15();
10269
+ init_constants10();
9539
10270
  init_skill_mirror();
9540
- init_importer10();
9541
- init_import_mappers7();
9542
- init_linter11();
10271
+ init_importer11();
10272
+ init_import_mappers8();
10273
+ init_linter12();
9543
10274
  init_import_map_builders();
9544
- target11 = {
10275
+ target12 = {
9545
10276
  name: "roo-code",
9546
10277
  primaryRootInstructionPath: ROO_CODE_ROOT_RULE,
9547
- generateRules: generateRules11,
9548
- generateCommands: generateCommands10,
9549
- generateSkills: generateSkills11,
9550
- generateMcp: generateMcp9,
9551
- generateIgnore: generateIgnore7,
9552
- generateAgents: generateAgents9,
10278
+ generateRules: generateRules12,
10279
+ generateCommands: generateCommands11,
10280
+ generateSkills: generateSkills12,
10281
+ generateMcp: generateMcp10,
10282
+ generateIgnore: generateIgnore8,
10283
+ generateAgents: generateAgents10,
9553
10284
  importFrom: importFromRooCode
9554
10285
  };
9555
- project11 = {
10286
+ project12 = {
9556
10287
  rootInstructionPath: ROO_CODE_ROOT_RULE,
9557
10288
  skillDir: ".roo/skills",
9558
10289
  managedOutputs: {
@@ -9660,9 +10391,9 @@ var init_roo_code2 = __esm({
9660
10391
  ignore: "native",
9661
10392
  permissions: "none"
9662
10393
  };
9663
- descriptor11 = {
10394
+ descriptor12 = {
9664
10395
  id: "roo-code",
9665
- generators: target11,
10396
+ generators: target12,
9666
10397
  capabilities: {
9667
10398
  rules: "native",
9668
10399
  additionalRules: "native",
@@ -9675,8 +10406,8 @@ var init_roo_code2 = __esm({
9675
10406
  permissions: "none"
9676
10407
  },
9677
10408
  emptyImportMessage: "No Roo Code config found (.roo/rules, .roo/commands, .roo/skills, .roo/mcp.json, .rooignore, or .roorules).",
9678
- lintRules: lintRules11,
9679
- project: project11,
10409
+ lintRules: lintRules12,
10410
+ project: project12,
9680
10411
  globalSupport: {
9681
10412
  capabilities: globalCapabilities11,
9682
10413
  detectionPaths: [
@@ -9759,7 +10490,7 @@ var init_roo_code2 = __esm({
9759
10490
 
9760
10491
  // src/targets/windsurf/constants.ts
9761
10492
  var WINDSURF_TARGET, WINDSURF_RULES_ROOT, WINDSURF_RULES_DIR, WINDSURF_IGNORE, CODEIUM_IGNORE, WINDSURF_AGENTS_MD, WINDSURF_HOOKS_FILE, WINDSURF_MCP_EXAMPLE_FILE, WINDSURF_MCP_CONFIG_FILE, WINDSURF_WORKFLOWS_DIR, WINDSURF_SKILLS_DIR, WINDSURF_CANONICAL_RULES_DIR, WINDSURF_CANONICAL_COMMANDS_DIR, WINDSURF_CANONICAL_AGENTS_DIR, WINDSURF_CANONICAL_SKILLS_DIR, WINDSURF_CANONICAL_IGNORE, WINDSURF_CANONICAL_HOOKS, WINDSURF_CANONICAL_MCP, WINDSURF_GLOBAL_RULES, WINDSURF_GLOBAL_SKILLS_DIR, WINDSURF_GLOBAL_WORKFLOWS_DIR, WINDSURF_GLOBAL_HOOKS_FILE, WINDSURF_GLOBAL_MCP_FILE, WINDSURF_GLOBAL_IGNORE, WINDSURF_GLOBAL_AGENTS_SKILLS_DIR;
9762
- var init_constants13 = __esm({
10493
+ var init_constants14 = __esm({
9763
10494
  "src/targets/windsurf/constants.ts"() {
9764
10495
  WINDSURF_TARGET = "windsurf";
9765
10496
  WINDSURF_RULES_ROOT = ".windsurfrules";
@@ -9798,7 +10529,7 @@ function directoryScopedRuleDir(globs) {
9798
10529
  if (dirs.length !== globs.length) return null;
9799
10530
  return dirs.every((dir) => dir === dirs[0]) ? dirs[0] : null;
9800
10531
  }
9801
- function generateRules12(canonical) {
10532
+ function generateRules13(canonical) {
9802
10533
  const outputs = [];
9803
10534
  const root = canonical.rules.find((r) => r.root);
9804
10535
  if (!root) return [];
@@ -9835,23 +10566,23 @@ function generateRules12(canonical) {
9835
10566
  var init_rules4 = __esm({
9836
10567
  "src/targets/windsurf/generator/rules.ts"() {
9837
10568
  init_markdown();
9838
- init_constants13();
10569
+ init_constants14();
9839
10570
  }
9840
10571
  });
9841
10572
 
9842
10573
  // src/targets/windsurf/generator/ignore.ts
9843
- function generateIgnore8(canonical) {
10574
+ function generateIgnore9(canonical) {
9844
10575
  if (!canonical.ignore || canonical.ignore.length === 0) return [];
9845
10576
  return [{ path: CODEIUM_IGNORE, content: canonical.ignore.join("\n") }];
9846
10577
  }
9847
10578
  var init_ignore3 = __esm({
9848
10579
  "src/targets/windsurf/generator/ignore.ts"() {
9849
- init_constants13();
10580
+ init_constants14();
9850
10581
  }
9851
10582
  });
9852
10583
 
9853
10584
  // src/targets/windsurf/generator/workflows.ts
9854
- function generateCommands11(canonical) {
10585
+ function generateCommands12(canonical) {
9855
10586
  return canonical.commands.map((cmd) => {
9856
10587
  const frontmatter = {
9857
10588
  description: cmd.description.trim() || void 0,
@@ -9870,12 +10601,12 @@ function generateCommands11(canonical) {
9870
10601
  var init_workflows = __esm({
9871
10602
  "src/targets/windsurf/generator/workflows.ts"() {
9872
10603
  init_markdown();
9873
- init_constants13();
10604
+ init_constants14();
9874
10605
  }
9875
10606
  });
9876
10607
 
9877
10608
  // src/targets/windsurf/generator/agents.ts
9878
- function generateAgents10(canonical) {
10609
+ function generateAgents11(canonical) {
9879
10610
  return canonical.agents.map((agent) => ({
9880
10611
  path: `${WINDSURF_SKILLS_DIR}/${projectedAgentSkillDirName(agent.name)}/SKILL.md`,
9881
10612
  content: serializeProjectedAgentSkill(agent)
@@ -9884,12 +10615,12 @@ function generateAgents10(canonical) {
9884
10615
  var init_agents4 = __esm({
9885
10616
  "src/targets/windsurf/generator/agents.ts"() {
9886
10617
  init_projected_agent_skill();
9887
- init_constants13();
10618
+ init_constants14();
9888
10619
  }
9889
10620
  });
9890
10621
 
9891
10622
  // src/targets/windsurf/generator/mcp.ts
9892
- function generateMcp10(canonical) {
10623
+ function generateMcp11(canonical) {
9893
10624
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
9894
10625
  return [
9895
10626
  {
@@ -9900,7 +10631,7 @@ function generateMcp10(canonical) {
9900
10631
  }
9901
10632
  var init_mcp3 = __esm({
9902
10633
  "src/targets/windsurf/generator/mcp.ts"() {
9903
- init_constants13();
10634
+ init_constants14();
9904
10635
  }
9905
10636
  });
9906
10637
 
@@ -9943,12 +10674,12 @@ function generateHooks6(canonical) {
9943
10674
  var init_hooks2 = __esm({
9944
10675
  "src/targets/windsurf/generator/hooks.ts"() {
9945
10676
  init_hook_command();
9946
- init_constants13();
10677
+ init_constants14();
9947
10678
  }
9948
10679
  });
9949
10680
 
9950
10681
  // src/targets/windsurf/generator/skills.ts
9951
- function generateSkills12(canonical) {
10682
+ function generateSkills13(canonical) {
9952
10683
  const outputs = [];
9953
10684
  for (const skill of canonical.skills) {
9954
10685
  const frontmatter = {
@@ -9970,12 +10701,12 @@ function generateSkills12(canonical) {
9970
10701
  var init_skills4 = __esm({
9971
10702
  "src/targets/windsurf/generator/skills.ts"() {
9972
10703
  init_markdown();
9973
- init_constants13();
10704
+ init_constants14();
9974
10705
  }
9975
10706
  });
9976
10707
 
9977
10708
  // src/targets/windsurf/generator/index.ts
9978
- var init_generator15 = __esm({
10709
+ var init_generator16 = __esm({
9979
10710
  "src/targets/windsurf/generator/index.ts"() {
9980
10711
  init_rules4();
9981
10712
  init_ignore3();
@@ -9988,9 +10719,9 @@ var init_generator15 = __esm({
9988
10719
  });
9989
10720
 
9990
10721
  // src/targets/windsurf/generator.ts
9991
- var init_generator16 = __esm({
10722
+ var init_generator17 = __esm({
9992
10723
  "src/targets/windsurf/generator.ts"() {
9993
- init_generator15();
10724
+ init_generator16();
9994
10725
  }
9995
10726
  });
9996
10727
  function toStringArray8(value) {
@@ -10042,7 +10773,7 @@ var init_importer_workflows = __esm({
10042
10773
  init_fs();
10043
10774
  init_markdown();
10044
10775
  init_import_metadata();
10045
- init_constants13();
10776
+ init_constants14();
10046
10777
  }
10047
10778
  });
10048
10779
  async function importSkills4(projectRoot, results, normalize, skillsRelDir = WINDSURF_SKILLS_DIR) {
@@ -10089,7 +10820,7 @@ var init_skills_adapter5 = __esm({
10089
10820
  init_projected_agent_skill();
10090
10821
  init_scoped_agents_import();
10091
10822
  init_skill_import_pipeline();
10092
- init_constants13();
10823
+ init_constants14();
10093
10824
  }
10094
10825
  });
10095
10826
  async function importWindsurfHooks(projectRoot, results) {
@@ -10187,7 +10918,7 @@ async function importWindsurfMcp(projectRoot, results) {
10187
10918
  var init_importer_hooks_mcp = __esm({
10188
10919
  "src/targets/windsurf/importer-hooks-mcp.ts"() {
10189
10920
  init_fs();
10190
- init_constants13();
10921
+ init_constants14();
10191
10922
  }
10192
10923
  });
10193
10924
  async function importFromWindsurf(projectRoot, options) {
@@ -10324,7 +11055,7 @@ async function importFromWindsurf(projectRoot, options) {
10324
11055
  await importWindsurfMcp(projectRoot, results);
10325
11056
  return results;
10326
11057
  }
10327
- var init_importer11 = __esm({
11058
+ var init_importer12 = __esm({
10328
11059
  "src/targets/windsurf/importer.ts"() {
10329
11060
  init_import_rewriter();
10330
11061
  init_fs();
@@ -10332,13 +11063,13 @@ var init_importer11 = __esm({
10332
11063
  init_import_metadata();
10333
11064
  init_import_orchestrator();
10334
11065
  init_scoped_agents_import();
10335
- init_constants13();
11066
+ init_constants14();
10336
11067
  init_importer_workflows();
10337
11068
  init_skills_adapter5();
10338
11069
  init_importer_hooks_mcp();
10339
11070
  }
10340
11071
  });
10341
- function lintRules12(canonical, projectRoot, _projectFiles) {
11072
+ function lintRules13(canonical, projectRoot, _projectFiles) {
10342
11073
  const diags = [];
10343
11074
  const { rules } = canonical;
10344
11075
  if (rules.length > 0) {
@@ -10365,9 +11096,9 @@ function lintRules12(canonical, projectRoot, _projectFiles) {
10365
11096
  }
10366
11097
  return diags;
10367
11098
  }
10368
- var init_linter12 = __esm({
11099
+ var init_linter13 = __esm({
10369
11100
  "src/targets/windsurf/linter.ts"() {
10370
- init_constants13();
11101
+ init_constants14();
10371
11102
  }
10372
11103
  });
10373
11104
 
@@ -10391,7 +11122,7 @@ function lintMcp4(canonical) {
10391
11122
  )
10392
11123
  ];
10393
11124
  }
10394
- var init_lint9 = __esm({
11125
+ var init_lint10 = __esm({
10395
11126
  "src/targets/windsurf/lint.ts"() {
10396
11127
  init_helpers();
10397
11128
  }
@@ -10404,32 +11135,32 @@ function directoryScopedRuleDir2(globs) {
10404
11135
  if (dirs.length !== globs.length) return null;
10405
11136
  return dirs.every((dir) => dir === dirs[0]) ? dirs[0] : null;
10406
11137
  }
10407
- var target12, project12, global10, globalCapabilities12, descriptor12;
11138
+ var target13, project13, global10, globalCapabilities12, descriptor13;
10408
11139
  var init_windsurf2 = __esm({
10409
11140
  "src/targets/windsurf/index.ts"() {
10410
- init_generator16();
11141
+ init_generator17();
10411
11142
  init_capabilities();
10412
- init_constants13();
11143
+ init_constants14();
10413
11144
  init_skill_mirror();
10414
- init_importer11();
10415
- init_linter12();
10416
- init_lint9();
11145
+ init_importer12();
11146
+ init_linter13();
11147
+ init_lint10();
10417
11148
  init_import_map_builders();
10418
11149
  init_conversions();
10419
11150
  init_projected_agent_skill();
10420
- target12 = {
11151
+ target13 = {
10421
11152
  name: "windsurf",
10422
11153
  primaryRootInstructionPath: WINDSURF_AGENTS_MD,
10423
- generateRules: generateRules12,
10424
- generateCommands: generateCommands11,
10425
- generateAgents: generateAgents10,
10426
- generateSkills: generateSkills12,
10427
- generateMcp: generateMcp10,
11154
+ generateRules: generateRules13,
11155
+ generateCommands: generateCommands12,
11156
+ generateAgents: generateAgents11,
11157
+ generateSkills: generateSkills13,
11158
+ generateMcp: generateMcp11,
10428
11159
  generateHooks: generateHooks6,
10429
- generateIgnore: generateIgnore8,
11160
+ generateIgnore: generateIgnore9,
10430
11161
  importFrom: importFromWindsurf
10431
11162
  };
10432
- project12 = {
11163
+ project13 = {
10433
11164
  rootInstructionPath: WINDSURF_AGENTS_MD,
10434
11165
  extraRuleOutputPaths(rule) {
10435
11166
  if (rule.root) return [WINDSURF_AGENTS_MD];
@@ -10524,9 +11255,9 @@ var init_windsurf2 = __esm({
10524
11255
  ignore: "native",
10525
11256
  permissions: "none"
10526
11257
  };
10527
- descriptor12 = {
11258
+ descriptor13 = {
10528
11259
  id: "windsurf",
10529
- generators: target12,
11260
+ generators: target13,
10530
11261
  capabilities: {
10531
11262
  rules: "native",
10532
11263
  additionalRules: "native",
@@ -10540,12 +11271,12 @@ var init_windsurf2 = __esm({
10540
11271
  },
10541
11272
  emptyImportMessage: "No Windsurf config found (.windsurfrules, .windsurf/rules, .windsurfignore, or .codeiumignore).",
10542
11273
  supportsConversion: { agents: true },
10543
- lintRules: lintRules12,
11274
+ lintRules: lintRules13,
10544
11275
  lint: {
10545
11276
  commands: lintCommands6,
10546
11277
  mcp: lintMcp4
10547
11278
  },
10548
- project: project12,
11279
+ project: project13,
10549
11280
  globalSupport: {
10550
11281
  capabilities: globalCapabilities12,
10551
11282
  detectionPaths: [
@@ -10588,67 +11319,67 @@ function builtinTargetsMap() {
10588
11319
  }
10589
11320
  return _builtinTargetsMap;
10590
11321
  }
10591
- function getBuiltinTargetDefinition(target13) {
10592
- return builtinTargetsMap().get(target13);
11322
+ function getBuiltinTargetDefinition(target14) {
11323
+ return builtinTargetsMap().get(target14);
10593
11324
  }
10594
- function getTargetCapabilities(target13, scope = "project") {
10595
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
10596
- if (!descriptor13) return void 0;
10597
- const raw = scope === "global" ? descriptor13.globalSupport?.capabilities ?? descriptor13.capabilities : descriptor13.capabilities;
11325
+ function getTargetCapabilities(target14, scope = "project") {
11326
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
11327
+ if (!descriptor14) return void 0;
11328
+ const raw = scope === "global" ? descriptor14.globalSupport?.capabilities ?? descriptor14.capabilities : descriptor14.capabilities;
10598
11329
  return normalizeTargetCapabilities(raw);
10599
11330
  }
10600
- function getTargetDetectionPaths(target13, scope = "project") {
10601
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
10602
- if (!descriptor13) return [];
11331
+ function getTargetDetectionPaths(target14, scope = "project") {
11332
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
11333
+ if (!descriptor14) return [];
10603
11334
  if (scope === "global") {
10604
- return descriptor13.globalSupport?.detectionPaths ?? [];
11335
+ return descriptor14.globalSupport?.detectionPaths ?? [];
10605
11336
  }
10606
- return descriptor13.detectionPaths;
11337
+ return descriptor14.detectionPaths;
10607
11338
  }
10608
- function getTargetLayout(target13, scope = "project") {
10609
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
10610
- if (!descriptor13) return void 0;
11339
+ function getTargetLayout(target14, scope = "project") {
11340
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
11341
+ if (!descriptor14) return void 0;
10611
11342
  if (scope === "global") {
10612
- return descriptor13.globalSupport?.layout;
11343
+ return descriptor14.globalSupport?.layout;
10613
11344
  }
10614
- return descriptor13.project;
11345
+ return descriptor14.project;
10615
11346
  }
10616
- function getTargetPrimaryRootInstructionPath(target13, scope = "project") {
10617
- return getTargetLayout(target13, scope)?.rootInstructionPath;
11347
+ function getTargetPrimaryRootInstructionPath(target14, scope = "project") {
11348
+ return getTargetLayout(target14, scope)?.rootInstructionPath;
10618
11349
  }
10619
- function getTargetSkillDir(target13, scope = "project") {
10620
- return getTargetLayout(target13, scope)?.skillDir;
11350
+ function getTargetSkillDir(target14, scope = "project") {
11351
+ return getTargetLayout(target14, scope)?.skillDir;
10621
11352
  }
10622
- function getTargetManagedOutputs(target13, scope = "project") {
10623
- return getTargetLayout(target13, scope)?.managedOutputs;
11353
+ function getTargetManagedOutputs(target14, scope = "project") {
11354
+ return getTargetLayout(target14, scope)?.managedOutputs;
10624
11355
  }
10625
- function rewriteGeneratedOutputPath(target13, path, scope = "project") {
10626
- const layout = getTargetLayout(target13, scope);
11356
+ function rewriteGeneratedOutputPath(target14, path, scope = "project") {
11357
+ const layout = getTargetLayout(target14, scope);
10627
11358
  if (!layout) return null;
10628
11359
  return layout.rewriteGeneratedPath ? layout.rewriteGeneratedPath(path) : path;
10629
11360
  }
10630
- function isFeatureSuppressedByConversion(descriptor13, feature, config, scope) {
10631
- if (!descriptor13 || !config) return false;
10632
- if (feature === "commands" && descriptor13.supportsConversion?.commands) {
10633
- return !shouldConvertCommandsToSkills(config, descriptor13.id, true, scope);
11361
+ function isFeatureSuppressedByConversion(descriptor14, feature, config, scope) {
11362
+ if (!descriptor14 || !config) return false;
11363
+ if (feature === "commands" && descriptor14.supportsConversion?.commands) {
11364
+ return !shouldConvertCommandsToSkills(config, descriptor14.id, true, scope);
10634
11365
  }
10635
- if (feature === "agents" && descriptor13.supportsConversion?.agents) {
10636
- return !shouldConvertAgentsToSkills(config, descriptor13.id, true, scope);
11366
+ if (feature === "agents" && descriptor14.supportsConversion?.agents) {
11367
+ return !shouldConvertAgentsToSkills(config, descriptor14.id, true, scope);
10637
11368
  }
10638
11369
  return false;
10639
11370
  }
10640
- function getEffectiveTargetSupportLevel(target13, feature, config, scope = "project") {
10641
- const baseLevel = getTargetCapabilities(target13, scope)?.[feature]?.level ?? "none";
11371
+ function getEffectiveTargetSupportLevel(target14, feature, config, scope = "project") {
11372
+ const baseLevel = getTargetCapabilities(target14, scope)?.[feature]?.level ?? "none";
10642
11373
  if (baseLevel !== "embedded") return baseLevel;
10643
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
10644
- return isFeatureSuppressedByConversion(descriptor13, feature, config, scope) ? "none" : baseLevel;
11374
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
11375
+ return isFeatureSuppressedByConversion(descriptor14, feature, config, scope) ? "none" : baseLevel;
10645
11376
  }
10646
- function resolveTargetFeatureGenerator(target13, feature, config, scope = "project") {
10647
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
10648
- if (!descriptor13?.generators) return void 0;
10649
- if (isFeatureSuppressedByConversion(descriptor13, feature, config, scope)) return void 0;
11377
+ function resolveTargetFeatureGenerator(target14, feature, config, scope = "project") {
11378
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
11379
+ if (!descriptor14?.generators) return void 0;
11380
+ if (isFeatureSuppressedByConversion(descriptor14, feature, config, scope)) return void 0;
10650
11381
  const pick = PICK_FEATURE_GENERATOR[feature];
10651
- return pick === null ? void 0 : pick(descriptor13.generators);
11382
+ return pick === null ? void 0 : pick(descriptor14.generators);
10652
11383
  }
10653
11384
  var BUILTIN_TARGETS, _builtinTargetsMap, PICK_FEATURE_GENERATOR;
10654
11385
  var init_builtin_targets = __esm({
@@ -10667,6 +11398,7 @@ var init_builtin_targets = __esm({
10667
11398
  init_cursor2();
10668
11399
  init_gemini_cli2();
10669
11400
  init_junie2();
11401
+ init_kilo_code2();
10670
11402
  init_kiro2();
10671
11403
  init_roo_code2();
10672
11404
  init_windsurf2();
@@ -10682,7 +11414,8 @@ var init_builtin_targets = __esm({
10682
11414
  descriptor9,
10683
11415
  descriptor10,
10684
11416
  descriptor11,
10685
- descriptor12
11417
+ descriptor12,
11418
+ descriptor13
10686
11419
  ];
10687
11420
  PICK_FEATURE_GENERATOR = {
10688
11421
  rules: (g) => g.generateRules,
@@ -10703,12 +11436,12 @@ function capabilityLevel(capability) {
10703
11436
  function canUseScopedSettings(feature) {
10704
11437
  return settingsBackedFeatures.includes(feature);
10705
11438
  }
10706
- function validateCapabilityImplementations(descriptor13, capabilities, ctx, pathPrefix) {
11439
+ function validateCapabilityImplementations(descriptor14, capabilities2, ctx, pathPrefix) {
10707
11440
  for (const requirement of generatorRequirements) {
10708
- const level = capabilityLevel(capabilities[requirement.feature]);
11441
+ const level = capabilityLevel(capabilities2[requirement.feature]);
10709
11442
  if (level === "none") continue;
10710
- const hasGenerator = typeof descriptor13.generators[requirement.generator] === "function";
10711
- const hasSettingsEmitter = canUseScopedSettings(requirement.feature) && typeof descriptor13.emitScopedSettings === "function";
11443
+ const hasGenerator = typeof descriptor14.generators[requirement.generator] === "function";
11444
+ const hasSettingsEmitter = canUseScopedSettings(requirement.feature) && typeof descriptor14.emitScopedSettings === "function";
10712
11445
  if (hasGenerator || hasSettingsEmitter) continue;
10713
11446
  ctx.addIssue({
10714
11447
  code: "custom",
@@ -10833,9 +11566,9 @@ var init_registry = __esm({
10833
11566
  });
10834
11567
 
10835
11568
  // src/core/reference/import-map.ts
10836
- async function buildImportReferenceMap(target13, projectRoot, scope = "project") {
11569
+ async function buildImportReferenceMap(target14, projectRoot, scope = "project") {
10837
11570
  const refs = /* @__PURE__ */ new Map();
10838
- const def = getDescriptor(target13);
11571
+ const def = getDescriptor(target14);
10839
11572
  if (def) {
10840
11573
  await def.buildImportPaths(refs, projectRoot, scope);
10841
11574
  }
@@ -10846,51 +11579,14 @@ var init_import_map = __esm({
10846
11579
  init_registry();
10847
11580
  }
10848
11581
  });
10849
- function pathApi(projectRoot) {
10850
- return projectRoot.includes("\\") || WINDOWS_ABSOLUTE_PATH.test(projectRoot) ? win32 : posix;
10851
- }
10852
- function normalizeSeparators(token) {
10853
- return token.replace(/\\/g, "/");
10854
- }
10855
- function normalizeForProject(projectRoot, filePath) {
10856
- const api = pathApi(projectRoot);
10857
- const normalized = api.normalize(
10858
- api === win32 ? filePath.replace(/\//g, "\\") : normalizeSeparators(filePath)
10859
- );
10860
- return normalized.endsWith(api.sep) && normalized.length > 1 ? normalized.slice(0, -1) : normalized;
10861
- }
10862
- function isAbsoluteForProject(projectRoot, filePath) {
10863
- return pathApi(projectRoot).isAbsolute(filePath) || WINDOWS_ABSOLUTE_PATH.test(filePath);
10864
- }
10865
- function stripTrailingPunctuation(token) {
10866
- let candidate = token;
10867
- let suffix = "";
10868
- while (TRAILING_PUNCTUATION.test(candidate)) {
10869
- suffix = candidate.at(-1) + suffix;
10870
- candidate = candidate.slice(0, -1);
10871
- }
10872
- return { candidate, suffix };
10873
- }
10874
- function rootFallbackPath(token, projectRoot) {
10875
- const api = pathApi(projectRoot);
10876
- const stripped = token.replace(/^(\.\.\/)+/, "").replace(/^\.\//, "");
10877
- return stripped && stripped !== token ? normalizeForProject(projectRoot, api.join(projectRoot, stripped)) : null;
10878
- }
10879
- var WINDOWS_ABSOLUTE_PATH, TRAILING_PUNCTUATION;
10880
- var init_path_helpers = __esm({
10881
- "src/core/path-helpers.ts"() {
10882
- WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]/;
10883
- TRAILING_PUNCTUATION = /[.!?:;]+$/;
10884
- }
10885
- });
10886
11582
 
10887
11583
  // src/core/reference/link-format-registry.ts
10888
- function topLevelDotfilePrefixes(descriptor13) {
10889
- const layouts = [descriptor13.project, descriptor13.globalSupport?.layout].filter(
11584
+ function topLevelDotfilePrefixes(descriptor14) {
11585
+ const layouts = [descriptor14.project, descriptor14.globalSupport?.layout].filter(
10890
11586
  (l) => l !== void 0
10891
11587
  );
10892
11588
  const candidates = [
10893
- ...descriptor13.detectionPaths,
11589
+ ...descriptor14.detectionPaths,
10894
11590
  ...layouts.flatMap((l) => l.managedOutputs?.dirs ?? []),
10895
11591
  ...layouts.flatMap((l) => l.managedOutputs?.files ?? [])
10896
11592
  ];
@@ -10903,8 +11599,8 @@ function topLevelDotfilePrefixes(descriptor13) {
10903
11599
  }
10904
11600
  function buildDefaultRootRelativePrefixes() {
10905
11601
  const set = /* @__PURE__ */ new Set([".agentsmesh/"]);
10906
- for (const descriptor13 of BUILTIN_TARGETS) {
10907
- for (const prefix of topLevelDotfilePrefixes(descriptor13)) set.add(prefix);
11602
+ for (const descriptor14 of BUILTIN_TARGETS) {
11603
+ for (const prefix of topLevelDotfilePrefixes(descriptor14)) set.add(prefix);
10908
11604
  }
10909
11605
  return Array.from(set);
10910
11606
  }
@@ -10975,7 +11671,7 @@ function resolveProjectPath(token, projectRoot, sourceFile) {
10975
11671
  }
10976
11672
  return [windowsToken];
10977
11673
  }
10978
- if (isAbsolute(token)) {
11674
+ if (api.isAbsolute(token)) {
10979
11675
  const absoluteToken = normalizeForProject(projectRoot, token);
10980
11676
  if (absoluteToken.startsWith(normalizedProjectRoot) || existsSync(token))
10981
11677
  return [absoluteToken];
@@ -11081,9 +11777,14 @@ var init_link_rebaser_helpers = __esm({
11081
11777
  LINE_NUMBER_SUFFIX = /(?::(\d+)){1,2}$/;
11082
11778
  }
11083
11779
  });
11780
+
11781
+ // src/core/reference/link-rebaser-formatting.ts
11084
11782
  function isReadingContext(context) {
11085
11783
  return context === void 0 || context.role === "inline-code" || context.role === "bracketed" || context.role === "quoted" || context.role === "at-prefix" || context.role === "bracket-label" || context.role === "bare-prose";
11086
11784
  }
11785
+ function isReadingContextOptions(options) {
11786
+ return isReadingContext(options.tokenContext);
11787
+ }
11087
11788
  function isUnderProjectRoot(projectRoot, absolutePath) {
11088
11789
  const api = pathApi(projectRoot);
11089
11790
  const root = normalizeForProject(projectRoot, projectRoot);
@@ -11123,11 +11824,6 @@ function toProjectRootRelative(projectRoot, absolutePath, keepSlash) {
11123
11824
  const rewritten = relPath.length > 0 ? relPath : ".";
11124
11825
  return keepSlash && !rewritten.endsWith("/") ? `${rewritten}/` : rewritten;
11125
11826
  }
11126
- function shouldPreserveAgentsMeshAnchor(_projectRoot, _destinationFile, options) {
11127
- if (!isReadingContext(options.tokenContext)) return false;
11128
- if (options.originalToken === void 0) return false;
11129
- return normalizeSeparators(options.originalToken).startsWith(".agentsmesh/");
11130
- }
11131
11827
  function toProjectRootReference(projectRoot, absolutePath, keepSlash) {
11132
11828
  const formatted = toProjectRootRelative(projectRoot, absolutePath, keepSlash);
11133
11829
  if (formatted === null) return null;
@@ -11137,21 +11833,21 @@ function formatLinkPathForDestinationLegacy(projectRoot, destinationFile, absolu
11137
11833
  const api = pathApi(projectRoot);
11138
11834
  const root = normalizeForProject(projectRoot, projectRoot);
11139
11835
  const destFile = normalizeForProject(projectRoot, destinationFile);
11140
- const target13 = normalizeForProject(projectRoot, absoluteTargetPath);
11141
- if (!isUnderProjectRoot(projectRoot, target13)) {
11142
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
11836
+ const target14 = normalizeForProject(projectRoot, absoluteTargetPath);
11837
+ if (!isUnderProjectRoot(projectRoot, target14)) {
11838
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
11143
11839
  }
11144
- const destDir = normalizeForProject(projectRoot, dirname(destFile));
11840
+ const destDir = normalizeForProject(projectRoot, api.dirname(destFile));
11145
11841
  if (!isUnderProjectRoot(projectRoot, destDir) && destDir !== root) {
11146
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
11842
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
11147
11843
  }
11148
- let rel2 = api.relative(destDir, target13).replace(/\\/g, "/");
11844
+ let rel2 = api.relative(destDir, target14).replace(/\\/g, "/");
11149
11845
  if (api.isAbsolute(rel2) || WINDOWS_ABSOLUTE_PATH.test(rel2)) {
11150
- return toProjectRootRelative(projectRoot, target13, keepSlash);
11846
+ return toProjectRootRelative(projectRoot, target14, keepSlash);
11151
11847
  }
11152
11848
  const joined = normalizeForProject(projectRoot, api.join(destDir, rel2));
11153
11849
  if (!isUnderProjectRoot(projectRoot, joined)) {
11154
- return toProjectRootRelative(projectRoot, target13, keepSlash);
11850
+ return toProjectRootRelative(projectRoot, target14, keepSlash);
11155
11851
  }
11156
11852
  if (rel2 === "" || rel2 === ".") {
11157
11853
  rel2 = ".";
@@ -11170,9 +11866,14 @@ var init_link_rebaser_formatting = __esm({
11170
11866
  // src/core/reference/link-rebaser-output.ts
11171
11867
  function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTargetPath, keepSlash, options = {}) {
11172
11868
  const scope = options.scope ?? "project";
11173
- const target13 = normalizeForProject(projectRoot, absoluteTargetPath);
11174
- if (shouldPreserveAgentsMeshAnchor(projectRoot, destinationFile, options)) {
11175
- return normalizeSeparators(options.originalToken ?? "");
11869
+ const target14 = normalizeForProject(projectRoot, absoluteTargetPath);
11870
+ if (isReadingContextOptions(options) && isUnderAgentsMesh(projectRoot, destinationFile) && isUnderAgentsMesh(projectRoot, target14)) {
11871
+ const api = pathApi(projectRoot);
11872
+ const root = normalizeForProject(projectRoot, projectRoot);
11873
+ const rel2 = api.relative(root, target14).replace(/\\/g, "/");
11874
+ if (!rel2.startsWith("..") && rel2.length > 0) {
11875
+ return keepSlash && !rel2.endsWith("/") ? `${rel2}/` : rel2;
11876
+ }
11176
11877
  }
11177
11878
  if (options.forceRelative) {
11178
11879
  return formatLinkPathForDestinationLegacy(
@@ -11184,10 +11885,10 @@ function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTarg
11184
11885
  );
11185
11886
  }
11186
11887
  if (scope === "global" && !isUnderAgentsMesh(projectRoot, destinationFile)) {
11187
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
11888
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
11188
11889
  }
11189
11890
  const meshCanonicalForShape = (() => {
11190
- if (isUnderAgentsMesh(projectRoot, target13)) return target13;
11891
+ if (isUnderAgentsMesh(projectRoot, target14)) return target14;
11191
11892
  const logical = options.logicalMeshSourceAbsolute;
11192
11893
  if (logical && isUnderAgentsMesh(projectRoot, normalizeForProject(projectRoot, logical))) {
11193
11894
  return normalizeForProject(projectRoot, logical);
@@ -11195,9 +11896,9 @@ function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTarg
11195
11896
  return null;
11196
11897
  })();
11197
11898
  if (!meshCanonicalForShape) {
11198
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
11899
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
11199
11900
  }
11200
- const treatAsDirectory = keepSlash || (options.pathIsDirectory?.(target13) ?? false);
11901
+ const treatAsDirectory = keepSlash || (options.pathIsDirectory?.(target14) ?? false);
11201
11902
  if (treatAsDirectory) {
11202
11903
  const meshRelative = toAgentsMeshRootRelative(projectRoot, meshCanonicalForShape, keepSlash);
11203
11904
  if (meshRelative !== null) return meshRelative;
@@ -11221,7 +11922,7 @@ var init_link_rebaser_output = __esm({
11221
11922
  });
11222
11923
 
11223
11924
  // src/core/reference/link-rebaser-suffix-strip.ts
11224
- function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pathExists) {
11925
+ function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pathExists2) {
11225
11926
  const api = pathApi(projectRoot);
11226
11927
  const normalizedToken = normalizeSeparators(token);
11227
11928
  if (!isRootRelativePathToken(normalizedToken)) return null;
@@ -11233,7 +11934,7 @@ function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pa
11233
11934
  const suffix = segments.slice(i).join("/");
11234
11935
  const candidate = normalizeForProject(projectRoot, api.join(destDir, suffix));
11235
11936
  if (candidate === destFilePath) continue;
11236
- if (pathExists(candidate)) return candidate;
11937
+ if (pathExists2(candidate)) return candidate;
11237
11938
  }
11238
11939
  return null;
11239
11940
  }
@@ -11550,22 +12251,23 @@ var init_link_rebaser = __esm({
11550
12251
  init_link_token_context();
11551
12252
  }
11552
12253
  });
11553
- function pathVariants(path) {
11554
- const variants = [normalize(path)];
12254
+ function pathVariants(api, path) {
12255
+ const variants = [api.normalize(path)];
11555
12256
  if (!existsSync(path)) return variants;
11556
12257
  try {
11557
12258
  const realPaths = [realpathSync(path), realpathSync.native(path)];
11558
12259
  for (const realPath of realPaths) {
11559
- const normalized = normalize(realPath);
12260
+ const normalized = api.normalize(realPath);
11560
12261
  if (!variants.includes(normalized)) variants.push(normalized);
11561
12262
  }
11562
12263
  } catch {
11563
12264
  }
11564
12265
  return variants;
11565
12266
  }
11566
- async function createImportReferenceNormalizer(target13, projectRoot, scope = "project") {
12267
+ async function createImportReferenceNormalizer(target14, projectRoot, scope = "project") {
12268
+ const api = pathApi(projectRoot);
11567
12269
  const refs = /* @__PURE__ */ new Map();
11568
- const targets = Array.from(/* @__PURE__ */ new Set([target13, ...TARGET_IDS]));
12270
+ const targets = Array.from(/* @__PURE__ */ new Set([target14, ...TARGET_IDS]));
11569
12271
  for (const candidate of targets) {
11570
12272
  const candidateRefs = await buildImportReferenceMap(candidate, projectRoot, scope);
11571
12273
  for (const [targetPath, canonicalPath] of candidateRefs.entries()) {
@@ -11574,17 +12276,17 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
11574
12276
  }
11575
12277
  const artifactMap = /* @__PURE__ */ new Map();
11576
12278
  for (const [targetPath, canonicalPath] of refs.entries()) {
11577
- const canonicalAbsPath = normalize(join(projectRoot, canonicalPath));
11578
- for (const variant of pathVariants(join(projectRoot, targetPath))) {
12279
+ const canonicalAbsPath = api.normalize(api.join(projectRoot, canonicalPath));
12280
+ for (const variant of pathVariants(api, api.join(projectRoot, targetPath))) {
11579
12281
  artifactMap.set(variant, canonicalAbsPath);
11580
12282
  }
11581
12283
  }
11582
12284
  const canonicalDestAbs = /* @__PURE__ */ new Set();
11583
12285
  for (const canonicalPath of new Set(refs.values())) {
11584
- const abs = normalize(join(projectRoot, canonicalPath));
12286
+ const abs = api.normalize(api.join(projectRoot, canonicalPath));
11585
12287
  canonicalDestAbs.add(abs);
11586
- for (const variant of pathVariants(abs)) {
11587
- canonicalDestAbs.add(normalize(variant));
12288
+ for (const variant of pathVariants(api, abs)) {
12289
+ canonicalDestAbs.add(api.normalize(variant));
11588
12290
  }
11589
12291
  }
11590
12292
  return (content, sourceFile, destinationFile) => rewriteFileLinks({
@@ -11594,7 +12296,7 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
11594
12296
  destinationFile,
11595
12297
  translatePath: (absolutePath) => artifactMap.get(absolutePath) ?? absolutePath,
11596
12298
  pathExists: (absolutePath) => {
11597
- const normalized = normalize(absolutePath);
12299
+ const normalized = api.normalize(absolutePath);
11598
12300
  return artifactMap.has(absolutePath) || artifactMap.has(normalized) || existsSync(absolutePath) || canonicalDestAbs.has(normalized);
11599
12301
  },
11600
12302
  explicitCurrentDirLinks: false,
@@ -11611,6 +12313,7 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
11611
12313
  }
11612
12314
  var init_import_rewriter = __esm({
11613
12315
  "src/core/reference/import-rewriter.ts"() {
12316
+ init_path_helpers();
11614
12317
  init_import_map();
11615
12318
  init_link_rebaser();
11616
12319
  init_target_ids();
@@ -11680,10 +12383,8 @@ async function importSettings2(projectRoot, results) {
11680
12383
  }
11681
12384
  const alreadyImportedMcp = results.some((r) => r.feature === "mcp");
11682
12385
  if (!alreadyImportedMcp && settings.mcpServers && typeof settings.mcpServers === "object") {
11683
- const mcpContent = JSON.stringify({ mcpServers: settings.mcpServers }, null, 2);
11684
- const destPath = join(projectRoot, CLAUDE_CANONICAL_MCP);
11685
- await mkdirp(dirname(destPath));
11686
- await writeFileAtomic(destPath, mcpContent);
12386
+ const mcpServers = settings.mcpServers;
12387
+ await writeMcpWithMerge(projectRoot, CLAUDE_CANONICAL_MCP, mcpServers);
11687
12388
  results.push({
11688
12389
  fromTool: "claude-code",
11689
12390
  fromPath: settingsPath,
@@ -11731,6 +12432,7 @@ var init_settings_helpers2 = __esm({
11731
12432
  "src/targets/claude-code/settings-helpers.ts"() {
11732
12433
  init_hook_command();
11733
12434
  init_fs();
12435
+ init_mcp_merge();
11734
12436
  init_constants3();
11735
12437
  }
11736
12438
  });
@@ -11790,7 +12492,7 @@ async function importFromClaudeCode(projectRoot, options = {}) {
11790
12492
  await importSettings2(projectRoot, results);
11791
12493
  return results;
11792
12494
  }
11793
- var init_importer12 = __esm({
12495
+ var init_importer13 = __esm({
11794
12496
  "src/targets/claude-code/importer.ts"() {
11795
12497
  init_import_rewriter();
11796
12498
  init_descriptor_import_runner();
@@ -12033,13 +12735,13 @@ function parseGitlabSource(source) {
12033
12735
  const slash = slug.lastIndexOf("/");
12034
12736
  if (slash < 0) return null;
12035
12737
  const namespace = slug.slice(0, slash).trim();
12036
- const project13 = slug.slice(slash + 1).trim();
12037
- if (!namespace || !project13) return null;
12738
+ const project14 = slug.slice(slash + 1).trim();
12739
+ if (!namespace || !project14) return null;
12038
12740
  return {
12039
12741
  namespace,
12040
- project: project13,
12742
+ project: project14,
12041
12743
  ref,
12042
- cloneUrl: `https://gitlab.com/${namespace}/${project13}.git`
12744
+ cloneUrl: `https://gitlab.com/${namespace}/${project14}.git`
12043
12745
  };
12044
12746
  }
12045
12747
  function parseGitSource(source) {
@@ -12098,13 +12800,25 @@ async function sweepStaleCache(cacheDir, maxAgeMs) {
12098
12800
  }
12099
12801
 
12100
12802
  // src/config/remote/remote-fetcher.ts
12803
+ var MAX_CACHE_KEY_LENGTH = 80;
12101
12804
  function buildCacheKey(provider, identifier, ref) {
12102
- const safe = (value) => value.replace(/[^a-zA-Z0-9_-]/g, "_");
12805
+ const safe = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_").replace(/^\.+/, "_");
12806
+ let key;
12103
12807
  if (provider === "github") {
12104
12808
  const [org, repo] = identifier.split("/", 2);
12105
- if (org && repo) return `${safe(org)}-${safe(repo)}-${safe(ref)}`;
12809
+ if (org && repo) {
12810
+ key = `${safe(org)}--${safe(repo)}--${safe(ref)}`;
12811
+ } else {
12812
+ key = `${safe(provider)}__${safe(identifier)}__${safe(ref)}`;
12813
+ }
12814
+ } else {
12815
+ key = `${safe(provider)}__${safe(identifier)}__${safe(ref)}`;
12816
+ }
12817
+ if (key.length > MAX_CACHE_KEY_LENGTH) {
12818
+ const hash = createHash("sha256").update(key).digest("hex").slice(0, 16);
12819
+ key = `${key.slice(0, MAX_CACHE_KEY_LENGTH - 18)}--${hash}`;
12106
12820
  }
12107
- return `${safe(provider)}_${safe(identifier)}_${safe(ref)}`;
12821
+ return key;
12108
12822
  }
12109
12823
  function getCacheDir() {
12110
12824
  const env = process.env.AGENTSMESH_CACHE;
@@ -12732,6 +13446,21 @@ var TARGET_SIGNATURES = [
12732
13446
  {
12733
13447
  target: "kiro",
12734
13448
  paths: [".kiro", ".kiro/steering", ".kiro/settings/mcp.json"]
13449
+ },
13450
+ {
13451
+ target: "kilo-code",
13452
+ paths: [
13453
+ ".kilo",
13454
+ ".kilo/rules",
13455
+ ".kilo/commands",
13456
+ ".kilo/agents",
13457
+ ".kilo/skills",
13458
+ ".kilocodeignore",
13459
+ ".kilocode",
13460
+ ".kilocodemodes",
13461
+ "kilo.jsonc",
13462
+ "kilo.json"
13463
+ ]
12735
13464
  }
12736
13465
  ];
12737
13466
  async function detectNativeFormat(repoPath) {
@@ -12816,15 +13545,16 @@ var logger = {
12816
13545
  };
12817
13546
 
12818
13547
  // src/canonical/extends/native-extends-importer.ts
12819
- init_importer12();
13548
+ init_importer13();
12820
13549
  init_importer6();
12821
13550
  init_importer5();
12822
13551
  init_importer7();
12823
13552
  init_importer3();
12824
- init_importer11();
13553
+ init_importer12();
12825
13554
  init_importer2();
12826
13555
  init_importer4();
12827
13556
  init_importer8();
13557
+ init_importer10();
12828
13558
  init_importer9();
12829
13559
  var NATIVE_IMPORTERS = {
12830
13560
  "claude-code": importFromClaudeCode,
@@ -12836,7 +13566,8 @@ var NATIVE_IMPORTERS = {
12836
13566
  cline: importFromCline,
12837
13567
  continue: importFromContinue,
12838
13568
  junie: importFromJunie,
12839
- kiro: importFromKiro
13569
+ kiro: importFromKiro,
13570
+ "kilo-code": importFromKiloCode
12840
13571
  };
12841
13572
  async function importNativeToCanonical(repoPath, targetName) {
12842
13573
  const importFn = NATIVE_IMPORTERS[targetName];
@@ -13363,8 +14094,8 @@ function deepMergeObjects(base, overrides2) {
13363
14094
  }
13364
14095
  return result;
13365
14096
  }
13366
- function mergeLocalConfig(project13, local) {
13367
- const merged = { ...project13 };
14097
+ function mergeLocalConfig(project14, local) {
14098
+ const merged = { ...project14 };
13368
14099
  if (Array.isArray(local.targets) && local.targets.length > 0) {
13369
14100
  merged.targets = local.targets;
13370
14101
  }
@@ -13384,7 +14115,7 @@ function mergeLocalConfig(project13, local) {
13384
14115
  );
13385
14116
  }
13386
14117
  if (Array.isArray(local.extends) && local.extends.length > 0) {
13387
- merged.extends = [...project13.extends ?? [], ...local.extends];
14118
+ merged.extends = [...project14.extends ?? [], ...local.extends];
13388
14119
  }
13389
14120
  return merged;
13390
14121
  }