rulesync 8.14.0 → 8.15.1
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/README.md +4 -4
- package/dist/{chunk-C7PHKGD2.js → chunk-3DM6NLND.js} +1806 -718
- package/dist/cli/index.cjs +2190 -1095
- package/dist/cli/index.js +9 -2
- package/dist/index.cjs +1833 -745
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -473,7 +473,8 @@ function validateOutputRoot(outputRoot) {
|
|
|
473
473
|
throw new Error("outputRoot cannot be an empty string");
|
|
474
474
|
}
|
|
475
475
|
if (isAbsolute(outputRoot)) {
|
|
476
|
-
const
|
|
476
|
+
const separatorRegex = process.platform === "win32" ? /[/\\]/ : /\//;
|
|
477
|
+
const segments = outputRoot.split(separatorRegex);
|
|
477
478
|
if (segments.includes("..")) {
|
|
478
479
|
throw new Error(`Path traversal detected: ${outputRoot}`);
|
|
479
480
|
}
|
|
@@ -9992,11 +9993,11 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
9992
9993
|
};
|
|
9993
9994
|
|
|
9994
9995
|
// src/features/permissions/permissions-processor.ts
|
|
9995
|
-
import { z as
|
|
9996
|
+
import { z as z37 } from "zod/mini";
|
|
9996
9997
|
|
|
9997
|
-
// src/features/permissions/
|
|
9998
|
+
// src/features/permissions/augmentcode-permissions.ts
|
|
9998
9999
|
import { join as join65 } from "path";
|
|
9999
|
-
import {
|
|
10000
|
+
import { z as z30 } from "zod/mini";
|
|
10000
10001
|
|
|
10001
10002
|
// src/features/permissions/rulesync-permissions.ts
|
|
10002
10003
|
import { join as join64 } from "path";
|
|
@@ -10091,7 +10092,397 @@ var ToolPermissions = class extends ToolFile {
|
|
|
10091
10092
|
}
|
|
10092
10093
|
};
|
|
10093
10094
|
|
|
10095
|
+
// src/features/permissions/augmentcode-permissions.ts
|
|
10096
|
+
var moduleLogger = new ConsoleLogger();
|
|
10097
|
+
var AugmentPermissionTypeSchema = z30.enum(["allow", "deny", "ask-user"]);
|
|
10098
|
+
var AugmentToolPermissionSchema = z30.looseObject({
|
|
10099
|
+
toolName: z30.string(),
|
|
10100
|
+
shellInputRegex: z30.optional(z30.string()),
|
|
10101
|
+
permission: z30.looseObject({
|
|
10102
|
+
type: AugmentPermissionTypeSchema
|
|
10103
|
+
})
|
|
10104
|
+
});
|
|
10105
|
+
var AugmentSettingsSchema = z30.looseObject({
|
|
10106
|
+
toolPermissions: z30.optional(z30.array(AugmentToolPermissionSchema))
|
|
10107
|
+
});
|
|
10108
|
+
var CANONICAL_TO_AUGMENT_TOOL_NAMES = {
|
|
10109
|
+
bash: "launch-process",
|
|
10110
|
+
read: "view",
|
|
10111
|
+
edit: "str-replace-editor",
|
|
10112
|
+
write: "save-file",
|
|
10113
|
+
webfetch: "web-fetch",
|
|
10114
|
+
websearch: "web-search"
|
|
10115
|
+
};
|
|
10116
|
+
var AUGMENT_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
10117
|
+
Object.entries(CANONICAL_TO_AUGMENT_TOOL_NAMES).map(([k, v]) => [v, k])
|
|
10118
|
+
);
|
|
10119
|
+
function toAugmentToolName(canonical) {
|
|
10120
|
+
return CANONICAL_TO_AUGMENT_TOOL_NAMES[canonical] ?? canonical;
|
|
10121
|
+
}
|
|
10122
|
+
function toCanonicalToolName(augmentName) {
|
|
10123
|
+
return AUGMENT_TO_CANONICAL_TOOL_NAMES[augmentName] ?? augmentName;
|
|
10124
|
+
}
|
|
10125
|
+
function actionToAugmentType(action) {
|
|
10126
|
+
switch (action) {
|
|
10127
|
+
case "allow":
|
|
10128
|
+
return "allow";
|
|
10129
|
+
case "deny":
|
|
10130
|
+
return "deny";
|
|
10131
|
+
case "ask":
|
|
10132
|
+
return "ask-user";
|
|
10133
|
+
}
|
|
10134
|
+
}
|
|
10135
|
+
function augmentTypeToAction(type) {
|
|
10136
|
+
switch (type) {
|
|
10137
|
+
case "allow":
|
|
10138
|
+
return "allow";
|
|
10139
|
+
case "deny":
|
|
10140
|
+
return "deny";
|
|
10141
|
+
case "ask-user":
|
|
10142
|
+
return "ask";
|
|
10143
|
+
}
|
|
10144
|
+
}
|
|
10145
|
+
function globToShellRegex(glob) {
|
|
10146
|
+
let regex = "";
|
|
10147
|
+
for (const char of glob) {
|
|
10148
|
+
if (char === "*") {
|
|
10149
|
+
regex += ".*";
|
|
10150
|
+
} else if (char === "?") {
|
|
10151
|
+
regex += ".";
|
|
10152
|
+
} else if (/[\\^$.|+(){}[\]]/.test(char)) {
|
|
10153
|
+
regex += `\\${char}`;
|
|
10154
|
+
} else {
|
|
10155
|
+
regex += char;
|
|
10156
|
+
}
|
|
10157
|
+
}
|
|
10158
|
+
return `^${regex}$`;
|
|
10159
|
+
}
|
|
10160
|
+
function shellRegexToGlob(regex) {
|
|
10161
|
+
let body = regex;
|
|
10162
|
+
if (body.startsWith("^")) body = body.slice(1);
|
|
10163
|
+
if (body.endsWith("$")) body = body.slice(0, -1);
|
|
10164
|
+
let glob = "";
|
|
10165
|
+
let i = 0;
|
|
10166
|
+
while (i < body.length) {
|
|
10167
|
+
const ch = body[i];
|
|
10168
|
+
if (ch === "\\" && i + 1 < body.length) {
|
|
10169
|
+
glob += body[i + 1];
|
|
10170
|
+
i += 2;
|
|
10171
|
+
continue;
|
|
10172
|
+
}
|
|
10173
|
+
if (ch === "." && body[i + 1] === "*") {
|
|
10174
|
+
glob += "*";
|
|
10175
|
+
i += 2;
|
|
10176
|
+
continue;
|
|
10177
|
+
}
|
|
10178
|
+
if (ch === ".") {
|
|
10179
|
+
glob += "?";
|
|
10180
|
+
i += 1;
|
|
10181
|
+
continue;
|
|
10182
|
+
}
|
|
10183
|
+
glob += ch;
|
|
10184
|
+
i += 1;
|
|
10185
|
+
}
|
|
10186
|
+
return glob;
|
|
10187
|
+
}
|
|
10188
|
+
function isShellRegexRoundtrippable(regex) {
|
|
10189
|
+
if (!regex.startsWith("^") || !regex.endsWith("$")) {
|
|
10190
|
+
return false;
|
|
10191
|
+
}
|
|
10192
|
+
const body = regex.slice(1, -1);
|
|
10193
|
+
let i = 0;
|
|
10194
|
+
while (i < body.length) {
|
|
10195
|
+
const ch = body[i];
|
|
10196
|
+
if (ch === "\\" && i + 1 < body.length) {
|
|
10197
|
+
i += 2;
|
|
10198
|
+
continue;
|
|
10199
|
+
}
|
|
10200
|
+
if (ch === "." && body[i + 1] === "*") {
|
|
10201
|
+
i += 2;
|
|
10202
|
+
continue;
|
|
10203
|
+
}
|
|
10204
|
+
if (ch === ".") {
|
|
10205
|
+
i += 1;
|
|
10206
|
+
continue;
|
|
10207
|
+
}
|
|
10208
|
+
if (/[$^|+?*(){}[\]]/.test(ch ?? "")) {
|
|
10209
|
+
return false;
|
|
10210
|
+
}
|
|
10211
|
+
i += 1;
|
|
10212
|
+
}
|
|
10213
|
+
return true;
|
|
10214
|
+
}
|
|
10215
|
+
var MANAGED_AUGMENT_TOOL_NAMES = new Set(Object.values(CANONICAL_TO_AUGMENT_TOOL_NAMES));
|
|
10216
|
+
var AugmentcodePermissions = class _AugmentcodePermissions extends ToolPermissions {
|
|
10217
|
+
constructor(params) {
|
|
10218
|
+
super({
|
|
10219
|
+
...params,
|
|
10220
|
+
fileContent: params.fileContent ?? "{}"
|
|
10221
|
+
});
|
|
10222
|
+
if (params.validate) {
|
|
10223
|
+
const result = this.validate();
|
|
10224
|
+
if (!result.success) {
|
|
10225
|
+
throw result.error;
|
|
10226
|
+
}
|
|
10227
|
+
}
|
|
10228
|
+
}
|
|
10229
|
+
isDeletable() {
|
|
10230
|
+
return false;
|
|
10231
|
+
}
|
|
10232
|
+
static getSettablePaths(_options = {}) {
|
|
10233
|
+
return {
|
|
10234
|
+
relativeDirPath: ".augment",
|
|
10235
|
+
relativeFilePath: "settings.json"
|
|
10236
|
+
};
|
|
10237
|
+
}
|
|
10238
|
+
static async fromFile({
|
|
10239
|
+
outputRoot = process.cwd(),
|
|
10240
|
+
validate = true,
|
|
10241
|
+
global = false
|
|
10242
|
+
}) {
|
|
10243
|
+
const paths = _AugmentcodePermissions.getSettablePaths({ global });
|
|
10244
|
+
const filePath = join65(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10245
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"toolPermissions":[]}';
|
|
10246
|
+
return new _AugmentcodePermissions({
|
|
10247
|
+
outputRoot,
|
|
10248
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10249
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10250
|
+
fileContent,
|
|
10251
|
+
validate
|
|
10252
|
+
});
|
|
10253
|
+
}
|
|
10254
|
+
static async fromRulesyncPermissions({
|
|
10255
|
+
outputRoot = process.cwd(),
|
|
10256
|
+
rulesyncPermissions,
|
|
10257
|
+
global = false,
|
|
10258
|
+
logger
|
|
10259
|
+
}) {
|
|
10260
|
+
const paths = _AugmentcodePermissions.getSettablePaths({ global });
|
|
10261
|
+
const filePath = join65(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10262
|
+
const existingContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
10263
|
+
let settings;
|
|
10264
|
+
try {
|
|
10265
|
+
const parsed = JSON.parse(existingContent);
|
|
10266
|
+
const result = AugmentSettingsSchema.safeParse(parsed);
|
|
10267
|
+
if (!result.success) {
|
|
10268
|
+
throw new Error(formatError(result.error));
|
|
10269
|
+
}
|
|
10270
|
+
settings = result.data;
|
|
10271
|
+
} catch (error) {
|
|
10272
|
+
throw new Error(
|
|
10273
|
+
`Failed to parse existing AugmentCode settings at ${filePath}: ${formatError(error)}`,
|
|
10274
|
+
{ cause: error }
|
|
10275
|
+
);
|
|
10276
|
+
}
|
|
10277
|
+
const config = rulesyncPermissions.getJson();
|
|
10278
|
+
const generated = convertRulesyncToAugmentEntries({ config, logger });
|
|
10279
|
+
const existingEntries = settings.toolPermissions ?? [];
|
|
10280
|
+
const generatedKeys = new Set(
|
|
10281
|
+
generated.map((e) => `${e.toolName}|${e.shellInputRegex ?? ""}|${e.permission.type}`)
|
|
10282
|
+
);
|
|
10283
|
+
const preservedEntries = existingEntries.filter((entry) => {
|
|
10284
|
+
if (!MANAGED_AUGMENT_TOOL_NAMES.has(entry.toolName)) return true;
|
|
10285
|
+
if (entry.permission.type === "deny") {
|
|
10286
|
+
const key = `${entry.toolName}|${entry.shellInputRegex ?? ""}|${entry.permission.type}`;
|
|
10287
|
+
return !generatedKeys.has(key);
|
|
10288
|
+
}
|
|
10289
|
+
return false;
|
|
10290
|
+
});
|
|
10291
|
+
const sortedAll = sortAugmentEntries([...generated, ...preservedEntries]);
|
|
10292
|
+
const merged = {
|
|
10293
|
+
...settings,
|
|
10294
|
+
toolPermissions: sortedAll
|
|
10295
|
+
};
|
|
10296
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
10297
|
+
return new _AugmentcodePermissions({
|
|
10298
|
+
outputRoot,
|
|
10299
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10300
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10301
|
+
fileContent,
|
|
10302
|
+
validate: true
|
|
10303
|
+
});
|
|
10304
|
+
}
|
|
10305
|
+
toRulesyncPermissions() {
|
|
10306
|
+
let settings;
|
|
10307
|
+
try {
|
|
10308
|
+
const parsed = JSON.parse(this.getFileContent());
|
|
10309
|
+
const result = AugmentSettingsSchema.safeParse(parsed);
|
|
10310
|
+
if (!result.success) {
|
|
10311
|
+
throw new Error(formatError(result.error));
|
|
10312
|
+
}
|
|
10313
|
+
settings = result.data;
|
|
10314
|
+
} catch (error) {
|
|
10315
|
+
throw new Error(
|
|
10316
|
+
`Failed to parse AugmentCode permissions content in ${join65(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10317
|
+
{ cause: error }
|
|
10318
|
+
);
|
|
10319
|
+
}
|
|
10320
|
+
const config = convertAugmentToRulesyncPermissions({
|
|
10321
|
+
entries: settings.toolPermissions ?? [],
|
|
10322
|
+
logger: moduleLogger
|
|
10323
|
+
});
|
|
10324
|
+
return this.toRulesyncPermissionsDefault({
|
|
10325
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
10326
|
+
});
|
|
10327
|
+
}
|
|
10328
|
+
validate() {
|
|
10329
|
+
try {
|
|
10330
|
+
const parsed = JSON.parse(this.fileContent || "{}");
|
|
10331
|
+
const result = AugmentSettingsSchema.safeParse(parsed);
|
|
10332
|
+
if (!result.success) {
|
|
10333
|
+
return { success: false, error: result.error };
|
|
10334
|
+
}
|
|
10335
|
+
return { success: true, error: null };
|
|
10336
|
+
} catch (error) {
|
|
10337
|
+
return {
|
|
10338
|
+
success: false,
|
|
10339
|
+
error: new Error(`Failed to parse AugmentCode permissions JSON: ${formatError(error)}`)
|
|
10340
|
+
};
|
|
10341
|
+
}
|
|
10342
|
+
}
|
|
10343
|
+
static forDeletion({
|
|
10344
|
+
outputRoot = process.cwd(),
|
|
10345
|
+
relativeDirPath,
|
|
10346
|
+
relativeFilePath
|
|
10347
|
+
}) {
|
|
10348
|
+
return new _AugmentcodePermissions({
|
|
10349
|
+
outputRoot,
|
|
10350
|
+
relativeDirPath,
|
|
10351
|
+
relativeFilePath,
|
|
10352
|
+
fileContent: JSON.stringify({ toolPermissions: [] }, null, 2),
|
|
10353
|
+
validate: false
|
|
10354
|
+
});
|
|
10355
|
+
}
|
|
10356
|
+
};
|
|
10357
|
+
function convertRulesyncToAugmentEntries({
|
|
10358
|
+
config,
|
|
10359
|
+
logger
|
|
10360
|
+
}) {
|
|
10361
|
+
const entries = [];
|
|
10362
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
10363
|
+
const augmentToolName = toAugmentToolName(category);
|
|
10364
|
+
const isManaged = MANAGED_AUGMENT_TOOL_NAMES.has(augmentToolName);
|
|
10365
|
+
if (!isManaged && augmentToolName === category) {
|
|
10366
|
+
logger?.warn(
|
|
10367
|
+
`AugmentCode permissions: passing through unknown tool category '${category}' as toolName.`
|
|
10368
|
+
);
|
|
10369
|
+
}
|
|
10370
|
+
if (augmentToolName === "launch-process") {
|
|
10371
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
10372
|
+
const augmentType = actionToAugmentType(action);
|
|
10373
|
+
if (pattern === "*") {
|
|
10374
|
+
entries.push({ toolName: augmentToolName, permission: { type: augmentType } });
|
|
10375
|
+
} else {
|
|
10376
|
+
entries.push({
|
|
10377
|
+
toolName: augmentToolName,
|
|
10378
|
+
shellInputRegex: globToShellRegex(pattern),
|
|
10379
|
+
permission: { type: augmentType }
|
|
10380
|
+
});
|
|
10381
|
+
}
|
|
10382
|
+
}
|
|
10383
|
+
continue;
|
|
10384
|
+
}
|
|
10385
|
+
const hasAnyDeny = Object.values(rules).some((a) => a === "deny");
|
|
10386
|
+
if (hasAnyDeny) {
|
|
10387
|
+
const collapsed = Object.keys(rules).filter((p) => p !== "*");
|
|
10388
|
+
if (collapsed.length > 0) {
|
|
10389
|
+
logger?.warn(
|
|
10390
|
+
`AugmentCode permissions: category '${category}' contains a 'deny' rule. AugmentCode lacks a per-input matcher for this tool category, so all rules collapse into a single catch-all 'deny' (fail-closed). Affected patterns: ${collapsed.join(", ")}.`
|
|
10391
|
+
);
|
|
10392
|
+
}
|
|
10393
|
+
entries.push({ toolName: augmentToolName, permission: { type: "deny" } });
|
|
10394
|
+
continue;
|
|
10395
|
+
}
|
|
10396
|
+
const droppedPatterns = [];
|
|
10397
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
10398
|
+
if (pattern === "*") {
|
|
10399
|
+
entries.push({
|
|
10400
|
+
toolName: augmentToolName,
|
|
10401
|
+
permission: { type: actionToAugmentType(action) }
|
|
10402
|
+
});
|
|
10403
|
+
} else {
|
|
10404
|
+
droppedPatterns.push(pattern);
|
|
10405
|
+
}
|
|
10406
|
+
}
|
|
10407
|
+
if (droppedPatterns.length > 0) {
|
|
10408
|
+
logger?.warn(
|
|
10409
|
+
`AugmentCode permissions: dropping non-wildcard patterns for category '${category}' (${droppedPatterns.join(", ")}); AugmentCode does not document a per-input matcher for this tool. Use a 'deny' rule with pattern '*' if you need to block this tool entirely.`
|
|
10410
|
+
);
|
|
10411
|
+
}
|
|
10412
|
+
}
|
|
10413
|
+
return entries;
|
|
10414
|
+
}
|
|
10415
|
+
function sortAugmentEntries(entries) {
|
|
10416
|
+
const typePriority = {
|
|
10417
|
+
deny: 0,
|
|
10418
|
+
"ask-user": 1,
|
|
10419
|
+
allow: 2
|
|
10420
|
+
};
|
|
10421
|
+
const decorated = entries.map((entry, index) => ({ entry, index }));
|
|
10422
|
+
decorated.sort((a, b) => {
|
|
10423
|
+
const aHasRegex = a.entry.shellInputRegex ? 1 : 0;
|
|
10424
|
+
const bHasRegex = b.entry.shellInputRegex ? 1 : 0;
|
|
10425
|
+
if (aHasRegex !== bHasRegex) return bHasRegex - aHasRegex;
|
|
10426
|
+
const aType = typePriority[a.entry.permission.type];
|
|
10427
|
+
const bType = typePriority[b.entry.permission.type];
|
|
10428
|
+
if (aType !== bType) return aType - bType;
|
|
10429
|
+
if (a.entry.shellInputRegex && b.entry.shellInputRegex) {
|
|
10430
|
+
const aLen = a.entry.shellInputRegex.length;
|
|
10431
|
+
const bLen = b.entry.shellInputRegex.length;
|
|
10432
|
+
if (aLen !== bLen) return bLen - aLen;
|
|
10433
|
+
}
|
|
10434
|
+
return a.index - b.index;
|
|
10435
|
+
});
|
|
10436
|
+
return decorated.map((d) => d.entry);
|
|
10437
|
+
}
|
|
10438
|
+
function convertAugmentToRulesyncPermissions({
|
|
10439
|
+
entries,
|
|
10440
|
+
logger
|
|
10441
|
+
}) {
|
|
10442
|
+
const actionPriority = {
|
|
10443
|
+
deny: 2,
|
|
10444
|
+
ask: 1,
|
|
10445
|
+
allow: 0
|
|
10446
|
+
};
|
|
10447
|
+
const permission = {};
|
|
10448
|
+
for (const entry of entries) {
|
|
10449
|
+
const canonical = toCanonicalToolName(entry.toolName);
|
|
10450
|
+
const action = augmentTypeToAction(entry.permission.type);
|
|
10451
|
+
let pattern;
|
|
10452
|
+
if (entry.toolName === "launch-process" && entry.shellInputRegex) {
|
|
10453
|
+
const regex = entry.shellInputRegex;
|
|
10454
|
+
if (isShellRegexRoundtrippable(regex)) {
|
|
10455
|
+
pattern = shellRegexToGlob(regex);
|
|
10456
|
+
} else {
|
|
10457
|
+
if (action === "deny") {
|
|
10458
|
+
logger?.warn(
|
|
10459
|
+
`AugmentCode permissions: shellInputRegex '${regex}' on tool '${entry.toolName}' is not faithfully roundtrippable to a glob. Importing as the catch-all '*' pattern (fail-closed) so the deny rule cannot be silently narrowed on regenerate.`
|
|
10460
|
+
);
|
|
10461
|
+
pattern = "*";
|
|
10462
|
+
} else {
|
|
10463
|
+
pattern = shellRegexToGlob(regex);
|
|
10464
|
+
logger?.warn(
|
|
10465
|
+
`AugmentCode permissions: shellInputRegex '${regex}' on tool '${entry.toolName}' is not faithfully roundtrippable to a glob. Importing as glob '${pattern}'; the rule may match a different set of inputs after regenerate.`
|
|
10466
|
+
);
|
|
10467
|
+
}
|
|
10468
|
+
}
|
|
10469
|
+
} else {
|
|
10470
|
+
pattern = "*";
|
|
10471
|
+
}
|
|
10472
|
+
if (!permission[canonical]) {
|
|
10473
|
+
permission[canonical] = {};
|
|
10474
|
+
}
|
|
10475
|
+
const existing = permission[canonical][pattern];
|
|
10476
|
+
if (existing === void 0 || actionPriority[action] > actionPriority[existing]) {
|
|
10477
|
+
permission[canonical][pattern] = action;
|
|
10478
|
+
}
|
|
10479
|
+
}
|
|
10480
|
+
return { permission };
|
|
10481
|
+
}
|
|
10482
|
+
|
|
10094
10483
|
// src/features/permissions/claudecode-permissions.ts
|
|
10484
|
+
import { join as join66 } from "path";
|
|
10485
|
+
import { uniq as uniq3 } from "es-toolkit";
|
|
10095
10486
|
var CANONICAL_TO_CLAUDE_TOOL_NAMES = {
|
|
10096
10487
|
bash: "Bash",
|
|
10097
10488
|
read: "Read",
|
|
@@ -10110,7 +10501,7 @@ var CLAUDE_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
|
10110
10501
|
function toClaudeToolName(canonical) {
|
|
10111
10502
|
return CANONICAL_TO_CLAUDE_TOOL_NAMES[canonical] ?? canonical;
|
|
10112
10503
|
}
|
|
10113
|
-
function
|
|
10504
|
+
function toCanonicalToolName2(claudeName) {
|
|
10114
10505
|
return CLAUDE_TO_CANONICAL_TOOL_NAMES[claudeName] ?? claudeName;
|
|
10115
10506
|
}
|
|
10116
10507
|
function parseClaudePermissionEntry(entry) {
|
|
@@ -10152,7 +10543,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
10152
10543
|
validate = true
|
|
10153
10544
|
}) {
|
|
10154
10545
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
10155
|
-
const filePath =
|
|
10546
|
+
const filePath = join66(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10156
10547
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
10157
10548
|
return new _ClaudecodePermissions({
|
|
10158
10549
|
outputRoot,
|
|
@@ -10168,7 +10559,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
10168
10559
|
logger
|
|
10169
10560
|
}) {
|
|
10170
10561
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
10171
|
-
const filePath =
|
|
10562
|
+
const filePath = join66(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10172
10563
|
const existingContent = await readOrInitializeFileContent(
|
|
10173
10564
|
filePath,
|
|
10174
10565
|
JSON.stringify({}, null, 2)
|
|
@@ -10245,7 +10636,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
10245
10636
|
settings = JSON.parse(this.getFileContent());
|
|
10246
10637
|
} catch (error) {
|
|
10247
10638
|
throw new Error(
|
|
10248
|
-
`Failed to parse Claude permissions content in ${
|
|
10639
|
+
`Failed to parse Claude permissions content in ${join66(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10249
10640
|
{ cause: error }
|
|
10250
10641
|
);
|
|
10251
10642
|
}
|
|
@@ -10304,7 +10695,7 @@ function convertClaudeToRulesyncPermissions(params) {
|
|
|
10304
10695
|
const processEntries = (entries, action) => {
|
|
10305
10696
|
for (const entry of entries) {
|
|
10306
10697
|
const { toolName, pattern } = parseClaudePermissionEntry(entry);
|
|
10307
|
-
const canonical =
|
|
10698
|
+
const canonical = toCanonicalToolName2(toolName);
|
|
10308
10699
|
if (!permission[canonical]) {
|
|
10309
10700
|
permission[canonical] = {};
|
|
10310
10701
|
}
|
|
@@ -10317,17 +10708,205 @@ function convertClaudeToRulesyncPermissions(params) {
|
|
|
10317
10708
|
return { permission };
|
|
10318
10709
|
}
|
|
10319
10710
|
|
|
10320
|
-
// src/features/permissions/
|
|
10321
|
-
import { join as
|
|
10322
|
-
import
|
|
10323
|
-
|
|
10324
|
-
var
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10711
|
+
// src/features/permissions/cline-permissions.ts
|
|
10712
|
+
import { join as join67 } from "path";
|
|
10713
|
+
import { uniq as uniq4 } from "es-toolkit";
|
|
10714
|
+
import { z as z31 } from "zod/mini";
|
|
10715
|
+
var ClineCommandPermissionsSchema = z31.looseObject({
|
|
10716
|
+
allow: z31.optional(z31.array(z31.string())),
|
|
10717
|
+
deny: z31.optional(z31.array(z31.string())),
|
|
10718
|
+
allowRedirects: z31.optional(z31.boolean())
|
|
10719
|
+
});
|
|
10720
|
+
var ClinePermissions = class _ClinePermissions extends ToolPermissions {
|
|
10721
|
+
constructor(params) {
|
|
10722
|
+
super({
|
|
10723
|
+
...params,
|
|
10724
|
+
fileContent: params.fileContent ?? "{}"
|
|
10725
|
+
});
|
|
10726
|
+
if (params.validate) {
|
|
10727
|
+
const result = this.validate();
|
|
10728
|
+
if (!result.success) {
|
|
10729
|
+
throw result.error;
|
|
10730
|
+
}
|
|
10731
|
+
}
|
|
10732
|
+
}
|
|
10733
|
+
isDeletable() {
|
|
10734
|
+
return false;
|
|
10735
|
+
}
|
|
10736
|
+
static getSettablePaths(_options = {}) {
|
|
10737
|
+
return {
|
|
10738
|
+
relativeDirPath: ".cline",
|
|
10739
|
+
relativeFilePath: "command-permissions.json"
|
|
10740
|
+
};
|
|
10741
|
+
}
|
|
10742
|
+
static async fromFile({
|
|
10743
|
+
outputRoot = process.cwd(),
|
|
10744
|
+
validate = true,
|
|
10745
|
+
global = false
|
|
10746
|
+
}) {
|
|
10747
|
+
const paths = _ClinePermissions.getSettablePaths({ global });
|
|
10748
|
+
const filePath = join67(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10749
|
+
const fileContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
10750
|
+
return new _ClinePermissions({
|
|
10751
|
+
outputRoot,
|
|
10752
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10753
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10754
|
+
fileContent,
|
|
10755
|
+
validate
|
|
10756
|
+
});
|
|
10757
|
+
}
|
|
10758
|
+
static async fromRulesyncPermissions({
|
|
10759
|
+
outputRoot = process.cwd(),
|
|
10760
|
+
rulesyncPermissions,
|
|
10761
|
+
global = false,
|
|
10762
|
+
logger
|
|
10763
|
+
}) {
|
|
10764
|
+
const paths = _ClinePermissions.getSettablePaths({ global });
|
|
10765
|
+
const filePath = join67(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10766
|
+
const existingContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
10767
|
+
let existing;
|
|
10768
|
+
try {
|
|
10769
|
+
const parsed = JSON.parse(existingContent);
|
|
10770
|
+
const result = ClineCommandPermissionsSchema.safeParse(parsed);
|
|
10771
|
+
if (!result.success) {
|
|
10772
|
+
throw new Error(formatError(result.error));
|
|
10773
|
+
}
|
|
10774
|
+
existing = result.data;
|
|
10775
|
+
} catch (error) {
|
|
10776
|
+
throw new Error(
|
|
10777
|
+
`Failed to parse existing Cline command-permissions at ${filePath}: ${formatError(error)}`,
|
|
10778
|
+
{ cause: error }
|
|
10779
|
+
);
|
|
10780
|
+
}
|
|
10781
|
+
const config = rulesyncPermissions.getJson();
|
|
10782
|
+
const allow = [];
|
|
10783
|
+
const deny = [];
|
|
10784
|
+
const droppedCategories = [];
|
|
10785
|
+
const translatedAskPatterns = [];
|
|
10786
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
10787
|
+
if (category !== "bash") {
|
|
10788
|
+
droppedCategories.push(category);
|
|
10789
|
+
continue;
|
|
10790
|
+
}
|
|
10791
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
10792
|
+
if (action === "ask") {
|
|
10793
|
+
translatedAskPatterns.push(pattern);
|
|
10794
|
+
deny.push(pattern);
|
|
10795
|
+
continue;
|
|
10796
|
+
}
|
|
10797
|
+
if (action === "allow") {
|
|
10798
|
+
allow.push(pattern);
|
|
10799
|
+
} else if (action === "deny") {
|
|
10800
|
+
deny.push(pattern);
|
|
10801
|
+
}
|
|
10802
|
+
}
|
|
10803
|
+
}
|
|
10804
|
+
if (droppedCategories.length > 0 || translatedAskPatterns.length > 0) {
|
|
10805
|
+
const parts = [];
|
|
10806
|
+
if (droppedCategories.length > 0) {
|
|
10807
|
+
parts.push(
|
|
10808
|
+
`non-bash categories [${droppedCategories.join(", ")}] (Cline only enforces shell commands; use the rulesync ignore feature for read/write restrictions)`
|
|
10809
|
+
);
|
|
10810
|
+
}
|
|
10811
|
+
if (translatedAskPatterns.length > 0) {
|
|
10812
|
+
parts.push(
|
|
10813
|
+
`'ask' rules for bash patterns [${translatedAskPatterns.join(", ")}] translated to 'deny' for fail-closed safety, since Cline lacks 'ask'`
|
|
10814
|
+
);
|
|
10815
|
+
}
|
|
10816
|
+
logger?.warn(`WARNING: Cline command permissions translation notice: ${parts.join("; ")}.`);
|
|
10817
|
+
}
|
|
10818
|
+
const dedupedAllow = uniq4(allow.toSorted());
|
|
10819
|
+
const dedupedDeny = uniq4(deny.toSorted());
|
|
10820
|
+
const mergedDeny = uniq4([...existing.deny ?? [], ...dedupedDeny]).toSorted();
|
|
10821
|
+
const denySet = new Set(mergedDeny);
|
|
10822
|
+
const collisions = dedupedAllow.filter((p) => denySet.has(p));
|
|
10823
|
+
if (collisions.length > 0) {
|
|
10824
|
+
logger?.warn(
|
|
10825
|
+
`Cline command permissions: pattern(s) ${collisions.map((p) => `'${p}'`).join(", ")} appear in both 'allow' and 'deny'. Cline's evaluation order is not documented to guarantee deny-priority; the resulting behavior is undefined. Consider removing the duplicate rule from rulesync.`
|
|
10826
|
+
);
|
|
10827
|
+
}
|
|
10828
|
+
const next = {
|
|
10829
|
+
...existing,
|
|
10830
|
+
allow: dedupedAllow,
|
|
10831
|
+
deny: mergedDeny,
|
|
10832
|
+
allowRedirects: existing.allowRedirects ?? false
|
|
10833
|
+
};
|
|
10834
|
+
return new _ClinePermissions({
|
|
10835
|
+
outputRoot,
|
|
10836
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10837
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10838
|
+
fileContent: JSON.stringify(next, null, 2),
|
|
10839
|
+
validate: true
|
|
10840
|
+
});
|
|
10841
|
+
}
|
|
10842
|
+
toRulesyncPermissions() {
|
|
10843
|
+
let parsed;
|
|
10844
|
+
try {
|
|
10845
|
+
const json = JSON.parse(this.getFileContent());
|
|
10846
|
+
const result = ClineCommandPermissionsSchema.safeParse(json);
|
|
10847
|
+
if (!result.success) {
|
|
10848
|
+
throw new Error(formatError(result.error));
|
|
10849
|
+
}
|
|
10850
|
+
parsed = result.data;
|
|
10851
|
+
} catch (error) {
|
|
10852
|
+
throw new Error(
|
|
10853
|
+
`Failed to parse Cline permissions content in ${join67(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10854
|
+
{ cause: error }
|
|
10855
|
+
);
|
|
10856
|
+
}
|
|
10857
|
+
const bashRules = {};
|
|
10858
|
+
for (const pattern of parsed.allow ?? []) {
|
|
10859
|
+
bashRules[pattern] = "allow";
|
|
10860
|
+
}
|
|
10861
|
+
for (const pattern of parsed.deny ?? []) {
|
|
10862
|
+
bashRules[pattern] = "deny";
|
|
10863
|
+
}
|
|
10864
|
+
const config = Object.keys(bashRules).length > 0 ? { permission: { bash: bashRules } } : { permission: {} };
|
|
10865
|
+
return this.toRulesyncPermissionsDefault({
|
|
10866
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
10867
|
+
});
|
|
10868
|
+
}
|
|
10869
|
+
validate() {
|
|
10870
|
+
try {
|
|
10871
|
+
const parsed = JSON.parse(this.fileContent || "{}");
|
|
10872
|
+
const result = ClineCommandPermissionsSchema.safeParse(parsed);
|
|
10873
|
+
if (!result.success) {
|
|
10874
|
+
return { success: false, error: result.error };
|
|
10875
|
+
}
|
|
10876
|
+
return { success: true, error: null };
|
|
10877
|
+
} catch (error) {
|
|
10878
|
+
return {
|
|
10879
|
+
success: false,
|
|
10880
|
+
error: new Error(`Failed to parse Cline permissions JSON: ${formatError(error)}`)
|
|
10881
|
+
};
|
|
10882
|
+
}
|
|
10883
|
+
}
|
|
10884
|
+
static forDeletion({
|
|
10885
|
+
outputRoot = process.cwd(),
|
|
10886
|
+
relativeDirPath,
|
|
10887
|
+
relativeFilePath
|
|
10888
|
+
}) {
|
|
10889
|
+
return new _ClinePermissions({
|
|
10890
|
+
outputRoot,
|
|
10891
|
+
relativeDirPath,
|
|
10892
|
+
relativeFilePath,
|
|
10893
|
+
fileContent: JSON.stringify({ allow: [], deny: [], allowRedirects: false }, null, 2),
|
|
10894
|
+
validate: false
|
|
10895
|
+
});
|
|
10896
|
+
}
|
|
10897
|
+
};
|
|
10898
|
+
|
|
10899
|
+
// src/features/permissions/codexcli-permissions.ts
|
|
10900
|
+
import { join as join68 } from "path";
|
|
10901
|
+
import * as smolToml4 from "smol-toml";
|
|
10902
|
+
var RULESYNC_PROFILE_NAME = "rulesync";
|
|
10903
|
+
var RULESYNC_BASH_RULES_FILE_NAME = "rulesync.rules";
|
|
10904
|
+
var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
10905
|
+
static getSettablePaths(_options = {}) {
|
|
10906
|
+
return {
|
|
10907
|
+
relativeDirPath: ".codex",
|
|
10908
|
+
relativeFilePath: "config.toml"
|
|
10909
|
+
};
|
|
10331
10910
|
}
|
|
10332
10911
|
isDeletable() {
|
|
10333
10912
|
return false;
|
|
@@ -10338,7 +10917,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
10338
10917
|
global = false
|
|
10339
10918
|
}) {
|
|
10340
10919
|
const paths = this.getSettablePaths({ global });
|
|
10341
|
-
const filePath =
|
|
10920
|
+
const filePath = join68(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10342
10921
|
const fileContent = await readFileContentOrNull(filePath) ?? smolToml4.stringify({});
|
|
10343
10922
|
return new _CodexcliPermissions({
|
|
10344
10923
|
outputRoot,
|
|
@@ -10356,7 +10935,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
10356
10935
|
global = false
|
|
10357
10936
|
}) {
|
|
10358
10937
|
const paths = this.getSettablePaths({ global });
|
|
10359
|
-
const filePath =
|
|
10938
|
+
const filePath = join68(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10360
10939
|
const existingContent = await readFileContentOrNull(filePath) ?? smolToml4.stringify({});
|
|
10361
10940
|
const parsed = toMutableTable(smolToml4.parse(existingContent));
|
|
10362
10941
|
const profile = convertRulesyncToCodexProfile({
|
|
@@ -10381,7 +10960,7 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
10381
10960
|
parsed = smolToml4.parse(this.getFileContent());
|
|
10382
10961
|
} catch (error) {
|
|
10383
10962
|
throw new Error(
|
|
10384
|
-
`Failed to parse Codex CLI permissions content in ${
|
|
10963
|
+
`Failed to parse Codex CLI permissions content in ${join68(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10385
10964
|
{ cause: error }
|
|
10386
10965
|
);
|
|
10387
10966
|
}
|
|
@@ -10422,7 +11001,7 @@ function createCodexcliBashRulesFile({
|
|
|
10422
11001
|
}) {
|
|
10423
11002
|
return new CodexcliRulesFile({
|
|
10424
11003
|
outputRoot,
|
|
10425
|
-
relativeDirPath:
|
|
11004
|
+
relativeDirPath: join68(".codex", "rules"),
|
|
10426
11005
|
relativeFilePath: RULESYNC_BASH_RULES_FILE_NAME,
|
|
10427
11006
|
fileContent: buildCodexBashRulesContent(config)
|
|
10428
11007
|
});
|
|
@@ -10577,8 +11156,8 @@ function mapBashActionToDecision(action) {
|
|
|
10577
11156
|
}
|
|
10578
11157
|
|
|
10579
11158
|
// src/features/permissions/cursor-permissions.ts
|
|
10580
|
-
import { join as
|
|
10581
|
-
import { uniq as
|
|
11159
|
+
import { join as join69 } from "path";
|
|
11160
|
+
import { uniq as uniq5 } from "es-toolkit";
|
|
10582
11161
|
var CANONICAL_TO_CURSOR_TYPE = {
|
|
10583
11162
|
bash: "Shell",
|
|
10584
11163
|
read: "Read",
|
|
@@ -10695,7 +11274,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10695
11274
|
global = false
|
|
10696
11275
|
}) {
|
|
10697
11276
|
const paths = _CursorPermissions.getSettablePaths({ global });
|
|
10698
|
-
const filePath =
|
|
11277
|
+
const filePath = join69(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10699
11278
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
10700
11279
|
return new _CursorPermissions({
|
|
10701
11280
|
outputRoot,
|
|
@@ -10712,7 +11291,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10712
11291
|
global = false
|
|
10713
11292
|
}) {
|
|
10714
11293
|
const paths = _CursorPermissions.getSettablePaths({ global });
|
|
10715
|
-
const filePath =
|
|
11294
|
+
const filePath = join69(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10716
11295
|
const existingContent = await readOrInitializeFileContent(
|
|
10717
11296
|
filePath,
|
|
10718
11297
|
JSON.stringify({}, null, 2)
|
|
@@ -10756,8 +11335,8 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10756
11335
|
const mergedPermissions = {
|
|
10757
11336
|
...existingPermissions
|
|
10758
11337
|
};
|
|
10759
|
-
const mergedAllow =
|
|
10760
|
-
const mergedDeny =
|
|
11338
|
+
const mergedAllow = uniq5([...preservedAllow, ...allow].toSorted());
|
|
11339
|
+
const mergedDeny = uniq5([...preservedDeny, ...deny].toSorted());
|
|
10761
11340
|
if (mergedAllow.length > 0) {
|
|
10762
11341
|
mergedPermissions.allow = mergedAllow;
|
|
10763
11342
|
} else {
|
|
@@ -10788,7 +11367,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10788
11367
|
settings = asCursorCliConfig(JSON.parse(this.getFileContent()));
|
|
10789
11368
|
} catch (error) {
|
|
10790
11369
|
throw new Error(
|
|
10791
|
-
`Failed to parse Cursor CLI permissions content in ${
|
|
11370
|
+
`Failed to parse Cursor CLI permissions content in ${join69(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10792
11371
|
{ cause: error }
|
|
10793
11372
|
);
|
|
10794
11373
|
}
|
|
@@ -10863,10 +11442,10 @@ function convertCursorToRulesyncPermissions(params) {
|
|
|
10863
11442
|
}
|
|
10864
11443
|
|
|
10865
11444
|
// src/features/permissions/geminicli-permissions.ts
|
|
10866
|
-
import { join as
|
|
11445
|
+
import { join as join70 } from "path";
|
|
10867
11446
|
import * as smolToml5 from "smol-toml";
|
|
10868
|
-
import { z as
|
|
10869
|
-
var GEMINICLI_POLICY_RELATIVE_DIR_PATH =
|
|
11447
|
+
import { z as z32 } from "zod/mini";
|
|
11448
|
+
var GEMINICLI_POLICY_RELATIVE_DIR_PATH = join70(".gemini", "policies");
|
|
10870
11449
|
var GEMINICLI_POLICY_FILE_NAME = "rulesync.toml";
|
|
10871
11450
|
var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
|
|
10872
11451
|
bash: "run_shell_command",
|
|
@@ -10893,7 +11472,7 @@ var RESERVED_OBJECT_KEYS = /* @__PURE__ */ new Set([
|
|
|
10893
11472
|
"constructor",
|
|
10894
11473
|
"prototype"
|
|
10895
11474
|
]);
|
|
10896
|
-
var
|
|
11475
|
+
var moduleLogger2 = new ConsoleLogger();
|
|
10897
11476
|
var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
10898
11477
|
static getSettablePaths(_options = {}) {
|
|
10899
11478
|
return {
|
|
@@ -10907,7 +11486,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
10907
11486
|
global = false
|
|
10908
11487
|
}) {
|
|
10909
11488
|
const paths = this.getSettablePaths({ global });
|
|
10910
|
-
const filePath =
|
|
11489
|
+
const filePath = join70(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10911
11490
|
const fileContent = await readFileContentOrNull(filePath) ?? "";
|
|
10912
11491
|
return new _GeminicliPermissions({
|
|
10913
11492
|
outputRoot,
|
|
@@ -10922,7 +11501,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
10922
11501
|
rulesyncPermissions,
|
|
10923
11502
|
validate = true,
|
|
10924
11503
|
global = false,
|
|
10925
|
-
logger =
|
|
11504
|
+
logger = moduleLogger2
|
|
10926
11505
|
}) {
|
|
10927
11506
|
const paths = this.getSettablePaths({ global });
|
|
10928
11507
|
const fileContent = buildGeminicliPolicyContent(rulesyncPermissions.getJson(), logger);
|
|
@@ -10943,35 +11522,35 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
10943
11522
|
parsed = smolToml5.parse(fileContent);
|
|
10944
11523
|
} catch (error) {
|
|
10945
11524
|
throw new Error(
|
|
10946
|
-
`Failed to parse Gemini CLI policy TOML in ${
|
|
11525
|
+
`Failed to parse Gemini CLI policy TOML in ${join70(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10947
11526
|
{ cause: error }
|
|
10948
11527
|
);
|
|
10949
11528
|
}
|
|
10950
|
-
const rules = extractRules(parsed,
|
|
11529
|
+
const rules = extractRules(parsed, moduleLogger2);
|
|
10951
11530
|
for (const [index, rule] of rules.entries()) {
|
|
10952
11531
|
const mappedCategory = Object.hasOwn(GEMINICLI_TO_RULESYNC_TOOL_NAME, rule.toolName) ? GEMINICLI_TO_RULESYNC_TOOL_NAME[rule.toolName] : void 0;
|
|
10953
11532
|
const category = mappedCategory ?? rule.toolName;
|
|
10954
11533
|
if (RESERVED_OBJECT_KEYS.has(category)) {
|
|
10955
|
-
|
|
11534
|
+
moduleLogger2.warn(
|
|
10956
11535
|
`Skipping rule #${index} in ${this.getRelativeFilePath()}: toolName "${rule.toolName}" maps to a reserved object key ("${category}") and would risk prototype pollution.`
|
|
10957
11536
|
);
|
|
10958
11537
|
continue;
|
|
10959
11538
|
}
|
|
10960
11539
|
const action = mapFromGeminicliDecision(rule.decision);
|
|
10961
11540
|
if (!action) {
|
|
10962
|
-
|
|
11541
|
+
moduleLogger2.warn(
|
|
10963
11542
|
`Skipping rule #${index} (toolName="${rule.toolName}", commandPrefix=${JSON.stringify(rule.commandPrefix)}, argsPattern=${JSON.stringify(rule.argsPattern)}) in ${this.getRelativeFilePath()}: unknown decision ${JSON.stringify(rule.decision)}`
|
|
10964
11543
|
);
|
|
10965
11544
|
continue;
|
|
10966
11545
|
}
|
|
10967
11546
|
if (rule.toolName === "run_shell_command" && rule.commandPrefix !== void 0 && rule.argsPattern !== void 0) {
|
|
10968
|
-
|
|
11547
|
+
moduleLogger2.warn(
|
|
10969
11548
|
`Rule #${index} in ${this.getRelativeFilePath()} sets both commandPrefix and argsPattern; rulesync will honor argsPattern and ignore commandPrefix=${JSON.stringify(rule.commandPrefix)}.`
|
|
10970
11549
|
);
|
|
10971
11550
|
}
|
|
10972
11551
|
const pattern = extractPattern(rule);
|
|
10973
11552
|
if (RESERVED_OBJECT_KEYS.has(pattern)) {
|
|
10974
|
-
|
|
11553
|
+
moduleLogger2.warn(
|
|
10975
11554
|
`Skipping rule #${index} in ${this.getRelativeFilePath()}: pattern "${pattern}" is a reserved object key.`
|
|
10976
11555
|
);
|
|
10977
11556
|
continue;
|
|
@@ -11193,14 +11772,14 @@ function regexToGlobPattern(regex) {
|
|
|
11193
11772
|
}
|
|
11194
11773
|
return glob;
|
|
11195
11774
|
}
|
|
11196
|
-
var GeminicliPolicyRuleSchema =
|
|
11197
|
-
toolName:
|
|
11198
|
-
decision:
|
|
11199
|
-
commandPrefix:
|
|
11200
|
-
argsPattern:
|
|
11775
|
+
var GeminicliPolicyRuleSchema = z32.looseObject({
|
|
11776
|
+
toolName: z32.string(),
|
|
11777
|
+
decision: z32.optional(z32.unknown()),
|
|
11778
|
+
commandPrefix: z32.optional(z32.string()),
|
|
11779
|
+
argsPattern: z32.optional(z32.string())
|
|
11201
11780
|
});
|
|
11202
|
-
var GeminicliPolicyFileSchema =
|
|
11203
|
-
rule:
|
|
11781
|
+
var GeminicliPolicyFileSchema = z32.looseObject({
|
|
11782
|
+
rule: z32.optional(z32.array(z32.looseObject({})))
|
|
11204
11783
|
});
|
|
11205
11784
|
function extractRules(parsed, logger) {
|
|
11206
11785
|
const parsedFile = GeminicliPolicyFileSchema.safeParse(parsed);
|
|
@@ -11234,18 +11813,192 @@ function extractPattern(rule) {
|
|
|
11234
11813
|
return regexToGlobPattern(regex);
|
|
11235
11814
|
}
|
|
11236
11815
|
|
|
11816
|
+
// src/features/permissions/kilo-permissions.ts
|
|
11817
|
+
import { join as join71 } from "path";
|
|
11818
|
+
import { parse as parseJsonc5, printParseErrorCode } from "jsonc-parser";
|
|
11819
|
+
import { z as z33 } from "zod/mini";
|
|
11820
|
+
var KiloPermissionSchema = z33.union([
|
|
11821
|
+
z33.enum(["allow", "ask", "deny"]),
|
|
11822
|
+
z33.record(z33.string(), z33.enum(["allow", "ask", "deny"]))
|
|
11823
|
+
]);
|
|
11824
|
+
var KiloPermissionsConfigSchema = z33.looseObject({
|
|
11825
|
+
permission: z33.optional(z33.record(z33.string(), KiloPermissionSchema))
|
|
11826
|
+
});
|
|
11827
|
+
var KILO_FILE_NAME = "kilo.jsonc";
|
|
11828
|
+
function parseKiloJsoncStrict(content, filePath) {
|
|
11829
|
+
const errors = [];
|
|
11830
|
+
const parsed = parseJsonc5(content, errors, { allowTrailingComma: true });
|
|
11831
|
+
const first = errors[0];
|
|
11832
|
+
if (first) {
|
|
11833
|
+
throw new Error(
|
|
11834
|
+
`Failed to parse Kilo Code config at ${filePath}: ${printParseErrorCode(first.error)} at offset ${first.offset}`
|
|
11835
|
+
);
|
|
11836
|
+
}
|
|
11837
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
11838
|
+
return parsed;
|
|
11839
|
+
}
|
|
11840
|
+
return {};
|
|
11841
|
+
}
|
|
11842
|
+
function collectKiloDenyPatterns(value) {
|
|
11843
|
+
if (typeof value === "string") {
|
|
11844
|
+
return value === "deny" ? ["*"] : [];
|
|
11845
|
+
}
|
|
11846
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
11847
|
+
const patterns = [];
|
|
11848
|
+
for (const [pattern, action] of Object.entries(value)) {
|
|
11849
|
+
if (action === "deny") {
|
|
11850
|
+
patterns.push(pattern);
|
|
11851
|
+
}
|
|
11852
|
+
}
|
|
11853
|
+
return patterns;
|
|
11854
|
+
}
|
|
11855
|
+
return [];
|
|
11856
|
+
}
|
|
11857
|
+
var KiloPermissions = class _KiloPermissions extends ToolPermissions {
|
|
11858
|
+
json;
|
|
11859
|
+
constructor(params) {
|
|
11860
|
+
super(params);
|
|
11861
|
+
const parsed = parseJsonc5(this.fileContent || "{}");
|
|
11862
|
+
if (params.validate !== false) {
|
|
11863
|
+
this.json = KiloPermissionsConfigSchema.parse(parsed);
|
|
11864
|
+
} else {
|
|
11865
|
+
const result = KiloPermissionsConfigSchema.safeParse(parsed);
|
|
11866
|
+
this.json = result.success ? result.data : {};
|
|
11867
|
+
}
|
|
11868
|
+
}
|
|
11869
|
+
getJson() {
|
|
11870
|
+
return this.json;
|
|
11871
|
+
}
|
|
11872
|
+
isDeletable() {
|
|
11873
|
+
return false;
|
|
11874
|
+
}
|
|
11875
|
+
static getSettablePaths({
|
|
11876
|
+
global = false
|
|
11877
|
+
} = {}) {
|
|
11878
|
+
return global ? { relativeDirPath: join71(".config", "kilo"), relativeFilePath: KILO_FILE_NAME } : { relativeDirPath: ".", relativeFilePath: KILO_FILE_NAME };
|
|
11879
|
+
}
|
|
11880
|
+
static async fromFile({
|
|
11881
|
+
outputRoot = process.cwd(),
|
|
11882
|
+
validate = true,
|
|
11883
|
+
global = false
|
|
11884
|
+
}) {
|
|
11885
|
+
const basePaths = _KiloPermissions.getSettablePaths({ global });
|
|
11886
|
+
const filePath = join71(outputRoot, basePaths.relativeDirPath, basePaths.relativeFilePath);
|
|
11887
|
+
const fileContent = await readFileContentOrNull(filePath);
|
|
11888
|
+
const parsed = parseKiloJsoncStrict(fileContent ?? "{}", filePath);
|
|
11889
|
+
const nextJson = { ...parsed, permission: parsed.permission ?? {} };
|
|
11890
|
+
return new _KiloPermissions({
|
|
11891
|
+
outputRoot,
|
|
11892
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
11893
|
+
relativeFilePath: basePaths.relativeFilePath,
|
|
11894
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
11895
|
+
validate
|
|
11896
|
+
});
|
|
11897
|
+
}
|
|
11898
|
+
static async fromRulesyncPermissions({
|
|
11899
|
+
outputRoot = process.cwd(),
|
|
11900
|
+
rulesyncPermissions,
|
|
11901
|
+
global = false,
|
|
11902
|
+
logger
|
|
11903
|
+
}) {
|
|
11904
|
+
const basePaths = _KiloPermissions.getSettablePaths({ global });
|
|
11905
|
+
const filePath = join71(outputRoot, basePaths.relativeDirPath, basePaths.relativeFilePath);
|
|
11906
|
+
const fileContent = await readFileContentOrNull(filePath);
|
|
11907
|
+
const parsed = parseKiloJsoncStrict(fileContent ?? "{}", filePath);
|
|
11908
|
+
const parsedPermission = parsed.permission;
|
|
11909
|
+
const existingPermission = parsedPermission && typeof parsedPermission === "object" && !Array.isArray(parsedPermission) ? { ...parsedPermission } : {};
|
|
11910
|
+
const rulesyncPermission = rulesyncPermissions.getJson().permission;
|
|
11911
|
+
const droppedDenyByKey = {};
|
|
11912
|
+
for (const key of Object.keys(rulesyncPermission)) {
|
|
11913
|
+
const previous = existingPermission[key];
|
|
11914
|
+
const previousDenyPatterns = collectKiloDenyPatterns(previous);
|
|
11915
|
+
const nextDenyPatterns = new Set(collectKiloDenyPatterns(rulesyncPermission[key]));
|
|
11916
|
+
const dropped = previousDenyPatterns.filter((p) => !nextDenyPatterns.has(p));
|
|
11917
|
+
if (dropped.length > 0) {
|
|
11918
|
+
droppedDenyByKey[key] = dropped;
|
|
11919
|
+
}
|
|
11920
|
+
}
|
|
11921
|
+
if (Object.keys(droppedDenyByKey).length > 0) {
|
|
11922
|
+
const summary = Object.entries(droppedDenyByKey).map(([key, patterns]) => `${key}: [${patterns.join(", ")}]`).join("; ");
|
|
11923
|
+
logger?.warn(
|
|
11924
|
+
`WARNING: Kilo permissions regeneration drops existing 'deny' rule(s) because rulesync output owns these tool keys. Dropped \u2014 ${summary}. To preserve these denies, add them to '.rulesync/permissions.json'.`
|
|
11925
|
+
);
|
|
11926
|
+
}
|
|
11927
|
+
const mergedPermission = { ...existingPermission };
|
|
11928
|
+
for (const [key, value] of Object.entries(rulesyncPermission)) {
|
|
11929
|
+
mergedPermission[key] = value;
|
|
11930
|
+
}
|
|
11931
|
+
const nextJson = {
|
|
11932
|
+
...parsed,
|
|
11933
|
+
permission: mergedPermission
|
|
11934
|
+
};
|
|
11935
|
+
return new _KiloPermissions({
|
|
11936
|
+
outputRoot,
|
|
11937
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
11938
|
+
relativeFilePath: basePaths.relativeFilePath,
|
|
11939
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
11940
|
+
validate: true
|
|
11941
|
+
});
|
|
11942
|
+
}
|
|
11943
|
+
toRulesyncPermissions() {
|
|
11944
|
+
const permission = this.normalizePermission(this.json.permission);
|
|
11945
|
+
return this.toRulesyncPermissionsDefault({
|
|
11946
|
+
fileContent: JSON.stringify({ permission }, null, 2)
|
|
11947
|
+
});
|
|
11948
|
+
}
|
|
11949
|
+
validate() {
|
|
11950
|
+
try {
|
|
11951
|
+
const json = parseJsonc5(this.fileContent || "{}");
|
|
11952
|
+
const result = KiloPermissionsConfigSchema.safeParse(json);
|
|
11953
|
+
if (!result.success) {
|
|
11954
|
+
return { success: false, error: result.error };
|
|
11955
|
+
}
|
|
11956
|
+
return { success: true, error: null };
|
|
11957
|
+
} catch (error) {
|
|
11958
|
+
return {
|
|
11959
|
+
success: false,
|
|
11960
|
+
error: new Error(`Failed to parse Kilo permissions JSON: ${formatError(error)}`)
|
|
11961
|
+
};
|
|
11962
|
+
}
|
|
11963
|
+
}
|
|
11964
|
+
static forDeletion({
|
|
11965
|
+
outputRoot = process.cwd(),
|
|
11966
|
+
relativeDirPath,
|
|
11967
|
+
relativeFilePath
|
|
11968
|
+
}) {
|
|
11969
|
+
return new _KiloPermissions({
|
|
11970
|
+
outputRoot,
|
|
11971
|
+
relativeDirPath,
|
|
11972
|
+
relativeFilePath,
|
|
11973
|
+
fileContent: JSON.stringify({ permission: {} }, null, 2),
|
|
11974
|
+
validate: false
|
|
11975
|
+
});
|
|
11976
|
+
}
|
|
11977
|
+
normalizePermission(permission) {
|
|
11978
|
+
if (!permission) {
|
|
11979
|
+
return {};
|
|
11980
|
+
}
|
|
11981
|
+
return Object.fromEntries(
|
|
11982
|
+
Object.entries(permission).map(([tool, value]) => [
|
|
11983
|
+
tool,
|
|
11984
|
+
typeof value === "string" ? { "*": value } : value
|
|
11985
|
+
])
|
|
11986
|
+
);
|
|
11987
|
+
}
|
|
11988
|
+
};
|
|
11989
|
+
|
|
11237
11990
|
// src/features/permissions/kiro-permissions.ts
|
|
11238
|
-
import { join as
|
|
11239
|
-
import { z as
|
|
11240
|
-
var KiroAgentSchema =
|
|
11241
|
-
allowedTools:
|
|
11242
|
-
toolsSettings:
|
|
11991
|
+
import { join as join72 } from "path";
|
|
11992
|
+
import { z as z34 } from "zod/mini";
|
|
11993
|
+
var KiroAgentSchema = z34.looseObject({
|
|
11994
|
+
allowedTools: z34.optional(z34.array(z34.string())),
|
|
11995
|
+
toolsSettings: z34.optional(z34.record(z34.string(), z34.unknown()))
|
|
11243
11996
|
});
|
|
11244
|
-
var UnknownRecordSchema =
|
|
11997
|
+
var UnknownRecordSchema = z34.record(z34.string(), z34.unknown());
|
|
11245
11998
|
var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
11246
11999
|
static getSettablePaths(_options = {}) {
|
|
11247
12000
|
return {
|
|
11248
|
-
relativeDirPath:
|
|
12001
|
+
relativeDirPath: join72(".kiro", "agents"),
|
|
11249
12002
|
relativeFilePath: "default.json"
|
|
11250
12003
|
};
|
|
11251
12004
|
}
|
|
@@ -11257,7 +12010,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
11257
12010
|
validate = true
|
|
11258
12011
|
}) {
|
|
11259
12012
|
const paths = this.getSettablePaths();
|
|
11260
|
-
const filePath =
|
|
12013
|
+
const filePath = join72(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
11261
12014
|
const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
11262
12015
|
return new _KiroPermissions({
|
|
11263
12016
|
outputRoot,
|
|
@@ -11274,7 +12027,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
11274
12027
|
logger
|
|
11275
12028
|
}) {
|
|
11276
12029
|
const paths = this.getSettablePaths();
|
|
11277
|
-
const filePath =
|
|
12030
|
+
const filePath = join72(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
11278
12031
|
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
11279
12032
|
const parsedResult = KiroAgentSchema.safeParse(JSON.parse(existingContent));
|
|
11280
12033
|
if (!parsedResult.success) {
|
|
@@ -11298,7 +12051,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
11298
12051
|
parsed = KiroAgentSchema.parse(JSON.parse(this.getFileContent()));
|
|
11299
12052
|
} catch (error) {
|
|
11300
12053
|
throw new Error(
|
|
11301
|
-
`Failed to parse Kiro permissions content in ${
|
|
12054
|
+
`Failed to parse Kiro permissions content in ${join72(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
11302
12055
|
{ cause: error }
|
|
11303
12056
|
);
|
|
11304
12057
|
}
|
|
@@ -11423,21 +12176,21 @@ function asStringArray(value) {
|
|
|
11423
12176
|
}
|
|
11424
12177
|
|
|
11425
12178
|
// src/features/permissions/opencode-permissions.ts
|
|
11426
|
-
import { join as
|
|
11427
|
-
import { parse as
|
|
11428
|
-
import { z as
|
|
11429
|
-
var OpencodePermissionSchema =
|
|
11430
|
-
|
|
11431
|
-
|
|
12179
|
+
import { join as join73 } from "path";
|
|
12180
|
+
import { parse as parseJsonc6 } from "jsonc-parser";
|
|
12181
|
+
import { z as z35 } from "zod/mini";
|
|
12182
|
+
var OpencodePermissionSchema = z35.union([
|
|
12183
|
+
z35.enum(["allow", "ask", "deny"]),
|
|
12184
|
+
z35.record(z35.string(), z35.enum(["allow", "ask", "deny"]))
|
|
11432
12185
|
]);
|
|
11433
|
-
var OpencodePermissionsConfigSchema =
|
|
11434
|
-
permission:
|
|
12186
|
+
var OpencodePermissionsConfigSchema = z35.looseObject({
|
|
12187
|
+
permission: z35.optional(z35.record(z35.string(), OpencodePermissionSchema))
|
|
11435
12188
|
});
|
|
11436
12189
|
var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
11437
12190
|
json;
|
|
11438
12191
|
constructor(params) {
|
|
11439
12192
|
super(params);
|
|
11440
|
-
this.json = OpencodePermissionsConfigSchema.parse(
|
|
12193
|
+
this.json = OpencodePermissionsConfigSchema.parse(parseJsonc6(this.fileContent || "{}"));
|
|
11441
12194
|
}
|
|
11442
12195
|
getJson() {
|
|
11443
12196
|
return this.json;
|
|
@@ -11448,7 +12201,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11448
12201
|
static getSettablePaths({
|
|
11449
12202
|
global = false
|
|
11450
12203
|
} = {}) {
|
|
11451
|
-
return global ? { relativeDirPath:
|
|
12204
|
+
return global ? { relativeDirPath: join73(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
|
|
11452
12205
|
}
|
|
11453
12206
|
static async fromFile({
|
|
11454
12207
|
outputRoot = process.cwd(),
|
|
@@ -11456,9 +12209,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11456
12209
|
global = false
|
|
11457
12210
|
}) {
|
|
11458
12211
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
11459
|
-
const jsonDir =
|
|
11460
|
-
const jsoncPath =
|
|
11461
|
-
const jsonPath =
|
|
12212
|
+
const jsonDir = join73(outputRoot, basePaths.relativeDirPath);
|
|
12213
|
+
const jsoncPath = join73(jsonDir, "opencode.jsonc");
|
|
12214
|
+
const jsonPath = join73(jsonDir, "opencode.json");
|
|
11462
12215
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
11463
12216
|
let relativeFilePath = "opencode.jsonc";
|
|
11464
12217
|
if (!fileContent) {
|
|
@@ -11467,7 +12220,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11467
12220
|
relativeFilePath = "opencode.json";
|
|
11468
12221
|
}
|
|
11469
12222
|
}
|
|
11470
|
-
const parsed =
|
|
12223
|
+
const parsed = parseJsonc6(fileContent ?? "{}");
|
|
11471
12224
|
const nextJson = { ...parsed, permission: parsed.permission ?? {} };
|
|
11472
12225
|
return new _OpencodePermissions({
|
|
11473
12226
|
outputRoot,
|
|
@@ -11483,9 +12236,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11483
12236
|
global = false
|
|
11484
12237
|
}) {
|
|
11485
12238
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
11486
|
-
const jsonDir =
|
|
11487
|
-
const jsoncPath =
|
|
11488
|
-
const jsonPath =
|
|
12239
|
+
const jsonDir = join73(outputRoot, basePaths.relativeDirPath);
|
|
12240
|
+
const jsoncPath = join73(jsonDir, "opencode.jsonc");
|
|
12241
|
+
const jsonPath = join73(jsonDir, "opencode.json");
|
|
11489
12242
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
11490
12243
|
let relativeFilePath = "opencode.jsonc";
|
|
11491
12244
|
if (!fileContent) {
|
|
@@ -11494,7 +12247,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11494
12247
|
relativeFilePath = "opencode.json";
|
|
11495
12248
|
}
|
|
11496
12249
|
}
|
|
11497
|
-
const parsed =
|
|
12250
|
+
const parsed = parseJsonc6(fileContent ?? "{}");
|
|
11498
12251
|
const nextJson = {
|
|
11499
12252
|
...parsed,
|
|
11500
12253
|
permission: rulesyncPermissions.getJson().permission
|
|
@@ -11506,17 +12259,251 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11506
12259
|
fileContent: JSON.stringify(nextJson, null, 2),
|
|
11507
12260
|
validate: true
|
|
11508
12261
|
});
|
|
11509
|
-
}
|
|
11510
|
-
toRulesyncPermissions() {
|
|
11511
|
-
const permission = this.normalizePermission(this.json.permission);
|
|
12262
|
+
}
|
|
12263
|
+
toRulesyncPermissions() {
|
|
12264
|
+
const permission = this.normalizePermission(this.json.permission);
|
|
12265
|
+
return this.toRulesyncPermissionsDefault({
|
|
12266
|
+
fileContent: JSON.stringify({ permission }, null, 2)
|
|
12267
|
+
});
|
|
12268
|
+
}
|
|
12269
|
+
validate() {
|
|
12270
|
+
try {
|
|
12271
|
+
const json = JSON.parse(this.fileContent || "{}");
|
|
12272
|
+
const result = OpencodePermissionsConfigSchema.safeParse(json);
|
|
12273
|
+
if (!result.success) {
|
|
12274
|
+
return { success: false, error: result.error };
|
|
12275
|
+
}
|
|
12276
|
+
return { success: true, error: null };
|
|
12277
|
+
} catch (error) {
|
|
12278
|
+
return {
|
|
12279
|
+
success: false,
|
|
12280
|
+
error: new Error(`Failed to parse OpenCode permissions JSON: ${formatError(error)}`)
|
|
12281
|
+
};
|
|
12282
|
+
}
|
|
12283
|
+
}
|
|
12284
|
+
static forDeletion({
|
|
12285
|
+
outputRoot = process.cwd(),
|
|
12286
|
+
relativeDirPath,
|
|
12287
|
+
relativeFilePath
|
|
12288
|
+
}) {
|
|
12289
|
+
return new _OpencodePermissions({
|
|
12290
|
+
outputRoot,
|
|
12291
|
+
relativeDirPath,
|
|
12292
|
+
relativeFilePath,
|
|
12293
|
+
fileContent: JSON.stringify({ permission: {} }, null, 2),
|
|
12294
|
+
validate: false
|
|
12295
|
+
});
|
|
12296
|
+
}
|
|
12297
|
+
normalizePermission(permission) {
|
|
12298
|
+
if (!permission) {
|
|
12299
|
+
return {};
|
|
12300
|
+
}
|
|
12301
|
+
return Object.fromEntries(
|
|
12302
|
+
Object.entries(permission).map(([tool, value]) => [
|
|
12303
|
+
tool,
|
|
12304
|
+
typeof value === "string" ? { "*": value } : value
|
|
12305
|
+
])
|
|
12306
|
+
);
|
|
12307
|
+
}
|
|
12308
|
+
};
|
|
12309
|
+
|
|
12310
|
+
// src/features/permissions/qwencode-permissions.ts
|
|
12311
|
+
import { join as join74 } from "path";
|
|
12312
|
+
import { uniq as uniq6 } from "es-toolkit";
|
|
12313
|
+
import { z as z36 } from "zod/mini";
|
|
12314
|
+
var QwenSettingsPermissionsSchema = z36.looseObject({
|
|
12315
|
+
allow: z36.optional(z36.array(z36.string())),
|
|
12316
|
+
ask: z36.optional(z36.array(z36.string())),
|
|
12317
|
+
deny: z36.optional(z36.array(z36.string()))
|
|
12318
|
+
});
|
|
12319
|
+
var QwenSettingsSchema = z36.looseObject({
|
|
12320
|
+
permissions: z36.optional(QwenSettingsPermissionsSchema)
|
|
12321
|
+
});
|
|
12322
|
+
var moduleLogger3 = new ConsoleLogger();
|
|
12323
|
+
var CANONICAL_TO_QWEN_TOOL_NAMES = {
|
|
12324
|
+
bash: "Bash",
|
|
12325
|
+
read: "Read",
|
|
12326
|
+
edit: "Edit",
|
|
12327
|
+
write: "Write",
|
|
12328
|
+
webfetch: "WebFetch",
|
|
12329
|
+
websearch: "WebSearch",
|
|
12330
|
+
grep: "Grep",
|
|
12331
|
+
glob: "Glob",
|
|
12332
|
+
agent: "Agent"
|
|
12333
|
+
};
|
|
12334
|
+
var QWEN_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
12335
|
+
Object.entries(CANONICAL_TO_QWEN_TOOL_NAMES).map(([k, v]) => [v, k])
|
|
12336
|
+
);
|
|
12337
|
+
function toQwenToolName(canonical) {
|
|
12338
|
+
return CANONICAL_TO_QWEN_TOOL_NAMES[canonical] ?? canonical;
|
|
12339
|
+
}
|
|
12340
|
+
function toCanonicalToolName3(qwenName) {
|
|
12341
|
+
return QWEN_TO_CANONICAL_TOOL_NAMES[qwenName] ?? qwenName;
|
|
12342
|
+
}
|
|
12343
|
+
function parseQwenPermissionEntry(entry, options = {}) {
|
|
12344
|
+
const parenIndex = entry.indexOf("(");
|
|
12345
|
+
if (parenIndex === -1) {
|
|
12346
|
+
return { ok: true, toolName: entry, pattern: "*" };
|
|
12347
|
+
}
|
|
12348
|
+
const toolName = entry.slice(0, parenIndex);
|
|
12349
|
+
const lastParenIndex = entry.lastIndexOf(")");
|
|
12350
|
+
if (lastParenIndex < parenIndex) {
|
|
12351
|
+
options.logger?.warn(
|
|
12352
|
+
`Qwen permissions: malformed entry '${entry}' is missing a closing parenthesis.`
|
|
12353
|
+
);
|
|
12354
|
+
return { ok: false, toolName, raw: entry };
|
|
12355
|
+
}
|
|
12356
|
+
if (lastParenIndex !== entry.length - 1) {
|
|
12357
|
+
options.logger?.warn(
|
|
12358
|
+
`Qwen permissions: malformed entry '${entry}' has trailing characters after the closing parenthesis.`
|
|
12359
|
+
);
|
|
12360
|
+
return { ok: false, toolName, raw: entry };
|
|
12361
|
+
}
|
|
12362
|
+
const pattern = entry.slice(parenIndex + 1, lastParenIndex);
|
|
12363
|
+
return { ok: true, toolName, pattern: pattern || "*" };
|
|
12364
|
+
}
|
|
12365
|
+
function buildQwenPermissionEntry(toolName, pattern) {
|
|
12366
|
+
if (pattern === "*") {
|
|
12367
|
+
return toolName;
|
|
12368
|
+
}
|
|
12369
|
+
return `${toolName}(${pattern})`;
|
|
12370
|
+
}
|
|
12371
|
+
var QwencodePermissions = class _QwencodePermissions extends ToolPermissions {
|
|
12372
|
+
constructor(params) {
|
|
12373
|
+
super({
|
|
12374
|
+
...params,
|
|
12375
|
+
fileContent: params.fileContent ?? "{}"
|
|
12376
|
+
});
|
|
12377
|
+
if (params.validate) {
|
|
12378
|
+
const result = this.validate();
|
|
12379
|
+
if (!result.success) {
|
|
12380
|
+
throw result.error;
|
|
12381
|
+
}
|
|
12382
|
+
}
|
|
12383
|
+
}
|
|
12384
|
+
isDeletable() {
|
|
12385
|
+
return false;
|
|
12386
|
+
}
|
|
12387
|
+
static getSettablePaths(_options = {}) {
|
|
12388
|
+
return {
|
|
12389
|
+
relativeDirPath: ".qwen",
|
|
12390
|
+
relativeFilePath: "settings.json"
|
|
12391
|
+
};
|
|
12392
|
+
}
|
|
12393
|
+
static async fromFile({
|
|
12394
|
+
outputRoot = process.cwd(),
|
|
12395
|
+
validate = true,
|
|
12396
|
+
global = false
|
|
12397
|
+
}) {
|
|
12398
|
+
const paths = _QwencodePermissions.getSettablePaths({ global });
|
|
12399
|
+
const filePath = join74(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
12400
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
12401
|
+
return new _QwencodePermissions({
|
|
12402
|
+
outputRoot,
|
|
12403
|
+
relativeDirPath: paths.relativeDirPath,
|
|
12404
|
+
relativeFilePath: paths.relativeFilePath,
|
|
12405
|
+
fileContent,
|
|
12406
|
+
validate
|
|
12407
|
+
});
|
|
12408
|
+
}
|
|
12409
|
+
static async fromRulesyncPermissions({
|
|
12410
|
+
outputRoot = process.cwd(),
|
|
12411
|
+
rulesyncPermissions,
|
|
12412
|
+
global = false,
|
|
12413
|
+
logger
|
|
12414
|
+
}) {
|
|
12415
|
+
const paths = _QwencodePermissions.getSettablePaths({ global });
|
|
12416
|
+
const filePath = join74(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
12417
|
+
const existingContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
12418
|
+
let settings;
|
|
12419
|
+
try {
|
|
12420
|
+
const parsed = JSON.parse(existingContent);
|
|
12421
|
+
const result = QwenSettingsSchema.safeParse(parsed);
|
|
12422
|
+
if (!result.success) {
|
|
12423
|
+
throw new Error(formatError(result.error));
|
|
12424
|
+
}
|
|
12425
|
+
settings = result.data;
|
|
12426
|
+
} catch (error) {
|
|
12427
|
+
throw new Error(
|
|
12428
|
+
`Failed to parse existing Qwen settings at ${filePath}: ${formatError(error)}`,
|
|
12429
|
+
{ cause: error }
|
|
12430
|
+
);
|
|
12431
|
+
}
|
|
12432
|
+
const config = rulesyncPermissions.getJson();
|
|
12433
|
+
const { allow, ask, deny } = convertRulesyncToQwenPermissions(config);
|
|
12434
|
+
const managedToolNames = new Set(
|
|
12435
|
+
Object.keys(config.permission).map((category) => toQwenToolName(category))
|
|
12436
|
+
);
|
|
12437
|
+
const existingPermissions = settings.permissions ?? {};
|
|
12438
|
+
const preservedAllow = (existingPermissions.allow ?? []).filter(
|
|
12439
|
+
(entry) => !managedToolNames.has(parseQwenPermissionEntry(entry, { logger }).toolName)
|
|
12440
|
+
);
|
|
12441
|
+
const preservedAsk = (existingPermissions.ask ?? []).filter(
|
|
12442
|
+
(entry) => !managedToolNames.has(parseQwenPermissionEntry(entry, { logger }).toolName)
|
|
12443
|
+
);
|
|
12444
|
+
const preservedDeny = (existingPermissions.deny ?? []).filter(
|
|
12445
|
+
(entry) => !managedToolNames.has(parseQwenPermissionEntry(entry, { logger }).toolName)
|
|
12446
|
+
);
|
|
12447
|
+
const mergedPermissions = {
|
|
12448
|
+
...existingPermissions
|
|
12449
|
+
};
|
|
12450
|
+
const mergedAllow = uniq6([...preservedAllow, ...allow].toSorted());
|
|
12451
|
+
const mergedAsk = uniq6([...preservedAsk, ...ask].toSorted());
|
|
12452
|
+
const mergedDeny = uniq6([...preservedDeny, ...deny].toSorted());
|
|
12453
|
+
if (mergedAllow.length > 0) {
|
|
12454
|
+
mergedPermissions.allow = mergedAllow;
|
|
12455
|
+
} else {
|
|
12456
|
+
delete mergedPermissions.allow;
|
|
12457
|
+
}
|
|
12458
|
+
if (mergedAsk.length > 0) {
|
|
12459
|
+
mergedPermissions.ask = mergedAsk;
|
|
12460
|
+
} else {
|
|
12461
|
+
delete mergedPermissions.ask;
|
|
12462
|
+
}
|
|
12463
|
+
if (mergedDeny.length > 0) {
|
|
12464
|
+
mergedPermissions.deny = mergedDeny;
|
|
12465
|
+
} else {
|
|
12466
|
+
delete mergedPermissions.deny;
|
|
12467
|
+
}
|
|
12468
|
+
const merged = { ...settings, permissions: mergedPermissions };
|
|
12469
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
12470
|
+
return new _QwencodePermissions({
|
|
12471
|
+
outputRoot,
|
|
12472
|
+
relativeDirPath: paths.relativeDirPath,
|
|
12473
|
+
relativeFilePath: paths.relativeFilePath,
|
|
12474
|
+
fileContent,
|
|
12475
|
+
validate: true
|
|
12476
|
+
});
|
|
12477
|
+
}
|
|
12478
|
+
toRulesyncPermissions() {
|
|
12479
|
+
let settings;
|
|
12480
|
+
try {
|
|
12481
|
+
const parsed = JSON.parse(this.getFileContent());
|
|
12482
|
+
const result = QwenSettingsSchema.safeParse(parsed);
|
|
12483
|
+
if (!result.success) {
|
|
12484
|
+
throw new Error(formatError(result.error));
|
|
12485
|
+
}
|
|
12486
|
+
settings = result.data;
|
|
12487
|
+
} catch (error) {
|
|
12488
|
+
throw new Error(
|
|
12489
|
+
`Failed to parse Qwen permissions content in ${join74(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
12490
|
+
{ cause: error }
|
|
12491
|
+
);
|
|
12492
|
+
}
|
|
12493
|
+
const permissions = settings.permissions ?? {};
|
|
12494
|
+
const config = convertQwenToRulesyncPermissions({
|
|
12495
|
+
allow: permissions.allow ?? [],
|
|
12496
|
+
ask: permissions.ask ?? [],
|
|
12497
|
+
deny: permissions.deny ?? []
|
|
12498
|
+
});
|
|
11512
12499
|
return this.toRulesyncPermissionsDefault({
|
|
11513
|
-
fileContent: JSON.stringify(
|
|
12500
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
11514
12501
|
});
|
|
11515
12502
|
}
|
|
11516
12503
|
validate() {
|
|
11517
12504
|
try {
|
|
11518
|
-
const
|
|
11519
|
-
const result =
|
|
12505
|
+
const parsed = JSON.parse(this.fileContent || "{}");
|
|
12506
|
+
const result = QwenSettingsSchema.safeParse(parsed);
|
|
11520
12507
|
if (!result.success) {
|
|
11521
12508
|
return { success: false, error: result.error };
|
|
11522
12509
|
}
|
|
@@ -11524,7 +12511,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11524
12511
|
} catch (error) {
|
|
11525
12512
|
return {
|
|
11526
12513
|
success: false,
|
|
11527
|
-
error: new Error(`Failed to parse
|
|
12514
|
+
error: new Error(`Failed to parse Qwen permissions JSON: ${formatError(error)}`)
|
|
11528
12515
|
};
|
|
11529
12516
|
}
|
|
11530
12517
|
}
|
|
@@ -11533,38 +12520,94 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11533
12520
|
relativeDirPath,
|
|
11534
12521
|
relativeFilePath
|
|
11535
12522
|
}) {
|
|
11536
|
-
return new
|
|
12523
|
+
return new _QwencodePermissions({
|
|
11537
12524
|
outputRoot,
|
|
11538
12525
|
relativeDirPath,
|
|
11539
12526
|
relativeFilePath,
|
|
11540
|
-
fileContent: JSON.stringify({
|
|
12527
|
+
fileContent: JSON.stringify({ permissions: {} }, null, 2),
|
|
11541
12528
|
validate: false
|
|
11542
12529
|
});
|
|
11543
12530
|
}
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
12531
|
+
};
|
|
12532
|
+
function convertRulesyncToQwenPermissions(config) {
|
|
12533
|
+
const allow = [];
|
|
12534
|
+
const ask = [];
|
|
12535
|
+
const deny = [];
|
|
12536
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
12537
|
+
const qwenToolName = toQwenToolName(category);
|
|
12538
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
12539
|
+
const entry = buildQwenPermissionEntry(qwenToolName, pattern);
|
|
12540
|
+
switch (action) {
|
|
12541
|
+
case "allow":
|
|
12542
|
+
allow.push(entry);
|
|
12543
|
+
break;
|
|
12544
|
+
case "ask":
|
|
12545
|
+
ask.push(entry);
|
|
12546
|
+
break;
|
|
12547
|
+
case "deny":
|
|
12548
|
+
deny.push(entry);
|
|
12549
|
+
break;
|
|
12550
|
+
}
|
|
11547
12551
|
}
|
|
11548
|
-
return Object.fromEntries(
|
|
11549
|
-
Object.entries(permission).map(([tool, value]) => [
|
|
11550
|
-
tool,
|
|
11551
|
-
typeof value === "string" ? { "*": value } : value
|
|
11552
|
-
])
|
|
11553
|
-
);
|
|
11554
12552
|
}
|
|
11555
|
-
};
|
|
12553
|
+
return { allow, ask, deny };
|
|
12554
|
+
}
|
|
12555
|
+
function convertQwenToRulesyncPermissions(params) {
|
|
12556
|
+
const permission = {};
|
|
12557
|
+
const logger = params.logger ?? moduleLogger3;
|
|
12558
|
+
const processEntries = (entries, action) => {
|
|
12559
|
+
for (const entry of entries) {
|
|
12560
|
+
const parsed = parseQwenPermissionEntry(entry, { logger });
|
|
12561
|
+
if (!parsed.ok) {
|
|
12562
|
+
if (action === "deny") {
|
|
12563
|
+
const canonical2 = toCanonicalToolName3(parsed.toolName);
|
|
12564
|
+
if (!permission[canonical2]) {
|
|
12565
|
+
permission[canonical2] = {};
|
|
12566
|
+
}
|
|
12567
|
+
permission[canonical2]["*"] = action;
|
|
12568
|
+
}
|
|
12569
|
+
continue;
|
|
12570
|
+
}
|
|
12571
|
+
const { toolName, pattern } = parsed;
|
|
12572
|
+
const canonical = toCanonicalToolName3(toolName);
|
|
12573
|
+
if (!permission[canonical]) {
|
|
12574
|
+
permission[canonical] = {};
|
|
12575
|
+
}
|
|
12576
|
+
permission[canonical][pattern] = action;
|
|
12577
|
+
}
|
|
12578
|
+
};
|
|
12579
|
+
processEntries(params.allow, "allow");
|
|
12580
|
+
processEntries(params.ask, "ask");
|
|
12581
|
+
processEntries(params.deny, "deny");
|
|
12582
|
+
return { permission };
|
|
12583
|
+
}
|
|
11556
12584
|
|
|
11557
12585
|
// src/features/permissions/permissions-processor.ts
|
|
11558
12586
|
var permissionsProcessorToolTargetTuple = [
|
|
12587
|
+
"augmentcode",
|
|
11559
12588
|
"claudecode",
|
|
12589
|
+
"cline",
|
|
11560
12590
|
"codexcli",
|
|
11561
12591
|
"cursor",
|
|
11562
12592
|
"geminicli",
|
|
12593
|
+
"kilo",
|
|
11563
12594
|
"kiro",
|
|
11564
|
-
"opencode"
|
|
12595
|
+
"opencode",
|
|
12596
|
+
"qwencode"
|
|
11565
12597
|
];
|
|
11566
|
-
var PermissionsProcessorToolTargetSchema =
|
|
12598
|
+
var PermissionsProcessorToolTargetSchema = z37.enum(permissionsProcessorToolTargetTuple);
|
|
11567
12599
|
var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
12600
|
+
[
|
|
12601
|
+
"augmentcode",
|
|
12602
|
+
{
|
|
12603
|
+
class: AugmentcodePermissions,
|
|
12604
|
+
meta: {
|
|
12605
|
+
supportsProject: true,
|
|
12606
|
+
supportsGlobal: true,
|
|
12607
|
+
supportsImport: true
|
|
12608
|
+
}
|
|
12609
|
+
}
|
|
12610
|
+
],
|
|
11568
12611
|
[
|
|
11569
12612
|
"claudecode",
|
|
11570
12613
|
{
|
|
@@ -11576,6 +12619,17 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
|
11576
12619
|
}
|
|
11577
12620
|
}
|
|
11578
12621
|
],
|
|
12622
|
+
[
|
|
12623
|
+
"cline",
|
|
12624
|
+
{
|
|
12625
|
+
class: ClinePermissions,
|
|
12626
|
+
meta: {
|
|
12627
|
+
supportsProject: true,
|
|
12628
|
+
supportsGlobal: false,
|
|
12629
|
+
supportsImport: true
|
|
12630
|
+
}
|
|
12631
|
+
}
|
|
12632
|
+
],
|
|
11579
12633
|
[
|
|
11580
12634
|
"codexcli",
|
|
11581
12635
|
{
|
|
@@ -11609,6 +12663,17 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
|
11609
12663
|
}
|
|
11610
12664
|
}
|
|
11611
12665
|
],
|
|
12666
|
+
[
|
|
12667
|
+
"kilo",
|
|
12668
|
+
{
|
|
12669
|
+
class: KiloPermissions,
|
|
12670
|
+
meta: {
|
|
12671
|
+
supportsProject: true,
|
|
12672
|
+
supportsGlobal: true,
|
|
12673
|
+
supportsImport: true
|
|
12674
|
+
}
|
|
12675
|
+
}
|
|
12676
|
+
],
|
|
11612
12677
|
[
|
|
11613
12678
|
"kiro",
|
|
11614
12679
|
{
|
|
@@ -11630,6 +12695,17 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
|
11630
12695
|
supportsImport: true
|
|
11631
12696
|
}
|
|
11632
12697
|
}
|
|
12698
|
+
],
|
|
12699
|
+
[
|
|
12700
|
+
"qwencode",
|
|
12701
|
+
{
|
|
12702
|
+
class: QwencodePermissions,
|
|
12703
|
+
meta: {
|
|
12704
|
+
supportsProject: true,
|
|
12705
|
+
supportsGlobal: true,
|
|
12706
|
+
supportsImport: true
|
|
12707
|
+
}
|
|
12708
|
+
}
|
|
11633
12709
|
]
|
|
11634
12710
|
]);
|
|
11635
12711
|
var PermissionsProcessor = class extends FeatureProcessor {
|
|
@@ -11738,25 +12814,25 @@ var PermissionsProcessor = class extends FeatureProcessor {
|
|
|
11738
12814
|
};
|
|
11739
12815
|
|
|
11740
12816
|
// src/features/rules/rules-processor.ts
|
|
11741
|
-
import { basename as basename10, dirname as dirname3, join as
|
|
12817
|
+
import { basename as basename10, dirname as dirname3, join as join151, relative as relative6 } from "path";
|
|
11742
12818
|
import { encode } from "@toon-format/toon";
|
|
11743
|
-
import { z as
|
|
12819
|
+
import { z as z79 } from "zod/mini";
|
|
11744
12820
|
|
|
11745
12821
|
// src/constants/general.ts
|
|
11746
12822
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
11747
12823
|
|
|
11748
12824
|
// src/features/skills/agentsmd-skill.ts
|
|
11749
|
-
import { join as
|
|
12825
|
+
import { join as join78 } from "path";
|
|
11750
12826
|
|
|
11751
12827
|
// src/features/skills/simulated-skill.ts
|
|
11752
|
-
import { join as
|
|
11753
|
-
import { z as
|
|
12828
|
+
import { join as join77 } from "path";
|
|
12829
|
+
import { z as z38 } from "zod/mini";
|
|
11754
12830
|
|
|
11755
12831
|
// src/features/skills/tool-skill.ts
|
|
11756
|
-
import { join as
|
|
12832
|
+
import { join as join76 } from "path";
|
|
11757
12833
|
|
|
11758
12834
|
// src/types/ai-dir.ts
|
|
11759
|
-
import path2, { basename as basename3, join as
|
|
12835
|
+
import path2, { basename as basename3, join as join75, relative as relative4, resolve as resolve5 } from "path";
|
|
11760
12836
|
var AiDir = class {
|
|
11761
12837
|
/**
|
|
11762
12838
|
* @example "."
|
|
@@ -11853,8 +12929,8 @@ var AiDir = class {
|
|
|
11853
12929
|
* @returns Array of files with their relative paths and buffers
|
|
11854
12930
|
*/
|
|
11855
12931
|
static async collectOtherFiles(outputRoot, relativeDirPath, dirName, excludeFileName) {
|
|
11856
|
-
const dirPath =
|
|
11857
|
-
const glob =
|
|
12932
|
+
const dirPath = join75(outputRoot, relativeDirPath, dirName);
|
|
12933
|
+
const glob = join75(dirPath, "**", "*");
|
|
11858
12934
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
11859
12935
|
const filteredPaths = filePaths.filter((filePath) => basename3(filePath) !== excludeFileName);
|
|
11860
12936
|
const files = await Promise.all(
|
|
@@ -11955,8 +13031,8 @@ var ToolSkill = class extends AiDir {
|
|
|
11955
13031
|
}) {
|
|
11956
13032
|
const settablePaths = getSettablePaths({ global });
|
|
11957
13033
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
11958
|
-
const skillDirPath =
|
|
11959
|
-
const skillFilePath =
|
|
13034
|
+
const skillDirPath = join76(outputRoot, actualRelativeDirPath, dirName);
|
|
13035
|
+
const skillFilePath = join76(skillDirPath, SKILL_FILE_NAME);
|
|
11960
13036
|
if (!await fileExists(skillFilePath)) {
|
|
11961
13037
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
11962
13038
|
}
|
|
@@ -11980,16 +13056,16 @@ var ToolSkill = class extends AiDir {
|
|
|
11980
13056
|
}
|
|
11981
13057
|
requireMainFileFrontmatter() {
|
|
11982
13058
|
if (!this.mainFile?.frontmatter) {
|
|
11983
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
13059
|
+
throw new Error(`Frontmatter is not defined in ${join76(this.relativeDirPath, this.dirName)}`);
|
|
11984
13060
|
}
|
|
11985
13061
|
return this.mainFile.frontmatter;
|
|
11986
13062
|
}
|
|
11987
13063
|
};
|
|
11988
13064
|
|
|
11989
13065
|
// src/features/skills/simulated-skill.ts
|
|
11990
|
-
var SimulatedSkillFrontmatterSchema =
|
|
11991
|
-
name:
|
|
11992
|
-
description:
|
|
13066
|
+
var SimulatedSkillFrontmatterSchema = z38.looseObject({
|
|
13067
|
+
name: z38.string(),
|
|
13068
|
+
description: z38.string()
|
|
11993
13069
|
});
|
|
11994
13070
|
var SimulatedSkill = class extends ToolSkill {
|
|
11995
13071
|
frontmatter;
|
|
@@ -12020,7 +13096,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
12020
13096
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
12021
13097
|
if (!result.success) {
|
|
12022
13098
|
throw new Error(
|
|
12023
|
-
`Invalid frontmatter in ${
|
|
13099
|
+
`Invalid frontmatter in ${join77(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
12024
13100
|
);
|
|
12025
13101
|
}
|
|
12026
13102
|
}
|
|
@@ -12079,8 +13155,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
12079
13155
|
}) {
|
|
12080
13156
|
const settablePaths = this.getSettablePaths();
|
|
12081
13157
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
12082
|
-
const skillDirPath =
|
|
12083
|
-
const skillFilePath =
|
|
13158
|
+
const skillDirPath = join77(outputRoot, actualRelativeDirPath, dirName);
|
|
13159
|
+
const skillFilePath = join77(skillDirPath, SKILL_FILE_NAME);
|
|
12084
13160
|
if (!await fileExists(skillFilePath)) {
|
|
12085
13161
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
12086
13162
|
}
|
|
@@ -12157,7 +13233,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
12157
13233
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
12158
13234
|
}
|
|
12159
13235
|
return {
|
|
12160
|
-
relativeDirPath:
|
|
13236
|
+
relativeDirPath: join78(".agents", "skills")
|
|
12161
13237
|
};
|
|
12162
13238
|
}
|
|
12163
13239
|
static async fromDir(params) {
|
|
@@ -12184,11 +13260,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
12184
13260
|
};
|
|
12185
13261
|
|
|
12186
13262
|
// src/features/skills/factorydroid-skill.ts
|
|
12187
|
-
import { join as
|
|
13263
|
+
import { join as join79 } from "path";
|
|
12188
13264
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
12189
13265
|
static getSettablePaths(_options) {
|
|
12190
13266
|
return {
|
|
12191
|
-
relativeDirPath:
|
|
13267
|
+
relativeDirPath: join79(".factory", "skills")
|
|
12192
13268
|
};
|
|
12193
13269
|
}
|
|
12194
13270
|
static async fromDir(params) {
|
|
@@ -12215,55 +13291,55 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
12215
13291
|
};
|
|
12216
13292
|
|
|
12217
13293
|
// src/features/skills/rovodev-skill.ts
|
|
12218
|
-
import { join as
|
|
12219
|
-
import { z as
|
|
13294
|
+
import { join as join81 } from "path";
|
|
13295
|
+
import { z as z40 } from "zod/mini";
|
|
12220
13296
|
|
|
12221
13297
|
// src/features/skills/rulesync-skill.ts
|
|
12222
|
-
import { join as
|
|
12223
|
-
import { z as
|
|
12224
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
12225
|
-
name:
|
|
12226
|
-
description:
|
|
12227
|
-
targets:
|
|
12228
|
-
claudecode:
|
|
12229
|
-
|
|
12230
|
-
"allowed-tools":
|
|
12231
|
-
model:
|
|
12232
|
-
"disable-model-invocation":
|
|
12233
|
-
"scheduled-task":
|
|
13298
|
+
import { join as join80 } from "path";
|
|
13299
|
+
import { z as z39 } from "zod/mini";
|
|
13300
|
+
var RulesyncSkillFrontmatterSchemaInternal = z39.looseObject({
|
|
13301
|
+
name: z39.string(),
|
|
13302
|
+
description: z39.string(),
|
|
13303
|
+
targets: z39._default(RulesyncTargetsSchema, ["*"]),
|
|
13304
|
+
claudecode: z39.optional(
|
|
13305
|
+
z39.looseObject({
|
|
13306
|
+
"allowed-tools": z39.optional(z39.array(z39.string())),
|
|
13307
|
+
model: z39.optional(z39.string()),
|
|
13308
|
+
"disable-model-invocation": z39.optional(z39.boolean()),
|
|
13309
|
+
"scheduled-task": z39.optional(z39.boolean())
|
|
12234
13310
|
})
|
|
12235
13311
|
),
|
|
12236
|
-
codexcli:
|
|
12237
|
-
|
|
12238
|
-
"short-description":
|
|
13312
|
+
codexcli: z39.optional(
|
|
13313
|
+
z39.looseObject({
|
|
13314
|
+
"short-description": z39.optional(z39.string())
|
|
12239
13315
|
})
|
|
12240
13316
|
),
|
|
12241
|
-
opencode:
|
|
12242
|
-
|
|
12243
|
-
"allowed-tools":
|
|
13317
|
+
opencode: z39.optional(
|
|
13318
|
+
z39.looseObject({
|
|
13319
|
+
"allowed-tools": z39.optional(z39.array(z39.string()))
|
|
12244
13320
|
})
|
|
12245
13321
|
),
|
|
12246
|
-
kilo:
|
|
12247
|
-
|
|
12248
|
-
"allowed-tools":
|
|
13322
|
+
kilo: z39.optional(
|
|
13323
|
+
z39.looseObject({
|
|
13324
|
+
"allowed-tools": z39.optional(z39.array(z39.string()))
|
|
12249
13325
|
})
|
|
12250
13326
|
),
|
|
12251
|
-
deepagents:
|
|
12252
|
-
|
|
12253
|
-
"allowed-tools":
|
|
13327
|
+
deepagents: z39.optional(
|
|
13328
|
+
z39.looseObject({
|
|
13329
|
+
"allowed-tools": z39.optional(z39.array(z39.string()))
|
|
12254
13330
|
})
|
|
12255
13331
|
),
|
|
12256
|
-
copilot:
|
|
12257
|
-
|
|
12258
|
-
license:
|
|
13332
|
+
copilot: z39.optional(
|
|
13333
|
+
z39.looseObject({
|
|
13334
|
+
license: z39.optional(z39.string())
|
|
12259
13335
|
})
|
|
12260
13336
|
),
|
|
12261
|
-
cline:
|
|
12262
|
-
roo:
|
|
12263
|
-
takt:
|
|
12264
|
-
|
|
13337
|
+
cline: z39.optional(z39.looseObject({})),
|
|
13338
|
+
roo: z39.optional(z39.looseObject({})),
|
|
13339
|
+
takt: z39.optional(
|
|
13340
|
+
z39.looseObject({
|
|
12265
13341
|
// Rename the emitted file stem (e.g. "test-skill.md" → "{name}.md").
|
|
12266
|
-
name:
|
|
13342
|
+
name: z39.optional(z39.string())
|
|
12267
13343
|
})
|
|
12268
13344
|
)
|
|
12269
13345
|
});
|
|
@@ -12305,7 +13381,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
12305
13381
|
}
|
|
12306
13382
|
getFrontmatter() {
|
|
12307
13383
|
if (!this.mainFile?.frontmatter) {
|
|
12308
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
13384
|
+
throw new Error(`Frontmatter is not defined in ${join80(this.relativeDirPath, this.dirName)}`);
|
|
12309
13385
|
}
|
|
12310
13386
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
12311
13387
|
return result;
|
|
@@ -12331,8 +13407,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
12331
13407
|
dirName,
|
|
12332
13408
|
global = false
|
|
12333
13409
|
}) {
|
|
12334
|
-
const skillDirPath =
|
|
12335
|
-
const skillFilePath =
|
|
13410
|
+
const skillDirPath = join80(outputRoot, relativeDirPath, dirName);
|
|
13411
|
+
const skillFilePath = join80(skillDirPath, SKILL_FILE_NAME);
|
|
12336
13412
|
if (!await fileExists(skillFilePath)) {
|
|
12337
13413
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
12338
13414
|
}
|
|
@@ -12362,14 +13438,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
12362
13438
|
};
|
|
12363
13439
|
|
|
12364
13440
|
// src/features/skills/rovodev-skill.ts
|
|
12365
|
-
var RovodevSkillFrontmatterSchema =
|
|
12366
|
-
name:
|
|
12367
|
-
description:
|
|
13441
|
+
var RovodevSkillFrontmatterSchema = z40.looseObject({
|
|
13442
|
+
name: z40.string(),
|
|
13443
|
+
description: z40.string()
|
|
12368
13444
|
});
|
|
12369
13445
|
var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
12370
13446
|
constructor({
|
|
12371
13447
|
outputRoot = process.cwd(),
|
|
12372
|
-
relativeDirPath =
|
|
13448
|
+
relativeDirPath = join81(".rovodev", "skills"),
|
|
12373
13449
|
dirName,
|
|
12374
13450
|
frontmatter,
|
|
12375
13451
|
body,
|
|
@@ -12398,8 +13474,8 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
12398
13474
|
}
|
|
12399
13475
|
static getSettablePaths(_options) {
|
|
12400
13476
|
return {
|
|
12401
|
-
relativeDirPath:
|
|
12402
|
-
alternativeSkillRoots: [
|
|
13477
|
+
relativeDirPath: join81(".rovodev", "skills"),
|
|
13478
|
+
alternativeSkillRoots: [join81(".agents", "skills")]
|
|
12403
13479
|
};
|
|
12404
13480
|
}
|
|
12405
13481
|
getFrontmatter() {
|
|
@@ -12487,13 +13563,13 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
12487
13563
|
});
|
|
12488
13564
|
const result = RovodevSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12489
13565
|
if (!result.success) {
|
|
12490
|
-
const skillDirPath =
|
|
13566
|
+
const skillDirPath = join81(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
12491
13567
|
throw new Error(
|
|
12492
|
-
`Invalid frontmatter in ${
|
|
13568
|
+
`Invalid frontmatter in ${join81(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12493
13569
|
);
|
|
12494
13570
|
}
|
|
12495
13571
|
if (result.data.name !== loaded.dirName) {
|
|
12496
|
-
const skillFilePath =
|
|
13572
|
+
const skillFilePath = join81(
|
|
12497
13573
|
loaded.outputRoot,
|
|
12498
13574
|
loaded.relativeDirPath,
|
|
12499
13575
|
loaded.dirName,
|
|
@@ -12535,11 +13611,11 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
12535
13611
|
};
|
|
12536
13612
|
|
|
12537
13613
|
// src/features/skills/skills-processor.ts
|
|
12538
|
-
import { basename as basename5, join as
|
|
12539
|
-
import { z as
|
|
13614
|
+
import { basename as basename5, join as join102 } from "path";
|
|
13615
|
+
import { z as z58 } from "zod/mini";
|
|
12540
13616
|
|
|
12541
13617
|
// src/types/dir-feature-processor.ts
|
|
12542
|
-
import { join as
|
|
13618
|
+
import { join as join82 } from "path";
|
|
12543
13619
|
var DirFeatureProcessor = class {
|
|
12544
13620
|
outputRoot;
|
|
12545
13621
|
inputRoot;
|
|
@@ -12582,7 +13658,7 @@ var DirFeatureProcessor = class {
|
|
|
12582
13658
|
const mainFile = aiDir.getMainFile();
|
|
12583
13659
|
let mainFileContent;
|
|
12584
13660
|
if (mainFile) {
|
|
12585
|
-
const mainFilePath =
|
|
13661
|
+
const mainFilePath = join82(dirPath, mainFile.name);
|
|
12586
13662
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
12587
13663
|
avoidBlockScalars: this.avoidBlockScalars
|
|
12588
13664
|
});
|
|
@@ -12602,7 +13678,7 @@ var DirFeatureProcessor = class {
|
|
|
12602
13678
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
12603
13679
|
otherFileContents.push(contentWithNewline);
|
|
12604
13680
|
if (!dirHasChanges) {
|
|
12605
|
-
const filePath =
|
|
13681
|
+
const filePath = join82(dirPath, file.relativeFilePathToDirPath);
|
|
12606
13682
|
const existingContent = await readFileContentOrNull(filePath);
|
|
12607
13683
|
if (!fileContentsEquivalent({
|
|
12608
13684
|
filePath,
|
|
@@ -12620,24 +13696,24 @@ var DirFeatureProcessor = class {
|
|
|
12620
13696
|
if (this.dryRun) {
|
|
12621
13697
|
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
12622
13698
|
if (mainFile) {
|
|
12623
|
-
this.logger.info(`[DRY RUN] Would write: ${
|
|
12624
|
-
changedPaths.push(
|
|
13699
|
+
this.logger.info(`[DRY RUN] Would write: ${join82(dirPath, mainFile.name)}`);
|
|
13700
|
+
changedPaths.push(join82(relativeDir, mainFile.name));
|
|
12625
13701
|
}
|
|
12626
13702
|
for (const file of otherFiles) {
|
|
12627
13703
|
this.logger.info(
|
|
12628
|
-
`[DRY RUN] Would write: ${
|
|
13704
|
+
`[DRY RUN] Would write: ${join82(dirPath, file.relativeFilePathToDirPath)}`
|
|
12629
13705
|
);
|
|
12630
|
-
changedPaths.push(
|
|
13706
|
+
changedPaths.push(join82(relativeDir, file.relativeFilePathToDirPath));
|
|
12631
13707
|
}
|
|
12632
13708
|
} else {
|
|
12633
13709
|
await ensureDir(dirPath);
|
|
12634
13710
|
if (mainFile && mainFileContent) {
|
|
12635
|
-
const mainFilePath =
|
|
13711
|
+
const mainFilePath = join82(dirPath, mainFile.name);
|
|
12636
13712
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
12637
|
-
changedPaths.push(
|
|
13713
|
+
changedPaths.push(join82(relativeDir, mainFile.name));
|
|
12638
13714
|
}
|
|
12639
13715
|
for (const [i, file] of otherFiles.entries()) {
|
|
12640
|
-
const filePath =
|
|
13716
|
+
const filePath = join82(dirPath, file.relativeFilePathToDirPath);
|
|
12641
13717
|
const content = otherFileContents[i];
|
|
12642
13718
|
if (content === void 0) {
|
|
12643
13719
|
throw new Error(
|
|
@@ -12645,7 +13721,7 @@ var DirFeatureProcessor = class {
|
|
|
12645
13721
|
);
|
|
12646
13722
|
}
|
|
12647
13723
|
await writeFileContent(filePath, content);
|
|
12648
|
-
changedPaths.push(
|
|
13724
|
+
changedPaths.push(join82(relativeDir, file.relativeFilePathToDirPath));
|
|
12649
13725
|
}
|
|
12650
13726
|
}
|
|
12651
13727
|
changedCount++;
|
|
@@ -12677,16 +13753,16 @@ var DirFeatureProcessor = class {
|
|
|
12677
13753
|
};
|
|
12678
13754
|
|
|
12679
13755
|
// src/features/skills/agentsskills-skill.ts
|
|
12680
|
-
import { join as
|
|
12681
|
-
import { z as
|
|
12682
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
12683
|
-
name:
|
|
12684
|
-
description:
|
|
13756
|
+
import { join as join83 } from "path";
|
|
13757
|
+
import { z as z41 } from "zod/mini";
|
|
13758
|
+
var AgentsSkillsSkillFrontmatterSchema = z41.looseObject({
|
|
13759
|
+
name: z41.string(),
|
|
13760
|
+
description: z41.string()
|
|
12685
13761
|
});
|
|
12686
13762
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
12687
13763
|
constructor({
|
|
12688
13764
|
outputRoot = process.cwd(),
|
|
12689
|
-
relativeDirPath =
|
|
13765
|
+
relativeDirPath = join83(".agents", "skills"),
|
|
12690
13766
|
dirName,
|
|
12691
13767
|
frontmatter,
|
|
12692
13768
|
body,
|
|
@@ -12718,7 +13794,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
12718
13794
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
12719
13795
|
}
|
|
12720
13796
|
return {
|
|
12721
|
-
relativeDirPath:
|
|
13797
|
+
relativeDirPath: join83(".agents", "skills")
|
|
12722
13798
|
};
|
|
12723
13799
|
}
|
|
12724
13800
|
getFrontmatter() {
|
|
@@ -12798,9 +13874,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
12798
13874
|
});
|
|
12799
13875
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12800
13876
|
if (!result.success) {
|
|
12801
|
-
const skillDirPath =
|
|
13877
|
+
const skillDirPath = join83(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
12802
13878
|
throw new Error(
|
|
12803
|
-
`Invalid frontmatter in ${
|
|
13879
|
+
`Invalid frontmatter in ${join83(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12804
13880
|
);
|
|
12805
13881
|
}
|
|
12806
13882
|
return new _AgentsSkillsSkill({
|
|
@@ -12835,16 +13911,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
12835
13911
|
};
|
|
12836
13912
|
|
|
12837
13913
|
// src/features/skills/antigravity-skill.ts
|
|
12838
|
-
import { join as
|
|
12839
|
-
import { z as
|
|
12840
|
-
var AntigravitySkillFrontmatterSchema =
|
|
12841
|
-
name:
|
|
12842
|
-
description:
|
|
13914
|
+
import { join as join84 } from "path";
|
|
13915
|
+
import { z as z42 } from "zod/mini";
|
|
13916
|
+
var AntigravitySkillFrontmatterSchema = z42.looseObject({
|
|
13917
|
+
name: z42.string(),
|
|
13918
|
+
description: z42.string()
|
|
12843
13919
|
});
|
|
12844
13920
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
12845
13921
|
constructor({
|
|
12846
13922
|
outputRoot = process.cwd(),
|
|
12847
|
-
relativeDirPath =
|
|
13923
|
+
relativeDirPath = join84(".agent", "skills"),
|
|
12848
13924
|
dirName,
|
|
12849
13925
|
frontmatter,
|
|
12850
13926
|
body,
|
|
@@ -12876,11 +13952,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
12876
13952
|
} = {}) {
|
|
12877
13953
|
if (global) {
|
|
12878
13954
|
return {
|
|
12879
|
-
relativeDirPath:
|
|
13955
|
+
relativeDirPath: join84(".gemini", "antigravity", "skills")
|
|
12880
13956
|
};
|
|
12881
13957
|
}
|
|
12882
13958
|
return {
|
|
12883
|
-
relativeDirPath:
|
|
13959
|
+
relativeDirPath: join84(".agent", "skills")
|
|
12884
13960
|
};
|
|
12885
13961
|
}
|
|
12886
13962
|
getFrontmatter() {
|
|
@@ -12960,9 +14036,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
12960
14036
|
});
|
|
12961
14037
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12962
14038
|
if (!result.success) {
|
|
12963
|
-
const skillDirPath =
|
|
14039
|
+
const skillDirPath = join84(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
12964
14040
|
throw new Error(
|
|
12965
|
-
`Invalid frontmatter in ${
|
|
14041
|
+
`Invalid frontmatter in ${join84(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12966
14042
|
);
|
|
12967
14043
|
}
|
|
12968
14044
|
return new _AntigravitySkill({
|
|
@@ -12996,21 +14072,21 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
12996
14072
|
};
|
|
12997
14073
|
|
|
12998
14074
|
// src/features/skills/claudecode-skill.ts
|
|
12999
|
-
import { join as
|
|
13000
|
-
import { z as
|
|
13001
|
-
var CLAUDE_SKILLS_DIR_PATH =
|
|
13002
|
-
var CLAUDE_SCHEDULED_TASKS_DIR_PATH =
|
|
13003
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
13004
|
-
name:
|
|
13005
|
-
description:
|
|
13006
|
-
"allowed-tools":
|
|
13007
|
-
model:
|
|
13008
|
-
"disable-model-invocation":
|
|
14075
|
+
import { join as join85 } from "path";
|
|
14076
|
+
import { z as z43 } from "zod/mini";
|
|
14077
|
+
var CLAUDE_SKILLS_DIR_PATH = join85(".claude", "skills");
|
|
14078
|
+
var CLAUDE_SCHEDULED_TASKS_DIR_PATH = join85(".claude", "scheduled-tasks");
|
|
14079
|
+
var ClaudecodeSkillFrontmatterSchema = z43.looseObject({
|
|
14080
|
+
name: z43.string(),
|
|
14081
|
+
description: z43.string(),
|
|
14082
|
+
"allowed-tools": z43.optional(z43.array(z43.string())),
|
|
14083
|
+
model: z43.optional(z43.string()),
|
|
14084
|
+
"disable-model-invocation": z43.optional(z43.boolean())
|
|
13009
14085
|
});
|
|
13010
14086
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
13011
14087
|
constructor({
|
|
13012
14088
|
outputRoot = process.cwd(),
|
|
13013
|
-
relativeDirPath =
|
|
14089
|
+
relativeDirPath = join85(".claude", "skills"),
|
|
13014
14090
|
dirName,
|
|
13015
14091
|
frontmatter,
|
|
13016
14092
|
body,
|
|
@@ -13145,9 +14221,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
13145
14221
|
});
|
|
13146
14222
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13147
14223
|
if (!result.success) {
|
|
13148
|
-
const skillDirPath =
|
|
14224
|
+
const skillDirPath = join85(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13149
14225
|
throw new Error(
|
|
13150
|
-
`Invalid frontmatter in ${
|
|
14226
|
+
`Invalid frontmatter in ${join85(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13151
14227
|
);
|
|
13152
14228
|
}
|
|
13153
14229
|
return new _ClaudecodeSkill({
|
|
@@ -13181,16 +14257,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
13181
14257
|
};
|
|
13182
14258
|
|
|
13183
14259
|
// src/features/skills/cline-skill.ts
|
|
13184
|
-
import { join as
|
|
13185
|
-
import { z as
|
|
13186
|
-
var ClineSkillFrontmatterSchema =
|
|
13187
|
-
name:
|
|
13188
|
-
description:
|
|
14260
|
+
import { join as join86 } from "path";
|
|
14261
|
+
import { z as z44 } from "zod/mini";
|
|
14262
|
+
var ClineSkillFrontmatterSchema = z44.looseObject({
|
|
14263
|
+
name: z44.string(),
|
|
14264
|
+
description: z44.string()
|
|
13189
14265
|
});
|
|
13190
14266
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
13191
14267
|
constructor({
|
|
13192
14268
|
outputRoot = process.cwd(),
|
|
13193
|
-
relativeDirPath =
|
|
14269
|
+
relativeDirPath = join86(".cline", "skills"),
|
|
13194
14270
|
dirName,
|
|
13195
14271
|
frontmatter,
|
|
13196
14272
|
body,
|
|
@@ -13219,7 +14295,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
13219
14295
|
}
|
|
13220
14296
|
static getSettablePaths(_options = {}) {
|
|
13221
14297
|
return {
|
|
13222
|
-
relativeDirPath:
|
|
14298
|
+
relativeDirPath: join86(".cline", "skills")
|
|
13223
14299
|
};
|
|
13224
14300
|
}
|
|
13225
14301
|
getFrontmatter() {
|
|
@@ -13307,13 +14383,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
13307
14383
|
});
|
|
13308
14384
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13309
14385
|
if (!result.success) {
|
|
13310
|
-
const skillDirPath =
|
|
14386
|
+
const skillDirPath = join86(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13311
14387
|
throw new Error(
|
|
13312
|
-
`Invalid frontmatter in ${
|
|
14388
|
+
`Invalid frontmatter in ${join86(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13313
14389
|
);
|
|
13314
14390
|
}
|
|
13315
14391
|
if (result.data.name !== loaded.dirName) {
|
|
13316
|
-
const skillFilePath =
|
|
14392
|
+
const skillFilePath = join86(
|
|
13317
14393
|
loaded.outputRoot,
|
|
13318
14394
|
loaded.relativeDirPath,
|
|
13319
14395
|
loaded.dirName,
|
|
@@ -13354,21 +14430,21 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
13354
14430
|
};
|
|
13355
14431
|
|
|
13356
14432
|
// src/features/skills/codexcli-skill.ts
|
|
13357
|
-
import { join as
|
|
13358
|
-
import { z as
|
|
13359
|
-
var CodexCliSkillFrontmatterSchema =
|
|
13360
|
-
name:
|
|
13361
|
-
description:
|
|
13362
|
-
metadata:
|
|
13363
|
-
|
|
13364
|
-
"short-description":
|
|
14433
|
+
import { join as join87 } from "path";
|
|
14434
|
+
import { z as z45 } from "zod/mini";
|
|
14435
|
+
var CodexCliSkillFrontmatterSchema = z45.looseObject({
|
|
14436
|
+
name: z45.string(),
|
|
14437
|
+
description: z45.string(),
|
|
14438
|
+
metadata: z45.optional(
|
|
14439
|
+
z45.looseObject({
|
|
14440
|
+
"short-description": z45.optional(z45.string())
|
|
13365
14441
|
})
|
|
13366
14442
|
)
|
|
13367
14443
|
});
|
|
13368
14444
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
13369
14445
|
constructor({
|
|
13370
14446
|
outputRoot = process.cwd(),
|
|
13371
|
-
relativeDirPath =
|
|
14447
|
+
relativeDirPath = join87(".codex", "skills"),
|
|
13372
14448
|
dirName,
|
|
13373
14449
|
frontmatter,
|
|
13374
14450
|
body,
|
|
@@ -13399,7 +14475,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
13399
14475
|
global: _global = false
|
|
13400
14476
|
} = {}) {
|
|
13401
14477
|
return {
|
|
13402
|
-
relativeDirPath:
|
|
14478
|
+
relativeDirPath: join87(".codex", "skills")
|
|
13403
14479
|
};
|
|
13404
14480
|
}
|
|
13405
14481
|
getFrontmatter() {
|
|
@@ -13489,9 +14565,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
13489
14565
|
});
|
|
13490
14566
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13491
14567
|
if (!result.success) {
|
|
13492
|
-
const skillDirPath =
|
|
14568
|
+
const skillDirPath = join87(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13493
14569
|
throw new Error(
|
|
13494
|
-
`Invalid frontmatter in ${
|
|
14570
|
+
`Invalid frontmatter in ${join87(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13495
14571
|
);
|
|
13496
14572
|
}
|
|
13497
14573
|
return new _CodexCliSkill({
|
|
@@ -13525,17 +14601,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
13525
14601
|
};
|
|
13526
14602
|
|
|
13527
14603
|
// src/features/skills/copilot-skill.ts
|
|
13528
|
-
import { join as
|
|
13529
|
-
import { z as
|
|
13530
|
-
var CopilotSkillFrontmatterSchema =
|
|
13531
|
-
name:
|
|
13532
|
-
description:
|
|
13533
|
-
license:
|
|
14604
|
+
import { join as join88 } from "path";
|
|
14605
|
+
import { z as z46 } from "zod/mini";
|
|
14606
|
+
var CopilotSkillFrontmatterSchema = z46.looseObject({
|
|
14607
|
+
name: z46.string(),
|
|
14608
|
+
description: z46.string(),
|
|
14609
|
+
license: z46.optional(z46.string())
|
|
13534
14610
|
});
|
|
13535
14611
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
13536
14612
|
constructor({
|
|
13537
14613
|
outputRoot = process.cwd(),
|
|
13538
|
-
relativeDirPath =
|
|
14614
|
+
relativeDirPath = join88(".github", "skills"),
|
|
13539
14615
|
dirName,
|
|
13540
14616
|
frontmatter,
|
|
13541
14617
|
body,
|
|
@@ -13567,7 +14643,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
13567
14643
|
throw new Error("CopilotSkill does not support global mode.");
|
|
13568
14644
|
}
|
|
13569
14645
|
return {
|
|
13570
|
-
relativeDirPath:
|
|
14646
|
+
relativeDirPath: join88(".github", "skills")
|
|
13571
14647
|
};
|
|
13572
14648
|
}
|
|
13573
14649
|
getFrontmatter() {
|
|
@@ -13653,9 +14729,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
13653
14729
|
});
|
|
13654
14730
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13655
14731
|
if (!result.success) {
|
|
13656
|
-
const skillDirPath =
|
|
14732
|
+
const skillDirPath = join88(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13657
14733
|
throw new Error(
|
|
13658
|
-
`Invalid frontmatter in ${
|
|
14734
|
+
`Invalid frontmatter in ${join88(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13659
14735
|
);
|
|
13660
14736
|
}
|
|
13661
14737
|
return new _CopilotSkill({
|
|
@@ -13690,16 +14766,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
13690
14766
|
};
|
|
13691
14767
|
|
|
13692
14768
|
// src/features/skills/cursor-skill.ts
|
|
13693
|
-
import { join as
|
|
13694
|
-
import { z as
|
|
13695
|
-
var CursorSkillFrontmatterSchema =
|
|
13696
|
-
name:
|
|
13697
|
-
description:
|
|
14769
|
+
import { join as join89 } from "path";
|
|
14770
|
+
import { z as z47 } from "zod/mini";
|
|
14771
|
+
var CursorSkillFrontmatterSchema = z47.looseObject({
|
|
14772
|
+
name: z47.string(),
|
|
14773
|
+
description: z47.string()
|
|
13698
14774
|
});
|
|
13699
14775
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
13700
14776
|
constructor({
|
|
13701
14777
|
outputRoot = process.cwd(),
|
|
13702
|
-
relativeDirPath =
|
|
14778
|
+
relativeDirPath = join89(".cursor", "skills"),
|
|
13703
14779
|
dirName,
|
|
13704
14780
|
frontmatter,
|
|
13705
14781
|
body,
|
|
@@ -13728,7 +14804,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
13728
14804
|
}
|
|
13729
14805
|
static getSettablePaths(_options) {
|
|
13730
14806
|
return {
|
|
13731
|
-
relativeDirPath:
|
|
14807
|
+
relativeDirPath: join89(".cursor", "skills")
|
|
13732
14808
|
};
|
|
13733
14809
|
}
|
|
13734
14810
|
getFrontmatter() {
|
|
@@ -13808,9 +14884,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
13808
14884
|
});
|
|
13809
14885
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13810
14886
|
if (!result.success) {
|
|
13811
|
-
const skillDirPath =
|
|
14887
|
+
const skillDirPath = join89(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13812
14888
|
throw new Error(
|
|
13813
|
-
`Invalid frontmatter in ${
|
|
14889
|
+
`Invalid frontmatter in ${join89(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13814
14890
|
);
|
|
13815
14891
|
}
|
|
13816
14892
|
return new _CursorSkill({
|
|
@@ -13845,17 +14921,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
13845
14921
|
};
|
|
13846
14922
|
|
|
13847
14923
|
// src/features/skills/deepagents-skill.ts
|
|
13848
|
-
import { join as
|
|
13849
|
-
import { z as
|
|
13850
|
-
var DeepagentsSkillFrontmatterSchema =
|
|
13851
|
-
name:
|
|
13852
|
-
description:
|
|
13853
|
-
"allowed-tools":
|
|
14924
|
+
import { join as join90 } from "path";
|
|
14925
|
+
import { z as z48 } from "zod/mini";
|
|
14926
|
+
var DeepagentsSkillFrontmatterSchema = z48.looseObject({
|
|
14927
|
+
name: z48.string(),
|
|
14928
|
+
description: z48.string(),
|
|
14929
|
+
"allowed-tools": z48.optional(z48.array(z48.string()))
|
|
13854
14930
|
});
|
|
13855
14931
|
var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
13856
14932
|
constructor({
|
|
13857
14933
|
outputRoot = process.cwd(),
|
|
13858
|
-
relativeDirPath =
|
|
14934
|
+
relativeDirPath = join90(".deepagents", "skills"),
|
|
13859
14935
|
dirName,
|
|
13860
14936
|
frontmatter,
|
|
13861
14937
|
body,
|
|
@@ -13884,7 +14960,7 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
13884
14960
|
}
|
|
13885
14961
|
static getSettablePaths(_options) {
|
|
13886
14962
|
return {
|
|
13887
|
-
relativeDirPath:
|
|
14963
|
+
relativeDirPath: join90(".deepagents", "skills")
|
|
13888
14964
|
};
|
|
13889
14965
|
}
|
|
13890
14966
|
getFrontmatter() {
|
|
@@ -13970,9 +15046,9 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
13970
15046
|
});
|
|
13971
15047
|
const result = DeepagentsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13972
15048
|
if (!result.success) {
|
|
13973
|
-
const skillDirPath =
|
|
15049
|
+
const skillDirPath = join90(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13974
15050
|
throw new Error(
|
|
13975
|
-
`Invalid frontmatter in ${
|
|
15051
|
+
`Invalid frontmatter in ${join90(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13976
15052
|
);
|
|
13977
15053
|
}
|
|
13978
15054
|
return new _DeepagentsSkill({
|
|
@@ -14007,11 +15083,11 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
14007
15083
|
};
|
|
14008
15084
|
|
|
14009
15085
|
// src/features/skills/geminicli-skill.ts
|
|
14010
|
-
import { join as
|
|
14011
|
-
import { z as
|
|
14012
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
14013
|
-
name:
|
|
14014
|
-
description:
|
|
15086
|
+
import { join as join91 } from "path";
|
|
15087
|
+
import { z as z49 } from "zod/mini";
|
|
15088
|
+
var GeminiCliSkillFrontmatterSchema = z49.looseObject({
|
|
15089
|
+
name: z49.string(),
|
|
15090
|
+
description: z49.string()
|
|
14015
15091
|
});
|
|
14016
15092
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
14017
15093
|
constructor({
|
|
@@ -14047,7 +15123,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
14047
15123
|
global: _global = false
|
|
14048
15124
|
} = {}) {
|
|
14049
15125
|
return {
|
|
14050
|
-
relativeDirPath:
|
|
15126
|
+
relativeDirPath: join91(".gemini", "skills")
|
|
14051
15127
|
};
|
|
14052
15128
|
}
|
|
14053
15129
|
getFrontmatter() {
|
|
@@ -14127,9 +15203,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
14127
15203
|
});
|
|
14128
15204
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14129
15205
|
if (!result.success) {
|
|
14130
|
-
const skillDirPath =
|
|
15206
|
+
const skillDirPath = join91(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14131
15207
|
throw new Error(
|
|
14132
|
-
`Invalid frontmatter in ${
|
|
15208
|
+
`Invalid frontmatter in ${join91(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14133
15209
|
);
|
|
14134
15210
|
}
|
|
14135
15211
|
return new _GeminiCliSkill({
|
|
@@ -14164,16 +15240,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
14164
15240
|
};
|
|
14165
15241
|
|
|
14166
15242
|
// src/features/skills/junie-skill.ts
|
|
14167
|
-
import { join as
|
|
14168
|
-
import { z as
|
|
14169
|
-
var JunieSkillFrontmatterSchema =
|
|
14170
|
-
name:
|
|
14171
|
-
description:
|
|
15243
|
+
import { join as join92 } from "path";
|
|
15244
|
+
import { z as z50 } from "zod/mini";
|
|
15245
|
+
var JunieSkillFrontmatterSchema = z50.looseObject({
|
|
15246
|
+
name: z50.string(),
|
|
15247
|
+
description: z50.string()
|
|
14172
15248
|
});
|
|
14173
15249
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
14174
15250
|
constructor({
|
|
14175
15251
|
outputRoot = process.cwd(),
|
|
14176
|
-
relativeDirPath =
|
|
15252
|
+
relativeDirPath = join92(".junie", "skills"),
|
|
14177
15253
|
dirName,
|
|
14178
15254
|
frontmatter,
|
|
14179
15255
|
body,
|
|
@@ -14205,7 +15281,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
14205
15281
|
throw new Error("JunieSkill does not support global mode.");
|
|
14206
15282
|
}
|
|
14207
15283
|
return {
|
|
14208
|
-
relativeDirPath:
|
|
15284
|
+
relativeDirPath: join92(".junie", "skills")
|
|
14209
15285
|
};
|
|
14210
15286
|
}
|
|
14211
15287
|
getFrontmatter() {
|
|
@@ -14292,13 +15368,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
14292
15368
|
});
|
|
14293
15369
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14294
15370
|
if (!result.success) {
|
|
14295
|
-
const skillDirPath =
|
|
15371
|
+
const skillDirPath = join92(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14296
15372
|
throw new Error(
|
|
14297
|
-
`Invalid frontmatter in ${
|
|
15373
|
+
`Invalid frontmatter in ${join92(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14298
15374
|
);
|
|
14299
15375
|
}
|
|
14300
15376
|
if (result.data.name !== loaded.dirName) {
|
|
14301
|
-
const skillFilePath =
|
|
15377
|
+
const skillFilePath = join92(
|
|
14302
15378
|
loaded.outputRoot,
|
|
14303
15379
|
loaded.relativeDirPath,
|
|
14304
15380
|
loaded.dirName,
|
|
@@ -14340,17 +15416,17 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
14340
15416
|
};
|
|
14341
15417
|
|
|
14342
15418
|
// src/features/skills/kilo-skill.ts
|
|
14343
|
-
import { join as
|
|
14344
|
-
import { z as
|
|
14345
|
-
var KiloSkillFrontmatterSchema =
|
|
14346
|
-
name:
|
|
14347
|
-
description:
|
|
14348
|
-
"allowed-tools":
|
|
15419
|
+
import { join as join93 } from "path";
|
|
15420
|
+
import { z as z51 } from "zod/mini";
|
|
15421
|
+
var KiloSkillFrontmatterSchema = z51.looseObject({
|
|
15422
|
+
name: z51.string(),
|
|
15423
|
+
description: z51.string(),
|
|
15424
|
+
"allowed-tools": z51.optional(z51.array(z51.string()))
|
|
14349
15425
|
});
|
|
14350
15426
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
14351
15427
|
constructor({
|
|
14352
15428
|
outputRoot = process.cwd(),
|
|
14353
|
-
relativeDirPath =
|
|
15429
|
+
relativeDirPath = join93(".kilo", "skills"),
|
|
14354
15430
|
dirName,
|
|
14355
15431
|
frontmatter,
|
|
14356
15432
|
body,
|
|
@@ -14379,7 +15455,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
14379
15455
|
}
|
|
14380
15456
|
static getSettablePaths({ global = false } = {}) {
|
|
14381
15457
|
return {
|
|
14382
|
-
relativeDirPath: global ?
|
|
15458
|
+
relativeDirPath: global ? join93(".config", "kilo", "skills") : join93(".kilo", "skills")
|
|
14383
15459
|
};
|
|
14384
15460
|
}
|
|
14385
15461
|
getFrontmatter() {
|
|
@@ -14465,9 +15541,9 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
14465
15541
|
});
|
|
14466
15542
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14467
15543
|
if (!result.success) {
|
|
14468
|
-
const skillDirPath =
|
|
15544
|
+
const skillDirPath = join93(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14469
15545
|
throw new Error(
|
|
14470
|
-
`Invalid frontmatter in ${
|
|
15546
|
+
`Invalid frontmatter in ${join93(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14471
15547
|
);
|
|
14472
15548
|
}
|
|
14473
15549
|
return new _KiloSkill({
|
|
@@ -14501,16 +15577,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
14501
15577
|
};
|
|
14502
15578
|
|
|
14503
15579
|
// src/features/skills/kiro-skill.ts
|
|
14504
|
-
import { join as
|
|
14505
|
-
import { z as
|
|
14506
|
-
var KiroSkillFrontmatterSchema =
|
|
14507
|
-
name:
|
|
14508
|
-
description:
|
|
15580
|
+
import { join as join94 } from "path";
|
|
15581
|
+
import { z as z52 } from "zod/mini";
|
|
15582
|
+
var KiroSkillFrontmatterSchema = z52.looseObject({
|
|
15583
|
+
name: z52.string(),
|
|
15584
|
+
description: z52.string()
|
|
14509
15585
|
});
|
|
14510
15586
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
14511
15587
|
constructor({
|
|
14512
15588
|
outputRoot = process.cwd(),
|
|
14513
|
-
relativeDirPath =
|
|
15589
|
+
relativeDirPath = join94(".kiro", "skills"),
|
|
14514
15590
|
dirName,
|
|
14515
15591
|
frontmatter,
|
|
14516
15592
|
body,
|
|
@@ -14542,7 +15618,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
14542
15618
|
throw new Error("KiroSkill does not support global mode.");
|
|
14543
15619
|
}
|
|
14544
15620
|
return {
|
|
14545
|
-
relativeDirPath:
|
|
15621
|
+
relativeDirPath: join94(".kiro", "skills")
|
|
14546
15622
|
};
|
|
14547
15623
|
}
|
|
14548
15624
|
getFrontmatter() {
|
|
@@ -14630,13 +15706,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
14630
15706
|
});
|
|
14631
15707
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14632
15708
|
if (!result.success) {
|
|
14633
|
-
const skillDirPath =
|
|
15709
|
+
const skillDirPath = join94(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14634
15710
|
throw new Error(
|
|
14635
|
-
`Invalid frontmatter in ${
|
|
15711
|
+
`Invalid frontmatter in ${join94(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14636
15712
|
);
|
|
14637
15713
|
}
|
|
14638
15714
|
if (result.data.name !== loaded.dirName) {
|
|
14639
|
-
const skillFilePath =
|
|
15715
|
+
const skillFilePath = join94(
|
|
14640
15716
|
loaded.outputRoot,
|
|
14641
15717
|
loaded.relativeDirPath,
|
|
14642
15718
|
loaded.dirName,
|
|
@@ -14678,17 +15754,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
14678
15754
|
};
|
|
14679
15755
|
|
|
14680
15756
|
// src/features/skills/opencode-skill.ts
|
|
14681
|
-
import { join as
|
|
14682
|
-
import { z as
|
|
14683
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
14684
|
-
name:
|
|
14685
|
-
description:
|
|
14686
|
-
"allowed-tools":
|
|
15757
|
+
import { join as join95 } from "path";
|
|
15758
|
+
import { z as z53 } from "zod/mini";
|
|
15759
|
+
var OpenCodeSkillFrontmatterSchema = z53.looseObject({
|
|
15760
|
+
name: z53.string(),
|
|
15761
|
+
description: z53.string(),
|
|
15762
|
+
"allowed-tools": z53.optional(z53.array(z53.string()))
|
|
14687
15763
|
});
|
|
14688
15764
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
14689
15765
|
constructor({
|
|
14690
15766
|
outputRoot = process.cwd(),
|
|
14691
|
-
relativeDirPath =
|
|
15767
|
+
relativeDirPath = join95(".opencode", "skill"),
|
|
14692
15768
|
dirName,
|
|
14693
15769
|
frontmatter,
|
|
14694
15770
|
body,
|
|
@@ -14717,7 +15793,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
14717
15793
|
}
|
|
14718
15794
|
static getSettablePaths({ global = false } = {}) {
|
|
14719
15795
|
return {
|
|
14720
|
-
relativeDirPath: global ?
|
|
15796
|
+
relativeDirPath: global ? join95(".config", "opencode", "skill") : join95(".opencode", "skill")
|
|
14721
15797
|
};
|
|
14722
15798
|
}
|
|
14723
15799
|
getFrontmatter() {
|
|
@@ -14803,9 +15879,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
14803
15879
|
});
|
|
14804
15880
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14805
15881
|
if (!result.success) {
|
|
14806
|
-
const skillDirPath =
|
|
15882
|
+
const skillDirPath = join95(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14807
15883
|
throw new Error(
|
|
14808
|
-
`Invalid frontmatter in ${
|
|
15884
|
+
`Invalid frontmatter in ${join95(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14809
15885
|
);
|
|
14810
15886
|
}
|
|
14811
15887
|
return new _OpenCodeSkill({
|
|
@@ -14839,11 +15915,11 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
14839
15915
|
};
|
|
14840
15916
|
|
|
14841
15917
|
// src/features/skills/pi-skill.ts
|
|
14842
|
-
import { join as
|
|
14843
|
-
import { z as
|
|
14844
|
-
var PiSkillFrontmatterSchema =
|
|
14845
|
-
name:
|
|
14846
|
-
description:
|
|
15918
|
+
import { join as join96 } from "path";
|
|
15919
|
+
import { z as z54 } from "zod/mini";
|
|
15920
|
+
var PiSkillFrontmatterSchema = z54.looseObject({
|
|
15921
|
+
name: z54.string(),
|
|
15922
|
+
description: z54.string()
|
|
14847
15923
|
});
|
|
14848
15924
|
var PiSkill = class _PiSkill extends ToolSkill {
|
|
14849
15925
|
constructor({
|
|
@@ -14879,11 +15955,11 @@ var PiSkill = class _PiSkill extends ToolSkill {
|
|
|
14879
15955
|
static getSettablePaths({ global } = {}) {
|
|
14880
15956
|
if (global) {
|
|
14881
15957
|
return {
|
|
14882
|
-
relativeDirPath:
|
|
15958
|
+
relativeDirPath: join96(".pi", "agent", "skills")
|
|
14883
15959
|
};
|
|
14884
15960
|
}
|
|
14885
15961
|
return {
|
|
14886
|
-
relativeDirPath:
|
|
15962
|
+
relativeDirPath: join96(".pi", "skills")
|
|
14887
15963
|
};
|
|
14888
15964
|
}
|
|
14889
15965
|
getFrontmatter() {
|
|
@@ -14962,9 +16038,9 @@ var PiSkill = class _PiSkill extends ToolSkill {
|
|
|
14962
16038
|
});
|
|
14963
16039
|
const result = PiSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14964
16040
|
if (!result.success) {
|
|
14965
|
-
const skillDirPath =
|
|
16041
|
+
const skillDirPath = join96(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14966
16042
|
throw new Error(
|
|
14967
|
-
`Invalid frontmatter in ${
|
|
16043
|
+
`Invalid frontmatter in ${join96(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14968
16044
|
);
|
|
14969
16045
|
}
|
|
14970
16046
|
return new _PiSkill({
|
|
@@ -14999,16 +16075,16 @@ var PiSkill = class _PiSkill extends ToolSkill {
|
|
|
14999
16075
|
};
|
|
15000
16076
|
|
|
15001
16077
|
// src/features/skills/replit-skill.ts
|
|
15002
|
-
import { join as
|
|
15003
|
-
import { z as
|
|
15004
|
-
var ReplitSkillFrontmatterSchema =
|
|
15005
|
-
name:
|
|
15006
|
-
description:
|
|
16078
|
+
import { join as join97 } from "path";
|
|
16079
|
+
import { z as z55 } from "zod/mini";
|
|
16080
|
+
var ReplitSkillFrontmatterSchema = z55.looseObject({
|
|
16081
|
+
name: z55.string(),
|
|
16082
|
+
description: z55.string()
|
|
15007
16083
|
});
|
|
15008
16084
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
15009
16085
|
constructor({
|
|
15010
16086
|
outputRoot = process.cwd(),
|
|
15011
|
-
relativeDirPath =
|
|
16087
|
+
relativeDirPath = join97(".agents", "skills"),
|
|
15012
16088
|
dirName,
|
|
15013
16089
|
frontmatter,
|
|
15014
16090
|
body,
|
|
@@ -15040,7 +16116,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
15040
16116
|
throw new Error("ReplitSkill does not support global mode.");
|
|
15041
16117
|
}
|
|
15042
16118
|
return {
|
|
15043
|
-
relativeDirPath:
|
|
16119
|
+
relativeDirPath: join97(".agents", "skills")
|
|
15044
16120
|
};
|
|
15045
16121
|
}
|
|
15046
16122
|
getFrontmatter() {
|
|
@@ -15120,9 +16196,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
15120
16196
|
});
|
|
15121
16197
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
15122
16198
|
if (!result.success) {
|
|
15123
|
-
const skillDirPath =
|
|
16199
|
+
const skillDirPath = join97(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
15124
16200
|
throw new Error(
|
|
15125
|
-
`Invalid frontmatter in ${
|
|
16201
|
+
`Invalid frontmatter in ${join97(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
15126
16202
|
);
|
|
15127
16203
|
}
|
|
15128
16204
|
return new _ReplitSkill({
|
|
@@ -15157,16 +16233,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
15157
16233
|
};
|
|
15158
16234
|
|
|
15159
16235
|
// src/features/skills/roo-skill.ts
|
|
15160
|
-
import { join as
|
|
15161
|
-
import { z as
|
|
15162
|
-
var RooSkillFrontmatterSchema =
|
|
15163
|
-
name:
|
|
15164
|
-
description:
|
|
16236
|
+
import { join as join98 } from "path";
|
|
16237
|
+
import { z as z56 } from "zod/mini";
|
|
16238
|
+
var RooSkillFrontmatterSchema = z56.looseObject({
|
|
16239
|
+
name: z56.string(),
|
|
16240
|
+
description: z56.string()
|
|
15165
16241
|
});
|
|
15166
16242
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
15167
16243
|
constructor({
|
|
15168
16244
|
outputRoot = process.cwd(),
|
|
15169
|
-
relativeDirPath =
|
|
16245
|
+
relativeDirPath = join98(".roo", "skills"),
|
|
15170
16246
|
dirName,
|
|
15171
16247
|
frontmatter,
|
|
15172
16248
|
body,
|
|
@@ -15197,7 +16273,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
15197
16273
|
global: _global = false
|
|
15198
16274
|
} = {}) {
|
|
15199
16275
|
return {
|
|
15200
|
-
relativeDirPath:
|
|
16276
|
+
relativeDirPath: join98(".roo", "skills")
|
|
15201
16277
|
};
|
|
15202
16278
|
}
|
|
15203
16279
|
getFrontmatter() {
|
|
@@ -15285,13 +16361,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
15285
16361
|
});
|
|
15286
16362
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
15287
16363
|
if (!result.success) {
|
|
15288
|
-
const skillDirPath =
|
|
16364
|
+
const skillDirPath = join98(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
15289
16365
|
throw new Error(
|
|
15290
|
-
`Invalid frontmatter in ${
|
|
16366
|
+
`Invalid frontmatter in ${join98(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
15291
16367
|
);
|
|
15292
16368
|
}
|
|
15293
16369
|
if (result.data.name !== loaded.dirName) {
|
|
15294
|
-
const skillFilePath =
|
|
16370
|
+
const skillFilePath = join98(
|
|
15295
16371
|
loaded.outputRoot,
|
|
15296
16372
|
loaded.relativeDirPath,
|
|
15297
16373
|
loaded.dirName,
|
|
@@ -15332,14 +16408,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
15332
16408
|
};
|
|
15333
16409
|
|
|
15334
16410
|
// src/features/skills/skills-utils.ts
|
|
15335
|
-
import { basename as basename4, join as
|
|
16411
|
+
import { basename as basename4, join as join99 } from "path";
|
|
15336
16412
|
async function getLocalSkillDirNames(outputRoot) {
|
|
15337
|
-
const skillsDir =
|
|
16413
|
+
const skillsDir = join99(outputRoot, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
15338
16414
|
const names = /* @__PURE__ */ new Set();
|
|
15339
16415
|
if (!await directoryExists(skillsDir)) {
|
|
15340
16416
|
return names;
|
|
15341
16417
|
}
|
|
15342
|
-
const dirPaths = await findFilesByGlobs(
|
|
16418
|
+
const dirPaths = await findFilesByGlobs(join99(skillsDir, "*"), { type: "dir" });
|
|
15343
16419
|
for (const dirPath of dirPaths) {
|
|
15344
16420
|
const name = basename4(dirPath);
|
|
15345
16421
|
if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
@@ -15349,7 +16425,7 @@ async function getLocalSkillDirNames(outputRoot) {
|
|
|
15349
16425
|
}
|
|
15350
16426
|
|
|
15351
16427
|
// src/features/skills/takt-skill.ts
|
|
15352
|
-
import path3, { join as
|
|
16428
|
+
import path3, { join as join100, relative as relative5, resolve as resolve6 } from "path";
|
|
15353
16429
|
var DEFAULT_TAKT_SKILL_DIR = "knowledge";
|
|
15354
16430
|
var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
15355
16431
|
fileName;
|
|
@@ -15386,7 +16462,7 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15386
16462
|
}
|
|
15387
16463
|
static getSettablePaths(_options = {}) {
|
|
15388
16464
|
return {
|
|
15389
|
-
relativeDirPath:
|
|
16465
|
+
relativeDirPath: join100(".takt", "facets", DEFAULT_TAKT_SKILL_DIR)
|
|
15390
16466
|
};
|
|
15391
16467
|
}
|
|
15392
16468
|
/**
|
|
@@ -15397,7 +16473,7 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15397
16473
|
* malicious `relativeDirPath` cannot escape `outputRoot`.
|
|
15398
16474
|
*/
|
|
15399
16475
|
getDirPath() {
|
|
15400
|
-
const fullPath =
|
|
16476
|
+
const fullPath = join100(this.outputRoot, this.relativeDirPath);
|
|
15401
16477
|
const resolvedFull = resolve6(fullPath);
|
|
15402
16478
|
const resolvedBase = resolve6(this.outputRoot);
|
|
15403
16479
|
const rel = relative5(resolvedBase, resolvedFull);
|
|
@@ -15438,7 +16514,7 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15438
16514
|
const stem = overrideName ?? rulesyncSkill.getDirName();
|
|
15439
16515
|
assertSafeTaktName({ name: stem, featureLabel: "skill", sourceLabel });
|
|
15440
16516
|
const fileName = `${stem}.md`;
|
|
15441
|
-
const relativeDirPath =
|
|
16517
|
+
const relativeDirPath = join100(".takt", "facets", DEFAULT_TAKT_SKILL_DIR);
|
|
15442
16518
|
return new _TaktSkill({
|
|
15443
16519
|
outputRoot,
|
|
15444
16520
|
relativeDirPath,
|
|
@@ -15488,11 +16564,11 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15488
16564
|
};
|
|
15489
16565
|
|
|
15490
16566
|
// src/features/skills/windsurf-skill.ts
|
|
15491
|
-
import { join as
|
|
15492
|
-
import { z as
|
|
15493
|
-
var WindsurfSkillFrontmatterSchema =
|
|
15494
|
-
name:
|
|
15495
|
-
description:
|
|
16567
|
+
import { join as join101 } from "path";
|
|
16568
|
+
import { z as z57 } from "zod/mini";
|
|
16569
|
+
var WindsurfSkillFrontmatterSchema = z57.looseObject({
|
|
16570
|
+
name: z57.string(),
|
|
16571
|
+
description: z57.string()
|
|
15496
16572
|
});
|
|
15497
16573
|
var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
15498
16574
|
constructor({
|
|
@@ -15527,11 +16603,11 @@ var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
|
15527
16603
|
static getSettablePaths({ global = false } = {}) {
|
|
15528
16604
|
if (global) {
|
|
15529
16605
|
return {
|
|
15530
|
-
relativeDirPath:
|
|
16606
|
+
relativeDirPath: join101(".codeium", "windsurf", "skills")
|
|
15531
16607
|
};
|
|
15532
16608
|
}
|
|
15533
16609
|
return {
|
|
15534
|
-
relativeDirPath:
|
|
16610
|
+
relativeDirPath: join101(".windsurf", "skills")
|
|
15535
16611
|
};
|
|
15536
16612
|
}
|
|
15537
16613
|
getFrontmatter() {
|
|
@@ -15611,9 +16687,9 @@ var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
|
15611
16687
|
});
|
|
15612
16688
|
const result = WindsurfSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
15613
16689
|
if (!result.success) {
|
|
15614
|
-
const skillDirPath =
|
|
16690
|
+
const skillDirPath = join101(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
15615
16691
|
throw new Error(
|
|
15616
|
-
`Invalid frontmatter in ${
|
|
16692
|
+
`Invalid frontmatter in ${join101(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
15617
16693
|
);
|
|
15618
16694
|
}
|
|
15619
16695
|
return new _WindsurfSkill({
|
|
@@ -15672,7 +16748,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
15672
16748
|
"takt",
|
|
15673
16749
|
"windsurf"
|
|
15674
16750
|
];
|
|
15675
|
-
var SkillsProcessorToolTargetSchema =
|
|
16751
|
+
var SkillsProcessorToolTargetSchema = z58.enum(skillsProcessorToolTargetTuple);
|
|
15676
16752
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
15677
16753
|
[
|
|
15678
16754
|
"agentsmd",
|
|
@@ -15923,10 +16999,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
15923
16999
|
)
|
|
15924
17000
|
);
|
|
15925
17001
|
const localSkillNames = new Set(localDirNames);
|
|
15926
|
-
const curatedDirPath =
|
|
17002
|
+
const curatedDirPath = join102(this.inputRoot, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
15927
17003
|
let curatedSkills = [];
|
|
15928
17004
|
if (await directoryExists(curatedDirPath)) {
|
|
15929
|
-
const curatedDirPaths = await findFilesByGlobs(
|
|
17005
|
+
const curatedDirPaths = await findFilesByGlobs(join102(curatedDirPath, "*"), { type: "dir" });
|
|
15930
17006
|
const curatedDirNames = curatedDirPaths.map((path4) => basename5(path4));
|
|
15931
17007
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
15932
17008
|
if (localSkillNames.has(name)) {
|
|
@@ -15964,11 +17040,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
15964
17040
|
const seenDirNames = /* @__PURE__ */ new Set();
|
|
15965
17041
|
const loadEntries = [];
|
|
15966
17042
|
for (const root of roots) {
|
|
15967
|
-
const skillsDirPath =
|
|
17043
|
+
const skillsDirPath = join102(this.outputRoot, root);
|
|
15968
17044
|
if (!await directoryExists(skillsDirPath)) {
|
|
15969
17045
|
continue;
|
|
15970
17046
|
}
|
|
15971
|
-
const dirPaths = await findFilesByGlobs(
|
|
17047
|
+
const dirPaths = await findFilesByGlobs(join102(skillsDirPath, "*"), { type: "dir" });
|
|
15972
17048
|
for (const dirPath of dirPaths) {
|
|
15973
17049
|
const dirName = basename5(dirPath);
|
|
15974
17050
|
if (seenDirNames.has(dirName)) {
|
|
@@ -15999,11 +17075,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
15999
17075
|
const roots = toolSkillSearchRoots(paths);
|
|
16000
17076
|
const toolSkills = [];
|
|
16001
17077
|
for (const root of roots) {
|
|
16002
|
-
const skillsDirPath =
|
|
17078
|
+
const skillsDirPath = join102(this.outputRoot, root);
|
|
16003
17079
|
if (!await directoryExists(skillsDirPath)) {
|
|
16004
17080
|
continue;
|
|
16005
17081
|
}
|
|
16006
|
-
const dirPaths = await findFilesByGlobs(
|
|
17082
|
+
const dirPaths = await findFilesByGlobs(join102(skillsDirPath, "*"), { type: "dir" });
|
|
16007
17083
|
for (const dirPath of dirPaths) {
|
|
16008
17084
|
const dirName = basename5(dirPath);
|
|
16009
17085
|
const toolSkill = factory.class.forDeletion({
|
|
@@ -16067,11 +17143,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
16067
17143
|
};
|
|
16068
17144
|
|
|
16069
17145
|
// src/features/subagents/agentsmd-subagent.ts
|
|
16070
|
-
import { join as
|
|
17146
|
+
import { join as join104 } from "path";
|
|
16071
17147
|
|
|
16072
17148
|
// src/features/subagents/simulated-subagent.ts
|
|
16073
|
-
import { basename as basename6, join as
|
|
16074
|
-
import { z as
|
|
17149
|
+
import { basename as basename6, join as join103 } from "path";
|
|
17150
|
+
import { z as z59 } from "zod/mini";
|
|
16075
17151
|
|
|
16076
17152
|
// src/features/subagents/tool-subagent.ts
|
|
16077
17153
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -16123,9 +17199,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
16123
17199
|
};
|
|
16124
17200
|
|
|
16125
17201
|
// src/features/subagents/simulated-subagent.ts
|
|
16126
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
16127
|
-
name:
|
|
16128
|
-
description:
|
|
17202
|
+
var SimulatedSubagentFrontmatterSchema = z59.object({
|
|
17203
|
+
name: z59.string(),
|
|
17204
|
+
description: z59.optional(z59.string())
|
|
16129
17205
|
});
|
|
16130
17206
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
16131
17207
|
frontmatter;
|
|
@@ -16135,7 +17211,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16135
17211
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16136
17212
|
if (!result.success) {
|
|
16137
17213
|
throw new Error(
|
|
16138
|
-
`Invalid frontmatter in ${
|
|
17214
|
+
`Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16139
17215
|
);
|
|
16140
17216
|
}
|
|
16141
17217
|
}
|
|
@@ -16186,7 +17262,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16186
17262
|
return {
|
|
16187
17263
|
success: false,
|
|
16188
17264
|
error: new Error(
|
|
16189
|
-
`Invalid frontmatter in ${
|
|
17265
|
+
`Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16190
17266
|
)
|
|
16191
17267
|
};
|
|
16192
17268
|
}
|
|
@@ -16196,7 +17272,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16196
17272
|
relativeFilePath,
|
|
16197
17273
|
validate = true
|
|
16198
17274
|
}) {
|
|
16199
|
-
const filePath =
|
|
17275
|
+
const filePath = join103(outputRoot, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
16200
17276
|
const fileContent = await readFileContent(filePath);
|
|
16201
17277
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16202
17278
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16232,7 +17308,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16232
17308
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
16233
17309
|
static getSettablePaths() {
|
|
16234
17310
|
return {
|
|
16235
|
-
relativeDirPath:
|
|
17311
|
+
relativeDirPath: join104(".agents", "subagents")
|
|
16236
17312
|
};
|
|
16237
17313
|
}
|
|
16238
17314
|
static async fromFile(params) {
|
|
@@ -16255,11 +17331,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
16255
17331
|
};
|
|
16256
17332
|
|
|
16257
17333
|
// src/features/subagents/factorydroid-subagent.ts
|
|
16258
|
-
import { join as
|
|
17334
|
+
import { join as join105 } from "path";
|
|
16259
17335
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
16260
17336
|
static getSettablePaths(_options) {
|
|
16261
17337
|
return {
|
|
16262
|
-
relativeDirPath:
|
|
17338
|
+
relativeDirPath: join105(".factory", "droids")
|
|
16263
17339
|
};
|
|
16264
17340
|
}
|
|
16265
17341
|
static async fromFile(params) {
|
|
@@ -16282,19 +17358,19 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
16282
17358
|
};
|
|
16283
17359
|
|
|
16284
17360
|
// src/features/subagents/geminicli-subagent.ts
|
|
16285
|
-
import { join as
|
|
16286
|
-
import { z as
|
|
17361
|
+
import { join as join107 } from "path";
|
|
17362
|
+
import { z as z61 } from "zod/mini";
|
|
16287
17363
|
|
|
16288
17364
|
// src/features/subagents/rulesync-subagent.ts
|
|
16289
|
-
import { basename as basename7, join as
|
|
16290
|
-
import { z as
|
|
16291
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
16292
|
-
targets:
|
|
16293
|
-
name:
|
|
16294
|
-
description:
|
|
16295
|
-
takt:
|
|
16296
|
-
|
|
16297
|
-
name:
|
|
17365
|
+
import { basename as basename7, join as join106 } from "path";
|
|
17366
|
+
import { z as z60 } from "zod/mini";
|
|
17367
|
+
var RulesyncSubagentFrontmatterSchema = z60.looseObject({
|
|
17368
|
+
targets: z60._default(RulesyncTargetsSchema, ["*"]),
|
|
17369
|
+
name: z60.string(),
|
|
17370
|
+
description: z60.optional(z60.string()),
|
|
17371
|
+
takt: z60.optional(
|
|
17372
|
+
z60.looseObject({
|
|
17373
|
+
name: z60.optional(z60.string())
|
|
16298
17374
|
})
|
|
16299
17375
|
)
|
|
16300
17376
|
});
|
|
@@ -16305,7 +17381,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16305
17381
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16306
17382
|
if (!parseResult.success && rest.validate !== false) {
|
|
16307
17383
|
throw new Error(
|
|
16308
|
-
`Invalid frontmatter in ${
|
|
17384
|
+
`Invalid frontmatter in ${join106(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
16309
17385
|
);
|
|
16310
17386
|
}
|
|
16311
17387
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -16338,7 +17414,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16338
17414
|
return {
|
|
16339
17415
|
success: false,
|
|
16340
17416
|
error: new Error(
|
|
16341
|
-
`Invalid frontmatter in ${
|
|
17417
|
+
`Invalid frontmatter in ${join106(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16342
17418
|
)
|
|
16343
17419
|
};
|
|
16344
17420
|
}
|
|
@@ -16347,7 +17423,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16347
17423
|
outputRoot = process.cwd(),
|
|
16348
17424
|
relativeFilePath
|
|
16349
17425
|
}) {
|
|
16350
|
-
const filePath =
|
|
17426
|
+
const filePath = join106(outputRoot, RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
16351
17427
|
const fileContent = await readFileContent(filePath);
|
|
16352
17428
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16353
17429
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16366,9 +17442,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16366
17442
|
};
|
|
16367
17443
|
|
|
16368
17444
|
// src/features/subagents/geminicli-subagent.ts
|
|
16369
|
-
var GeminiCliSubagentFrontmatterSchema =
|
|
16370
|
-
name:
|
|
16371
|
-
description:
|
|
17445
|
+
var GeminiCliSubagentFrontmatterSchema = z61.looseObject({
|
|
17446
|
+
name: z61.string(),
|
|
17447
|
+
description: z61.optional(z61.string())
|
|
16372
17448
|
});
|
|
16373
17449
|
var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
16374
17450
|
frontmatter;
|
|
@@ -16378,7 +17454,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16378
17454
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16379
17455
|
if (!result.success) {
|
|
16380
17456
|
throw new Error(
|
|
16381
|
-
`Invalid frontmatter in ${
|
|
17457
|
+
`Invalid frontmatter in ${join107(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16382
17458
|
);
|
|
16383
17459
|
}
|
|
16384
17460
|
}
|
|
@@ -16391,7 +17467,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16391
17467
|
}
|
|
16392
17468
|
static getSettablePaths(_options = {}) {
|
|
16393
17469
|
return {
|
|
16394
|
-
relativeDirPath:
|
|
17470
|
+
relativeDirPath: join107(".gemini", "agents")
|
|
16395
17471
|
};
|
|
16396
17472
|
}
|
|
16397
17473
|
getFrontmatter() {
|
|
@@ -16459,7 +17535,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16459
17535
|
return {
|
|
16460
17536
|
success: false,
|
|
16461
17537
|
error: new Error(
|
|
16462
|
-
`Invalid frontmatter in ${
|
|
17538
|
+
`Invalid frontmatter in ${join107(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16463
17539
|
)
|
|
16464
17540
|
};
|
|
16465
17541
|
}
|
|
@@ -16477,7 +17553,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16477
17553
|
global = false
|
|
16478
17554
|
}) {
|
|
16479
17555
|
const paths = this.getSettablePaths({ global });
|
|
16480
|
-
const filePath =
|
|
17556
|
+
const filePath = join107(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16481
17557
|
const fileContent = await readFileContent(filePath);
|
|
16482
17558
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16483
17559
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16513,11 +17589,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16513
17589
|
};
|
|
16514
17590
|
|
|
16515
17591
|
// src/features/subagents/roo-subagent.ts
|
|
16516
|
-
import { join as
|
|
17592
|
+
import { join as join108 } from "path";
|
|
16517
17593
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
16518
17594
|
static getSettablePaths() {
|
|
16519
17595
|
return {
|
|
16520
|
-
relativeDirPath:
|
|
17596
|
+
relativeDirPath: join108(".roo", "subagents")
|
|
16521
17597
|
};
|
|
16522
17598
|
}
|
|
16523
17599
|
static async fromFile(params) {
|
|
@@ -16540,11 +17616,11 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
16540
17616
|
};
|
|
16541
17617
|
|
|
16542
17618
|
// src/features/subagents/rovodev-subagent.ts
|
|
16543
|
-
import { join as
|
|
16544
|
-
import { z as
|
|
16545
|
-
var RovodevSubagentFrontmatterSchema =
|
|
16546
|
-
name:
|
|
16547
|
-
description:
|
|
17619
|
+
import { join as join109 } from "path";
|
|
17620
|
+
import { z as z62 } from "zod/mini";
|
|
17621
|
+
var RovodevSubagentFrontmatterSchema = z62.looseObject({
|
|
17622
|
+
name: z62.string(),
|
|
17623
|
+
description: z62.optional(z62.string())
|
|
16548
17624
|
});
|
|
16549
17625
|
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
16550
17626
|
frontmatter;
|
|
@@ -16554,7 +17630,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16554
17630
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16555
17631
|
if (!result.success) {
|
|
16556
17632
|
throw new Error(
|
|
16557
|
-
`Invalid frontmatter in ${
|
|
17633
|
+
`Invalid frontmatter in ${join109(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16558
17634
|
);
|
|
16559
17635
|
}
|
|
16560
17636
|
}
|
|
@@ -16566,7 +17642,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16566
17642
|
}
|
|
16567
17643
|
static getSettablePaths(_options = {}) {
|
|
16568
17644
|
return {
|
|
16569
|
-
relativeDirPath:
|
|
17645
|
+
relativeDirPath: join109(".rovodev", "subagents")
|
|
16570
17646
|
};
|
|
16571
17647
|
}
|
|
16572
17648
|
getFrontmatter() {
|
|
@@ -16629,7 +17705,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16629
17705
|
return {
|
|
16630
17706
|
success: false,
|
|
16631
17707
|
error: new Error(
|
|
16632
|
-
`Invalid frontmatter in ${
|
|
17708
|
+
`Invalid frontmatter in ${join109(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16633
17709
|
)
|
|
16634
17710
|
};
|
|
16635
17711
|
}
|
|
@@ -16646,7 +17722,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16646
17722
|
global = false
|
|
16647
17723
|
}) {
|
|
16648
17724
|
const paths = this.getSettablePaths({ global });
|
|
16649
|
-
const filePath =
|
|
17725
|
+
const filePath = join109(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16650
17726
|
const fileContent = await readFileContent(filePath);
|
|
16651
17727
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16652
17728
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16685,19 +17761,19 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16685
17761
|
};
|
|
16686
17762
|
|
|
16687
17763
|
// src/features/subagents/subagents-processor.ts
|
|
16688
|
-
import { basename as basename9, join as
|
|
16689
|
-
import { z as
|
|
17764
|
+
import { basename as basename9, join as join122 } from "path";
|
|
17765
|
+
import { z as z72 } from "zod/mini";
|
|
16690
17766
|
|
|
16691
17767
|
// src/features/subagents/claudecode-subagent.ts
|
|
16692
|
-
import { join as
|
|
16693
|
-
import { z as
|
|
16694
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
16695
|
-
name:
|
|
16696
|
-
description:
|
|
16697
|
-
model:
|
|
16698
|
-
tools:
|
|
16699
|
-
permissionMode:
|
|
16700
|
-
skills:
|
|
17768
|
+
import { join as join110 } from "path";
|
|
17769
|
+
import { z as z63 } from "zod/mini";
|
|
17770
|
+
var ClaudecodeSubagentFrontmatterSchema = z63.looseObject({
|
|
17771
|
+
name: z63.string(),
|
|
17772
|
+
description: z63.optional(z63.string()),
|
|
17773
|
+
model: z63.optional(z63.string()),
|
|
17774
|
+
tools: z63.optional(z63.union([z63.string(), z63.array(z63.string())])),
|
|
17775
|
+
permissionMode: z63.optional(z63.string()),
|
|
17776
|
+
skills: z63.optional(z63.union([z63.string(), z63.array(z63.string())]))
|
|
16701
17777
|
});
|
|
16702
17778
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
16703
17779
|
frontmatter;
|
|
@@ -16707,7 +17783,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16707
17783
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16708
17784
|
if (!result.success) {
|
|
16709
17785
|
throw new Error(
|
|
16710
|
-
`Invalid frontmatter in ${
|
|
17786
|
+
`Invalid frontmatter in ${join110(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16711
17787
|
);
|
|
16712
17788
|
}
|
|
16713
17789
|
}
|
|
@@ -16719,7 +17795,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16719
17795
|
}
|
|
16720
17796
|
static getSettablePaths(_options = {}) {
|
|
16721
17797
|
return {
|
|
16722
|
-
relativeDirPath:
|
|
17798
|
+
relativeDirPath: join110(".claude", "agents")
|
|
16723
17799
|
};
|
|
16724
17800
|
}
|
|
16725
17801
|
getFrontmatter() {
|
|
@@ -16798,7 +17874,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16798
17874
|
return {
|
|
16799
17875
|
success: false,
|
|
16800
17876
|
error: new Error(
|
|
16801
|
-
`Invalid frontmatter in ${
|
|
17877
|
+
`Invalid frontmatter in ${join110(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16802
17878
|
)
|
|
16803
17879
|
};
|
|
16804
17880
|
}
|
|
@@ -16816,7 +17892,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16816
17892
|
global = false
|
|
16817
17893
|
}) {
|
|
16818
17894
|
const paths = this.getSettablePaths({ global });
|
|
16819
|
-
const filePath =
|
|
17895
|
+
const filePath = join110(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16820
17896
|
const fileContent = await readFileContent(filePath);
|
|
16821
17897
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16822
17898
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16851,16 +17927,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16851
17927
|
};
|
|
16852
17928
|
|
|
16853
17929
|
// src/features/subagents/codexcli-subagent.ts
|
|
16854
|
-
import { join as
|
|
17930
|
+
import { join as join111 } from "path";
|
|
16855
17931
|
import * as smolToml6 from "smol-toml";
|
|
16856
|
-
import { z as
|
|
16857
|
-
var CodexCliSubagentTomlSchema =
|
|
16858
|
-
name:
|
|
16859
|
-
description:
|
|
16860
|
-
developer_instructions:
|
|
16861
|
-
model:
|
|
16862
|
-
model_reasoning_effort:
|
|
16863
|
-
sandbox_mode:
|
|
17932
|
+
import { z as z64 } from "zod/mini";
|
|
17933
|
+
var CodexCliSubagentTomlSchema = z64.looseObject({
|
|
17934
|
+
name: z64.string(),
|
|
17935
|
+
description: z64.optional(z64.string()),
|
|
17936
|
+
developer_instructions: z64.optional(z64.string()),
|
|
17937
|
+
model: z64.optional(z64.string()),
|
|
17938
|
+
model_reasoning_effort: z64.optional(z64.string()),
|
|
17939
|
+
sandbox_mode: z64.optional(z64.string())
|
|
16864
17940
|
});
|
|
16865
17941
|
function stringifyCodexCliSubagentToml(tomlObj) {
|
|
16866
17942
|
const { developer_instructions, ...restFields } = tomlObj;
|
|
@@ -16882,7 +17958,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16882
17958
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
16883
17959
|
} catch (error) {
|
|
16884
17960
|
throw new Error(
|
|
16885
|
-
`Invalid TOML in ${
|
|
17961
|
+
`Invalid TOML in ${join111(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
16886
17962
|
{ cause: error }
|
|
16887
17963
|
);
|
|
16888
17964
|
}
|
|
@@ -16894,7 +17970,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16894
17970
|
}
|
|
16895
17971
|
static getSettablePaths(_options = {}) {
|
|
16896
17972
|
return {
|
|
16897
|
-
relativeDirPath:
|
|
17973
|
+
relativeDirPath: join111(".codex", "agents")
|
|
16898
17974
|
};
|
|
16899
17975
|
}
|
|
16900
17976
|
getBody() {
|
|
@@ -16906,7 +17982,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16906
17982
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml6.parse(this.body));
|
|
16907
17983
|
} catch (error) {
|
|
16908
17984
|
throw new Error(
|
|
16909
|
-
`Failed to parse TOML in ${
|
|
17985
|
+
`Failed to parse TOML in ${join111(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
16910
17986
|
{ cause: error }
|
|
16911
17987
|
);
|
|
16912
17988
|
}
|
|
@@ -16987,7 +18063,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16987
18063
|
global = false
|
|
16988
18064
|
}) {
|
|
16989
18065
|
const paths = this.getSettablePaths({ global });
|
|
16990
|
-
const filePath =
|
|
18066
|
+
const filePath = join111(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16991
18067
|
const fileContent = await readFileContent(filePath);
|
|
16992
18068
|
const subagent = new _CodexCliSubagent({
|
|
16993
18069
|
outputRoot,
|
|
@@ -17025,13 +18101,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
17025
18101
|
};
|
|
17026
18102
|
|
|
17027
18103
|
// src/features/subagents/copilot-subagent.ts
|
|
17028
|
-
import { join as
|
|
17029
|
-
import { z as
|
|
18104
|
+
import { join as join112 } from "path";
|
|
18105
|
+
import { z as z65 } from "zod/mini";
|
|
17030
18106
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
17031
|
-
var CopilotSubagentFrontmatterSchema =
|
|
17032
|
-
name:
|
|
17033
|
-
description:
|
|
17034
|
-
tools:
|
|
18107
|
+
var CopilotSubagentFrontmatterSchema = z65.looseObject({
|
|
18108
|
+
name: z65.string(),
|
|
18109
|
+
description: z65.optional(z65.string()),
|
|
18110
|
+
tools: z65.optional(z65.union([z65.string(), z65.array(z65.string())]))
|
|
17035
18111
|
});
|
|
17036
18112
|
var normalizeTools = (tools) => {
|
|
17037
18113
|
if (!tools) {
|
|
@@ -17066,7 +18142,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17066
18142
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17067
18143
|
if (!result.success) {
|
|
17068
18144
|
throw new Error(
|
|
17069
|
-
`Invalid frontmatter in ${
|
|
18145
|
+
`Invalid frontmatter in ${join112(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17070
18146
|
);
|
|
17071
18147
|
}
|
|
17072
18148
|
}
|
|
@@ -17078,7 +18154,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17078
18154
|
}
|
|
17079
18155
|
static getSettablePaths(_options = {}) {
|
|
17080
18156
|
return {
|
|
17081
|
-
relativeDirPath:
|
|
18157
|
+
relativeDirPath: join112(".github", "agents")
|
|
17082
18158
|
};
|
|
17083
18159
|
}
|
|
17084
18160
|
getFrontmatter() {
|
|
@@ -17152,7 +18228,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17152
18228
|
return {
|
|
17153
18229
|
success: false,
|
|
17154
18230
|
error: new Error(
|
|
17155
|
-
`Invalid frontmatter in ${
|
|
18231
|
+
`Invalid frontmatter in ${join112(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17156
18232
|
)
|
|
17157
18233
|
};
|
|
17158
18234
|
}
|
|
@@ -17170,7 +18246,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17170
18246
|
global = false
|
|
17171
18247
|
}) {
|
|
17172
18248
|
const paths = this.getSettablePaths({ global });
|
|
17173
|
-
const filePath =
|
|
18249
|
+
const filePath = join112(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17174
18250
|
const fileContent = await readFileContent(filePath);
|
|
17175
18251
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17176
18252
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17206,18 +18282,18 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17206
18282
|
};
|
|
17207
18283
|
|
|
17208
18284
|
// src/features/subagents/copilotcli-subagent.ts
|
|
17209
|
-
import { join as
|
|
17210
|
-
import { z as
|
|
17211
|
-
var CopilotCliSubagentFrontmatterSchema =
|
|
17212
|
-
description:
|
|
17213
|
-
name:
|
|
17214
|
-
target:
|
|
17215
|
-
tools:
|
|
17216
|
-
model:
|
|
17217
|
-
"disable-model-invocation":
|
|
17218
|
-
"user-invocable":
|
|
17219
|
-
"mcp-servers":
|
|
17220
|
-
metadata:
|
|
18285
|
+
import { join as join113 } from "path";
|
|
18286
|
+
import { z as z66 } from "zod/mini";
|
|
18287
|
+
var CopilotCliSubagentFrontmatterSchema = z66.looseObject({
|
|
18288
|
+
description: z66.string(),
|
|
18289
|
+
name: z66.optional(z66.string()),
|
|
18290
|
+
target: z66.optional(z66.string()),
|
|
18291
|
+
tools: z66.optional(z66.union([z66.string(), z66.array(z66.string())])),
|
|
18292
|
+
model: z66.optional(z66.string()),
|
|
18293
|
+
"disable-model-invocation": z66.optional(z66.boolean()),
|
|
18294
|
+
"user-invocable": z66.optional(z66.boolean()),
|
|
18295
|
+
"mcp-servers": z66.optional(z66.record(z66.string(), z66.unknown())),
|
|
18296
|
+
metadata: z66.optional(z66.record(z66.string(), z66.unknown()))
|
|
17221
18297
|
});
|
|
17222
18298
|
var toCopilotCliAgentFilePath = (relativeFilePath) => {
|
|
17223
18299
|
if (relativeFilePath.endsWith(".agent.md")) {
|
|
@@ -17242,7 +18318,7 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17242
18318
|
const result = CopilotCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17243
18319
|
if (!result.success) {
|
|
17244
18320
|
throw new Error(
|
|
17245
|
-
`Invalid frontmatter in ${
|
|
18321
|
+
`Invalid frontmatter in ${join113(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17246
18322
|
);
|
|
17247
18323
|
}
|
|
17248
18324
|
}
|
|
@@ -17254,9 +18330,9 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17254
18330
|
global = false
|
|
17255
18331
|
} = {}) {
|
|
17256
18332
|
if (global) {
|
|
17257
|
-
return { relativeDirPath:
|
|
18333
|
+
return { relativeDirPath: join113(".copilot", "agents") };
|
|
17258
18334
|
}
|
|
17259
|
-
return { relativeDirPath:
|
|
18335
|
+
return { relativeDirPath: join113(".github", "agents") };
|
|
17260
18336
|
}
|
|
17261
18337
|
getFrontmatter() {
|
|
17262
18338
|
return this.frontmatter;
|
|
@@ -17334,7 +18410,7 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17334
18410
|
return {
|
|
17335
18411
|
success: false,
|
|
17336
18412
|
error: new Error(
|
|
17337
|
-
`Invalid frontmatter in ${
|
|
18413
|
+
`Invalid frontmatter in ${join113(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17338
18414
|
)
|
|
17339
18415
|
};
|
|
17340
18416
|
}
|
|
@@ -17351,7 +18427,7 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17351
18427
|
global = false
|
|
17352
18428
|
}) {
|
|
17353
18429
|
const paths = this.getSettablePaths({ global });
|
|
17354
|
-
const filePath =
|
|
18430
|
+
const filePath = join113(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17355
18431
|
const fileContent = await readFileContent(filePath);
|
|
17356
18432
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17357
18433
|
const result = CopilotCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17387,11 +18463,11 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17387
18463
|
};
|
|
17388
18464
|
|
|
17389
18465
|
// src/features/subagents/cursor-subagent.ts
|
|
17390
|
-
import { join as
|
|
17391
|
-
import { z as
|
|
17392
|
-
var CursorSubagentFrontmatterSchema =
|
|
17393
|
-
name:
|
|
17394
|
-
description:
|
|
18466
|
+
import { join as join114 } from "path";
|
|
18467
|
+
import { z as z67 } from "zod/mini";
|
|
18468
|
+
var CursorSubagentFrontmatterSchema = z67.looseObject({
|
|
18469
|
+
name: z67.string(),
|
|
18470
|
+
description: z67.optional(z67.string())
|
|
17395
18471
|
});
|
|
17396
18472
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
17397
18473
|
frontmatter;
|
|
@@ -17401,7 +18477,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17401
18477
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17402
18478
|
if (!result.success) {
|
|
17403
18479
|
throw new Error(
|
|
17404
|
-
`Invalid frontmatter in ${
|
|
18480
|
+
`Invalid frontmatter in ${join114(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17405
18481
|
);
|
|
17406
18482
|
}
|
|
17407
18483
|
}
|
|
@@ -17413,7 +18489,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17413
18489
|
}
|
|
17414
18490
|
static getSettablePaths(_options = {}) {
|
|
17415
18491
|
return {
|
|
17416
|
-
relativeDirPath:
|
|
18492
|
+
relativeDirPath: join114(".cursor", "agents")
|
|
17417
18493
|
};
|
|
17418
18494
|
}
|
|
17419
18495
|
getFrontmatter() {
|
|
@@ -17480,7 +18556,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17480
18556
|
return {
|
|
17481
18557
|
success: false,
|
|
17482
18558
|
error: new Error(
|
|
17483
|
-
`Invalid frontmatter in ${
|
|
18559
|
+
`Invalid frontmatter in ${join114(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17484
18560
|
)
|
|
17485
18561
|
};
|
|
17486
18562
|
}
|
|
@@ -17498,7 +18574,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17498
18574
|
global = false
|
|
17499
18575
|
}) {
|
|
17500
18576
|
const paths = this.getSettablePaths({ global });
|
|
17501
|
-
const filePath =
|
|
18577
|
+
const filePath = join114(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17502
18578
|
const fileContent = await readFileContent(filePath);
|
|
17503
18579
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17504
18580
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17534,12 +18610,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17534
18610
|
};
|
|
17535
18611
|
|
|
17536
18612
|
// src/features/subagents/deepagents-subagent.ts
|
|
17537
|
-
import { join as
|
|
17538
|
-
import { z as
|
|
17539
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
17540
|
-
name:
|
|
17541
|
-
description:
|
|
17542
|
-
model:
|
|
18613
|
+
import { join as join115 } from "path";
|
|
18614
|
+
import { z as z68 } from "zod/mini";
|
|
18615
|
+
var DeepagentsSubagentFrontmatterSchema = z68.looseObject({
|
|
18616
|
+
name: z68.string(),
|
|
18617
|
+
description: z68.optional(z68.string()),
|
|
18618
|
+
model: z68.optional(z68.string())
|
|
17543
18619
|
});
|
|
17544
18620
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
17545
18621
|
frontmatter;
|
|
@@ -17549,7 +18625,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17549
18625
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17550
18626
|
if (!result.success) {
|
|
17551
18627
|
throw new Error(
|
|
17552
|
-
`Invalid frontmatter in ${
|
|
18628
|
+
`Invalid frontmatter in ${join115(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17553
18629
|
);
|
|
17554
18630
|
}
|
|
17555
18631
|
}
|
|
@@ -17559,7 +18635,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17559
18635
|
}
|
|
17560
18636
|
static getSettablePaths(_options = {}) {
|
|
17561
18637
|
return {
|
|
17562
|
-
relativeDirPath:
|
|
18638
|
+
relativeDirPath: join115(".deepagents", "agents")
|
|
17563
18639
|
};
|
|
17564
18640
|
}
|
|
17565
18641
|
getFrontmatter() {
|
|
@@ -17634,7 +18710,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17634
18710
|
return {
|
|
17635
18711
|
success: false,
|
|
17636
18712
|
error: new Error(
|
|
17637
|
-
`Invalid frontmatter in ${
|
|
18713
|
+
`Invalid frontmatter in ${join115(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17638
18714
|
)
|
|
17639
18715
|
};
|
|
17640
18716
|
}
|
|
@@ -17652,7 +18728,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17652
18728
|
global = false
|
|
17653
18729
|
}) {
|
|
17654
18730
|
const paths = this.getSettablePaths({ global });
|
|
17655
|
-
const filePath =
|
|
18731
|
+
const filePath = join115(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17656
18732
|
const fileContent = await readFileContent(filePath);
|
|
17657
18733
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17658
18734
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17687,11 +18763,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17687
18763
|
};
|
|
17688
18764
|
|
|
17689
18765
|
// src/features/subagents/junie-subagent.ts
|
|
17690
|
-
import { join as
|
|
17691
|
-
import { z as
|
|
17692
|
-
var JunieSubagentFrontmatterSchema =
|
|
17693
|
-
name:
|
|
17694
|
-
description:
|
|
18766
|
+
import { join as join116 } from "path";
|
|
18767
|
+
import { z as z69 } from "zod/mini";
|
|
18768
|
+
var JunieSubagentFrontmatterSchema = z69.looseObject({
|
|
18769
|
+
name: z69.optional(z69.string()),
|
|
18770
|
+
description: z69.string()
|
|
17695
18771
|
});
|
|
17696
18772
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
17697
18773
|
frontmatter;
|
|
@@ -17701,7 +18777,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17701
18777
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17702
18778
|
if (!result.success) {
|
|
17703
18779
|
throw new Error(
|
|
17704
|
-
`Invalid frontmatter in ${
|
|
18780
|
+
`Invalid frontmatter in ${join116(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17705
18781
|
);
|
|
17706
18782
|
}
|
|
17707
18783
|
}
|
|
@@ -17716,7 +18792,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17716
18792
|
throw new Error("JunieSubagent does not support global mode.");
|
|
17717
18793
|
}
|
|
17718
18794
|
return {
|
|
17719
|
-
relativeDirPath:
|
|
18795
|
+
relativeDirPath: join116(".junie", "agents")
|
|
17720
18796
|
};
|
|
17721
18797
|
}
|
|
17722
18798
|
getFrontmatter() {
|
|
@@ -17792,7 +18868,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17792
18868
|
return {
|
|
17793
18869
|
success: false,
|
|
17794
18870
|
error: new Error(
|
|
17795
|
-
`Invalid frontmatter in ${
|
|
18871
|
+
`Invalid frontmatter in ${join116(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17796
18872
|
)
|
|
17797
18873
|
};
|
|
17798
18874
|
}
|
|
@@ -17810,7 +18886,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17810
18886
|
global = false
|
|
17811
18887
|
}) {
|
|
17812
18888
|
const paths = this.getSettablePaths({ global });
|
|
17813
|
-
const filePath =
|
|
18889
|
+
const filePath = join116(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17814
18890
|
const fileContent = await readFileContent(filePath);
|
|
17815
18891
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17816
18892
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17845,15 +18921,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17845
18921
|
};
|
|
17846
18922
|
|
|
17847
18923
|
// src/features/subagents/kilo-subagent.ts
|
|
17848
|
-
import { join as
|
|
18924
|
+
import { join as join118 } from "path";
|
|
17849
18925
|
|
|
17850
18926
|
// src/features/subagents/opencode-style-subagent.ts
|
|
17851
|
-
import { basename as basename8, join as
|
|
17852
|
-
import { z as
|
|
17853
|
-
var OpenCodeStyleSubagentFrontmatterSchema =
|
|
17854
|
-
description:
|
|
17855
|
-
mode:
|
|
17856
|
-
name:
|
|
18927
|
+
import { basename as basename8, join as join117 } from "path";
|
|
18928
|
+
import { z as z70 } from "zod/mini";
|
|
18929
|
+
var OpenCodeStyleSubagentFrontmatterSchema = z70.looseObject({
|
|
18930
|
+
description: z70.optional(z70.string()),
|
|
18931
|
+
mode: z70._default(z70.string(), "subagent"),
|
|
18932
|
+
name: z70.optional(z70.string())
|
|
17857
18933
|
});
|
|
17858
18934
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
17859
18935
|
frontmatter;
|
|
@@ -17863,7 +18939,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
17863
18939
|
const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17864
18940
|
if (!result.success) {
|
|
17865
18941
|
throw new Error(
|
|
17866
|
-
`Invalid frontmatter in ${
|
|
18942
|
+
`Invalid frontmatter in ${join117(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17867
18943
|
);
|
|
17868
18944
|
}
|
|
17869
18945
|
}
|
|
@@ -17905,7 +18981,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
17905
18981
|
return {
|
|
17906
18982
|
success: false,
|
|
17907
18983
|
error: new Error(
|
|
17908
|
-
`Invalid frontmatter in ${
|
|
18984
|
+
`Invalid frontmatter in ${join117(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17909
18985
|
)
|
|
17910
18986
|
};
|
|
17911
18987
|
}
|
|
@@ -17921,7 +18997,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
17921
18997
|
global = false
|
|
17922
18998
|
} = {}) {
|
|
17923
18999
|
return {
|
|
17924
|
-
relativeDirPath: global ?
|
|
19000
|
+
relativeDirPath: global ? join118(".config", "kilo", "agent") : join118(".kilo", "agent")
|
|
17925
19001
|
};
|
|
17926
19002
|
}
|
|
17927
19003
|
static fromRulesyncSubagent({
|
|
@@ -17965,7 +19041,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
17965
19041
|
global = false
|
|
17966
19042
|
}) {
|
|
17967
19043
|
const paths = this.getSettablePaths({ global });
|
|
17968
|
-
const filePath =
|
|
19044
|
+
const filePath = join118(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17969
19045
|
const fileContent = await readFileContent(filePath);
|
|
17970
19046
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17971
19047
|
const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -18001,23 +19077,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
18001
19077
|
};
|
|
18002
19078
|
|
|
18003
19079
|
// src/features/subagents/kiro-subagent.ts
|
|
18004
|
-
import { join as
|
|
18005
|
-
import { z as
|
|
18006
|
-
var KiroCliSubagentJsonSchema =
|
|
18007
|
-
name:
|
|
18008
|
-
description:
|
|
18009
|
-
prompt:
|
|
18010
|
-
tools:
|
|
18011
|
-
toolAliases:
|
|
18012
|
-
toolSettings:
|
|
18013
|
-
toolSchema:
|
|
18014
|
-
hooks:
|
|
18015
|
-
model:
|
|
18016
|
-
mcpServers:
|
|
18017
|
-
useLegacyMcpJson:
|
|
18018
|
-
resources:
|
|
18019
|
-
allowedTools:
|
|
18020
|
-
includeMcpJson:
|
|
19080
|
+
import { join as join119 } from "path";
|
|
19081
|
+
import { z as z71 } from "zod/mini";
|
|
19082
|
+
var KiroCliSubagentJsonSchema = z71.looseObject({
|
|
19083
|
+
name: z71.string(),
|
|
19084
|
+
description: z71.optional(z71.nullable(z71.string())),
|
|
19085
|
+
prompt: z71.optional(z71.nullable(z71.string())),
|
|
19086
|
+
tools: z71.optional(z71.nullable(z71.array(z71.string()))),
|
|
19087
|
+
toolAliases: z71.optional(z71.nullable(z71.record(z71.string(), z71.string()))),
|
|
19088
|
+
toolSettings: z71.optional(z71.nullable(z71.unknown())),
|
|
19089
|
+
toolSchema: z71.optional(z71.nullable(z71.unknown())),
|
|
19090
|
+
hooks: z71.optional(z71.nullable(z71.record(z71.string(), z71.array(z71.unknown())))),
|
|
19091
|
+
model: z71.optional(z71.nullable(z71.string())),
|
|
19092
|
+
mcpServers: z71.optional(z71.nullable(z71.record(z71.string(), z71.unknown()))),
|
|
19093
|
+
useLegacyMcpJson: z71.optional(z71.nullable(z71.boolean())),
|
|
19094
|
+
resources: z71.optional(z71.nullable(z71.array(z71.string()))),
|
|
19095
|
+
allowedTools: z71.optional(z71.nullable(z71.array(z71.string()))),
|
|
19096
|
+
includeMcpJson: z71.optional(z71.nullable(z71.boolean()))
|
|
18021
19097
|
});
|
|
18022
19098
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
18023
19099
|
body;
|
|
@@ -18028,7 +19104,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18028
19104
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
18029
19105
|
} catch (error) {
|
|
18030
19106
|
throw new Error(
|
|
18031
|
-
`Invalid JSON in ${
|
|
19107
|
+
`Invalid JSON in ${join119(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
18032
19108
|
{ cause: error }
|
|
18033
19109
|
);
|
|
18034
19110
|
}
|
|
@@ -18040,7 +19116,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18040
19116
|
}
|
|
18041
19117
|
static getSettablePaths(_options = {}) {
|
|
18042
19118
|
return {
|
|
18043
|
-
relativeDirPath:
|
|
19119
|
+
relativeDirPath: join119(".kiro", "agents")
|
|
18044
19120
|
};
|
|
18045
19121
|
}
|
|
18046
19122
|
getBody() {
|
|
@@ -18052,7 +19128,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18052
19128
|
parsed = JSON.parse(this.body);
|
|
18053
19129
|
} catch (error) {
|
|
18054
19130
|
throw new Error(
|
|
18055
|
-
`Failed to parse JSON in ${
|
|
19131
|
+
`Failed to parse JSON in ${join119(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
18056
19132
|
{ cause: error }
|
|
18057
19133
|
);
|
|
18058
19134
|
}
|
|
@@ -18133,7 +19209,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18133
19209
|
global = false
|
|
18134
19210
|
}) {
|
|
18135
19211
|
const paths = this.getSettablePaths({ global });
|
|
18136
|
-
const filePath =
|
|
19212
|
+
const filePath = join119(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
18137
19213
|
const fileContent = await readFileContent(filePath);
|
|
18138
19214
|
const subagent = new _KiroSubagent({
|
|
18139
19215
|
outputRoot,
|
|
@@ -18171,7 +19247,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18171
19247
|
};
|
|
18172
19248
|
|
|
18173
19249
|
// src/features/subagents/opencode-subagent.ts
|
|
18174
|
-
import { join as
|
|
19250
|
+
import { join as join120 } from "path";
|
|
18175
19251
|
var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
|
|
18176
19252
|
var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
18177
19253
|
getToolTarget() {
|
|
@@ -18181,7 +19257,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
18181
19257
|
global = false
|
|
18182
19258
|
} = {}) {
|
|
18183
19259
|
return {
|
|
18184
|
-
relativeDirPath: global ?
|
|
19260
|
+
relativeDirPath: global ? join120(".config", "opencode", "agent") : join120(".opencode", "agent")
|
|
18185
19261
|
};
|
|
18186
19262
|
}
|
|
18187
19263
|
static fromRulesyncSubagent({
|
|
@@ -18225,7 +19301,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
18225
19301
|
global = false
|
|
18226
19302
|
}) {
|
|
18227
19303
|
const paths = this.getSettablePaths({ global });
|
|
18228
|
-
const filePath =
|
|
19304
|
+
const filePath = join120(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
18229
19305
|
const fileContent = await readFileContent(filePath);
|
|
18230
19306
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
18231
19307
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -18261,7 +19337,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
18261
19337
|
};
|
|
18262
19338
|
|
|
18263
19339
|
// src/features/subagents/takt-subagent.ts
|
|
18264
|
-
import { join as
|
|
19340
|
+
import { join as join121 } from "path";
|
|
18265
19341
|
var DEFAULT_TAKT_SUBAGENT_DIR = "personas";
|
|
18266
19342
|
var TaktSubagent = class _TaktSubagent extends ToolSubagent {
|
|
18267
19343
|
body;
|
|
@@ -18273,7 +19349,7 @@ var TaktSubagent = class _TaktSubagent extends ToolSubagent {
|
|
|
18273
19349
|
}
|
|
18274
19350
|
static getSettablePaths(_options = {}) {
|
|
18275
19351
|
return {
|
|
18276
|
-
relativeDirPath:
|
|
19352
|
+
relativeDirPath: join121(".takt", "facets", DEFAULT_TAKT_SUBAGENT_DIR)
|
|
18277
19353
|
};
|
|
18278
19354
|
}
|
|
18279
19355
|
getBody() {
|
|
@@ -18335,7 +19411,7 @@ var TaktSubagent = class _TaktSubagent extends ToolSubagent {
|
|
|
18335
19411
|
global = false
|
|
18336
19412
|
}) {
|
|
18337
19413
|
const paths = this.getSettablePaths({ global });
|
|
18338
|
-
const filePath =
|
|
19414
|
+
const filePath = join121(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
18339
19415
|
const fileContent = await readFileContent(filePath);
|
|
18340
19416
|
const { body } = parseFrontmatter(fileContent, filePath);
|
|
18341
19417
|
return new _TaktSubagent({
|
|
@@ -18383,7 +19459,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
18383
19459
|
"rovodev",
|
|
18384
19460
|
"takt"
|
|
18385
19461
|
];
|
|
18386
|
-
var SubagentsProcessorToolTargetSchema =
|
|
19462
|
+
var SubagentsProcessorToolTargetSchema = z72.enum(subagentsProcessorToolTargetTuple);
|
|
18387
19463
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
18388
19464
|
[
|
|
18389
19465
|
"agentsmd",
|
|
@@ -18592,7 +19668,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18592
19668
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
18593
19669
|
*/
|
|
18594
19670
|
async loadRulesyncFiles() {
|
|
18595
|
-
const subagentsDir =
|
|
19671
|
+
const subagentsDir = join122(this.inputRoot, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
18596
19672
|
const dirExists = await directoryExists(subagentsDir);
|
|
18597
19673
|
if (!dirExists) {
|
|
18598
19674
|
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -18607,7 +19683,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18607
19683
|
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
18608
19684
|
const rulesyncSubagents = [];
|
|
18609
19685
|
for (const mdFile of mdFiles) {
|
|
18610
|
-
const filepath =
|
|
19686
|
+
const filepath = join122(subagentsDir, mdFile);
|
|
18611
19687
|
try {
|
|
18612
19688
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
18613
19689
|
outputRoot: this.inputRoot,
|
|
@@ -18638,7 +19714,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18638
19714
|
const factory = this.getFactory(this.toolTarget);
|
|
18639
19715
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
18640
19716
|
const subagentFilePaths = await findFilesByGlobs(
|
|
18641
|
-
|
|
19717
|
+
join122(this.outputRoot, paths.relativeDirPath, factory.meta.filePattern)
|
|
18642
19718
|
);
|
|
18643
19719
|
if (forDeletion) {
|
|
18644
19720
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -18705,55 +19781,55 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18705
19781
|
};
|
|
18706
19782
|
|
|
18707
19783
|
// src/features/rules/agentsmd-rule.ts
|
|
18708
|
-
import { join as
|
|
19784
|
+
import { join as join125 } from "path";
|
|
18709
19785
|
|
|
18710
19786
|
// src/features/rules/tool-rule.ts
|
|
18711
|
-
import { join as
|
|
19787
|
+
import { join as join124 } from "path";
|
|
18712
19788
|
|
|
18713
19789
|
// src/features/rules/rulesync-rule.ts
|
|
18714
|
-
import { join as
|
|
18715
|
-
import { z as
|
|
18716
|
-
var RulesyncRuleFrontmatterSchema =
|
|
18717
|
-
root:
|
|
18718
|
-
localRoot:
|
|
18719
|
-
targets:
|
|
18720
|
-
description:
|
|
18721
|
-
globs:
|
|
18722
|
-
agentsmd:
|
|
18723
|
-
|
|
19790
|
+
import { join as join123 } from "path";
|
|
19791
|
+
import { z as z73 } from "zod/mini";
|
|
19792
|
+
var RulesyncRuleFrontmatterSchema = z73.object({
|
|
19793
|
+
root: z73.optional(z73.boolean()),
|
|
19794
|
+
localRoot: z73.optional(z73.boolean()),
|
|
19795
|
+
targets: z73._default(RulesyncTargetsSchema, ["*"]),
|
|
19796
|
+
description: z73.optional(z73.string()),
|
|
19797
|
+
globs: z73.optional(z73.array(z73.string())),
|
|
19798
|
+
agentsmd: z73.optional(
|
|
19799
|
+
z73.looseObject({
|
|
18724
19800
|
// @example "path/to/subproject"
|
|
18725
|
-
subprojectPath:
|
|
19801
|
+
subprojectPath: z73.optional(z73.string())
|
|
18726
19802
|
})
|
|
18727
19803
|
),
|
|
18728
|
-
claudecode:
|
|
18729
|
-
|
|
19804
|
+
claudecode: z73.optional(
|
|
19805
|
+
z73.looseObject({
|
|
18730
19806
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
18731
19807
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
18732
|
-
paths:
|
|
19808
|
+
paths: z73.optional(z73.array(z73.string()))
|
|
18733
19809
|
})
|
|
18734
19810
|
),
|
|
18735
|
-
cursor:
|
|
18736
|
-
|
|
18737
|
-
alwaysApply:
|
|
18738
|
-
description:
|
|
18739
|
-
globs:
|
|
19811
|
+
cursor: z73.optional(
|
|
19812
|
+
z73.looseObject({
|
|
19813
|
+
alwaysApply: z73.optional(z73.boolean()),
|
|
19814
|
+
description: z73.optional(z73.string()),
|
|
19815
|
+
globs: z73.optional(z73.array(z73.string()))
|
|
18740
19816
|
})
|
|
18741
19817
|
),
|
|
18742
|
-
copilot:
|
|
18743
|
-
|
|
18744
|
-
excludeAgent:
|
|
19818
|
+
copilot: z73.optional(
|
|
19819
|
+
z73.looseObject({
|
|
19820
|
+
excludeAgent: z73.optional(z73.union([z73.literal("code-review"), z73.literal("coding-agent")]))
|
|
18745
19821
|
})
|
|
18746
19822
|
),
|
|
18747
|
-
antigravity:
|
|
18748
|
-
|
|
18749
|
-
trigger:
|
|
18750
|
-
globs:
|
|
19823
|
+
antigravity: z73.optional(
|
|
19824
|
+
z73.looseObject({
|
|
19825
|
+
trigger: z73.optional(z73.string()),
|
|
19826
|
+
globs: z73.optional(z73.array(z73.string()))
|
|
18751
19827
|
})
|
|
18752
19828
|
),
|
|
18753
|
-
takt:
|
|
18754
|
-
|
|
19829
|
+
takt: z73.optional(
|
|
19830
|
+
z73.looseObject({
|
|
18755
19831
|
// Rename the emitted file stem (e.g. "coder.md" → "{name}.md").
|
|
18756
|
-
name:
|
|
19832
|
+
name: z73.optional(z73.string())
|
|
18757
19833
|
})
|
|
18758
19834
|
)
|
|
18759
19835
|
});
|
|
@@ -18764,7 +19840,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
18764
19840
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
18765
19841
|
if (!parseResult.success && rest.validate !== false) {
|
|
18766
19842
|
throw new Error(
|
|
18767
|
-
`Invalid frontmatter in ${
|
|
19843
|
+
`Invalid frontmatter in ${join123(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
18768
19844
|
);
|
|
18769
19845
|
}
|
|
18770
19846
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -18799,7 +19875,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
18799
19875
|
return {
|
|
18800
19876
|
success: false,
|
|
18801
19877
|
error: new Error(
|
|
18802
|
-
`Invalid frontmatter in ${
|
|
19878
|
+
`Invalid frontmatter in ${join123(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
18803
19879
|
)
|
|
18804
19880
|
};
|
|
18805
19881
|
}
|
|
@@ -18809,7 +19885,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
18809
19885
|
relativeFilePath,
|
|
18810
19886
|
validate = true
|
|
18811
19887
|
}) {
|
|
18812
|
-
const filePath =
|
|
19888
|
+
const filePath = join123(
|
|
18813
19889
|
outputRoot,
|
|
18814
19890
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
18815
19891
|
relativeFilePath
|
|
@@ -18908,7 +19984,7 @@ var ToolRule = class extends ToolFile {
|
|
|
18908
19984
|
rulesyncRule,
|
|
18909
19985
|
validate = true,
|
|
18910
19986
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
18911
|
-
nonRootPath = { relativeDirPath:
|
|
19987
|
+
nonRootPath = { relativeDirPath: join124(".agents", "memories") }
|
|
18912
19988
|
}) {
|
|
18913
19989
|
const params = this.buildToolRuleParamsDefault({
|
|
18914
19990
|
outputRoot,
|
|
@@ -18919,7 +19995,7 @@ var ToolRule = class extends ToolFile {
|
|
|
18919
19995
|
});
|
|
18920
19996
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
18921
19997
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
18922
|
-
params.relativeDirPath =
|
|
19998
|
+
params.relativeDirPath = join124(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
18923
19999
|
params.relativeFilePath = "AGENTS.md";
|
|
18924
20000
|
}
|
|
18925
20001
|
return params;
|
|
@@ -18968,7 +20044,7 @@ var ToolRule = class extends ToolFile {
|
|
|
18968
20044
|
}
|
|
18969
20045
|
};
|
|
18970
20046
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
18971
|
-
return excludeToolDir ? subDir :
|
|
20047
|
+
return excludeToolDir ? subDir : join124(toolDir, subDir);
|
|
18972
20048
|
}
|
|
18973
20049
|
|
|
18974
20050
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -18997,8 +20073,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
18997
20073
|
validate = true
|
|
18998
20074
|
}) {
|
|
18999
20075
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
19000
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
19001
|
-
const fileContent = await readFileContent(
|
|
20076
|
+
const relativePath = isRoot ? "AGENTS.md" : join125(".agents", "memories", relativeFilePath);
|
|
20077
|
+
const fileContent = await readFileContent(join125(outputRoot, relativePath));
|
|
19002
20078
|
return new _AgentsMdRule({
|
|
19003
20079
|
outputRoot,
|
|
19004
20080
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -19053,21 +20129,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
19053
20129
|
};
|
|
19054
20130
|
|
|
19055
20131
|
// src/features/rules/antigravity-rule.ts
|
|
19056
|
-
import { join as
|
|
19057
|
-
import { z as
|
|
19058
|
-
var AntigravityRuleFrontmatterSchema =
|
|
19059
|
-
trigger:
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
20132
|
+
import { join as join126 } from "path";
|
|
20133
|
+
import { z as z74 } from "zod/mini";
|
|
20134
|
+
var AntigravityRuleFrontmatterSchema = z74.looseObject({
|
|
20135
|
+
trigger: z74.optional(
|
|
20136
|
+
z74.union([
|
|
20137
|
+
z74.literal("always_on"),
|
|
20138
|
+
z74.literal("glob"),
|
|
20139
|
+
z74.literal("manual"),
|
|
20140
|
+
z74.literal("model_decision"),
|
|
20141
|
+
z74.string()
|
|
19066
20142
|
// accepts any string for forward compatibility
|
|
19067
20143
|
])
|
|
19068
20144
|
),
|
|
19069
|
-
globs:
|
|
19070
|
-
description:
|
|
20145
|
+
globs: z74.optional(z74.string()),
|
|
20146
|
+
description: z74.optional(z74.string())
|
|
19071
20147
|
});
|
|
19072
20148
|
function parseGlobsString(globs) {
|
|
19073
20149
|
if (!globs) {
|
|
@@ -19212,7 +20288,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
19212
20288
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
19213
20289
|
if (!result.success) {
|
|
19214
20290
|
throw new Error(
|
|
19215
|
-
`Invalid frontmatter in ${
|
|
20291
|
+
`Invalid frontmatter in ${join126(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
19216
20292
|
);
|
|
19217
20293
|
}
|
|
19218
20294
|
}
|
|
@@ -19236,7 +20312,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
19236
20312
|
relativeFilePath,
|
|
19237
20313
|
validate = true
|
|
19238
20314
|
}) {
|
|
19239
|
-
const filePath =
|
|
20315
|
+
const filePath = join126(
|
|
19240
20316
|
outputRoot,
|
|
19241
20317
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
19242
20318
|
relativeFilePath
|
|
@@ -19376,7 +20452,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
19376
20452
|
};
|
|
19377
20453
|
|
|
19378
20454
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
19379
|
-
import { join as
|
|
20455
|
+
import { join as join127 } from "path";
|
|
19380
20456
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
19381
20457
|
toRulesyncRule() {
|
|
19382
20458
|
const rulesyncFrontmatter = {
|
|
@@ -19436,8 +20512,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
19436
20512
|
}) {
|
|
19437
20513
|
const settablePaths = this.getSettablePaths();
|
|
19438
20514
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
19439
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
19440
|
-
const fileContent = await readFileContent(
|
|
20515
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join127(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
20516
|
+
const fileContent = await readFileContent(join127(outputRoot, relativePath));
|
|
19441
20517
|
return new _AugmentcodeLegacyRule({
|
|
19442
20518
|
outputRoot,
|
|
19443
20519
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -19466,7 +20542,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
19466
20542
|
};
|
|
19467
20543
|
|
|
19468
20544
|
// src/features/rules/augmentcode-rule.ts
|
|
19469
|
-
import { join as
|
|
20545
|
+
import { join as join128 } from "path";
|
|
19470
20546
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
19471
20547
|
toRulesyncRule() {
|
|
19472
20548
|
return this.toRulesyncRuleDefault();
|
|
@@ -19497,7 +20573,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
19497
20573
|
relativeFilePath,
|
|
19498
20574
|
validate = true
|
|
19499
20575
|
}) {
|
|
19500
|
-
const filePath =
|
|
20576
|
+
const filePath = join128(
|
|
19501
20577
|
outputRoot,
|
|
19502
20578
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
19503
20579
|
relativeFilePath
|
|
@@ -19537,7 +20613,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
19537
20613
|
};
|
|
19538
20614
|
|
|
19539
20615
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
19540
|
-
import { join as
|
|
20616
|
+
import { join as join129 } from "path";
|
|
19541
20617
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
19542
20618
|
static getSettablePaths({
|
|
19543
20619
|
global,
|
|
@@ -19579,7 +20655,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
19579
20655
|
if (isRoot) {
|
|
19580
20656
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
19581
20657
|
const fileContent2 = await readFileContent(
|
|
19582
|
-
|
|
20658
|
+
join129(outputRoot, rootDirPath, paths.root.relativeFilePath)
|
|
19583
20659
|
);
|
|
19584
20660
|
return new _ClaudecodeLegacyRule({
|
|
19585
20661
|
outputRoot,
|
|
@@ -19593,8 +20669,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
19593
20669
|
if (!paths.nonRoot) {
|
|
19594
20670
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
19595
20671
|
}
|
|
19596
|
-
const relativePath =
|
|
19597
|
-
const fileContent = await readFileContent(
|
|
20672
|
+
const relativePath = join129(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
20673
|
+
const fileContent = await readFileContent(join129(outputRoot, relativePath));
|
|
19598
20674
|
return new _ClaudecodeLegacyRule({
|
|
19599
20675
|
outputRoot,
|
|
19600
20676
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -19653,10 +20729,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
19653
20729
|
};
|
|
19654
20730
|
|
|
19655
20731
|
// src/features/rules/claudecode-rule.ts
|
|
19656
|
-
import { join as
|
|
19657
|
-
import { z as
|
|
19658
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
19659
|
-
paths:
|
|
20732
|
+
import { join as join130 } from "path";
|
|
20733
|
+
import { z as z75 } from "zod/mini";
|
|
20734
|
+
var ClaudecodeRuleFrontmatterSchema = z75.object({
|
|
20735
|
+
paths: z75.optional(z75.array(z75.string()))
|
|
19660
20736
|
});
|
|
19661
20737
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
19662
20738
|
frontmatter;
|
|
@@ -19694,7 +20770,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19694
20770
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
19695
20771
|
if (!result.success) {
|
|
19696
20772
|
throw new Error(
|
|
19697
|
-
`Invalid frontmatter in ${
|
|
20773
|
+
`Invalid frontmatter in ${join130(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
19698
20774
|
);
|
|
19699
20775
|
}
|
|
19700
20776
|
}
|
|
@@ -19724,7 +20800,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19724
20800
|
if (isRoot) {
|
|
19725
20801
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
19726
20802
|
const fileContent2 = await readFileContent(
|
|
19727
|
-
|
|
20803
|
+
join130(outputRoot, rootDirPath, paths.root.relativeFilePath)
|
|
19728
20804
|
);
|
|
19729
20805
|
return new _ClaudecodeRule({
|
|
19730
20806
|
outputRoot,
|
|
@@ -19739,8 +20815,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19739
20815
|
if (!paths.nonRoot) {
|
|
19740
20816
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
19741
20817
|
}
|
|
19742
|
-
const relativePath =
|
|
19743
|
-
const filePath =
|
|
20818
|
+
const relativePath = join130(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
20819
|
+
const filePath = join130(outputRoot, relativePath);
|
|
19744
20820
|
const fileContent = await readFileContent(filePath);
|
|
19745
20821
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
19746
20822
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -19851,7 +20927,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19851
20927
|
return {
|
|
19852
20928
|
success: false,
|
|
19853
20929
|
error: new Error(
|
|
19854
|
-
`Invalid frontmatter in ${
|
|
20930
|
+
`Invalid frontmatter in ${join130(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
19855
20931
|
)
|
|
19856
20932
|
};
|
|
19857
20933
|
}
|
|
@@ -19871,10 +20947,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19871
20947
|
};
|
|
19872
20948
|
|
|
19873
20949
|
// src/features/rules/cline-rule.ts
|
|
19874
|
-
import { join as
|
|
19875
|
-
import { z as
|
|
19876
|
-
var ClineRuleFrontmatterSchema =
|
|
19877
|
-
description:
|
|
20950
|
+
import { join as join131 } from "path";
|
|
20951
|
+
import { z as z76 } from "zod/mini";
|
|
20952
|
+
var ClineRuleFrontmatterSchema = z76.object({
|
|
20953
|
+
description: z76.string()
|
|
19878
20954
|
});
|
|
19879
20955
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
19880
20956
|
static getSettablePaths(_options = {}) {
|
|
@@ -19917,7 +20993,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
19917
20993
|
validate = true
|
|
19918
20994
|
}) {
|
|
19919
20995
|
const fileContent = await readFileContent(
|
|
19920
|
-
|
|
20996
|
+
join131(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
19921
20997
|
);
|
|
19922
20998
|
return new _ClineRule({
|
|
19923
20999
|
outputRoot,
|
|
@@ -19943,7 +21019,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
19943
21019
|
};
|
|
19944
21020
|
|
|
19945
21021
|
// src/features/rules/codexcli-rule.ts
|
|
19946
|
-
import { join as
|
|
21022
|
+
import { join as join132 } from "path";
|
|
19947
21023
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
19948
21024
|
static getSettablePaths({
|
|
19949
21025
|
global,
|
|
@@ -19978,7 +21054,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
19978
21054
|
if (isRoot) {
|
|
19979
21055
|
const relativePath2 = paths.root.relativeFilePath;
|
|
19980
21056
|
const fileContent2 = await readFileContent(
|
|
19981
|
-
|
|
21057
|
+
join132(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
19982
21058
|
);
|
|
19983
21059
|
return new _CodexcliRule({
|
|
19984
21060
|
outputRoot,
|
|
@@ -19992,8 +21068,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
19992
21068
|
if (!paths.nonRoot) {
|
|
19993
21069
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
19994
21070
|
}
|
|
19995
|
-
const relativePath =
|
|
19996
|
-
const fileContent = await readFileContent(
|
|
21071
|
+
const relativePath = join132(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21072
|
+
const fileContent = await readFileContent(join132(outputRoot, relativePath));
|
|
19997
21073
|
return new _CodexcliRule({
|
|
19998
21074
|
outputRoot,
|
|
19999
21075
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20052,13 +21128,15 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
20052
21128
|
};
|
|
20053
21129
|
|
|
20054
21130
|
// src/features/rules/copilot-rule.ts
|
|
20055
|
-
import { join as
|
|
20056
|
-
import { z as
|
|
20057
|
-
var CopilotRuleFrontmatterSchema =
|
|
20058
|
-
description:
|
|
20059
|
-
applyTo:
|
|
20060
|
-
excludeAgent:
|
|
21131
|
+
import { join as join133 } from "path";
|
|
21132
|
+
import { z as z77 } from "zod/mini";
|
|
21133
|
+
var CopilotRuleFrontmatterSchema = z77.object({
|
|
21134
|
+
description: z77.optional(z77.string()),
|
|
21135
|
+
applyTo: z77.optional(z77.string()),
|
|
21136
|
+
excludeAgent: z77.optional(z77.union([z77.literal("code-review"), z77.literal("coding-agent")]))
|
|
20061
21137
|
});
|
|
21138
|
+
var normalizeRelativePath = (path4) => path4.replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
21139
|
+
var sameRelativePath = (leftDir, leftFile, rightDir, rightFile) => normalizeRelativePath(join133(leftDir, leftFile)) === normalizeRelativePath(join133(rightDir, rightFile));
|
|
20062
21140
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
20063
21141
|
frontmatter;
|
|
20064
21142
|
body;
|
|
@@ -20089,7 +21167,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20089
21167
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
20090
21168
|
if (!result.success) {
|
|
20091
21169
|
throw new Error(
|
|
20092
|
-
`Invalid frontmatter in ${
|
|
21170
|
+
`Invalid frontmatter in ${join133(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
20093
21171
|
);
|
|
20094
21172
|
}
|
|
20095
21173
|
}
|
|
@@ -20176,11 +21254,16 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20176
21254
|
global = false
|
|
20177
21255
|
}) {
|
|
20178
21256
|
const paths = this.getSettablePaths({ global });
|
|
20179
|
-
const isRoot = relativeDirPath ?
|
|
21257
|
+
const isRoot = relativeDirPath ? sameRelativePath(
|
|
21258
|
+
relativeDirPath,
|
|
21259
|
+
relativeFilePath,
|
|
21260
|
+
paths.root.relativeDirPath,
|
|
21261
|
+
paths.root.relativeFilePath
|
|
21262
|
+
) : relativeFilePath === paths.root.relativeFilePath;
|
|
20180
21263
|
const resolvedRelativeDirPath = relativeDirPath ?? (isRoot ? paths.root.relativeDirPath : paths.nonRoot?.relativeDirPath ?? paths.root.relativeDirPath);
|
|
20181
21264
|
if (isRoot) {
|
|
20182
|
-
const relativePath2 =
|
|
20183
|
-
const filePath2 =
|
|
21265
|
+
const relativePath2 = join133(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
21266
|
+
const filePath2 = join133(outputRoot, relativePath2);
|
|
20184
21267
|
const fileContent2 = await readFileContent(filePath2);
|
|
20185
21268
|
return new _CopilotRule({
|
|
20186
21269
|
outputRoot,
|
|
@@ -20195,8 +21278,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20195
21278
|
if (!paths.nonRoot) {
|
|
20196
21279
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20197
21280
|
}
|
|
20198
|
-
const relativePath =
|
|
20199
|
-
const filePath =
|
|
21281
|
+
const relativePath = join133(resolvedRelativeDirPath, relativeFilePath);
|
|
21282
|
+
const filePath = join133(outputRoot, relativePath);
|
|
20200
21283
|
const fileContent = await readFileContent(filePath);
|
|
20201
21284
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
20202
21285
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -20220,7 +21303,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20220
21303
|
global = false
|
|
20221
21304
|
}) {
|
|
20222
21305
|
const paths = this.getSettablePaths({ global });
|
|
20223
|
-
const isRoot =
|
|
21306
|
+
const isRoot = sameRelativePath(
|
|
21307
|
+
relativeDirPath,
|
|
21308
|
+
relativeFilePath,
|
|
21309
|
+
paths.root.relativeDirPath,
|
|
21310
|
+
paths.root.relativeFilePath
|
|
21311
|
+
);
|
|
20224
21312
|
return new _CopilotRule({
|
|
20225
21313
|
outputRoot,
|
|
20226
21314
|
relativeDirPath,
|
|
@@ -20242,7 +21330,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20242
21330
|
return {
|
|
20243
21331
|
success: false,
|
|
20244
21332
|
error: new Error(
|
|
20245
|
-
`Invalid frontmatter in ${
|
|
21333
|
+
`Invalid frontmatter in ${join133(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
20246
21334
|
)
|
|
20247
21335
|
};
|
|
20248
21336
|
}
|
|
@@ -20298,12 +21386,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
20298
21386
|
};
|
|
20299
21387
|
|
|
20300
21388
|
// src/features/rules/cursor-rule.ts
|
|
20301
|
-
import { join as
|
|
20302
|
-
import { z as
|
|
20303
|
-
var CursorRuleFrontmatterSchema =
|
|
20304
|
-
description:
|
|
20305
|
-
globs:
|
|
20306
|
-
alwaysApply:
|
|
21389
|
+
import { join as join134 } from "path";
|
|
21390
|
+
import { z as z78 } from "zod/mini";
|
|
21391
|
+
var CursorRuleFrontmatterSchema = z78.object({
|
|
21392
|
+
description: z78.optional(z78.string()),
|
|
21393
|
+
globs: z78.optional(z78.string()),
|
|
21394
|
+
alwaysApply: z78.optional(z78.boolean())
|
|
20307
21395
|
});
|
|
20308
21396
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
20309
21397
|
frontmatter;
|
|
@@ -20320,7 +21408,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20320
21408
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
20321
21409
|
if (!result.success) {
|
|
20322
21410
|
throw new Error(
|
|
20323
|
-
`Invalid frontmatter in ${
|
|
21411
|
+
`Invalid frontmatter in ${join134(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
20324
21412
|
);
|
|
20325
21413
|
}
|
|
20326
21414
|
}
|
|
@@ -20436,7 +21524,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20436
21524
|
relativeFilePath,
|
|
20437
21525
|
validate = true
|
|
20438
21526
|
}) {
|
|
20439
|
-
const filePath =
|
|
21527
|
+
const filePath = join134(
|
|
20440
21528
|
outputRoot,
|
|
20441
21529
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
20442
21530
|
relativeFilePath
|
|
@@ -20446,7 +21534,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20446
21534
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
20447
21535
|
if (!result.success) {
|
|
20448
21536
|
throw new Error(
|
|
20449
|
-
`Invalid frontmatter in ${
|
|
21537
|
+
`Invalid frontmatter in ${join134(outputRoot, relativeFilePath)}: ${formatError(result.error)}`
|
|
20450
21538
|
);
|
|
20451
21539
|
}
|
|
20452
21540
|
return new _CursorRule({
|
|
@@ -20483,7 +21571,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20483
21571
|
return {
|
|
20484
21572
|
success: false,
|
|
20485
21573
|
error: new Error(
|
|
20486
|
-
`Invalid frontmatter in ${
|
|
21574
|
+
`Invalid frontmatter in ${join134(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
20487
21575
|
)
|
|
20488
21576
|
};
|
|
20489
21577
|
}
|
|
@@ -20503,7 +21591,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20503
21591
|
};
|
|
20504
21592
|
|
|
20505
21593
|
// src/features/rules/deepagents-rule.ts
|
|
20506
|
-
import { join as
|
|
21594
|
+
import { join as join135 } from "path";
|
|
20507
21595
|
var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
20508
21596
|
constructor({ fileContent, root, ...rest }) {
|
|
20509
21597
|
super({
|
|
@@ -20530,8 +21618,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
20530
21618
|
}) {
|
|
20531
21619
|
const settablePaths = this.getSettablePaths();
|
|
20532
21620
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
20533
|
-
const relativePath = isRoot ?
|
|
20534
|
-
const fileContent = await readFileContent(
|
|
21621
|
+
const relativePath = isRoot ? join135(".deepagents", "AGENTS.md") : join135(".deepagents", "memories", relativeFilePath);
|
|
21622
|
+
const fileContent = await readFileContent(join135(outputRoot, relativePath));
|
|
20535
21623
|
return new _DeepagentsRule({
|
|
20536
21624
|
outputRoot,
|
|
20537
21625
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -20586,7 +21674,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
20586
21674
|
};
|
|
20587
21675
|
|
|
20588
21676
|
// src/features/rules/factorydroid-rule.ts
|
|
20589
|
-
import { join as
|
|
21677
|
+
import { join as join136 } from "path";
|
|
20590
21678
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
20591
21679
|
constructor({ fileContent, root, ...rest }) {
|
|
20592
21680
|
super({
|
|
@@ -20626,8 +21714,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
20626
21714
|
const paths = this.getSettablePaths({ global });
|
|
20627
21715
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
20628
21716
|
if (isRoot) {
|
|
20629
|
-
const relativePath2 =
|
|
20630
|
-
const fileContent2 = await readFileContent(
|
|
21717
|
+
const relativePath2 = join136(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
21718
|
+
const fileContent2 = await readFileContent(join136(outputRoot, relativePath2));
|
|
20631
21719
|
return new _FactorydroidRule({
|
|
20632
21720
|
outputRoot,
|
|
20633
21721
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -20640,8 +21728,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
20640
21728
|
if (!paths.nonRoot) {
|
|
20641
21729
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20642
21730
|
}
|
|
20643
|
-
const relativePath =
|
|
20644
|
-
const fileContent = await readFileContent(
|
|
21731
|
+
const relativePath = join136(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21732
|
+
const fileContent = await readFileContent(join136(outputRoot, relativePath));
|
|
20645
21733
|
return new _FactorydroidRule({
|
|
20646
21734
|
outputRoot,
|
|
20647
21735
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20700,7 +21788,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
20700
21788
|
};
|
|
20701
21789
|
|
|
20702
21790
|
// src/features/rules/geminicli-rule.ts
|
|
20703
|
-
import { join as
|
|
21791
|
+
import { join as join137 } from "path";
|
|
20704
21792
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
20705
21793
|
static getSettablePaths({
|
|
20706
21794
|
global,
|
|
@@ -20735,7 +21823,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
20735
21823
|
if (isRoot) {
|
|
20736
21824
|
const relativePath2 = paths.root.relativeFilePath;
|
|
20737
21825
|
const fileContent2 = await readFileContent(
|
|
20738
|
-
|
|
21826
|
+
join137(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
20739
21827
|
);
|
|
20740
21828
|
return new _GeminiCliRule({
|
|
20741
21829
|
outputRoot,
|
|
@@ -20749,8 +21837,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
20749
21837
|
if (!paths.nonRoot) {
|
|
20750
21838
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20751
21839
|
}
|
|
20752
|
-
const relativePath =
|
|
20753
|
-
const fileContent = await readFileContent(
|
|
21840
|
+
const relativePath = join137(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21841
|
+
const fileContent = await readFileContent(join137(outputRoot, relativePath));
|
|
20754
21842
|
return new _GeminiCliRule({
|
|
20755
21843
|
outputRoot,
|
|
20756
21844
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20809,7 +21897,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
20809
21897
|
};
|
|
20810
21898
|
|
|
20811
21899
|
// src/features/rules/goose-rule.ts
|
|
20812
|
-
import { join as
|
|
21900
|
+
import { join as join138 } from "path";
|
|
20813
21901
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
20814
21902
|
static getSettablePaths({
|
|
20815
21903
|
global,
|
|
@@ -20844,7 +21932,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
20844
21932
|
if (isRoot) {
|
|
20845
21933
|
const relativePath2 = paths.root.relativeFilePath;
|
|
20846
21934
|
const fileContent2 = await readFileContent(
|
|
20847
|
-
|
|
21935
|
+
join138(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
20848
21936
|
);
|
|
20849
21937
|
return new _GooseRule({
|
|
20850
21938
|
outputRoot,
|
|
@@ -20858,8 +21946,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
20858
21946
|
if (!paths.nonRoot) {
|
|
20859
21947
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20860
21948
|
}
|
|
20861
|
-
const relativePath =
|
|
20862
|
-
const fileContent = await readFileContent(
|
|
21949
|
+
const relativePath = join138(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21950
|
+
const fileContent = await readFileContent(join138(outputRoot, relativePath));
|
|
20863
21951
|
return new _GooseRule({
|
|
20864
21952
|
outputRoot,
|
|
20865
21953
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20918,7 +22006,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
20918
22006
|
};
|
|
20919
22007
|
|
|
20920
22008
|
// src/features/rules/junie-rule.ts
|
|
20921
|
-
import { join as
|
|
22009
|
+
import { join as join139 } from "path";
|
|
20922
22010
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
20923
22011
|
static getSettablePaths(_options = {}) {
|
|
20924
22012
|
return {
|
|
@@ -20947,8 +22035,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
20947
22035
|
}) {
|
|
20948
22036
|
const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
|
|
20949
22037
|
const settablePaths = this.getSettablePaths();
|
|
20950
|
-
const relativePath = isRoot ?
|
|
20951
|
-
const fileContent = await readFileContent(
|
|
22038
|
+
const relativePath = isRoot ? join139(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : join139(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
22039
|
+
const fileContent = await readFileContent(join139(outputRoot, relativePath));
|
|
20952
22040
|
return new _JunieRule({
|
|
20953
22041
|
outputRoot,
|
|
20954
22042
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -21003,7 +22091,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
21003
22091
|
};
|
|
21004
22092
|
|
|
21005
22093
|
// src/features/rules/kilo-rule.ts
|
|
21006
|
-
import { join as
|
|
22094
|
+
import { join as join140 } from "path";
|
|
21007
22095
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
21008
22096
|
static getSettablePaths({
|
|
21009
22097
|
global,
|
|
@@ -21038,7 +22126,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
21038
22126
|
if (isRoot) {
|
|
21039
22127
|
const relativePath2 = paths.root.relativeFilePath;
|
|
21040
22128
|
const fileContent2 = await readFileContent(
|
|
21041
|
-
|
|
22129
|
+
join140(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
21042
22130
|
);
|
|
21043
22131
|
return new _KiloRule({
|
|
21044
22132
|
outputRoot,
|
|
@@ -21052,8 +22140,8 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
21052
22140
|
if (!paths.nonRoot) {
|
|
21053
22141
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
21054
22142
|
}
|
|
21055
|
-
const relativePath =
|
|
21056
|
-
const fileContent = await readFileContent(
|
|
22143
|
+
const relativePath = join140(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
22144
|
+
const fileContent = await readFileContent(join140(outputRoot, relativePath));
|
|
21057
22145
|
return new _KiloRule({
|
|
21058
22146
|
outputRoot,
|
|
21059
22147
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -21112,7 +22200,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
21112
22200
|
};
|
|
21113
22201
|
|
|
21114
22202
|
// src/features/rules/kiro-rule.ts
|
|
21115
|
-
import { join as
|
|
22203
|
+
import { join as join141 } from "path";
|
|
21116
22204
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
21117
22205
|
static getSettablePaths(_options = {}) {
|
|
21118
22206
|
return {
|
|
@@ -21127,7 +22215,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
21127
22215
|
validate = true
|
|
21128
22216
|
}) {
|
|
21129
22217
|
const fileContent = await readFileContent(
|
|
21130
|
-
|
|
22218
|
+
join141(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
21131
22219
|
);
|
|
21132
22220
|
return new _KiroRule({
|
|
21133
22221
|
outputRoot,
|
|
@@ -21181,7 +22269,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
21181
22269
|
};
|
|
21182
22270
|
|
|
21183
22271
|
// src/features/rules/opencode-rule.ts
|
|
21184
|
-
import { join as
|
|
22272
|
+
import { join as join142 } from "path";
|
|
21185
22273
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
21186
22274
|
static getSettablePaths({
|
|
21187
22275
|
global,
|
|
@@ -21216,7 +22304,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
21216
22304
|
if (isRoot) {
|
|
21217
22305
|
const relativePath2 = paths.root.relativeFilePath;
|
|
21218
22306
|
const fileContent2 = await readFileContent(
|
|
21219
|
-
|
|
22307
|
+
join142(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
21220
22308
|
);
|
|
21221
22309
|
return new _OpenCodeRule({
|
|
21222
22310
|
outputRoot,
|
|
@@ -21230,8 +22318,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
21230
22318
|
if (!paths.nonRoot) {
|
|
21231
22319
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
21232
22320
|
}
|
|
21233
|
-
const relativePath =
|
|
21234
|
-
const fileContent = await readFileContent(
|
|
22321
|
+
const relativePath = join142(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
22322
|
+
const fileContent = await readFileContent(join142(outputRoot, relativePath));
|
|
21235
22323
|
return new _OpenCodeRule({
|
|
21236
22324
|
outputRoot,
|
|
21237
22325
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -21290,7 +22378,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
21290
22378
|
};
|
|
21291
22379
|
|
|
21292
22380
|
// src/features/rules/pi-rule.ts
|
|
21293
|
-
import { join as
|
|
22381
|
+
import { join as join143 } from "path";
|
|
21294
22382
|
var PiRule = class _PiRule extends ToolRule {
|
|
21295
22383
|
static getSettablePaths({
|
|
21296
22384
|
global,
|
|
@@ -21324,7 +22412,7 @@ var PiRule = class _PiRule extends ToolRule {
|
|
|
21324
22412
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
21325
22413
|
if (isRoot) {
|
|
21326
22414
|
const fileContent2 = await readFileContent(
|
|
21327
|
-
|
|
22415
|
+
join143(outputRoot, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
21328
22416
|
);
|
|
21329
22417
|
return new _PiRule({
|
|
21330
22418
|
outputRoot,
|
|
@@ -21340,8 +22428,8 @@ var PiRule = class _PiRule extends ToolRule {
|
|
|
21340
22428
|
`PiRule does not support non-root rules in global mode; expected '${paths.root.relativeFilePath}' but got '${relativeFilePath}'`
|
|
21341
22429
|
);
|
|
21342
22430
|
}
|
|
21343
|
-
const relativePath =
|
|
21344
|
-
const fileContent = await readFileContent(
|
|
22431
|
+
const relativePath = join143(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
22432
|
+
const fileContent = await readFileContent(join143(outputRoot, relativePath));
|
|
21345
22433
|
return new _PiRule({
|
|
21346
22434
|
outputRoot,
|
|
21347
22435
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -21405,7 +22493,7 @@ var PiRule = class _PiRule extends ToolRule {
|
|
|
21405
22493
|
};
|
|
21406
22494
|
|
|
21407
22495
|
// src/features/rules/qwencode-rule.ts
|
|
21408
|
-
import { join as
|
|
22496
|
+
import { join as join144 } from "path";
|
|
21409
22497
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
21410
22498
|
static getSettablePaths(_options = {}) {
|
|
21411
22499
|
return {
|
|
@@ -21424,8 +22512,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
21424
22512
|
validate = true
|
|
21425
22513
|
}) {
|
|
21426
22514
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
21427
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
21428
|
-
const fileContent = await readFileContent(
|
|
22515
|
+
const relativePath = isRoot ? "QWEN.md" : join144(".qwen", "memories", relativeFilePath);
|
|
22516
|
+
const fileContent = await readFileContent(join144(outputRoot, relativePath));
|
|
21429
22517
|
return new _QwencodeRule({
|
|
21430
22518
|
outputRoot,
|
|
21431
22519
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -21477,7 +22565,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
21477
22565
|
};
|
|
21478
22566
|
|
|
21479
22567
|
// src/features/rules/replit-rule.ts
|
|
21480
|
-
import { join as
|
|
22568
|
+
import { join as join145 } from "path";
|
|
21481
22569
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
21482
22570
|
static getSettablePaths(_options = {}) {
|
|
21483
22571
|
return {
|
|
@@ -21499,7 +22587,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
21499
22587
|
}
|
|
21500
22588
|
const relativePath = paths.root.relativeFilePath;
|
|
21501
22589
|
const fileContent = await readFileContent(
|
|
21502
|
-
|
|
22590
|
+
join145(outputRoot, paths.root.relativeDirPath, relativePath)
|
|
21503
22591
|
);
|
|
21504
22592
|
return new _ReplitRule({
|
|
21505
22593
|
outputRoot,
|
|
@@ -21565,7 +22653,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
21565
22653
|
};
|
|
21566
22654
|
|
|
21567
22655
|
// src/features/rules/roo-rule.ts
|
|
21568
|
-
import { join as
|
|
22656
|
+
import { join as join146 } from "path";
|
|
21569
22657
|
var RooRule = class _RooRule extends ToolRule {
|
|
21570
22658
|
static getSettablePaths(_options = {}) {
|
|
21571
22659
|
return {
|
|
@@ -21580,7 +22668,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
21580
22668
|
validate = true
|
|
21581
22669
|
}) {
|
|
21582
22670
|
const fileContent = await readFileContent(
|
|
21583
|
-
|
|
22671
|
+
join146(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
21584
22672
|
);
|
|
21585
22673
|
return new _RooRule({
|
|
21586
22674
|
outputRoot,
|
|
@@ -21649,7 +22737,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
21649
22737
|
};
|
|
21650
22738
|
|
|
21651
22739
|
// src/features/rules/rovodev-rule.ts
|
|
21652
|
-
import { join as
|
|
22740
|
+
import { join as join147 } from "path";
|
|
21653
22741
|
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
21654
22742
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
21655
22743
|
/**
|
|
@@ -21693,7 +22781,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21693
22781
|
root: rovodevAgents,
|
|
21694
22782
|
alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
|
|
21695
22783
|
nonRoot: {
|
|
21696
|
-
relativeDirPath:
|
|
22784
|
+
relativeDirPath: join147(".rovodev", ".rulesync", "modular-rules")
|
|
21697
22785
|
}
|
|
21698
22786
|
};
|
|
21699
22787
|
}
|
|
@@ -21732,10 +22820,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21732
22820
|
}) {
|
|
21733
22821
|
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
21734
22822
|
throw new Error(
|
|
21735
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${
|
|
22823
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join147(relativeDirPath, relativeFilePath)}`
|
|
21736
22824
|
);
|
|
21737
22825
|
}
|
|
21738
|
-
const fileContent = await readFileContent(
|
|
22826
|
+
const fileContent = await readFileContent(join147(outputRoot, relativeDirPath, relativeFilePath));
|
|
21739
22827
|
return new _RovodevRule({
|
|
21740
22828
|
outputRoot,
|
|
21741
22829
|
relativeDirPath,
|
|
@@ -21755,10 +22843,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21755
22843
|
paths
|
|
21756
22844
|
}) {
|
|
21757
22845
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
21758
|
-
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${
|
|
22846
|
+
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${join147(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : join147(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
21759
22847
|
if (relativeFilePath !== "AGENTS.md") {
|
|
21760
22848
|
throw new Error(
|
|
21761
|
-
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${
|
|
22849
|
+
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${join147(relativeDirPath, relativeFilePath)}`
|
|
21762
22850
|
);
|
|
21763
22851
|
}
|
|
21764
22852
|
const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
|
|
@@ -21766,10 +22854,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21766
22854
|
);
|
|
21767
22855
|
if (!allowed) {
|
|
21768
22856
|
throw new Error(
|
|
21769
|
-
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${
|
|
22857
|
+
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${join147(relativeDirPath, relativeFilePath)}`
|
|
21770
22858
|
);
|
|
21771
22859
|
}
|
|
21772
|
-
const fileContent = await readFileContent(
|
|
22860
|
+
const fileContent = await readFileContent(join147(outputRoot, relativeDirPath, relativeFilePath));
|
|
21773
22861
|
return new _RovodevRule({
|
|
21774
22862
|
outputRoot,
|
|
21775
22863
|
relativeDirPath,
|
|
@@ -21883,7 +22971,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21883
22971
|
};
|
|
21884
22972
|
|
|
21885
22973
|
// src/features/rules/takt-rule.ts
|
|
21886
|
-
import { join as
|
|
22974
|
+
import { join as join148 } from "path";
|
|
21887
22975
|
var DEFAULT_TAKT_RULE_DIR = "policies";
|
|
21888
22976
|
var TaktRule = class _TaktRule extends ToolRule {
|
|
21889
22977
|
static getSettablePaths({
|
|
@@ -21895,7 +22983,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21895
22983
|
root: {
|
|
21896
22984
|
relativeDirPath: buildToolPath(
|
|
21897
22985
|
".takt",
|
|
21898
|
-
|
|
22986
|
+
join148("facets", DEFAULT_TAKT_RULE_DIR),
|
|
21899
22987
|
excludeToolDir
|
|
21900
22988
|
),
|
|
21901
22989
|
relativeFilePath: "overview.md"
|
|
@@ -21906,7 +22994,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21906
22994
|
nonRoot: {
|
|
21907
22995
|
relativeDirPath: buildToolPath(
|
|
21908
22996
|
".takt",
|
|
21909
|
-
|
|
22997
|
+
join148("facets", DEFAULT_TAKT_RULE_DIR),
|
|
21910
22998
|
excludeToolDir
|
|
21911
22999
|
)
|
|
21912
23000
|
}
|
|
@@ -21924,8 +23012,8 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21924
23012
|
validate = true,
|
|
21925
23013
|
relativeDirPath: overrideDirPath
|
|
21926
23014
|
}) {
|
|
21927
|
-
const dirPath = overrideDirPath ??
|
|
21928
|
-
const filePath =
|
|
23015
|
+
const dirPath = overrideDirPath ?? join148(".takt", "facets", DEFAULT_TAKT_RULE_DIR);
|
|
23016
|
+
const filePath = join148(outputRoot, dirPath, relativeFilePath);
|
|
21929
23017
|
const fileContent = await readFileContent(filePath);
|
|
21930
23018
|
const { body } = parseFrontmatter(fileContent, filePath);
|
|
21931
23019
|
return new _TaktRule({
|
|
@@ -21964,7 +23052,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21964
23052
|
const stem = overrideName ?? sourceStem;
|
|
21965
23053
|
assertSafeTaktName({ name: stem, featureLabel: "rule", sourceLabel });
|
|
21966
23054
|
const relativeFilePath = `${stem}.md`;
|
|
21967
|
-
const relativeDirPath =
|
|
23055
|
+
const relativeDirPath = join148(".takt", "facets", DEFAULT_TAKT_RULE_DIR);
|
|
21968
23056
|
return new _TaktRule({
|
|
21969
23057
|
outputRoot,
|
|
21970
23058
|
relativeDirPath,
|
|
@@ -21989,7 +23077,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21989
23077
|
};
|
|
21990
23078
|
|
|
21991
23079
|
// src/features/rules/warp-rule.ts
|
|
21992
|
-
import { join as
|
|
23080
|
+
import { join as join149 } from "path";
|
|
21993
23081
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
21994
23082
|
constructor({ fileContent, root, ...rest }) {
|
|
21995
23083
|
super({
|
|
@@ -22015,8 +23103,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
22015
23103
|
validate = true
|
|
22016
23104
|
}) {
|
|
22017
23105
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
22018
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
22019
|
-
const fileContent = await readFileContent(
|
|
23106
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join149(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
23107
|
+
const fileContent = await readFileContent(join149(outputRoot, relativePath));
|
|
22020
23108
|
return new _WarpRule({
|
|
22021
23109
|
outputRoot,
|
|
22022
23110
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -22071,7 +23159,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
22071
23159
|
};
|
|
22072
23160
|
|
|
22073
23161
|
// src/features/rules/windsurf-rule.ts
|
|
22074
|
-
import { join as
|
|
23162
|
+
import { join as join150 } from "path";
|
|
22075
23163
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
22076
23164
|
static getSettablePaths(_options = {}) {
|
|
22077
23165
|
return {
|
|
@@ -22086,7 +23174,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
22086
23174
|
validate = true
|
|
22087
23175
|
}) {
|
|
22088
23176
|
const fileContent = await readFileContent(
|
|
22089
|
-
|
|
23177
|
+
join150(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
22090
23178
|
);
|
|
22091
23179
|
return new _WindsurfRule({
|
|
22092
23180
|
outputRoot,
|
|
@@ -22186,11 +23274,11 @@ var rulesProcessorToolTargets = [
|
|
|
22186
23274
|
"warp",
|
|
22187
23275
|
"windsurf"
|
|
22188
23276
|
];
|
|
22189
|
-
var RulesProcessorToolTargetSchema =
|
|
22190
|
-
var formatRulePaths = (rules) => rules.map((r) =>
|
|
22191
|
-
var RulesFeatureOptionsSchema =
|
|
22192
|
-
ruleDiscoveryMode:
|
|
22193
|
-
includeLocalRoot:
|
|
23277
|
+
var RulesProcessorToolTargetSchema = z79.enum(rulesProcessorToolTargets);
|
|
23278
|
+
var formatRulePaths = (rules) => rules.map((r) => join151(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
23279
|
+
var RulesFeatureOptionsSchema = z79.looseObject({
|
|
23280
|
+
ruleDiscoveryMode: z79.optional(z79.enum(["none", "explicit"])),
|
|
23281
|
+
includeLocalRoot: z79.optional(z79.boolean())
|
|
22194
23282
|
});
|
|
22195
23283
|
var resolveRuleDiscoveryMode = ({
|
|
22196
23284
|
defaultMode,
|
|
@@ -22211,8 +23299,8 @@ var resolveRuleDiscoveryMode = ({
|
|
|
22211
23299
|
}
|
|
22212
23300
|
return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
|
|
22213
23301
|
};
|
|
22214
|
-
var IncludeLocalRootSchema =
|
|
22215
|
-
includeLocalRoot:
|
|
23302
|
+
var IncludeLocalRootSchema = z79.looseObject({
|
|
23303
|
+
includeLocalRoot: z79.optional(z79.boolean())
|
|
22216
23304
|
});
|
|
22217
23305
|
var resolveIncludeLocalRoot = (options) => {
|
|
22218
23306
|
if (!options) return true;
|
|
@@ -22683,7 +23771,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22683
23771
|
}).relativeDirPath;
|
|
22684
23772
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
22685
23773
|
const frontmatter = skill.getFrontmatter();
|
|
22686
|
-
const relativePath =
|
|
23774
|
+
const relativePath = join151(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
22687
23775
|
return {
|
|
22688
23776
|
name: frontmatter.name,
|
|
22689
23777
|
description: frontmatter.description,
|
|
@@ -22812,8 +23900,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22812
23900
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
22813
23901
|
*/
|
|
22814
23902
|
async loadRulesyncFiles() {
|
|
22815
|
-
const rulesyncOutputRoot =
|
|
22816
|
-
const files = await findFilesByGlobs(
|
|
23903
|
+
const rulesyncOutputRoot = join151(this.inputRoot, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
23904
|
+
const files = await findFilesByGlobs(join151(rulesyncOutputRoot, "**", "*.md"));
|
|
22817
23905
|
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
22818
23906
|
const rulesyncRules = await Promise.all(
|
|
22819
23907
|
files.map((file) => {
|
|
@@ -22929,13 +24017,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22929
24017
|
return [];
|
|
22930
24018
|
}
|
|
22931
24019
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
22932
|
-
|
|
24020
|
+
join151(
|
|
22933
24021
|
this.outputRoot,
|
|
22934
24022
|
settablePaths.root.relativeDirPath ?? ".",
|
|
22935
24023
|
settablePaths.root.relativeFilePath
|
|
22936
24024
|
),
|
|
22937
24025
|
settablePaths.alternativeRoots,
|
|
22938
|
-
(alt) =>
|
|
24026
|
+
(alt) => join151(this.outputRoot, alt.relativeDirPath, alt.relativeFilePath)
|
|
22939
24027
|
);
|
|
22940
24028
|
if (forDeletion) {
|
|
22941
24029
|
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
@@ -22966,7 +24054,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22966
24054
|
return [];
|
|
22967
24055
|
}
|
|
22968
24056
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
22969
|
-
|
|
24057
|
+
join151(this.outputRoot, "AGENTS.local.md")
|
|
22970
24058
|
);
|
|
22971
24059
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
22972
24060
|
}
|
|
@@ -22977,9 +24065,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22977
24065
|
return [];
|
|
22978
24066
|
}
|
|
22979
24067
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
22980
|
-
|
|
24068
|
+
join151(this.outputRoot, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
22981
24069
|
settablePaths.alternativeRoots,
|
|
22982
|
-
(alt) =>
|
|
24070
|
+
(alt) => join151(this.outputRoot, alt.relativeDirPath, "CLAUDE.local.md")
|
|
22983
24071
|
);
|
|
22984
24072
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
22985
24073
|
})();
|
|
@@ -22990,20 +24078,20 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22990
24078
|
if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
|
|
22991
24079
|
return [];
|
|
22992
24080
|
}
|
|
22993
|
-
const primaryPaths = await findFilesByGlobs(
|
|
24081
|
+
const primaryPaths = await findFilesByGlobs(join151(this.outputRoot, ".rovodev", "AGENTS.md"));
|
|
22994
24082
|
if (primaryPaths.length === 0) {
|
|
22995
24083
|
return [];
|
|
22996
24084
|
}
|
|
22997
|
-
const mirrorPaths = await findFilesByGlobs(
|
|
24085
|
+
const mirrorPaths = await findFilesByGlobs(join151(this.outputRoot, "AGENTS.md"));
|
|
22998
24086
|
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
22999
24087
|
})();
|
|
23000
24088
|
const nonRootToolRules = await (async () => {
|
|
23001
24089
|
if (!settablePaths.nonRoot) {
|
|
23002
24090
|
return [];
|
|
23003
24091
|
}
|
|
23004
|
-
const nonRootOutputRoot =
|
|
24092
|
+
const nonRootOutputRoot = join151(this.outputRoot, settablePaths.nonRoot.relativeDirPath);
|
|
23005
24093
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
23006
|
-
|
|
24094
|
+
join151(nonRootOutputRoot, "**", `*.${factory.meta.extension}`)
|
|
23007
24095
|
);
|
|
23008
24096
|
if (forDeletion) {
|
|
23009
24097
|
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
@@ -23017,7 +24105,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
23017
24105
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
23018
24106
|
if (!ok) {
|
|
23019
24107
|
this.logger.warn(
|
|
23020
|
-
`Skipping reserved Rovodev path under modular-rules (import): ${
|
|
24108
|
+
`Skipping reserved Rovodev path under modular-rules (import): ${join151(modularRootRelative, relativeFilePath)}`
|
|
23021
24109
|
);
|
|
23022
24110
|
}
|
|
23023
24111
|
return ok;
|
|
@@ -23143,14 +24231,14 @@ s/<command> [arguments]
|
|
|
23143
24231
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
23144
24232
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
23145
24233
|
|
|
23146
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
24234
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join151(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
23147
24235
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
23148
24236
|
|
|
23149
24237
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
23150
24238
|
|
|
23151
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
24239
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join151(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
23152
24240
|
|
|
23153
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
24241
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join151(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
23154
24242
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
23155
24243
|
const result = [
|
|
23156
24244
|
overview,
|
|
@@ -23408,7 +24496,7 @@ function buildPermissionsStrategy(ctx) {
|
|
|
23408
24496
|
}
|
|
23409
24497
|
|
|
23410
24498
|
// src/lib/generate.ts
|
|
23411
|
-
import { join as
|
|
24499
|
+
import { join as join152 } from "path";
|
|
23412
24500
|
import { intersection } from "es-toolkit";
|
|
23413
24501
|
async function processFeatureGeneration(params) {
|
|
23414
24502
|
const { config, processor, toolFiles } = params;
|
|
@@ -23482,7 +24570,7 @@ function warnUnsupportedTargets(params) {
|
|
|
23482
24570
|
}
|
|
23483
24571
|
}
|
|
23484
24572
|
async function checkRulesyncDirExists(params) {
|
|
23485
|
-
return fileExists(
|
|
24573
|
+
return fileExists(join152(params.inputRoot, RULESYNC_RELATIVE_DIR_PATH));
|
|
23486
24574
|
}
|
|
23487
24575
|
async function generate(params) {
|
|
23488
24576
|
const { config, logger } = params;
|