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/index.js CHANGED
@@ -1,52 +1,52 @@
1
1
  import { z } from 'zod';
2
- import { access, readdir, readFile, realpath, stat, rm, mkdir, lstat, writeFile, rename } from 'fs/promises';
3
- import { join, basename, dirname, relative, win32, posix, resolve, normalize, extname, isAbsolute } from 'path';
2
+ import { access, readdir, readFile, realpath, stat, rm, mkdir, lstat, unlink, writeFile, rename } from 'fs/promises';
3
+ import { join, basename, dirname, relative, win32, posix, resolve, extname } from 'path';
4
4
  import { constants, existsSync, realpathSync, statSync } from 'fs';
5
5
  import { stringify, parse } from 'yaml';
6
6
  import { parse as parse$1 } from 'smol-toml';
7
7
  import { Buffer } from 'buffer';
8
8
  import { homedir } from 'os';
9
+ import { createHash } from 'crypto';
9
10
  import { execFile } from 'child_process';
10
11
  import { fileURLToPath, pathToFileURL, URL } from 'url';
11
12
  import { promisify } from 'util';
12
13
  import * as tar from 'tar';
13
14
  import { createTwoFilesPatch } from 'diff';
14
- import { createHash } from 'crypto';
15
15
 
16
16
  var __defProp = Object.defineProperty;
17
17
  var __getOwnPropNames = Object.getOwnPropertyNames;
18
18
  var __esm = (fn, res) => function __init() {
19
19
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
20
20
  };
