agentsmesh 0.9.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/CHANGELOG.md +23 -0
- package/README.md +25 -23
- package/dist/canonical.d.ts +2 -2
- package/dist/canonical.js +1095 -406
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +125 -120
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +1209 -517
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1221 -529
- package/dist/index.js.map +1 -1
- package/dist/{schema-BeGiBqbB.d.ts → schema-qelg8gw8.d.ts} +2 -0
- package/dist/{target-descriptor-CkH4Z43u.d.ts → target-descriptor-Dhdg8s2o.d.ts} +1 -1
- package/dist/targets.d.ts +3 -3
- package/dist/targets.js +1060 -388
- package/dist/targets.js.map +1 -1
- package/package.json +2 -2
- package/schemas/agentsmesh.json +3 -0
- package/schemas/pack.json +1 -0
package/dist/engine.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { readFile, rm, mkdir, readdir, stat, lstat, unlink, writeFile, rename, access, realpath } from 'fs/promises';
|
|
3
|
-
import { join, basename, dirname, relative, win32, posix, resolve,
|
|
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';
|
|
@@ -18,35 +18,35 @@ 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 = (
|
|
21
|
+
var __export = (target14, all) => {
|
|
22
22
|
for (var name in all)
|
|
23
|
-
__defProp(
|
|
23
|
+
__defProp(target14, name, { get: all[name], enumerable: true });
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// src/config/core/conversions.ts
|
|
27
|
-
function usesCommandSkillProjection(
|
|
28
|
-
return Object.prototype.hasOwnProperty.call(DEFAULT_COMMANDS_TO_SKILLS,
|
|
27
|
+
function usesCommandSkillProjection(target14) {
|
|
28
|
+
return Object.prototype.hasOwnProperty.call(DEFAULT_COMMANDS_TO_SKILLS, target14);
|
|
29
29
|
}
|
|
30
|
-
function usesAgentSkillProjection(
|
|
31
|
-
return Object.prototype.hasOwnProperty.call(DEFAULT_AGENTS_TO_SKILLS,
|
|
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,
|
|
39
|
-
const raw = config.conversions?.commands_to_skills?.[
|
|
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(
|
|
42
|
+
if (usesCommandSkillProjection(target14)) return DEFAULT_COMMANDS_TO_SKILLS[target14];
|
|
43
43
|
return defaultEnabled ?? false;
|
|
44
44
|
}
|
|
45
|
-
function shouldConvertAgentsToSkills(config,
|
|
46
|
-
const raw = config.conversions?.agents_to_skills?.[
|
|
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(
|
|
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(
|
|
102
|
+
function validateCapabilityImplementations(descriptor14, capabilities2, ctx, pathPrefix) {
|
|
103
103
|
for (const requirement of generatorRequirements) {
|
|
104
|
-
const level = capabilityLevel(
|
|
104
|
+
const level = capabilityLevel(capabilities2[requirement.feature]);
|
|
105
105
|
if (level === "none") continue;
|
|
106
|
-
const hasGenerator = typeof
|
|
107
|
-
const hasSettingsEmitter = canUseScopedSettings(requirement.feature) && typeof
|
|
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(
|
|
223
|
-
const validated = validateDescriptor(
|
|
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
|
|
244
|
-
if (!
|
|
245
|
-
for (const [prefix, role] of Object.entries(
|
|
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
|
|
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
|
|
256
|
-
if (!
|
|
257
|
-
for (const [prefix, role] of Object.entries(
|
|
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:
|
|
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(
|
|
366
|
+
constructor(target14, options) {
|
|
366
367
|
const suffix = options?.supported ? ` Supported: ${options.supported.join(", ")}.` : "";
|
|
367
|
-
super("AM_TARGET_NOT_FOUND", `Unknown target "${
|
|
368
|
+
super("AM_TARGET_NOT_FOUND", `Unknown target "${target14}".${suffix}`, options);
|
|
368
369
|
this.name = "TargetNotFoundError";
|
|
369
|
-
this.target =
|
|
370
|
+
this.target = target14;
|
|
370
371
|
}
|
|
371
372
|
};
|
|
372
373
|
ImportError = class extends AgentsMeshError {
|
|
373
374
|
target;
|
|
374
|
-
constructor(
|
|
375
|
-
super("AM_IMPORT_FAILED", `Import from ${
|
|
375
|
+
constructor(target14, message, options) {
|
|
376
|
+
super("AM_IMPORT_FAILED", `Import from ${target14} failed: ${message}`, options);
|
|
376
377
|
this.name = "ImportError";
|
|
377
|
-
this.target =
|
|
378
|
+
this.target = target14;
|
|
378
379
|
}
|
|
379
380
|
};
|
|
380
381
|
GenerationError = class extends AgentsMeshError {
|
|
@@ -1117,21 +1118,6 @@ var init_generator = __esm({
|
|
|
1117
1118
|
init_constants();
|
|
1118
1119
|
}
|
|
1119
1120
|
});
|
|
1120
|
-
|
|
1121
|
-
// src/core/reference/import-map.ts
|
|
1122
|
-
async function buildImportReferenceMap(target13, projectRoot, scope = "project") {
|
|
1123
|
-
const refs = /* @__PURE__ */ new Map();
|
|
1124
|
-
const def = getDescriptor(target13);
|
|
1125
|
-
if (def) {
|
|
1126
|
-
await def.buildImportPaths(refs, projectRoot, scope);
|
|
1127
|
-
}
|
|
1128
|
-
return refs;
|
|
1129
|
-
}
|
|
1130
|
-
var init_import_map = __esm({
|
|
1131
|
-
"src/core/reference/import-map.ts"() {
|
|
1132
|
-
init_registry();
|
|
1133
|
-
}
|
|
1134
|
-
});
|
|
1135
1121
|
function pathApi(projectRoot) {
|
|
1136
1122
|
return projectRoot.includes("\\") || WINDOWS_ABSOLUTE_PATH.test(projectRoot) ? win32 : posix;
|
|
1137
1123
|
}
|
|
@@ -1170,13 +1156,28 @@ var init_path_helpers = __esm({
|
|
|
1170
1156
|
}
|
|
1171
1157
|
});
|
|
1172
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
|
+
|
|
1173
1174
|
// src/core/reference/link-format-registry.ts
|
|
1174
|
-
function topLevelDotfilePrefixes(
|
|
1175
|
-
const layouts = [
|
|
1175
|
+
function topLevelDotfilePrefixes(descriptor14) {
|
|
1176
|
+
const layouts = [descriptor14.project, descriptor14.globalSupport?.layout].filter(
|
|
1176
1177
|
(l) => l !== void 0
|
|
1177
1178
|
);
|
|
1178
1179
|
const candidates = [
|
|
1179
|
-
...
|
|
1180
|
+
...descriptor14.detectionPaths,
|
|
1180
1181
|
...layouts.flatMap((l) => l.managedOutputs?.dirs ?? []),
|
|
1181
1182
|
...layouts.flatMap((l) => l.managedOutputs?.files ?? [])
|
|
1182
1183
|
];
|
|
@@ -1189,8 +1190,8 @@ function topLevelDotfilePrefixes(descriptor13) {
|
|
|
1189
1190
|
}
|
|
1190
1191
|
function buildDefaultRootRelativePrefixes() {
|
|
1191
1192
|
const set = /* @__PURE__ */ new Set([".agentsmesh/"]);
|
|
1192
|
-
for (const
|
|
1193
|
-
for (const prefix of topLevelDotfilePrefixes(
|
|
1193
|
+
for (const descriptor14 of BUILTIN_TARGETS) {
|
|
1194
|
+
for (const prefix of topLevelDotfilePrefixes(descriptor14)) set.add(prefix);
|
|
1194
1195
|
}
|
|
1195
1196
|
return Array.from(set);
|
|
1196
1197
|
}
|
|
@@ -1261,7 +1262,7 @@ function resolveProjectPath(token, projectRoot, sourceFile) {
|
|
|
1261
1262
|
}
|
|
1262
1263
|
return [windowsToken];
|
|
1263
1264
|
}
|
|
1264
|
-
if (isAbsolute(token)) {
|
|
1265
|
+
if (api.isAbsolute(token)) {
|
|
1265
1266
|
const absoluteToken = normalizeForProject(projectRoot, token);
|
|
1266
1267
|
if (absoluteToken.startsWith(normalizedProjectRoot) || existsSync(token))
|
|
1267
1268
|
return [absoluteToken];
|
|
@@ -1367,9 +1368,14 @@ var init_link_rebaser_helpers = __esm({
|
|
|
1367
1368
|
LINE_NUMBER_SUFFIX = /(?::(\d+)){1,2}$/;
|
|
1368
1369
|
}
|
|
1369
1370
|
});
|
|
1371
|
+
|
|
1372
|
+
// src/core/reference/link-rebaser-formatting.ts
|
|
1370
1373
|
function isReadingContext(context) {
|
|
1371
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";
|
|
1372
1375
|
}
|
|
1376
|
+
function isReadingContextOptions(options) {
|
|
1377
|
+
return isReadingContext(options.tokenContext);
|
|
1378
|
+
}
|
|
1373
1379
|
function isUnderProjectRoot(projectRoot, absolutePath) {
|
|
1374
1380
|
const api = pathApi(projectRoot);
|
|
1375
1381
|
const root = normalizeForProject(projectRoot, projectRoot);
|
|
@@ -1409,11 +1415,6 @@ function toProjectRootRelative(projectRoot, absolutePath, keepSlash) {
|
|
|
1409
1415
|
const rewritten = relPath.length > 0 ? relPath : ".";
|
|
1410
1416
|
return keepSlash && !rewritten.endsWith("/") ? `${rewritten}/` : rewritten;
|
|
1411
1417
|
}
|
|
1412
|
-
function shouldPreserveAgentsMeshAnchor(_projectRoot, _destinationFile, options) {
|
|
1413
|
-
if (!isReadingContext(options.tokenContext)) return false;
|
|
1414
|
-
if (options.originalToken === void 0) return false;
|
|
1415
|
-
return normalizeSeparators(options.originalToken).startsWith(".agentsmesh/");
|
|
1416
|
-
}
|
|
1417
1418
|
function toProjectRootReference(projectRoot, absolutePath, keepSlash) {
|
|
1418
1419
|
const formatted = toProjectRootRelative(projectRoot, absolutePath, keepSlash);
|
|
1419
1420
|
if (formatted === null) return null;
|
|
@@ -1423,21 +1424,21 @@ function formatLinkPathForDestinationLegacy(projectRoot, destinationFile, absolu
|
|
|
1423
1424
|
const api = pathApi(projectRoot);
|
|
1424
1425
|
const root = normalizeForProject(projectRoot, projectRoot);
|
|
1425
1426
|
const destFile = normalizeForProject(projectRoot, destinationFile);
|
|
1426
|
-
const
|
|
1427
|
-
if (!isUnderProjectRoot(projectRoot,
|
|
1428
|
-
return toProjectRootReference(projectRoot,
|
|
1427
|
+
const target14 = normalizeForProject(projectRoot, absoluteTargetPath);
|
|
1428
|
+
if (!isUnderProjectRoot(projectRoot, target14)) {
|
|
1429
|
+
return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
|
|
1429
1430
|
}
|
|
1430
|
-
const destDir = normalizeForProject(projectRoot, dirname(destFile));
|
|
1431
|
+
const destDir = normalizeForProject(projectRoot, api.dirname(destFile));
|
|
1431
1432
|
if (!isUnderProjectRoot(projectRoot, destDir) && destDir !== root) {
|
|
1432
|
-
return toProjectRootReference(projectRoot,
|
|
1433
|
+
return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
|
|
1433
1434
|
}
|
|
1434
|
-
let rel2 = api.relative(destDir,
|
|
1435
|
+
let rel2 = api.relative(destDir, target14).replace(/\\/g, "/");
|
|
1435
1436
|
if (api.isAbsolute(rel2) || WINDOWS_ABSOLUTE_PATH.test(rel2)) {
|
|
1436
|
-
return toProjectRootRelative(projectRoot,
|
|
1437
|
+
return toProjectRootRelative(projectRoot, target14, keepSlash);
|
|
1437
1438
|
}
|
|
1438
1439
|
const joined = normalizeForProject(projectRoot, api.join(destDir, rel2));
|
|
1439
1440
|
if (!isUnderProjectRoot(projectRoot, joined)) {
|
|
1440
|
-
return toProjectRootRelative(projectRoot,
|
|
1441
|
+
return toProjectRootRelative(projectRoot, target14, keepSlash);
|
|
1441
1442
|
}
|
|
1442
1443
|
if (rel2 === "" || rel2 === ".") {
|
|
1443
1444
|
rel2 = ".";
|
|
@@ -1456,9 +1457,14 @@ var init_link_rebaser_formatting = __esm({
|
|
|
1456
1457
|
// src/core/reference/link-rebaser-output.ts
|
|
1457
1458
|
function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTargetPath, keepSlash, options = {}) {
|
|
1458
1459
|
const scope = options.scope ?? "project";
|
|
1459
|
-
const
|
|
1460
|
-
if (
|
|
1461
|
-
|
|
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
|
+
}
|
|
1462
1468
|
}
|
|
1463
1469
|
if (options.forceRelative) {
|
|
1464
1470
|
return formatLinkPathForDestinationLegacy(
|
|
@@ -1470,10 +1476,10 @@ function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTarg
|
|
|
1470
1476
|
);
|
|
1471
1477
|
}
|
|
1472
1478
|
if (scope === "global" && !isUnderAgentsMesh(projectRoot, destinationFile)) {
|
|
1473
|
-
return toProjectRootReference(projectRoot,
|
|
1479
|
+
return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
|
|
1474
1480
|
}
|
|
1475
1481
|
const meshCanonicalForShape = (() => {
|
|
1476
|
-
if (isUnderAgentsMesh(projectRoot,
|
|
1482
|
+
if (isUnderAgentsMesh(projectRoot, target14)) return target14;
|
|
1477
1483
|
const logical = options.logicalMeshSourceAbsolute;
|
|
1478
1484
|
if (logical && isUnderAgentsMesh(projectRoot, normalizeForProject(projectRoot, logical))) {
|
|
1479
1485
|
return normalizeForProject(projectRoot, logical);
|
|
@@ -1481,9 +1487,9 @@ function formatLinkPathForDestination(projectRoot, destinationFile, absoluteTarg
|
|
|
1481
1487
|
return null;
|
|
1482
1488
|
})();
|
|
1483
1489
|
if (!meshCanonicalForShape) {
|
|
1484
|
-
return toProjectRootReference(projectRoot,
|
|
1490
|
+
return toProjectRootReference(projectRoot, target14, keepSlash)?.text ?? null;
|
|
1485
1491
|
}
|
|
1486
|
-
const treatAsDirectory = keepSlash || (options.pathIsDirectory?.(
|
|
1492
|
+
const treatAsDirectory = keepSlash || (options.pathIsDirectory?.(target14) ?? false);
|
|
1487
1493
|
if (treatAsDirectory) {
|
|
1488
1494
|
const meshRelative = toAgentsMeshRootRelative(projectRoot, meshCanonicalForShape, keepSlash);
|
|
1489
1495
|
if (meshRelative !== null) return meshRelative;
|
|
@@ -1507,7 +1513,7 @@ var init_link_rebaser_output = __esm({
|
|
|
1507
1513
|
});
|
|
1508
1514
|
|
|
1509
1515
|
// src/core/reference/link-rebaser-suffix-strip.ts
|
|
1510
|
-
function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile,
|
|
1516
|
+
function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pathExists2) {
|
|
1511
1517
|
const api = pathApi(projectRoot);
|
|
1512
1518
|
const normalizedToken = normalizeSeparators(token);
|
|
1513
1519
|
if (!isRootRelativePathToken(normalizedToken)) return null;
|
|
@@ -1519,7 +1525,7 @@ function resolveByDestinationSuffixStrip(token, projectRoot, destinationFile, pa
|
|
|
1519
1525
|
const suffix = segments.slice(i).join("/");
|
|
1520
1526
|
const candidate = normalizeForProject(projectRoot, api.join(destDir, suffix));
|
|
1521
1527
|
if (candidate === destFilePath) continue;
|
|
1522
|
-
if (
|
|
1528
|
+
if (pathExists2(candidate)) return candidate;
|
|
1523
1529
|
}
|
|
1524
1530
|
return null;
|
|
1525
1531
|
}
|
|
@@ -1836,22 +1842,23 @@ var init_link_rebaser = __esm({
|
|
|
1836
1842
|
init_link_token_context();
|
|
1837
1843
|
}
|
|
1838
1844
|
});
|
|
1839
|
-
function pathVariants(path) {
|
|
1840
|
-
const variants = [normalize(path)];
|
|
1845
|
+
function pathVariants(api, path) {
|
|
1846
|
+
const variants = [api.normalize(path)];
|
|
1841
1847
|
if (!existsSync(path)) return variants;
|
|
1842
1848
|
try {
|
|
1843
1849
|
const realPaths = [realpathSync(path), realpathSync.native(path)];
|
|
1844
1850
|
for (const realPath of realPaths) {
|
|
1845
|
-
const normalized = normalize(realPath);
|
|
1851
|
+
const normalized = api.normalize(realPath);
|
|
1846
1852
|
if (!variants.includes(normalized)) variants.push(normalized);
|
|
1847
1853
|
}
|
|
1848
1854
|
} catch {
|
|
1849
1855
|
}
|
|
1850
1856
|
return variants;
|
|
1851
1857
|
}
|
|
1852
|
-
async function createImportReferenceNormalizer(
|
|
1858
|
+
async function createImportReferenceNormalizer(target14, projectRoot, scope = "project") {
|
|
1859
|
+
const api = pathApi(projectRoot);
|
|
1853
1860
|
const refs = /* @__PURE__ */ new Map();
|
|
1854
|
-
const targets = Array.from(/* @__PURE__ */ new Set([
|
|
1861
|
+
const targets = Array.from(/* @__PURE__ */ new Set([target14, ...TARGET_IDS]));
|
|
1855
1862
|
for (const candidate of targets) {
|
|
1856
1863
|
const candidateRefs = await buildImportReferenceMap(candidate, projectRoot, scope);
|
|
1857
1864
|
for (const [targetPath, canonicalPath] of candidateRefs.entries()) {
|
|
@@ -1860,17 +1867,17 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
|
|
|
1860
1867
|
}
|
|
1861
1868
|
const artifactMap = /* @__PURE__ */ new Map();
|
|
1862
1869
|
for (const [targetPath, canonicalPath] of refs.entries()) {
|
|
1863
|
-
const canonicalAbsPath = normalize(join(projectRoot, canonicalPath));
|
|
1864
|
-
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))) {
|
|
1865
1872
|
artifactMap.set(variant, canonicalAbsPath);
|
|
1866
1873
|
}
|
|
1867
1874
|
}
|
|
1868
1875
|
const canonicalDestAbs = /* @__PURE__ */ new Set();
|
|
1869
1876
|
for (const canonicalPath of new Set(refs.values())) {
|
|
1870
|
-
const abs = normalize(join(projectRoot, canonicalPath));
|
|
1877
|
+
const abs = api.normalize(api.join(projectRoot, canonicalPath));
|
|
1871
1878
|
canonicalDestAbs.add(abs);
|
|
1872
|
-
for (const variant of pathVariants(abs)) {
|
|
1873
|
-
canonicalDestAbs.add(normalize(variant));
|
|
1879
|
+
for (const variant of pathVariants(api, abs)) {
|
|
1880
|
+
canonicalDestAbs.add(api.normalize(variant));
|
|
1874
1881
|
}
|
|
1875
1882
|
}
|
|
1876
1883
|
return (content, sourceFile, destinationFile) => rewriteFileLinks({
|
|
@@ -1880,7 +1887,7 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
|
|
|
1880
1887
|
destinationFile,
|
|
1881
1888
|
translatePath: (absolutePath) => artifactMap.get(absolutePath) ?? absolutePath,
|
|
1882
1889
|
pathExists: (absolutePath) => {
|
|
1883
|
-
const normalized = normalize(absolutePath);
|
|
1890
|
+
const normalized = api.normalize(absolutePath);
|
|
1884
1891
|
return artifactMap.has(absolutePath) || artifactMap.has(normalized) || existsSync(absolutePath) || canonicalDestAbs.has(normalized);
|
|
1885
1892
|
},
|
|
1886
1893
|
explicitCurrentDirLinks: false,
|
|
@@ -1897,11 +1904,43 @@ async function createImportReferenceNormalizer(target13, projectRoot, scope = "p
|
|
|
1897
1904
|
}
|
|
1898
1905
|
var init_import_rewriter = __esm({
|
|
1899
1906
|
"src/core/reference/import-rewriter.ts"() {
|
|
1907
|
+
init_path_helpers();
|
|
1900
1908
|
init_import_map();
|
|
1901
1909
|
init_link_rebaser();
|
|
1902
1910
|
init_target_ids();
|
|
1903
1911
|
}
|
|
1904
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
|
+
});
|
|
1905
1944
|
|
|
1906
1945
|
// src/targets/import/shared-import-helpers.ts
|
|
1907
1946
|
function toGlobsArray(v) {
|
|
@@ -2214,11 +2253,9 @@ async function runMcpJson(spec, sources, projectRoot, fromTool) {
|
|
|
2214
2253
|
const srcPath = join(projectRoot, rel2);
|
|
2215
2254
|
const content = await readFileSafe(srcPath);
|
|
2216
2255
|
if (content === null) continue;
|
|
2217
|
-
const
|
|
2218
|
-
if (Object.keys(
|
|
2219
|
-
|
|
2220
|
-
await mkdirp(dirname(destPath));
|
|
2221
|
-
await writeFileAtomic(destPath, JSON.stringify({ mcpServers: servers }, null, 2));
|
|
2256
|
+
const imported = parseMcpJson(content);
|
|
2257
|
+
if (Object.keys(imported).length === 0) return [];
|
|
2258
|
+
await writeMcpWithMerge(projectRoot, canonicalPath, imported);
|
|
2222
2259
|
return [{ fromTool, fromPath: srcPath, toPath: canonicalPath, feature: spec.feature }];
|
|
2223
2260
|
}
|
|
2224
2261
|
return [];
|
|
@@ -2254,14 +2291,14 @@ function specsForFeature(importer, feature) {
|
|
|
2254
2291
|
if (Array.isArray(value)) return value;
|
|
2255
2292
|
return [value];
|
|
2256
2293
|
}
|
|
2257
|
-
async function runDescriptorImport(
|
|
2258
|
-
const importer =
|
|
2294
|
+
async function runDescriptorImport(descriptor14, projectRoot, scope, options) {
|
|
2295
|
+
const importer = descriptor14.importer;
|
|
2259
2296
|
if (!importer) return [];
|
|
2260
|
-
const normalize = options?.normalize ?? await createImportReferenceNormalizer(
|
|
2297
|
+
const normalize = options?.normalize ?? await createImportReferenceNormalizer(descriptor14.id, projectRoot, scope);
|
|
2261
2298
|
const results = [];
|
|
2262
2299
|
for (const feature of IMPORT_FEATURE_ORDER) {
|
|
2263
2300
|
for (const spec of specsForFeature(importer, feature)) {
|
|
2264
|
-
results.push(...await runSpec(spec, scope, projectRoot,
|
|
2301
|
+
results.push(...await runSpec(spec, scope, projectRoot, descriptor14.id, normalize));
|
|
2265
2302
|
}
|
|
2266
2303
|
}
|
|
2267
2304
|
return results;
|
|
@@ -2270,6 +2307,7 @@ var init_descriptor_import_runner = __esm({
|
|
|
2270
2307
|
"src/targets/import/descriptor-import-runner.ts"() {
|
|
2271
2308
|
init_import_rewriter();
|
|
2272
2309
|
init_fs();
|
|
2310
|
+
init_mcp_merge();
|
|
2273
2311
|
init_markdown();
|
|
2274
2312
|
init_shared_import_helpers();
|
|
2275
2313
|
init_import_metadata();
|
|
@@ -2725,22 +2763,22 @@ var init_projected_agent_skill = __esm({
|
|
|
2725
2763
|
}
|
|
2726
2764
|
});
|
|
2727
2765
|
function rel(projectRoot, absPath) {
|
|
2728
|
-
return relative(projectRoot, absPath).replace(/\\/g, "/");
|
|
2766
|
+
return pathApi(projectRoot).relative(projectRoot, absPath).replace(/\\/g, "/");
|
|
2729
2767
|
}
|
|
2730
2768
|
async function listFiles(projectRoot, dir) {
|
|
2731
|
-
return readDirRecursive(join(projectRoot, dir)).catch(() => []);
|
|
2769
|
+
return readDirRecursive(pathApi(projectRoot).join(projectRoot, dir)).catch(() => []);
|
|
2732
2770
|
}
|
|
2733
2771
|
function addDirectoryMapping(refs, from, to) {
|
|
2734
2772
|
refs.set(from, to);
|
|
2735
2773
|
refs.set(`${from}/`, `${to}/`);
|
|
2736
2774
|
}
|
|
2737
2775
|
function addAncestorMappings(refs, fromPath, toPath, stopDir) {
|
|
2738
|
-
let fromDir = dirname(fromPath);
|
|
2739
|
-
let toDir = dirname(toPath);
|
|
2776
|
+
let fromDir = posix.dirname(fromPath);
|
|
2777
|
+
let toDir = posix.dirname(toPath);
|
|
2740
2778
|
while (fromDir !== stopDir && fromDir !== ".") {
|
|
2741
2779
|
addDirectoryMapping(refs, fromDir, toDir);
|
|
2742
|
-
fromDir = dirname(fromDir);
|
|
2743
|
-
toDir = dirname(toDir);
|
|
2780
|
+
fromDir = posix.dirname(fromDir);
|
|
2781
|
+
toDir = posix.dirname(toDir);
|
|
2744
2782
|
}
|
|
2745
2783
|
}
|
|
2746
2784
|
function addSimpleFileMapping(refs, fromPath, canonicalDir, extension) {
|
|
@@ -2784,18 +2822,18 @@ async function targetRootSegments() {
|
|
|
2784
2822
|
if (targetRootSegmentsCache !== void 0) return targetRootSegmentsCache;
|
|
2785
2823
|
const { BUILTIN_TARGETS: BUILTIN_TARGETS2 } = await Promise.resolve().then(() => (init_builtin_targets(), builtin_targets_exports));
|
|
2786
2824
|
const roots = /* @__PURE__ */ new Set();
|
|
2787
|
-
for (const
|
|
2825
|
+
for (const descriptor14 of BUILTIN_TARGETS2) {
|
|
2788
2826
|
for (const path of [
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
...
|
|
2792
|
-
...
|
|
2793
|
-
...
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
...
|
|
2797
|
-
...
|
|
2798
|
-
...
|
|
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 ?? []
|
|
2799
2837
|
]) {
|
|
2800
2838
|
if (path !== void 0) {
|
|
2801
2839
|
const segment = firstPathSegment(path);
|
|
@@ -2812,8 +2850,9 @@ function hasHiddenSegment(relPath) {
|
|
|
2812
2850
|
async function listScopedAgentsFiles(projectRoot) {
|
|
2813
2851
|
const files = [];
|
|
2814
2852
|
const targetRootSegmentsSet = await targetRootSegments();
|
|
2853
|
+
const api = pathApi(projectRoot);
|
|
2815
2854
|
async function walk(relDir) {
|
|
2816
|
-
const absDir = join(projectRoot, relDir);
|
|
2855
|
+
const absDir = api.join(projectRoot, relDir);
|
|
2817
2856
|
const entries = await readdir(absDir, { withFileTypes: true }).catch(() => []);
|
|
2818
2857
|
for (const entry of entries) {
|
|
2819
2858
|
const relPath = relDir ? `${relDir}/${entry.name}` : entry.name;
|
|
@@ -2822,7 +2861,7 @@ async function listScopedAgentsFiles(projectRoot) {
|
|
|
2822
2861
|
await walk(relPath);
|
|
2823
2862
|
continue;
|
|
2824
2863
|
}
|
|
2825
|
-
if (entry.isSymbolicLink() && await stat(join(projectRoot, relPath)).then(
|
|
2864
|
+
if (entry.isSymbolicLink() && await stat(api.join(projectRoot, relPath)).then(
|
|
2826
2865
|
(info) => info.isDirectory(),
|
|
2827
2866
|
() => false
|
|
2828
2867
|
)) {
|
|
@@ -2831,7 +2870,7 @@ async function listScopedAgentsFiles(projectRoot) {
|
|
|
2831
2870
|
continue;
|
|
2832
2871
|
}
|
|
2833
2872
|
if (entry.name === "AGENTS.md" || entry.name === "AGENTS.override.md") {
|
|
2834
|
-
files.push(join(projectRoot, relPath));
|
|
2873
|
+
files.push(api.join(projectRoot, relPath));
|
|
2835
2874
|
}
|
|
2836
2875
|
}
|
|
2837
2876
|
}
|
|
@@ -2845,7 +2884,7 @@ async function addScopedAgentsMappings(refs, projectRoot) {
|
|
|
2845
2884
|
const isNestedAgents = relPath.endsWith("/AGENTS.md") && relPath !== "AGENTS.md" && !relPath.endsWith("/AGENTS.override.md");
|
|
2846
2885
|
const isNestedOverride = relPath.endsWith("/AGENTS.override.md") && relPath !== "AGENTS.override.md";
|
|
2847
2886
|
if (!isNestedAgents && !isNestedOverride) continue;
|
|
2848
|
-
const parentDir = dirname(relPath);
|
|
2887
|
+
const parentDir = posix.dirname(relPath);
|
|
2849
2888
|
if (hasHiddenSegment(parentDir)) continue;
|
|
2850
2889
|
const ruleName = parentDir.replace(/\//g, "-");
|
|
2851
2890
|
refs.set(relPath, `${AB_RULES}/${ruleName}.md`);
|
|
@@ -2854,6 +2893,7 @@ async function addScopedAgentsMappings(refs, projectRoot) {
|
|
|
2854
2893
|
var AB_RULES, AB_COMMANDS, AB_AGENTS, AB_SKILLS2, targetRootSegmentsCache;
|
|
2855
2894
|
var init_import_map_shared = __esm({
|
|
2856
2895
|
"src/core/reference/import-map-shared.ts"() {
|
|
2896
|
+
init_path_helpers();
|
|
2857
2897
|
init_fs();
|
|
2858
2898
|
init_command_skill();
|
|
2859
2899
|
init_projected_agent_skill();
|
|
@@ -3308,9 +3348,100 @@ var init_junie = __esm({
|
|
|
3308
3348
|
}
|
|
3309
3349
|
});
|
|
3310
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
|
+
|
|
3311
3442
|
// src/targets/kiro/constants.ts
|
|
3312
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;
|
|
3313
|
-
var
|
|
3444
|
+
var init_constants9 = __esm({
|
|
3314
3445
|
"src/targets/kiro/constants.ts"() {
|
|
3315
3446
|
KIRO_TARGET = "kiro";
|
|
3316
3447
|
KIRO_AGENTS_MD = "AGENTS.md";
|
|
@@ -3369,14 +3500,14 @@ async function buildKiroImportPaths(refs, projectRoot, scope = "project") {
|
|
|
3369
3500
|
var init_kiro = __esm({
|
|
3370
3501
|
"src/core/reference/import-maps/kiro.ts"() {
|
|
3371
3502
|
init_import_map_shared();
|
|
3372
|
-
|
|
3503
|
+
init_constants9();
|
|
3373
3504
|
init_constants2();
|
|
3374
3505
|
}
|
|
3375
3506
|
});
|
|
3376
3507
|
|
|
3377
3508
|
// src/targets/roo-code/constants.ts
|
|
3378
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;
|
|
3379
|
-
var
|
|
3510
|
+
var init_constants10 = __esm({
|
|
3380
3511
|
"src/targets/roo-code/constants.ts"() {
|
|
3381
3512
|
ROO_CODE_TARGET = "roo-code";
|
|
3382
3513
|
ROO_CODE_DIR = ".roo";
|
|
@@ -3443,7 +3574,7 @@ async function buildRooCodeImportPaths(refs, projectRoot, scope = "project") {
|
|
|
3443
3574
|
var init_roo_code = __esm({
|
|
3444
3575
|
"src/core/reference/import-maps/roo-code.ts"() {
|
|
3445
3576
|
init_import_map_shared();
|
|
3446
|
-
|
|
3577
|
+
init_constants10();
|
|
3447
3578
|
init_constants2();
|
|
3448
3579
|
}
|
|
3449
3580
|
});
|
|
@@ -3482,6 +3613,7 @@ var init_import_maps = __esm({
|
|
|
3482
3613
|
init_cursor();
|
|
3483
3614
|
init_gemini_cli();
|
|
3484
3615
|
init_junie();
|
|
3616
|
+
init_kilo_code();
|
|
3485
3617
|
init_kiro();
|
|
3486
3618
|
init_roo_code();
|
|
3487
3619
|
init_windsurf();
|
|
@@ -3973,10 +4105,8 @@ async function importSettings(projectRoot, results) {
|
|
|
3973
4105
|
}
|
|
3974
4106
|
const alreadyImportedMcp = results.some((r) => r.feature === "mcp");
|
|
3975
4107
|
if (!alreadyImportedMcp && settings.mcpServers && typeof settings.mcpServers === "object") {
|
|
3976
|
-
const
|
|
3977
|
-
|
|
3978
|
-
await mkdirp(dirname(destPath));
|
|
3979
|
-
await writeFileAtomic(destPath, mcpContent);
|
|
4108
|
+
const mcpServers = settings.mcpServers;
|
|
4109
|
+
await writeMcpWithMerge(projectRoot, CLAUDE_CANONICAL_MCP, mcpServers);
|
|
3980
4110
|
results.push({
|
|
3981
4111
|
fromTool: "claude-code",
|
|
3982
4112
|
fromPath: settingsPath,
|
|
@@ -4024,6 +4154,7 @@ var init_settings_helpers = __esm({
|
|
|
4024
4154
|
"src/targets/claude-code/settings-helpers.ts"() {
|
|
4025
4155
|
init_hook_command();
|
|
4026
4156
|
init_fs();
|
|
4157
|
+
init_mcp_merge();
|
|
4027
4158
|
init_constants3();
|
|
4028
4159
|
}
|
|
4029
4160
|
});
|
|
@@ -4983,11 +5114,11 @@ var init_linter3 = __esm({
|
|
|
4983
5114
|
});
|
|
4984
5115
|
|
|
4985
5116
|
// src/core/lint/shared/helpers.ts
|
|
4986
|
-
function createWarning(file,
|
|
5117
|
+
function createWarning(file, target14, message) {
|
|
4987
5118
|
return {
|
|
4988
5119
|
level: "warning",
|
|
4989
5120
|
file,
|
|
4990
|
-
target:
|
|
5121
|
+
target: target14,
|
|
4991
5122
|
message
|
|
4992
5123
|
};
|
|
4993
5124
|
}
|
|
@@ -4997,12 +5128,12 @@ function formatOxfordComma(items) {
|
|
|
4997
5128
|
if (items.length === 2) return `${items[0]} and ${items[1]}`;
|
|
4998
5129
|
return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
|
|
4999
5130
|
}
|
|
5000
|
-
function createUnsupportedHookWarning(event,
|
|
5001
|
-
const by = options?.unsupportedBy ??
|
|
5131
|
+
function createUnsupportedHookWarning(event, target14, supportedEvents, options) {
|
|
5132
|
+
const by = options?.unsupportedBy ?? target14;
|
|
5002
5133
|
const supported = formatOxfordComma(supportedEvents);
|
|
5003
5134
|
return createWarning(
|
|
5004
5135
|
".agentsmesh/hooks.yaml",
|
|
5005
|
-
|
|
5136
|
+
target14,
|
|
5006
5137
|
`${event} is not supported by ${by}; only ${supported} are projected.`
|
|
5007
5138
|
);
|
|
5008
5139
|
}
|
|
@@ -5186,7 +5317,7 @@ var init_cline2 = __esm({
|
|
|
5186
5317
|
|
|
5187
5318
|
// src/targets/codex-cli/constants.ts
|
|
5188
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;
|
|
5189
|
-
var
|
|
5320
|
+
var init_constants11 = __esm({
|
|
5190
5321
|
"src/targets/codex-cli/constants.ts"() {
|
|
5191
5322
|
CODEX_TARGET = "codex-cli";
|
|
5192
5323
|
CODEX_MD = "codex.md";
|
|
@@ -5249,7 +5380,7 @@ function summarizeRule(rule) {
|
|
|
5249
5380
|
scopes.push(`Enforced in \`${CODEX_RULES_DIR}/${ruleSlug2(rule.source)}.rules\`.`);
|
|
5250
5381
|
}
|
|
5251
5382
|
if (rule.targets.length > 0) {
|
|
5252
|
-
scopes.push(`Targeted to ${rule.targets.map((
|
|
5383
|
+
scopes.push(`Targeted to ${rule.targets.map((target14) => `\`${target14}\``).join(", ")}.`);
|
|
5253
5384
|
}
|
|
5254
5385
|
return scopes.join(" ");
|
|
5255
5386
|
}
|
|
@@ -5279,7 +5410,7 @@ function stripCodexRuleIndex(content) {
|
|
|
5279
5410
|
var init_instruction_mirror = __esm({
|
|
5280
5411
|
"src/targets/codex-cli/instruction-mirror.ts"() {
|
|
5281
5412
|
init_markdown();
|
|
5282
|
-
|
|
5413
|
+
init_constants11();
|
|
5283
5414
|
}
|
|
5284
5415
|
});
|
|
5285
5416
|
function looksLikeCodexRulesDsl(body) {
|
|
@@ -5345,7 +5476,7 @@ function renderCodexGlobalInstructions(canonical) {
|
|
|
5345
5476
|
var init_rules = __esm({
|
|
5346
5477
|
"src/targets/codex-cli/generator/rules.ts"() {
|
|
5347
5478
|
init_managed_blocks();
|
|
5348
|
-
|
|
5479
|
+
init_constants11();
|
|
5349
5480
|
init_instruction_mirror();
|
|
5350
5481
|
}
|
|
5351
5482
|
});
|
|
@@ -5386,7 +5517,7 @@ function generateCommands4(canonical) {
|
|
|
5386
5517
|
var init_skills = __esm({
|
|
5387
5518
|
"src/targets/codex-cli/generator/skills.ts"() {
|
|
5388
5519
|
init_markdown();
|
|
5389
|
-
|
|
5520
|
+
init_constants11();
|
|
5390
5521
|
init_command_skill();
|
|
5391
5522
|
}
|
|
5392
5523
|
});
|
|
@@ -5427,7 +5558,7 @@ ${body}
|
|
|
5427
5558
|
}
|
|
5428
5559
|
var init_agents = __esm({
|
|
5429
5560
|
"src/targets/codex-cli/generator/agents.ts"() {
|
|
5430
|
-
|
|
5561
|
+
init_constants11();
|
|
5431
5562
|
}
|
|
5432
5563
|
});
|
|
5433
5564
|
|
|
@@ -5479,7 +5610,7 @@ function needsTomlQuoting(key) {
|
|
|
5479
5610
|
var init_mcp = __esm({
|
|
5480
5611
|
"src/targets/codex-cli/generator/mcp.ts"() {
|
|
5481
5612
|
init_mcp_servers();
|
|
5482
|
-
|
|
5613
|
+
init_constants11();
|
|
5483
5614
|
}
|
|
5484
5615
|
});
|
|
5485
5616
|
|
|
@@ -5538,11 +5669,7 @@ async function importMcp(projectRoot, results) {
|
|
|
5538
5669
|
if (server) mcpServers[name] = server;
|
|
5539
5670
|
}
|
|
5540
5671
|
if (Object.keys(mcpServers).length === 0) return;
|
|
5541
|
-
await
|
|
5542
|
-
await writeFileAtomic(
|
|
5543
|
-
join(projectRoot, CODEX_CANONICAL_MCP),
|
|
5544
|
-
JSON.stringify({ mcpServers }, null, 2)
|
|
5545
|
-
);
|
|
5672
|
+
await writeMcpWithMerge(projectRoot, CODEX_CANONICAL_MCP, mcpServers);
|
|
5546
5673
|
results.push({
|
|
5547
5674
|
fromTool: CODEX_TARGET,
|
|
5548
5675
|
fromPath: configPath,
|
|
@@ -5553,7 +5680,8 @@ async function importMcp(projectRoot, results) {
|
|
|
5553
5680
|
var init_mcp_helpers = __esm({
|
|
5554
5681
|
"src/targets/codex-cli/mcp-helpers.ts"() {
|
|
5555
5682
|
init_fs();
|
|
5556
|
-
|
|
5683
|
+
init_mcp_merge();
|
|
5684
|
+
init_constants11();
|
|
5557
5685
|
}
|
|
5558
5686
|
});
|
|
5559
5687
|
function shouldImportScopedAgentsRule(relDir) {
|
|
@@ -5647,7 +5775,7 @@ var init_skills_adapter2 = __esm({
|
|
|
5647
5775
|
init_projected_agent_skill();
|
|
5648
5776
|
init_scoped_agents_import();
|
|
5649
5777
|
init_skill_import_pipeline();
|
|
5650
|
-
|
|
5778
|
+
init_constants11();
|
|
5651
5779
|
}
|
|
5652
5780
|
});
|
|
5653
5781
|
async function importCodexAgentsFromToml(projectRoot, results, normalize) {
|
|
@@ -5700,7 +5828,7 @@ var init_importer_agents = __esm({
|
|
|
5700
5828
|
"src/targets/codex-cli/importer-agents.ts"() {
|
|
5701
5829
|
init_fs();
|
|
5702
5830
|
init_projected_agent_skill();
|
|
5703
|
-
|
|
5831
|
+
init_constants11();
|
|
5704
5832
|
}
|
|
5705
5833
|
});
|
|
5706
5834
|
function tryParseEmbeddedCanonicalFromCodexRules(content) {
|
|
@@ -5743,7 +5871,7 @@ function tryParseEmbeddedCanonicalFromCodexRules(content) {
|
|
|
5743
5871
|
}
|
|
5744
5872
|
var init_codex_rules_embed = __esm({
|
|
5745
5873
|
"src/targets/codex-cli/codex-rules-embed.ts"() {
|
|
5746
|
-
|
|
5874
|
+
init_constants11();
|
|
5747
5875
|
}
|
|
5748
5876
|
});
|
|
5749
5877
|
async function importCodexNonRootRuleFiles(projectRoot, destDir, normalize) {
|
|
@@ -5817,7 +5945,7 @@ var init_import_codex_non_root_rules = __esm({
|
|
|
5817
5945
|
init_fs();
|
|
5818
5946
|
init_markdown();
|
|
5819
5947
|
init_import_metadata();
|
|
5820
|
-
|
|
5948
|
+
init_constants11();
|
|
5821
5949
|
init_codex_rules_embed();
|
|
5822
5950
|
}
|
|
5823
5951
|
});
|
|
@@ -5939,7 +6067,7 @@ var init_importer_rules2 = __esm({
|
|
|
5939
6067
|
init_embedded_rules();
|
|
5940
6068
|
init_import_orchestrator();
|
|
5941
6069
|
init_scoped_agents_import();
|
|
5942
|
-
|
|
6070
|
+
init_constants11();
|
|
5943
6071
|
init_import_codex_non_root_rules();
|
|
5944
6072
|
init_instruction_mirror();
|
|
5945
6073
|
}
|
|
@@ -5964,7 +6092,7 @@ async function importFromCodex(projectRoot, options) {
|
|
|
5964
6092
|
var init_importer4 = __esm({
|
|
5965
6093
|
"src/targets/codex-cli/importer.ts"() {
|
|
5966
6094
|
init_import_rewriter();
|
|
5967
|
-
|
|
6095
|
+
init_constants11();
|
|
5968
6096
|
init_mcp_helpers();
|
|
5969
6097
|
init_skills_adapter2();
|
|
5970
6098
|
init_importer_agents();
|
|
@@ -5989,7 +6117,7 @@ function lintRules4(canonical, projectRoot, _projectFiles) {
|
|
|
5989
6117
|
}
|
|
5990
6118
|
var init_linter4 = __esm({
|
|
5991
6119
|
"src/targets/codex-cli/linter.ts"() {
|
|
5992
|
-
|
|
6120
|
+
init_constants11();
|
|
5993
6121
|
}
|
|
5994
6122
|
});
|
|
5995
6123
|
|
|
@@ -6039,7 +6167,7 @@ var target4, project4, global3, globalCapabilities4, descriptor4;
|
|
|
6039
6167
|
var init_codex_cli2 = __esm({
|
|
6040
6168
|
"src/targets/codex-cli/index.ts"() {
|
|
6041
6169
|
init_generator5();
|
|
6042
|
-
|
|
6170
|
+
init_constants11();
|
|
6043
6171
|
init_importer4();
|
|
6044
6172
|
init_linter4();
|
|
6045
6173
|
init_lint2();
|
|
@@ -6303,10 +6431,7 @@ async function importMcp2(projectRoot, results) {
|
|
|
6303
6431
|
importedFrom.push(srcPath);
|
|
6304
6432
|
}
|
|
6305
6433
|
if (Object.keys(merged).length === 0) return;
|
|
6306
|
-
await
|
|
6307
|
-
join(projectRoot, CONTINUE_CANONICAL_MCP),
|
|
6308
|
-
JSON.stringify({ mcpServers: merged }, null, 2)
|
|
6309
|
-
);
|
|
6434
|
+
await writeMcpWithMerge(projectRoot, CONTINUE_CANONICAL_MCP, merged);
|
|
6310
6435
|
for (const fromPath of importedFrom) {
|
|
6311
6436
|
results.push({
|
|
6312
6437
|
fromTool: CONTINUE_TARGET,
|
|
@@ -6330,6 +6455,7 @@ var init_importer5 = __esm({
|
|
|
6330
6455
|
init_fs();
|
|
6331
6456
|
init_embedded_skill();
|
|
6332
6457
|
init_descriptor_import_runner();
|
|
6458
|
+
init_mcp_merge();
|
|
6333
6459
|
init_shared_import_helpers();
|
|
6334
6460
|
init_constants5();
|
|
6335
6461
|
init_continue2();
|
|
@@ -6660,7 +6786,7 @@ var init_continue2 = __esm({
|
|
|
6660
6786
|
|
|
6661
6787
|
// src/targets/copilot/constants.ts
|
|
6662
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;
|
|
6663
|
-
var
|
|
6789
|
+
var init_constants12 = __esm({
|
|
6664
6790
|
"src/targets/copilot/constants.ts"() {
|
|
6665
6791
|
COPILOT_TARGET = "copilot";
|
|
6666
6792
|
COPILOT_INSTRUCTIONS = ".github/copilot-instructions.md";
|
|
@@ -6725,7 +6851,7 @@ function parseCommandPromptFrontmatter(frontmatter, promptPath) {
|
|
|
6725
6851
|
var init_command_prompt = __esm({
|
|
6726
6852
|
"src/targets/copilot/command-prompt.ts"() {
|
|
6727
6853
|
init_markdown();
|
|
6728
|
-
|
|
6854
|
+
init_constants12();
|
|
6729
6855
|
}
|
|
6730
6856
|
});
|
|
6731
6857
|
|
|
@@ -6877,7 +7003,7 @@ function generateHooks3(canonical) {
|
|
|
6877
7003
|
var init_generator7 = __esm({
|
|
6878
7004
|
"src/targets/copilot/generator.ts"() {
|
|
6879
7005
|
init_markdown();
|
|
6880
|
-
|
|
7006
|
+
init_constants12();
|
|
6881
7007
|
init_command_prompt();
|
|
6882
7008
|
init_hook_entry();
|
|
6883
7009
|
}
|
|
@@ -6971,7 +7097,7 @@ async function importHooks(projectRoot, results) {
|
|
|
6971
7097
|
var init_hook_parser = __esm({
|
|
6972
7098
|
"src/targets/copilot/hook-parser.ts"() {
|
|
6973
7099
|
init_fs();
|
|
6974
|
-
|
|
7100
|
+
init_constants12();
|
|
6975
7101
|
}
|
|
6976
7102
|
});
|
|
6977
7103
|
async function importSkills2(projectRoot, results, normalize, skillsDirRel = COPILOT_SKILLS_DIR) {
|
|
@@ -6992,7 +7118,7 @@ async function importSkills2(projectRoot, results, normalize, skillsDirRel = COP
|
|
|
6992
7118
|
var init_skills_adapter3 = __esm({
|
|
6993
7119
|
"src/targets/copilot/skills-adapter.ts"() {
|
|
6994
7120
|
init_skill_import_pipeline();
|
|
6995
|
-
|
|
7121
|
+
init_constants12();
|
|
6996
7122
|
}
|
|
6997
7123
|
});
|
|
6998
7124
|
|
|
@@ -7015,7 +7141,7 @@ var init_importer6 = __esm({
|
|
|
7015
7141
|
"src/targets/copilot/importer.ts"() {
|
|
7016
7142
|
init_import_rewriter();
|
|
7017
7143
|
init_descriptor_import_runner();
|
|
7018
|
-
|
|
7144
|
+
init_constants12();
|
|
7019
7145
|
init_hook_parser();
|
|
7020
7146
|
init_skills_adapter3();
|
|
7021
7147
|
init_copilot2();
|
|
@@ -7034,7 +7160,7 @@ var init_import_mappers4 = __esm({
|
|
|
7034
7160
|
init_import_metadata();
|
|
7035
7161
|
init_shared_import_helpers();
|
|
7036
7162
|
init_command_prompt();
|
|
7037
|
-
|
|
7163
|
+
init_constants12();
|
|
7038
7164
|
copilotLegacyRuleMapper = async ({
|
|
7039
7165
|
relativePath,
|
|
7040
7166
|
normalizeTo,
|
|
@@ -7151,7 +7277,7 @@ function lintRules6(canonical, projectRoot, projectFiles, options) {
|
|
|
7151
7277
|
var init_linter6 = __esm({
|
|
7152
7278
|
"src/targets/copilot/linter.ts"() {
|
|
7153
7279
|
init_validate_rules();
|
|
7154
|
-
|
|
7280
|
+
init_constants12();
|
|
7155
7281
|
}
|
|
7156
7282
|
});
|
|
7157
7283
|
|
|
@@ -7268,7 +7394,7 @@ var SCRIPT_PREFIX_RE;
|
|
|
7268
7394
|
var init_hook_assets = __esm({
|
|
7269
7395
|
"src/targets/copilot/hook-assets.ts"() {
|
|
7270
7396
|
init_fs();
|
|
7271
|
-
|
|
7397
|
+
init_constants12();
|
|
7272
7398
|
init_hook_entry();
|
|
7273
7399
|
SCRIPT_PREFIX_RE = /^(?<prefix>\s*(?:(?:bash|sh|zsh)\s+)?)["']?(?<path>(?:\.\.\/|\.\/|[^/\s"'`]+\/)[^\s"'`]+)["']?(?<suffix>(?:\s.*)?)$/;
|
|
7274
7400
|
}
|
|
@@ -7282,7 +7408,7 @@ var generateCopilotGlobalExtras;
|
|
|
7282
7408
|
var init_scope_extras2 = __esm({
|
|
7283
7409
|
"src/targets/copilot/scope-extras.ts"() {
|
|
7284
7410
|
init_fs();
|
|
7285
|
-
|
|
7411
|
+
init_constants12();
|
|
7286
7412
|
generateCopilotGlobalExtras = async (canonical, projectRoot, scope, enabledFeatures) => {
|
|
7287
7413
|
if (scope !== "global" || !enabledFeatures.has("rules")) return [];
|
|
7288
7414
|
const root = canonical.rules.find((r) => r.root);
|
|
@@ -7305,7 +7431,7 @@ var target6, project6, global4, globalCapabilities6, descriptor6;
|
|
|
7305
7431
|
var init_copilot2 = __esm({
|
|
7306
7432
|
"src/targets/copilot/index.ts"() {
|
|
7307
7433
|
init_generator7();
|
|
7308
|
-
|
|
7434
|
+
init_constants12();
|
|
7309
7435
|
init_importer6();
|
|
7310
7436
|
init_import_mappers4();
|
|
7311
7437
|
init_linter6();
|
|
@@ -8074,8 +8200,8 @@ async function hasGlobalCursorArtifacts(projectRoot) {
|
|
|
8074
8200
|
join(projectRoot, CURSOR_COMMANDS_DIR)
|
|
8075
8201
|
];
|
|
8076
8202
|
for (const p of candidates) {
|
|
8077
|
-
const
|
|
8078
|
-
if (
|
|
8203
|
+
const stat7 = await readFileSafe(p);
|
|
8204
|
+
if (stat7 !== null && stat7.trim() !== "") return true;
|
|
8079
8205
|
}
|
|
8080
8206
|
const skillFiles = await readDirRecursive(join(projectRoot, CURSOR_GLOBAL_SKILLS_DIR));
|
|
8081
8207
|
if (skillFiles.some((f) => f.endsWith(".md"))) return true;
|
|
@@ -8233,9 +8359,8 @@ async function importMcp3(projectRoot, results) {
|
|
|
8233
8359
|
return;
|
|
8234
8360
|
}
|
|
8235
8361
|
if (!parsed || typeof parsed !== "object" || !("mcpServers" in parsed)) return;
|
|
8236
|
-
const
|
|
8237
|
-
await
|
|
8238
|
-
await writeFileAtomic(destPath, content);
|
|
8362
|
+
const servers = parsed.mcpServers;
|
|
8363
|
+
await writeMcpWithMerge(projectRoot, CURSOR_CANONICAL_MCP, servers);
|
|
8239
8364
|
results.push({
|
|
8240
8365
|
fromTool: "cursor",
|
|
8241
8366
|
fromPath: mcpPath,
|
|
@@ -8262,6 +8387,7 @@ var init_importer7 = __esm({
|
|
|
8262
8387
|
init_import_rewriter();
|
|
8263
8388
|
init_fs();
|
|
8264
8389
|
init_descriptor_import_runner();
|
|
8390
|
+
init_mcp_merge();
|
|
8265
8391
|
init_importer_rules3();
|
|
8266
8392
|
init_settings_helpers2();
|
|
8267
8393
|
init_skills_adapter4();
|
|
@@ -8563,7 +8689,7 @@ var init_cursor2 = __esm({
|
|
|
8563
8689
|
|
|
8564
8690
|
// src/targets/gemini-cli/constants.ts
|
|
8565
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;
|
|
8566
|
-
var
|
|
8692
|
+
var init_constants13 = __esm({
|
|
8567
8693
|
"src/targets/gemini-cli/constants.ts"() {
|
|
8568
8694
|
GEMINI_TARGET = "gemini-cli";
|
|
8569
8695
|
GEMINI_ROOT = "GEMINI.md";
|
|
@@ -8615,7 +8741,7 @@ function generateRules8(canonical) {
|
|
|
8615
8741
|
var init_rules3 = __esm({
|
|
8616
8742
|
"src/targets/gemini-cli/generator/rules.ts"() {
|
|
8617
8743
|
init_managed_blocks();
|
|
8618
|
-
|
|
8744
|
+
init_constants13();
|
|
8619
8745
|
}
|
|
8620
8746
|
});
|
|
8621
8747
|
function canonicalCommandNameToGeminiTomlPath(cmdName, commandsDir) {
|
|
@@ -8655,7 +8781,7 @@ function generateCommands8(canonical) {
|
|
|
8655
8781
|
}
|
|
8656
8782
|
var init_commands2 = __esm({
|
|
8657
8783
|
"src/targets/gemini-cli/generator/commands.ts"() {
|
|
8658
|
-
|
|
8784
|
+
init_constants13();
|
|
8659
8785
|
init_command_namespace();
|
|
8660
8786
|
}
|
|
8661
8787
|
});
|
|
@@ -8683,7 +8809,7 @@ function generateAgents6(canonical) {
|
|
|
8683
8809
|
var init_agents3 = __esm({
|
|
8684
8810
|
"src/targets/gemini-cli/generator/agents.ts"() {
|
|
8685
8811
|
init_markdown();
|
|
8686
|
-
|
|
8812
|
+
init_constants13();
|
|
8687
8813
|
}
|
|
8688
8814
|
});
|
|
8689
8815
|
|
|
@@ -8714,7 +8840,7 @@ function generateSkills8(canonical) {
|
|
|
8714
8840
|
var init_skills3 = __esm({
|
|
8715
8841
|
"src/targets/gemini-cli/generator/skills.ts"() {
|
|
8716
8842
|
init_markdown();
|
|
8717
|
-
|
|
8843
|
+
init_constants13();
|
|
8718
8844
|
}
|
|
8719
8845
|
});
|
|
8720
8846
|
|
|
@@ -8775,7 +8901,7 @@ function generateGeminiSettingsFiles(canonical) {
|
|
|
8775
8901
|
var init_settings = __esm({
|
|
8776
8902
|
"src/targets/gemini-cli/generator/settings.ts"() {
|
|
8777
8903
|
init_hook_command();
|
|
8778
|
-
|
|
8904
|
+
init_constants13();
|
|
8779
8905
|
}
|
|
8780
8906
|
});
|
|
8781
8907
|
|
|
@@ -8786,7 +8912,7 @@ function generateIgnore4(canonical) {
|
|
|
8786
8912
|
}
|
|
8787
8913
|
var init_ignore2 = __esm({
|
|
8788
8914
|
"src/targets/gemini-cli/generator/ignore.ts"() {
|
|
8789
|
-
|
|
8915
|
+
init_constants13();
|
|
8790
8916
|
}
|
|
8791
8917
|
});
|
|
8792
8918
|
|
|
@@ -8887,7 +9013,7 @@ function generateGeminiPermissionsPolicies(canonical) {
|
|
|
8887
9013
|
}
|
|
8888
9014
|
var init_policies_generator = __esm({
|
|
8889
9015
|
"src/targets/gemini-cli/policies-generator.ts"() {
|
|
8890
|
-
|
|
9016
|
+
init_constants13();
|
|
8891
9017
|
}
|
|
8892
9018
|
});
|
|
8893
9019
|
function mapGeminiHookEvent(event) {
|
|
@@ -9015,7 +9141,7 @@ var init_format_helpers_settings = __esm({
|
|
|
9015
9141
|
"src/targets/gemini-cli/format-helpers-settings.ts"() {
|
|
9016
9142
|
init_hook_command();
|
|
9017
9143
|
init_fs();
|
|
9018
|
-
|
|
9144
|
+
init_constants13();
|
|
9019
9145
|
init_format_helpers_shared();
|
|
9020
9146
|
}
|
|
9021
9147
|
});
|
|
@@ -9040,7 +9166,7 @@ async function importGeminiIgnore(projectRoot, results) {
|
|
|
9040
9166
|
var init_format_helpers = __esm({
|
|
9041
9167
|
"src/targets/gemini-cli/format-helpers.ts"() {
|
|
9042
9168
|
init_fs();
|
|
9043
|
-
|
|
9169
|
+
init_constants13();
|
|
9044
9170
|
init_format_helpers_shared();
|
|
9045
9171
|
init_format_helpers_settings();
|
|
9046
9172
|
}
|
|
@@ -9148,7 +9274,7 @@ async function importGeminiPolicies(projectRoot) {
|
|
|
9148
9274
|
var init_policies_importer = __esm({
|
|
9149
9275
|
"src/targets/gemini-cli/policies-importer.ts"() {
|
|
9150
9276
|
init_fs();
|
|
9151
|
-
|
|
9277
|
+
init_constants13();
|
|
9152
9278
|
}
|
|
9153
9279
|
});
|
|
9154
9280
|
function stripProjectRootCanonicalPrefix(content, projectRoot) {
|
|
@@ -9274,7 +9400,7 @@ var init_importer_skills_agents = __esm({
|
|
|
9274
9400
|
init_markdown();
|
|
9275
9401
|
init_import_metadata();
|
|
9276
9402
|
init_projected_agent_skill();
|
|
9277
|
-
|
|
9403
|
+
init_constants13();
|
|
9278
9404
|
}
|
|
9279
9405
|
});
|
|
9280
9406
|
async function importRootRule2(projectRoot, results, normalize) {
|
|
@@ -9350,7 +9476,7 @@ var init_importer8 = __esm({
|
|
|
9350
9476
|
init_import_metadata();
|
|
9351
9477
|
init_embedded_rules();
|
|
9352
9478
|
init_descriptor_import_runner();
|
|
9353
|
-
|
|
9479
|
+
init_constants13();
|
|
9354
9480
|
init_gemini_cli2();
|
|
9355
9481
|
init_format_helpers();
|
|
9356
9482
|
init_policies_importer();
|
|
@@ -9418,7 +9544,7 @@ var init_importer_mappers3 = __esm({
|
|
|
9418
9544
|
init_import_metadata();
|
|
9419
9545
|
init_shared_import_helpers();
|
|
9420
9546
|
init_format_helpers();
|
|
9421
|
-
|
|
9547
|
+
init_constants13();
|
|
9422
9548
|
}
|
|
9423
9549
|
});
|
|
9424
9550
|
|
|
@@ -9442,7 +9568,7 @@ function lintRules8(canonical, projectRoot, projectFiles, options) {
|
|
|
9442
9568
|
var init_linter8 = __esm({
|
|
9443
9569
|
"src/targets/gemini-cli/linter.ts"() {
|
|
9444
9570
|
init_validate_rules();
|
|
9445
|
-
|
|
9571
|
+
init_constants13();
|
|
9446
9572
|
}
|
|
9447
9573
|
});
|
|
9448
9574
|
|
|
@@ -9536,7 +9662,7 @@ var init_gemini_cli2 = __esm({
|
|
|
9536
9662
|
init_generator11();
|
|
9537
9663
|
init_capabilities();
|
|
9538
9664
|
init_policies_generator();
|
|
9539
|
-
|
|
9665
|
+
init_constants13();
|
|
9540
9666
|
init_importer8();
|
|
9541
9667
|
init_import_mappers6();
|
|
9542
9668
|
init_linter8();
|
|
@@ -10110,56 +10236,600 @@ var init_junie2 = __esm({
|
|
|
10110
10236
|
};
|
|
10111
10237
|
}
|
|
10112
10238
|
});
|
|
10113
|
-
function
|
|
10114
|
-
return value.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
10115
|
-
}
|
|
10116
|
-
function hookText(entry) {
|
|
10117
|
-
return entry.type === "prompt" ? entry.prompt : entry.command;
|
|
10118
|
-
}
|
|
10119
|
-
function toWhen(event, matcher) {
|
|
10120
|
-
const type = CANONICAL_TO_KIRO[event];
|
|
10121
|
-
if (event === "PreToolUse" || event === "PostToolUse") {
|
|
10122
|
-
return { type, tools: [matcher || "*"] };
|
|
10123
|
-
}
|
|
10124
|
-
return { type };
|
|
10125
|
-
}
|
|
10126
|
-
function generateKiroHooks(hooks) {
|
|
10239
|
+
function generateRules10(canonical) {
|
|
10127
10240
|
const outputs = [];
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
}
|
|
10145
|
-
|
|
10146
|
-
}
|
|
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
|
+
});
|
|
10147
10260
|
}
|
|
10148
10261
|
return outputs;
|
|
10149
10262
|
}
|
|
10150
|
-
function
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
if (file.then.type === "askAgent" && typeof file.then.prompt === "string") {
|
|
10263
|
+
function generateCommands10(canonical) {
|
|
10264
|
+
return canonical.commands.map((command) => {
|
|
10265
|
+
const frontmatter = {};
|
|
10266
|
+
if (command.description) frontmatter.description = command.description;
|
|
10155
10267
|
return {
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10268
|
+
path: `${KILO_CODE_COMMANDS_DIR}/${command.name}.md`,
|
|
10269
|
+
content: serializeFrontmatter(frontmatter, command.body.trim() || "")
|
|
10270
|
+
};
|
|
10271
|
+
});
|
|
10272
|
+
}
|
|
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
|
+
});
|
|
10286
|
+
}
|
|
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;
|
|
10800
|
+
if (!(mappedEvent in CANONICAL_TO_KIRO) || !Array.isArray(entries)) continue;
|
|
10801
|
+
let index = 1;
|
|
10802
|
+
for (const entry of entries) {
|
|
10803
|
+
const text = hookText(entry);
|
|
10804
|
+
if (!text) continue;
|
|
10805
|
+
const file = {
|
|
10806
|
+
name: `${toKebab(event)} ${index}`,
|
|
10807
|
+
version: "1",
|
|
10808
|
+
when: toWhen(mappedEvent, entry.matcher),
|
|
10809
|
+
then: entry.type === "prompt" ? { type: "askAgent", prompt: text } : { type: "shellCommand", command: text }
|
|
10810
|
+
};
|
|
10811
|
+
outputs.push({
|
|
10812
|
+
name: `${toKebab(event)}-${index}.kiro.hook`,
|
|
10813
|
+
content: JSON.stringify(file, null, 2)
|
|
10814
|
+
});
|
|
10815
|
+
index += 1;
|
|
10816
|
+
}
|
|
10817
|
+
}
|
|
10818
|
+
return outputs;
|
|
10819
|
+
}
|
|
10820
|
+
function toCanonicalEntry(file) {
|
|
10821
|
+
const canonicalEvent = KIRO_TO_CANONICAL.get(file.when.type);
|
|
10822
|
+
if (!canonicalEvent) return null;
|
|
10823
|
+
const matcher = file.when.tools?.[0] ?? file.when.patterns?.[0] ?? "*";
|
|
10824
|
+
if (file.then.type === "askAgent" && typeof file.then.prompt === "string") {
|
|
10825
|
+
return {
|
|
10826
|
+
event: canonicalEvent,
|
|
10827
|
+
entry: {
|
|
10828
|
+
matcher,
|
|
10829
|
+
command: file.then.prompt,
|
|
10830
|
+
prompt: file.then.prompt,
|
|
10831
|
+
type: "prompt"
|
|
10832
|
+
}
|
|
10163
10833
|
};
|
|
10164
10834
|
}
|
|
10165
10835
|
if (file.then.type === "shellCommand" && typeof file.then.command === "string") {
|
|
@@ -10217,7 +10887,7 @@ function steeringFrontmatter(rule) {
|
|
|
10217
10887
|
if (rule.description) frontmatter.description = rule.description;
|
|
10218
10888
|
return frontmatter;
|
|
10219
10889
|
}
|
|
10220
|
-
function
|
|
10890
|
+
function generateRules11(canonical) {
|
|
10221
10891
|
const outputs = [];
|
|
10222
10892
|
const root = canonical.rules.find((rule) => rule.root);
|
|
10223
10893
|
if (root) {
|
|
@@ -10234,10 +10904,10 @@ function generateRules10(canonical) {
|
|
|
10234
10904
|
}
|
|
10235
10905
|
return outputs;
|
|
10236
10906
|
}
|
|
10237
|
-
function
|
|
10907
|
+
function generateSkills11(canonical) {
|
|
10238
10908
|
return generateEmbeddedSkills(canonical, KIRO_SKILLS_DIR);
|
|
10239
10909
|
}
|
|
10240
|
-
function
|
|
10910
|
+
function generateMcp9(canonical) {
|
|
10241
10911
|
if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
|
|
10242
10912
|
return [
|
|
10243
10913
|
{
|
|
@@ -10253,7 +10923,7 @@ function generateHooks5(canonical) {
|
|
|
10253
10923
|
content: hook.content
|
|
10254
10924
|
}));
|
|
10255
10925
|
}
|
|
10256
|
-
function
|
|
10926
|
+
function generateAgents9(canonical) {
|
|
10257
10927
|
return canonical.agents.map((agent) => {
|
|
10258
10928
|
const frontmatter = {
|
|
10259
10929
|
name: agent.name,
|
|
@@ -10268,16 +10938,16 @@ function generateAgents8(canonical) {
|
|
|
10268
10938
|
return { path: `${KIRO_AGENTS_DIR}/${agent.name}.md`, content };
|
|
10269
10939
|
});
|
|
10270
10940
|
}
|
|
10271
|
-
function
|
|
10941
|
+
function generateIgnore7(canonical) {
|
|
10272
10942
|
if (canonical.ignore.length === 0) return [];
|
|
10273
10943
|
return [{ path: KIRO_IGNORE, content: canonical.ignore.join("\n") }];
|
|
10274
10944
|
}
|
|
10275
|
-
var
|
|
10945
|
+
var init_generator14 = __esm({
|
|
10276
10946
|
"src/targets/kiro/generator.ts"() {
|
|
10277
10947
|
init_embedded_skill();
|
|
10278
10948
|
init_markdown();
|
|
10279
10949
|
init_hook_format();
|
|
10280
|
-
|
|
10950
|
+
init_constants9();
|
|
10281
10951
|
}
|
|
10282
10952
|
});
|
|
10283
10953
|
function canonicalRuleMeta(frontmatter) {
|
|
@@ -10366,12 +11036,12 @@ async function importFromKiro(projectRoot, options = {}) {
|
|
|
10366
11036
|
const normalize = await createImportReferenceNormalizer(KIRO_TARGET, projectRoot, scope);
|
|
10367
11037
|
await importRoot(projectRoot, results, normalize, scope);
|
|
10368
11038
|
await importNonRootRules(projectRoot, results, normalize);
|
|
10369
|
-
results.push(...await runDescriptorImport(
|
|
11039
|
+
results.push(...await runDescriptorImport(descriptor11, projectRoot, scope, { normalize }));
|
|
10370
11040
|
await importEmbeddedSkills(projectRoot, KIRO_SKILLS_DIR, KIRO_TARGET, results, normalize);
|
|
10371
11041
|
if (scope === "project") await importHooks2(projectRoot, results);
|
|
10372
11042
|
return results;
|
|
10373
11043
|
}
|
|
10374
|
-
var
|
|
11044
|
+
var init_importer11 = __esm({
|
|
10375
11045
|
"src/targets/kiro/importer.ts"() {
|
|
10376
11046
|
init_import_rewriter();
|
|
10377
11047
|
init_embedded_skill();
|
|
@@ -10382,13 +11052,13 @@ var init_importer10 = __esm({
|
|
|
10382
11052
|
init_fs();
|
|
10383
11053
|
init_markdown();
|
|
10384
11054
|
init_hook_format();
|
|
10385
|
-
|
|
11055
|
+
init_constants9();
|
|
10386
11056
|
init_kiro2();
|
|
10387
11057
|
}
|
|
10388
11058
|
});
|
|
10389
11059
|
|
|
10390
11060
|
// src/targets/kiro/linter.ts
|
|
10391
|
-
function
|
|
11061
|
+
function lintRules11(canonical, projectRoot, projectFiles, options) {
|
|
10392
11062
|
return validateRules(canonical, projectRoot, projectFiles, {
|
|
10393
11063
|
checkGlobMatches: options?.scope !== "global"
|
|
10394
11064
|
}).map((diagnostic) => ({
|
|
@@ -10396,15 +11066,15 @@ function lintRules10(canonical, projectRoot, projectFiles, options) {
|
|
|
10396
11066
|
target: KIRO_TARGET
|
|
10397
11067
|
}));
|
|
10398
11068
|
}
|
|
10399
|
-
var
|
|
11069
|
+
var init_linter11 = __esm({
|
|
10400
11070
|
"src/targets/kiro/linter.ts"() {
|
|
10401
11071
|
init_validate_rules();
|
|
10402
|
-
|
|
11072
|
+
init_constants9();
|
|
10403
11073
|
}
|
|
10404
11074
|
});
|
|
10405
11075
|
|
|
10406
11076
|
// src/targets/kiro/lint.ts
|
|
10407
|
-
function
|
|
11077
|
+
function lintHooks5(canonical) {
|
|
10408
11078
|
if (!canonical.hooks || Object.keys(canonical.hooks).length === 0) return [];
|
|
10409
11079
|
const supported = ["PreToolUse", "PostToolUse", "UserPromptSubmit", "SubagentStop"];
|
|
10410
11080
|
const supportedSet = new Set(supported);
|
|
@@ -10412,35 +11082,35 @@ function lintHooks4(canonical) {
|
|
|
10412
11082
|
(event) => createUnsupportedHookWarning(event, "kiro", supported, { unsupportedBy: "Kiro hooks" })
|
|
10413
11083
|
);
|
|
10414
11084
|
}
|
|
10415
|
-
var
|
|
11085
|
+
var init_lint9 = __esm({
|
|
10416
11086
|
"src/targets/kiro/lint.ts"() {
|
|
10417
11087
|
init_helpers();
|
|
10418
11088
|
}
|
|
10419
11089
|
});
|
|
10420
11090
|
|
|
10421
11091
|
// src/targets/kiro/index.ts
|
|
10422
|
-
var
|
|
11092
|
+
var target11, project11, global8, globalCapabilities10, descriptor11;
|
|
10423
11093
|
var init_kiro2 = __esm({
|
|
10424
11094
|
"src/targets/kiro/index.ts"() {
|
|
10425
|
-
|
|
11095
|
+
init_generator14();
|
|
10426
11096
|
init_skill_mirror();
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
11097
|
+
init_importer11();
|
|
11098
|
+
init_linter11();
|
|
11099
|
+
init_lint9();
|
|
10430
11100
|
init_import_map_builders();
|
|
10431
|
-
|
|
10432
|
-
|
|
11101
|
+
init_constants9();
|
|
11102
|
+
target11 = {
|
|
10433
11103
|
name: KIRO_TARGET,
|
|
10434
11104
|
primaryRootInstructionPath: KIRO_AGENTS_MD,
|
|
10435
|
-
generateRules:
|
|
10436
|
-
generateAgents:
|
|
10437
|
-
generateSkills:
|
|
10438
|
-
generateMcp:
|
|
11105
|
+
generateRules: generateRules11,
|
|
11106
|
+
generateAgents: generateAgents9,
|
|
11107
|
+
generateSkills: generateSkills11,
|
|
11108
|
+
generateMcp: generateMcp9,
|
|
10439
11109
|
generateHooks: generateHooks5,
|
|
10440
|
-
generateIgnore:
|
|
11110
|
+
generateIgnore: generateIgnore7,
|
|
10441
11111
|
importFrom: importFromKiro
|
|
10442
11112
|
};
|
|
10443
|
-
|
|
11113
|
+
project11 = {
|
|
10444
11114
|
rootInstructionPath: KIRO_AGENTS_MD,
|
|
10445
11115
|
skillDir: KIRO_SKILLS_DIR,
|
|
10446
11116
|
managedOutputs: {
|
|
@@ -10521,9 +11191,9 @@ var init_kiro2 = __esm({
|
|
|
10521
11191
|
ignore: "native",
|
|
10522
11192
|
permissions: "none"
|
|
10523
11193
|
};
|
|
10524
|
-
|
|
11194
|
+
descriptor11 = {
|
|
10525
11195
|
id: KIRO_TARGET,
|
|
10526
|
-
generators:
|
|
11196
|
+
generators: target11,
|
|
10527
11197
|
capabilities: {
|
|
10528
11198
|
rules: "native",
|
|
10529
11199
|
additionalRules: "native",
|
|
@@ -10536,11 +11206,11 @@ var init_kiro2 = __esm({
|
|
|
10536
11206
|
permissions: "none"
|
|
10537
11207
|
},
|
|
10538
11208
|
emptyImportMessage: "No Kiro config found (AGENTS.md, .kiro/steering, .kiro/skills, .kiro/agents, .kiro/hooks, .kiro/settings/mcp.json, or .kiroignore).",
|
|
10539
|
-
lintRules:
|
|
11209
|
+
lintRules: lintRules11,
|
|
10540
11210
|
lint: {
|
|
10541
|
-
hooks:
|
|
11211
|
+
hooks: lintHooks5
|
|
10542
11212
|
},
|
|
10543
|
-
project:
|
|
11213
|
+
project: project11,
|
|
10544
11214
|
globalSupport: {
|
|
10545
11215
|
capabilities: globalCapabilities10,
|
|
10546
11216
|
detectionPaths: [
|
|
@@ -10589,7 +11259,7 @@ var init_kiro2 = __esm({
|
|
|
10589
11259
|
};
|
|
10590
11260
|
}
|
|
10591
11261
|
});
|
|
10592
|
-
function
|
|
11262
|
+
function generateRules12(canonical) {
|
|
10593
11263
|
const outputs = [];
|
|
10594
11264
|
const root = canonical.rules.find((rule) => rule.root);
|
|
10595
11265
|
if (root) {
|
|
@@ -10609,7 +11279,7 @@ function generateRules11(canonical) {
|
|
|
10609
11279
|
}
|
|
10610
11280
|
return outputs;
|
|
10611
11281
|
}
|
|
10612
|
-
function
|
|
11282
|
+
function generateCommands11(canonical) {
|
|
10613
11283
|
return canonical.commands.map((command) => {
|
|
10614
11284
|
const frontmatter = {};
|
|
10615
11285
|
if (command.description) frontmatter.description = command.description;
|
|
@@ -10619,7 +11289,7 @@ function generateCommands10(canonical) {
|
|
|
10619
11289
|
};
|
|
10620
11290
|
});
|
|
10621
11291
|
}
|
|
10622
|
-
function
|
|
11292
|
+
function generateMcp10(canonical) {
|
|
10623
11293
|
if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
|
|
10624
11294
|
return [
|
|
10625
11295
|
{
|
|
@@ -10628,14 +11298,14 @@ function generateMcp9(canonical) {
|
|
|
10628
11298
|
}
|
|
10629
11299
|
];
|
|
10630
11300
|
}
|
|
10631
|
-
function
|
|
11301
|
+
function generateIgnore8(canonical) {
|
|
10632
11302
|
if (canonical.ignore.length === 0) return [];
|
|
10633
11303
|
return [{ path: ROO_CODE_IGNORE, content: canonical.ignore.join("\n") }];
|
|
10634
11304
|
}
|
|
10635
|
-
function
|
|
11305
|
+
function generateSkills12(canonical) {
|
|
10636
11306
|
return generateEmbeddedSkills(canonical, ROO_CODE_SKILLS_DIR);
|
|
10637
11307
|
}
|
|
10638
|
-
function
|
|
11308
|
+
function generateAgents10(canonical) {
|
|
10639
11309
|
if (canonical.agents.length === 0) return [];
|
|
10640
11310
|
const customModes = canonical.agents.map((agent) => {
|
|
10641
11311
|
const slug = basename(agent.source, ".md");
|
|
@@ -10646,19 +11316,19 @@ function generateAgents9(canonical) {
|
|
|
10646
11316
|
});
|
|
10647
11317
|
return [{ path: ROO_CODE_MODES_FILE, content: stringify({ customModes }) }];
|
|
10648
11318
|
}
|
|
10649
|
-
var
|
|
11319
|
+
var init_generator15 = __esm({
|
|
10650
11320
|
"src/targets/roo-code/generator.ts"() {
|
|
10651
11321
|
init_embedded_skill();
|
|
10652
11322
|
init_markdown();
|
|
10653
|
-
|
|
11323
|
+
init_constants10();
|
|
10654
11324
|
}
|
|
10655
11325
|
});
|
|
10656
11326
|
var rooNonRootRuleMapper, rooCommandMapper;
|
|
10657
|
-
var
|
|
11327
|
+
var init_import_mappers8 = __esm({
|
|
10658
11328
|
"src/targets/roo-code/import-mappers.ts"() {
|
|
10659
11329
|
init_markdown();
|
|
10660
11330
|
init_import_metadata();
|
|
10661
|
-
|
|
11331
|
+
init_constants10();
|
|
10662
11332
|
rooNonRootRuleMapper = async ({
|
|
10663
11333
|
relativePath,
|
|
10664
11334
|
normalizeTo,
|
|
@@ -10742,25 +11412,25 @@ async function importFromRooCode(projectRoot, options = {}) {
|
|
|
10742
11412
|
const scope = options.scope ?? "project";
|
|
10743
11413
|
const results = [];
|
|
10744
11414
|
const normalize = await createImportReferenceNormalizer(ROO_CODE_TARGET, projectRoot, scope);
|
|
10745
|
-
results.push(...await runDescriptorImport(
|
|
11415
|
+
results.push(...await runDescriptorImport(descriptor12, projectRoot, scope, { normalize }));
|
|
10746
11416
|
await importPerModeRules(projectRoot, results, normalize);
|
|
10747
11417
|
await importEmbeddedSkills(projectRoot, ROO_CODE_SKILLS_DIR, ROO_CODE_TARGET, results, normalize);
|
|
10748
11418
|
return results;
|
|
10749
11419
|
}
|
|
10750
|
-
var
|
|
11420
|
+
var init_importer12 = __esm({
|
|
10751
11421
|
"src/targets/roo-code/importer.ts"() {
|
|
10752
11422
|
init_import_rewriter();
|
|
10753
11423
|
init_embedded_skill();
|
|
10754
11424
|
init_import_orchestrator();
|
|
10755
11425
|
init_descriptor_import_runner();
|
|
10756
|
-
|
|
10757
|
-
|
|
11426
|
+
init_import_mappers8();
|
|
11427
|
+
init_constants10();
|
|
10758
11428
|
init_roo_code2();
|
|
10759
11429
|
}
|
|
10760
11430
|
});
|
|
10761
11431
|
|
|
10762
11432
|
// src/targets/roo-code/linter.ts
|
|
10763
|
-
function
|
|
11433
|
+
function lintRules12(canonical, projectRoot, projectFiles, options) {
|
|
10764
11434
|
return validateRules(canonical, projectRoot, projectFiles, {
|
|
10765
11435
|
checkGlobMatches: options?.scope !== "global"
|
|
10766
11436
|
}).map((diagnostic) => ({
|
|
@@ -10768,10 +11438,10 @@ function lintRules11(canonical, projectRoot, projectFiles, options) {
|
|
|
10768
11438
|
target: ROO_CODE_TARGET
|
|
10769
11439
|
}));
|
|
10770
11440
|
}
|
|
10771
|
-
var
|
|
11441
|
+
var init_linter12 = __esm({
|
|
10772
11442
|
"src/targets/roo-code/linter.ts"() {
|
|
10773
11443
|
init_validate_rules();
|
|
10774
|
-
|
|
11444
|
+
init_constants10();
|
|
10775
11445
|
}
|
|
10776
11446
|
});
|
|
10777
11447
|
function computeStatus5(existing, content) {
|
|
@@ -10779,29 +11449,29 @@ function computeStatus5(existing, content) {
|
|
|
10779
11449
|
if (existing !== content) return "updated";
|
|
10780
11450
|
return "unchanged";
|
|
10781
11451
|
}
|
|
10782
|
-
var
|
|
11452
|
+
var target12, project12, generateRooGlobalExtras, global9, globalCapabilities11, descriptor12;
|
|
10783
11453
|
var init_roo_code2 = __esm({
|
|
10784
11454
|
"src/targets/roo-code/index.ts"() {
|
|
10785
11455
|
init_fs();
|
|
10786
|
-
|
|
10787
|
-
|
|
11456
|
+
init_generator15();
|
|
11457
|
+
init_constants10();
|
|
10788
11458
|
init_skill_mirror();
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
11459
|
+
init_importer12();
|
|
11460
|
+
init_import_mappers8();
|
|
11461
|
+
init_linter12();
|
|
10792
11462
|
init_import_map_builders();
|
|
10793
|
-
|
|
11463
|
+
target12 = {
|
|
10794
11464
|
name: "roo-code",
|
|
10795
11465
|
primaryRootInstructionPath: ROO_CODE_ROOT_RULE,
|
|
10796
|
-
generateRules:
|
|
10797
|
-
generateCommands:
|
|
10798
|
-
generateSkills:
|
|
10799
|
-
generateMcp:
|
|
10800
|
-
generateIgnore:
|
|
10801
|
-
generateAgents:
|
|
11466
|
+
generateRules: generateRules12,
|
|
11467
|
+
generateCommands: generateCommands11,
|
|
11468
|
+
generateSkills: generateSkills12,
|
|
11469
|
+
generateMcp: generateMcp10,
|
|
11470
|
+
generateIgnore: generateIgnore8,
|
|
11471
|
+
generateAgents: generateAgents10,
|
|
10802
11472
|
importFrom: importFromRooCode
|
|
10803
11473
|
};
|
|
10804
|
-
|
|
11474
|
+
project12 = {
|
|
10805
11475
|
rootInstructionPath: ROO_CODE_ROOT_RULE,
|
|
10806
11476
|
skillDir: ".roo/skills",
|
|
10807
11477
|
managedOutputs: {
|
|
@@ -10909,9 +11579,9 @@ var init_roo_code2 = __esm({
|
|
|
10909
11579
|
ignore: "native",
|
|
10910
11580
|
permissions: "none"
|
|
10911
11581
|
};
|
|
10912
|
-
|
|
11582
|
+
descriptor12 = {
|
|
10913
11583
|
id: "roo-code",
|
|
10914
|
-
generators:
|
|
11584
|
+
generators: target12,
|
|
10915
11585
|
capabilities: {
|
|
10916
11586
|
rules: "native",
|
|
10917
11587
|
additionalRules: "native",
|
|
@@ -10924,8 +11594,8 @@ var init_roo_code2 = __esm({
|
|
|
10924
11594
|
permissions: "none"
|
|
10925
11595
|
},
|
|
10926
11596
|
emptyImportMessage: "No Roo Code config found (.roo/rules, .roo/commands, .roo/skills, .roo/mcp.json, .rooignore, or .roorules).",
|
|
10927
|
-
lintRules:
|
|
10928
|
-
project:
|
|
11597
|
+
lintRules: lintRules12,
|
|
11598
|
+
project: project12,
|
|
10929
11599
|
globalSupport: {
|
|
10930
11600
|
capabilities: globalCapabilities11,
|
|
10931
11601
|
detectionPaths: [
|
|
@@ -11008,7 +11678,7 @@ var init_roo_code2 = __esm({
|
|
|
11008
11678
|
|
|
11009
11679
|
// src/targets/windsurf/constants.ts
|
|
11010
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;
|
|
11011
|
-
var
|
|
11681
|
+
var init_constants14 = __esm({
|
|
11012
11682
|
"src/targets/windsurf/constants.ts"() {
|
|
11013
11683
|
WINDSURF_TARGET = "windsurf";
|
|
11014
11684
|
WINDSURF_RULES_ROOT = ".windsurfrules";
|
|
@@ -11047,7 +11717,7 @@ function directoryScopedRuleDir(globs) {
|
|
|
11047
11717
|
if (dirs.length !== globs.length) return null;
|
|
11048
11718
|
return dirs.every((dir) => dir === dirs[0]) ? dirs[0] : null;
|
|
11049
11719
|
}
|
|
11050
|
-
function
|
|
11720
|
+
function generateRules13(canonical) {
|
|
11051
11721
|
const outputs = [];
|
|
11052
11722
|
const root = canonical.rules.find((r) => r.root);
|
|
11053
11723
|
if (!root) return [];
|
|
@@ -11084,23 +11754,23 @@ function generateRules12(canonical) {
|
|
|
11084
11754
|
var init_rules4 = __esm({
|
|
11085
11755
|
"src/targets/windsurf/generator/rules.ts"() {
|
|
11086
11756
|
init_markdown();
|
|
11087
|
-
|
|
11757
|
+
init_constants14();
|
|
11088
11758
|
}
|
|
11089
11759
|
});
|
|
11090
11760
|
|
|
11091
11761
|
// src/targets/windsurf/generator/ignore.ts
|
|
11092
|
-
function
|
|
11762
|
+
function generateIgnore9(canonical) {
|
|
11093
11763
|
if (!canonical.ignore || canonical.ignore.length === 0) return [];
|
|
11094
11764
|
return [{ path: CODEIUM_IGNORE, content: canonical.ignore.join("\n") }];
|
|
11095
11765
|
}
|
|
11096
11766
|
var init_ignore3 = __esm({
|
|
11097
11767
|
"src/targets/windsurf/generator/ignore.ts"() {
|
|
11098
|
-
|
|
11768
|
+
init_constants14();
|
|
11099
11769
|
}
|
|
11100
11770
|
});
|
|
11101
11771
|
|
|
11102
11772
|
// src/targets/windsurf/generator/workflows.ts
|
|
11103
|
-
function
|
|
11773
|
+
function generateCommands12(canonical) {
|
|
11104
11774
|
return canonical.commands.map((cmd) => {
|
|
11105
11775
|
const frontmatter = {
|
|
11106
11776
|
description: cmd.description.trim() || void 0,
|
|
@@ -11119,12 +11789,12 @@ function generateCommands11(canonical) {
|
|
|
11119
11789
|
var init_workflows = __esm({
|
|
11120
11790
|
"src/targets/windsurf/generator/workflows.ts"() {
|
|
11121
11791
|
init_markdown();
|
|
11122
|
-
|
|
11792
|
+
init_constants14();
|
|
11123
11793
|
}
|
|
11124
11794
|
});
|
|
11125
11795
|
|
|
11126
11796
|
// src/targets/windsurf/generator/agents.ts
|
|
11127
|
-
function
|
|
11797
|
+
function generateAgents11(canonical) {
|
|
11128
11798
|
return canonical.agents.map((agent) => ({
|
|
11129
11799
|
path: `${WINDSURF_SKILLS_DIR}/${projectedAgentSkillDirName(agent.name)}/SKILL.md`,
|
|
11130
11800
|
content: serializeProjectedAgentSkill(agent)
|
|
@@ -11133,12 +11803,12 @@ function generateAgents10(canonical) {
|
|
|
11133
11803
|
var init_agents4 = __esm({
|
|
11134
11804
|
"src/targets/windsurf/generator/agents.ts"() {
|
|
11135
11805
|
init_projected_agent_skill();
|
|
11136
|
-
|
|
11806
|
+
init_constants14();
|
|
11137
11807
|
}
|
|
11138
11808
|
});
|
|
11139
11809
|
|
|
11140
11810
|
// src/targets/windsurf/generator/mcp.ts
|
|
11141
|
-
function
|
|
11811
|
+
function generateMcp11(canonical) {
|
|
11142
11812
|
if (!canonical.mcp || Object.keys(canonical.mcp.mcpServers).length === 0) return [];
|
|
11143
11813
|
return [
|
|
11144
11814
|
{
|
|
@@ -11149,7 +11819,7 @@ function generateMcp10(canonical) {
|
|
|
11149
11819
|
}
|
|
11150
11820
|
var init_mcp3 = __esm({
|
|
11151
11821
|
"src/targets/windsurf/generator/mcp.ts"() {
|
|
11152
|
-
|
|
11822
|
+
init_constants14();
|
|
11153
11823
|
}
|
|
11154
11824
|
});
|
|
11155
11825
|
|
|
@@ -11192,12 +11862,12 @@ function generateHooks6(canonical) {
|
|
|
11192
11862
|
var init_hooks2 = __esm({
|
|
11193
11863
|
"src/targets/windsurf/generator/hooks.ts"() {
|
|
11194
11864
|
init_hook_command();
|
|
11195
|
-
|
|
11865
|
+
init_constants14();
|
|
11196
11866
|
}
|
|
11197
11867
|
});
|
|
11198
11868
|
|
|
11199
11869
|
// src/targets/windsurf/generator/skills.ts
|
|
11200
|
-
function
|
|
11870
|
+
function generateSkills13(canonical) {
|
|
11201
11871
|
const outputs = [];
|
|
11202
11872
|
for (const skill of canonical.skills) {
|
|
11203
11873
|
const frontmatter = {
|
|
@@ -11219,12 +11889,12 @@ function generateSkills12(canonical) {
|
|
|
11219
11889
|
var init_skills4 = __esm({
|
|
11220
11890
|
"src/targets/windsurf/generator/skills.ts"() {
|
|
11221
11891
|
init_markdown();
|
|
11222
|
-
|
|
11892
|
+
init_constants14();
|
|
11223
11893
|
}
|
|
11224
11894
|
});
|
|
11225
11895
|
|
|
11226
11896
|
// src/targets/windsurf/generator/index.ts
|
|
11227
|
-
var
|
|
11897
|
+
var init_generator16 = __esm({
|
|
11228
11898
|
"src/targets/windsurf/generator/index.ts"() {
|
|
11229
11899
|
init_rules4();
|
|
11230
11900
|
init_ignore3();
|
|
@@ -11237,9 +11907,9 @@ var init_generator15 = __esm({
|
|
|
11237
11907
|
});
|
|
11238
11908
|
|
|
11239
11909
|
// src/targets/windsurf/generator.ts
|
|
11240
|
-
var
|
|
11910
|
+
var init_generator17 = __esm({
|
|
11241
11911
|
"src/targets/windsurf/generator.ts"() {
|
|
11242
|
-
|
|
11912
|
+
init_generator16();
|
|
11243
11913
|
}
|
|
11244
11914
|
});
|
|
11245
11915
|
function toStringArray8(value) {
|
|
@@ -11291,7 +11961,7 @@ var init_importer_workflows = __esm({
|
|
|
11291
11961
|
init_fs();
|
|
11292
11962
|
init_markdown();
|
|
11293
11963
|
init_import_metadata();
|
|
11294
|
-
|
|
11964
|
+
init_constants14();
|
|
11295
11965
|
}
|
|
11296
11966
|
});
|
|
11297
11967
|
async function importSkills4(projectRoot, results, normalize, skillsRelDir = WINDSURF_SKILLS_DIR) {
|
|
@@ -11338,7 +12008,7 @@ var init_skills_adapter5 = __esm({
|
|
|
11338
12008
|
init_projected_agent_skill();
|
|
11339
12009
|
init_scoped_agents_import();
|
|
11340
12010
|
init_skill_import_pipeline();
|
|
11341
|
-
|
|
12011
|
+
init_constants14();
|
|
11342
12012
|
}
|
|
11343
12013
|
});
|
|
11344
12014
|
async function importWindsurfHooks(projectRoot, results) {
|
|
@@ -11436,7 +12106,7 @@ async function importWindsurfMcp(projectRoot, results) {
|
|
|
11436
12106
|
var init_importer_hooks_mcp = __esm({
|
|
11437
12107
|
"src/targets/windsurf/importer-hooks-mcp.ts"() {
|
|
11438
12108
|
init_fs();
|
|
11439
|
-
|
|
12109
|
+
init_constants14();
|
|
11440
12110
|
}
|
|
11441
12111
|
});
|
|
11442
12112
|
async function importFromWindsurf(projectRoot, options) {
|
|
@@ -11573,7 +12243,7 @@ async function importFromWindsurf(projectRoot, options) {
|
|
|
11573
12243
|
await importWindsurfMcp(projectRoot, results);
|
|
11574
12244
|
return results;
|
|
11575
12245
|
}
|
|
11576
|
-
var
|
|
12246
|
+
var init_importer13 = __esm({
|
|
11577
12247
|
"src/targets/windsurf/importer.ts"() {
|
|
11578
12248
|
init_import_rewriter();
|
|
11579
12249
|
init_fs();
|
|
@@ -11581,13 +12251,13 @@ var init_importer12 = __esm({
|
|
|
11581
12251
|
init_import_metadata();
|
|
11582
12252
|
init_import_orchestrator();
|
|
11583
12253
|
init_scoped_agents_import();
|
|
11584
|
-
|
|
12254
|
+
init_constants14();
|
|
11585
12255
|
init_importer_workflows();
|
|
11586
12256
|
init_skills_adapter5();
|
|
11587
12257
|
init_importer_hooks_mcp();
|
|
11588
12258
|
}
|
|
11589
12259
|
});
|
|
11590
|
-
function
|
|
12260
|
+
function lintRules13(canonical, projectRoot, _projectFiles) {
|
|
11591
12261
|
const diags = [];
|
|
11592
12262
|
const { rules } = canonical;
|
|
11593
12263
|
if (rules.length > 0) {
|
|
@@ -11614,9 +12284,9 @@ function lintRules12(canonical, projectRoot, _projectFiles) {
|
|
|
11614
12284
|
}
|
|
11615
12285
|
return diags;
|
|
11616
12286
|
}
|
|
11617
|
-
var
|
|
12287
|
+
var init_linter13 = __esm({
|
|
11618
12288
|
"src/targets/windsurf/linter.ts"() {
|
|
11619
|
-
|
|
12289
|
+
init_constants14();
|
|
11620
12290
|
}
|
|
11621
12291
|
});
|
|
11622
12292
|
|
|
@@ -11640,7 +12310,7 @@ function lintMcp4(canonical) {
|
|
|
11640
12310
|
)
|
|
11641
12311
|
];
|
|
11642
12312
|
}
|
|
11643
|
-
var
|
|
12313
|
+
var init_lint10 = __esm({
|
|
11644
12314
|
"src/targets/windsurf/lint.ts"() {
|
|
11645
12315
|
init_helpers();
|
|
11646
12316
|
}
|
|
@@ -11653,32 +12323,32 @@ function directoryScopedRuleDir2(globs) {
|
|
|
11653
12323
|
if (dirs.length !== globs.length) return null;
|
|
11654
12324
|
return dirs.every((dir) => dir === dirs[0]) ? dirs[0] : null;
|
|
11655
12325
|
}
|
|
11656
|
-
var
|
|
12326
|
+
var target13, project13, global10, globalCapabilities12, descriptor13;
|
|
11657
12327
|
var init_windsurf2 = __esm({
|
|
11658
12328
|
"src/targets/windsurf/index.ts"() {
|
|
11659
|
-
|
|
12329
|
+
init_generator17();
|
|
11660
12330
|
init_capabilities();
|
|
11661
|
-
|
|
12331
|
+
init_constants14();
|
|
11662
12332
|
init_skill_mirror();
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
12333
|
+
init_importer13();
|
|
12334
|
+
init_linter13();
|
|
12335
|
+
init_lint10();
|
|
11666
12336
|
init_import_map_builders();
|
|
11667
12337
|
init_conversions();
|
|
11668
12338
|
init_projected_agent_skill();
|
|
11669
|
-
|
|
12339
|
+
target13 = {
|
|
11670
12340
|
name: "windsurf",
|
|
11671
12341
|
primaryRootInstructionPath: WINDSURF_AGENTS_MD,
|
|
11672
|
-
generateRules:
|
|
11673
|
-
generateCommands:
|
|
11674
|
-
generateAgents:
|
|
11675
|
-
generateSkills:
|
|
11676
|
-
generateMcp:
|
|
12342
|
+
generateRules: generateRules13,
|
|
12343
|
+
generateCommands: generateCommands12,
|
|
12344
|
+
generateAgents: generateAgents11,
|
|
12345
|
+
generateSkills: generateSkills13,
|
|
12346
|
+
generateMcp: generateMcp11,
|
|
11677
12347
|
generateHooks: generateHooks6,
|
|
11678
|
-
generateIgnore:
|
|
12348
|
+
generateIgnore: generateIgnore9,
|
|
11679
12349
|
importFrom: importFromWindsurf
|
|
11680
12350
|
};
|
|
11681
|
-
|
|
12351
|
+
project13 = {
|
|
11682
12352
|
rootInstructionPath: WINDSURF_AGENTS_MD,
|
|
11683
12353
|
extraRuleOutputPaths(rule) {
|
|
11684
12354
|
if (rule.root) return [WINDSURF_AGENTS_MD];
|
|
@@ -11773,9 +12443,9 @@ var init_windsurf2 = __esm({
|
|
|
11773
12443
|
ignore: "native",
|
|
11774
12444
|
permissions: "none"
|
|
11775
12445
|
};
|
|
11776
|
-
|
|
12446
|
+
descriptor13 = {
|
|
11777
12447
|
id: "windsurf",
|
|
11778
|
-
generators:
|
|
12448
|
+
generators: target13,
|
|
11779
12449
|
capabilities: {
|
|
11780
12450
|
rules: "native",
|
|
11781
12451
|
additionalRules: "native",
|
|
@@ -11789,12 +12459,12 @@ var init_windsurf2 = __esm({
|
|
|
11789
12459
|
},
|
|
11790
12460
|
emptyImportMessage: "No Windsurf config found (.windsurfrules, .windsurf/rules, .windsurfignore, or .codeiumignore).",
|
|
11791
12461
|
supportsConversion: { agents: true },
|
|
11792
|
-
lintRules:
|
|
12462
|
+
lintRules: lintRules13,
|
|
11793
12463
|
lint: {
|
|
11794
12464
|
commands: lintCommands6,
|
|
11795
12465
|
mcp: lintMcp4
|
|
11796
12466
|
},
|
|
11797
|
-
project:
|
|
12467
|
+
project: project13,
|
|
11798
12468
|
globalSupport: {
|
|
11799
12469
|
capabilities: globalCapabilities12,
|
|
11800
12470
|
detectionPaths: [
|
|
@@ -11837,67 +12507,67 @@ function builtinTargetsMap() {
|
|
|
11837
12507
|
}
|
|
11838
12508
|
return _builtinTargetsMap;
|
|
11839
12509
|
}
|
|
11840
|
-
function getBuiltinTargetDefinition(
|
|
11841
|
-
return builtinTargetsMap().get(
|
|
12510
|
+
function getBuiltinTargetDefinition(target14) {
|
|
12511
|
+
return builtinTargetsMap().get(target14);
|
|
11842
12512
|
}
|
|
11843
|
-
function getTargetCapabilities(
|
|
11844
|
-
const
|
|
11845
|
-
if (!
|
|
11846
|
-
const raw = scope === "global" ?
|
|
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;
|
|
11847
12517
|
return normalizeTargetCapabilities(raw);
|
|
11848
12518
|
}
|
|
11849
|
-
function getTargetDetectionPaths(
|
|
11850
|
-
const
|
|
11851
|
-
if (!
|
|
12519
|
+
function getTargetDetectionPaths(target14, scope = "project") {
|
|
12520
|
+
const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
|
|
12521
|
+
if (!descriptor14) return [];
|
|
11852
12522
|
if (scope === "global") {
|
|
11853
|
-
return
|
|
12523
|
+
return descriptor14.globalSupport?.detectionPaths ?? [];
|
|
11854
12524
|
}
|
|
11855
|
-
return
|
|
12525
|
+
return descriptor14.detectionPaths;
|
|
11856
12526
|
}
|
|
11857
|
-
function getTargetLayout(
|
|
11858
|
-
const
|
|
11859
|
-
if (!
|
|
12527
|
+
function getTargetLayout(target14, scope = "project") {
|
|
12528
|
+
const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
|
|
12529
|
+
if (!descriptor14) return void 0;
|
|
11860
12530
|
if (scope === "global") {
|
|
11861
|
-
return
|
|
12531
|
+
return descriptor14.globalSupport?.layout;
|
|
11862
12532
|
}
|
|
11863
|
-
return
|
|
12533
|
+
return descriptor14.project;
|
|
11864
12534
|
}
|
|
11865
|
-
function getTargetPrimaryRootInstructionPath(
|
|
11866
|
-
return getTargetLayout(
|
|
12535
|
+
function getTargetPrimaryRootInstructionPath(target14, scope = "project") {
|
|
12536
|
+
return getTargetLayout(target14, scope)?.rootInstructionPath;
|
|
11867
12537
|
}
|
|
11868
|
-
function getTargetSkillDir(
|
|
11869
|
-
return getTargetLayout(
|
|
12538
|
+
function getTargetSkillDir(target14, scope = "project") {
|
|
12539
|
+
return getTargetLayout(target14, scope)?.skillDir;
|
|
11870
12540
|
}
|
|
11871
|
-
function getTargetManagedOutputs(
|
|
11872
|
-
return getTargetLayout(
|
|
12541
|
+
function getTargetManagedOutputs(target14, scope = "project") {
|
|
12542
|
+
return getTargetLayout(target14, scope)?.managedOutputs;
|
|
11873
12543
|
}
|
|
11874
|
-
function rewriteGeneratedOutputPath(
|
|
11875
|
-
const layout = getTargetLayout(
|
|
12544
|
+
function rewriteGeneratedOutputPath(target14, path, scope = "project") {
|
|
12545
|
+
const layout = getTargetLayout(target14, scope);
|
|
11876
12546
|
if (!layout) return null;
|
|
11877
12547
|
return layout.rewriteGeneratedPath ? layout.rewriteGeneratedPath(path) : path;
|
|
11878
12548
|
}
|
|
11879
|
-
function isFeatureSuppressedByConversion(
|
|
11880
|
-
if (!
|
|
11881
|
-
if (feature === "commands" &&
|
|
11882
|
-
return !shouldConvertCommandsToSkills(config,
|
|
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);
|
|
11883
12553
|
}
|
|
11884
|
-
if (feature === "agents" &&
|
|
11885
|
-
return !shouldConvertAgentsToSkills(config,
|
|
12554
|
+
if (feature === "agents" && descriptor14.supportsConversion?.agents) {
|
|
12555
|
+
return !shouldConvertAgentsToSkills(config, descriptor14.id, true, scope);
|
|
11886
12556
|
}
|
|
11887
12557
|
return false;
|
|
11888
12558
|
}
|
|
11889
|
-
function getEffectiveTargetSupportLevel(
|
|
11890
|
-
const baseLevel = getTargetCapabilities(
|
|
12559
|
+
function getEffectiveTargetSupportLevel(target14, feature, config, scope = "project") {
|
|
12560
|
+
const baseLevel = getTargetCapabilities(target14, scope)?.[feature]?.level ?? "none";
|
|
11891
12561
|
if (baseLevel !== "embedded") return baseLevel;
|
|
11892
|
-
const
|
|
11893
|
-
return isFeatureSuppressedByConversion(
|
|
12562
|
+
const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
|
|
12563
|
+
return isFeatureSuppressedByConversion(descriptor14, feature, config, scope) ? "none" : baseLevel;
|
|
11894
12564
|
}
|
|
11895
|
-
function resolveTargetFeatureGenerator(
|
|
11896
|
-
const
|
|
11897
|
-
if (!
|
|
11898
|
-
if (isFeatureSuppressedByConversion(
|
|
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;
|
|
11899
12569
|
const pick = PICK_FEATURE_GENERATOR[feature];
|
|
11900
|
-
return pick === null ? void 0 : pick(
|
|
12570
|
+
return pick === null ? void 0 : pick(descriptor14.generators);
|
|
11901
12571
|
}
|
|
11902
12572
|
var BUILTIN_TARGETS, _builtinTargetsMap, PICK_FEATURE_GENERATOR;
|
|
11903
12573
|
var init_builtin_targets = __esm({
|
|
@@ -11916,6 +12586,7 @@ var init_builtin_targets = __esm({
|
|
|
11916
12586
|
init_cursor2();
|
|
11917
12587
|
init_gemini_cli2();
|
|
11918
12588
|
init_junie2();
|
|
12589
|
+
init_kilo_code2();
|
|
11919
12590
|
init_kiro2();
|
|
11920
12591
|
init_roo_code2();
|
|
11921
12592
|
init_windsurf2();
|
|
@@ -11931,7 +12602,8 @@ var init_builtin_targets = __esm({
|
|
|
11931
12602
|
descriptor9,
|
|
11932
12603
|
descriptor10,
|
|
11933
12604
|
descriptor11,
|
|
11934
|
-
descriptor12
|
|
12605
|
+
descriptor12,
|
|
12606
|
+
descriptor13
|
|
11935
12607
|
];
|
|
11936
12608
|
PICK_FEATURE_GENERATOR = {
|
|
11937
12609
|
rules: (g) => g.generateRules,
|
|
@@ -11966,51 +12638,51 @@ function addSkillDirectoryMappings(refs, canonicalPath, targetPath) {
|
|
|
11966
12638
|
|
|
11967
12639
|
// src/core/reference/map-targets.ts
|
|
11968
12640
|
init_builtin_targets();
|
|
11969
|
-
function ruleTargetPath(
|
|
11970
|
-
const layout = getTargetLayout(
|
|
12641
|
+
function ruleTargetPath(target14, rule, scope = "project") {
|
|
12642
|
+
const layout = getTargetLayout(target14, scope);
|
|
11971
12643
|
if (!layout) return null;
|
|
11972
12644
|
if (rule.root) {
|
|
11973
12645
|
return layout.rootInstructionPath ?? null;
|
|
11974
12646
|
}
|
|
11975
|
-
if (rule.targets.length > 0 && !rule.targets.includes(
|
|
12647
|
+
if (rule.targets.length > 0 && !rule.targets.includes(target14)) return null;
|
|
11976
12648
|
const slug = posix.basename(rule.source.replace(/\\/g, "/"), ".md");
|
|
11977
12649
|
return layout.paths.rulePath(slug, rule);
|
|
11978
12650
|
}
|
|
11979
|
-
function commandTargetPath(
|
|
11980
|
-
const layout = getTargetLayout(
|
|
12651
|
+
function commandTargetPath(target14, name, config, scope = "project") {
|
|
12652
|
+
const layout = getTargetLayout(target14, scope);
|
|
11981
12653
|
if (!layout) return null;
|
|
11982
12654
|
return layout.paths.commandPath(name, config);
|
|
11983
12655
|
}
|
|
11984
|
-
function agentTargetPath(
|
|
11985
|
-
const layout = getTargetLayout(
|
|
12656
|
+
function agentTargetPath(target14, name, config, scope = "project") {
|
|
12657
|
+
const layout = getTargetLayout(target14, scope);
|
|
11986
12658
|
if (!layout) return null;
|
|
11987
12659
|
return layout.paths.agentPath(name, config);
|
|
11988
12660
|
}
|
|
11989
12661
|
|
|
11990
12662
|
// src/core/reference/map.ts
|
|
11991
|
-
|
|
11992
|
-
init_constants12();
|
|
12663
|
+
init_constants11();
|
|
11993
12664
|
init_constants13();
|
|
12665
|
+
init_constants14();
|
|
11994
12666
|
init_builtin_targets();
|
|
11995
12667
|
function addDirectoryMapping3(refs, from, to) {
|
|
11996
12668
|
refs.set(from, to);
|
|
11997
12669
|
refs.set(`${from}/`, `${to}/`);
|
|
11998
12670
|
}
|
|
11999
|
-
function buildReferenceMap(
|
|
12671
|
+
function buildReferenceMap(target14, canonical, config, scope = "project") {
|
|
12000
12672
|
const refs = /* @__PURE__ */ new Map();
|
|
12001
12673
|
for (const rule of canonical.rules) {
|
|
12002
|
-
const path = ruleTargetPath(
|
|
12674
|
+
const path = ruleTargetPath(target14, rule, scope);
|
|
12003
12675
|
if (path) refs.set(`.agentsmesh/rules/${basename(rule.source)}`, path);
|
|
12004
12676
|
}
|
|
12005
12677
|
for (const command of canonical.commands) {
|
|
12006
|
-
const path = commandTargetPath(
|
|
12678
|
+
const path = commandTargetPath(target14, command.name, config, scope);
|
|
12007
12679
|
if (path) refs.set(`.agentsmesh/commands/${command.name}.md`, path);
|
|
12008
12680
|
}
|
|
12009
12681
|
for (const agent of canonical.agents) {
|
|
12010
|
-
const path = agentTargetPath(
|
|
12682
|
+
const path = agentTargetPath(target14, agent.name, config, scope);
|
|
12011
12683
|
if (path) refs.set(`.agentsmesh/agents/${agent.name}.md`, path);
|
|
12012
12684
|
}
|
|
12013
|
-
const skillDir = getTargetSkillDir(
|
|
12685
|
+
const skillDir = getTargetSkillDir(target14, scope);
|
|
12014
12686
|
if (!skillDir) return refs;
|
|
12015
12687
|
for (const skill of canonical.skills) {
|
|
12016
12688
|
addDirectoryMapping3(refs, `.agentsmesh/skills/${skill.name}`, `${skillDir}/${skill.name}`);
|
|
@@ -12047,17 +12719,20 @@ function isGeminiAgents(result) {
|
|
|
12047
12719
|
function isKiroAgents(result) {
|
|
12048
12720
|
return result.target === "kiro" && result.path.endsWith(AGENTS_SUFFIX);
|
|
12049
12721
|
}
|
|
12722
|
+
function isKiloCodeAgents(result) {
|
|
12723
|
+
return result.target === "kilo-code" && result.path.endsWith(AGENTS_SUFFIX);
|
|
12724
|
+
}
|
|
12050
12725
|
function isCompatibilityAgents(result) {
|
|
12051
12726
|
return isCursorAgents(result) || isGeminiAgents(result);
|
|
12052
12727
|
}
|
|
12053
|
-
function reverseReferenceMap(
|
|
12054
|
-
const cached2 = cache.get(
|
|
12728
|
+
function reverseReferenceMap(target14, canonical, config, cache) {
|
|
12729
|
+
const cached2 = cache.get(target14);
|
|
12055
12730
|
if (cached2) return cached2;
|
|
12056
12731
|
const reversed = /* @__PURE__ */ new Map();
|
|
12057
|
-
for (const [canonicalPath, targetPath] of buildReferenceMap(
|
|
12732
|
+
for (const [canonicalPath, targetPath] of buildReferenceMap(target14, canonical, config)) {
|
|
12058
12733
|
if (!reversed.has(targetPath)) reversed.set(targetPath, canonicalPath);
|
|
12059
12734
|
}
|
|
12060
|
-
cache.set(
|
|
12735
|
+
cache.set(target14, reversed);
|
|
12061
12736
|
return reversed;
|
|
12062
12737
|
}
|
|
12063
12738
|
function normalizeContent(content, refs) {
|
|
@@ -12096,15 +12771,15 @@ function preferEquivalentCodexAgents(results, canonical, config) {
|
|
|
12096
12771
|
return results.filter((result) => {
|
|
12097
12772
|
if (isCursorAgents(result)) {
|
|
12098
12773
|
const targets = overlapTargetsByPath.get(result.path);
|
|
12099
|
-
if (targets && [...targets].some((
|
|
12774
|
+
if (targets && [...targets].some((target14) => target14 !== "cursor")) return false;
|
|
12100
12775
|
}
|
|
12101
12776
|
if (isGeminiAgents(result)) {
|
|
12102
12777
|
const targets = overlapTargetsByPath.get(result.path);
|
|
12103
|
-
if (targets && [...targets].some((
|
|
12778
|
+
if (targets && [...targets].some((target14) => target14 !== "cursor" && target14 !== "gemini-cli")) {
|
|
12104
12779
|
return false;
|
|
12105
12780
|
}
|
|
12106
12781
|
}
|
|
12107
|
-
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)) {
|
|
12108
12783
|
return true;
|
|
12109
12784
|
}
|
|
12110
12785
|
const codexResult = codexByPath.get(result.path);
|
|
@@ -12136,23 +12811,23 @@ function skillSupportingDirPrefixes(supportingFiles) {
|
|
|
12136
12811
|
const dirs = /* @__PURE__ */ new Set();
|
|
12137
12812
|
for (const { relativePath } of supportingFiles) {
|
|
12138
12813
|
const posixPath = relativePath.replace(/\\/g, "/");
|
|
12139
|
-
let d = dirname(posixPath);
|
|
12814
|
+
let d = posix.dirname(posixPath);
|
|
12140
12815
|
while (d !== "." && d.length > 0) {
|
|
12141
12816
|
dirs.add(d);
|
|
12142
|
-
const next = dirname(d);
|
|
12817
|
+
const next = posix.dirname(d);
|
|
12143
12818
|
if (next === d) break;
|
|
12144
12819
|
d = next;
|
|
12145
12820
|
}
|
|
12146
12821
|
}
|
|
12147
12822
|
return [...dirs];
|
|
12148
12823
|
}
|
|
12149
|
-
function addPackSkillArtifactMappings(refs,
|
|
12150
|
-
const skillDir = getTargetSkillDir(
|
|
12824
|
+
function addPackSkillArtifactMappings(refs, target14, canonical, projectRoot, scope) {
|
|
12825
|
+
const skillDir = getTargetSkillDir(target14, scope);
|
|
12151
12826
|
if (!skillDir) return;
|
|
12152
12827
|
const api = pathApi(projectRoot);
|
|
12153
12828
|
const packsPrefix = api.join(projectRoot, ".agentsmesh", "packs");
|
|
12154
12829
|
for (const skill of canonical.skills) {
|
|
12155
|
-
const skillSourceDir = dirname(skill.source);
|
|
12830
|
+
const skillSourceDir = api.dirname(skill.source);
|
|
12156
12831
|
if (!skillSourceDir.startsWith(packsPrefix)) continue;
|
|
12157
12832
|
const targetSkillDir = api.normalize(api.join(projectRoot, skillDir, skill.name));
|
|
12158
12833
|
addPackAbsoluteDirMapping(refs, skillSourceDir, targetSkillDir, api);
|
|
@@ -12181,8 +12856,8 @@ function copilotInstructionsPath(rule) {
|
|
|
12181
12856
|
const slug = basename(rule.source, ".md");
|
|
12182
12857
|
return `.github/instructions/${slug}.instructions.md`;
|
|
12183
12858
|
}
|
|
12184
|
-
function applyCopilotInstructionArtifactRefs(
|
|
12185
|
-
if (
|
|
12859
|
+
function applyCopilotInstructionArtifactRefs(target14, refs, projectRoot, destinationPath, canonical) {
|
|
12860
|
+
if (target14 !== "copilot" || !destinationPath?.startsWith(".github/instructions/")) return;
|
|
12186
12861
|
const api = pathApi(projectRoot);
|
|
12187
12862
|
for (const rule of canonical.rules) {
|
|
12188
12863
|
if (rule.root || rule.globs.length === 0) continue;
|
|
@@ -12217,11 +12892,11 @@ function resolveRewriteFamilyId(layout, outputPath) {
|
|
|
12217
12892
|
function pushUnique(paths, path) {
|
|
12218
12893
|
if (path !== void 0 && path.length > 0 && !paths.includes(path)) paths.push(path);
|
|
12219
12894
|
}
|
|
12220
|
-
function extraRuleOutputPaths(
|
|
12895
|
+
function extraRuleOutputPaths(target14, rule, refs, scope) {
|
|
12221
12896
|
const paths = [];
|
|
12222
12897
|
const targetPath = refs.get(`.agentsmesh/rules/${basename(rule.source)}`);
|
|
12223
12898
|
pushUnique(paths, targetPath);
|
|
12224
|
-
const layout = getTargetLayout(
|
|
12899
|
+
const layout = getTargetLayout(target14, scope);
|
|
12225
12900
|
if (rule.root) {
|
|
12226
12901
|
for (const mirrorPath of getAdditionalRootDecorationPaths(layout)) {
|
|
12227
12902
|
pushUnique(paths, mirrorPath);
|
|
@@ -12235,8 +12910,8 @@ function extraRuleOutputPaths(target13, rule, refs, scope) {
|
|
|
12235
12910
|
|
|
12236
12911
|
// src/core/reference/output-source-map.ts
|
|
12237
12912
|
init_builtin_targets();
|
|
12238
|
-
function addSkillMirrorSourceEntry(
|
|
12239
|
-
const layout = getTargetLayout(
|
|
12913
|
+
function addSkillMirrorSourceEntry(target14, scope, primaryOutputPath, source, sourceMap, activeTargets) {
|
|
12914
|
+
const layout = getTargetLayout(target14, scope);
|
|
12240
12915
|
if (!layout?.mirrorGlobalPath) return;
|
|
12241
12916
|
const raw = layout.mirrorGlobalPath(primaryOutputPath, activeTargets ?? []);
|
|
12242
12917
|
const mirrorPaths = raw === null ? [] : Array.isArray(raw) ? raw : [raw];
|
|
@@ -12255,24 +12930,24 @@ function canonicalAgentPath(agent) {
|
|
|
12255
12930
|
function canonicalSkillPath(skill) {
|
|
12256
12931
|
return `.agentsmesh/skills/${skill.name}/SKILL.md`;
|
|
12257
12932
|
}
|
|
12258
|
-
function buildArtifactPathMap(
|
|
12933
|
+
function buildArtifactPathMap(target14, canonical, config, projectRoot, destinationPath, options) {
|
|
12259
12934
|
const scope = options?.scope ?? "project";
|
|
12260
12935
|
const api = pathApi(projectRoot);
|
|
12261
12936
|
const refs = new Map(
|
|
12262
|
-
[...buildReferenceMap(
|
|
12937
|
+
[...buildReferenceMap(target14, canonical, config, scope)].map(([canonicalPath, targetPath]) => [
|
|
12263
12938
|
api.normalize(api.join(projectRoot, canonicalPath)),
|
|
12264
12939
|
api.normalize(api.join(projectRoot, targetPath))
|
|
12265
12940
|
])
|
|
12266
12941
|
);
|
|
12267
|
-
applyCopilotInstructionArtifactRefs(
|
|
12268
|
-
addPackSkillArtifactMappings(refs,
|
|
12942
|
+
applyCopilotInstructionArtifactRefs(target14, refs, projectRoot, destinationPath, canonical);
|
|
12943
|
+
addPackSkillArtifactMappings(refs, target14, canonical, projectRoot, scope);
|
|
12269
12944
|
return refs;
|
|
12270
12945
|
}
|
|
12271
|
-
function buildOutputSourceMap(
|
|
12272
|
-
const refs = buildReferenceMap(
|
|
12946
|
+
function buildOutputSourceMap(target14, canonical, config, scope = "project", activeTargets) {
|
|
12947
|
+
const refs = buildReferenceMap(target14, canonical, config, scope);
|
|
12273
12948
|
const sourceMap = /* @__PURE__ */ new Map();
|
|
12274
12949
|
for (const rule of canonical.rules) {
|
|
12275
|
-
for (const targetPath of extraRuleOutputPaths(
|
|
12950
|
+
for (const targetPath of extraRuleOutputPaths(target14, rule, refs, scope)) {
|
|
12276
12951
|
sourceMap.set(targetPath, rule.source);
|
|
12277
12952
|
}
|
|
12278
12953
|
}
|
|
@@ -12289,7 +12964,7 @@ function buildOutputSourceMap(target13, canonical, config, scope = "project", ac
|
|
|
12289
12964
|
if (skillTargetPath) {
|
|
12290
12965
|
sourceMap.set(skillTargetPath, skill.source);
|
|
12291
12966
|
addSkillMirrorSourceEntry(
|
|
12292
|
-
|
|
12967
|
+
target14,
|
|
12293
12968
|
scope,
|
|
12294
12969
|
skillTargetPath,
|
|
12295
12970
|
skill.source,
|
|
@@ -12303,7 +12978,7 @@ function buildOutputSourceMap(target13, canonical, config, scope = "project", ac
|
|
|
12303
12978
|
if (targetPath) {
|
|
12304
12979
|
sourceMap.set(targetPath, file.absolutePath);
|
|
12305
12980
|
addSkillMirrorSourceEntry(
|
|
12306
|
-
|
|
12981
|
+
target14,
|
|
12307
12982
|
scope,
|
|
12308
12983
|
targetPath,
|
|
12309
12984
|
file.absolutePath,
|
|
@@ -12323,9 +12998,9 @@ init_shared_artifact_owner();
|
|
|
12323
12998
|
function findSharedArtifactOwner(path, activeTargets) {
|
|
12324
12999
|
if (!activeTargets) return null;
|
|
12325
13000
|
for (const targetId of activeTargets) {
|
|
12326
|
-
const
|
|
12327
|
-
if (!
|
|
12328
|
-
for (const [pathPrefix, role] of Object.entries(
|
|
13001
|
+
const descriptor14 = getDescriptor(targetId);
|
|
13002
|
+
if (!descriptor14?.sharedArtifacts) continue;
|
|
13003
|
+
for (const [pathPrefix, role] of Object.entries(descriptor14.sharedArtifacts)) {
|
|
12329
13004
|
if (role === "owner" && path.startsWith(pathPrefix)) {
|
|
12330
13005
|
return targetId;
|
|
12331
13006
|
}
|
|
@@ -12342,8 +13017,8 @@ function artifactMapTargetForResult(result, scope, activeTargets) {
|
|
|
12342
13017
|
}
|
|
12343
13018
|
return result.target;
|
|
12344
13019
|
}
|
|
12345
|
-
function sourceMapCacheKey(
|
|
12346
|
-
return `${
|
|
13020
|
+
function sourceMapCacheKey(target14, activeTargets) {
|
|
13021
|
+
return `${target14}\0${(activeTargets ?? []).join(",")}`;
|
|
12347
13022
|
}
|
|
12348
13023
|
function collectPlannedPaths(projectRoot, results) {
|
|
12349
13024
|
const api = pathApi(projectRoot);
|
|
@@ -12623,28 +13298,28 @@ function computeStatus6(existing, content) {
|
|
|
12623
13298
|
if (existing !== content) return "updated";
|
|
12624
13299
|
return "unchanged";
|
|
12625
13300
|
}
|
|
12626
|
-
function resolveGeneratedOutputPath(
|
|
12627
|
-
let resolvedPath = rewriteGeneratedOutputPath(
|
|
13301
|
+
function resolveGeneratedOutputPath(target14, path, scope) {
|
|
13302
|
+
let resolvedPath = rewriteGeneratedOutputPath(target14, path, scope);
|
|
12628
13303
|
if (resolvedPath !== null) return resolvedPath;
|
|
12629
|
-
const desc = getDescriptor(
|
|
13304
|
+
const desc = getDescriptor(target14);
|
|
12630
13305
|
if (!desc) return null;
|
|
12631
13306
|
const layout = scope === "global" ? desc.globalSupport?.layout : desc.project;
|
|
12632
13307
|
if (!layout) return null;
|
|
12633
13308
|
resolvedPath = layout.rewriteGeneratedPath ? layout.rewriteGeneratedPath(path) : path;
|
|
12634
13309
|
return resolvedPath;
|
|
12635
13310
|
}
|
|
12636
|
-
async function emitGeneratedOutput(results,
|
|
12637
|
-
const resolvedPath = resolveGeneratedOutputPath(
|
|
13311
|
+
async function emitGeneratedOutput(results, target14, out, projectRoot, scope, options) {
|
|
13312
|
+
const resolvedPath = resolveGeneratedOutputPath(target14, out.path, scope);
|
|
12638
13313
|
if (resolvedPath === null) return null;
|
|
12639
13314
|
const existing = await readFileSafe(join(projectRoot, resolvedPath));
|
|
12640
|
-
const pendingIdx = results.findIndex((r) => r.path === resolvedPath && r.target ===
|
|
13315
|
+
const pendingIdx = results.findIndex((r) => r.path === resolvedPath && r.target === target14);
|
|
12641
13316
|
const pendingResult = pendingIdx >= 0 ? results[pendingIdx] : void 0;
|
|
12642
13317
|
const content = options?.mergeContent?.(existing, pendingResult, out.content, resolvedPath) ?? out.content;
|
|
12643
13318
|
if (pendingIdx >= 0) {
|
|
12644
13319
|
results.splice(pendingIdx, 1);
|
|
12645
13320
|
}
|
|
12646
13321
|
results.push({
|
|
12647
|
-
target:
|
|
13322
|
+
target: target14,
|
|
12648
13323
|
path: resolvedPath,
|
|
12649
13324
|
content,
|
|
12650
13325
|
currentContent: existing ?? void 0,
|
|
@@ -12652,8 +13327,8 @@ async function emitGeneratedOutput(results, target13, out, projectRoot, scope, o
|
|
|
12652
13327
|
});
|
|
12653
13328
|
return resolvedPath;
|
|
12654
13329
|
}
|
|
12655
|
-
function featureContext(
|
|
12656
|
-
const caps = getTargetCapabilities(
|
|
13330
|
+
function featureContext(target14, feature, scope) {
|
|
13331
|
+
const caps = getTargetCapabilities(target14, scope);
|
|
12657
13332
|
return {
|
|
12658
13333
|
capability: caps?.[feature] ?? { level: "none" },
|
|
12659
13334
|
scope
|
|
@@ -12661,21 +13336,21 @@ function featureContext(target13, feature, scope) {
|
|
|
12661
13336
|
}
|
|
12662
13337
|
async function generateFeature(results, targets, canonical, projectRoot, enabled, scope, feature, getGen) {
|
|
12663
13338
|
if (!enabled) return;
|
|
12664
|
-
for (const
|
|
12665
|
-
const gen = getGen(
|
|
13339
|
+
for (const target14 of targets) {
|
|
13340
|
+
const gen = getGen(target14);
|
|
12666
13341
|
if (!gen) continue;
|
|
12667
|
-
const ctx = featureContext(
|
|
13342
|
+
const ctx = featureContext(target14, feature, scope);
|
|
12668
13343
|
for (const out of gen(canonical, ctx)) {
|
|
12669
|
-
const resolvedPath = await emitGeneratedOutput(results,
|
|
13344
|
+
const resolvedPath = await emitGeneratedOutput(results, target14, out, projectRoot, scope);
|
|
12670
13345
|
if (resolvedPath === null) continue;
|
|
12671
|
-
const layout = getTargetLayout(
|
|
13346
|
+
const layout = getTargetLayout(target14, scope);
|
|
12672
13347
|
if (layout?.mirrorGlobalPath) {
|
|
12673
13348
|
const raw = layout.mirrorGlobalPath(resolvedPath, targets);
|
|
12674
13349
|
const mirrorPaths = raw === null ? [] : Array.isArray(raw) ? raw : [raw];
|
|
12675
13350
|
for (const mirrorPath of mirrorPaths) {
|
|
12676
13351
|
const existingMirror = await readFileSafe(join(projectRoot, mirrorPath));
|
|
12677
13352
|
results.push({
|
|
12678
|
-
target:
|
|
13353
|
+
target: target14,
|
|
12679
13354
|
path: mirrorPath,
|
|
12680
13355
|
content: out.content,
|
|
12681
13356
|
currentContent: existingMirror ?? void 0,
|
|
@@ -12714,9 +13389,9 @@ function decoratePrimaryRootInstructions(results, canonical, scope = "project")
|
|
|
12714
13389
|
init_builtin_targets();
|
|
12715
13390
|
init_registry();
|
|
12716
13391
|
init_settings2();
|
|
12717
|
-
function mergeOutputContent(
|
|
12718
|
-
const
|
|
12719
|
-
const merged =
|
|
13392
|
+
function mergeOutputContent(target14, existing, pending, newContent, resolvedPath) {
|
|
13393
|
+
const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
|
|
13394
|
+
const merged = descriptor14?.mergeGeneratedOutputContent?.(
|
|
12720
13395
|
existing,
|
|
12721
13396
|
pending,
|
|
12722
13397
|
newContent,
|
|
@@ -12727,44 +13402,44 @@ function mergeOutputContent(target13, existing, pending, newContent, resolvedPat
|
|
|
12727
13402
|
return base !== null && SETTINGS_JSON_PATHS.includes(resolvedPath) ? mergeSettingsJson(base, newContent) : newContent;
|
|
12728
13403
|
}
|
|
12729
13404
|
async function generatePermissionsFeature(results, targets, canonical, projectRoot, scope) {
|
|
12730
|
-
for (const
|
|
12731
|
-
const gen = resolveTargetFeatureGenerator(
|
|
13405
|
+
for (const target14 of targets) {
|
|
13406
|
+
const gen = resolveTargetFeatureGenerator(target14, "permissions", void 0, scope) ?? getDescriptor(target14)?.generators.generatePermissions;
|
|
12732
13407
|
if (!gen) continue;
|
|
12733
13408
|
for (const out of gen(canonical)) {
|
|
12734
|
-
await emitGeneratedOutput(results,
|
|
12735
|
-
mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(
|
|
13409
|
+
await emitGeneratedOutput(results, target14, out, projectRoot, scope, {
|
|
13410
|
+
mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target14, existing, pending, newContent, resolvedPath)
|
|
12736
13411
|
});
|
|
12737
13412
|
}
|
|
12738
13413
|
}
|
|
12739
13414
|
}
|
|
12740
13415
|
async function generateHooksFeature(results, targets, canonical, projectRoot, scope, config) {
|
|
12741
|
-
for (const
|
|
12742
|
-
const gen = resolveTargetFeatureGenerator(
|
|
13416
|
+
for (const target14 of targets) {
|
|
13417
|
+
const gen = resolveTargetFeatureGenerator(target14, "hooks", config, scope) ?? getDescriptor(target14)?.generators.generateHooks;
|
|
12743
13418
|
if (!gen) continue;
|
|
12744
|
-
const ctx = featureContext(
|
|
13419
|
+
const ctx = featureContext(target14, "hooks", scope);
|
|
12745
13420
|
let outputs = [...gen(canonical, ctx)];
|
|
12746
|
-
const
|
|
12747
|
-
const post =
|
|
13421
|
+
const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
|
|
13422
|
+
const post = descriptor14?.postProcessHookOutputs;
|
|
12748
13423
|
if (post) {
|
|
12749
13424
|
outputs = [...await post(projectRoot, canonical, outputs)];
|
|
12750
13425
|
}
|
|
12751
13426
|
for (const out of outputs) {
|
|
12752
|
-
await emitGeneratedOutput(results,
|
|
12753
|
-
mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(
|
|
13427
|
+
await emitGeneratedOutput(results, target14, out, projectRoot, scope, {
|
|
13428
|
+
mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target14, existing, pending, newContent, resolvedPath)
|
|
12754
13429
|
});
|
|
12755
13430
|
}
|
|
12756
13431
|
}
|
|
12757
13432
|
}
|
|
12758
13433
|
async function generateScopedSettingsFeature(results, targets, canonical, projectRoot, scope) {
|
|
12759
|
-
for (const
|
|
12760
|
-
const
|
|
12761
|
-
const emit =
|
|
13434
|
+
for (const target14 of targets) {
|
|
13435
|
+
const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
|
|
13436
|
+
const emit = descriptor14?.emitScopedSettings;
|
|
12762
13437
|
if (!emit) continue;
|
|
12763
13438
|
const outputs = emit(canonical, scope);
|
|
12764
13439
|
if (outputs.length === 0) continue;
|
|
12765
13440
|
for (const out of outputs) {
|
|
12766
|
-
await emitGeneratedOutput(results,
|
|
12767
|
-
mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(
|
|
13441
|
+
await emitGeneratedOutput(results, target14, out, projectRoot, scope, {
|
|
13442
|
+
mergeContent: (existing, pending, newContent, resolvedPath) => mergeOutputContent(target14, existing, pending, newContent, resolvedPath)
|
|
12768
13443
|
});
|
|
12769
13444
|
}
|
|
12770
13445
|
}
|
|
@@ -12775,8 +13450,8 @@ async function generate(ctx) {
|
|
|
12775
13450
|
const { config, canonical, projectRoot, scope = "project", targetFilter } = ctx;
|
|
12776
13451
|
const allTargets = [...config.targets, ...config.pluginTargets ?? []];
|
|
12777
13452
|
const targets = targetFilter ? allTargets.filter((t) => targetFilter.includes(t)) : allTargets;
|
|
12778
|
-
function resolveGen(
|
|
12779
|
-
return resolveTargetFeatureGenerator(
|
|
13453
|
+
function resolveGen(target14, feature) {
|
|
13454
|
+
return resolveTargetFeatureGenerator(target14, feature, config, scope);
|
|
12780
13455
|
}
|
|
12781
13456
|
const hasRules = config.features.includes("rules");
|
|
12782
13457
|
const hasCommands = config.features.includes("commands");
|
|
@@ -12795,7 +13470,7 @@ async function generate(ctx) {
|
|
|
12795
13470
|
hasRules,
|
|
12796
13471
|
scope,
|
|
12797
13472
|
"rules",
|
|
12798
|
-
(
|
|
13473
|
+
(target14) => resolveGen(target14, "rules")
|
|
12799
13474
|
);
|
|
12800
13475
|
await generateFeature(
|
|
12801
13476
|
results,
|
|
@@ -12805,7 +13480,7 @@ async function generate(ctx) {
|
|
|
12805
13480
|
hasCommands,
|
|
12806
13481
|
scope,
|
|
12807
13482
|
"commands",
|
|
12808
|
-
(
|
|
13483
|
+
(target14) => resolveGen(target14, "commands")
|
|
12809
13484
|
);
|
|
12810
13485
|
await generateFeature(
|
|
12811
13486
|
results,
|
|
@@ -12815,7 +13490,7 @@ async function generate(ctx) {
|
|
|
12815
13490
|
hasAgents,
|
|
12816
13491
|
scope,
|
|
12817
13492
|
"agents",
|
|
12818
|
-
(
|
|
13493
|
+
(target14) => resolveGen(target14, "agents")
|
|
12819
13494
|
);
|
|
12820
13495
|
await generateFeature(
|
|
12821
13496
|
results,
|
|
@@ -12825,7 +13500,7 @@ async function generate(ctx) {
|
|
|
12825
13500
|
hasSkills,
|
|
12826
13501
|
scope,
|
|
12827
13502
|
"skills",
|
|
12828
|
-
(
|
|
13503
|
+
(target14) => resolveGen(target14, "skills")
|
|
12829
13504
|
);
|
|
12830
13505
|
await generateFeature(
|
|
12831
13506
|
results,
|
|
@@ -12835,7 +13510,7 @@ async function generate(ctx) {
|
|
|
12835
13510
|
hasMcp,
|
|
12836
13511
|
scope,
|
|
12837
13512
|
"mcp",
|
|
12838
|
-
(
|
|
13513
|
+
(target14) => resolveGen(target14, "mcp")
|
|
12839
13514
|
);
|
|
12840
13515
|
if (hasPermissions) {
|
|
12841
13516
|
await generatePermissionsFeature(results, targets, canonical, projectRoot, scope);
|
|
@@ -12849,12 +13524,12 @@ async function generate(ctx) {
|
|
|
12849
13524
|
hasIgnore,
|
|
12850
13525
|
scope,
|
|
12851
13526
|
"ignore",
|
|
12852
|
-
(
|
|
13527
|
+
(target14) => resolveGen(target14, "ignore")
|
|
12853
13528
|
);
|
|
12854
13529
|
const enabledFeatures = new Set(config.features);
|
|
12855
|
-
for (const
|
|
12856
|
-
const
|
|
12857
|
-
const scopeExtras =
|
|
13530
|
+
for (const target14 of targets) {
|
|
13531
|
+
const descriptor14 = getBuiltinTargetDefinition(target14) ?? getDescriptor(target14);
|
|
13532
|
+
const scopeExtras = descriptor14?.globalSupport?.scopeExtras;
|
|
12858
13533
|
if (scopeExtras) {
|
|
12859
13534
|
const extras = await scopeExtras(canonical, projectRoot, scope, enabledFeatures);
|
|
12860
13535
|
results.push(...extras);
|
|
@@ -13059,8 +13734,8 @@ function deepMergeObjects(base, overrides2) {
|
|
|
13059
13734
|
}
|
|
13060
13735
|
return result;
|
|
13061
13736
|
}
|
|
13062
|
-
function mergeLocalConfig(
|
|
13063
|
-
const merged = { ...
|
|
13737
|
+
function mergeLocalConfig(project14, local) {
|
|
13738
|
+
const merged = { ...project14 };
|
|
13064
13739
|
if (Array.isArray(local.targets) && local.targets.length > 0) {
|
|
13065
13740
|
merged.targets = local.targets;
|
|
13066
13741
|
}
|
|
@@ -13080,7 +13755,7 @@ function mergeLocalConfig(project13, local) {
|
|
|
13080
13755
|
);
|
|
13081
13756
|
}
|
|
13082
13757
|
if (Array.isArray(local.extends) && local.extends.length > 0) {
|
|
13083
|
-
merged.extends = [...
|
|
13758
|
+
merged.extends = [...project14.extends ?? [], ...local.extends];
|
|
13084
13759
|
}
|
|
13085
13760
|
return merged;
|
|
13086
13761
|
}
|
|
@@ -13390,13 +14065,13 @@ function parseGitlabSource(source) {
|
|
|
13390
14065
|
const slash = slug.lastIndexOf("/");
|
|
13391
14066
|
if (slash < 0) return null;
|
|
13392
14067
|
const namespace = slug.slice(0, slash).trim();
|
|
13393
|
-
const
|
|
13394
|
-
if (!namespace || !
|
|
14068
|
+
const project14 = slug.slice(slash + 1).trim();
|
|
14069
|
+
if (!namespace || !project14) return null;
|
|
13395
14070
|
return {
|
|
13396
14071
|
namespace,
|
|
13397
|
-
project:
|
|
14072
|
+
project: project14,
|
|
13398
14073
|
ref,
|
|
13399
|
-
cloneUrl: `https://gitlab.com/${namespace}/${
|
|
14074
|
+
cloneUrl: `https://gitlab.com/${namespace}/${project14}.git`
|
|
13400
14075
|
};
|
|
13401
14076
|
}
|
|
13402
14077
|
function parseGitSource(source) {
|
|
@@ -14101,6 +14776,21 @@ var TARGET_SIGNATURES = [
|
|
|
14101
14776
|
{
|
|
14102
14777
|
target: "kiro",
|
|
14103
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
|
+
]
|
|
14104
14794
|
}
|
|
14105
14795
|
];
|
|
14106
14796
|
async function detectNativeFormat(repoPath) {
|
|
@@ -14131,10 +14821,11 @@ init_importer7();
|
|
|
14131
14821
|
init_importer6();
|
|
14132
14822
|
init_importer8();
|
|
14133
14823
|
init_importer4();
|
|
14134
|
-
|
|
14824
|
+
init_importer13();
|
|
14135
14825
|
init_importer3();
|
|
14136
14826
|
init_importer5();
|
|
14137
14827
|
init_importer9();
|
|
14828
|
+
init_importer11();
|
|
14138
14829
|
init_importer10();
|
|
14139
14830
|
var NATIVE_IMPORTERS = {
|
|
14140
14831
|
"claude-code": importFromClaudeCode,
|
|
@@ -14146,7 +14837,8 @@ var NATIVE_IMPORTERS = {
|
|
|
14146
14837
|
cline: importFromCline,
|
|
14147
14838
|
continue: importFromContinue,
|
|
14148
14839
|
junie: importFromJunie,
|
|
14149
|
-
kiro: importFromKiro
|
|
14840
|
+
kiro: importFromKiro,
|
|
14841
|
+
"kilo-code": importFromKiloCode
|
|
14150
14842
|
};
|
|
14151
14843
|
async function importNativeToCanonical(repoPath, targetName) {
|
|
14152
14844
|
const importFn = NATIVE_IMPORTERS[targetName];
|
|
@@ -14595,9 +15287,9 @@ async function loadPlugin(entry, projectRoot) {
|
|
|
14595
15287
|
const descriptors = [];
|
|
14596
15288
|
for (const raw of rawDescriptors) {
|
|
14597
15289
|
try {
|
|
14598
|
-
const
|
|
14599
|
-
registerTargetDescriptor(
|
|
14600
|
-
descriptors.push(
|
|
15290
|
+
const descriptor14 = validateDescriptor(raw);
|
|
15291
|
+
registerTargetDescriptor(descriptor14);
|
|
15292
|
+
descriptors.push(descriptor14);
|
|
14601
15293
|
} catch (err) {
|
|
14602
15294
|
throw new Error(
|
|
14603
15295
|
`Plugin '${entry.source}' exported an invalid descriptor: ${err instanceof Error ? err.message : String(err)}`,
|
|
@@ -14636,14 +15328,14 @@ init_fs();
|
|
|
14636
15328
|
// src/targets/catalog/target-catalog.ts
|
|
14637
15329
|
init_builtin_targets();
|
|
14638
15330
|
var TARGET_CATALOG = Object.fromEntries(
|
|
14639
|
-
BUILTIN_TARGETS.map((
|
|
14640
|
-
|
|
15331
|
+
BUILTIN_TARGETS.map((target14) => [
|
|
15332
|
+
target14.id,
|
|
14641
15333
|
{
|
|
14642
|
-
importFrom:
|
|
14643
|
-
emptyImportMessage:
|
|
14644
|
-
lintRules:
|
|
14645
|
-
lint:
|
|
14646
|
-
capabilities:
|
|
15334
|
+
importFrom: target14.generators.importFrom,
|
|
15335
|
+
emptyImportMessage: target14.emptyImportMessage,
|
|
15336
|
+
lintRules: target14.lintRules,
|
|
15337
|
+
lint: target14.lint,
|
|
15338
|
+
capabilities: target14.capabilities
|
|
14647
15339
|
}
|
|
14648
15340
|
])
|
|
14649
15341
|
);
|
|
@@ -14823,14 +15515,14 @@ async function runLint(config, canonical, projectRoot, targetFilter, options = {
|
|
|
14823
15515
|
const hasHooks = config.features.includes("hooks");
|
|
14824
15516
|
const diagnostics = [];
|
|
14825
15517
|
const projectFiles = scope === "global" ? [] : await getProjectFiles(projectRoot);
|
|
14826
|
-
for (const
|
|
14827
|
-
const fullDesc = getDescriptor(
|
|
14828
|
-
const
|
|
14829
|
-
if (
|
|
15518
|
+
for (const target14 of targets) {
|
|
15519
|
+
const fullDesc = getDescriptor(target14);
|
|
15520
|
+
const descriptor14 = isBuiltinTargetId(target14) ? getTargetCatalogEntry(target14) : fullDesc;
|
|
15521
|
+
if (descriptor14?.capabilities) {
|
|
14830
15522
|
diagnostics.push(
|
|
14831
15523
|
...lintSilentFeatureDrops({
|
|
14832
|
-
target:
|
|
14833
|
-
capabilities:
|
|
15524
|
+
target: target14,
|
|
15525
|
+
capabilities: descriptor14.capabilities,
|
|
14834
15526
|
canonical,
|
|
14835
15527
|
enabledFeatures: config.features
|
|
14836
15528
|
})
|
|
@@ -14839,7 +15531,7 @@ async function runLint(config, canonical, projectRoot, targetFilter, options = {
|
|
|
14839
15531
|
if (hasHooks) {
|
|
14840
15532
|
diagnostics.push(
|
|
14841
15533
|
...lintHookScriptReferences({
|
|
14842
|
-
target:
|
|
15534
|
+
target: target14,
|
|
14843
15535
|
canonical,
|
|
14844
15536
|
hasScriptProjection: fullDesc?.postProcessHookOutputs !== void 0
|
|
14845
15537
|
})
|
|
@@ -14848,30 +15540,30 @@ async function runLint(config, canonical, projectRoot, targetFilter, options = {
|
|
|
14848
15540
|
if (hasRules) {
|
|
14849
15541
|
diagnostics.push(
|
|
14850
15542
|
...lintRuleScopeInversion({
|
|
14851
|
-
target:
|
|
15543
|
+
target: target14,
|
|
14852
15544
|
canonical,
|
|
14853
15545
|
preservesManualActivation: fullDesc?.preservesManualActivation === true
|
|
14854
15546
|
})
|
|
14855
15547
|
);
|
|
14856
15548
|
}
|
|
14857
|
-
if (hasRules &&
|
|
14858
|
-
diagnostics.push(...
|
|
15549
|
+
if (hasRules && descriptor14?.lintRules) {
|
|
15550
|
+
diagnostics.push(...descriptor14.lintRules(canonical, projectRoot, projectFiles, { scope }));
|
|
14859
15551
|
}
|
|
14860
15552
|
if (fullDesc?.generators.lint) {
|
|
14861
15553
|
diagnostics.push(...fullDesc.generators.lint(canonical));
|
|
14862
15554
|
}
|
|
14863
15555
|
const lintOpts = { scope };
|
|
14864
|
-
if (hasCommands &&
|
|
14865
|
-
diagnostics.push(...
|
|
15556
|
+
if (hasCommands && descriptor14?.lint?.commands) {
|
|
15557
|
+
diagnostics.push(...descriptor14.lint.commands(canonical, lintOpts));
|
|
14866
15558
|
}
|
|
14867
|
-
if (hasMcp &&
|
|
14868
|
-
diagnostics.push(...
|
|
15559
|
+
if (hasMcp && descriptor14?.lint?.mcp) {
|
|
15560
|
+
diagnostics.push(...descriptor14.lint.mcp(canonical, lintOpts));
|
|
14869
15561
|
}
|
|
14870
|
-
if (hasPermissions &&
|
|
14871
|
-
diagnostics.push(...
|
|
15562
|
+
if (hasPermissions && descriptor14?.lint?.permissions) {
|
|
15563
|
+
diagnostics.push(...descriptor14.lint.permissions(canonical, lintOpts));
|
|
14872
15564
|
}
|
|
14873
|
-
if (hasHooks &&
|
|
14874
|
-
diagnostics.push(...
|
|
15565
|
+
if (hasHooks && descriptor14?.lint?.hooks) {
|
|
15566
|
+
diagnostics.push(...descriptor14.lint.hooks(canonical, lintOpts));
|
|
14875
15567
|
}
|
|
14876
15568
|
}
|
|
14877
15569
|
const hasErrors = diagnostics.some((d) => d.level === "error");
|
|
@@ -15089,14 +15781,14 @@ async function checkLockSync(opts) {
|
|
|
15089
15781
|
// src/public/engine.ts
|
|
15090
15782
|
init_registry();
|
|
15091
15783
|
init_target_ids();
|
|
15092
|
-
async function importFrom(
|
|
15093
|
-
const
|
|
15094
|
-
if (!
|
|
15095
|
-
throw new TargetNotFoundError(
|
|
15784
|
+
async function importFrom(target14, opts) {
|
|
15785
|
+
const descriptor14 = getDescriptor(target14);
|
|
15786
|
+
if (!descriptor14) {
|
|
15787
|
+
throw new TargetNotFoundError(target14, {
|
|
15096
15788
|
supported: [...TARGET_IDS, ...getAllDescriptors().map((d) => d.id)]
|
|
15097
15789
|
});
|
|
15098
15790
|
}
|
|
15099
|
-
return
|
|
15791
|
+
return descriptor14.generators.importFrom(opts.root, { scope: opts.scope ?? "project" });
|
|
15100
15792
|
}
|
|
15101
15793
|
async function loadConfig2(projectRoot) {
|
|
15102
15794
|
return loadConfigFromDir(projectRoot);
|