21
- var __export = (target13, all) => {
21
+ var __export = (target14, all) => {
22
22
  for (var name in all)
23
- __defProp(target13, name, { get: all[name], enumerable: true });
23
+ __defProp(target14, name, { get: all[name], enumerable: true });
24
24
  };
25
25
 
26
26
  // src/config/core/conversions.ts
27
- function usesCommandSkillProjection(target13) {
28
- return Object.prototype.hasOwnProperty.call(DEFAULT_COMMANDS_TO_SKILLS, target13);
27
+ function usesCommandSkillProjection(target14) {
28
+ return Object.prototype.hasOwnProperty.call(DEFAULT_COMMANDS_TO_SKILLS, target14);
29
29
  }
30
- function usesAgentSkillProjection(target13) {
31
- return Object.prototype.hasOwnProperty.call(DEFAULT_AGENTS_TO_SKILLS, target13);
30
+ function usesAgentSkillProjection(target14) {
31
+ return Object.prototype.hasOwnProperty.call(DEFAULT_AGENTS_TO_SKILLS, target14);
32
32
  }
33
33
  function resolveConversionValue(value, scope) {
34
34
  if (value === void 0) return void 0;
35
35
  if (typeof value === "boolean") return value;
36
36
  return value[scope];
37
37
  }
38
- function shouldConvertCommandsToSkills(config, target13, defaultEnabled, scope = "project") {
39
- const raw = config.conversions?.commands_to_skills?.[target13];
38
+ function shouldConvertCommandsToSkills(config, target14, defaultEnabled, scope = "project") {
39
+ const raw = config.conversions?.commands_to_skills?.[target14];
40
40
  const configVal = resolveConversionValue(raw, scope);
41
41
  if (configVal !== void 0) return configVal;
42
- if (usesCommandSkillProjection(target13)) return DEFAULT_COMMANDS_TO_SKILLS[target13];
42
+ if (usesCommandSkillProjection(target14)) return DEFAULT_COMMANDS_TO_SKILLS[target14];
43
43
  return defaultEnabled ?? false;
44
44
  }
45
- function shouldConvertAgentsToSkills(config, target13, defaultEnabled, scope = "project") {
46
- const raw = config.conversions?.agents_to_skills?.[target13];
45
+ function shouldConvertAgentsToSkills(config, target14, defaultEnabled, scope = "project") {
46
+ const raw = config.conversions?.agents_to_skills?.[target14];
47
47
  const configVal = resolveConversionValue(raw, scope);
48
48
  if (configVal !== void 0) return configVal;
49
- if (usesAgentSkillProjection(target13)) return DEFAULT_AGENTS_TO_SKILLS[target13];
49
+ if (usesAgentSkillProjection(target14)) return DEFAULT_AGENTS_TO_SKILLS[target14];
50
50
  return defaultEnabled ?? false;
51
51
  }
52
52
  var DEFAULT_COMMANDS_TO_SKILLS, DEFAULT_AGENTS_TO_SKILLS;
@@ -99,12 +99,12 @@ function capabilityLevel(capability) {
99
99
  function canUseScopedSettings(feature) {
100
100
  return settingsBackedFeatures.includes(feature);
101
101
  }
102
- function validateCapabilityImplementations(descriptor13, capabilities, ctx, pathPrefix) {
102
+ function validateCapabilityImplementations(descriptor14, capabilities2, ctx, pathPrefix) {
103
103
  for (const requirement of generatorRequirements) {
104
- const level = capabilityLevel(capabilities[requirement.feature]);
104
+ const level = capabilityLevel(capabilities2[requirement.feature]);
105
105
  if (level === "none") continue;
106
- const hasGenerator = typeof descriptor13.generators[requirement.generator] === "function";
107
- const hasSettingsEmitter = canUseScopedSettings(requirement.feature) && typeof descriptor13.emitScopedSettings === "function";
106
+ const hasGenerator = typeof descriptor14.generators[requirement.generator] === "function";
107
+ const hasSettingsEmitter = canUseScopedSettings(requirement.feature) && typeof descriptor14.emitScopedSettings === "function";
108
108
  if (hasGenerator || hasSettingsEmitter) continue;
109
109
  ctx.addIssue({
110
110
  code: "custom",
@@ -219,8 +219,8 @@ function builtinDescriptors() {
219
219
  }
220
220
  return _builtinDescriptors;
221
221
  }
222
- function registerTargetDescriptor(descriptor13) {
223
- const validated = validateDescriptor(descriptor13);
222
+ function registerTargetDescriptor(descriptor14) {
223
+ const validated = validateDescriptor(descriptor14);
224
224
  descriptorRegistry.set(validated.id, validated);
225
225
  }
226
226
  function getDescriptor(name) {
@@ -240,11 +240,11 @@ var init_registry = __esm({
240
240
 
241
241
  // src/targets/catalog/shared-artifact-owner.ts
242
242
  function ownerTargetIdForSharedPath(path) {
243
- for (const descriptor13 of BUILTIN_TARGETS) {
244
- if (!descriptor13.sharedArtifacts) continue;
245
- for (const [prefix, role] of Object.entries(descriptor13.sharedArtifacts)) {
243
+ for (const descriptor14 of BUILTIN_TARGETS) {
244
+ if (!descriptor14.sharedArtifacts) continue;
245
+ for (const [prefix, role] of Object.entries(descriptor14.sharedArtifacts)) {
246
246
  if (role === "owner" && path.startsWith(prefix)) {
247
- return descriptor13.id;
247
+ return descriptor14.id;
248
248
  }
249
249
  }
250
250
  }
@@ -252,11 +252,11 @@ function ownerTargetIdForSharedPath(path) {
252
252
  }
253
253
  function findSharedArtifactOwnershipConflicts(descriptors) {
254
254
  const owners = [];
255
- for (const descriptor13 of descriptors) {
256
- if (!descriptor13.sharedArtifacts) continue;
257
- for (const [prefix, role] of Object.entries(descriptor13.sharedArtifacts)) {
255
+ for (const descriptor14 of descriptors) {
256
+ if (!descriptor14.sharedArtifacts) continue;
257
+ for (const [prefix, role] of Object.entries(descriptor14.sharedArtifacts)) {
258
258
  if (role !== "owner") continue;
259
- owners.push({ targetId: descriptor13.id, prefix });
259
+ owners.push({ targetId: descriptor14.id, prefix });
260
260
  }
261
261
  }
262
262
  const conflicts = [];
@@ -307,6 +307,7 @@ var init_builtin_target_ids_generated = __esm({
307
307
  "cursor",
308
308
  "gemini-cli",
309
309
  "junie",
310
+ "kilo-code",
310
311
  "kiro",
311
312
  "roo-code",
312
313
  "windsurf"
@@ -362,19 +363,19 @@ var init_errors = __esm({
362
363
  };
363
364
  TargetNotFoundError = class extends AgentsMeshError {
364
365
  target;
365
- constructor(target13, options) {
366
+ constructor(target14, options) {
366
367
  const suffix = options?.supported ? ` Supported: ${options.supported.join(", ")}.` : "";
367
- super("AM_TARGET_NOT_FOUND", `Unknown target "${target13}".${suffix}`, options);
368
+ super("AM_TARGET_NOT_FOUND", `Unknown target "${target14}".${suffix}`, options);
368
369
  this.name = "TargetNotFoundError";
369
- this.target = target13;
370
+ this.target = target14;
370
371
  }
371
372
  };
372
373
  ImportError = class extends AgentsMeshError {
373
374
  target;
374
- constructor(target13, message, options) {
375
- super("AM_IMPORT_FAILED", `Import from ${target13} failed: ${message}`, options);
375
+ constructor(target14, message, options) {
376
+ super("AM_IMPORT_FAILED", `Import from ${target14} failed: ${message}`, options);
376
377
  this.name = "ImportError";
377
- this.target = target13;
378
+ this.target = target14;
378
379
  }
379
380
  };
380
381
  GenerationError = class extends AgentsMeshError {
@@ -452,6 +453,11 @@ async function writeFileAtomic(path, content) {
452
453
  { errnoCode: "EISDIR" }
453
454
  );
454
455
  }
456
+ if (info.isSymbolicLink()) {
457
+ await unlink(path).catch((e) => {
458
+ if (e.code !== "ENOENT") throw e;
459
+ });
460
+ }
455
461
  } catch (err) {
456
462
  if (err instanceof FileSystemError) throw err;
457
463
  const e = err;
@@ -460,7 +466,15 @@ async function writeFileAtomic(path, content) {
460
466
  const tmpPath = `${path}.tmp`;
461
467
  const payload = shouldNormalizeLineEndings(path) ? normalizeLineEndings(content) : content;
462
468
  try {
463
- await writeFile(tmpPath, payload, "utf-8");
469
+ try {
470
+ const tmpInfo = await lstat(tmpPath);
471
+ if (tmpInfo.isSymbolicLink()) {
472
+ await unlink(tmpPath);
473
+ }
474
+ } catch (tmpErr) {
475
+ if (tmpErr.code !== "ENOENT") throw tmpErr;
476
+ }
477
+ await writeFile(tmpPath, payload, { encoding: "utf-8", flag: "w" });
464
478
  await rename(tmpPath, path);
465
479
  } catch (err) {
466
480
  await rm(tmpPath, { force: true }).catch(() => {
@@ -1104,21 +1118,6 @@ var init_generator = __esm({
1104
1118
  init_constants();
1105
1119
  }
1106
1120
  });
1107
-
1108
- // src/core/reference/import-map.ts
1109
- async function buildImportReferenceMap(target13, projectRoot, scope = "project") {
1110
- const refs = /* @__PURE__ */ new Map();
1111
- const def = getDescriptor(target13);
1112
- if (def) {
1113
- await def.buildImportPaths(refs, projectRoot, scope);
1114
- }
1115
- return refs;
1116
- }
1117
- var init_import_map = __esm({
1118
- "src/core/reference/import-map.ts"() {
1119
- init_registry();
1120
- }
1121
- });
1122
1121
  function pathApi(projectRoot) {
1123
1122
  return projectRoot.includes("\\") || WINDOWS_ABSOLUTE_PATH.test(projectRoot) ? win32 : posix;
1124
1123
  }
@@ -1157,13 +1156,28 @@ var init_path_helpers = __esm({
1157
1156
  }
1158
1157
  });
1159
1158
 
1159
+ // src/core/reference/import-map.ts
1160
+ async function buildImportReferenceMap(target14, projectRoot, scope = "project") {
1161
+ const refs = /* @__PURE__ */ new Map();
1162
+ const def = getDescriptor(target14);
1163
+ if (def) {
1164
+ await def.buildImportPaths(refs, projectRoot, scope);
1165
+ }
1166
+ return refs;
1167
+ }
1168
+ var init_import_map = __esm({
1169
+ "src/core/reference/import-map.ts"() {
1170
+ init_registry();
1171
+ }
1172
+ });
1173
+
1160
1174
  // src/core/reference/link-format-registry.ts
1161
- function topLevelDotfilePrefixes(descriptor13) {
1162
- const layouts = [descriptor13.project, descriptor13.globalSupport?.layout].filter(
1175
+ function topLevelDotfilePrefixes(descriptor14) {
1176
+ const layouts = [descriptor14.project, descriptor14.globalSupport?.layout].filter(
1163
1177
  (l) => l !== void 0
1164
1178
  );
1165
1179
  const candidates = [
1166
- ...descriptor13.detectionPaths,
1180
+ ...descriptor14.detectionPaths,
1167
1181
  ...layouts.flatMap((l) => l.managedOutputs?.dirs ?? []),
1168
1182
  ...layouts.flatMap((l) => l.managedOutputs?.files ?? [])
1169
1183
  ];
@@ -1176,8 +1190,8 @@ function topLevelDotfilePrefixes(descriptor13) {
1176
1190
  }
1177
1191
  function buildDefaultRootRelativePrefixes() {
1178
1192
  const set = /* @__PURE__ */ new Set([".agentsmesh/"]);
1179
- for (const descriptor13 of BUILTIN_TARGETS) {
1180
- for (const prefix of topLevelDotfilePrefixes(descriptor13)) set.add(prefix);
1193
+ for (const descriptor14 of BUILTIN_TARGETS) {
1194
+ for (const prefix of topLevelDotfilePrefixes(descriptor14)) set.add(prefix);
1181
1195
  }
1182
1196
  return Array.from(set);
1183
1197
  }
@@ -1248,7 +1262,7 @@ function resolveProjectPath(token, projectRoot, sourceFile) {
1248
1262
  }
1249
1263
  return [windowsToken];
1250
1264
  }
1251
- if (isAbsolute(token)) {
1265
+ if (api.isAbsolute(token)) {
1252
1266
  const absoluteToken = normalizeForProject(projectRoot, token);
1253
1267
  if (absoluteToken.startsWith(normalizedProjectRoot) || existsSync(token))
1254
1268
  return [absoluteToken];
@@ -1354,9 +1368,14 @@ var init_link_rebaser_helpers = __esm({
1354
1368
  LINE_NUMBER_SUFFIX = /(?::(\d+)){1,2}$/;
1355
1369
  }
1356
1370
  });
1371
+
1372
+ // src/core/reference/link-rebaser-formatting.ts
1357
1373
  function isReadingContext(context) {
1358
1374
  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";
1359
1375
  }
1376
+ function isReadingContextOptions(options) {
1377
+ return isReadingContext(options.tokenContext);
1378
+ }
1360
1379
  function isUnderProjectRoot(projectRoot, absolutePath) {
1361
1380
  const api = pathApi(projectRoot);
1362
1381
  const root = normalizeForProject(projectRoot, projectRoot);
@@ -1396,11 +1415,6 @@ function toProjectRootRelative(projectRoot, absolutePath, keepSlash) {
1396
1415
  const rewritten = relPath.length > 0 ? relPath : ".";
1397
1416
  return keepSlash && !rewritten.endsWith("/") ? `${rewritten}/` : rewritten;
1398
1417
  }
1399
- function shouldPreserveAgentsMeshAnchor(_projectRoot, _destinationFile, options) {
1400
- if (!isReadingContext(options.tokenContext)) return false;
1401
- if (options.originalToken === void 0) return false;
1402
- return normalizeSeparators(options.originalToken).startsWith(".agentsmesh/");
1403
- }
1404
1418
  function toProjectRootReference(projectRoot, absolutePath, keepSlash) {
1405
1419
  const formatted = toProjectRootRelative(projectRoot, absolutePath, keepSlash);
1406
1420
  if (formatted === null) return null;
@@ -1410,21 +1424,21 @@ function formatLinkPathForDestinationLegacy(projectRoot, destinationFile, absolu
1410
1424
  const api = pathApi(projectRoot);
1411
1425
  const root = normalizeForProject(projectRoot, projectRoot);
1412
1426
  const destFile = normalizeForProject(projectRoot, destinationFile);
1413
- const target13 = normalizeForProject(projectRoot, absoluteTargetPath);
1414
- if (!isUnderProjectRoot(projectRoot, target13)) {
1415
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
1427
+ const target14 = normalizeForProject(projectRoot, absoluteTargetPath);
1428
+ if (!isUnderProjectRoot(projectRoot, target14)) {
1429
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
1416
1430
  }
1417
- const destDir = normalizeForProject(projectRoot, dirname(destFile));
1431
+ const destDir = normalizeForProject(projectRoot, api.dirname(destFile));
1418
1432
  if (!isUnderProjectRoot(projectRoot, destDir) && destDir !== root) {
1419
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
1433
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
1420
1434
  }
1421
- let rel2 = api.relative(destDir, target13).replace(/\\/g, "/");
1435
+ let rel2 = api.relative(destDir, target14).replace(/\\/g, "/");
1422
1436
  if (api.isAbsolute(rel2) || WINDOWS_ABSOLUTE_PATH.test(rel2)) {
1423
- return toProjectRootRelative(projectRoot, target13, keepSlash);
1437
+ return toProjectRootRelative(projectRoot, target14, keepSlash);
1424
1438
  }
1425
1439
  const joined = normalizeForProject(projectRoot, api.join(destDir, rel2));
1426
1440
  if (!isUnderProjectRoot(projectRoot, joined)) {
1427
- return toProjectRootRelative(projectRoot, target13, keepSlash);
1441
+ return toProjectRootRelative(projectRoot, target14, keepSlash);
1428
1442
  }
1429
1443
  if (rel2 === "" || rel2 === ".") {
1430
1444
  rel2 = ".";
@@ -1443,9 +1457,14 @@ var init_link_rebaser_formatting = __esm({
1443
1457
  // src/core/reference/link-rebaser-output.ts
1444
1458
  function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTargetPath, keepSlash, options = {}) {
1445
1459
  const scope = options.scope ?? "project";
1446
- const target13 = normalizeForProject(projectRoot, absoluteTargetPath);
1447
- if (shouldPreserveAgentsMeshAnchor(projectRoot, destinationFile, options)) {
1448
- return normalizeSeparators(options.originalToken ?? "");
1460
+ const target14 = normalizeForProject(projectRoot, absoluteTargetPath);
1461
+ if (isReadingContextOptions(options) && isUnderAgentsMesh(projectRoot, destinationFile) && isUnderAgentsMesh(projectRoot, target14)) {
1462
+ const api = pathApi(projectRoot);
1463
+ const root = normalizeForProject(projectRoot, projectRoot);
1464
+ const rel2 = api.relative(root, target14).replace(/\\/g, "/");
1465
+ if (!rel2.startsWith("..") && rel2.length > 0) {
1466
+ return keepSlash && !rel2.endsWith("/") ? `${rel2}/` : rel2;
1467
+ }
1449
1468
  }
1450
1469
  if (options.forceRelative) {
1451
1470
  return formatLinkPathForDestinationLegacy(
@@ -1457,10 +1476,10 @@ function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTarg
1457
1476
  );
1458
1477
  }
1459
1478
  if (scope === "global" && !isUnderAgentsMesh(projectRoot, destinationFile)) {
1460
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
1479
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
1461
1480
  }
1462
1481
  const meshCanonicalForShape = (() => {
1463
- if (isUnderAgentsMesh(projectRoot, target13)) return target13;
1482
+ if (isUnderAgentsMesh(projectRoot, target14)) return target14;
1464
1483
  const logical = options.logicalMeshSourceAbsolute;
1465
1484
  if (logical && isUnderAgentsMesh(projectRoot, normalizeForProject(projectRoot, logical))) {
1466
1485
  return normalizeForProject(projectRoot, logical);
@@ -1468,9 +1487,9 @@ function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTarg
1468
1487
  return null;
1469
1488
  })();
1470
1489
  if (!meshCanonicalForShape) {
1471
- return toProjectRootReference(projectRoot, target13, keepSlash)?.text ?? null;
1490
+ return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
1472
1491
  }
1473
- const treatAsDirectory = keepSlash || (options.pathIsDirectory?.(target13) ?? false);
1492
+ const treatAsDirectory = keepSlash || (options.pathIsDirectory?.(target14) ?? false);
1474
1493
  if (treatAsDirectory) {
1475
1494
  const meshRelative = toAgentsMeshRootRelative(projectRoot, meshCanonicalForShape, keepSlash);
1476
1495
  if (meshRelative !== null) return meshRelative;
@@ -1494,7 +1513,7 @@ var init_link_rebaser_output = __esm({
1494
1513
  });
1495
1514
 
1496
1515
  // src/core/reference/link-rebaser-suffix-strip.ts
1497
- function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pathExists) {
1516
+ function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pathExists2) {
1498
1517
  const api = pathApi(projectRoot);
1499
1518
  const normalizedToken = normalizeSeparators(token);
1500
1519
  if (!isRootRelativePathToken(normalizedToken)) return null;
@@ -1506,7 +1525,7 @@ function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pa
1506
1525
  const suffix = segments.slice(i).join("/");
1507
1526
  const candidate = normalizeForProject(projectRoot, api.join(destDir, suffix));
1508
1527
  if (candidate === destFilePath) continue;
1509
- if (pathExists(candidate)) return candidate;
1528
+ if (pathExists2(candidate)) return candidate;
1510
1529
  }
1511
1530
  return null;
1512
1531
  }
@@ -1823,22 +1842,23 @@ var init_link_rebaser = __esm({
1823
1842
  init_link_token_context();
1824
1843
  }
1825
1844
  });
1826
- function pathVariants(path) {
1827
- const variants = [normalize(path)];
1845
+ function pathVariants(api, path) {
1846
+ const variants = [api.normalize(path)];
1828
1847
  if (!existsSync(path)) return variants;
1829
1848
  try {
1830
1849
  const realPaths = [realpathSync(path), realpathSync.native(path)];
1831
1850
  for (const realPath of realPaths) {
1832
- const normalized = normalize(realPath);
1851
+ const normalized = api.normalize(realPath);
1833
1852
  if (!variants.includes(normalized)) variants.push(normalized);
1834
1853
  }
1835
1854
  } catch {
1836
1855
  }
1837
1856
  return variants;
1838
1857
  }
1839
- async function createImportReferenceNormalizer(target13, projectRoot, scope = "project") {
1858
+ async function createImportReferenceNormalizer(target14, projectRoot, scope = "project") {
1859
+ const api = pathApi(projectRoot);
1840
1860
  const refs = /* @__PURE__ */ new Map();
1841
- const targets = Array.from(/* @__PURE__ */ new Set([target13, ...TARGET_IDS]));
1861
+ const targets = Array.from(/* @__PURE__ */ new Set([target14, ...TARGET_IDS]));
1842
1862
  for (const candidate of targets) {
1843
1863
  const candidateRefs = await buildImportReferenceMap(candidate, projectRoot, scope);
1844
1864
  for (const [targetPath, canonicalPath] of candidateRefs.entries()) {
@@ -1847,17 +1867,17 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
1847
1867
  }
1848
1868
  const artifactMap = /* @__PURE__ */ new Map();
1849
1869
  for (const [targetPath, canonicalPath] of refs.entries()) {
1850
- const canonicalAbsPath = normalize(join(projectRoot, canonicalPath));
1851
- for (const variant of pathVariants(join(projectRoot, targetPath))) {
1870
+ const canonicalAbsPath = api.normalize(api.join(projectRoot, canonicalPath));
1871
+ for (const variant of pathVariants(api, api.join(projectRoot, targetPath))) {
1852
1872
  artifactMap.set(variant, canonicalAbsPath);
1853
1873
  }
1854
1874
  }
1855
1875
  const canonicalDestAbs = /* @__PURE__ */ new Set();
1856
1876
  for (const canonicalPath of new Set(refs.values())) {
1857
- const abs = normalize(join(projectRoot, canonicalPath));
1877
+ const abs = api.normalize(api.join(projectRoot, canonicalPath));
1858
1878
  canonicalDestAbs.add(abs);
1859
- for (const variant of pathVariants(abs)) {
1860
- canonicalDestAbs.add(normalize(variant));
1879
+ for (const variant of pathVariants(api, abs)) {
1880
+ canonicalDestAbs.add(api.normalize(variant));
1861
1881
  }
1862
1882
  }
1863
1883
  return (content, sourceFile, destinationFile) => rewriteFileLinks({
@@ -1867,7 +1887,7 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
1867
1887
  destinationFile,
1868
1888
  translatePath: (absolutePath) => artifactMap.get(absolutePath) ?? absolutePath,
1869
1889
  pathExists: (absolutePath) => {
1870
- const normalized = normalize(absolutePath);
1890
+ const normalized = api.normalize(absolutePath);
1871
1891
  return artifactMap.has(absolutePath) || artifactMap.has(normalized) || existsSync(absolutePath) || canonicalDestAbs.has(normalized);
1872
1892
  },
1873
1893
  explicitCurrentDirLinks: false,
@@ -1884,11 +1904,43 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
1884
1904
  }
1885
1905
  var init_import_rewriter = __esm({
1886
1906
  "src/core/reference/import-rewriter.ts"() {
1907
+ init_path_helpers();
1887
1908
  init_import_map();
1888
1909
  init_link_rebaser();
1889
1910
  init_target_ids();
1890
1911
  }
1891
1912
  });
1913
+ async function writeMcpWithMerge(projectRoot, canonicalPath, imported) {
1914
+ const destPath = join(projectRoot, canonicalPath);
1915
+ const existing = await readExistingServers(destPath);
1916
+ const merged = { ...existing, ...imported };
1917
+ await mkdirp(dirname(destPath));
1918
+ await writeFileAtomic(destPath, JSON.stringify({ mcpServers: merged }, null, 2));
1919
+ }
1920
+ async function readExistingServers(path) {
1921
+ const content = await readFileSafe(path);
1922
+ if (content === null) return {};
1923
+ let parsed;
1924
+ try {
1925
+ parsed = JSON.parse(content);
1926
+ } catch {
1927
+ return {};
1928
+ }
1929
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
1930
+ const raw = parsed.mcpServers;
1931
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
1932
+ const out = {};
1933
+ for (const [name, value] of Object.entries(raw)) {
1934
+ if (!value || typeof value !== "object" || Array.isArray(value)) continue;
1935
+ out[name] = value;
1936
+ }
1937
+ return out;
1938
+ }
1939
+ var init_mcp_merge = __esm({
1940
+ "src/targets/import/mcp-merge.ts"() {
1941
+ init_fs();
1942
+ }
1943
+ });
1892
1944
 
1893
1945
  // src/targets/import/shared-import-helpers.ts
1894
1946
  function toGlobsArray(v) {
@@ -2134,18 +2186,24 @@ async function runDirectory(spec, sources, projectRoot, fromTool, normalize) {
2134
2186
  }
2135
2187
  return results;
2136
2188
  }
2189
+ function resolveCanonicalFilePath(spec) {
2190
+ const filename = spec.canonicalFilename;
2191
+ if (filename.includes("/") || filename.includes("\\")) return filename;
2192
+ return posix.join(spec.canonicalDir, filename);
2193
+ }
2137
2194
  async function runFlatFile(spec, sources, projectRoot, fromTool) {
2138
2195
  if (!spec.canonicalFilename) {
2139
2196
  throw new Error(`flatFile spec for ${spec.feature} must set canonicalFilename`);
2140
2197
  }
2198
+ const canonicalPath = resolveCanonicalFilePath(spec);
2141
2199
  for (const rel2 of sources) {
2142
2200
  const srcPath = join(projectRoot, rel2);
2143
2201
  const content = await readFileSafe(srcPath);
2144
2202
  if (content === null) continue;
2145
- const destPath = join(projectRoot, spec.canonicalFilename);
2203
+ const destPath = join(projectRoot, canonicalPath);
2146
2204
  await mkdirp(dirname(destPath));
2147
2205
  await writeFileAtomic(destPath, content.trimEnd());
2148
- return [{ fromTool, fromPath: srcPath, toPath: spec.canonicalFilename, feature: spec.feature }];
2206
+ return [{ fromTool, fromPath: srcPath, toPath: canonicalPath, feature: spec.feature }];
2149
2207
  }
2150
2208
  return [];
2151
2209
  }
@@ -2190,24 +2248,19 @@ async function runMcpJson(spec, sources, projectRoot, fromTool) {
2190
2248
  if (!spec.canonicalFilename) {
2191
2249
  throw new Error(`mcpJson spec for ${spec.feature} must set canonicalFilename`);
2192
2250
  }
2251
+ const canonicalPath = resolveCanonicalFilePath(spec);
2193
2252
  for (const rel2 of sources) {
2194
2253
  const srcPath = join(projectRoot, rel2);
2195
2254
  const content = await readFileSafe(srcPath);
2196
2255
  if (content === null) continue;
2197
- const servers = parseMcpJson(content);
2198
- if (Object.keys(servers).length === 0) return [];
2199
- const destPath = join(projectRoot, spec.canonicalFilename);
2200
- await mkdirp(dirname(destPath));
2201
- await writeFileAtomic(destPath, JSON.stringify({ mcpServers: servers }, null, 2));
2202
- return [{ fromTool, fromPath: srcPath, toPath: spec.canonicalFilename, feature: spec.feature }];
2256
+ const imported = parseMcpJson(content);
2257
+ if (Object.keys(imported).length === 0) return [];
2258
+ await writeMcpWithMerge(projectRoot, canonicalPath, imported);
2259
+ return [{ fromTool, fromPath: srcPath, toPath: canonicalPath, feature: spec.feature }];
2203
2260
  }
2204
2261
  return [];
2205
2262
  }
2206
- async function runSpec(spec, scope, projectRoot, fromTool, normalize) {
2207
- const primary = resolveScopedSources(spec.source, scope);
2208
- const fallback = resolveScopedSources(spec.fallbacks, scope);
2209
- const sources = primary.length > 0 ? primary : fallback;
2210
- if (sources.length === 0) return [];
2263
+ function dispatchSpec(spec, sources, projectRoot, fromTool, normalize) {
2211
2264
  switch (spec.mode) {
2212
2265
  case "singleFile":
2213
2266
  return runSingleFile(spec, sources, projectRoot, fromTool, normalize);
@@ -2219,20 +2272,33 @@ async function runSpec(spec, scope, projectRoot, fromTool, normalize) {
2219
2272
  return runMcpJson(spec, sources, projectRoot, fromTool);
2220
2273
  }
2221
2274
  }
2275
+ async function runSpec(spec, scope, projectRoot, fromTool, normalize) {
2276
+ const primary = resolveScopedSources(spec.source, scope);
2277
+ const fallback = resolveScopedSources(spec.fallbacks, scope);
2278
+ if (primary.length === 0 && fallback.length === 0) return [];
2279
+ if (primary.length > 0) {
2280
+ const results = await dispatchSpec(spec, primary, projectRoot, fromTool, normalize);
2281
+ if (results.length > 0) return results;
2282
+ }
2283
+ if (fallback.length > 0) {
2284
+ return dispatchSpec(spec, fallback, projectRoot, fromTool, normalize);
2285
+ }
2286
+ return [];
2287
+ }
2222
2288
  function specsForFeature(importer, feature) {
2223
2289
  const value = importer[feature];
2224
2290
  if (!value) return [];
2225
2291
  if (Array.isArray(value)) return value;
2226
2292
  return [value];
2227
2293
  }
2228
- async function runDescriptorImport(descriptor13, projectRoot, scope, options) {
2229
- const importer = descriptor13.importer;
2294
+ async function runDescriptorImport(descriptor14, projectRoot, scope, options) {
2295
+ const importer = descriptor14.importer;
2230
2296
  if (!importer) return [];
2231
- const normalize = options?.normalize ?? await createImportReferenceNormalizer(descriptor13.id, projectRoot, scope);
2297
+ const normalize = options?.normalize ?? await createImportReferenceNormalizer(descriptor14.id, projectRoot, scope);
2232
2298
  const results = [];
2233
2299
  for (const feature of IMPORT_FEATURE_ORDER) {
2234
2300
  for (const spec of specsForFeature(importer, feature)) {
2235
- results.push(...await runSpec(spec, scope, projectRoot, descriptor13.id, normalize));
2301
+ results.push(...await runSpec(spec, scope, projectRoot, descriptor14.id, normalize));
2236
2302
  }
2237
2303
  }
2238
2304
  return results;
@@ -2241,6 +2307,7 @@ var init_descriptor_import_runner = __esm({
2241
2307
  "src/targets/import/descriptor-import-runner.ts"() {
2242
2308
  init_import_rewriter();
2243
2309
  init_fs();
2310
+ init_mcp_merge();
2244
2311
  init_markdown();
2245
2312
  init_shared_import_helpers();
2246
2313
  init_import_metadata();
@@ -2696,22 +2763,22 @@ var init_projected_agent_skill = __esm({
2696
2763
  }
2697
2764
  });
2698
2765
  function rel(projectRoot, absPath) {
2699
- return relative(projectRoot, absPath).replace(/\\/g, "/");
2766
+ return pathApi(projectRoot).relative(projectRoot, absPath).replace(/\\/g, "/");
2700
2767
  }
2701
2768
  async function listFiles(projectRoot, dir) {
2702
- return readDirRecursive(join(projectRoot, dir)).catch(() => []);
2769
+ return readDirRecursive(pathApi(projectRoot).join(projectRoot, dir)).catch(() => []);
2703
2770
  }
2704
2771
  function addDirectoryMapping(refs, from, to) {
2705
2772
  refs.set(from, to);
2706
2773
  refs.set(`${from}/`, `${to}/`);
2707
2774
  }
2708
2775
  function addAncestorMappings(refs, fromPath, toPath, stopDir) {
2709
- let fromDir = dirname(fromPath);
2710
- let toDir = dirname(toPath);
2776
+ let fromDir = posix.dirname(fromPath);
2777
+ let toDir = posix.dirname(toPath);
2711
2778
  while (fromDir !== stopDir && fromDir !== ".") {
2712
2779
  addDirectoryMapping(refs, fromDir, toDir);
2713
- fromDir = dirname(fromDir);
2714
- toDir = dirname(toDir);
2780
+ fromDir = posix.dirname(fromDir);
2781
+ toDir = posix.dirname(toDir);
2715
2782
  }
2716
2783
  }
2717
2784
  function addSimpleFileMapping(refs, fromPath, canonicalDir, extension) {
@@ -2755,18 +2822,18 @@ async function targetRootSegments() {
2755
2822
  if (targetRootSegmentsCache !== void 0) return targetRootSegmentsCache;
2756
2823
  const { BUILTIN_TARGETS: BUILTIN_TARGETS2 } = await Promise.resolve().then(() => (init_builtin_targets(), builtin_targets_exports));
2757
2824
  const roots = /* @__PURE__ */ new Set();
2758
- for (const descriptor13 of BUILTIN_TARGETS2) {
2825
+ for (const descriptor14 of BUILTIN_TARGETS2) {
2759
2826
  for (const path of [
2760
- descriptor13.project.rootInstructionPath,
2761
- descriptor13.project.skillDir,
2762
- ...descriptor13.project.managedOutputs?.dirs ?? [],
2763
- ...descriptor13.project.managedOutputs?.files ?? [],
2764
- ...descriptor13.detectionPaths,
2765
- descriptor13.globalSupport?.layout.rootInstructionPath,
2766
- descriptor13.globalSupport?.layout.skillDir,
2767
- ...descriptor13.globalSupport?.layout.managedOutputs?.dirs ?? [],
2768
- ...descriptor13.globalSupport?.layout.managedOutputs?.files ?? [],
2769
- ...descriptor13.globalSupport?.detectionPaths ?? []
2827
+ descriptor14.project.rootInstructionPath,
2828
+ descriptor14.project.skillDir,
2829
+ ...descriptor14.project.managedOutputs?.dirs ?? [],
2830
+ ...descriptor14.project.managedOutputs?.files ?? [],
2831
+ ...descriptor14.detectionPaths,
2832
+ descriptor14.globalSupport?.layout.rootInstructionPath,
2833
+ descriptor14.globalSupport?.layout.skillDir,
2834
+ ...descriptor14.globalSupport?.layout.managedOutputs?.dirs ?? [],
2835
+ ...descriptor14.globalSupport?.layout.managedOutputs?.files ?? [],
2836
+ ...descriptor14.globalSupport?.detectionPaths ?? []
2770
2837
  ]) {
2771
2838
  if (path !== void 0) {
2772
2839
  const segment = firstPathSegment(path);
@@ -2783,8 +2850,9 @@ function hasHiddenSegment(relPath) {
2783
2850
  async function listScopedAgentsFiles(projectRoot) {
2784
2851
  const files = [];
2785
2852
  const targetRootSegmentsSet = await targetRootSegments();
2853
+ const api = pathApi(projectRoot);
2786
2854
  async function walk(relDir) {
2787
- const absDir = join(projectRoot, relDir);
2855
+ const absDir = api.join(projectRoot, relDir);
2788
2856
  const entries = await readdir(absDir, { withFileTypes: true }).catch(() => []);
2789
2857
  for (const entry of entries) {
2790
2858
  const relPath = relDir ? `${relDir}/${entry.name}` : entry.name;
@@ -2793,7 +2861,7 @@ async function listScopedAgentsFiles(projectRoot) {
2793
2861
  await walk(relPath);
2794
2862
  continue;
2795
2863
  }
2796
- if (entry.isSymbolicLink() && await stat(join(projectRoot, relPath)).then(
2864
+ if (entry.isSymbolicLink() && await stat(api.join(projectRoot, relPath)).then(
2797
2865
  (info) => info.isDirectory(),
2798
2866
  () => false
2799
2867
  )) {
@@ -2802,7 +2870,7 @@ async function listScopedAgentsFiles(projectRoot) {
2802
2870
  continue;
2803
2871
  }
2804
2872
  if (entry.name === "AGENTS.md" || entry.name === "AGENTS.override.md") {
2805
- files.push(join(projectRoot, relPath));
2873
+ files.push(api.join(projectRoot, relPath));
2806
2874
  }
2807
2875
  }
2808
2876
  }
@@ -2816,7 +2884,7 @@ async function addScopedAgentsMappings(refs, projectRoot) {
2816
2884
  const isNestedAgents = relPath.endsWith("/AGENTS.md") && relPath !== "AGENTS.md" && !relPath.endsWith("/AGENTS.override.md");
2817
2885
  const isNestedOverride = relPath.endsWith("/AGENTS.override.md") && relPath !== "AGENTS.override.md";
2818
2886
  if (!isNestedAgents && !isNestedOverride) continue;
2819
- const parentDir = dirname(relPath);
2887
+ const parentDir = posix.dirname(relPath);
2820
2888
  if (hasHiddenSegment(parentDir)) continue;
2821
2889
  const ruleName = parentDir.replace(/\//g, "-");
2822
2890
  refs.set(relPath, `${AB_RULES}/${ruleName}.md`);
@@ -2825,6 +2893,7 @@ async function addScopedAgentsMappings(refs, projectRoot) {
2825
2893
  var AB_RULES, AB_COMMANDS, AB_AGENTS, AB_SKILLS2, targetRootSegmentsCache;
2826
2894
  var init_import_map_shared = __esm({
2827
2895
  "src/core/reference/import-map-shared.ts"() {
2896
+ init_path_helpers();
2828
2897
  init_fs();
2829
2898
  init_command_skill();
2830
2899
  init_projected_agent_skill();
@@ -3279,9 +3348,100 @@ var init_junie = __esm({
3279
3348
  }
3280
3349
  });
3281
3350
 
3351
+ // src/targets/kilo-code/constants.ts
3352
+ 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;
3353
+ var init_constants8 = __esm({
3354
+ "src/targets/kilo-code/constants.ts"() {
3355
+ KILO_CODE_TARGET = "kilo-code";
3356
+ KILO_CODE_DIR = ".kilo";
3357
+ KILO_CODE_ROOT_RULE = "AGENTS.md";
3358
+ KILO_CODE_RULES_DIR = `${KILO_CODE_DIR}/rules`;
3359
+ KILO_CODE_COMMANDS_DIR = `${KILO_CODE_DIR}/commands`;
3360
+ KILO_CODE_AGENTS_DIR = `${KILO_CODE_DIR}/agents`;
3361
+ KILO_CODE_SKILLS_DIR = `${KILO_CODE_DIR}/skills`;
3362
+ KILO_CODE_MCP_FILE = `${KILO_CODE_DIR}/mcp.json`;
3363
+ KILO_CODE_IGNORE = ".kilocodeignore";
3364
+ KILO_CODE_LEGACY_DIR = ".kilocode";
3365
+ KILO_CODE_LEGACY_RULES_DIR = `${KILO_CODE_LEGACY_DIR}/rules`;
3366
+ KILO_CODE_LEGACY_WORKFLOWS_DIR = `${KILO_CODE_LEGACY_DIR}/workflows`;
3367
+ KILO_CODE_LEGACY_SKILLS_DIR = `${KILO_CODE_LEGACY_DIR}/skills`;
3368
+ KILO_CODE_LEGACY_MCP_FILE = `${KILO_CODE_LEGACY_DIR}/mcp.json`;
3369
+ KILO_CODE_LEGACY_MODES_FILE = ".kilocodemodes";
3370
+ KILO_CODE_GLOBAL_DIR = ".kilo";
3371
+ KILO_CODE_GLOBAL_AGENTS_MD = `${KILO_CODE_GLOBAL_DIR}/AGENTS.md`;
3372
+ KILO_CODE_GLOBAL_RULES_DIR = `${KILO_CODE_GLOBAL_DIR}/rules`;
3373
+ KILO_CODE_GLOBAL_COMMANDS_DIR = `${KILO_CODE_GLOBAL_DIR}/commands`;
3374
+ KILO_CODE_GLOBAL_AGENTS_DIR = `${KILO_CODE_GLOBAL_DIR}/agents`;
3375
+ KILO_CODE_GLOBAL_SKILLS_DIR = `${KILO_CODE_GLOBAL_DIR}/skills`;
3376
+ KILO_CODE_GLOBAL_MCP_FILE = `${KILO_CODE_GLOBAL_DIR}/mcp.json`;
3377
+ KILO_CODE_GLOBAL_IGNORE = ".kilocodeignore";
3378
+ KILO_CODE_GLOBAL_AGENTS_SKILLS_DIR = ".agents/skills";
3379
+ KILO_CODE_CANONICAL_RULES_DIR = ".agentsmesh/rules";
3380
+ KILO_CODE_CANONICAL_COMMANDS_DIR = ".agentsmesh/commands";
3381
+ KILO_CODE_CANONICAL_AGENTS_DIR = ".agentsmesh/agents";
3382
+ KILO_CODE_CANONICAL_MCP = ".agentsmesh/mcp.json";
3383
+ KILO_CODE_CANONICAL_IGNORE = ".agentsmesh/ignore";
3384
+ }
3385
+ });
3386
+ async function buildKiloCodeImportPaths(refs, projectRoot, scope = "project") {
3387
+ if (scope === "global") {
3388
+ refs.set(KILO_CODE_GLOBAL_AGENTS_MD, `${AB_RULES2}/_root.md`);
3389
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_RULES_DIR)) {
3390
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_RULES2, ".md");
3391
+ }
3392
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_COMMANDS_DIR)) {
3393
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS2, ".md");
3394
+ }
3395
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_AGENTS_DIR)) {
3396
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS2, ".md");
3397
+ }
3398
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_GLOBAL_SKILLS_DIR)) {
3399
+ addSkillLikeMapping(refs, rel(projectRoot, absPath), KILO_CODE_GLOBAL_SKILLS_DIR);
3400
+ }
3401
+ refs.set(KILO_CODE_GLOBAL_MCP_FILE, ".agentsmesh/mcp.json");
3402
+ return;
3403
+ }
3404
+ refs.set(KILO_CODE_ROOT_RULE, `${AB_RULES2}/_root.md`);
3405
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_RULES_DIR)) {
3406
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_RULES2, ".md");
3407
+ }
3408
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_COMMANDS_DIR)) {
3409
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS2, ".md");
3410
+ }
3411
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_AGENTS_DIR)) {
3412
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_AGENTS2, ".md");
3413
+ }
3414
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_SKILLS_DIR)) {
3415
+ addSkillLikeMapping(refs, rel(projectRoot, absPath), KILO_CODE_SKILLS_DIR);
3416
+ }
3417
+ refs.set(KILO_CODE_MCP_FILE, ".agentsmesh/mcp.json");
3418
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_LEGACY_RULES_DIR)) {
3419
+ const relPath = rel(projectRoot, absPath);
3420
+ if (basename(relPath) === "00-root.md") {
3421
+ refs.set(relPath, `${AB_RULES2}/_root.md`);
3422
+ continue;
3423
+ }
3424
+ addSimpleFileMapping(refs, relPath, AB_RULES2, ".md");
3425
+ }
3426
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_LEGACY_WORKFLOWS_DIR)) {
3427
+ addSimpleFileMapping(refs, rel(projectRoot, absPath), AB_COMMANDS2, ".md");
3428
+ }
3429
+ for (const absPath of await listFiles(projectRoot, KILO_CODE_LEGACY_SKILLS_DIR)) {
3430
+ addSkillLikeMapping(refs, rel(projectRoot, absPath), KILO_CODE_LEGACY_SKILLS_DIR);
3431
+ }
3432
+ refs.set(KILO_CODE_LEGACY_MCP_FILE, ".agentsmesh/mcp.json");
3433
+ }
3434
+ var init_kilo_code = __esm({
3435
+ "src/core/reference/import-maps/kilo-code.ts"() {
3436
+ init_import_map_shared();
3437
+ init_constants8();
3438
+ init_constants2();
3439
+ }
3440
+ });
3441
+
3282
3442
  // src/targets/kiro/constants.ts
3283
3443
  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;
3284
- var init_constants8 = __esm({
3444
+ var init_constants9 = __esm({
3285
3445
  "src/targets/kiro/constants.ts"() {
3286
3446
  KIRO_TARGET = "kiro";
3287
3447
  KIRO_AGENTS_MD = "AGENTS.md";
@@ -3340,14 +3500,14 @@ async function buildKiroImportPaths(refs, projectRoot, scope = "project") {
3340
3500
  var init_kiro = __esm({
3341
3501
  "src/core/reference/import-maps/kiro.ts"() {
3342
3502
  init_import_map_shared();
3343
- init_constants8();
3503
+ init_constants9();
3344
3504
  init_constants2();
3345
3505
  }
3346
3506
  });
3347
3507
 
3348
3508
  // src/targets/roo-code/constants.ts
3349
3509
  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;
3350
- var init_constants9 = __esm({
3510
+ var init_constants10 = __esm({
3351
3511
  "src/targets/roo-code/constants.ts"() {
3352
3512
  ROO_CODE_TARGET = "roo-code";
3353
3513
  ROO_CODE_DIR = ".roo";
@@ -3414,7 +3574,7 @@ async function buildRooCodeImportPaths(refs, projectRoot, scope = "project") {
3414
3574
  var init_roo_code = __esm({
3415
3575
  "src/core/reference/import-maps/roo-code.ts"() {
3416
3576
  init_import_map_shared();
3417
- init_constants9();
3577
+ init_constants10();
3418
3578
  init_constants2();
3419
3579
  }
3420
3580
  });
@@ -3453,6 +3613,7 @@ var init_import_maps = __esm({
3453
3613
  init_cursor();
3454
3614
  init_gemini_cli();
3455
3615
  init_junie();
3616
+ init_kilo_code();
3456
3617
  init_kiro();
3457
3618
  init_roo_code();
3458
3619
  init_windsurf();
@@ -3944,10 +4105,8 @@ async function importSettings(projectRoot, results) {
3944
4105
  }
3945
4106
  const alreadyImportedMcp = results.some((r) => r.feature === "mcp");
3946
4107
  if (!alreadyImportedMcp && settings.mcpServers && typeof settings.mcpServers === "object") {
3947
- const mcpContent = JSON.stringify({ mcpServers: settings.mcpServers }, null, 2);
3948
- const destPath = join(projectRoot, CLAUDE_CANONICAL_MCP);
3949
- await mkdirp(dirname(destPath));
3950
- await writeFileAtomic(destPath, mcpContent);
4108
+ const mcpServers = settings.mcpServers;
4109
+ await writeMcpWithMerge(projectRoot, CLAUDE_CANONICAL_MCP, mcpServers);
3951
4110
  results.push({
3952
4111
  fromTool: "claude-code",
3953
4112
  fromPath: settingsPath,
@@ -3995,6 +4154,7 @@ var init_settings_helpers = __esm({
3995
4154
  "src/targets/claude-code/settings-helpers.ts"() {
3996
4155
  init_hook_command();
3997
4156
  init_fs();
4157
+ init_mcp_merge();
3998
4158
  init_constants3();
3999
4159
  }
4000
4160
  });
@@ -4954,11 +5114,11 @@ var init_linter3 = __esm({
4954
5114
  });
4955
5115
 
4956
5116
  // src/core/lint/shared/helpers.ts
4957
- function createWarning(file, target13, message) {
5117
+ function createWarning(file, target14, message) {
4958
5118
  return {
4959
5119
  level: "warning",
4960
5120
  file,
4961
- target: target13,
5121
+ target: target14,
4962
5122
  message
4963
5123
  };
4964
5124
  }
@@ -4968,12 +5128,12 @@ function formatOxfordComma(items) {
4968
5128
  if (items.length === 2) return `${items[0]} and ${items[1]}`;
4969
5129
  return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
4970
5130
  }
4971
- function createUnsupportedHookWarning(event, target13, supportedEvents, options) {
4972
- const by = options?.unsupportedBy ?? target13;
5131
+ function createUnsupportedHookWarning(event, target14, supportedEvents, options) {
5132
+ const by = options?.unsupportedBy ?? target14;
4973
5133
  const supported = formatOxfordComma(supportedEvents);
4974
5134
  return createWarning(
4975
5135
  ".agentsmesh/hooks.yaml",
4976
- target13,
5136
+ target14,
4977
5137
  `${event} is not supported by ${by}; only ${supported} are projected.`
4978
5138
  );
4979
5139
  }
@@ -5157,7 +5317,7 @@ var init_cline2 = __esm({
5157
5317
 
5158
5318
  // src/targets/codex-cli/constants.ts
5159
5319
  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;
5160
- var init_constants10 = __esm({
5320
+ var init_constants11 = __esm({
5161
5321
  "src/targets/codex-cli/constants.ts"() {
5162
5322
  CODEX_TARGET = "codex-cli";
5163
5323
  CODEX_MD = "codex.md";
@@ -5220,7 +5380,7 @@ function summarizeRule(rule) {
5220
5380
  scopes.push(`Enforced in \`${CODEX_RULES_DIR}/${ruleSlug2(rule.source)}.rules\`.`);
5221
5381
  }
5222
5382
  if (rule.targets.length > 0) {
5223
- scopes.push(`Targeted to ${rule.targets.map((target13) => `\`${target13}\``).join(", ")}.`);
5383
+ scopes.push(`Targeted to ${rule.targets.map((target14) => `\`${target14}\``).join(", ")}.`);
5224
5384
  }
5225
5385
  return scopes.join(" ");
5226
5386
  }
@@ -5250,7 +5410,7 @@ function stripCodexRuleIndex(content) {
5250
5410
  var init_instruction_mirror = __esm({
5251
5411
  "src/targets/codex-cli/instruction-mirror.ts"() {
5252
5412
  init_markdown();
5253
- init_constants10();
5413
+ init_constants11();
5254
5414
  }
5255
5415
  });
5256
5416
  function looksLikeCodexRulesDsl(body) {
@@ -5316,7 +5476,7 @@ function renderCodexGlobalInstructions(canonical) {
5316
5476
  var init_rules = __esm({
5317
5477
  "src/targets/codex-cli/generator/rules.ts"() {
5318
5478
  init_managed_blocks();
5319
- init_constants10();
5479
+ init_constants11();
5320
5480
  init_instruction_mirror();
5321
5481
  }
5322
5482
  });
@@ -5357,7 +5517,7 @@ function generateCommands4(canonical) {
5357
5517
  var init_skills = __esm({
5358
5518
  "src/targets/codex-cli/generator/skills.ts"() {
5359
5519
  init_markdown();
5360
- init_constants10();
5520
+ init_constants11();
5361
5521
  init_command_skill();
5362
5522
  }
5363
5523
  });
@@ -5398,7 +5558,7 @@ ${body}
5398
5558
  }
5399
5559
  var init_agents = __esm({
5400
5560
  "src/targets/codex-cli/generator/agents.ts"() {
5401
- init_constants10();
5561
+ init_constants11();
5402
5562
  }
5403
5563
  });
5404
5564
 
@@ -5450,7 +5610,7 @@ function needsTomlQuoting(key) {
5450
5610
  var init_mcp = __esm({
5451
5611
  "src/targets/codex-cli/generator/mcp.ts"() {
5452
5612
  init_mcp_servers();
5453
- init_constants10();
5613
+ init_constants11();
5454
5614
  }
5455
5615
  });
5456
5616
 
@@ -5509,11 +5669,7 @@ async function importMcp(projectRoot, results) {
5509
5669
  if (server) mcpServers[name] = server;
5510
5670
  }
5511
5671
  if (Object.keys(mcpServers).length === 0) return;
5512
- await mkdirp(join(projectRoot, ".agentsmesh"));
5513
- await writeFileAtomic(
5514
- join(projectRoot, CODEX_CANONICAL_MCP),
5515
- JSON.stringify({ mcpServers }, null, 2)
5516
- );
5672
+ await writeMcpWithMerge(projectRoot, CODEX_CANONICAL_MCP, mcpServers);
5517
5673
  results.push({
5518
5674
  fromTool: CODEX_TARGET,
5519
5675
  fromPath: configPath,
@@ -5524,7 +5680,8 @@ async function importMcp(projectRoot, results) {
5524
5680
  var init_mcp_helpers = __esm({
5525
5681
  "src/targets/codex-cli/mcp-helpers.ts"() {
5526
5682
  init_fs();
5527
- init_constants10();
5683
+ init_mcp_merge();
5684
+ init_constants11();
5528
5685
  }
5529
5686
  });
5530
5687
  function shouldImportScopedAgentsRule(relDir) {
@@ -5618,7 +5775,7 @@ var init_skills_adapter2 = __esm({
5618
5775
  init_projected_agent_skill();
5619
5776
  init_scoped_agents_import();
5620
5777
  init_skill_import_pipeline();
5621
- init_constants10();
5778
+ init_constants11();
5622
5779
  }
5623
5780
  });
5624
5781
  async function importCodexAgentsFromToml(projectRoot, results, normalize) {
@@ -5671,7 +5828,7 @@ var init_importer_agents = __esm({
5671
5828
  "src/targets/codex-cli/importer-agents.ts"() {
5672
5829
  init_fs();
5673
5830
  init_projected_agent_skill();
5674
- init_constants10();
5831
+ init_constants11();
5675
5832
  }
5676
5833
  });
5677
5834
  function tryParseEmbeddedCanonicalFromCodexRules(content) {
@@ -5714,7 +5871,7 @@ function tryParseEmbeddedCanonicalFromCodexRules(content) {
5714
5871
  }
5715
5872
  var init_codex_rules_embed = __esm({
5716
5873
  "src/targets/codex-cli/codex-rules-embed.ts"() {
5717
- init_constants10();
5874
+ init_constants11();
5718
5875
  }
5719
5876
  });
5720
5877
  async function importCodexNonRootRuleFiles(projectRoot, destDir, normalize) {
@@ -5788,7 +5945,7 @@ var init_import_codex_non_root_rules = __esm({
5788
5945
  init_fs();
5789
5946
  init_markdown();
5790
5947
  init_import_metadata();
5791
- init_constants10();
5948
+ init_constants11();
5792
5949
  init_codex_rules_embed();
5793
5950
  }
5794
5951
  });
@@ -5910,7 +6067,7 @@ var init_importer_rules2 = __esm({
5910
6067
  init_embedded_rules();
5911
6068
  init_import_orchestrator();
5912
6069
  init_scoped_agents_import();
5913
- init_constants10();
6070
+ init_constants11();
5914
6071
  init_import_codex_non_root_rules();
5915
6072
  init_instruction_mirror();
5916
6073
  }
@@ -5935,7 +6092,7 @@ async function importFromCodex(projectRoot, options) {
5935
6092
  var init_importer4 = __esm({
5936
6093
  "src/targets/codex-cli/importer.ts"() {
5937
6094
  init_import_rewriter();
5938
- init_constants10();
6095
+ init_constants11();
5939
6096
  init_mcp_helpers();
5940
6097
  init_skills_adapter2();
5941
6098
  init_importer_agents();
@@ -5960,7 +6117,7 @@ function lintRules4(canonical, projectRoot, _projectFiles) {
5960
6117
  }
5961
6118
  var init_linter4 = __esm({
5962
6119
  "src/targets/codex-cli/linter.ts"() {
5963
- init_constants10();
6120
+ init_constants11();
5964
6121
  }
5965
6122
  });
5966
6123
 
@@ -6010,7 +6167,7 @@ var target4, project4, global3, globalCapabilities4, descriptor4;
6010
6167
  var init_codex_cli2 = __esm({
6011
6168
  "src/targets/codex-cli/index.ts"() {
6012
6169
  init_generator5();
6013
- init_constants10();
6170
+ init_constants11();
6014
6171
  init_importer4();
6015
6172
  init_linter4();
6016
6173
  init_lint2();
@@ -6274,10 +6431,7 @@ async function importMcp2(projectRoot, results) {
6274
6431
  importedFrom.push(srcPath);
6275
6432
  }
6276
6433
  if (Object.keys(merged).length === 0) return;
6277
- await writeFileAtomic(
6278
- join(projectRoot, CONTINUE_CANONICAL_MCP),
6279
- JSON.stringify({ mcpServers: merged }, null, 2)
6280
- );
6434
+ await writeMcpWithMerge(projectRoot, CONTINUE_CANONICAL_MCP, merged);
6281
6435
  for (const fromPath of importedFrom) {
6282
6436
  results.push({
6283
6437
  fromTool: CONTINUE_TARGET,
@@ -6301,6 +6455,7 @@ var init_importer5 = __esm({
6301
6455
  init_fs();
6302
6456
  init_embedded_skill();
6303
6457
  init_descriptor_import_runner();
6458
+ init_mcp_merge();
6304
6459
  init_shared_import_helpers();
6305
6460
  init_constants5();
6306
6461
  init_continue2();
@@ -6631,7 +6786,7 @@ var init_continue2 = __esm({
6631
6786
 
6632
6787
  // src/targets/copilot/constants.ts
6633
6788
  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;
6634
- var init_constants11 = __esm({
6789
+ var init_constants12 = __esm({
6635
6790
  "src/targets/copilot/constants.ts"() {
6636
6791
  COPILOT_TARGET = "copilot";
6637
6792
  COPILOT_INSTRUCTIONS = ".github/copilot-instructions.md";
@@ -6696,7 +6851,7 @@ function parseCommandPromptFrontmatter(frontmatter, promptPath) {
6696
6851
  var init_command_prompt = __esm({
6697
6852
  "src/targets/copilot/command-prompt.ts"() {
6698
6853
  init_markdown();
6699
- init_constants11();
6854
+ init_constants12();
6700
6855
  }
6701
6856
  });
6702
6857
 
@@ -6848,7 +7003,7 @@ function generateHooks3(canonical) {
6848
7003
  var init_generator7 = __esm({
6849
7004
  "src/targets/copilot/generator.ts"() {
6850
7005
  init_markdown();
6851
- init_constants11();
7006
+ init_constants12();
6852
7007
  init_command_prompt();
6853
7008
  init_hook_entry();
6854
7009
  }
@@ -6942,7 +7097,7 @@ async function importHooks(projectRoot, results) {
6942
7097
  var init_hook_parser = __esm({
6943
7098
  "src/targets/copilot/hook-parser.ts"() {
6944
7099
  init_fs();
6945
- init_constants11();
7100
+ init_constants12();
6946
7101
  }
6947
7102
  });
6948
7103
  async function importSkills2(projectRoot, results, normalize, skillsDirRel = COPILOT_SKILLS_DIR) {
@@ -6963,7 +7118,7 @@ async function importSkills2(projectRoot, results, normalize, skillsDirRel = COP
6963
7118
  var init_skills_adapter3 = __esm({
6964
7119
  "src/targets/copilot/skills-adapter.ts"() {
6965
7120
  init_skill_import_pipeline();
6966
- init_constants11();
7121
+ init_constants12();
6967
7122
  }
6968
7123
  });
6969
7124
 
@@ -6986,7 +7141,7 @@ var init_importer6 = __esm({
6986
7141
  "src/targets/copilot/importer.ts"() {
6987
7142
  init_import_rewriter();
6988
7143
  init_descriptor_import_runner();
6989
- init_constants11();
7144
+ init_constants12();
6990
7145
  init_hook_parser();
6991
7146
  init_skills_adapter3();
6992
7147
  init_copilot2();
@@ -7005,7 +7160,7 @@ var init_import_mappers4 = __esm({
7005
7160
  init_import_metadata();
7006
7161
  init_shared_import_helpers();
7007
7162
  init_command_prompt();
7008
- init_constants11();
7163
+ init_constants12();
7009
7164
  copilotLegacyRuleMapper = async ({
7010
7165
  relativePath,
7011
7166
  normalizeTo,
@@ -7122,7 +7277,7 @@ function lintRules6(canonical, projectRoot, projectFiles, options) {
7122
7277
  var init_linter6 = __esm({
7123
7278
  "src/targets/copilot/linter.ts"() {
7124
7279
  init_validate_rules();
7125
- init_constants11();
7280
+ init_constants12();
7126
7281
  }
7127
7282
  });
7128
7283
 
@@ -7239,7 +7394,7 @@ var SCRIPT_PREFIX_RE;
7239
7394
  var init_hook_assets = __esm({
7240
7395
  "src/targets/copilot/hook-assets.ts"() {
7241
7396
  init_fs();
7242
- init_constants11();
7397
+ init_constants12();
7243
7398
  init_hook_entry();
7244
7399
  SCRIPT_PREFIX_RE = /^(?<prefix>\s*(?:(?:bash|sh|zsh)\s+)?)["']?(?<path>(?:\.\.\/|\.\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?<suffix>(?:\s.*)?)$/;
7245
7400
  }
@@ -7253,7 +7408,7 @@ var generateCopilotGlobalExtras;
7253
7408
  var init_scope_extras2 = __esm({
7254
7409
  "src/targets/copilot/scope-extras.ts"() {
7255
7410
  init_fs();
7256
- init_constants11();
7411
+ init_constants12();
7257
7412
  generateCopilotGlobalExtras = async (canonical, projectRoot, scope, enabledFeatures) => {
7258
7413
  if (scope !== "global" || !enabledFeatures.has("rules")) return [];
7259
7414
  const root = canonical.rules.find((r) => r.root);
@@ -7276,7 +7431,7 @@ var target6, project6, global4, globalCapabilities6, descriptor6;
7276
7431
  var init_copilot2 = __esm({
7277
7432
  "src/targets/copilot/index.ts"() {
7278
7433
  init_generator7();
7279
- init_constants11();
7434
+ init_constants12();
7280
7435
  init_importer6();
7281
7436
  init_import_mappers4();
7282
7437
  init_linter6();
@@ -8045,8 +8200,8 @@ async function hasGlobalCursorArtifacts(projectRoot) {
8045
8200
  join(projectRoot, CURSOR_COMMANDS_DIR)
8046
8201
  ];
8047
8202
  for (const p of candidates) {
8048
- const stat6 = await readFileSafe(p);
8049
- if (stat6 !== null && stat6.trim() !== "") return true;
8203
+ const stat7 = await readFileSafe(p);
8204
+ if (stat7 !== null && stat7.trim() !== "") return true;
8050
8205
  }
8051
8206
  const skillFiles = await readDirRecursive(join(projectRoot, CURSOR_GLOBAL_SKILLS_DIR));
8052
8207
  if (skillFiles.some((f) => f.endsWith(".md"))) return true;
@@ -8204,9 +8359,8 @@ async function importMcp3(projectRoot, results) {
8204
8359
  return;
8205
8360
  }
8206
8361
  if (!parsed || typeof parsed !== "object" || !("mcpServers" in parsed)) return;
8207
- const destPath = join(projectRoot, CURSOR_CANONICAL_MCP);
8208
- await mkdirp(dirname(destPath));
8209
- await writeFileAtomic(destPath, content);
8362
+ const servers = parsed.mcpServers;
8363
+ await writeMcpWithMerge(projectRoot, CURSOR_CANONICAL_MCP, servers);
8210
8364
  results.push({
8211
8365
  fromTool: "cursor",
8212
8366
  fromPath: mcpPath,
@@ -8233,6 +8387,7 @@ var init_importer7 = __esm({
8233
8387
  init_import_rewriter();
8234
8388
  init_fs();
8235
8389
  init_descriptor_import_runner();
8390
+ init_mcp_merge();
8236
8391
  init_importer_rules3();
8237
8392
  init_settings_helpers2();
8238
8393
  init_skills_adapter4();
@@ -8534,7 +8689,7 @@ var init_cursor2 = __esm({
8534
8689
 
8535
8690
  // src/targets/gemini-cli/constants.ts
8536
8691
  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;
8537
- var init_constants12 = __esm({
8692
+ var init_constants13 = __esm({
8538
8693
  "src/targets/gemini-cli/constants.ts"() {
8539
8694
  GEMINI_TARGET = "gemini-cli";
8540
8695
  GEMINI_ROOT = "GEMINI.md";
@@ -8586,7 +8741,7 @@ function generateRules8(canonical) {
8586
8741
  var init_rules3 = __esm({
8587
8742
  "src/targets/gemini-cli/generator/rules.ts"() {
8588
8743
  init_managed_blocks();
8589
- init_constants12();
8744
+ init_constants13();
8590
8745
  }
8591
8746
  });
8592
8747
  function canonicalCommandNameToGeminiTomlPath(cmdName, commandsDir) {
@@ -8626,7 +8781,7 @@ function generateCommands8(canonical) {
8626
8781
  }
8627
8782
  var init_commands2 = __esm({
8628
8783
  "src/targets/gemini-cli/generator/commands.ts"() {
8629
- init_constants12();
8784
+ init_constants13();
8630
8785
  init_command_namespace();
8631
8786
  }
8632
8787
  });
@@ -8654,7 +8809,7 @@ function generateAgents6(canonical) {
8654
8809
  var init_agents3 = __esm({
8655
8810
  "src/targets/gemini-cli/generator/agents.ts"() {
8656
8811
  init_markdown();
8657
- init_constants12();
8812
+ init_constants13();
8658
8813
  }
8659
8814
  });
8660
8815
 
@@ -8685,7 +8840,7 @@ function generateSkills8(canonical) {
8685
8840
  var init_skills3 = __esm({
8686
8841
  "src/targets/gemini-cli/generator/skills.ts"() {
8687
8842
  init_markdown();
8688
- init_constants12();
8843
+ init_constants13();
8689
8844
  }
8690
8845
  });
8691
8846
 
@@ -8746,7 +8901,7 @@ function generateGeminiSettingsFiles(canonical) {
8746
8901
  var init_settings = __esm({
8747
8902
  "src/targets/gemini-cli/generator/settings.ts"() {
8748
8903
  init_hook_command();
8749
- init_constants12();
8904
+ init_constants13();
8750
8905
  }
8751
8906
  });
8752
8907
 
@@ -8757,7 +8912,7 @@ function generateIgnore4(canonical) {
8757
8912
  }
8758
8913
  var init_ignore2 = __esm({
8759
8914
  "src/targets/gemini-cli/generator/ignore.ts"() {
8760
- init_constants12();
8915
+ init_constants13();
8761
8916
  }
8762
8917
  });
8763
8918
 
@@ -8858,7 +9013,7 @@ function generateGeminiPermissionsPolicies(canonical) {
8858
9013
  }
8859
9014
  var init_policies_generator = __esm({
8860
9015
  "src/targets/gemini-cli/policies-generator.ts"() {
8861
- init_constants12();
9016
+ init_constants13();
8862
9017
  }
8863
9018
  });
8864
9019
  function mapGeminiHookEvent(event) {
@@ -8986,7 +9141,7 @@ var init_format_helpers_settings = __esm({
8986
9141
  "src/targets/gemini-cli/format-helpers-settings.ts"() {
8987
9142
  init_hook_command();
8988
9143
  init_fs();
8989
- init_constants12();
9144
+ init_constants13();
8990
9145
  init_format_helpers_shared();
8991
9146
  }
8992
9147
  });
@@ -9011,7 +9166,7 @@ async function importGeminiIgnore(projectRoot, results) {
9011
9166
  var init_format_helpers = __esm({
9012
9167
  "src/targets/gemini-cli/format-helpers.ts"() {
9013
9168
  init_fs();
9014
- init_constants12();
9169
+ init_constants13();
9015
9170
  init_format_helpers_shared();
9016
9171
  init_format_helpers_settings();
9017
9172
  }
@@ -9119,7 +9274,7 @@ async function importGeminiPolicies(projectRoot) {
9119
9274
  var init_policies_importer = __esm({
9120
9275
  "src/targets/gemini-cli/policies-importer.ts"() {
9121
9276
  init_fs();
9122
- init_constants12();
9277
+ init_constants13();
9123
9278
  }
9124
9279
  });
9125
9280
  function stripProjectRootCanonicalPrefix(content, projectRoot) {
@@ -9245,7 +9400,7 @@ var init_importer_skills_agents = __esm({
9245
9400
  init_markdown();
9246
9401
  init_import_metadata();
9247
9402
  init_projected_agent_skill();
9248
- init_constants12();
9403
+ init_constants13();
9249
9404
  }
9250
9405
  });
9251
9406
  async function importRootRule2(projectRoot, results, normalize) {
@@ -9321,7 +9476,7 @@ var init_importer8 = __esm({
9321
9476
  init_import_metadata();
9322
9477
  init_embedded_rules();
9323
9478
  init_descriptor_import_runner();
9324
- init_constants12();
9479
+ init_constants13();
9325
9480
  init_gemini_cli2();
9326
9481
  init_format_helpers();
9327
9482
  init_policies_importer();
@@ -9389,7 +9544,7 @@ var init_importer_mappers3 = __esm({
9389
9544
  init_import_metadata();
9390
9545
  init_shared_import_helpers();
9391
9546
  init_format_helpers();
9392
- init_constants12();
9547
+ init_constants13();
9393
9548
  }
9394
9549
  });
9395
9550
 
@@ -9413,7 +9568,7 @@ function lintRules8(canonical, projectRoot, projectFiles, options) {
9413
9568
  var init_linter8 = __esm({
9414
9569
  "src/targets/gemini-cli/linter.ts"() {
9415
9570
  init_validate_rules();
9416
- init_constants12();
9571
+ init_constants13();
9417
9572
  }
9418
9573
  });
9419
9574
 
@@ -9507,7 +9662,7 @@ var init_gemini_cli2 = __esm({
9507
9662
  init_generator11();
9508
9663
  init_capabilities();
9509
9664
  init_policies_generator();
9510
- init_constants12();
9665
+ init_constants13();
9511
9666
  init_importer8();
9512
9667
  init_import_mappers6();
9513
9668
  init_linter8();
@@ -10081,23 +10236,567 @@ var init_junie2 = __esm({
10081
10236
  };
10082
10237
  }
10083
10238
  });
10084
- function toKebab(value) {
10085
- return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
10239
+ function generateRules10(canonical) {
10240
+ const outputs = [];
10241
+ const root = canonical.rules.find((rule) => rule.root);
10242
+ if (root) {
10243
+ outputs.push({
10244
+ path: KILO_CODE_ROOT_RULE,
10245
+ content: root.body.trim() ? root.body : ""
10246
+ });
10247
+ }
10248
+ for (const rule of canonical.rules) {
10249
+ if (rule.root) continue;
10250
+ if (rule.targets.length > 0 && !rule.targets.includes(KILO_CODE_TARGET)) continue;
10251
+ const slug = basename(rule.source, ".md");
10252
+ const frontmatter = {};
10253
+ if (rule.description) frontmatter.description = rule.description;
10254
+ if (rule.globs.length > 0) frontmatter.globs = rule.globs;
10255
+ const content = Object.keys(frontmatter).length > 0 ? serializeFrontmatter(frontmatter, rule.body.trim() || "") : rule.body.trim() || "";
10256
+ outputs.push({
10257
+ path: `${KILO_CODE_RULES_DIR}/${slug}.md`,
10258
+ content
10259
+ });
10260
+ }
10261
+ return outputs;
10086
10262
  }
10087
- function hookText(entry) {
10088
- return entry.type === "prompt" ? entry.prompt : entry.command;
10263
+ function generateCommands10(canonical) {
10264
+ return canonical.commands.map((command) => {
10265
+ const frontmatter = {};
10266
+ if (command.description) frontmatter.description = command.description;
10267
+ return {
10268
+ path: `${KILO_CODE_COMMANDS_DIR}/${command.name}.md`,
10269
+ content: serializeFrontmatter(frontmatter, command.body.trim() || "")
10270
+ };
10271
+ });
10089
10272
  }
10090
- function toWhen(event, matcher) {
10091
- const type = CANONICAL_TO_KIRO[event];
10092
- if (event === "PreToolUse" || event === "PostToolUse") {
10093
- return { type, tools: [matcher || "*"] };
10094
- }
10095
- return { type };
10273
+ function generateAgents8(canonical) {
10274
+ return canonical.agents.map((agent) => {
10275
+ const slug = basename(agent.source, ".md");
10276
+ const frontmatter = { mode: "subagent" };
10277
+ if (agent.description) frontmatter.description = agent.description;
10278
+ if (agent.model) frontmatter.model = agent.model;
10279
+ if (agent.tools.length > 0) frontmatter.tools = agent.tools;
10280
+ if (agent.disallowedTools.length > 0) frontmatter.disallowedTools = agent.disallowedTools;
10281
+ return {
10282
+ path: `${KILO_CODE_AGENTS_DIR}/${slug}.md`,
10283
+ content: serializeFrontmatter(frontmatter, agent.body.trim() || "")
10284
+ };
10285
+ });
10096
10286
  }
10097
- function generateKiroHooks(hooks) {
10098
- const outputs = [];
10099
- for (const [event, entries] of Object.entries(hooks)) {
10100
- const mappedEvent = event;
10287
+ function generateMcp8(canonical) {
10288
+ if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
10289
+ return [
10290
+ {
10291
+ path: KILO_CODE_MCP_FILE,
10292
+ content: JSON.stringify({ mcpServers: canonical.mcp.mcpServers }, null, 2)
10293
+ }
10294
+ ];
10295
+ }
10296
+ function generateIgnore6(canonical) {
10297
+ if (canonical.ignore.length === 0) return [];
10298
+ return [{ path: KILO_CODE_IGNORE, content: canonical.ignore.join("\n") }];
10299
+ }
10300
+ function generateSkills10(canonical) {
10301
+ return generateEmbeddedSkills(canonical, KILO_CODE_SKILLS_DIR);
10302
+ }
10303
+ var init_generator13 = __esm({
10304
+ "src/targets/kilo-code/generator.ts"() {
10305
+ init_embedded_skill();
10306
+ init_markdown();
10307
+ init_constants8();
10308
+ }
10309
+ });
10310
+ var kiloNonRootRuleMapper, kiloCommandMapper, kiloAgentMapper;
10311
+ var init_import_mappers7 = __esm({
10312
+ "src/targets/kilo-code/import-mappers.ts"() {
10313
+ init_markdown();
10314
+ init_import_metadata();
10315
+ init_constants8();
10316
+ kiloNonRootRuleMapper = async ({
10317
+ relativePath,
10318
+ normalizeTo,
10319
+ destDir
10320
+ }) => {
10321
+ const destPath = join(destDir, relativePath);
10322
+ const { frontmatter, body } = parseFrontmatter(normalizeTo(destPath));
10323
+ return {
10324
+ destPath,
10325
+ toPath: `${KILO_CODE_CANONICAL_RULES_DIR}/${relativePath}`,
10326
+ content: await serializeImportedRuleWithFallback(
10327
+ destPath,
10328
+ {
10329
+ root: false,
10330
+ description: typeof frontmatter.description === "string" ? frontmatter.description : void 0,
10331
+ globs: Array.isArray(frontmatter.globs) ? frontmatter.globs : void 0
10332
+ },
10333
+ body
10334
+ )
10335
+ };
10336
+ };
10337
+ kiloCommandMapper = async ({
10338
+ relativePath,
10339
+ normalizeTo,
10340
+ destDir
10341
+ }) => {
10342
+ const destPath = join(destDir, relativePath);
10343
+ const { frontmatter, body } = parseFrontmatter(normalizeTo(destPath));
10344
+ return {
10345
+ destPath,
10346
+ toPath: `${KILO_CODE_CANONICAL_COMMANDS_DIR}/${relativePath}`,
10347
+ content: await serializeImportedCommandWithFallback(
10348
+ destPath,
10349
+ {
10350
+ hasDescription: Object.prototype.hasOwnProperty.call(frontmatter, "description"),
10351
+ description: typeof frontmatter.description === "string" ? frontmatter.description : void 0,
10352
+ hasAllowedTools: false,
10353
+ allowedTools: []
10354
+ },
10355
+ body
10356
+ )
10357
+ };
10358
+ };
10359
+ kiloAgentMapper = async ({
10360
+ relativePath,
10361
+ normalizeTo,
10362
+ destDir
10363
+ }) => {
10364
+ const destPath = join(destDir, relativePath);
10365
+ const { frontmatter, body } = parseFrontmatter(normalizeTo(destPath));
10366
+ return {
10367
+ destPath,
10368
+ toPath: `${KILO_CODE_CANONICAL_AGENTS_DIR}/${relativePath}`,
10369
+ content: await serializeImportedAgentWithFallback(destPath, frontmatter, body)
10370
+ };
10371
+ };
10372
+ }
10373
+ });
10374
+ async function pathExists(absolutePath) {
10375
+ try {
10376
+ await stat(absolutePath);
10377
+ return true;
10378
+ } catch {
10379
+ return false;
10380
+ }
10381
+ }
10382
+ async function importLegacyRules(projectRoot, results, normalize) {
10383
+ const srcDir = join(projectRoot, KILO_CODE_LEGACY_RULES_DIR);
10384
+ if (!await pathExists(srcDir)) return;
10385
+ const destDir = join(projectRoot, KILO_CODE_CANONICAL_RULES_DIR);
10386
+ const rootSourceFile = join(srcDir, LEGACY_ROOT_RULE_FILE);
10387
+ const hasCurrentRoot = results.some((result) => result.toPath === CANONICAL_ROOT_RULE_PATH);
10388
+ const rootContent = hasCurrentRoot ? null : await readFileSafe(rootSourceFile);
10389
+ if (rootContent !== null) {
10390
+ const destPath = join(projectRoot, CANONICAL_ROOT_RULE_PATH);
10391
+ const normalized = normalize(rootContent, rootSourceFile, destPath);
10392
+ const { body } = parseFrontmatter(normalized);
10393
+ const serialized = await serializeImportedRuleWithFallback(destPath, { root: true }, body);
10394
+ await writeFileAtomic(destPath, serialized);
10395
+ results.push({
10396
+ feature: "rules",
10397
+ fromTool: KILO_CODE_TARGET,
10398
+ fromPath: `${KILO_CODE_LEGACY_RULES_DIR}/${LEGACY_ROOT_RULE_FILE}`,
10399
+ toPath: CANONICAL_ROOT_RULE_PATH
10400
+ });
10401
+ }
10402
+ results.push(
10403
+ ...await importFileDirectory({
10404
+ srcDir,
10405
+ destDir,
10406
+ extensions: [".md"],
10407
+ fromTool: KILO_CODE_TARGET,
10408
+ normalize,
10409
+ mapEntry: async ({ srcPath, relativePath, content, normalizeTo }) => {
10410
+ const mapping = await kiloNonRootRuleMapper({
10411
+ absolutePath: srcPath,
10412
+ relativePath,
10413
+ content,
10414
+ destDir,
10415
+ normalizeTo
10416
+ });
10417
+ if (relativePath === LEGACY_ROOT_RULE_FILE) return null;
10418
+ if (!mapping) return null;
10419
+ return { ...mapping, feature: "rules" };
10420
+ }
10421
+ })
10422
+ );
10423
+ }
10424
+ async function importLegacyWorkflows(projectRoot, results, normalize) {
10425
+ const srcDir = join(projectRoot, KILO_CODE_LEGACY_WORKFLOWS_DIR);
10426
+ if (!await pathExists(srcDir)) return;
10427
+ const destDir = join(projectRoot, KILO_CODE_CANONICAL_COMMANDS_DIR);
10428
+ results.push(
10429
+ ...await importFileDirectory({
10430
+ srcDir,
10431
+ destDir,
10432
+ extensions: [".md"],
10433
+ fromTool: KILO_CODE_TARGET,
10434
+ normalize,
10435
+ mapEntry: async ({ srcPath, relativePath, content, normalizeTo }) => {
10436
+ const mapping = await kiloCommandMapper({
10437
+ absolutePath: srcPath,
10438
+ relativePath,
10439
+ content,
10440
+ destDir,
10441
+ normalizeTo
10442
+ });
10443
+ if (!mapping) return null;
10444
+ return { ...mapping, feature: "commands" };
10445
+ }
10446
+ })
10447
+ );
10448
+ }
10449
+ async function importLegacyModes(projectRoot, results, normalize) {
10450
+ const sourceFile = join(projectRoot, KILO_CODE_LEGACY_MODES_FILE);
10451
+ const content = await readFileSafe(sourceFile);
10452
+ if (content === null) return;
10453
+ let parsed;
10454
+ try {
10455
+ parsed = parse(content);
10456
+ } catch {
10457
+ return;
10458
+ }
10459
+ if (!parsed || !Array.isArray(parsed.customModes)) return;
10460
+ for (const raw of parsed.customModes) {
10461
+ if (!raw || typeof raw !== "object") continue;
10462
+ const mode = raw;
10463
+ if (typeof mode.slug !== "string" || mode.slug.length === 0) continue;
10464
+ const slug = mode.slug;
10465
+ const destPath = join(projectRoot, KILO_CODE_CANONICAL_AGENTS_DIR, `${slug}.md`);
10466
+ const description = typeof mode.description === "string" ? mode.description : "";
10467
+ const role = typeof mode.roleDefinition === "string" ? mode.roleDefinition.trim() : "";
10468
+ const whenToUse = typeof mode.whenToUse === "string" ? mode.whenToUse.trim() : "";
10469
+ const body = whenToUse ? `${role}
10470
+
10471
+ ## When to use
10472
+
10473
+ ${whenToUse}` : role;
10474
+ const frontmatter = {};
10475
+ if (description) frontmatter.description = description;
10476
+ if (typeof mode.name === "string" && mode.name.length > 0) frontmatter.name = mode.name;
10477
+ const serialized = await serializeImportedAgentWithFallback(destPath, frontmatter, body);
10478
+ const normalized = normalize(serialized, sourceFile, destPath);
10479
+ await writeFileAtomic(destPath, normalized);
10480
+ results.push({
10481
+ feature: "agents",
10482
+ fromTool: KILO_CODE_TARGET,
10483
+ fromPath: sourceFile,
10484
+ toPath: `${KILO_CODE_CANONICAL_AGENTS_DIR}/${slug}.md`
10485
+ });
10486
+ }
10487
+ }
10488
+ async function importFromKiloCode(projectRoot, options = {}) {
10489
+ const scope = options.scope ?? "project";
10490
+ const results = [];
10491
+ const normalize = await createImportReferenceNormalizer(KILO_CODE_TARGET, projectRoot, scope);
10492
+ results.push(...await runDescriptorImport(descriptor10, projectRoot, scope, { normalize }));
10493
+ await importEmbeddedSkills(
10494
+ projectRoot,
10495
+ KILO_CODE_SKILLS_DIR,
10496
+ KILO_CODE_TARGET,
10497
+ results,
10498
+ normalize
10499
+ );
10500
+ if (scope === "project") {
10501
+ await importLegacyRules(projectRoot, results, normalize);
10502
+ await importLegacyWorkflows(projectRoot, results, normalize);
10503
+ await importLegacyModes(projectRoot, results, normalize);
10504
+ await importEmbeddedSkills(
10505
+ projectRoot,
10506
+ KILO_CODE_LEGACY_SKILLS_DIR,
10507
+ KILO_CODE_TARGET,
10508
+ results,
10509
+ normalize
10510
+ );
10511
+ }
10512
+ return results;
10513
+ }
10514
+ var CANONICAL_ROOT_RULE_PATH, LEGACY_ROOT_RULE_FILE;
10515
+ var init_importer10 = __esm({
10516
+ "src/targets/kilo-code/importer.ts"() {
10517
+ init_import_rewriter();
10518
+ init_embedded_skill();
10519
+ init_import_orchestrator();
10520
+ init_descriptor_import_runner();
10521
+ init_fs();
10522
+ init_import_metadata();
10523
+ init_markdown();
10524
+ init_import_mappers7();
10525
+ init_constants8();
10526
+ init_kilo_code2();
10527
+ CANONICAL_ROOT_RULE_PATH = `${KILO_CODE_CANONICAL_RULES_DIR}/_root.md`;
10528
+ LEGACY_ROOT_RULE_FILE = "00-root.md";
10529
+ }
10530
+ });
10531
+
10532
+ // src/targets/kilo-code/linter.ts
10533
+ function lintRules10(canonical, projectRoot, projectFiles, options) {
10534
+ return validateRules(canonical, projectRoot, projectFiles, {
10535
+ checkGlobMatches: options?.scope !== "global"
10536
+ }).map((diagnostic) => ({
10537
+ ...diagnostic,
10538
+ target: KILO_CODE_TARGET
10539
+ }));
10540
+ }
10541
+ var init_linter10 = __esm({
10542
+ "src/targets/kilo-code/linter.ts"() {
10543
+ init_validate_rules();
10544
+ init_constants8();
10545
+ }
10546
+ });
10547
+
10548
+ // src/targets/kilo-code/lint.ts
10549
+ function lintHooks4(canonical) {
10550
+ if (!canonical.hooks) return [];
10551
+ const hasEntries = Object.values(canonical.hooks).some(
10552
+ (entries) => Array.isArray(entries) && entries.length > 0
10553
+ );
10554
+ if (!hasEntries) return [];
10555
+ return [
10556
+ createWarning(
10557
+ ".agentsmesh/hooks.yaml",
10558
+ "kilo-code",
10559
+ "kilo-code does not support user-defined lifecycle hooks; canonical hooks are not projected."
10560
+ )
10561
+ ];
10562
+ }
10563
+ function lintPermissions2(canonical) {
10564
+ if (!canonical.permissions) return [];
10565
+ const { allow, deny } = canonical.permissions;
10566
+ const ask = canonical.permissions.ask ?? [];
10567
+ if (allow.length === 0 && deny.length === 0 && ask.length === 0) return [];
10568
+ return [
10569
+ createWarning(
10570
+ ".agentsmesh/permissions.yaml",
10571
+ "kilo-code",
10572
+ "kilo-code permissions live in kilo.jsonc, which agentsmesh does not generate in v1; canonical permissions are not projected."
10573
+ )
10574
+ ];
10575
+ }
10576
+ var init_lint8 = __esm({
10577
+ "src/targets/kilo-code/lint.ts"() {
10578
+ init_helpers();
10579
+ }
10580
+ });
10581
+
10582
+ // src/targets/kilo-code/index.ts
10583
+ var target10, project10, globalLayout3, capabilities, descriptor10;
10584
+ var init_kilo_code2 = __esm({
10585
+ "src/targets/kilo-code/index.ts"() {
10586
+ init_generator13();
10587
+ init_constants8();
10588
+ init_skill_mirror();
10589
+ init_importer10();
10590
+ init_import_mappers7();
10591
+ init_linter10();
10592
+ init_lint8();
10593
+ init_import_map_builders();
10594
+ target10 = {
10595
+ name: KILO_CODE_TARGET,
10596
+ primaryRootInstructionPath: KILO_CODE_ROOT_RULE,
10597
+ generateRules: generateRules10,
10598
+ generateCommands: generateCommands10,
10599
+ generateAgents: generateAgents8,
10600
+ generateSkills: generateSkills10,
10601
+ generateMcp: generateMcp8,
10602
+ generateIgnore: generateIgnore6,
10603
+ importFrom: importFromKiloCode
10604
+ };
10605
+ project10 = {
10606
+ rootInstructionPath: KILO_CODE_ROOT_RULE,
10607
+ skillDir: KILO_CODE_SKILLS_DIR,
10608
+ managedOutputs: {
10609
+ dirs: [KILO_CODE_RULES_DIR, KILO_CODE_COMMANDS_DIR, KILO_CODE_AGENTS_DIR, KILO_CODE_SKILLS_DIR],
10610
+ files: [KILO_CODE_ROOT_RULE, KILO_CODE_MCP_FILE, KILO_CODE_IGNORE]
10611
+ },
10612
+ paths: {
10613
+ rulePath(slug, _rule) {
10614
+ return `${KILO_CODE_RULES_DIR}/${slug}.md`;
10615
+ },
10616
+ commandPath(name, _config) {
10617
+ return `${KILO_CODE_COMMANDS_DIR}/${name}.md`;
10618
+ },
10619
+ agentPath(name, _config) {
10620
+ return `${KILO_CODE_AGENTS_DIR}/${name}.md`;
10621
+ }
10622
+ }
10623
+ };
10624
+ globalLayout3 = {
10625
+ rootInstructionPath: KILO_CODE_GLOBAL_AGENTS_MD,
10626
+ skillDir: KILO_CODE_GLOBAL_SKILLS_DIR,
10627
+ managedOutputs: {
10628
+ dirs: [
10629
+ KILO_CODE_GLOBAL_RULES_DIR,
10630
+ KILO_CODE_GLOBAL_COMMANDS_DIR,
10631
+ KILO_CODE_GLOBAL_AGENTS_DIR,
10632
+ KILO_CODE_GLOBAL_SKILLS_DIR,
10633
+ KILO_CODE_GLOBAL_AGENTS_SKILLS_DIR
10634
+ ],
10635
+ files: [KILO_CODE_GLOBAL_AGENTS_MD, KILO_CODE_GLOBAL_MCP_FILE, KILO_CODE_GLOBAL_IGNORE]
10636
+ },
10637
+ rewriteGeneratedPath(path) {
10638
+ if (path === KILO_CODE_ROOT_RULE) return KILO_CODE_GLOBAL_AGENTS_MD;
10639
+ return path;
10640
+ },
10641
+ mirrorGlobalPath(path, activeTargets) {
10642
+ return mirrorSkillsToAgents(path, KILO_CODE_GLOBAL_SKILLS_DIR, activeTargets);
10643
+ },
10644
+ paths: {
10645
+ rulePath(slug, _rule) {
10646
+ return `${KILO_CODE_GLOBAL_RULES_DIR}/${slug}.md`;
10647
+ },
10648
+ commandPath(name, _config) {
10649
+ return `${KILO_CODE_GLOBAL_COMMANDS_DIR}/${name}.md`;
10650
+ },
10651
+ agentPath(name, _config) {
10652
+ return `${KILO_CODE_GLOBAL_AGENTS_DIR}/${name}.md`;
10653
+ }
10654
+ }
10655
+ };
10656
+ capabilities = {
10657
+ rules: "native",
10658
+ additionalRules: "native",
10659
+ commands: "native",
10660
+ agents: "native",
10661
+ skills: "native",
10662
+ mcp: "native",
10663
+ hooks: "none",
10664
+ ignore: "native",
10665
+ permissions: "none"
10666
+ };
10667
+ descriptor10 = {
10668
+ id: KILO_CODE_TARGET,
10669
+ generators: target10,
10670
+ capabilities,
10671
+ emptyImportMessage: "No Kilo Code config found (AGENTS.md, .kilo/rules, .kilo/commands, .kilo/agents, .kilo/skills, .kilo/mcp.json, .kilocodeignore, .kilocode/, or .kilocodemodes).",
10672
+ lintRules: lintRules10,
10673
+ lint: {
10674
+ hooks: lintHooks4,
10675
+ permissions: lintPermissions2
10676
+ },
10677
+ project: project10,
10678
+ globalSupport: {
10679
+ capabilities,
10680
+ detectionPaths: [
10681
+ KILO_CODE_GLOBAL_AGENTS_MD,
10682
+ KILO_CODE_GLOBAL_RULES_DIR,
10683
+ KILO_CODE_GLOBAL_COMMANDS_DIR,
10684
+ KILO_CODE_GLOBAL_AGENTS_DIR,
10685
+ KILO_CODE_GLOBAL_SKILLS_DIR,
10686
+ KILO_CODE_GLOBAL_MCP_FILE,
10687
+ KILO_CODE_GLOBAL_IGNORE
10688
+ ],
10689
+ layout: globalLayout3
10690
+ },
10691
+ importer: {
10692
+ rules: [
10693
+ {
10694
+ // Root rule: prefer AGENTS.md (new) → in legacy projects users
10695
+ // historically used .kilocode/rules/00-root.md, but those import
10696
+ // through the descriptor's directory mapper as a regular rule with
10697
+ // slug `00-root` (we don't promote them to root). The legacy global
10698
+ // rules dir falls back to AGENTS.md only.
10699
+ feature: "rules",
10700
+ mode: "singleFile",
10701
+ source: {
10702
+ project: [KILO_CODE_ROOT_RULE],
10703
+ global: [KILO_CODE_GLOBAL_AGENTS_MD]
10704
+ },
10705
+ canonicalDir: KILO_CODE_CANONICAL_RULES_DIR,
10706
+ canonicalRootFilename: "_root.md",
10707
+ markAsRoot: true
10708
+ },
10709
+ {
10710
+ feature: "rules",
10711
+ mode: "directory",
10712
+ source: {
10713
+ project: [KILO_CODE_RULES_DIR],
10714
+ global: [KILO_CODE_GLOBAL_RULES_DIR]
10715
+ },
10716
+ canonicalDir: KILO_CODE_CANONICAL_RULES_DIR,
10717
+ extensions: [".md"],
10718
+ map: kiloNonRootRuleMapper
10719
+ }
10720
+ ],
10721
+ commands: {
10722
+ feature: "commands",
10723
+ mode: "directory",
10724
+ source: {
10725
+ project: [KILO_CODE_COMMANDS_DIR],
10726
+ global: [KILO_CODE_GLOBAL_COMMANDS_DIR]
10727
+ },
10728
+ canonicalDir: KILO_CODE_CANONICAL_COMMANDS_DIR,
10729
+ extensions: [".md"],
10730
+ map: kiloCommandMapper
10731
+ },
10732
+ agents: {
10733
+ feature: "agents",
10734
+ mode: "directory",
10735
+ source: {
10736
+ project: [KILO_CODE_AGENTS_DIR],
10737
+ global: [KILO_CODE_GLOBAL_AGENTS_DIR]
10738
+ },
10739
+ canonicalDir: KILO_CODE_CANONICAL_AGENTS_DIR,
10740
+ extensions: [".md"],
10741
+ map: kiloAgentMapper
10742
+ },
10743
+ mcp: {
10744
+ feature: "mcp",
10745
+ mode: "mcpJson",
10746
+ source: {
10747
+ project: [KILO_CODE_MCP_FILE, KILO_CODE_LEGACY_MCP_FILE],
10748
+ global: [KILO_CODE_GLOBAL_MCP_FILE]
10749
+ },
10750
+ canonicalDir: ".agentsmesh",
10751
+ canonicalFilename: KILO_CODE_CANONICAL_MCP
10752
+ },
10753
+ ignore: {
10754
+ feature: "ignore",
10755
+ mode: "flatFile",
10756
+ source: {
10757
+ project: [KILO_CODE_IGNORE],
10758
+ global: [KILO_CODE_GLOBAL_IGNORE]
10759
+ },
10760
+ canonicalDir: ".agentsmesh",
10761
+ canonicalFilename: KILO_CODE_CANONICAL_IGNORE
10762
+ }
10763
+ },
10764
+ buildImportPaths: buildKiloCodeImportPaths,
10765
+ detectionPaths: [
10766
+ KILO_CODE_RULES_DIR,
10767
+ KILO_CODE_COMMANDS_DIR,
10768
+ KILO_CODE_AGENTS_DIR,
10769
+ KILO_CODE_SKILLS_DIR,
10770
+ KILO_CODE_MCP_FILE,
10771
+ KILO_CODE_LEGACY_RULES_DIR,
10772
+ KILO_CODE_LEGACY_WORKFLOWS_DIR,
10773
+ KILO_CODE_LEGACY_SKILLS_DIR,
10774
+ KILO_CODE_LEGACY_MCP_FILE,
10775
+ KILO_CODE_LEGACY_MODES_FILE,
10776
+ KILO_CODE_IGNORE,
10777
+ "kilo.jsonc",
10778
+ "kilo.json"
10779
+ ]
10780
+ };
10781
+ }
10782
+ });
10783
+ function toKebab(value) {
10784
+ return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
10785
+ }
10786
+ function hookText(entry) {
10787
+ return entry.type === "prompt" ? entry.prompt : entry.command;
10788
+ }
10789
+ function toWhen(event, matcher) {
10790
+ const type = CANONICAL_TO_KIRO[event];
10791
+ if (event === "PreToolUse" || event === "PostToolUse") {
10792
+ return { type, tools: [matcher || "*"] };
10793
+ }
10794
+ return { type };
10795
+ }
10796
+ function generateKiroHooks(hooks) {
10797
+ const outputs = [];
10798
+ for (const [event, entries] of Object.entries(hooks)) {
10799
+ const mappedEvent = event;
10101
10800
  if (!(mappedEvent in CANONICAL_TO_KIRO) || !Array.isArray(entries)) continue;
10102
10801
  let index = 1;
10103
10802
  for (const entry of entries) {
@@ -10188,7 +10887,7 @@ function steeringFrontmatter(rule) {
10188
10887
  if (rule.description) frontmatter.description = rule.description;
10189
10888
  return frontmatter;
10190
10889
  }
10191
- function generateRules10(canonical) {
10890
+ function generateRules11(canonical) {
10192
10891
  const outputs = [];
10193
10892
  const root = canonical.rules.find((rule) => rule.root);
10194
10893
  if (root) {
@@ -10205,10 +10904,10 @@ function generateRules10(canonical) {
10205
10904
  }
10206
10905
  return outputs;
10207
10906
  }
10208
- function generateSkills10(canonical) {
10907
+ function generateSkills11(canonical) {
10209
10908
  return generateEmbeddedSkills(canonical, KIRO_SKILLS_DIR);
10210
10909
  }
10211
- function generateMcp8(canonical) {
10910
+ function generateMcp9(canonical) {
10212
10911
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
10213
10912
  return [
10214
10913
  {
@@ -10224,7 +10923,7 @@ function generateHooks5(canonical) {
10224
10923
  content: hook.content
10225
10924
  }));
10226
10925
  }
10227
- function generateAgents8(canonical) {
10926
+ function generateAgents9(canonical) {
10228
10927
  return canonical.agents.map((agent) => {
10229
10928
  const frontmatter = {
10230
10929
  name: agent.name,
@@ -10239,16 +10938,16 @@ function generateAgents8(canonical) {
10239
10938
  return { path: `${KIRO_AGENTS_DIR}/${agent.name}.md`, content };
10240
10939
  });
10241
10940
  }
10242
- function generateIgnore6(canonical) {
10941
+ function generateIgnore7(canonical) {
10243
10942
  if (canonical.ignore.length === 0) return [];
10244
10943
  return [{ path: KIRO_IGNORE, content: canonical.ignore.join("\n") }];
10245
10944
  }
10246
- var init_generator13 = __esm({
10945
+ var init_generator14 = __esm({
10247
10946
  "src/targets/kiro/generator.ts"() {
10248
10947
  init_embedded_skill();
10249
10948
  init_markdown();
10250
10949
  init_hook_format();
10251
- init_constants8();
10950
+ init_constants9();
10252
10951
  }
10253
10952
  });
10254
10953
  function canonicalRuleMeta(frontmatter) {
@@ -10337,12 +11036,12 @@ async function importFromKiro(projectRoot, options = {}) {
10337
11036
  const normalize = await createImportReferenceNormalizer(KIRO_TARGET, projectRoot, scope);
10338
11037
  await importRoot(projectRoot, results, normalize, scope);
10339
11038
  await importNonRootRules(projectRoot, results, normalize);
10340
- results.push(...await runDescriptorImport(descriptor10, projectRoot, scope, { normalize }));
11039
+ results.push(...await runDescriptorImport(descriptor11, projectRoot, scope, { normalize }));
10341
11040
  await importEmbeddedSkills(projectRoot, KIRO_SKILLS_DIR, KIRO_TARGET, results, normalize);
10342
11041
  if (scope === "project") await importHooks2(projectRoot, results);
10343
11042
  return results;
10344
11043
  }
10345
- var init_importer10 = __esm({
11044
+ var init_importer11 = __esm({
10346
11045
  "src/targets/kiro/importer.ts"() {
10347
11046
  init_import_rewriter();
10348
11047
  init_embedded_skill();
@@ -10353,13 +11052,13 @@ var init_importer10 = __esm({
10353
11052
  init_fs();
10354
11053
  init_markdown();
10355
11054
  init_hook_format();
10356
- init_constants8();
11055
+ init_constants9();
10357
11056
  init_kiro2();
10358
11057
  }
10359
11058
  });
10360
11059
 
10361
11060
  // src/targets/kiro/linter.ts
10362
- function lintRules10(canonical, projectRoot, projectFiles, options) {
11061
+ function lintRules11(canonical, projectRoot, projectFiles, options) {
10363
11062
  return validateRules(canonical, projectRoot, projectFiles, {
10364
11063
  checkGlobMatches: options?.scope !== "global"
10365
11064
  }).map((diagnostic) => ({
@@ -10367,15 +11066,15 @@ function lintRules10(canonical, projectRoot, projectFiles, options) {
10367
11066
  target: KIRO_TARGET
10368
11067
  }));
10369
11068
  }
10370
- var init_linter10 = __esm({
11069
+ var init_linter11 = __esm({
10371
11070
  "src/targets/kiro/linter.ts"() {
10372
11071
  init_validate_rules();
10373
- init_constants8();
11072
+ init_constants9();
10374
11073
  }
10375
11074
  });
10376
11075
 
10377
11076
  // src/targets/kiro/lint.ts
10378
- function lintHooks4(canonical) {
11077
+ function lintHooks5(canonical) {
10379
11078
  if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
10380
11079
  const supported = ["PreToolUse", "PostToolUse", "UserPromptSubmit", "SubagentStop"];
10381
11080
  const supportedSet = new Set(supported);
@@ -10383,35 +11082,35 @@ function lintHooks4(canonical) {
10383
11082
  (event) => createUnsupportedHookWarning(event, "kiro", supported, { unsupportedBy: "Kiro hooks" })
10384
11083
  );
10385
11084
  }
10386
- var init_lint8 = __esm({
11085
+ var init_lint9 = __esm({
10387
11086
  "src/targets/kiro/lint.ts"() {
10388
11087
  init_helpers();
10389
11088
  }
10390
11089
  });
10391
11090
 
10392
11091
  // src/targets/kiro/index.ts
10393
- var target10, project10, global8, globalCapabilities10, descriptor10;
11092
+ var target11, project11, global8, globalCapabilities10, descriptor11;
10394
11093
  var init_kiro2 = __esm({
10395
11094
  "src/targets/kiro/index.ts"() {
10396
- init_generator13();
11095
+ init_generator14();
10397
11096
  init_skill_mirror();
10398
- init_importer10();
10399
- init_linter10();
10400
- init_lint8();
11097
+ init_importer11();
11098
+ init_linter11();
11099
+ init_lint9();
10401
11100
  init_import_map_builders();
10402
- init_constants8();
10403
- target10 = {
11101
+ init_constants9();
11102
+ target11 = {
10404
11103
  name: KIRO_TARGET,
10405
11104
  primaryRootInstructionPath: KIRO_AGENTS_MD,
10406
- generateRules: generateRules10,
10407
- generateAgents: generateAgents8,
10408
- generateSkills: generateSkills10,
10409
- generateMcp: generateMcp8,
11105
+ generateRules: generateRules11,
11106
+ generateAgents: generateAgents9,
11107
+ generateSkills: generateSkills11,
11108
+ generateMcp: generateMcp9,
10410
11109
  generateHooks: generateHooks5,
10411
- generateIgnore: generateIgnore6,
11110
+ generateIgnore: generateIgnore7,
10412
11111
  importFrom: importFromKiro
10413
11112
  };
10414
- project10 = {
11113
+ project11 = {
10415
11114
  rootInstructionPath: KIRO_AGENTS_MD,
10416
11115
  skillDir: KIRO_SKILLS_DIR,
10417
11116
  managedOutputs: {
@@ -10492,9 +11191,9 @@ var init_kiro2 = __esm({
10492
11191
  ignore: "native",
10493
11192
  permissions: "none"
10494
11193
  };
10495
- descriptor10 = {
11194
+ descriptor11 = {
10496
11195
  id: KIRO_TARGET,
10497
- generators: target10,
11196
+ generators: target11,
10498
11197
  capabilities: {
10499
11198
  rules: "native",
10500
11199
  additionalRules: "native",
@@ -10507,11 +11206,11 @@ var init_kiro2 = __esm({
10507
11206
  permissions: "none"
10508
11207
  },
10509
11208
  emptyImportMessage: "No Kiro config found (AGENTS.md, .kiro/steering, .kiro/skills, .kiro/agents, .kiro/hooks, .kiro/settings/mcp.json, or .kiroignore).",
10510
- lintRules: lintRules10,
11209
+ lintRules: lintRules11,
10511
11210
  lint: {
10512
- hooks: lintHooks4
11211
+ hooks: lintHooks5
10513
11212
  },
10514
- project: project10,
11213
+ project: project11,
10515
11214
  globalSupport: {
10516
11215
  capabilities: globalCapabilities10,
10517
11216
  detectionPaths: [
@@ -10560,7 +11259,7 @@ var init_kiro2 = __esm({
10560
11259
  };
10561
11260
  }
10562
11261
  });
10563
- function generateRules11(canonical) {
11262
+ function generateRules12(canonical) {
10564
11263
  const outputs = [];
10565
11264
  const root = canonical.rules.find((rule) => rule.root);
10566
11265
  if (root) {
@@ -10580,7 +11279,7 @@ function generateRules11(canonical) {
10580
11279
  }
10581
11280
  return outputs;
10582
11281
  }
10583
- function generateCommands10(canonical) {
11282
+ function generateCommands11(canonical) {
10584
11283
  return canonical.commands.map((command) => {
10585
11284
  const frontmatter = {};
10586
11285
  if (command.description) frontmatter.description = command.description;
@@ -10590,7 +11289,7 @@ function generateCommands10(canonical) {
10590
11289
  };
10591
11290
  });
10592
11291
  }
10593
- function generateMcp9(canonical) {
11292
+ function generateMcp10(canonical) {
10594
11293
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
10595
11294
  return [
10596
11295
  {
@@ -10599,14 +11298,14 @@ function generateMcp9(canonical) {
10599
11298
  }
10600
11299
  ];
10601
11300
  }
10602
- function generateIgnore7(canonical) {
11301
+ function generateIgnore8(canonical) {
10603
11302
  if (canonical.ignore.length === 0) return [];
10604
11303
  return [{ path: ROO_CODE_IGNORE, content: canonical.ignore.join("\n") }];
10605
11304
  }
10606
- function generateSkills11(canonical) {
11305
+ function generateSkills12(canonical) {
10607
11306
  return generateEmbeddedSkills(canonical, ROO_CODE_SKILLS_DIR);
10608
11307
  }
10609
- function generateAgents9(canonical) {
11308
+ function generateAgents10(canonical) {
10610
11309
  if (canonical.agents.length === 0) return [];
10611
11310
  const customModes = canonical.agents.map((agent) => {
10612
11311
  const slug = basename(agent.source, ".md");
@@ -10617,19 +11316,19 @@ function generateAgents9(canonical) {
10617
11316
  });
10618
11317
  return [{ path: ROO_CODE_MODES_FILE, content: stringify({ customModes }) }];
10619
11318
  }
10620
- var init_generator14 = __esm({
11319
+ var init_generator15 = __esm({
10621
11320
  "src/targets/roo-code/generator.ts"() {
10622
11321
  init_embedded_skill();
10623
11322
  init_markdown();
10624
- init_constants9();
11323
+ init_constants10();
10625
11324
  }
10626
11325
  });
10627
11326
  var rooNonRootRuleMapper, rooCommandMapper;
10628
- var init_import_mappers7 = __esm({
11327
+ var init_import_mappers8 = __esm({
10629
11328
  "src/targets/roo-code/import-mappers.ts"() {
10630
11329
  init_markdown();
10631
11330
  init_import_metadata();
10632
- init_constants9();
11331
+ init_constants10();
10633
11332
  rooNonRootRuleMapper = async ({
10634
11333
  relativePath,
10635
11334
  normalizeTo,
@@ -10713,25 +11412,25 @@ async function importFromRooCode(projectRoot, options = {}) {
10713
11412
  const scope = options.scope ?? "project";
10714
11413
  const results = [];
10715
11414
  const normalize = await createImportReferenceNormalizer(ROO_CODE_TARGET, projectRoot, scope);
10716
- results.push(...await runDescriptorImport(descriptor11, projectRoot, scope, { normalize }));
11415
+ results.push(...await runDescriptorImport(descriptor12, projectRoot, scope, { normalize }));
10717
11416
  await importPerModeRules(projectRoot, results, normalize);
10718
11417
  await importEmbeddedSkills(projectRoot, ROO_CODE_SKILLS_DIR, ROO_CODE_TARGET, results, normalize);
10719
11418
  return results;
10720
11419
  }
10721
- var init_importer11 = __esm({
11420
+ var init_importer12 = __esm({
10722
11421
  "src/targets/roo-code/importer.ts"() {
10723
11422
  init_import_rewriter();
10724
11423
  init_embedded_skill();
10725
11424
  init_import_orchestrator();
10726
11425
  init_descriptor_import_runner();
10727
- init_import_mappers7();
10728
- init_constants9();
11426
+ init_import_mappers8();
11427
+ init_constants10();
10729
11428
  init_roo_code2();
10730
11429
  }
10731
11430
  });
10732
11431
 
10733
11432
  // src/targets/roo-code/linter.ts
10734
- function lintRules11(canonical, projectRoot, projectFiles, options) {
11433
+ function lintRules12(canonical, projectRoot, projectFiles, options) {
10735
11434
  return validateRules(canonical, projectRoot, projectFiles, {
10736
11435
  checkGlobMatches: options?.scope !== "global"
10737
11436
  }).map((diagnostic) => ({
@@ -10739,10 +11438,10 @@ function lintRules11(canonical, projectRoot, projectFiles, options) {
10739
11438
  target: ROO_CODE_TARGET
10740
11439
  }));
10741
11440
  }
10742
- var init_linter11 = __esm({
11441
+ var init_linter12 = __esm({
10743
11442
  "src/targets/roo-code/linter.ts"() {
10744
11443
  init_validate_rules();
10745
- init_constants9();
11444
+ init_constants10();
10746
11445
  }
10747
11446
  });
10748
11447
  function computeStatus5(existing, content) {
@@ -10750,29 +11449,29 @@ function computeStatus5(existing, content) {
10750
11449
  if (existing !== content) return "updated";
10751
11450
  return "unchanged";
10752
11451
  }
10753
- var target11, project11, generateRooGlobalExtras, global9, globalCapabilities11, descriptor11;
11452
+ var target12, project12, generateRooGlobalExtras, global9, globalCapabilities11, descriptor12;
10754
11453
  var init_roo_code2 = __esm({
10755
11454
  "src/targets/roo-code/index.ts"() {
10756
11455
  init_fs();
10757
- init_generator14();
10758
- init_constants9();
11456
+ init_generator15();
11457
+ init_constants10();
10759
11458
  init_skill_mirror();
10760
- init_importer11();
10761
- init_import_mappers7();
10762
- init_linter11();
11459
+ init_importer12();
11460
+ init_import_mappers8();
11461
+ init_linter12();
10763
11462
  init_import_map_builders();
10764
- target11 = {
11463
+ target12 = {
10765
11464
  name: "roo-code",
10766
11465
  primaryRootInstructionPath: ROO_CODE_ROOT_RULE,
10767
- generateRules: generateRules11,
10768
- generateCommands: generateCommands10,
10769
- generateSkills: generateSkills11,
10770
- generateMcp: generateMcp9,
10771
- generateIgnore: generateIgnore7,
10772
- generateAgents: generateAgents9,
11466
+ generateRules: generateRules12,
11467
+ generateCommands: generateCommands11,
11468
+ generateSkills: generateSkills12,
11469
+ generateMcp: generateMcp10,
11470
+ generateIgnore: generateIgnore8,
11471
+ generateAgents: generateAgents10,
10773
11472
  importFrom: importFromRooCode
10774
11473
  };
10775
- project11 = {
11474
+ project12 = {
10776
11475
  rootInstructionPath: ROO_CODE_ROOT_RULE,
10777
11476
  skillDir: ".roo/skills",
10778
11477
  managedOutputs: {
@@ -10880,9 +11579,9 @@ var init_roo_code2 = __esm({
10880
11579
  ignore: "native",
10881
11580
  permissions: "none"
10882
11581
  };
10883
- descriptor11 = {
11582
+ descriptor12 = {
10884
11583
  id: "roo-code",
10885
- generators: target11,
11584
+ generators: target12,
10886
11585
  capabilities: {
10887
11586
  rules: "native",
10888
11587
  additionalRules: "native",
@@ -10895,8 +11594,8 @@ var init_roo_code2 = __esm({
10895
11594
  permissions: "none"
10896
11595
  },
10897
11596
  emptyImportMessage: "No Roo Code config found (.roo/rules, .roo/commands, .roo/skills, .roo/mcp.json, .rooignore, or .roorules).",
10898
- lintRules: lintRules11,
10899
- project: project11,
11597
+ lintRules: lintRules12,
11598
+ project: project12,
10900
11599
  globalSupport: {
10901
11600
  capabilities: globalCapabilities11,
10902
11601
  detectionPaths: [
@@ -10979,7 +11678,7 @@ var init_roo_code2 = __esm({
10979
11678
 
10980
11679
  // src/targets/windsurf/constants.ts
10981
11680
  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;
10982
- var init_constants13 = __esm({
11681
+ var init_constants14 = __esm({
10983
11682
  "src/targets/windsurf/constants.ts"() {
10984
11683
  WINDSURF_TARGET = "windsurf";
10985
11684
  WINDSURF_RULES_ROOT = ".windsurfrules";
@@ -11018,7 +11717,7 @@ function directoryScopedRuleDir(globs) {
11018
11717
  if (dirs.length !== globs.length) return null;
11019
11718
  return dirs.every((dir) => dir === dirs[0]) ? dirs[0] : null;
11020
11719
  }
11021
- function generateRules12(canonical) {
11720
+ function generateRules13(canonical) {
11022
11721
  const outputs = [];
11023
11722
  const root = canonical.rules.find((r) => r.root);
11024
11723
  if (!root) return [];
@@ -11055,23 +11754,23 @@ function generateRules12(canonical) {
11055
11754
  var init_rules4 = __esm({
11056
11755
  "src/targets/windsurf/generator/rules.ts"() {
11057
11756
  init_markdown();
11058
- init_constants13();
11757
+ init_constants14();
11059
11758
  }
11060
11759
  });
11061
11760
 
11062
11761
  // src/targets/windsurf/generator/ignore.ts
11063
- function generateIgnore8(canonical) {
11762
+ function generateIgnore9(canonical) {
11064
11763
  if (!canonical.ignore || canonical.ignore.length === 0) return [];
11065
11764
  return [{ path: CODEIUM_IGNORE, content: canonical.ignore.join("\n") }];
11066
11765
  }
11067
11766
  var init_ignore3 = __esm({
11068
11767
  "src/targets/windsurf/generator/ignore.ts"() {
11069
- init_constants13();
11768
+ init_constants14();
11070
11769
  }
11071
11770
  });
11072
11771
 
11073
11772
  // src/targets/windsurf/generator/workflows.ts
11074
- function generateCommands11(canonical) {
11773
+ function generateCommands12(canonical) {
11075
11774
  return canonical.commands.map((cmd) => {
11076
11775
  const frontmatter = {
11077
11776
  description: cmd.description.trim() || void 0,
@@ -11090,12 +11789,12 @@ function generateCommands11(canonical) {
11090
11789
  var init_workflows = __esm({
11091
11790
  "src/targets/windsurf/generator/workflows.ts"() {
11092
11791
  init_markdown();
11093
- init_constants13();
11792
+ init_constants14();
11094
11793
  }
11095
11794
  });
11096
11795
 
11097
11796
  // src/targets/windsurf/generator/agents.ts
11098
- function generateAgents10(canonical) {
11797
+ function generateAgents11(canonical) {
11099
11798
  return canonical.agents.map((agent) => ({
11100
11799
  path: `${WINDSURF_SKILLS_DIR}/${projectedAgentSkillDirName(agent.name)}/SKILL.md`,
11101
11800
  content: serializeProjectedAgentSkill(agent)
@@ -11104,12 +11803,12 @@ function generateAgents10(canonical) {
11104
11803
  var init_agents4 = __esm({
11105
11804
  "src/targets/windsurf/generator/agents.ts"() {
11106
11805
  init_projected_agent_skill();
11107
- init_constants13();
11806
+ init_constants14();
11108
11807
  }
11109
11808
  });
11110
11809
 
11111
11810
  // src/targets/windsurf/generator/mcp.ts
11112
- function generateMcp10(canonical) {
11811
+ function generateMcp11(canonical) {
11113
11812
  if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
11114
11813
  return [
11115
11814
  {
@@ -11120,7 +11819,7 @@ function generateMcp10(canonical) {
11120
11819
  }
11121
11820
  var init_mcp3 = __esm({
11122
11821
  "src/targets/windsurf/generator/mcp.ts"() {
11123
- init_constants13();
11822
+ init_constants14();
11124
11823
  }
11125
11824
  });
11126
11825
 
@@ -11163,12 +11862,12 @@ function generateHooks6(canonical) {
11163
11862
  var init_hooks2 = __esm({
11164
11863
  "src/targets/windsurf/generator/hooks.ts"() {
11165
11864
  init_hook_command();
11166
- init_constants13();
11865
+ init_constants14();
11167
11866
  }
11168
11867
  });
11169
11868
 
11170
11869
  // src/targets/windsurf/generator/skills.ts
11171
- function generateSkills12(canonical) {
11870
+ function generateSkills13(canonical) {
11172
11871
  const outputs = [];
11173
11872
  for (const skill of canonical.skills) {
11174
11873
  const frontmatter = {
@@ -11190,12 +11889,12 @@ function generateSkills12(canonical) {
11190
11889
  var init_skills4 = __esm({
11191
11890
  "src/targets/windsurf/generator/skills.ts"() {
11192
11891
  init_markdown();
11193
- init_constants13();
11892
+ init_constants14();
11194
11893
  }
11195
11894
  });
11196
11895
 
11197
11896
  // src/targets/windsurf/generator/index.ts
11198
- var init_generator15 = __esm({
11897
+ var init_generator16 = __esm({
11199
11898
  "src/targets/windsurf/generator/index.ts"() {
11200
11899
  init_rules4();
11201
11900
  init_ignore3();
@@ -11208,9 +11907,9 @@ var init_generator15 = __esm({
11208
11907
  });
11209
11908
 
11210
11909
  // src/targets/windsurf/generator.ts
11211
- var init_generator16 = __esm({
11910
+ var init_generator17 = __esm({
11212
11911
  "src/targets/windsurf/generator.ts"() {
11213
- init_generator15();
11912
+ init_generator16();
11214
11913
  }
11215
11914
  });
11216
11915
  function toStringArray8(value) {
@@ -11262,7 +11961,7 @@ var init_importer_workflows = __esm({
11262
11961
  init_fs();
11263
11962
  init_markdown();
11264
11963
  init_import_metadata();
11265
- init_constants13();
11964
+ init_constants14();
11266
11965
  }
11267
11966
  });
11268
11967
  async function importSkills4(projectRoot, results, normalize, skillsRelDir = WINDSURF_SKILLS_DIR) {
@@ -11309,7 +12008,7 @@ var init_skills_adapter5 = __esm({
11309
12008
  init_projected_agent_skill();
11310
12009
  init_scoped_agents_import();
11311
12010
  init_skill_import_pipeline();
11312
- init_constants13();
12011
+ init_constants14();
11313
12012
  }
11314
12013
  });
11315
12014
  async function importWindsurfHooks(projectRoot, results) {
@@ -11407,7 +12106,7 @@ async function importWindsurfMcp(projectRoot, results) {
11407
12106
  var init_importer_hooks_mcp = __esm({
11408
12107
  "src/targets/windsurf/importer-hooks-mcp.ts"() {
11409
12108
  init_fs();
11410
- init_constants13();
12109
+ init_constants14();
11411
12110
  }
11412
12111
  });
11413
12112
  async function importFromWindsurf(projectRoot, options) {
@@ -11544,7 +12243,7 @@ async function importFromWindsurf(projectRoot, options) {
11544
12243
  await importWindsurfMcp(projectRoot, results);
11545
12244
  return results;
11546
12245
  }
11547
- var init_importer12 = __esm({
12246
+ var init_importer13 = __esm({
11548
12247
  "src/targets/windsurf/importer.ts"() {
11549
12248
  init_import_rewriter();
11550
12249
  init_fs();
@@ -11552,13 +12251,13 @@ var init_importer12 = __esm({
11552
12251
  init_import_metadata();
11553
12252
  init_import_orchestrator();
11554
12253
  init_scoped_agents_import();
11555
- init_constants13();
12254
+ init_constants14();
11556
12255
  init_importer_workflows();
11557
12256
  init_skills_adapter5();
11558
12257
  init_importer_hooks_mcp();
11559
12258
  }
11560
12259
  });
11561
- function lintRules12(canonical, projectRoot, _projectFiles) {
12260
+ function lintRules13(canonical, projectRoot, _projectFiles) {
11562
12261
  const diags = [];
11563
12262
  const { rules } = canonical;
11564
12263
  if (rules.length > 0) {
@@ -11585,9 +12284,9 @@ function lintRules12(canonical, projectRoot, _projectFiles) {
11585
12284
  }
11586
12285
  return diags;
11587
12286
  }
11588
- var init_linter12 = __esm({
12287
+ var init_linter13 = __esm({
11589
12288
  "src/targets/windsurf/linter.ts"() {
11590
- init_constants13();
12289
+ init_constants14();
11591
12290
  }
11592
12291
  });
11593
12292
 
@@ -11611,7 +12310,7 @@ function lintMcp4(canonical) {
11611
12310
  )
11612
12311
  ];
11613
12312
  }
11614
- var init_lint9 = __esm({
12313
+ var init_lint10 = __esm({
11615
12314
  "src/targets/windsurf/lint.ts"() {
11616
12315
  init_helpers();
11617
12316
  }
@@ -11624,32 +12323,32 @@ function directoryScopedRuleDir2(globs) {
11624
12323
  if (dirs.length !== globs.length) return null;
11625
12324
  return dirs.every((dir) => dir === dirs[0]) ? dirs[0] : null;
11626
12325
  }
11627
- var target12, project12, global10, globalCapabilities12, descriptor12;
12326
+ var target13, project13, global10, globalCapabilities12, descriptor13;
11628
12327
  var init_windsurf2 = __esm({
11629
12328
  "src/targets/windsurf/index.ts"() {
11630
- init_generator16();
12329
+ init_generator17();
11631
12330
  init_capabilities();
11632
- init_constants13();
12331
+ init_constants14();
11633
12332
  init_skill_mirror();
11634
- init_importer12();
11635
- init_linter12();
11636
- init_lint9();
12333
+ init_importer13();
12334
+ init_linter13();
12335
+ init_lint10();
11637
12336
  init_import_map_builders();
11638
12337
  init_conversions();
11639
12338
  init_projected_agent_skill();
11640
- target12 = {
12339
+ target13 = {
11641
12340
  name: "windsurf",
11642
12341
  primaryRootInstructionPath: WINDSURF_AGENTS_MD,
11643
- generateRules: generateRules12,
11644
- generateCommands: generateCommands11,
11645
- generateAgents: generateAgents10,
11646
- generateSkills: generateSkills12,
11647
- generateMcp: generateMcp10,
12342
+ generateRules: generateRules13,
12343
+ generateCommands: generateCommands12,
12344
+ generateAgents: generateAgents11,
12345
+ generateSkills: generateSkills13,
12346
+ generateMcp: generateMcp11,
11648
12347
  generateHooks: generateHooks6,
11649
- generateIgnore: generateIgnore8,
12348
+ generateIgnore: generateIgnore9,
11650
12349
  importFrom: importFromWindsurf
11651
12350
  };
11652
- project12 = {
12351
+ project13 = {
11653
12352
  rootInstructionPath: WINDSURF_AGENTS_MD,
11654
12353
  extraRuleOutputPaths(rule) {
11655
12354
  if (rule.root) return [WINDSURF_AGENTS_MD];
@@ -11744,9 +12443,9 @@ var init_windsurf2 = __esm({
11744
12443
  ignore: "native",
11745
12444
  permissions: "none"
11746
12445
  };
11747
- descriptor12 = {
12446
+ descriptor13 = {
11748
12447
  id: "windsurf",
11749
- generators: target12,
12448
+ generators: target13,
11750
12449
  capabilities: {
11751
12450
  rules: "native",
11752
12451
  additionalRules: "native",
@@ -11760,12 +12459,12 @@ var init_windsurf2 = __esm({
11760
12459
  },
11761
12460
  emptyImportMessage: "No Windsurf config found (.windsurfrules, .windsurf/rules, .windsurfignore, or .codeiumignore).",
11762
12461
  supportsConversion: { agents: true },
11763
- lintRules: lintRules12,
12462
+ lintRules: lintRules13,
11764
12463
  lint: {
11765
12464
  commands: lintCommands6,
11766
12465
  mcp: lintMcp4
11767
12466
  },
11768
- project: project12,
12467
+ project: project13,
11769
12468
  globalSupport: {
11770
12469
  capabilities: globalCapabilities12,
11771
12470
  detectionPaths: [
@@ -11808,67 +12507,67 @@ function builtinTargetsMap() {
11808
12507
  }
11809
12508
  return _builtinTargetsMap;
11810
12509
  }
11811
- function getBuiltinTargetDefinition(target13) {
11812
- return builtinTargetsMap().get(target13);
12510
+ function getBuiltinTargetDefinition(target14) {
12511
+ return builtinTargetsMap().get(target14);
11813
12512
  }
11814
- function getTargetCapabilities(target13, scope = "project") {
11815
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
11816
- if (!descriptor13) return void 0;
11817
- const raw = scope === "global" ? descriptor13.globalSupport?.capabilities ?? descriptor13.capabilities : descriptor13.capabilities;
12513
+ function getTargetCapabilities(target14, scope = "project") {
12514
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
12515
+ if (!descriptor14) return void 0;
12516
+ const raw = scope === "global" ? descriptor14.globalSupport?.capabilities ?? descriptor14.capabilities : descriptor14.capabilities;
11818
12517
  return normalizeTargetCapabilities(raw);
11819
12518
  }
11820
- function getTargetDetectionPaths(target13, scope = "project") {
11821
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
11822
- if (!descriptor13) return [];
12519
+ function getTargetDetectionPaths(target14, scope = "project") {
12520
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
12521
+ if (!descriptor14) return [];
11823
12522
  if (scope === "global") {
11824
- return descriptor13.globalSupport?.detectionPaths ?? [];
12523
+ return descriptor14.globalSupport?.detectionPaths ?? [];
11825
12524
  }
11826
- return descriptor13.detectionPaths;
12525
+ return descriptor14.detectionPaths;
11827
12526
  }
11828
- function getTargetLayout(target13, scope = "project") {
11829
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
11830
- if (!descriptor13) return void 0;
12527
+ function getTargetLayout(target14, scope = "project") {
12528
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
12529
+ if (!descriptor14) return void 0;
11831
12530
  if (scope === "global") {
11832
- return descriptor13.globalSupport?.layout;
12531
+ return descriptor14.globalSupport?.layout;
11833
12532
  }
11834
- return descriptor13.project;
12533
+ return descriptor14.project;
11835
12534
  }
11836
- function getTargetPrimaryRootInstructionPath(target13, scope = "project") {
11837
- return getTargetLayout(target13, scope)?.rootInstructionPath;
12535
+ function getTargetPrimaryRootInstructionPath(target14, scope = "project") {
12536
+ return getTargetLayout(target14, scope)?.rootInstructionPath;
11838
12537
  }
11839
- function getTargetSkillDir(target13, scope = "project") {
11840
- return getTargetLayout(target13, scope)?.skillDir;
12538
+ function getTargetSkillDir(target14, scope = "project") {
12539
+ return getTargetLayout(target14, scope)?.skillDir;
11841
12540
  }
11842
- function getTargetManagedOutputs(target13, scope = "project") {
11843
- return getTargetLayout(target13, scope)?.managedOutputs;
12541
+ function getTargetManagedOutputs(target14, scope = "project") {
12542
+ return getTargetLayout(target14, scope)?.managedOutputs;
11844
12543
  }
11845
- function rewriteGeneratedOutputPath(target13, path, scope = "project") {
11846
- const layout = getTargetLayout(target13, scope);
12544
+ function rewriteGeneratedOutputPath(target14, path, scope = "project") {
12545
+ const layout = getTargetLayout(target14, scope);
11847
12546
  if (!layout) return null;
11848
12547
  return layout.rewriteGeneratedPath ? layout.rewriteGeneratedPath(path) : path;
11849
12548
  }
11850
- function isFeatureSuppressedByConversion(descriptor13, feature, config, scope) {
11851
- if (!descriptor13 || !config) return false;
11852
- if (feature === "commands" && descriptor13.supportsConversion?.commands) {
11853
- return !shouldConvertCommandsToSkills(config, descriptor13.id, true, scope);
12549
+ function isFeatureSuppressedByConversion(descriptor14, feature, config, scope) {
12550
+ if (!descriptor14 || !config) return false;
12551
+ if (feature === "commands" && descriptor14.supportsConversion?.commands) {
12552
+ return !shouldConvertCommandsToSkills(config, descriptor14.id, true, scope);
11854
12553
  }
11855
- if (feature === "agents" && descriptor13.supportsConversion?.agents) {
11856
- return !shouldConvertAgentsToSkills(config, descriptor13.id, true, scope);
12554
+ if (feature === "agents" && descriptor14.supportsConversion?.agents) {
12555
+ return !shouldConvertAgentsToSkills(config, descriptor14.id, true, scope);
11857
12556
  }
11858
12557
  return false;
11859
12558
  }
11860
- function getEffectiveTargetSupportLevel(target13, feature, config, scope = "project") {
11861
- const baseLevel = getTargetCapabilities(target13, scope)?.[feature]?.level ?? "none";
12559
+ function getEffectiveTargetSupportLevel(target14, feature, config, scope = "project") {
12560
+ const baseLevel = getTargetCapabilities(target14, scope)?.[feature]?.level ?? "none";
11862
12561
  if (baseLevel !== "embedded") return baseLevel;
11863
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
11864
- return isFeatureSuppressedByConversion(descriptor13, feature, config, scope) ? "none" : baseLevel;
12562
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
12563
+ return isFeatureSuppressedByConversion(descriptor14, feature, config, scope) ? "none" : baseLevel;
11865
12564
  }
11866
- function resolveTargetFeatureGenerator(target13, feature, config, scope = "project") {
11867
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
11868
- if (!descriptor13?.generators) return void 0;
11869
- if (isFeatureSuppressedByConversion(descriptor13, feature, config, scope)) return void 0;
12565
+ function resolveTargetFeatureGenerator(target14, feature, config, scope = "project") {
12566
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
12567
+ if (!descriptor14?.generators) return void 0;
12568
+ if (isFeatureSuppressedByConversion(descriptor14, feature, config, scope)) return void 0;
11870
12569
  const pick = PICK_FEATURE_GENERATOR[feature];
11871
- return pick === null ? void 0 : pick(descriptor13.generators);
12570
+ return pick === null ? void 0 : pick(descriptor14.generators);
11872
12571
  }
11873
12572
  var BUILTIN_TARGETS, _builtinTargetsMap, PICK_FEATURE_GENERATOR;
11874
12573
  var init_builtin_targets = __esm({
@@ -11887,6 +12586,7 @@ var init_builtin_targets = __esm({
11887
12586
  init_cursor2();
11888
12587
  init_gemini_cli2();
11889
12588
  init_junie2();
12589
+ init_kilo_code2();
11890
12590
  init_kiro2();
11891
12591
  init_roo_code2();
11892
12592
  init_windsurf2();
@@ -11902,7 +12602,8 @@ var init_builtin_targets = __esm({
11902
12602
  descriptor9,
11903
12603
  descriptor10,
11904
12604
  descriptor11,
11905
- descriptor12
12605
+ descriptor12,
12606
+ descriptor13
11906
12607
  ];
11907
12608
  PICK_FEATURE_GENERATOR = {
11908
12609
  rules: (g) => g.generateRules,
@@ -11937,51 +12638,51 @@ function addSkillDirectoryMappings(refs, canonicalPath, targetPath) {
11937
12638
 
11938
12639
  // src/core/reference/map-targets.ts
11939
12640
  init_builtin_targets();
11940
- function ruleTargetPath(target13, rule, scope = "project") {
11941
- const layout = getTargetLayout(target13, scope);
12641
+ function ruleTargetPath(target14, rule, scope = "project") {
12642
+ const layout = getTargetLayout(target14, scope);
11942
12643
  if (!layout) return null;
11943
12644
  if (rule.root) {
11944
12645
  return layout.rootInstructionPath ?? null;
11945
12646
  }
11946
- if (rule.targets.length > 0 && !rule.targets.includes(target13)) return null;
11947
- const slug = basename(rule.source, ".md");
12647
+ if (rule.targets.length > 0 && !rule.targets.includes(target14)) return null;
12648
+ const slug = posix.basename(rule.source.replace(/\\/g, "/"), ".md");
11948
12649
  return layout.paths.rulePath(slug, rule);
11949
12650
  }
11950
- function commandTargetPath(target13, name, config, scope = "project") {
11951
- const layout = getTargetLayout(target13, scope);
12651
+ function commandTargetPath(target14, name, config, scope = "project") {
12652
+ const layout = getTargetLayout(target14, scope);
11952
12653
  if (!layout) return null;
11953
12654
  return layout.paths.commandPath(name, config);
11954
12655
  }
11955
- function agentTargetPath(target13, name, config, scope = "project") {
11956
- const layout = getTargetLayout(target13, scope);
12656
+ function agentTargetPath(target14, name, config, scope = "project") {
12657
+ const layout = getTargetLayout(target14, scope);
11957
12658
  if (!layout) return null;
11958
12659
  return layout.paths.agentPath(name, config);
11959
12660
  }
11960
12661
 
11961
12662
  // src/core/reference/map.ts
11962
- init_constants10();
11963
- init_constants12();
12663
+ init_constants11();
11964
12664
  init_constants13();
12665
+ init_constants14();
11965
12666
  init_builtin_targets();
11966
12667
  function addDirectoryMapping3(refs, from, to) {
11967
12668
  refs.set(from, to);
11968
12669
  refs.set(`${from}/`, `${to}/`);
11969
12670
  }
11970
- function buildReferenceMap(target13, canonical, config, scope = "project") {
12671
+ function buildReferenceMap(target14, canonical, config, scope = "project") {
11971
12672
  const refs = /* @__PURE__ */ new Map();
11972
12673
  for (const rule of canonical.rules) {
11973
- const path = ruleTargetPath(target13, rule, scope);
12674
+ const path = ruleTargetPath(target14, rule, scope);
11974
12675
  if (path) refs.set(`.agentsmesh/rules/${basename(rule.source)}`, path);
11975
12676
  }
11976
12677
  for (const command of canonical.commands) {
11977
- const path = commandTargetPath(target13, command.name, config, scope);
12678
+ const path = commandTargetPath(target14, command.name, config, scope);
11978
12679
  if (path) refs.set(`.agentsmesh/commands/${command.name}.md`, path);
11979
12680
  }
11980
12681
  for (const agent of canonical.agents) {
11981
- const path = agentTargetPath(target13, agent.name, config, scope);
12682
+ const path = agentTargetPath(target14, agent.name, config, scope);
11982
12683
  if (path) refs.set(`.agentsmesh/agents/${agent.name}.md`, path);
11983
12684
  }
11984
- const skillDir = getTargetSkillDir(target13, scope);
12685
+ const skillDir = getTargetSkillDir(target14, scope);
11985
12686
  if (!skillDir) return refs;
11986
12687
  for (const skill of canonical.skills) {
11987
12688
  addDirectoryMapping3(refs, `.agentsmesh/skills/${skill.name}`, `${skillDir}/${skill.name}`);
@@ -12018,17 +12719,20 @@ function isGeminiAgents(result) {
12018
12719
  function isKiroAgents(result) {
12019
12720
  return result.target === "kiro" && result.path.endsWith(AGENTS_SUFFIX);
12020
12721
  }
12722
+ function isKiloCodeAgents(result) {
12723
+ return result.target === "kilo-code" && result.path.endsWith(AGENTS_SUFFIX);
12724
+ }
12021
12725
  function isCompatibilityAgents(result) {
12022
12726
  return isCursorAgents(result) || isGeminiAgents(result);
12023
12727
  }
12024
- function reverseReferenceMap(target13, canonical, config, cache) {
12025
- const cached2 = cache.get(target13);
12728
+ function reverseReferenceMap(target14, canonical, config, cache) {
12729
+ const cached2 = cache.get(target14);
12026
12730
  if (cached2) return cached2;
12027
12731
  const reversed = /* @__PURE__ */ new Map();
12028
- for (const [canonicalPath, targetPath] of buildReferenceMap(target13, canonical, config)) {
12732
+ for (const [canonicalPath, targetPath] of buildReferenceMap(target14, canonical, config)) {
12029
12733
  if (!reversed.has(targetPath)) reversed.set(targetPath, canonicalPath);
12030
12734
  }
12031
- cache.set(target13, reversed);
12735
+ cache.set(target14, reversed);
12032
12736
  return reversed;
12033
12737
  }
12034
12738
  function normalizeContent(content, refs) {
@@ -12067,15 +12771,15 @@ function preferEquivalentCodexAgents(results, canonical, config) {
12067
12771
  return results.filter((result) => {
12068
12772
  if (isCursorAgents(result)) {
12069
12773
  const targets = overlapTargetsByPath.get(result.path);
12070
- if (targets && [...targets].some((target13) => target13 !== "cursor")) return false;
12774
+ if (targets && [...targets].some((target14) => target14 !== "cursor")) return false;
12071
12775
  }
12072
12776
  if (isGeminiAgents(result)) {
12073
12777
  const targets = overlapTargetsByPath.get(result.path);
12074
- if (targets && [...targets].some((target13) => target13 !== "cursor" && target13 !== "gemini-cli")) {
12778
+ if (targets && [...targets].some((target14) => target14 !== "cursor" && target14 !== "gemini-cli")) {
12075
12779
  return false;
12076
12780
  }
12077
12781
  }
12078
- if (!isWindsurfAgents(result) && !isClineAgents(result) && !isCursorAgents(result) && !isGeminiAgents(result) && !isKiroAgents(result)) {
12782
+ if (!isWindsurfAgents(result) && !isClineAgents(result) && !isCursorAgents(result) && !isGeminiAgents(result) && !isKiroAgents(result) && !isKiloCodeAgents(result)) {
12079
12783
  return true;
12080
12784
  }
12081
12785
  const codexResult = codexByPath.get(result.path);
@@ -12107,23 +12811,23 @@ function skillSupportingDirPrefixes(supportingFiles) {
12107
12811
  const dirs = /* @__PURE__ */ new Set();
12108
12812
  for (const { relativePath } of supportingFiles) {
12109
12813
  const posixPath = relativePath.replace(/\\/g, "/");
12110
- let d = dirname(posixPath);
12814
+ let d = posix.dirname(posixPath);
12111
12815
  while (d !== "." && d.length > 0) {
12112
12816
  dirs.add(d);
12113
- const next = dirname(d);
12817
+ const next = posix.dirname(d);
12114
12818
  if (next === d) break;
12115
12819
  d = next;
12116
12820
  }
12117
12821
  }
12118
12822
  return [...dirs];
12119
12823
  }
12120
- function addPackSkillArtifactMappings(refs, target13, canonical, projectRoot, scope) {
12121
- const skillDir = getTargetSkillDir(target13, scope);
12824
+ function addPackSkillArtifactMappings(refs, target14, canonical, projectRoot, scope) {
12825
+ const skillDir = getTargetSkillDir(target14, scope);
12122
12826
  if (!skillDir) return;
12123
12827
  const api = pathApi(projectRoot);
12124
12828
  const packsPrefix = api.join(projectRoot, ".agentsmesh", "packs");
12125
12829
  for (const skill of canonical.skills) {
12126
- const skillSourceDir = dirname(skill.source);
12830
+ const skillSourceDir = api.dirname(skill.source);
12127
12831
  if (!skillSourceDir.startsWith(packsPrefix)) continue;
12128
12832
  const targetSkillDir = api.normalize(api.join(projectRoot, skillDir, skill.name));
12129
12833
  addPackAbsoluteDirMapping(refs, skillSourceDir, targetSkillDir, api);
@@ -12152,8 +12856,8 @@ function copilotInstructionsPath(rule) {
12152
12856
  const slug = basename(rule.source, ".md");
12153
12857
  return `.github/instructions/${slug}.instructions.md`;
12154
12858
  }
12155
- function applyCopilotInstructionArtifactRefs(target13, refs, projectRoot, destinationPath, canonical) {
12156
- if (target13 !== "copilot" || !destinationPath?.startsWith(".github/instructions/")) return;
12859
+ function applyCopilotInstructionArtifactRefs(target14, refs, projectRoot, destinationPath, canonical) {
12860
+ if (target14 !== "copilot" || !destinationPath?.startsWith(".github/instructions/")) return;
12157
12861
  const api = pathApi(projectRoot);
12158
12862
  for (const rule of canonical.rules) {
12159
12863
  if (rule.root || rule.globs.length === 0) continue;
@@ -12188,11 +12892,11 @@ function resolveRewriteFamilyId(layout, outputPath) {
12188
12892
  function pushUnique(paths, path) {
12189
12893
  if (path !== void 0 && path.length > 0 && !paths.includes(path)) paths.push(path);
12190
12894
  }
12191
- function extraRuleOutputPaths(target13, rule, refs, scope) {
12895
+ function extraRuleOutputPaths(target14, rule, refs, scope) {
12192
12896
  const paths = [];
12193
12897
  const targetPath = refs.get(`.agentsmesh/rules/${basename(rule.source)}`);
12194
12898
  pushUnique(paths, targetPath);
12195
- const layout = getTargetLayout(target13, scope);
12899
+ const layout = getTargetLayout(target14, scope);
12196
12900
  if (rule.root) {
12197
12901
  for (const mirrorPath of getAdditionalRootDecorationPaths(layout)) {
12198
12902
  pushUnique(paths, mirrorPath);
@@ -12206,9 +12910,8 @@ function extraRuleOutputPaths(target13, rule, refs, scope) {
12206
12910
 
12207
12911
  // src/core/reference/output-source-map.ts
12208
12912
  init_builtin_targets();
12209
- function addGlobalSkillMirrorSourceEntry(target13, scope, primaryOutputPath, source, sourceMap, activeTargets) {
12210
- if (scope !== "global") return;
12211
- const layout = getTargetLayout(target13, scope);
12913
+ function addSkillMirrorSourceEntry(target14, scope, primaryOutputPath, source, sourceMap, activeTargets) {
12914
+ const layout = getTargetLayout(target14, scope);
12212
12915
  if (!layout?.mirrorGlobalPath) return;
12213
12916
  const raw = layout.mirrorGlobalPath(primaryOutputPath, activeTargets ?? []);
12214
12917
  const mirrorPaths = raw === null ? [] : Array.isArray(raw) ? raw : [raw];
@@ -12227,24 +12930,24 @@ function canonicalAgentPath(agent) {
12227
12930
  function canonicalSkillPath(skill) {
12228
12931
  return `.agentsmesh/skills/${skill.name}/SKILL.md`;
12229
12932
  }
12230
- function buildArtifactPathMap(target13, canonical, config, projectRoot, destinationPath, options) {
12933
+ function buildArtifactPathMap(target14, canonical, config, projectRoot, destinationPath, options) {
12231
12934
  const scope = options?.scope ?? "project";
12232
12935
  const api = pathApi(projectRoot);
12233
12936
  const refs = new Map(
12234
- [...buildReferenceMap(target13, canonical, config, scope)].map(([canonicalPath, targetPath]) => [
12937
+ [...buildReferenceMap(target14, canonical, config, scope)].map(([canonicalPath, targetPath]) => [
12235
12938
  api.normalize(api.join(projectRoot, canonicalPath)),
12236
12939
  api.normalize(api.join(projectRoot, targetPath))
12237
12940
  ])
12238
12941
  );
12239
- applyCopilotInstructionArtifactRefs(target13, refs, projectRoot, destinationPath, canonical);
12240
- addPackSkillArtifactMappings(refs, target13, canonical, projectRoot, scope);
12942
+ applyCopilotInstructionArtifactRefs(target14, refs, projectRoot, destinationPath, canonical);
12943
+ addPackSkillArtifactMappings(refs, target14, canonical, projectRoot, scope);
12241
12944
  return refs;
12242
12945
  }
12243
- function buildOutputSourceMap(target13, canonical, config, scope = "project", activeTargets) {
12244
- const refs = buildReferenceMap(target13, canonical, config, scope);
12946
+ function buildOutputSourceMap(target14, canonical, config, scope = "project", activeTargets) {
12947
+ const refs = buildReferenceMap(target14, canonical, config, scope);
12245
12948
  const sourceMap = /* @__PURE__ */ new Map();
12246
12949
  for (const rule of canonical.rules) {
12247
- for (const targetPath of extraRuleOutputPaths(target13, rule, refs, scope)) {
12950
+ for (const targetPath of extraRuleOutputPaths(target14, rule, refs, scope)) {
12248
12951
  sourceMap.set(targetPath, rule.source);
12249
12952
  }
12250
12953
  }
@@ -12260,8 +12963,8 @@ function buildOutputSourceMap(target13, canonical, config, scope = "project", ac
12260
12963
  const skillTargetPath = refs.get(canonicalSkillPath(skill));
12261
12964
  if (skillTargetPath) {
12262
12965
  sourceMap.set(skillTargetPath, skill.source);
12263
- addGlobalSkillMirrorSourceEntry(
12264
- target13,
12966
+ addSkillMirrorSourceEntry(
12967
+ target14,
12265
12968
  scope,
12266
12969
  skillTargetPath,
12267
12970
  skill.source,
@@ -12274,8 +12977,8 @@ function buildOutputSourceMap(target13, canonical, config, scope = "project", ac
12274
12977
  const targetPath = refs.get(canonicalPath);
12275
12978
  if (targetPath) {
12276
12979
  sourceMap.set(targetPath, file.absolutePath);
12277
- addGlobalSkillMirrorSourceEntry(
12278
- target13,
12980
+ addSkillMirrorSourceEntry(
12981
+ target14,
12279
12982
  scope,
12280
12983
  targetPath,
12281
12984
  file.absolutePath,
@@ -12290,13 +12993,14 @@ function buildOutputSourceMap(target13, canonical, config, scope = "project", ac
12290
12993
 
12291
12994
  // src/core/reference/rewriter.ts
12292
12995
  init_builtin_targets();
12996
+ init_registry();
12293
12997
  init_shared_artifact_owner();
12294
12998
  function findSharedArtifactOwner(path, activeTargets) {
12295
12999
  if (!activeTargets) return null;
12296
13000
  for (const targetId of activeTargets) {
12297
- const descriptor13 = getBuiltinTargetDefinition(targetId);
12298
- if (!descriptor13?.sharedArtifacts) continue;
12299
- for (const [pathPrefix, role] of Object.entries(descriptor13.sharedArtifacts)) {
13001
+ const descriptor14 = getDescriptor(targetId);
13002
+ if (!descriptor14?.sharedArtifacts) continue;
13003
+ for (const [pathPrefix, role] of Object.entries(descriptor14.sharedArtifacts)) {
12300
13004
  if (role === "owner" && path.startsWith(pathPrefix)) {
12301
13005
  return targetId;
12302
13006
  }
@@ -12313,8 +13017,8 @@ function artifactMapTargetForResult(result, scope, activeTargets) {
12313
13017
  }
12314
13018
  return result.target;
12315
13019
  }
12316
- function sourceMapCacheKey(target13, activeTargets) {
12317
- return `${target13}\0${(activeTargets ?? []).join(",")}`;
13020
+ function sourceMapCacheKey(target14, activeTargets) {
13021
+ return `${target14}\0${(activeTargets ?? []).join(",")}`;
12318
13022
  }
12319
13023
  function collectPlannedPaths(projectRoot, results) {
12320
13024
  const api = pathApi(projectRoot);
@@ -12594,28 +13298,28 @@ function computeStatus6(existing, content) {
12594
13298
  if (existing !== content) return "updated";
12595
13299
  return "unchanged";
12596
13300
  }
12597
- function resolveGeneratedOutputPath(target13, path, scope) {
12598
- let resolvedPath = rewriteGeneratedOutputPath(target13, path, scope);
13301
+ function resolveGeneratedOutputPath(target14, path, scope) {
13302
+ let resolvedPath = rewriteGeneratedOutputPath(target14, path, scope);
12599
13303
  if (resolvedPath !== null) return resolvedPath;
12600
- const desc = getDescriptor(target13);
13304
+ const desc = getDescriptor(target14);
12601
13305
  if (!desc) return null;
12602
13306
  const layout = scope === "global" ? desc.globalSupport?.layout : desc.project;
12603
13307
  if (!layout) return null;
12604
13308
  resolvedPath = layout.rewriteGeneratedPath ? layout.rewriteGeneratedPath(path) : path;
12605
13309
  return resolvedPath;
12606
13310
  }
12607
- async function emitGeneratedOutput(results, target13, out, projectRoot, scope, options) {
12608
- const resolvedPath = resolveGeneratedOutputPath(target13, out.path, scope);
13311
+ async function emitGeneratedOutput(results, target14, out, projectRoot, scope, options) {
13312
+ const resolvedPath = resolveGeneratedOutputPath(target14, out.path, scope);
12609
13313
  if (resolvedPath === null) return null;
12610
13314
  const existing = await readFileSafe(join(projectRoot, resolvedPath));
12611
- const pendingIdx = results.findIndex((r) => r.path === resolvedPath && r.target === target13);
13315
+ const pendingIdx = results.findIndex((r) => r.path === resolvedPath && r.target === target14);
12612
13316
  const pendingResult = pendingIdx >= 0 ? results[pendingIdx] : void 0;
12613
13317
  const content = options?.mergeContent?.(existing, pendingResult, out.content, resolvedPath) ?? out.content;
12614
13318
  if (pendingIdx >= 0) {
12615
13319
  results.splice(pendingIdx, 1);
12616
13320
  }
12617
13321
  results.push({
12618
- target: target13,
13322
+ target: target14,
12619
13323
  path: resolvedPath,
12620
13324
  content,
12621
13325
  currentContent: existing ?? void 0,
@@ -12623,8 +13327,8 @@ async function emitGeneratedOutput(results, target13, out, projectRoot, scope, o
12623
13327
  });
12624
13328
  return resolvedPath;
12625
13329
  }
12626
- function featureContext(target13, feature, scope) {
12627
- const caps = getTargetCapabilities(target13, scope);
13330
+ function featureContext(target14, feature, scope) {
13331
+ const caps = getTargetCapabilities(target14, scope);
12628
13332
  return {
12629
13333
  capability: caps?.[feature] ?? { level: "none" },
12630
13334
  scope
@@ -12632,21 +13336,21 @@ function featureContext(target13, feature, scope) {
12632
13336
  }
12633
13337
  async function generateFeature(results, targets, canonical, projectRoot, enabled, scope, feature, getGen) {
12634
13338
  if (!enabled) return;
12635
- for (const target13 of targets) {
12636
- const gen = getGen(target13);
13339
+ for (const target14 of targets) {
13340
+ const gen = getGen(target14);
12637
13341
  if (!gen) continue;
12638
- const ctx = featureContext(target13, feature, scope);
13342
+ const ctx = featureContext(target14, feature, scope);
12639
13343
  for (const out of gen(canonical, ctx)) {
12640
- const resolvedPath = await emitGeneratedOutput(results, target13, out, projectRoot, scope);
13344
+ const resolvedPath = await emitGeneratedOutput(results, target14, out, projectRoot, scope);
12641
13345
  if (resolvedPath === null) continue;
12642
- const layout = getTargetLayout(target13, scope);
13346
+ const layout = getTargetLayout(target14, scope);
12643
13347
  if (layout?.mirrorGlobalPath) {
12644
13348
  const raw = layout.mirrorGlobalPath(resolvedPath, targets);
12645
13349
  const mirrorPaths = raw === null ? [] : Array.isArray(raw) ? raw : [raw];
12646
13350
  for (const mirrorPath of mirrorPaths) {
12647
13351
  const existingMirror = await readFileSafe(join(projectRoot, mirrorPath));
12648
13352
  results.push({
12649
- target: target13,
13353
+ target: target14,
12650
13354
  path: mirrorPath,
12651
13355
  content: out.content,
12652
13356
  currentContent: existingMirror ?? void 0,
@@ -12685,9 +13389,9 @@ function decoratePrimaryRootInstructions(results, canonical, scope = "project")
12685
13389
  init_builtin_targets();
12686
13390
  init_registry();
12687
13391
  init_settings2();
12688
- function mergeOutputContent(target13, existing, pending, newContent, resolvedPath) {
12689
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
12690
- const merged = descriptor13?.mergeGeneratedOutputContent?.(
13392
+ function mergeOutputContent(target14, existing, pending, newContent, resolvedPath) {
13393
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
13394
+ const merged = descriptor14?.mergeGeneratedOutputContent?.(
12691
13395
  existing,
12692
13396
  pending,
12693
13397
  newContent,
@@ -12698,44 +13402,44 @@ function mergeOutputContent(target13, existing, pending, newContent, resolvedPat
12698
13402
  return base !== null && SETTINGS_JSON_PATHS.includes(resolvedPath) ? mergeSettingsJson(base, newContent) : newContent;
12699
13403
  }
12700
13404
  async function generatePermissionsFeature(results, targets, canonical, projectRoot, scope) {
12701
- for (const target13 of targets) {
12702
- const gen = resolveTargetFeatureGenerator(target13, "permissions", void 0, scope) ?? getDescriptor(target13)?.generators.generatePermissions;
13405
+ for (const target14 of targets) {
13406
+ const gen = resolveTargetFeatureGenerator(target14, "permissions", void 0, scope) ?? getDescriptor(target14)?.generators.generatePermissions;
12703
13407
  if (!gen) continue;
12704
13408
  for (const out of gen(canonical)) {
12705
- await emitGeneratedOutput(results, target13, out, projectRoot, scope, {
12706
- mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target13, existing, pending, newContent, resolvedPath)
13409
+ await emitGeneratedOutput(results, target14, out, projectRoot, scope, {
13410
+ mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target14, existing, pending, newContent, resolvedPath)
12707
13411
  });
12708
13412
  }
12709
13413
  }
12710
13414
  }
12711
13415
  async function generateHooksFeature(results, targets, canonical, projectRoot, scope, config) {
12712
- for (const target13 of targets) {
12713
- const gen = resolveTargetFeatureGenerator(target13, "hooks", config, scope) ?? getDescriptor(target13)?.generators.generateHooks;
13416
+ for (const target14 of targets) {
13417
+ const gen = resolveTargetFeatureGenerator(target14, "hooks", config, scope) ?? getDescriptor(target14)?.generators.generateHooks;
12714
13418
  if (!gen) continue;
12715
- const ctx = featureContext(target13, "hooks", scope);
13419
+ const ctx = featureContext(target14, "hooks", scope);
12716
13420
  let outputs = [...gen(canonical, ctx)];
12717
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
12718
- const post = descriptor13?.postProcessHookOutputs;
13421
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
13422
+ const post = descriptor14?.postProcessHookOutputs;
12719
13423
  if (post) {
12720
13424
  outputs = [...await post(projectRoot, canonical, outputs)];
12721
13425
  }
12722
13426
  for (const out of outputs) {
12723
- await emitGeneratedOutput(results, target13, out, projectRoot, scope, {
12724
- mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target13, existing, pending, newContent, resolvedPath)
13427
+ await emitGeneratedOutput(results, target14, out, projectRoot, scope, {
13428
+ mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target14, existing, pending, newContent, resolvedPath)
12725
13429
  });
12726
13430
  }
12727
13431
  }
12728
13432
  }
12729
13433
  async function generateScopedSettingsFeature(results, targets, canonical, projectRoot, scope) {
12730
- for (const target13 of targets) {
12731
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
12732
- const emit = descriptor13?.emitScopedSettings;
13434
+ for (const target14 of targets) {
13435
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
13436
+ const emit = descriptor14?.emitScopedSettings;
12733
13437
  if (!emit) continue;
12734
13438
  const outputs = emit(canonical, scope);
12735
13439
  if (outputs.length === 0) continue;
12736
13440
  for (const out of outputs) {
12737
- await emitGeneratedOutput(results, target13, out, projectRoot, scope, {
12738
- mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target13, existing, pending, newContent, resolvedPath)
13441
+ await emitGeneratedOutput(results, target14, out, projectRoot, scope, {
13442
+ mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target14, existing, pending, newContent, resolvedPath)
12739
13443
  });
12740
13444
  }
12741
13445
  }
@@ -12746,8 +13450,8 @@ async function generate(ctx) {
12746
13450
  const { config, canonical, projectRoot, scope = "project", targetFilter } = ctx;
12747
13451
  const allTargets = [...config.targets, ...config.pluginTargets ?? []];
12748
13452
  const targets = targetFilter ? allTargets.filter((t) => targetFilter.includes(t)) : allTargets;
12749
- function resolveGen(target13, feature) {
12750
- return resolveTargetFeatureGenerator(target13, feature, config, scope);
13453
+ function resolveGen(target14, feature) {
13454
+ return resolveTargetFeatureGenerator(target14, feature, config, scope);
12751
13455
  }
12752
13456
  const hasRules = config.features.includes("rules");
12753
13457
  const hasCommands = config.features.includes("commands");
@@ -12766,7 +13470,7 @@ async function generate(ctx) {
12766
13470
  hasRules,
12767
13471
  scope,
12768
13472
  "rules",
12769
- (target13) => resolveGen(target13, "rules")
13473
+ (target14) => resolveGen(target14, "rules")
12770
13474
  );
12771
13475
  await generateFeature(
12772
13476
  results,
@@ -12776,7 +13480,7 @@ async function generate(ctx) {
12776
13480
  hasCommands,
12777
13481
  scope,
12778
13482
  "commands",
12779
- (target13) => resolveGen(target13, "commands")
13483
+ (target14) => resolveGen(target14, "commands")
12780
13484
  );
12781
13485
  await generateFeature(
12782
13486
  results,
@@ -12786,7 +13490,7 @@ async function generate(ctx) {
12786
13490
  hasAgents,
12787
13491
  scope,
12788
13492
  "agents",
12789
- (target13) => resolveGen(target13, "agents")
13493
+ (target14) => resolveGen(target14, "agents")
12790
13494
  );
12791
13495
  await generateFeature(
12792
13496
  results,
@@ -12796,7 +13500,7 @@ async function generate(ctx) {
12796
13500
  hasSkills,
12797
13501
  scope,
12798
13502
  "skills",
12799
- (target13) => resolveGen(target13, "skills")
13503
+ (target14) => resolveGen(target14, "skills")
12800
13504
  );
12801
13505
  await generateFeature(
12802
13506
  results,
@@ -12806,7 +13510,7 @@ async function generate(ctx) {
12806
13510
  hasMcp,
12807
13511
  scope,
12808
13512
  "mcp",
12809
- (target13) => resolveGen(target13, "mcp")
13513
+ (target14) => resolveGen(target14, "mcp")
12810
13514
  );
12811
13515
  if (hasPermissions) {
12812
13516
  await generatePermissionsFeature(results, targets, canonical, projectRoot, scope);
@@ -12820,12 +13524,12 @@ async function generate(ctx) {
12820
13524
  hasIgnore,
12821
13525
  scope,
12822
13526
  "ignore",
12823
- (target13) => resolveGen(target13, "ignore")
13527
+ (target14) => resolveGen(target14, "ignore")
12824
13528
  );
12825
13529
  const enabledFeatures = new Set(config.features);
12826
- for (const target13 of targets) {
12827
- const descriptor13 = getBuiltinTargetDefinition(target13) ?? getDescriptor(target13);
12828
- const scopeExtras = descriptor13?.globalSupport?.scopeExtras;
13530
+ for (const target14 of targets) {
13531
+ const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
13532
+ const scopeExtras = descriptor14?.globalSupport?.scopeExtras;
12829
13533
  if (scopeExtras) {
12830
13534
  const extras = await scopeExtras(canonical, projectRoot, scope, enabledFeatures);
12831
13535
  results.push(...extras);
@@ -13030,8 +13734,8 @@ function deepMergeObjects(base, overrides2) {
13030
13734
  }
13031
13735
  return result;
13032
13736
  }
13033
- function mergeLocalConfig(project13, local) {
13034
- const merged = { ...project13 };
13737
+ function mergeLocalConfig(project14, local) {
13738
+ const merged = { ...project14 };
13035
13739
  if (Array.isArray(local.targets) && local.targets.length > 0) {
13036
13740
  merged.targets = local.targets;
13037
13741
  }
@@ -13051,7 +13755,7 @@ function mergeLocalConfig(project13, local) {
13051
13755
  );
13052
13756
  }
13053
13757
  if (Array.isArray(local.extends) && local.extends.length > 0) {
13054
- merged.extends = [...project13.extends ?? [], ...local.extends];
13758
+ merged.extends = [...project14.extends ?? [], ...local.extends];
13055
13759
  }
13056
13760
  return merged;
13057
13761
  }
@@ -13361,13 +14065,13 @@ function parseGitlabSource(source) {
13361
14065
  const slash = slug.lastIndexOf("/");
13362
14066
  if (slash < 0) return null;
13363
14067
  const namespace = slug.slice(0, slash).trim();
13364
- const project13 = slug.slice(slash + 1).trim();
13365
- if (!namespace || !project13) return null;
14068
+ const project14 = slug.slice(slash + 1).trim();
14069
+ if (!namespace || !project14) return null;
13366
14070
  return {
13367
14071
  namespace,
13368
- project: project13,
14072
+ project: project14,
13369
14073
  ref,
13370
- cloneUrl: `https://gitlab.com/${namespace}/${project13}.git`
14074
+ cloneUrl: `https://gitlab.com/${namespace}/${project14}.git`
13371
14075
  };
13372
14076
  }
13373
14077
  function parseGitSource(source) {
@@ -13426,13 +14130,25 @@ async function sweepStaleCache(cacheDir, maxAgeMs) {
13426
14130
  }
13427
14131
 
13428
14132
  // src/config/remote/remote-fetcher.ts
14133
+ var MAX_CACHE_KEY_LENGTH = 80;
13429
14134
  function buildCacheKey(provider, identifier, ref) {
13430
- const safe = (value) => value.replace(/[^a-zA-Z0-9_-]/g, "_");
14135
+ const safe = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_").replace(/^\.+/, "_");
14136
+ let key;
13431
14137
  if (provider === "github") {
13432
14138
  const [org, repo] = identifier.split("/", 2);
13433
- if (org && repo) return `${safe(org)}-${safe(repo)}-${safe(ref)}`;
14139
+ if (org && repo) {
14140
+ key = `${safe(org)}--${safe(repo)}--${safe(ref)}`;
14141
+ } else {
14142
+ key = `${safe(provider)}__${safe(identifier)}__${safe(ref)}`;
14143
+ }
14144
+ } else {
14145
+ key = `${safe(provider)}__${safe(identifier)}__${safe(ref)}`;
14146
+ }
14147
+ if (key.length > MAX_CACHE_KEY_LENGTH) {
14148
+ const hash = createHash("sha256").update(key).digest("hex").slice(0, 16);
14149
+ key = `${key.slice(0, MAX_CACHE_KEY_LENGTH - 18)}--${hash}`;
13434
14150
  }
13435
- return `${safe(provider)}_${safe(identifier)}_${safe(ref)}`;
14151
+ return key;
13436
14152
  }
13437
14153
  function getCacheDir() {
13438
14154
  const env = process.env.AGENTSMESH_CACHE;
@@ -14060,6 +14776,21 @@ var TARGET_SIGNATURES = [
14060
14776
  {
14061
14777
  target: "kiro",
14062
14778
  paths: [".kiro", ".kiro/steering", ".kiro/settings/mcp.json"]
14779
+ },
14780
+ {
14781
+ target: "kilo-code",
14782
+ paths: [
14783
+ ".kilo",
14784
+ ".kilo/rules",
14785
+ ".kilo/commands",
14786
+ ".kilo/agents",
14787
+ ".kilo/skills",
14788
+ ".kilocodeignore",
14789
+ ".kilocode",
14790
+ ".kilocodemodes",
14791
+ "kilo.jsonc",
14792
+ "kilo.json"
14793
+ ]
14063
14794
  }
14064
14795
  ];
14065
14796
  async function detectNativeFormat(repoPath) {
@@ -14090,10 +14821,11 @@ init_importer7();
14090
14821
  init_importer6();
14091
14822
  init_importer8();
14092
14823
  init_importer4();
14093
- init_importer12();
14824
+ init_importer13();
14094
14825
  init_importer3();
14095
14826
  init_importer5();
14096
14827
  init_importer9();
14828
+ init_importer11();
14097
14829
  init_importer10();
14098
14830
  var NATIVE_IMPORTERS = {
14099
14831
  "claude-code": importFromClaudeCode,
@@ -14105,7 +14837,8 @@ var NATIVE_IMPORTERS = {
14105
14837
  cline: importFromCline,
14106
14838
  continue: importFromContinue,
14107
14839
  junie: importFromJunie,
14108
- kiro: importFromKiro
14840
+ kiro: importFromKiro,
14841
+ "kilo-code": importFromKiloCode
14109
14842
  };
14110
14843
  async function importNativeToCanonical(repoPath, targetName) {
14111
14844
  const importFn = NATIVE_IMPORTERS[targetName];
@@ -14525,7 +15258,8 @@ async function importPluginModule(entry, projectRoot) {
14525
15258
  const { source } = entry;
14526
15259
  let importTarget;
14527
15260
  if (source.startsWith("file:") || source.startsWith("./") || source.startsWith("../") || source.startsWith("/")) {
14528
- const resolved = source.startsWith("file:") ? fileURLToPath(source) : resolve(projectRoot, source);
15261
+ const raw = source.startsWith("file:") ? fileURLToPath(source) : source;
15262
+ const resolved = resolve(projectRoot, raw);
14529
15263
  importTarget = pathToFileURL(resolved).href;
14530
15264
  } else {
14531
15265
  importTarget = source;
@@ -14553,9 +15287,9 @@ async function loadPlugin(entry, projectRoot) {
14553
15287
  const descriptors = [];
14554
15288
  for (const raw of rawDescriptors) {
14555
15289
  try {
14556
- const descriptor13 = validateDescriptor(raw);
14557
- registerTargetDescriptor(descriptor13);
14558
- descriptors.push(descriptor13);
15290
+ const descriptor14 = validateDescriptor(raw);
15291
+ registerTargetDescriptor(descriptor14);
15292
+ descriptors.push(descriptor14);
14559
15293
  } catch (err) {
14560
15294
  throw new Error(
14561
15295
  `Plugin '${entry.source}' exported an invalid descriptor: ${err instanceof Error ? err.message : String(err)}`,
@@ -14594,14 +15328,14 @@ init_fs();
14594
15328
  // src/targets/catalog/target-catalog.ts
14595
15329
  init_builtin_targets();
14596
15330
  var TARGET_CATALOG = Object.fromEntries(
14597
- BUILTIN_TARGETS.map((target13) => [
14598
- target13.id,
15331
+ BUILTIN_TARGETS.map((target14) => [
15332
+ target14.id,
14599
15333
  {
14600
- importFrom: target13.generators.importFrom,
14601
- emptyImportMessage: target13.emptyImportMessage,
14602
- lintRules: target13.lintRules,
14603
- lint: target13.lint,
14604
- capabilities: target13.capabilities
15334
+ importFrom: target14.generators.importFrom,
15335
+ emptyImportMessage: target14.emptyImportMessage,
15336
+ lintRules: target14.lintRules,
15337
+ lint: target14.lint,
15338
+ capabilities: target14.capabilities
14605
15339
  }
14606
15340
  ])
14607
15341
  );
@@ -14781,57 +15515,55 @@ async function runLint(config, canonical, projectRoot, targetFilter, options = {
14781
15515
  const hasHooks = config.features.includes("hooks");
14782
15516
  const diagnostics = [];
14783
15517
  const projectFiles = scope === "global" ? [] : await getProjectFiles(projectRoot);
14784
- for (const target13 of targets) {
14785
- const descriptor13 = isBuiltinTargetId(target13) ? getTargetCatalogEntry(target13) : getDescriptor(target13);
14786
- if (descriptor13?.capabilities) {
15518
+ for (const target14 of targets) {
15519
+ const fullDesc = getDescriptor(target14);
15520
+ const descriptor14 = isBuiltinTargetId(target14) ? getTargetCatalogEntry(target14) : fullDesc;
15521
+ if (descriptor14?.capabilities) {
14787
15522
  diagnostics.push(
14788
15523
  ...lintSilentFeatureDrops({
14789
- target: target13,
14790
- capabilities: descriptor13.capabilities,
15524
+ target: target14,
15525
+ capabilities: descriptor14.capabilities,
14791
15526
  canonical,
14792
15527
  enabledFeatures: config.features
14793
15528
  })
14794
15529
  );
14795
15530
  }
14796
15531
  if (hasHooks) {
14797
- const fullDescForHooks = getDescriptor(target13);
14798
15532
  diagnostics.push(
14799
15533
  ...lintHookScriptReferences({
14800
- target: target13,
15534
+ target: target14,
14801
15535
  canonical,
14802
- hasScriptProjection: fullDescForHooks?.postProcessHookOutputs !== void 0
15536
+ hasScriptProjection: fullDesc?.postProcessHookOutputs !== void 0
14803
15537
  })
14804
15538
  );
14805
15539
  }
14806
15540
  if (hasRules) {
14807
- const fullDescForRules = getDescriptor(target13);
14808
15541
  diagnostics.push(
14809
15542
  ...lintRuleScopeInversion({
14810
- target: target13,
15543
+ target: target14,
14811
15544
  canonical,
14812
- preservesManualActivation: fullDescForRules?.preservesManualActivation === true
15545
+ preservesManualActivation: fullDesc?.preservesManualActivation === true
14813
15546
  })
14814
15547
  );
14815
15548
  }
14816
- if (hasRules && descriptor13?.lintRules) {
14817
- diagnostics.push(...descriptor13.lintRules(canonical, projectRoot, projectFiles, { scope }));
15549
+ if (hasRules && descriptor14?.lintRules) {
15550
+ diagnostics.push(...descriptor14.lintRules(canonical, projectRoot, projectFiles, { scope }));
14818
15551
  }
14819
- const fullDesc = getDescriptor(target13);
14820
15552
  if (fullDesc?.generators.lint) {
14821
15553
  diagnostics.push(...fullDesc.generators.lint(canonical));
14822
15554
  }
14823
15555
  const lintOpts = { scope };
14824
- if (hasCommands && descriptor13?.lint?.commands) {
14825
- diagnostics.push(...descriptor13.lint.commands(canonical, lintOpts));
15556
+ if (hasCommands && descriptor14?.lint?.commands) {
15557
+ diagnostics.push(...descriptor14.lint.commands(canonical, lintOpts));
14826
15558
  }
14827
- if (hasMcp && descriptor13?.lint?.mcp) {
14828
- diagnostics.push(...descriptor13.lint.mcp(canonical, lintOpts));
15559
+ if (hasMcp && descriptor14?.lint?.mcp) {
15560
+ diagnostics.push(...descriptor14.lint.mcp(canonical, lintOpts));
14829
15561
  }
14830
- if (hasPermissions && descriptor13?.lint?.permissions) {
14831
- diagnostics.push(...descriptor13.lint.permissions(canonical, lintOpts));
15562
+ if (hasPermissions && descriptor14?.lint?.permissions) {
15563
+ diagnostics.push(...descriptor14.lint.permissions(canonical, lintOpts));
14832
15564
  }
14833
- if (hasHooks && descriptor13?.lint?.hooks) {
14834
- diagnostics.push(...descriptor13.lint.hooks(canonical, lintOpts));
15565
+ if (hasHooks && descriptor14?.lint?.hooks) {
15566
+ diagnostics.push(...descriptor14.lint.hooks(canonical, lintOpts));
14835
15567
  }
14836
15568
  }
14837
15569
  const hasErrors = diagnostics.some((d) => d.level === "error");
@@ -15049,14 +15781,14 @@ async function checkLockSync(opts) {
15049
15781
  // src/public/engine.ts
15050
15782
  init_registry();
15051
15783
  init_target_ids();
15052
- async function importFrom(target13, opts) {
15053
- const descriptor13 = getDescriptor(target13);
15054
- if (!descriptor13) {
15055
- throw new TargetNotFoundError(target13, {
15784
+ async function importFrom(target14, opts) {
15785
+ const descriptor14 = getDescriptor(target14);
15786
+ if (!descriptor14) {
15787
+ throw new TargetNotFoundError(target14, {
15056
15788
  supported: [...TARGET_IDS, ...getAllDescriptors().map((d) => d.id)]
15057
15789
  });
15058
15790
  }
15059
- return descriptor13.generators.importFrom(opts.root, { scope: opts.scope ?? "project" });
15791
+ return descriptor14.generators.importFrom(opts.root, { scope: opts.scope ?? "project" });
15060
15792
  }
15061
15793
  async function loadConfig2(projectRoot) {
15062
15794
  return loadConfigFromDir(projectRoot);
@@ -15130,8 +15862,9 @@ async function loadCanonical(projectRoot, options = {}) {
15130
15862
  // src/public/targets.ts
15131
15863
  init_builtin_targets();
15132
15864
  init_registry();
15133
- function copyCapabilities(capabilities) {
15134
- return Object.freeze({ ...capabilities });
15865
+ init_descriptor_import_runner();
15866
+ function copyCapabilities(capabilities2) {
15867
+ return Object.freeze({ ...capabilities2 });
15135
15868
  }
15136
15869
  function copyGenerators(generators) {
15137
15870
  return Object.freeze({ ...generators });
@@ -15164,17 +15897,17 @@ function copyGlobalSupport(globalSupport) {
15164
15897
  layout: copyLayout(globalSupport.layout)
15165
15898
  });
15166
15899
  }
15167
- function copyTargetDescriptor(descriptor13) {
15900
+ function copyTargetDescriptor(descriptor14) {
15168
15901
  return Object.freeze({
15169
- ...descriptor13,
15170
- generators: copyGenerators(descriptor13.generators),
15171
- capabilities: copyCapabilities(descriptor13.capabilities),
15172
- globalSupport: descriptor13.globalSupport === void 0 ? void 0 : copyGlobalSupport(descriptor13.globalSupport),
15173
- lint: descriptor13.lint === void 0 ? void 0 : Object.freeze({ ...descriptor13.lint }),
15174
- project: copyLayout(descriptor13.project),
15175
- supportsConversion: descriptor13.supportsConversion === void 0 ? void 0 : Object.freeze({ ...descriptor13.supportsConversion }),
15176
- detectionPaths: Object.freeze([...descriptor13.detectionPaths]),
15177
- sharedArtifacts: descriptor13.sharedArtifacts === void 0 ? void 0 : Object.freeze({ ...descriptor13.sharedArtifacts })
15902
+ ...descriptor14,
15903
+ generators: copyGenerators(descriptor14.generators),
15904
+ capabilities: copyCapabilities(descriptor14.capabilities),
15905
+ globalSupport: descriptor14.globalSupport === void 0 ? void 0 : copyGlobalSupport(descriptor14.globalSupport),
15906
+ lint: descriptor14.lint === void 0 ? void 0 : Object.freeze({ ...descriptor14.lint }),
15907
+ project: copyLayout(descriptor14.project),
15908
+ supportsConversion: descriptor14.supportsConversion === void 0 ? void 0 : Object.freeze({ ...descriptor14.supportsConversion }),
15909
+ detectionPaths: Object.freeze([...descriptor14.detectionPaths]),
15910
+ sharedArtifacts: descriptor14.sharedArtifacts === void 0 ? void 0 : Object.freeze({ ...descriptor14.sharedArtifacts })
15178
15911
  });
15179
15912
  }
15180
15913
  function getTargetCatalog() {