rulesync 8.14.0 → 8.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/{chunk-C7PHKGD2.js → chunk-UMJWBQ2X.js} +1732 -761
- package/dist/cli/index.cjs +2068 -1093
- package/dist/cli/index.js +6 -2
- package/dist/index.cjs +1768 -797
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -9992,11 +9992,11 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
9992
9992
|
};
|
|
9993
9993
|
|
|
9994
9994
|
// src/features/permissions/permissions-processor.ts
|
|
9995
|
-
import { z as
|
|
9995
|
+
import { z as z37 } from "zod/mini";
|
|
9996
9996
|
|
|
9997
|
-
// src/features/permissions/
|
|
9997
|
+
// src/features/permissions/augmentcode-permissions.ts
|
|
9998
9998
|
import { join as join65 } from "path";
|
|
9999
|
-
import {
|
|
9999
|
+
import { z as z30 } from "zod/mini";
|
|
10000
10000
|
|
|
10001
10001
|
// src/features/permissions/rulesync-permissions.ts
|
|
10002
10002
|
import { join as join64 } from "path";
|
|
@@ -10091,7 +10091,329 @@ var ToolPermissions = class extends ToolFile {
|
|
|
10091
10091
|
}
|
|
10092
10092
|
};
|
|
10093
10093
|
|
|
10094
|
+
// src/features/permissions/augmentcode-permissions.ts
|
|
10095
|
+
var AugmentPermissionTypeSchema = z30.enum(["allow", "deny", "ask-user"]);
|
|
10096
|
+
var AugmentToolPermissionSchema = z30.looseObject({
|
|
10097
|
+
toolName: z30.string(),
|
|
10098
|
+
shellInputRegex: z30.optional(z30.string()),
|
|
10099
|
+
permission: z30.looseObject({
|
|
10100
|
+
type: AugmentPermissionTypeSchema
|
|
10101
|
+
})
|
|
10102
|
+
});
|
|
10103
|
+
var AugmentSettingsSchema = z30.looseObject({
|
|
10104
|
+
toolPermissions: z30.optional(z30.array(AugmentToolPermissionSchema))
|
|
10105
|
+
});
|
|
10106
|
+
var CANONICAL_TO_AUGMENT_TOOL_NAMES = {
|
|
10107
|
+
bash: "launch-process",
|
|
10108
|
+
read: "view",
|
|
10109
|
+
edit: "str-replace-editor",
|
|
10110
|
+
write: "save-file",
|
|
10111
|
+
webfetch: "web-fetch",
|
|
10112
|
+
websearch: "web-search"
|
|
10113
|
+
};
|
|
10114
|
+
var AUGMENT_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
10115
|
+
Object.entries(CANONICAL_TO_AUGMENT_TOOL_NAMES).map(([k, v]) => [v, k])
|
|
10116
|
+
);
|
|
10117
|
+
function toAugmentToolName(canonical) {
|
|
10118
|
+
return CANONICAL_TO_AUGMENT_TOOL_NAMES[canonical] ?? canonical;
|
|
10119
|
+
}
|
|
10120
|
+
function toCanonicalToolName(augmentName) {
|
|
10121
|
+
return AUGMENT_TO_CANONICAL_TOOL_NAMES[augmentName] ?? augmentName;
|
|
10122
|
+
}
|
|
10123
|
+
function actionToAugmentType(action) {
|
|
10124
|
+
switch (action) {
|
|
10125
|
+
case "allow":
|
|
10126
|
+
return "allow";
|
|
10127
|
+
case "deny":
|
|
10128
|
+
return "deny";
|
|
10129
|
+
case "ask":
|
|
10130
|
+
return "ask-user";
|
|
10131
|
+
}
|
|
10132
|
+
}
|
|
10133
|
+
function augmentTypeToAction(type) {
|
|
10134
|
+
switch (type) {
|
|
10135
|
+
case "allow":
|
|
10136
|
+
return "allow";
|
|
10137
|
+
case "deny":
|
|
10138
|
+
return "deny";
|
|
10139
|
+
case "ask-user":
|
|
10140
|
+
return "ask";
|
|
10141
|
+
}
|
|
10142
|
+
}
|
|
10143
|
+
function globToShellRegex(glob) {
|
|
10144
|
+
let regex = "";
|
|
10145
|
+
for (const char of glob) {
|
|
10146
|
+
if (char === "*") {
|
|
10147
|
+
regex += ".*";
|
|
10148
|
+
} else if (char === "?") {
|
|
10149
|
+
regex += ".";
|
|
10150
|
+
} else if (/[\\^$.|+(){}[\]]/.test(char)) {
|
|
10151
|
+
regex += `\\${char}`;
|
|
10152
|
+
} else {
|
|
10153
|
+
regex += char;
|
|
10154
|
+
}
|
|
10155
|
+
}
|
|
10156
|
+
return `^${regex}$`;
|
|
10157
|
+
}
|
|
10158
|
+
function shellRegexToGlob(regex) {
|
|
10159
|
+
let body = regex;
|
|
10160
|
+
if (body.startsWith("^")) body = body.slice(1);
|
|
10161
|
+
if (body.endsWith("$")) body = body.slice(0, -1);
|
|
10162
|
+
let glob = "";
|
|
10163
|
+
let i = 0;
|
|
10164
|
+
while (i < body.length) {
|
|
10165
|
+
const ch = body[i];
|
|
10166
|
+
if (ch === "\\" && i + 1 < body.length) {
|
|
10167
|
+
glob += body[i + 1];
|
|
10168
|
+
i += 2;
|
|
10169
|
+
continue;
|
|
10170
|
+
}
|
|
10171
|
+
if (ch === "." && body[i + 1] === "*") {
|
|
10172
|
+
glob += "*";
|
|
10173
|
+
i += 2;
|
|
10174
|
+
continue;
|
|
10175
|
+
}
|
|
10176
|
+
if (ch === ".") {
|
|
10177
|
+
glob += "?";
|
|
10178
|
+
i += 1;
|
|
10179
|
+
continue;
|
|
10180
|
+
}
|
|
10181
|
+
glob += ch;
|
|
10182
|
+
i += 1;
|
|
10183
|
+
}
|
|
10184
|
+
return glob;
|
|
10185
|
+
}
|
|
10186
|
+
var MANAGED_AUGMENT_TOOL_NAMES = new Set(Object.values(CANONICAL_TO_AUGMENT_TOOL_NAMES));
|
|
10187
|
+
var AugmentcodePermissions = class _AugmentcodePermissions extends ToolPermissions {
|
|
10188
|
+
constructor(params) {
|
|
10189
|
+
super({
|
|
10190
|
+
...params,
|
|
10191
|
+
fileContent: params.fileContent ?? "{}"
|
|
10192
|
+
});
|
|
10193
|
+
}
|
|
10194
|
+
isDeletable() {
|
|
10195
|
+
return false;
|
|
10196
|
+
}
|
|
10197
|
+
static getSettablePaths(_options = {}) {
|
|
10198
|
+
return {
|
|
10199
|
+
relativeDirPath: ".augment",
|
|
10200
|
+
relativeFilePath: "settings.json"
|
|
10201
|
+
};
|
|
10202
|
+
}
|
|
10203
|
+
static async fromFile({
|
|
10204
|
+
outputRoot = process.cwd(),
|
|
10205
|
+
validate = true,
|
|
10206
|
+
global = false
|
|
10207
|
+
}) {
|
|
10208
|
+
const paths = _AugmentcodePermissions.getSettablePaths({ global });
|
|
10209
|
+
const filePath = join65(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10210
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"toolPermissions":[]}';
|
|
10211
|
+
return new _AugmentcodePermissions({
|
|
10212
|
+
outputRoot,
|
|
10213
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10214
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10215
|
+
fileContent,
|
|
10216
|
+
validate
|
|
10217
|
+
});
|
|
10218
|
+
}
|
|
10219
|
+
static async fromRulesyncPermissions({
|
|
10220
|
+
outputRoot = process.cwd(),
|
|
10221
|
+
rulesyncPermissions,
|
|
10222
|
+
global = false,
|
|
10223
|
+
logger
|
|
10224
|
+
}) {
|
|
10225
|
+
const paths = _AugmentcodePermissions.getSettablePaths({ global });
|
|
10226
|
+
const filePath = join65(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10227
|
+
const existingContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
10228
|
+
let settings;
|
|
10229
|
+
try {
|
|
10230
|
+
const parsed = JSON.parse(existingContent);
|
|
10231
|
+
const result = AugmentSettingsSchema.safeParse(parsed);
|
|
10232
|
+
if (!result.success) {
|
|
10233
|
+
throw new Error(formatError(result.error));
|
|
10234
|
+
}
|
|
10235
|
+
settings = result.data;
|
|
10236
|
+
} catch (error) {
|
|
10237
|
+
throw new Error(
|
|
10238
|
+
`Failed to parse existing AugmentCode settings at ${filePath}: ${formatError(error)}`,
|
|
10239
|
+
{ cause: error }
|
|
10240
|
+
);
|
|
10241
|
+
}
|
|
10242
|
+
const config = rulesyncPermissions.getJson();
|
|
10243
|
+
const generated = convertRulesyncToAugmentEntries({ config, logger });
|
|
10244
|
+
const existingEntries = settings.toolPermissions ?? [];
|
|
10245
|
+
const generatedKeys = new Set(
|
|
10246
|
+
generated.map((e) => `${e.toolName}|${e.shellInputRegex ?? ""}|${e.permission.type}`)
|
|
10247
|
+
);
|
|
10248
|
+
const preservedEntries = existingEntries.filter((entry) => {
|
|
10249
|
+
if (!MANAGED_AUGMENT_TOOL_NAMES.has(entry.toolName)) return true;
|
|
10250
|
+
if (entry.permission.type === "deny") {
|
|
10251
|
+
const key = `${entry.toolName}|${entry.shellInputRegex ?? ""}|${entry.permission.type}`;
|
|
10252
|
+
return !generatedKeys.has(key);
|
|
10253
|
+
}
|
|
10254
|
+
return false;
|
|
10255
|
+
});
|
|
10256
|
+
const sortedAll = sortAugmentEntries([...generated, ...preservedEntries]);
|
|
10257
|
+
const merged = {
|
|
10258
|
+
...settings,
|
|
10259
|
+
toolPermissions: sortedAll
|
|
10260
|
+
};
|
|
10261
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
10262
|
+
return new _AugmentcodePermissions({
|
|
10263
|
+
outputRoot,
|
|
10264
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10265
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10266
|
+
fileContent,
|
|
10267
|
+
validate: true
|
|
10268
|
+
});
|
|
10269
|
+
}
|
|
10270
|
+
toRulesyncPermissions() {
|
|
10271
|
+
let settings;
|
|
10272
|
+
try {
|
|
10273
|
+
const parsed = JSON.parse(this.getFileContent());
|
|
10274
|
+
const result = AugmentSettingsSchema.safeParse(parsed);
|
|
10275
|
+
if (!result.success) {
|
|
10276
|
+
throw new Error(formatError(result.error));
|
|
10277
|
+
}
|
|
10278
|
+
settings = result.data;
|
|
10279
|
+
} catch (error) {
|
|
10280
|
+
throw new Error(
|
|
10281
|
+
`Failed to parse AugmentCode permissions content in ${join65(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10282
|
+
{ cause: error }
|
|
10283
|
+
);
|
|
10284
|
+
}
|
|
10285
|
+
const config = convertAugmentToRulesyncPermissions({
|
|
10286
|
+
entries: settings.toolPermissions ?? []
|
|
10287
|
+
});
|
|
10288
|
+
return this.toRulesyncPermissionsDefault({
|
|
10289
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
10290
|
+
});
|
|
10291
|
+
}
|
|
10292
|
+
validate() {
|
|
10293
|
+
return { success: true, error: null };
|
|
10294
|
+
}
|
|
10295
|
+
static forDeletion({
|
|
10296
|
+
outputRoot = process.cwd(),
|
|
10297
|
+
relativeDirPath,
|
|
10298
|
+
relativeFilePath
|
|
10299
|
+
}) {
|
|
10300
|
+
return new _AugmentcodePermissions({
|
|
10301
|
+
outputRoot,
|
|
10302
|
+
relativeDirPath,
|
|
10303
|
+
relativeFilePath,
|
|
10304
|
+
fileContent: JSON.stringify({ toolPermissions: [] }, null, 2),
|
|
10305
|
+
validate: false
|
|
10306
|
+
});
|
|
10307
|
+
}
|
|
10308
|
+
};
|
|
10309
|
+
function convertRulesyncToAugmentEntries({
|
|
10310
|
+
config,
|
|
10311
|
+
logger
|
|
10312
|
+
}) {
|
|
10313
|
+
const entries = [];
|
|
10314
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
10315
|
+
const augmentToolName = toAugmentToolName(category);
|
|
10316
|
+
const isManaged = MANAGED_AUGMENT_TOOL_NAMES.has(augmentToolName);
|
|
10317
|
+
if (!isManaged && augmentToolName === category) {
|
|
10318
|
+
logger?.warn(
|
|
10319
|
+
`AugmentCode permissions: passing through unknown tool category '${category}' as toolName.`
|
|
10320
|
+
);
|
|
10321
|
+
}
|
|
10322
|
+
if (augmentToolName === "launch-process") {
|
|
10323
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
10324
|
+
const augmentType = actionToAugmentType(action);
|
|
10325
|
+
if (pattern === "*") {
|
|
10326
|
+
entries.push({ toolName: augmentToolName, permission: { type: augmentType } });
|
|
10327
|
+
} else {
|
|
10328
|
+
entries.push({
|
|
10329
|
+
toolName: augmentToolName,
|
|
10330
|
+
shellInputRegex: globToShellRegex(pattern),
|
|
10331
|
+
permission: { type: augmentType }
|
|
10332
|
+
});
|
|
10333
|
+
}
|
|
10334
|
+
}
|
|
10335
|
+
continue;
|
|
10336
|
+
}
|
|
10337
|
+
const hasAnyDeny = Object.values(rules).some((a) => a === "deny");
|
|
10338
|
+
if (hasAnyDeny) {
|
|
10339
|
+
const collapsed = Object.keys(rules).filter((p) => p !== "*");
|
|
10340
|
+
if (collapsed.length > 0) {
|
|
10341
|
+
logger?.warn(
|
|
10342
|
+
`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(", ")}.`
|
|
10343
|
+
);
|
|
10344
|
+
}
|
|
10345
|
+
entries.push({ toolName: augmentToolName, permission: { type: "deny" } });
|
|
10346
|
+
continue;
|
|
10347
|
+
}
|
|
10348
|
+
const droppedPatterns = [];
|
|
10349
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
10350
|
+
if (pattern === "*") {
|
|
10351
|
+
entries.push({
|
|
10352
|
+
toolName: augmentToolName,
|
|
10353
|
+
permission: { type: actionToAugmentType(action) }
|
|
10354
|
+
});
|
|
10355
|
+
} else {
|
|
10356
|
+
droppedPatterns.push(pattern);
|
|
10357
|
+
}
|
|
10358
|
+
}
|
|
10359
|
+
if (droppedPatterns.length > 0) {
|
|
10360
|
+
logger?.warn(
|
|
10361
|
+
`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.`
|
|
10362
|
+
);
|
|
10363
|
+
}
|
|
10364
|
+
}
|
|
10365
|
+
return entries;
|
|
10366
|
+
}
|
|
10367
|
+
function sortAugmentEntries(entries) {
|
|
10368
|
+
const typePriority = {
|
|
10369
|
+
deny: 0,
|
|
10370
|
+
"ask-user": 1,
|
|
10371
|
+
allow: 2
|
|
10372
|
+
};
|
|
10373
|
+
const decorated = entries.map((entry, index) => ({ entry, index }));
|
|
10374
|
+
decorated.sort((a, b) => {
|
|
10375
|
+
const aHasRegex = a.entry.shellInputRegex ? 1 : 0;
|
|
10376
|
+
const bHasRegex = b.entry.shellInputRegex ? 1 : 0;
|
|
10377
|
+
if (aHasRegex !== bHasRegex) return bHasRegex - aHasRegex;
|
|
10378
|
+
const aType = typePriority[a.entry.permission.type];
|
|
10379
|
+
const bType = typePriority[b.entry.permission.type];
|
|
10380
|
+
if (aType !== bType) return aType - bType;
|
|
10381
|
+
if (a.entry.shellInputRegex && b.entry.shellInputRegex) {
|
|
10382
|
+
const aLen = a.entry.shellInputRegex.length;
|
|
10383
|
+
const bLen = b.entry.shellInputRegex.length;
|
|
10384
|
+
if (aLen !== bLen) return bLen - aLen;
|
|
10385
|
+
}
|
|
10386
|
+
return a.index - b.index;
|
|
10387
|
+
});
|
|
10388
|
+
return decorated.map((d) => d.entry);
|
|
10389
|
+
}
|
|
10390
|
+
function convertAugmentToRulesyncPermissions({
|
|
10391
|
+
entries
|
|
10392
|
+
}) {
|
|
10393
|
+
const actionPriority = {
|
|
10394
|
+
deny: 2,
|
|
10395
|
+
ask: 1,
|
|
10396
|
+
allow: 0
|
|
10397
|
+
};
|
|
10398
|
+
const permission = {};
|
|
10399
|
+
for (const entry of entries) {
|
|
10400
|
+
const canonical = toCanonicalToolName(entry.toolName);
|
|
10401
|
+
const action = augmentTypeToAction(entry.permission.type);
|
|
10402
|
+
const pattern = entry.toolName === "launch-process" && entry.shellInputRegex ? shellRegexToGlob(entry.shellInputRegex) : "*";
|
|
10403
|
+
if (!permission[canonical]) {
|
|
10404
|
+
permission[canonical] = {};
|
|
10405
|
+
}
|
|
10406
|
+
const existing = permission[canonical][pattern];
|
|
10407
|
+
if (existing === void 0 || actionPriority[action] > actionPriority[existing]) {
|
|
10408
|
+
permission[canonical][pattern] = action;
|
|
10409
|
+
}
|
|
10410
|
+
}
|
|
10411
|
+
return { permission };
|
|
10412
|
+
}
|
|
10413
|
+
|
|
10094
10414
|
// src/features/permissions/claudecode-permissions.ts
|
|
10415
|
+
import { join as join66 } from "path";
|
|
10416
|
+
import { uniq as uniq3 } from "es-toolkit";
|
|
10095
10417
|
var CANONICAL_TO_CLAUDE_TOOL_NAMES = {
|
|
10096
10418
|
bash: "Bash",
|
|
10097
10419
|
read: "Read",
|
|
@@ -10110,7 +10432,7 @@ var CLAUDE_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
|
10110
10432
|
function toClaudeToolName(canonical) {
|
|
10111
10433
|
return CANONICAL_TO_CLAUDE_TOOL_NAMES[canonical] ?? canonical;
|
|
10112
10434
|
}
|
|
10113
|
-
function
|
|
10435
|
+
function toCanonicalToolName2(claudeName) {
|
|
10114
10436
|
return CLAUDE_TO_CANONICAL_TOOL_NAMES[claudeName] ?? claudeName;
|
|
10115
10437
|
}
|
|
10116
10438
|
function parseClaudePermissionEntry(entry) {
|
|
@@ -10152,7 +10474,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
10152
10474
|
validate = true
|
|
10153
10475
|
}) {
|
|
10154
10476
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
10155
|
-
const filePath =
|
|
10477
|
+
const filePath = join66(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10156
10478
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
10157
10479
|
return new _ClaudecodePermissions({
|
|
10158
10480
|
outputRoot,
|
|
@@ -10168,7 +10490,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
10168
10490
|
logger
|
|
10169
10491
|
}) {
|
|
10170
10492
|
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
10171
|
-
const filePath =
|
|
10493
|
+
const filePath = join66(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10172
10494
|
const existingContent = await readOrInitializeFileContent(
|
|
10173
10495
|
filePath,
|
|
10174
10496
|
JSON.stringify({}, null, 2)
|
|
@@ -10245,7 +10567,7 @@ var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions
|
|
|
10245
10567
|
settings = JSON.parse(this.getFileContent());
|
|
10246
10568
|
} catch (error) {
|
|
10247
10569
|
throw new Error(
|
|
10248
|
-
`Failed to parse Claude permissions content in ${
|
|
10570
|
+
`Failed to parse Claude permissions content in ${join66(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10249
10571
|
{ cause: error }
|
|
10250
10572
|
);
|
|
10251
10573
|
}
|
|
@@ -10304,7 +10626,7 @@ function convertClaudeToRulesyncPermissions(params) {
|
|
|
10304
10626
|
const processEntries = (entries, action) => {
|
|
10305
10627
|
for (const entry of entries) {
|
|
10306
10628
|
const { toolName, pattern } = parseClaudePermissionEntry(entry);
|
|
10307
|
-
const canonical =
|
|
10629
|
+
const canonical = toCanonicalToolName2(toolName);
|
|
10308
10630
|
if (!permission[canonical]) {
|
|
10309
10631
|
permission[canonical] = {};
|
|
10310
10632
|
}
|
|
@@ -10317,30 +10639,40 @@ function convertClaudeToRulesyncPermissions(params) {
|
|
|
10317
10639
|
return { permission };
|
|
10318
10640
|
}
|
|
10319
10641
|
|
|
10320
|
-
// src/features/permissions/
|
|
10321
|
-
import { join as
|
|
10322
|
-
import
|
|
10323
|
-
|
|
10324
|
-
var
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10642
|
+
// src/features/permissions/cline-permissions.ts
|
|
10643
|
+
import { join as join67 } from "path";
|
|
10644
|
+
import { uniq as uniq4 } from "es-toolkit";
|
|
10645
|
+
import { z as z31 } from "zod/mini";
|
|
10646
|
+
var ClineCommandPermissionsSchema = z31.looseObject({
|
|
10647
|
+
allow: z31.optional(z31.array(z31.string())),
|
|
10648
|
+
deny: z31.optional(z31.array(z31.string())),
|
|
10649
|
+
allowRedirects: z31.optional(z31.boolean())
|
|
10650
|
+
});
|
|
10651
|
+
var ClinePermissions = class _ClinePermissions extends ToolPermissions {
|
|
10652
|
+
constructor(params) {
|
|
10653
|
+
super({
|
|
10654
|
+
...params,
|
|
10655
|
+
fileContent: params.fileContent ?? "{}"
|
|
10656
|
+
});
|
|
10331
10657
|
}
|
|
10332
10658
|
isDeletable() {
|
|
10333
10659
|
return false;
|
|
10334
10660
|
}
|
|
10661
|
+
static getSettablePaths(_options = {}) {
|
|
10662
|
+
return {
|
|
10663
|
+
relativeDirPath: ".cline",
|
|
10664
|
+
relativeFilePath: "command-permissions.json"
|
|
10665
|
+
};
|
|
10666
|
+
}
|
|
10335
10667
|
static async fromFile({
|
|
10336
10668
|
outputRoot = process.cwd(),
|
|
10337
10669
|
validate = true,
|
|
10338
10670
|
global = false
|
|
10339
10671
|
}) {
|
|
10340
|
-
const paths =
|
|
10341
|
-
const filePath =
|
|
10342
|
-
const fileContent = await readFileContentOrNull(filePath) ??
|
|
10343
|
-
return new
|
|
10672
|
+
const paths = _ClinePermissions.getSettablePaths({ global });
|
|
10673
|
+
const filePath = join67(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10674
|
+
const fileContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
10675
|
+
return new _ClinePermissions({
|
|
10344
10676
|
outputRoot,
|
|
10345
10677
|
relativeDirPath: paths.relativeDirPath,
|
|
10346
10678
|
relativeFilePath: paths.relativeFilePath,
|
|
@@ -10351,56 +10683,216 @@ var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
|
10351
10683
|
static async fromRulesyncPermissions({
|
|
10352
10684
|
outputRoot = process.cwd(),
|
|
10353
10685
|
rulesyncPermissions,
|
|
10354
|
-
|
|
10355
|
-
logger
|
|
10356
|
-
global = false
|
|
10686
|
+
global = false,
|
|
10687
|
+
logger
|
|
10357
10688
|
}) {
|
|
10358
|
-
const paths =
|
|
10359
|
-
const filePath =
|
|
10360
|
-
const existingContent = await readFileContentOrNull(filePath) ??
|
|
10361
|
-
|
|
10362
|
-
const profile = convertRulesyncToCodexProfile({
|
|
10363
|
-
config: rulesyncPermissions.getJson(),
|
|
10364
|
-
logger
|
|
10365
|
-
});
|
|
10366
|
-
const permissionsTable = toMutableTable(parsed.permissions);
|
|
10367
|
-
permissionsTable[RULESYNC_PROFILE_NAME] = profile;
|
|
10368
|
-
parsed.permissions = permissionsTable;
|
|
10369
|
-
parsed.default_permissions = RULESYNC_PROFILE_NAME;
|
|
10370
|
-
return new _CodexcliPermissions({
|
|
10371
|
-
outputRoot,
|
|
10372
|
-
relativeDirPath: paths.relativeDirPath,
|
|
10373
|
-
relativeFilePath: paths.relativeFilePath,
|
|
10374
|
-
fileContent: smolToml4.stringify(parsed),
|
|
10375
|
-
validate
|
|
10376
|
-
});
|
|
10377
|
-
}
|
|
10378
|
-
toRulesyncPermissions() {
|
|
10379
|
-
let parsed;
|
|
10689
|
+
const paths = _ClinePermissions.getSettablePaths({ global });
|
|
10690
|
+
const filePath = join67(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10691
|
+
const existingContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
10692
|
+
let existing;
|
|
10380
10693
|
try {
|
|
10381
|
-
parsed =
|
|
10694
|
+
const parsed = JSON.parse(existingContent);
|
|
10695
|
+
const result = ClineCommandPermissionsSchema.safeParse(parsed);
|
|
10696
|
+
if (!result.success) {
|
|
10697
|
+
throw new Error(formatError(result.error));
|
|
10698
|
+
}
|
|
10699
|
+
existing = result.data;
|
|
10382
10700
|
} catch (error) {
|
|
10383
10701
|
throw new Error(
|
|
10384
|
-
`Failed to parse
|
|
10702
|
+
`Failed to parse existing Cline command-permissions at ${filePath}: ${formatError(error)}`,
|
|
10385
10703
|
{ cause: error }
|
|
10386
10704
|
);
|
|
10387
10705
|
}
|
|
10388
|
-
const
|
|
10389
|
-
const
|
|
10390
|
-
const
|
|
10391
|
-
const
|
|
10392
|
-
const
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10706
|
+
const config = rulesyncPermissions.getJson();
|
|
10707
|
+
const allow = [];
|
|
10708
|
+
const deny = [];
|
|
10709
|
+
const droppedCategories = [];
|
|
10710
|
+
const translatedAskPatterns = [];
|
|
10711
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
10712
|
+
if (category !== "bash") {
|
|
10713
|
+
droppedCategories.push(category);
|
|
10714
|
+
continue;
|
|
10715
|
+
}
|
|
10716
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
10717
|
+
if (action === "ask") {
|
|
10718
|
+
translatedAskPatterns.push(pattern);
|
|
10719
|
+
deny.push(pattern);
|
|
10720
|
+
continue;
|
|
10721
|
+
}
|
|
10722
|
+
if (action === "allow") {
|
|
10723
|
+
allow.push(pattern);
|
|
10724
|
+
} else if (action === "deny") {
|
|
10725
|
+
deny.push(pattern);
|
|
10726
|
+
}
|
|
10727
|
+
}
|
|
10728
|
+
}
|
|
10729
|
+
if (droppedCategories.length > 0 || translatedAskPatterns.length > 0) {
|
|
10730
|
+
const parts = [];
|
|
10731
|
+
if (droppedCategories.length > 0) {
|
|
10732
|
+
parts.push(
|
|
10733
|
+
`non-bash categories [${droppedCategories.join(", ")}] (Cline only enforces shell commands; use the rulesync ignore feature for read/write restrictions)`
|
|
10734
|
+
);
|
|
10735
|
+
}
|
|
10736
|
+
if (translatedAskPatterns.length > 0) {
|
|
10737
|
+
parts.push(
|
|
10738
|
+
`'ask' rules for bash patterns [${translatedAskPatterns.join(", ")}] translated to 'deny' for fail-closed safety, since Cline lacks 'ask'`
|
|
10739
|
+
);
|
|
10740
|
+
}
|
|
10741
|
+
logger?.warn(`WARNING: Cline command permissions translation notice: ${parts.join("; ")}.`);
|
|
10742
|
+
}
|
|
10743
|
+
const dedupedAllow = uniq4(allow.toSorted());
|
|
10744
|
+
const dedupedDeny = uniq4(deny.toSorted());
|
|
10745
|
+
const mergedDeny = uniq4([...existing.deny ?? [], ...dedupedDeny]).toSorted();
|
|
10746
|
+
const denySet = new Set(mergedDeny);
|
|
10747
|
+
const collisions = dedupedAllow.filter((p) => denySet.has(p));
|
|
10748
|
+
if (collisions.length > 0) {
|
|
10749
|
+
logger?.warn(
|
|
10750
|
+
`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.`
|
|
10751
|
+
);
|
|
10752
|
+
}
|
|
10753
|
+
const next = {
|
|
10754
|
+
...existing,
|
|
10755
|
+
allow: dedupedAllow,
|
|
10756
|
+
deny: mergedDeny,
|
|
10757
|
+
allowRedirects: existing.allowRedirects ?? false
|
|
10758
|
+
};
|
|
10759
|
+
return new _ClinePermissions({
|
|
10760
|
+
outputRoot,
|
|
10761
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10762
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10763
|
+
fileContent: JSON.stringify(next, null, 2),
|
|
10764
|
+
validate: true
|
|
10765
|
+
});
|
|
10766
|
+
}
|
|
10767
|
+
toRulesyncPermissions() {
|
|
10768
|
+
let parsed;
|
|
10769
|
+
try {
|
|
10770
|
+
const json = JSON.parse(this.getFileContent());
|
|
10771
|
+
const result = ClineCommandPermissionsSchema.safeParse(json);
|
|
10772
|
+
if (!result.success) {
|
|
10773
|
+
throw new Error(formatError(result.error));
|
|
10774
|
+
}
|
|
10775
|
+
parsed = result.data;
|
|
10776
|
+
} catch (error) {
|
|
10777
|
+
throw new Error(
|
|
10778
|
+
`Failed to parse Cline permissions content in ${join67(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10779
|
+
{ cause: error }
|
|
10780
|
+
);
|
|
10781
|
+
}
|
|
10782
|
+
const bashRules = {};
|
|
10783
|
+
for (const pattern of parsed.allow ?? []) {
|
|
10784
|
+
bashRules[pattern] = "allow";
|
|
10785
|
+
}
|
|
10786
|
+
for (const pattern of parsed.deny ?? []) {
|
|
10787
|
+
bashRules[pattern] = "deny";
|
|
10788
|
+
}
|
|
10789
|
+
const config = Object.keys(bashRules).length > 0 ? { permission: { bash: bashRules } } : { permission: {} };
|
|
10790
|
+
return this.toRulesyncPermissionsDefault({
|
|
10791
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
10792
|
+
});
|
|
10793
|
+
}
|
|
10794
|
+
validate() {
|
|
10795
|
+
return { success: true, error: null };
|
|
10796
|
+
}
|
|
10797
|
+
static forDeletion({
|
|
10798
|
+
outputRoot = process.cwd(),
|
|
10799
|
+
relativeDirPath,
|
|
10800
|
+
relativeFilePath
|
|
10801
|
+
}) {
|
|
10802
|
+
return new _ClinePermissions({
|
|
10803
|
+
outputRoot,
|
|
10804
|
+
relativeDirPath,
|
|
10805
|
+
relativeFilePath,
|
|
10806
|
+
fileContent: JSON.stringify({ allow: [], deny: [], allowRedirects: false }, null, 2),
|
|
10807
|
+
validate: false
|
|
10808
|
+
});
|
|
10809
|
+
}
|
|
10810
|
+
};
|
|
10811
|
+
|
|
10812
|
+
// src/features/permissions/codexcli-permissions.ts
|
|
10813
|
+
import { join as join68 } from "path";
|
|
10814
|
+
import * as smolToml4 from "smol-toml";
|
|
10815
|
+
var RULESYNC_PROFILE_NAME = "rulesync";
|
|
10816
|
+
var RULESYNC_BASH_RULES_FILE_NAME = "rulesync.rules";
|
|
10817
|
+
var CodexcliPermissions = class _CodexcliPermissions extends ToolPermissions {
|
|
10818
|
+
static getSettablePaths(_options = {}) {
|
|
10819
|
+
return {
|
|
10820
|
+
relativeDirPath: ".codex",
|
|
10821
|
+
relativeFilePath: "config.toml"
|
|
10822
|
+
};
|
|
10823
|
+
}
|
|
10824
|
+
isDeletable() {
|
|
10825
|
+
return false;
|
|
10826
|
+
}
|
|
10827
|
+
static async fromFile({
|
|
10828
|
+
outputRoot = process.cwd(),
|
|
10829
|
+
validate = true,
|
|
10830
|
+
global = false
|
|
10831
|
+
}) {
|
|
10832
|
+
const paths = this.getSettablePaths({ global });
|
|
10833
|
+
const filePath = join68(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10834
|
+
const fileContent = await readFileContentOrNull(filePath) ?? smolToml4.stringify({});
|
|
10835
|
+
return new _CodexcliPermissions({
|
|
10836
|
+
outputRoot,
|
|
10837
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10838
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10839
|
+
fileContent,
|
|
10840
|
+
validate
|
|
10841
|
+
});
|
|
10842
|
+
}
|
|
10843
|
+
static async fromRulesyncPermissions({
|
|
10844
|
+
outputRoot = process.cwd(),
|
|
10845
|
+
rulesyncPermissions,
|
|
10846
|
+
validate = true,
|
|
10847
|
+
logger,
|
|
10848
|
+
global = false
|
|
10849
|
+
}) {
|
|
10850
|
+
const paths = this.getSettablePaths({ global });
|
|
10851
|
+
const filePath = join68(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10852
|
+
const existingContent = await readFileContentOrNull(filePath) ?? smolToml4.stringify({});
|
|
10853
|
+
const parsed = toMutableTable(smolToml4.parse(existingContent));
|
|
10854
|
+
const profile = convertRulesyncToCodexProfile({
|
|
10855
|
+
config: rulesyncPermissions.getJson(),
|
|
10856
|
+
logger
|
|
10857
|
+
});
|
|
10858
|
+
const permissionsTable = toMutableTable(parsed.permissions);
|
|
10859
|
+
permissionsTable[RULESYNC_PROFILE_NAME] = profile;
|
|
10860
|
+
parsed.permissions = permissionsTable;
|
|
10861
|
+
parsed.default_permissions = RULESYNC_PROFILE_NAME;
|
|
10862
|
+
return new _CodexcliPermissions({
|
|
10863
|
+
outputRoot,
|
|
10864
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10865
|
+
relativeFilePath: paths.relativeFilePath,
|
|
10866
|
+
fileContent: smolToml4.stringify(parsed),
|
|
10867
|
+
validate
|
|
10868
|
+
});
|
|
10869
|
+
}
|
|
10870
|
+
toRulesyncPermissions() {
|
|
10871
|
+
let parsed;
|
|
10872
|
+
try {
|
|
10873
|
+
parsed = smolToml4.parse(this.getFileContent());
|
|
10874
|
+
} catch (error) {
|
|
10875
|
+
throw new Error(
|
|
10876
|
+
`Failed to parse Codex CLI permissions content in ${join68(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10877
|
+
{ cause: error }
|
|
10878
|
+
);
|
|
10879
|
+
}
|
|
10880
|
+
const table = toMutableTable(parsed);
|
|
10881
|
+
const defaultProfile = typeof table.default_permissions === "string" ? table.default_permissions : void 0;
|
|
10882
|
+
const permissionsTable = toMutableTable(table.permissions);
|
|
10883
|
+
const profile = toCodexProfile(permissionsTable[defaultProfile ?? RULESYNC_PROFILE_NAME]) ?? toCodexProfile(permissionsTable[RULESYNC_PROFILE_NAME]);
|
|
10884
|
+
const config = convertCodexProfileToRulesync(profile);
|
|
10885
|
+
return this.toRulesyncPermissionsDefault({
|
|
10886
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
10887
|
+
});
|
|
10888
|
+
}
|
|
10889
|
+
validate() {
|
|
10890
|
+
return { success: true, error: null };
|
|
10891
|
+
}
|
|
10892
|
+
static forDeletion({
|
|
10893
|
+
outputRoot = process.cwd(),
|
|
10894
|
+
relativeDirPath,
|
|
10895
|
+
relativeFilePath
|
|
10404
10896
|
}) {
|
|
10405
10897
|
return new _CodexcliPermissions({
|
|
10406
10898
|
outputRoot,
|
|
@@ -10422,7 +10914,7 @@ function createCodexcliBashRulesFile({
|
|
|
10422
10914
|
}) {
|
|
10423
10915
|
return new CodexcliRulesFile({
|
|
10424
10916
|
outputRoot,
|
|
10425
|
-
relativeDirPath:
|
|
10917
|
+
relativeDirPath: join68(".codex", "rules"),
|
|
10426
10918
|
relativeFilePath: RULESYNC_BASH_RULES_FILE_NAME,
|
|
10427
10919
|
fileContent: buildCodexBashRulesContent(config)
|
|
10428
10920
|
});
|
|
@@ -10577,8 +11069,8 @@ function mapBashActionToDecision(action) {
|
|
|
10577
11069
|
}
|
|
10578
11070
|
|
|
10579
11071
|
// src/features/permissions/cursor-permissions.ts
|
|
10580
|
-
import { join as
|
|
10581
|
-
import { uniq as
|
|
11072
|
+
import { join as join69 } from "path";
|
|
11073
|
+
import { uniq as uniq5 } from "es-toolkit";
|
|
10582
11074
|
var CANONICAL_TO_CURSOR_TYPE = {
|
|
10583
11075
|
bash: "Shell",
|
|
10584
11076
|
read: "Read",
|
|
@@ -10695,7 +11187,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10695
11187
|
global = false
|
|
10696
11188
|
}) {
|
|
10697
11189
|
const paths = _CursorPermissions.getSettablePaths({ global });
|
|
10698
|
-
const filePath =
|
|
11190
|
+
const filePath = join69(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10699
11191
|
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
10700
11192
|
return new _CursorPermissions({
|
|
10701
11193
|
outputRoot,
|
|
@@ -10712,7 +11204,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10712
11204
|
global = false
|
|
10713
11205
|
}) {
|
|
10714
11206
|
const paths = _CursorPermissions.getSettablePaths({ global });
|
|
10715
|
-
const filePath =
|
|
11207
|
+
const filePath = join69(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10716
11208
|
const existingContent = await readOrInitializeFileContent(
|
|
10717
11209
|
filePath,
|
|
10718
11210
|
JSON.stringify({}, null, 2)
|
|
@@ -10756,8 +11248,8 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10756
11248
|
const mergedPermissions = {
|
|
10757
11249
|
...existingPermissions
|
|
10758
11250
|
};
|
|
10759
|
-
const mergedAllow =
|
|
10760
|
-
const mergedDeny =
|
|
11251
|
+
const mergedAllow = uniq5([...preservedAllow, ...allow].toSorted());
|
|
11252
|
+
const mergedDeny = uniq5([...preservedDeny, ...deny].toSorted());
|
|
10761
11253
|
if (mergedAllow.length > 0) {
|
|
10762
11254
|
mergedPermissions.allow = mergedAllow;
|
|
10763
11255
|
} else {
|
|
@@ -10788,7 +11280,7 @@ var CursorPermissions = class _CursorPermissions extends ToolPermissions {
|
|
|
10788
11280
|
settings = asCursorCliConfig(JSON.parse(this.getFileContent()));
|
|
10789
11281
|
} catch (error) {
|
|
10790
11282
|
throw new Error(
|
|
10791
|
-
`Failed to parse Cursor CLI permissions content in ${
|
|
11283
|
+
`Failed to parse Cursor CLI permissions content in ${join69(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10792
11284
|
{ cause: error }
|
|
10793
11285
|
);
|
|
10794
11286
|
}
|
|
@@ -10863,10 +11355,10 @@ function convertCursorToRulesyncPermissions(params) {
|
|
|
10863
11355
|
}
|
|
10864
11356
|
|
|
10865
11357
|
// src/features/permissions/geminicli-permissions.ts
|
|
10866
|
-
import { join as
|
|
11358
|
+
import { join as join70 } from "path";
|
|
10867
11359
|
import * as smolToml5 from "smol-toml";
|
|
10868
|
-
import { z as
|
|
10869
|
-
var GEMINICLI_POLICY_RELATIVE_DIR_PATH =
|
|
11360
|
+
import { z as z32 } from "zod/mini";
|
|
11361
|
+
var GEMINICLI_POLICY_RELATIVE_DIR_PATH = join70(".gemini", "policies");
|
|
10870
11362
|
var GEMINICLI_POLICY_FILE_NAME = "rulesync.toml";
|
|
10871
11363
|
var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
|
|
10872
11364
|
bash: "run_shell_command",
|
|
@@ -10907,7 +11399,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
10907
11399
|
global = false
|
|
10908
11400
|
}) {
|
|
10909
11401
|
const paths = this.getSettablePaths({ global });
|
|
10910
|
-
const filePath =
|
|
11402
|
+
const filePath = join70(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
10911
11403
|
const fileContent = await readFileContentOrNull(filePath) ?? "";
|
|
10912
11404
|
return new _GeminicliPermissions({
|
|
10913
11405
|
outputRoot,
|
|
@@ -10943,7 +11435,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
10943
11435
|
parsed = smolToml5.parse(fileContent);
|
|
10944
11436
|
} catch (error) {
|
|
10945
11437
|
throw new Error(
|
|
10946
|
-
`Failed to parse Gemini CLI policy TOML in ${
|
|
11438
|
+
`Failed to parse Gemini CLI policy TOML in ${join70(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
10947
11439
|
{ cause: error }
|
|
10948
11440
|
);
|
|
10949
11441
|
}
|
|
@@ -11193,14 +11685,14 @@ function regexToGlobPattern(regex) {
|
|
|
11193
11685
|
}
|
|
11194
11686
|
return glob;
|
|
11195
11687
|
}
|
|
11196
|
-
var GeminicliPolicyRuleSchema =
|
|
11197
|
-
toolName:
|
|
11198
|
-
decision:
|
|
11199
|
-
commandPrefix:
|
|
11200
|
-
argsPattern:
|
|
11688
|
+
var GeminicliPolicyRuleSchema = z32.looseObject({
|
|
11689
|
+
toolName: z32.string(),
|
|
11690
|
+
decision: z32.optional(z32.unknown()),
|
|
11691
|
+
commandPrefix: z32.optional(z32.string()),
|
|
11692
|
+
argsPattern: z32.optional(z32.string())
|
|
11201
11693
|
});
|
|
11202
|
-
var GeminicliPolicyFileSchema =
|
|
11203
|
-
rule:
|
|
11694
|
+
var GeminicliPolicyFileSchema = z32.looseObject({
|
|
11695
|
+
rule: z32.optional(z32.array(z32.looseObject({})))
|
|
11204
11696
|
});
|
|
11205
11697
|
function extractRules(parsed, logger) {
|
|
11206
11698
|
const parsedFile = GeminicliPolicyFileSchema.safeParse(parsed);
|
|
@@ -11234,18 +11726,192 @@ function extractPattern(rule) {
|
|
|
11234
11726
|
return regexToGlobPattern(regex);
|
|
11235
11727
|
}
|
|
11236
11728
|
|
|
11729
|
+
// src/features/permissions/kilo-permissions.ts
|
|
11730
|
+
import { join as join71 } from "path";
|
|
11731
|
+
import { parse as parseJsonc5, printParseErrorCode } from "jsonc-parser";
|
|
11732
|
+
import { z as z33 } from "zod/mini";
|
|
11733
|
+
var KiloPermissionSchema = z33.union([
|
|
11734
|
+
z33.enum(["allow", "ask", "deny"]),
|
|
11735
|
+
z33.record(z33.string(), z33.enum(["allow", "ask", "deny"]))
|
|
11736
|
+
]);
|
|
11737
|
+
var KiloPermissionsConfigSchema = z33.looseObject({
|
|
11738
|
+
permission: z33.optional(z33.record(z33.string(), KiloPermissionSchema))
|
|
11739
|
+
});
|
|
11740
|
+
var KILO_FILE_NAME = "kilo.jsonc";
|
|
11741
|
+
function parseKiloJsoncStrict(content, filePath) {
|
|
11742
|
+
const errors = [];
|
|
11743
|
+
const parsed = parseJsonc5(content, errors, { allowTrailingComma: true });
|
|
11744
|
+
const first = errors[0];
|
|
11745
|
+
if (first) {
|
|
11746
|
+
throw new Error(
|
|
11747
|
+
`Failed to parse Kilo Code config at ${filePath}: ${printParseErrorCode(first.error)} at offset ${first.offset}`
|
|
11748
|
+
);
|
|
11749
|
+
}
|
|
11750
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
11751
|
+
return parsed;
|
|
11752
|
+
}
|
|
11753
|
+
return {};
|
|
11754
|
+
}
|
|
11755
|
+
function collectKiloDenyPatterns(value) {
|
|
11756
|
+
if (typeof value === "string") {
|
|
11757
|
+
return value === "deny" ? ["*"] : [];
|
|
11758
|
+
}
|
|
11759
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
11760
|
+
const patterns = [];
|
|
11761
|
+
for (const [pattern, action] of Object.entries(value)) {
|
|
11762
|
+
if (action === "deny") {
|
|
11763
|
+
patterns.push(pattern);
|
|
11764
|
+
}
|
|
11765
|
+
}
|
|
11766
|
+
return patterns;
|
|
11767
|
+
}
|
|
11768
|
+
return [];
|
|
11769
|
+
}
|
|
11770
|
+
var KiloPermissions = class _KiloPermissions extends ToolPermissions {
|
|
11771
|
+
json;
|
|
11772
|
+
constructor(params) {
|
|
11773
|
+
super(params);
|
|
11774
|
+
const parsed = parseJsonc5(this.fileContent || "{}");
|
|
11775
|
+
if (params.validate !== false) {
|
|
11776
|
+
this.json = KiloPermissionsConfigSchema.parse(parsed);
|
|
11777
|
+
} else {
|
|
11778
|
+
const result = KiloPermissionsConfigSchema.safeParse(parsed);
|
|
11779
|
+
this.json = result.success ? result.data : {};
|
|
11780
|
+
}
|
|
11781
|
+
}
|
|
11782
|
+
getJson() {
|
|
11783
|
+
return this.json;
|
|
11784
|
+
}
|
|
11785
|
+
isDeletable() {
|
|
11786
|
+
return false;
|
|
11787
|
+
}
|
|
11788
|
+
static getSettablePaths({
|
|
11789
|
+
global = false
|
|
11790
|
+
} = {}) {
|
|
11791
|
+
return global ? { relativeDirPath: join71(".config", "kilo"), relativeFilePath: KILO_FILE_NAME } : { relativeDirPath: ".", relativeFilePath: KILO_FILE_NAME };
|
|
11792
|
+
}
|
|
11793
|
+
static async fromFile({
|
|
11794
|
+
outputRoot = process.cwd(),
|
|
11795
|
+
validate = true,
|
|
11796
|
+
global = false
|
|
11797
|
+
}) {
|
|
11798
|
+
const basePaths = _KiloPermissions.getSettablePaths({ global });
|
|
11799
|
+
const filePath = join71(outputRoot, basePaths.relativeDirPath, basePaths.relativeFilePath);
|
|
11800
|
+
const fileContent = await readFileContentOrNull(filePath);
|
|
11801
|
+
const parsed = parseKiloJsoncStrict(fileContent ?? "{}", filePath);
|
|
11802
|
+
const nextJson = { ...parsed, permission: parsed.permission ?? {} };
|
|
11803
|
+
return new _KiloPermissions({
|
|
11804
|
+
outputRoot,
|
|
11805
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
11806
|
+
relativeFilePath: basePaths.relativeFilePath,
|
|
11807
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
11808
|
+
validate
|
|
11809
|
+
});
|
|
11810
|
+
}
|
|
11811
|
+
static async fromRulesyncPermissions({
|
|
11812
|
+
outputRoot = process.cwd(),
|
|
11813
|
+
rulesyncPermissions,
|
|
11814
|
+
global = false,
|
|
11815
|
+
logger
|
|
11816
|
+
}) {
|
|
11817
|
+
const basePaths = _KiloPermissions.getSettablePaths({ global });
|
|
11818
|
+
const filePath = join71(outputRoot, basePaths.relativeDirPath, basePaths.relativeFilePath);
|
|
11819
|
+
const fileContent = await readFileContentOrNull(filePath);
|
|
11820
|
+
const parsed = parseKiloJsoncStrict(fileContent ?? "{}", filePath);
|
|
11821
|
+
const parsedPermission = parsed.permission;
|
|
11822
|
+
const existingPermission = parsedPermission && typeof parsedPermission === "object" && !Array.isArray(parsedPermission) ? { ...parsedPermission } : {};
|
|
11823
|
+
const rulesyncPermission = rulesyncPermissions.getJson().permission;
|
|
11824
|
+
const droppedDenyByKey = {};
|
|
11825
|
+
for (const key of Object.keys(rulesyncPermission)) {
|
|
11826
|
+
const previous = existingPermission[key];
|
|
11827
|
+
const previousDenyPatterns = collectKiloDenyPatterns(previous);
|
|
11828
|
+
const nextDenyPatterns = new Set(collectKiloDenyPatterns(rulesyncPermission[key]));
|
|
11829
|
+
const dropped = previousDenyPatterns.filter((p) => !nextDenyPatterns.has(p));
|
|
11830
|
+
if (dropped.length > 0) {
|
|
11831
|
+
droppedDenyByKey[key] = dropped;
|
|
11832
|
+
}
|
|
11833
|
+
}
|
|
11834
|
+
if (Object.keys(droppedDenyByKey).length > 0) {
|
|
11835
|
+
const summary = Object.entries(droppedDenyByKey).map(([key, patterns]) => `${key}: [${patterns.join(", ")}]`).join("; ");
|
|
11836
|
+
logger?.warn(
|
|
11837
|
+
`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'.`
|
|
11838
|
+
);
|
|
11839
|
+
}
|
|
11840
|
+
const mergedPermission = { ...existingPermission };
|
|
11841
|
+
for (const [key, value] of Object.entries(rulesyncPermission)) {
|
|
11842
|
+
mergedPermission[key] = value;
|
|
11843
|
+
}
|
|
11844
|
+
const nextJson = {
|
|
11845
|
+
...parsed,
|
|
11846
|
+
permission: mergedPermission
|
|
11847
|
+
};
|
|
11848
|
+
return new _KiloPermissions({
|
|
11849
|
+
outputRoot,
|
|
11850
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
11851
|
+
relativeFilePath: basePaths.relativeFilePath,
|
|
11852
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
11853
|
+
validate: true
|
|
11854
|
+
});
|
|
11855
|
+
}
|
|
11856
|
+
toRulesyncPermissions() {
|
|
11857
|
+
const permission = this.normalizePermission(this.json.permission);
|
|
11858
|
+
return this.toRulesyncPermissionsDefault({
|
|
11859
|
+
fileContent: JSON.stringify({ permission }, null, 2)
|
|
11860
|
+
});
|
|
11861
|
+
}
|
|
11862
|
+
validate() {
|
|
11863
|
+
try {
|
|
11864
|
+
const json = parseJsonc5(this.fileContent || "{}");
|
|
11865
|
+
const result = KiloPermissionsConfigSchema.safeParse(json);
|
|
11866
|
+
if (!result.success) {
|
|
11867
|
+
return { success: false, error: result.error };
|
|
11868
|
+
}
|
|
11869
|
+
return { success: true, error: null };
|
|
11870
|
+
} catch (error) {
|
|
11871
|
+
return {
|
|
11872
|
+
success: false,
|
|
11873
|
+
error: new Error(`Failed to parse Kilo permissions JSON: ${formatError(error)}`)
|
|
11874
|
+
};
|
|
11875
|
+
}
|
|
11876
|
+
}
|
|
11877
|
+
static forDeletion({
|
|
11878
|
+
outputRoot = process.cwd(),
|
|
11879
|
+
relativeDirPath,
|
|
11880
|
+
relativeFilePath
|
|
11881
|
+
}) {
|
|
11882
|
+
return new _KiloPermissions({
|
|
11883
|
+
outputRoot,
|
|
11884
|
+
relativeDirPath,
|
|
11885
|
+
relativeFilePath,
|
|
11886
|
+
fileContent: JSON.stringify({ permission: {} }, null, 2),
|
|
11887
|
+
validate: false
|
|
11888
|
+
});
|
|
11889
|
+
}
|
|
11890
|
+
normalizePermission(permission) {
|
|
11891
|
+
if (!permission) {
|
|
11892
|
+
return {};
|
|
11893
|
+
}
|
|
11894
|
+
return Object.fromEntries(
|
|
11895
|
+
Object.entries(permission).map(([tool, value]) => [
|
|
11896
|
+
tool,
|
|
11897
|
+
typeof value === "string" ? { "*": value } : value
|
|
11898
|
+
])
|
|
11899
|
+
);
|
|
11900
|
+
}
|
|
11901
|
+
};
|
|
11902
|
+
|
|
11237
11903
|
// src/features/permissions/kiro-permissions.ts
|
|
11238
|
-
import { join as
|
|
11239
|
-
import { z as
|
|
11240
|
-
var KiroAgentSchema =
|
|
11241
|
-
allowedTools:
|
|
11242
|
-
toolsSettings:
|
|
11904
|
+
import { join as join72 } from "path";
|
|
11905
|
+
import { z as z34 } from "zod/mini";
|
|
11906
|
+
var KiroAgentSchema = z34.looseObject({
|
|
11907
|
+
allowedTools: z34.optional(z34.array(z34.string())),
|
|
11908
|
+
toolsSettings: z34.optional(z34.record(z34.string(), z34.unknown()))
|
|
11243
11909
|
});
|
|
11244
|
-
var UnknownRecordSchema =
|
|
11910
|
+
var UnknownRecordSchema = z34.record(z34.string(), z34.unknown());
|
|
11245
11911
|
var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
11246
11912
|
static getSettablePaths(_options = {}) {
|
|
11247
11913
|
return {
|
|
11248
|
-
relativeDirPath:
|
|
11914
|
+
relativeDirPath: join72(".kiro", "agents"),
|
|
11249
11915
|
relativeFilePath: "default.json"
|
|
11250
11916
|
};
|
|
11251
11917
|
}
|
|
@@ -11257,7 +11923,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
11257
11923
|
validate = true
|
|
11258
11924
|
}) {
|
|
11259
11925
|
const paths = this.getSettablePaths();
|
|
11260
|
-
const filePath =
|
|
11926
|
+
const filePath = join72(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
11261
11927
|
const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
11262
11928
|
return new _KiroPermissions({
|
|
11263
11929
|
outputRoot,
|
|
@@ -11274,7 +11940,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
11274
11940
|
logger
|
|
11275
11941
|
}) {
|
|
11276
11942
|
const paths = this.getSettablePaths();
|
|
11277
|
-
const filePath =
|
|
11943
|
+
const filePath = join72(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
11278
11944
|
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
11279
11945
|
const parsedResult = KiroAgentSchema.safeParse(JSON.parse(existingContent));
|
|
11280
11946
|
if (!parsedResult.success) {
|
|
@@ -11298,7 +11964,7 @@ var KiroPermissions = class _KiroPermissions extends ToolPermissions {
|
|
|
11298
11964
|
parsed = KiroAgentSchema.parse(JSON.parse(this.getFileContent()));
|
|
11299
11965
|
} catch (error) {
|
|
11300
11966
|
throw new Error(
|
|
11301
|
-
`Failed to parse Kiro permissions content in ${
|
|
11967
|
+
`Failed to parse Kiro permissions content in ${join72(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
11302
11968
|
{ cause: error }
|
|
11303
11969
|
);
|
|
11304
11970
|
}
|
|
@@ -11423,21 +12089,21 @@ function asStringArray(value) {
|
|
|
11423
12089
|
}
|
|
11424
12090
|
|
|
11425
12091
|
// src/features/permissions/opencode-permissions.ts
|
|
11426
|
-
import { join as
|
|
11427
|
-
import { parse as
|
|
11428
|
-
import { z as
|
|
11429
|
-
var OpencodePermissionSchema =
|
|
11430
|
-
|
|
11431
|
-
|
|
12092
|
+
import { join as join73 } from "path";
|
|
12093
|
+
import { parse as parseJsonc6 } from "jsonc-parser";
|
|
12094
|
+
import { z as z35 } from "zod/mini";
|
|
12095
|
+
var OpencodePermissionSchema = z35.union([
|
|
12096
|
+
z35.enum(["allow", "ask", "deny"]),
|
|
12097
|
+
z35.record(z35.string(), z35.enum(["allow", "ask", "deny"]))
|
|
11432
12098
|
]);
|
|
11433
|
-
var OpencodePermissionsConfigSchema =
|
|
11434
|
-
permission:
|
|
12099
|
+
var OpencodePermissionsConfigSchema = z35.looseObject({
|
|
12100
|
+
permission: z35.optional(z35.record(z35.string(), OpencodePermissionSchema))
|
|
11435
12101
|
});
|
|
11436
12102
|
var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
11437
12103
|
json;
|
|
11438
12104
|
constructor(params) {
|
|
11439
12105
|
super(params);
|
|
11440
|
-
this.json = OpencodePermissionsConfigSchema.parse(
|
|
12106
|
+
this.json = OpencodePermissionsConfigSchema.parse(parseJsonc6(this.fileContent || "{}"));
|
|
11441
12107
|
}
|
|
11442
12108
|
getJson() {
|
|
11443
12109
|
return this.json;
|
|
@@ -11448,7 +12114,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11448
12114
|
static getSettablePaths({
|
|
11449
12115
|
global = false
|
|
11450
12116
|
} = {}) {
|
|
11451
|
-
return global ? { relativeDirPath:
|
|
12117
|
+
return global ? { relativeDirPath: join73(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
|
|
11452
12118
|
}
|
|
11453
12119
|
static async fromFile({
|
|
11454
12120
|
outputRoot = process.cwd(),
|
|
@@ -11456,9 +12122,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11456
12122
|
global = false
|
|
11457
12123
|
}) {
|
|
11458
12124
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
11459
|
-
const jsonDir =
|
|
11460
|
-
const jsoncPath =
|
|
11461
|
-
const jsonPath =
|
|
12125
|
+
const jsonDir = join73(outputRoot, basePaths.relativeDirPath);
|
|
12126
|
+
const jsoncPath = join73(jsonDir, "opencode.jsonc");
|
|
12127
|
+
const jsonPath = join73(jsonDir, "opencode.json");
|
|
11462
12128
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
11463
12129
|
let relativeFilePath = "opencode.jsonc";
|
|
11464
12130
|
if (!fileContent) {
|
|
@@ -11467,7 +12133,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11467
12133
|
relativeFilePath = "opencode.json";
|
|
11468
12134
|
}
|
|
11469
12135
|
}
|
|
11470
|
-
const parsed =
|
|
12136
|
+
const parsed = parseJsonc6(fileContent ?? "{}");
|
|
11471
12137
|
const nextJson = { ...parsed, permission: parsed.permission ?? {} };
|
|
11472
12138
|
return new _OpencodePermissions({
|
|
11473
12139
|
outputRoot,
|
|
@@ -11483,9 +12149,9 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11483
12149
|
global = false
|
|
11484
12150
|
}) {
|
|
11485
12151
|
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
11486
|
-
const jsonDir =
|
|
11487
|
-
const jsoncPath =
|
|
11488
|
-
const jsonPath =
|
|
12152
|
+
const jsonDir = join73(outputRoot, basePaths.relativeDirPath);
|
|
12153
|
+
const jsoncPath = join73(jsonDir, "opencode.jsonc");
|
|
12154
|
+
const jsonPath = join73(jsonDir, "opencode.json");
|
|
11489
12155
|
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
11490
12156
|
let relativeFilePath = "opencode.jsonc";
|
|
11491
12157
|
if (!fileContent) {
|
|
@@ -11494,7 +12160,7 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11494
12160
|
relativeFilePath = "opencode.json";
|
|
11495
12161
|
}
|
|
11496
12162
|
}
|
|
11497
|
-
const parsed =
|
|
12163
|
+
const parsed = parseJsonc6(fileContent ?? "{}");
|
|
11498
12164
|
const nextJson = {
|
|
11499
12165
|
...parsed,
|
|
11500
12166
|
permission: rulesyncPermissions.getJson().permission
|
|
@@ -11510,61 +12176,333 @@ var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
|
11510
12176
|
toRulesyncPermissions() {
|
|
11511
12177
|
const permission = this.normalizePermission(this.json.permission);
|
|
11512
12178
|
return this.toRulesyncPermissionsDefault({
|
|
11513
|
-
fileContent: JSON.stringify({ permission }, null, 2)
|
|
12179
|
+
fileContent: JSON.stringify({ permission }, null, 2)
|
|
12180
|
+
});
|
|
12181
|
+
}
|
|
12182
|
+
validate() {
|
|
12183
|
+
try {
|
|
12184
|
+
const json = JSON.parse(this.fileContent || "{}");
|
|
12185
|
+
const result = OpencodePermissionsConfigSchema.safeParse(json);
|
|
12186
|
+
if (!result.success) {
|
|
12187
|
+
return { success: false, error: result.error };
|
|
12188
|
+
}
|
|
12189
|
+
return { success: true, error: null };
|
|
12190
|
+
} catch (error) {
|
|
12191
|
+
return {
|
|
12192
|
+
success: false,
|
|
12193
|
+
error: new Error(`Failed to parse OpenCode permissions JSON: ${formatError(error)}`)
|
|
12194
|
+
};
|
|
12195
|
+
}
|
|
12196
|
+
}
|
|
12197
|
+
static forDeletion({
|
|
12198
|
+
outputRoot = process.cwd(),
|
|
12199
|
+
relativeDirPath,
|
|
12200
|
+
relativeFilePath
|
|
12201
|
+
}) {
|
|
12202
|
+
return new _OpencodePermissions({
|
|
12203
|
+
outputRoot,
|
|
12204
|
+
relativeDirPath,
|
|
12205
|
+
relativeFilePath,
|
|
12206
|
+
fileContent: JSON.stringify({ permission: {} }, null, 2),
|
|
12207
|
+
validate: false
|
|
12208
|
+
});
|
|
12209
|
+
}
|
|
12210
|
+
normalizePermission(permission) {
|
|
12211
|
+
if (!permission) {
|
|
12212
|
+
return {};
|
|
12213
|
+
}
|
|
12214
|
+
return Object.fromEntries(
|
|
12215
|
+
Object.entries(permission).map(([tool, value]) => [
|
|
12216
|
+
tool,
|
|
12217
|
+
typeof value === "string" ? { "*": value } : value
|
|
12218
|
+
])
|
|
12219
|
+
);
|
|
12220
|
+
}
|
|
12221
|
+
};
|
|
12222
|
+
|
|
12223
|
+
// src/features/permissions/qwencode-permissions.ts
|
|
12224
|
+
import { join as join74 } from "path";
|
|
12225
|
+
import { uniq as uniq6 } from "es-toolkit";
|
|
12226
|
+
import { z as z36 } from "zod/mini";
|
|
12227
|
+
var QwenSettingsPermissionsSchema = z36.looseObject({
|
|
12228
|
+
allow: z36.optional(z36.array(z36.string())),
|
|
12229
|
+
ask: z36.optional(z36.array(z36.string())),
|
|
12230
|
+
deny: z36.optional(z36.array(z36.string()))
|
|
12231
|
+
});
|
|
12232
|
+
var QwenSettingsSchema = z36.looseObject({
|
|
12233
|
+
permissions: z36.optional(QwenSettingsPermissionsSchema)
|
|
12234
|
+
});
|
|
12235
|
+
var moduleLogger2 = new ConsoleLogger();
|
|
12236
|
+
var CANONICAL_TO_QWEN_TOOL_NAMES = {
|
|
12237
|
+
bash: "Bash",
|
|
12238
|
+
read: "Read",
|
|
12239
|
+
edit: "Edit",
|
|
12240
|
+
write: "Write",
|
|
12241
|
+
webfetch: "WebFetch",
|
|
12242
|
+
websearch: "WebSearch",
|
|
12243
|
+
grep: "Grep",
|
|
12244
|
+
glob: "Glob",
|
|
12245
|
+
agent: "Agent"
|
|
12246
|
+
};
|
|
12247
|
+
var QWEN_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
12248
|
+
Object.entries(CANONICAL_TO_QWEN_TOOL_NAMES).map(([k, v]) => [v, k])
|
|
12249
|
+
);
|
|
12250
|
+
function toQwenToolName(canonical) {
|
|
12251
|
+
return CANONICAL_TO_QWEN_TOOL_NAMES[canonical] ?? canonical;
|
|
12252
|
+
}
|
|
12253
|
+
function toCanonicalToolName3(qwenName) {
|
|
12254
|
+
return QWEN_TO_CANONICAL_TOOL_NAMES[qwenName] ?? qwenName;
|
|
12255
|
+
}
|
|
12256
|
+
function parseQwenPermissionEntry(entry, options = {}) {
|
|
12257
|
+
const parenIndex = entry.indexOf("(");
|
|
12258
|
+
if (parenIndex === -1) {
|
|
12259
|
+
return { ok: true, toolName: entry, pattern: "*" };
|
|
12260
|
+
}
|
|
12261
|
+
const toolName = entry.slice(0, parenIndex);
|
|
12262
|
+
const lastParenIndex = entry.lastIndexOf(")");
|
|
12263
|
+
if (lastParenIndex < parenIndex) {
|
|
12264
|
+
options.logger?.warn(
|
|
12265
|
+
`Qwen permissions: malformed entry '${entry}' is missing a closing parenthesis.`
|
|
12266
|
+
);
|
|
12267
|
+
return { ok: false, toolName, raw: entry };
|
|
12268
|
+
}
|
|
12269
|
+
if (lastParenIndex !== entry.length - 1) {
|
|
12270
|
+
options.logger?.warn(
|
|
12271
|
+
`Qwen permissions: malformed entry '${entry}' has trailing characters after the closing parenthesis.`
|
|
12272
|
+
);
|
|
12273
|
+
return { ok: false, toolName, raw: entry };
|
|
12274
|
+
}
|
|
12275
|
+
const pattern = entry.slice(parenIndex + 1, lastParenIndex);
|
|
12276
|
+
return { ok: true, toolName, pattern: pattern || "*" };
|
|
12277
|
+
}
|
|
12278
|
+
function buildQwenPermissionEntry(toolName, pattern) {
|
|
12279
|
+
if (pattern === "*") {
|
|
12280
|
+
return toolName;
|
|
12281
|
+
}
|
|
12282
|
+
return `${toolName}(${pattern})`;
|
|
12283
|
+
}
|
|
12284
|
+
var QwencodePermissions = class _QwencodePermissions extends ToolPermissions {
|
|
12285
|
+
constructor(params) {
|
|
12286
|
+
super({
|
|
12287
|
+
...params,
|
|
12288
|
+
fileContent: params.fileContent ?? "{}"
|
|
12289
|
+
});
|
|
12290
|
+
}
|
|
12291
|
+
isDeletable() {
|
|
12292
|
+
return false;
|
|
12293
|
+
}
|
|
12294
|
+
static getSettablePaths(_options = {}) {
|
|
12295
|
+
return {
|
|
12296
|
+
relativeDirPath: ".qwen",
|
|
12297
|
+
relativeFilePath: "settings.json"
|
|
12298
|
+
};
|
|
12299
|
+
}
|
|
12300
|
+
static async fromFile({
|
|
12301
|
+
outputRoot = process.cwd(),
|
|
12302
|
+
validate = true,
|
|
12303
|
+
global = false
|
|
12304
|
+
}) {
|
|
12305
|
+
const paths = _QwencodePermissions.getSettablePaths({ global });
|
|
12306
|
+
const filePath = join74(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
12307
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
12308
|
+
return new _QwencodePermissions({
|
|
12309
|
+
outputRoot,
|
|
12310
|
+
relativeDirPath: paths.relativeDirPath,
|
|
12311
|
+
relativeFilePath: paths.relativeFilePath,
|
|
12312
|
+
fileContent,
|
|
12313
|
+
validate
|
|
12314
|
+
});
|
|
12315
|
+
}
|
|
12316
|
+
static async fromRulesyncPermissions({
|
|
12317
|
+
outputRoot = process.cwd(),
|
|
12318
|
+
rulesyncPermissions,
|
|
12319
|
+
global = false,
|
|
12320
|
+
logger
|
|
12321
|
+
}) {
|
|
12322
|
+
const paths = _QwencodePermissions.getSettablePaths({ global });
|
|
12323
|
+
const filePath = join74(outputRoot, paths.relativeDirPath, paths.relativeFilePath);
|
|
12324
|
+
const existingContent = await readFileContentOrNull(filePath) ?? "{}";
|
|
12325
|
+
let settings;
|
|
12326
|
+
try {
|
|
12327
|
+
const parsed = JSON.parse(existingContent);
|
|
12328
|
+
const result = QwenSettingsSchema.safeParse(parsed);
|
|
12329
|
+
if (!result.success) {
|
|
12330
|
+
throw new Error(formatError(result.error));
|
|
12331
|
+
}
|
|
12332
|
+
settings = result.data;
|
|
12333
|
+
} catch (error) {
|
|
12334
|
+
throw new Error(
|
|
12335
|
+
`Failed to parse existing Qwen settings at ${filePath}: ${formatError(error)}`,
|
|
12336
|
+
{ cause: error }
|
|
12337
|
+
);
|
|
12338
|
+
}
|
|
12339
|
+
const config = rulesyncPermissions.getJson();
|
|
12340
|
+
const { allow, ask, deny } = convertRulesyncToQwenPermissions(config);
|
|
12341
|
+
const managedToolNames = new Set(
|
|
12342
|
+
Object.keys(config.permission).map((category) => toQwenToolName(category))
|
|
12343
|
+
);
|
|
12344
|
+
const existingPermissions = settings.permissions ?? {};
|
|
12345
|
+
const preservedAllow = (existingPermissions.allow ?? []).filter(
|
|
12346
|
+
(entry) => !managedToolNames.has(parseQwenPermissionEntry(entry, { logger }).toolName)
|
|
12347
|
+
);
|
|
12348
|
+
const preservedAsk = (existingPermissions.ask ?? []).filter(
|
|
12349
|
+
(entry) => !managedToolNames.has(parseQwenPermissionEntry(entry, { logger }).toolName)
|
|
12350
|
+
);
|
|
12351
|
+
const preservedDeny = (existingPermissions.deny ?? []).filter(
|
|
12352
|
+
(entry) => !managedToolNames.has(parseQwenPermissionEntry(entry, { logger }).toolName)
|
|
12353
|
+
);
|
|
12354
|
+
const mergedPermissions = {
|
|
12355
|
+
...existingPermissions
|
|
12356
|
+
};
|
|
12357
|
+
const mergedAllow = uniq6([...preservedAllow, ...allow].toSorted());
|
|
12358
|
+
const mergedAsk = uniq6([...preservedAsk, ...ask].toSorted());
|
|
12359
|
+
const mergedDeny = uniq6([...preservedDeny, ...deny].toSorted());
|
|
12360
|
+
if (mergedAllow.length > 0) {
|
|
12361
|
+
mergedPermissions.allow = mergedAllow;
|
|
12362
|
+
} else {
|
|
12363
|
+
delete mergedPermissions.allow;
|
|
12364
|
+
}
|
|
12365
|
+
if (mergedAsk.length > 0) {
|
|
12366
|
+
mergedPermissions.ask = mergedAsk;
|
|
12367
|
+
} else {
|
|
12368
|
+
delete mergedPermissions.ask;
|
|
12369
|
+
}
|
|
12370
|
+
if (mergedDeny.length > 0) {
|
|
12371
|
+
mergedPermissions.deny = mergedDeny;
|
|
12372
|
+
} else {
|
|
12373
|
+
delete mergedPermissions.deny;
|
|
12374
|
+
}
|
|
12375
|
+
const merged = { ...settings, permissions: mergedPermissions };
|
|
12376
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
12377
|
+
return new _QwencodePermissions({
|
|
12378
|
+
outputRoot,
|
|
12379
|
+
relativeDirPath: paths.relativeDirPath,
|
|
12380
|
+
relativeFilePath: paths.relativeFilePath,
|
|
12381
|
+
fileContent,
|
|
12382
|
+
validate: true
|
|
12383
|
+
});
|
|
12384
|
+
}
|
|
12385
|
+
toRulesyncPermissions() {
|
|
12386
|
+
let settings;
|
|
12387
|
+
try {
|
|
12388
|
+
const parsed = JSON.parse(this.getFileContent());
|
|
12389
|
+
const result = QwenSettingsSchema.safeParse(parsed);
|
|
12390
|
+
if (!result.success) {
|
|
12391
|
+
throw new Error(formatError(result.error));
|
|
12392
|
+
}
|
|
12393
|
+
settings = result.data;
|
|
12394
|
+
} catch (error) {
|
|
12395
|
+
throw new Error(
|
|
12396
|
+
`Failed to parse Qwen permissions content in ${join74(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
12397
|
+
{ cause: error }
|
|
12398
|
+
);
|
|
12399
|
+
}
|
|
12400
|
+
const permissions = settings.permissions ?? {};
|
|
12401
|
+
const config = convertQwenToRulesyncPermissions({
|
|
12402
|
+
allow: permissions.allow ?? [],
|
|
12403
|
+
ask: permissions.ask ?? [],
|
|
12404
|
+
deny: permissions.deny ?? []
|
|
12405
|
+
});
|
|
12406
|
+
return this.toRulesyncPermissionsDefault({
|
|
12407
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
11514
12408
|
});
|
|
11515
12409
|
}
|
|
11516
12410
|
validate() {
|
|
11517
|
-
|
|
11518
|
-
const json = JSON.parse(this.fileContent || "{}");
|
|
11519
|
-
const result = OpencodePermissionsConfigSchema.safeParse(json);
|
|
11520
|
-
if (!result.success) {
|
|
11521
|
-
return { success: false, error: result.error };
|
|
11522
|
-
}
|
|
11523
|
-
return { success: true, error: null };
|
|
11524
|
-
} catch (error) {
|
|
11525
|
-
return {
|
|
11526
|
-
success: false,
|
|
11527
|
-
error: new Error(`Failed to parse OpenCode permissions JSON: ${formatError(error)}`)
|
|
11528
|
-
};
|
|
11529
|
-
}
|
|
12411
|
+
return { success: true, error: null };
|
|
11530
12412
|
}
|
|
11531
12413
|
static forDeletion({
|
|
11532
12414
|
outputRoot = process.cwd(),
|
|
11533
12415
|
relativeDirPath,
|
|
11534
12416
|
relativeFilePath
|
|
11535
12417
|
}) {
|
|
11536
|
-
return new
|
|
12418
|
+
return new _QwencodePermissions({
|
|
11537
12419
|
outputRoot,
|
|
11538
12420
|
relativeDirPath,
|
|
11539
12421
|
relativeFilePath,
|
|
11540
|
-
fileContent: JSON.stringify({
|
|
12422
|
+
fileContent: JSON.stringify({ permissions: {} }, null, 2),
|
|
11541
12423
|
validate: false
|
|
11542
12424
|
});
|
|
11543
12425
|
}
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
12426
|
+
};
|
|
12427
|
+
function convertRulesyncToQwenPermissions(config) {
|
|
12428
|
+
const allow = [];
|
|
12429
|
+
const ask = [];
|
|
12430
|
+
const deny = [];
|
|
12431
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
12432
|
+
const qwenToolName = toQwenToolName(category);
|
|
12433
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
12434
|
+
const entry = buildQwenPermissionEntry(qwenToolName, pattern);
|
|
12435
|
+
switch (action) {
|
|
12436
|
+
case "allow":
|
|
12437
|
+
allow.push(entry);
|
|
12438
|
+
break;
|
|
12439
|
+
case "ask":
|
|
12440
|
+
ask.push(entry);
|
|
12441
|
+
break;
|
|
12442
|
+
case "deny":
|
|
12443
|
+
deny.push(entry);
|
|
12444
|
+
break;
|
|
12445
|
+
}
|
|
11547
12446
|
}
|
|
11548
|
-
return Object.fromEntries(
|
|
11549
|
-
Object.entries(permission).map(([tool, value]) => [
|
|
11550
|
-
tool,
|
|
11551
|
-
typeof value === "string" ? { "*": value } : value
|
|
11552
|
-
])
|
|
11553
|
-
);
|
|
11554
12447
|
}
|
|
11555
|
-
};
|
|
12448
|
+
return { allow, ask, deny };
|
|
12449
|
+
}
|
|
12450
|
+
function convertQwenToRulesyncPermissions(params) {
|
|
12451
|
+
const permission = {};
|
|
12452
|
+
const logger = params.logger ?? moduleLogger2;
|
|
12453
|
+
const processEntries = (entries, action) => {
|
|
12454
|
+
for (const entry of entries) {
|
|
12455
|
+
const parsed = parseQwenPermissionEntry(entry, { logger });
|
|
12456
|
+
if (!parsed.ok) {
|
|
12457
|
+
if (action === "deny") {
|
|
12458
|
+
const canonical2 = toCanonicalToolName3(parsed.toolName);
|
|
12459
|
+
if (!permission[canonical2]) {
|
|
12460
|
+
permission[canonical2] = {};
|
|
12461
|
+
}
|
|
12462
|
+
permission[canonical2]["*"] = action;
|
|
12463
|
+
}
|
|
12464
|
+
continue;
|
|
12465
|
+
}
|
|
12466
|
+
const { toolName, pattern } = parsed;
|
|
12467
|
+
const canonical = toCanonicalToolName3(toolName);
|
|
12468
|
+
if (!permission[canonical]) {
|
|
12469
|
+
permission[canonical] = {};
|
|
12470
|
+
}
|
|
12471
|
+
permission[canonical][pattern] = action;
|
|
12472
|
+
}
|
|
12473
|
+
};
|
|
12474
|
+
processEntries(params.allow, "allow");
|
|
12475
|
+
processEntries(params.ask, "ask");
|
|
12476
|
+
processEntries(params.deny, "deny");
|
|
12477
|
+
return { permission };
|
|
12478
|
+
}
|
|
11556
12479
|
|
|
11557
12480
|
// src/features/permissions/permissions-processor.ts
|
|
11558
12481
|
var permissionsProcessorToolTargetTuple = [
|
|
12482
|
+
"augmentcode",
|
|
11559
12483
|
"claudecode",
|
|
12484
|
+
"cline",
|
|
11560
12485
|
"codexcli",
|
|
11561
12486
|
"cursor",
|
|
11562
12487
|
"geminicli",
|
|
12488
|
+
"kilo",
|
|
11563
12489
|
"kiro",
|
|
11564
|
-
"opencode"
|
|
12490
|
+
"opencode",
|
|
12491
|
+
"qwencode"
|
|
11565
12492
|
];
|
|
11566
|
-
var PermissionsProcessorToolTargetSchema =
|
|
12493
|
+
var PermissionsProcessorToolTargetSchema = z37.enum(permissionsProcessorToolTargetTuple);
|
|
11567
12494
|
var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
12495
|
+
[
|
|
12496
|
+
"augmentcode",
|
|
12497
|
+
{
|
|
12498
|
+
class: AugmentcodePermissions,
|
|
12499
|
+
meta: {
|
|
12500
|
+
supportsProject: true,
|
|
12501
|
+
supportsGlobal: true,
|
|
12502
|
+
supportsImport: true
|
|
12503
|
+
}
|
|
12504
|
+
}
|
|
12505
|
+
],
|
|
11568
12506
|
[
|
|
11569
12507
|
"claudecode",
|
|
11570
12508
|
{
|
|
@@ -11576,6 +12514,17 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
|
11576
12514
|
}
|
|
11577
12515
|
}
|
|
11578
12516
|
],
|
|
12517
|
+
[
|
|
12518
|
+
"cline",
|
|
12519
|
+
{
|
|
12520
|
+
class: ClinePermissions,
|
|
12521
|
+
meta: {
|
|
12522
|
+
supportsProject: true,
|
|
12523
|
+
supportsGlobal: false,
|
|
12524
|
+
supportsImport: true
|
|
12525
|
+
}
|
|
12526
|
+
}
|
|
12527
|
+
],
|
|
11579
12528
|
[
|
|
11580
12529
|
"codexcli",
|
|
11581
12530
|
{
|
|
@@ -11609,6 +12558,17 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
|
11609
12558
|
}
|
|
11610
12559
|
}
|
|
11611
12560
|
],
|
|
12561
|
+
[
|
|
12562
|
+
"kilo",
|
|
12563
|
+
{
|
|
12564
|
+
class: KiloPermissions,
|
|
12565
|
+
meta: {
|
|
12566
|
+
supportsProject: true,
|
|
12567
|
+
supportsGlobal: true,
|
|
12568
|
+
supportsImport: true
|
|
12569
|
+
}
|
|
12570
|
+
}
|
|
12571
|
+
],
|
|
11612
12572
|
[
|
|
11613
12573
|
"kiro",
|
|
11614
12574
|
{
|
|
@@ -11630,6 +12590,17 @@ var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
|
11630
12590
|
supportsImport: true
|
|
11631
12591
|
}
|
|
11632
12592
|
}
|
|
12593
|
+
],
|
|
12594
|
+
[
|
|
12595
|
+
"qwencode",
|
|
12596
|
+
{
|
|
12597
|
+
class: QwencodePermissions,
|
|
12598
|
+
meta: {
|
|
12599
|
+
supportsProject: true,
|
|
12600
|
+
supportsGlobal: true,
|
|
12601
|
+
supportsImport: true
|
|
12602
|
+
}
|
|
12603
|
+
}
|
|
11633
12604
|
]
|
|
11634
12605
|
]);
|
|
11635
12606
|
var PermissionsProcessor = class extends FeatureProcessor {
|
|
@@ -11738,25 +12709,25 @@ var PermissionsProcessor = class extends FeatureProcessor {
|
|
|
11738
12709
|
};
|
|
11739
12710
|
|
|
11740
12711
|
// src/features/rules/rules-processor.ts
|
|
11741
|
-
import { basename as basename10, dirname as dirname3, join as
|
|
12712
|
+
import { basename as basename10, dirname as dirname3, join as join151, relative as relative6 } from "path";
|
|
11742
12713
|
import { encode } from "@toon-format/toon";
|
|
11743
|
-
import { z as
|
|
12714
|
+
import { z as z79 } from "zod/mini";
|
|
11744
12715
|
|
|
11745
12716
|
// src/constants/general.ts
|
|
11746
12717
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
11747
12718
|
|
|
11748
12719
|
// src/features/skills/agentsmd-skill.ts
|
|
11749
|
-
import { join as
|
|
12720
|
+
import { join as join78 } from "path";
|
|
11750
12721
|
|
|
11751
12722
|
// src/features/skills/simulated-skill.ts
|
|
11752
|
-
import { join as
|
|
11753
|
-
import { z as
|
|
12723
|
+
import { join as join77 } from "path";
|
|
12724
|
+
import { z as z38 } from "zod/mini";
|
|
11754
12725
|
|
|
11755
12726
|
// src/features/skills/tool-skill.ts
|
|
11756
|
-
import { join as
|
|
12727
|
+
import { join as join76 } from "path";
|
|
11757
12728
|
|
|
11758
12729
|
// src/types/ai-dir.ts
|
|
11759
|
-
import path2, { basename as basename3, join as
|
|
12730
|
+
import path2, { basename as basename3, join as join75, relative as relative4, resolve as resolve5 } from "path";
|
|
11760
12731
|
var AiDir = class {
|
|
11761
12732
|
/**
|
|
11762
12733
|
* @example "."
|
|
@@ -11853,8 +12824,8 @@ var AiDir = class {
|
|
|
11853
12824
|
* @returns Array of files with their relative paths and buffers
|
|
11854
12825
|
*/
|
|
11855
12826
|
static async collectOtherFiles(outputRoot, relativeDirPath, dirName, excludeFileName) {
|
|
11856
|
-
const dirPath =
|
|
11857
|
-
const glob =
|
|
12827
|
+
const dirPath = join75(outputRoot, relativeDirPath, dirName);
|
|
12828
|
+
const glob = join75(dirPath, "**", "*");
|
|
11858
12829
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
11859
12830
|
const filteredPaths = filePaths.filter((filePath) => basename3(filePath) !== excludeFileName);
|
|
11860
12831
|
const files = await Promise.all(
|
|
@@ -11955,8 +12926,8 @@ var ToolSkill = class extends AiDir {
|
|
|
11955
12926
|
}) {
|
|
11956
12927
|
const settablePaths = getSettablePaths({ global });
|
|
11957
12928
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
11958
|
-
const skillDirPath =
|
|
11959
|
-
const skillFilePath =
|
|
12929
|
+
const skillDirPath = join76(outputRoot, actualRelativeDirPath, dirName);
|
|
12930
|
+
const skillFilePath = join76(skillDirPath, SKILL_FILE_NAME);
|
|
11960
12931
|
if (!await fileExists(skillFilePath)) {
|
|
11961
12932
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
11962
12933
|
}
|
|
@@ -11980,16 +12951,16 @@ var ToolSkill = class extends AiDir {
|
|
|
11980
12951
|
}
|
|
11981
12952
|
requireMainFileFrontmatter() {
|
|
11982
12953
|
if (!this.mainFile?.frontmatter) {
|
|
11983
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
12954
|
+
throw new Error(`Frontmatter is not defined in ${join76(this.relativeDirPath, this.dirName)}`);
|
|
11984
12955
|
}
|
|
11985
12956
|
return this.mainFile.frontmatter;
|
|
11986
12957
|
}
|
|
11987
12958
|
};
|
|
11988
12959
|
|
|
11989
12960
|
// src/features/skills/simulated-skill.ts
|
|
11990
|
-
var SimulatedSkillFrontmatterSchema =
|
|
11991
|
-
name:
|
|
11992
|
-
description:
|
|
12961
|
+
var SimulatedSkillFrontmatterSchema = z38.looseObject({
|
|
12962
|
+
name: z38.string(),
|
|
12963
|
+
description: z38.string()
|
|
11993
12964
|
});
|
|
11994
12965
|
var SimulatedSkill = class extends ToolSkill {
|
|
11995
12966
|
frontmatter;
|
|
@@ -12020,7 +12991,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
12020
12991
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
12021
12992
|
if (!result.success) {
|
|
12022
12993
|
throw new Error(
|
|
12023
|
-
`Invalid frontmatter in ${
|
|
12994
|
+
`Invalid frontmatter in ${join77(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
12024
12995
|
);
|
|
12025
12996
|
}
|
|
12026
12997
|
}
|
|
@@ -12079,8 +13050,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
12079
13050
|
}) {
|
|
12080
13051
|
const settablePaths = this.getSettablePaths();
|
|
12081
13052
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
12082
|
-
const skillDirPath =
|
|
12083
|
-
const skillFilePath =
|
|
13053
|
+
const skillDirPath = join77(outputRoot, actualRelativeDirPath, dirName);
|
|
13054
|
+
const skillFilePath = join77(skillDirPath, SKILL_FILE_NAME);
|
|
12084
13055
|
if (!await fileExists(skillFilePath)) {
|
|
12085
13056
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
12086
13057
|
}
|
|
@@ -12157,7 +13128,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
12157
13128
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
12158
13129
|
}
|
|
12159
13130
|
return {
|
|
12160
|
-
relativeDirPath:
|
|
13131
|
+
relativeDirPath: join78(".agents", "skills")
|
|
12161
13132
|
};
|
|
12162
13133
|
}
|
|
12163
13134
|
static async fromDir(params) {
|
|
@@ -12184,11 +13155,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
12184
13155
|
};
|
|
12185
13156
|
|
|
12186
13157
|
// src/features/skills/factorydroid-skill.ts
|
|
12187
|
-
import { join as
|
|
13158
|
+
import { join as join79 } from "path";
|
|
12188
13159
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
12189
13160
|
static getSettablePaths(_options) {
|
|
12190
13161
|
return {
|
|
12191
|
-
relativeDirPath:
|
|
13162
|
+
relativeDirPath: join79(".factory", "skills")
|
|
12192
13163
|
};
|
|
12193
13164
|
}
|
|
12194
13165
|
static async fromDir(params) {
|
|
@@ -12215,55 +13186,55 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
12215
13186
|
};
|
|
12216
13187
|
|
|
12217
13188
|
// src/features/skills/rovodev-skill.ts
|
|
12218
|
-
import { join as
|
|
12219
|
-
import { z as
|
|
13189
|
+
import { join as join81 } from "path";
|
|
13190
|
+
import { z as z40 } from "zod/mini";
|
|
12220
13191
|
|
|
12221
13192
|
// 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":
|
|
13193
|
+
import { join as join80 } from "path";
|
|
13194
|
+
import { z as z39 } from "zod/mini";
|
|
13195
|
+
var RulesyncSkillFrontmatterSchemaInternal = z39.looseObject({
|
|
13196
|
+
name: z39.string(),
|
|
13197
|
+
description: z39.string(),
|
|
13198
|
+
targets: z39._default(RulesyncTargetsSchema, ["*"]),
|
|
13199
|
+
claudecode: z39.optional(
|
|
13200
|
+
z39.looseObject({
|
|
13201
|
+
"allowed-tools": z39.optional(z39.array(z39.string())),
|
|
13202
|
+
model: z39.optional(z39.string()),
|
|
13203
|
+
"disable-model-invocation": z39.optional(z39.boolean()),
|
|
13204
|
+
"scheduled-task": z39.optional(z39.boolean())
|
|
12234
13205
|
})
|
|
12235
13206
|
),
|
|
12236
|
-
codexcli:
|
|
12237
|
-
|
|
12238
|
-
"short-description":
|
|
13207
|
+
codexcli: z39.optional(
|
|
13208
|
+
z39.looseObject({
|
|
13209
|
+
"short-description": z39.optional(z39.string())
|
|
12239
13210
|
})
|
|
12240
13211
|
),
|
|
12241
|
-
opencode:
|
|
12242
|
-
|
|
12243
|
-
"allowed-tools":
|
|
13212
|
+
opencode: z39.optional(
|
|
13213
|
+
z39.looseObject({
|
|
13214
|
+
"allowed-tools": z39.optional(z39.array(z39.string()))
|
|
12244
13215
|
})
|
|
12245
13216
|
),
|
|
12246
|
-
kilo:
|
|
12247
|
-
|
|
12248
|
-
"allowed-tools":
|
|
13217
|
+
kilo: z39.optional(
|
|
13218
|
+
z39.looseObject({
|
|
13219
|
+
"allowed-tools": z39.optional(z39.array(z39.string()))
|
|
12249
13220
|
})
|
|
12250
13221
|
),
|
|
12251
|
-
deepagents:
|
|
12252
|
-
|
|
12253
|
-
"allowed-tools":
|
|
13222
|
+
deepagents: z39.optional(
|
|
13223
|
+
z39.looseObject({
|
|
13224
|
+
"allowed-tools": z39.optional(z39.array(z39.string()))
|
|
12254
13225
|
})
|
|
12255
13226
|
),
|
|
12256
|
-
copilot:
|
|
12257
|
-
|
|
12258
|
-
license:
|
|
13227
|
+
copilot: z39.optional(
|
|
13228
|
+
z39.looseObject({
|
|
13229
|
+
license: z39.optional(z39.string())
|
|
12259
13230
|
})
|
|
12260
13231
|
),
|
|
12261
|
-
cline:
|
|
12262
|
-
roo:
|
|
12263
|
-
takt:
|
|
12264
|
-
|
|
13232
|
+
cline: z39.optional(z39.looseObject({})),
|
|
13233
|
+
roo: z39.optional(z39.looseObject({})),
|
|
13234
|
+
takt: z39.optional(
|
|
13235
|
+
z39.looseObject({
|
|
12265
13236
|
// Rename the emitted file stem (e.g. "test-skill.md" → "{name}.md").
|
|
12266
|
-
name:
|
|
13237
|
+
name: z39.optional(z39.string())
|
|
12267
13238
|
})
|
|
12268
13239
|
)
|
|
12269
13240
|
});
|
|
@@ -12305,7 +13276,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
12305
13276
|
}
|
|
12306
13277
|
getFrontmatter() {
|
|
12307
13278
|
if (!this.mainFile?.frontmatter) {
|
|
12308
|
-
throw new Error(`Frontmatter is not defined in ${
|
|
13279
|
+
throw new Error(`Frontmatter is not defined in ${join80(this.relativeDirPath, this.dirName)}`);
|
|
12309
13280
|
}
|
|
12310
13281
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
12311
13282
|
return result;
|
|
@@ -12331,8 +13302,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
12331
13302
|
dirName,
|
|
12332
13303
|
global = false
|
|
12333
13304
|
}) {
|
|
12334
|
-
const skillDirPath =
|
|
12335
|
-
const skillFilePath =
|
|
13305
|
+
const skillDirPath = join80(outputRoot, relativeDirPath, dirName);
|
|
13306
|
+
const skillFilePath = join80(skillDirPath, SKILL_FILE_NAME);
|
|
12336
13307
|
if (!await fileExists(skillFilePath)) {
|
|
12337
13308
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
12338
13309
|
}
|
|
@@ -12362,14 +13333,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
12362
13333
|
};
|
|
12363
13334
|
|
|
12364
13335
|
// src/features/skills/rovodev-skill.ts
|
|
12365
|
-
var RovodevSkillFrontmatterSchema =
|
|
12366
|
-
name:
|
|
12367
|
-
description:
|
|
13336
|
+
var RovodevSkillFrontmatterSchema = z40.looseObject({
|
|
13337
|
+
name: z40.string(),
|
|
13338
|
+
description: z40.string()
|
|
12368
13339
|
});
|
|
12369
13340
|
var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
12370
13341
|
constructor({
|
|
12371
13342
|
outputRoot = process.cwd(),
|
|
12372
|
-
relativeDirPath =
|
|
13343
|
+
relativeDirPath = join81(".rovodev", "skills"),
|
|
12373
13344
|
dirName,
|
|
12374
13345
|
frontmatter,
|
|
12375
13346
|
body,
|
|
@@ -12398,8 +13369,8 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
12398
13369
|
}
|
|
12399
13370
|
static getSettablePaths(_options) {
|
|
12400
13371
|
return {
|
|
12401
|
-
relativeDirPath:
|
|
12402
|
-
alternativeSkillRoots: [
|
|
13372
|
+
relativeDirPath: join81(".rovodev", "skills"),
|
|
13373
|
+
alternativeSkillRoots: [join81(".agents", "skills")]
|
|
12403
13374
|
};
|
|
12404
13375
|
}
|
|
12405
13376
|
getFrontmatter() {
|
|
@@ -12487,13 +13458,13 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
12487
13458
|
});
|
|
12488
13459
|
const result = RovodevSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12489
13460
|
if (!result.success) {
|
|
12490
|
-
const skillDirPath =
|
|
13461
|
+
const skillDirPath = join81(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
12491
13462
|
throw new Error(
|
|
12492
|
-
`Invalid frontmatter in ${
|
|
13463
|
+
`Invalid frontmatter in ${join81(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12493
13464
|
);
|
|
12494
13465
|
}
|
|
12495
13466
|
if (result.data.name !== loaded.dirName) {
|
|
12496
|
-
const skillFilePath =
|
|
13467
|
+
const skillFilePath = join81(
|
|
12497
13468
|
loaded.outputRoot,
|
|
12498
13469
|
loaded.relativeDirPath,
|
|
12499
13470
|
loaded.dirName,
|
|
@@ -12535,11 +13506,11 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
12535
13506
|
};
|
|
12536
13507
|
|
|
12537
13508
|
// src/features/skills/skills-processor.ts
|
|
12538
|
-
import { basename as basename5, join as
|
|
12539
|
-
import { z as
|
|
13509
|
+
import { basename as basename5, join as join102 } from "path";
|
|
13510
|
+
import { z as z58 } from "zod/mini";
|
|
12540
13511
|
|
|
12541
13512
|
// src/types/dir-feature-processor.ts
|
|
12542
|
-
import { join as
|
|
13513
|
+
import { join as join82 } from "path";
|
|
12543
13514
|
var DirFeatureProcessor = class {
|
|
12544
13515
|
outputRoot;
|
|
12545
13516
|
inputRoot;
|
|
@@ -12582,7 +13553,7 @@ var DirFeatureProcessor = class {
|
|
|
12582
13553
|
const mainFile = aiDir.getMainFile();
|
|
12583
13554
|
let mainFileContent;
|
|
12584
13555
|
if (mainFile) {
|
|
12585
|
-
const mainFilePath =
|
|
13556
|
+
const mainFilePath = join82(dirPath, mainFile.name);
|
|
12586
13557
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
12587
13558
|
avoidBlockScalars: this.avoidBlockScalars
|
|
12588
13559
|
});
|
|
@@ -12602,7 +13573,7 @@ var DirFeatureProcessor = class {
|
|
|
12602
13573
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
12603
13574
|
otherFileContents.push(contentWithNewline);
|
|
12604
13575
|
if (!dirHasChanges) {
|
|
12605
|
-
const filePath =
|
|
13576
|
+
const filePath = join82(dirPath, file.relativeFilePathToDirPath);
|
|
12606
13577
|
const existingContent = await readFileContentOrNull(filePath);
|
|
12607
13578
|
if (!fileContentsEquivalent({
|
|
12608
13579
|
filePath,
|
|
@@ -12620,24 +13591,24 @@ var DirFeatureProcessor = class {
|
|
|
12620
13591
|
if (this.dryRun) {
|
|
12621
13592
|
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
12622
13593
|
if (mainFile) {
|
|
12623
|
-
this.logger.info(`[DRY RUN] Would write: ${
|
|
12624
|
-
changedPaths.push(
|
|
13594
|
+
this.logger.info(`[DRY RUN] Would write: ${join82(dirPath, mainFile.name)}`);
|
|
13595
|
+
changedPaths.push(join82(relativeDir, mainFile.name));
|
|
12625
13596
|
}
|
|
12626
13597
|
for (const file of otherFiles) {
|
|
12627
13598
|
this.logger.info(
|
|
12628
|
-
`[DRY RUN] Would write: ${
|
|
13599
|
+
`[DRY RUN] Would write: ${join82(dirPath, file.relativeFilePathToDirPath)}`
|
|
12629
13600
|
);
|
|
12630
|
-
changedPaths.push(
|
|
13601
|
+
changedPaths.push(join82(relativeDir, file.relativeFilePathToDirPath));
|
|
12631
13602
|
}
|
|
12632
13603
|
} else {
|
|
12633
13604
|
await ensureDir(dirPath);
|
|
12634
13605
|
if (mainFile && mainFileContent) {
|
|
12635
|
-
const mainFilePath =
|
|
13606
|
+
const mainFilePath = join82(dirPath, mainFile.name);
|
|
12636
13607
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
12637
|
-
changedPaths.push(
|
|
13608
|
+
changedPaths.push(join82(relativeDir, mainFile.name));
|
|
12638
13609
|
}
|
|
12639
13610
|
for (const [i, file] of otherFiles.entries()) {
|
|
12640
|
-
const filePath =
|
|
13611
|
+
const filePath = join82(dirPath, file.relativeFilePathToDirPath);
|
|
12641
13612
|
const content = otherFileContents[i];
|
|
12642
13613
|
if (content === void 0) {
|
|
12643
13614
|
throw new Error(
|
|
@@ -12645,7 +13616,7 @@ var DirFeatureProcessor = class {
|
|
|
12645
13616
|
);
|
|
12646
13617
|
}
|
|
12647
13618
|
await writeFileContent(filePath, content);
|
|
12648
|
-
changedPaths.push(
|
|
13619
|
+
changedPaths.push(join82(relativeDir, file.relativeFilePathToDirPath));
|
|
12649
13620
|
}
|
|
12650
13621
|
}
|
|
12651
13622
|
changedCount++;
|
|
@@ -12677,16 +13648,16 @@ var DirFeatureProcessor = class {
|
|
|
12677
13648
|
};
|
|
12678
13649
|
|
|
12679
13650
|
// src/features/skills/agentsskills-skill.ts
|
|
12680
|
-
import { join as
|
|
12681
|
-
import { z as
|
|
12682
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
12683
|
-
name:
|
|
12684
|
-
description:
|
|
13651
|
+
import { join as join83 } from "path";
|
|
13652
|
+
import { z as z41 } from "zod/mini";
|
|
13653
|
+
var AgentsSkillsSkillFrontmatterSchema = z41.looseObject({
|
|
13654
|
+
name: z41.string(),
|
|
13655
|
+
description: z41.string()
|
|
12685
13656
|
});
|
|
12686
13657
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
12687
13658
|
constructor({
|
|
12688
13659
|
outputRoot = process.cwd(),
|
|
12689
|
-
relativeDirPath =
|
|
13660
|
+
relativeDirPath = join83(".agents", "skills"),
|
|
12690
13661
|
dirName,
|
|
12691
13662
|
frontmatter,
|
|
12692
13663
|
body,
|
|
@@ -12718,7 +13689,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
12718
13689
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
12719
13690
|
}
|
|
12720
13691
|
return {
|
|
12721
|
-
relativeDirPath:
|
|
13692
|
+
relativeDirPath: join83(".agents", "skills")
|
|
12722
13693
|
};
|
|
12723
13694
|
}
|
|
12724
13695
|
getFrontmatter() {
|
|
@@ -12798,9 +13769,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
12798
13769
|
});
|
|
12799
13770
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12800
13771
|
if (!result.success) {
|
|
12801
|
-
const skillDirPath =
|
|
13772
|
+
const skillDirPath = join83(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
12802
13773
|
throw new Error(
|
|
12803
|
-
`Invalid frontmatter in ${
|
|
13774
|
+
`Invalid frontmatter in ${join83(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12804
13775
|
);
|
|
12805
13776
|
}
|
|
12806
13777
|
return new _AgentsSkillsSkill({
|
|
@@ -12835,16 +13806,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
12835
13806
|
};
|
|
12836
13807
|
|
|
12837
13808
|
// src/features/skills/antigravity-skill.ts
|
|
12838
|
-
import { join as
|
|
12839
|
-
import { z as
|
|
12840
|
-
var AntigravitySkillFrontmatterSchema =
|
|
12841
|
-
name:
|
|
12842
|
-
description:
|
|
13809
|
+
import { join as join84 } from "path";
|
|
13810
|
+
import { z as z42 } from "zod/mini";
|
|
13811
|
+
var AntigravitySkillFrontmatterSchema = z42.looseObject({
|
|
13812
|
+
name: z42.string(),
|
|
13813
|
+
description: z42.string()
|
|
12843
13814
|
});
|
|
12844
13815
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
12845
13816
|
constructor({
|
|
12846
13817
|
outputRoot = process.cwd(),
|
|
12847
|
-
relativeDirPath =
|
|
13818
|
+
relativeDirPath = join84(".agent", "skills"),
|
|
12848
13819
|
dirName,
|
|
12849
13820
|
frontmatter,
|
|
12850
13821
|
body,
|
|
@@ -12876,11 +13847,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
12876
13847
|
} = {}) {
|
|
12877
13848
|
if (global) {
|
|
12878
13849
|
return {
|
|
12879
|
-
relativeDirPath:
|
|
13850
|
+
relativeDirPath: join84(".gemini", "antigravity", "skills")
|
|
12880
13851
|
};
|
|
12881
13852
|
}
|
|
12882
13853
|
return {
|
|
12883
|
-
relativeDirPath:
|
|
13854
|
+
relativeDirPath: join84(".agent", "skills")
|
|
12884
13855
|
};
|
|
12885
13856
|
}
|
|
12886
13857
|
getFrontmatter() {
|
|
@@ -12960,9 +13931,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
12960
13931
|
});
|
|
12961
13932
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12962
13933
|
if (!result.success) {
|
|
12963
|
-
const skillDirPath =
|
|
13934
|
+
const skillDirPath = join84(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
12964
13935
|
throw new Error(
|
|
12965
|
-
`Invalid frontmatter in ${
|
|
13936
|
+
`Invalid frontmatter in ${join84(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12966
13937
|
);
|
|
12967
13938
|
}
|
|
12968
13939
|
return new _AntigravitySkill({
|
|
@@ -12996,21 +13967,21 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
12996
13967
|
};
|
|
12997
13968
|
|
|
12998
13969
|
// 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":
|
|
13970
|
+
import { join as join85 } from "path";
|
|
13971
|
+
import { z as z43 } from "zod/mini";
|
|
13972
|
+
var CLAUDE_SKILLS_DIR_PATH = join85(".claude", "skills");
|
|
13973
|
+
var CLAUDE_SCHEDULED_TASKS_DIR_PATH = join85(".claude", "scheduled-tasks");
|
|
13974
|
+
var ClaudecodeSkillFrontmatterSchema = z43.looseObject({
|
|
13975
|
+
name: z43.string(),
|
|
13976
|
+
description: z43.string(),
|
|
13977
|
+
"allowed-tools": z43.optional(z43.array(z43.string())),
|
|
13978
|
+
model: z43.optional(z43.string()),
|
|
13979
|
+
"disable-model-invocation": z43.optional(z43.boolean())
|
|
13009
13980
|
});
|
|
13010
13981
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
13011
13982
|
constructor({
|
|
13012
13983
|
outputRoot = process.cwd(),
|
|
13013
|
-
relativeDirPath =
|
|
13984
|
+
relativeDirPath = join85(".claude", "skills"),
|
|
13014
13985
|
dirName,
|
|
13015
13986
|
frontmatter,
|
|
13016
13987
|
body,
|
|
@@ -13145,9 +14116,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
13145
14116
|
});
|
|
13146
14117
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13147
14118
|
if (!result.success) {
|
|
13148
|
-
const skillDirPath =
|
|
14119
|
+
const skillDirPath = join85(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13149
14120
|
throw new Error(
|
|
13150
|
-
`Invalid frontmatter in ${
|
|
14121
|
+
`Invalid frontmatter in ${join85(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13151
14122
|
);
|
|
13152
14123
|
}
|
|
13153
14124
|
return new _ClaudecodeSkill({
|
|
@@ -13181,16 +14152,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
13181
14152
|
};
|
|
13182
14153
|
|
|
13183
14154
|
// src/features/skills/cline-skill.ts
|
|
13184
|
-
import { join as
|
|
13185
|
-
import { z as
|
|
13186
|
-
var ClineSkillFrontmatterSchema =
|
|
13187
|
-
name:
|
|
13188
|
-
description:
|
|
14155
|
+
import { join as join86 } from "path";
|
|
14156
|
+
import { z as z44 } from "zod/mini";
|
|
14157
|
+
var ClineSkillFrontmatterSchema = z44.looseObject({
|
|
14158
|
+
name: z44.string(),
|
|
14159
|
+
description: z44.string()
|
|
13189
14160
|
});
|
|
13190
14161
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
13191
14162
|
constructor({
|
|
13192
14163
|
outputRoot = process.cwd(),
|
|
13193
|
-
relativeDirPath =
|
|
14164
|
+
relativeDirPath = join86(".cline", "skills"),
|
|
13194
14165
|
dirName,
|
|
13195
14166
|
frontmatter,
|
|
13196
14167
|
body,
|
|
@@ -13219,7 +14190,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
13219
14190
|
}
|
|
13220
14191
|
static getSettablePaths(_options = {}) {
|
|
13221
14192
|
return {
|
|
13222
|
-
relativeDirPath:
|
|
14193
|
+
relativeDirPath: join86(".cline", "skills")
|
|
13223
14194
|
};
|
|
13224
14195
|
}
|
|
13225
14196
|
getFrontmatter() {
|
|
@@ -13307,13 +14278,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
13307
14278
|
});
|
|
13308
14279
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13309
14280
|
if (!result.success) {
|
|
13310
|
-
const skillDirPath =
|
|
14281
|
+
const skillDirPath = join86(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13311
14282
|
throw new Error(
|
|
13312
|
-
`Invalid frontmatter in ${
|
|
14283
|
+
`Invalid frontmatter in ${join86(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13313
14284
|
);
|
|
13314
14285
|
}
|
|
13315
14286
|
if (result.data.name !== loaded.dirName) {
|
|
13316
|
-
const skillFilePath =
|
|
14287
|
+
const skillFilePath = join86(
|
|
13317
14288
|
loaded.outputRoot,
|
|
13318
14289
|
loaded.relativeDirPath,
|
|
13319
14290
|
loaded.dirName,
|
|
@@ -13354,21 +14325,21 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
13354
14325
|
};
|
|
13355
14326
|
|
|
13356
14327
|
// 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":
|
|
14328
|
+
import { join as join87 } from "path";
|
|
14329
|
+
import { z as z45 } from "zod/mini";
|
|
14330
|
+
var CodexCliSkillFrontmatterSchema = z45.looseObject({
|
|
14331
|
+
name: z45.string(),
|
|
14332
|
+
description: z45.string(),
|
|
14333
|
+
metadata: z45.optional(
|
|
14334
|
+
z45.looseObject({
|
|
14335
|
+
"short-description": z45.optional(z45.string())
|
|
13365
14336
|
})
|
|
13366
14337
|
)
|
|
13367
14338
|
});
|
|
13368
14339
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
13369
14340
|
constructor({
|
|
13370
14341
|
outputRoot = process.cwd(),
|
|
13371
|
-
relativeDirPath =
|
|
14342
|
+
relativeDirPath = join87(".codex", "skills"),
|
|
13372
14343
|
dirName,
|
|
13373
14344
|
frontmatter,
|
|
13374
14345
|
body,
|
|
@@ -13399,7 +14370,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
13399
14370
|
global: _global = false
|
|
13400
14371
|
} = {}) {
|
|
13401
14372
|
return {
|
|
13402
|
-
relativeDirPath:
|
|
14373
|
+
relativeDirPath: join87(".codex", "skills")
|
|
13403
14374
|
};
|
|
13404
14375
|
}
|
|
13405
14376
|
getFrontmatter() {
|
|
@@ -13489,9 +14460,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
13489
14460
|
});
|
|
13490
14461
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13491
14462
|
if (!result.success) {
|
|
13492
|
-
const skillDirPath =
|
|
14463
|
+
const skillDirPath = join87(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13493
14464
|
throw new Error(
|
|
13494
|
-
`Invalid frontmatter in ${
|
|
14465
|
+
`Invalid frontmatter in ${join87(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13495
14466
|
);
|
|
13496
14467
|
}
|
|
13497
14468
|
return new _CodexCliSkill({
|
|
@@ -13525,17 +14496,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
13525
14496
|
};
|
|
13526
14497
|
|
|
13527
14498
|
// src/features/skills/copilot-skill.ts
|
|
13528
|
-
import { join as
|
|
13529
|
-
import { z as
|
|
13530
|
-
var CopilotSkillFrontmatterSchema =
|
|
13531
|
-
name:
|
|
13532
|
-
description:
|
|
13533
|
-
license:
|
|
14499
|
+
import { join as join88 } from "path";
|
|
14500
|
+
import { z as z46 } from "zod/mini";
|
|
14501
|
+
var CopilotSkillFrontmatterSchema = z46.looseObject({
|
|
14502
|
+
name: z46.string(),
|
|
14503
|
+
description: z46.string(),
|
|
14504
|
+
license: z46.optional(z46.string())
|
|
13534
14505
|
});
|
|
13535
14506
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
13536
14507
|
constructor({
|
|
13537
14508
|
outputRoot = process.cwd(),
|
|
13538
|
-
relativeDirPath =
|
|
14509
|
+
relativeDirPath = join88(".github", "skills"),
|
|
13539
14510
|
dirName,
|
|
13540
14511
|
frontmatter,
|
|
13541
14512
|
body,
|
|
@@ -13567,7 +14538,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
13567
14538
|
throw new Error("CopilotSkill does not support global mode.");
|
|
13568
14539
|
}
|
|
13569
14540
|
return {
|
|
13570
|
-
relativeDirPath:
|
|
14541
|
+
relativeDirPath: join88(".github", "skills")
|
|
13571
14542
|
};
|
|
13572
14543
|
}
|
|
13573
14544
|
getFrontmatter() {
|
|
@@ -13653,9 +14624,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
13653
14624
|
});
|
|
13654
14625
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13655
14626
|
if (!result.success) {
|
|
13656
|
-
const skillDirPath =
|
|
14627
|
+
const skillDirPath = join88(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13657
14628
|
throw new Error(
|
|
13658
|
-
`Invalid frontmatter in ${
|
|
14629
|
+
`Invalid frontmatter in ${join88(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13659
14630
|
);
|
|
13660
14631
|
}
|
|
13661
14632
|
return new _CopilotSkill({
|
|
@@ -13690,16 +14661,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
13690
14661
|
};
|
|
13691
14662
|
|
|
13692
14663
|
// src/features/skills/cursor-skill.ts
|
|
13693
|
-
import { join as
|
|
13694
|
-
import { z as
|
|
13695
|
-
var CursorSkillFrontmatterSchema =
|
|
13696
|
-
name:
|
|
13697
|
-
description:
|
|
14664
|
+
import { join as join89 } from "path";
|
|
14665
|
+
import { z as z47 } from "zod/mini";
|
|
14666
|
+
var CursorSkillFrontmatterSchema = z47.looseObject({
|
|
14667
|
+
name: z47.string(),
|
|
14668
|
+
description: z47.string()
|
|
13698
14669
|
});
|
|
13699
14670
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
13700
14671
|
constructor({
|
|
13701
14672
|
outputRoot = process.cwd(),
|
|
13702
|
-
relativeDirPath =
|
|
14673
|
+
relativeDirPath = join89(".cursor", "skills"),
|
|
13703
14674
|
dirName,
|
|
13704
14675
|
frontmatter,
|
|
13705
14676
|
body,
|
|
@@ -13728,7 +14699,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
13728
14699
|
}
|
|
13729
14700
|
static getSettablePaths(_options) {
|
|
13730
14701
|
return {
|
|
13731
|
-
relativeDirPath:
|
|
14702
|
+
relativeDirPath: join89(".cursor", "skills")
|
|
13732
14703
|
};
|
|
13733
14704
|
}
|
|
13734
14705
|
getFrontmatter() {
|
|
@@ -13808,9 +14779,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
13808
14779
|
});
|
|
13809
14780
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13810
14781
|
if (!result.success) {
|
|
13811
|
-
const skillDirPath =
|
|
14782
|
+
const skillDirPath = join89(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13812
14783
|
throw new Error(
|
|
13813
|
-
`Invalid frontmatter in ${
|
|
14784
|
+
`Invalid frontmatter in ${join89(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13814
14785
|
);
|
|
13815
14786
|
}
|
|
13816
14787
|
return new _CursorSkill({
|
|
@@ -13845,17 +14816,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
13845
14816
|
};
|
|
13846
14817
|
|
|
13847
14818
|
// src/features/skills/deepagents-skill.ts
|
|
13848
|
-
import { join as
|
|
13849
|
-
import { z as
|
|
13850
|
-
var DeepagentsSkillFrontmatterSchema =
|
|
13851
|
-
name:
|
|
13852
|
-
description:
|
|
13853
|
-
"allowed-tools":
|
|
14819
|
+
import { join as join90 } from "path";
|
|
14820
|
+
import { z as z48 } from "zod/mini";
|
|
14821
|
+
var DeepagentsSkillFrontmatterSchema = z48.looseObject({
|
|
14822
|
+
name: z48.string(),
|
|
14823
|
+
description: z48.string(),
|
|
14824
|
+
"allowed-tools": z48.optional(z48.array(z48.string()))
|
|
13854
14825
|
});
|
|
13855
14826
|
var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
13856
14827
|
constructor({
|
|
13857
14828
|
outputRoot = process.cwd(),
|
|
13858
|
-
relativeDirPath =
|
|
14829
|
+
relativeDirPath = join90(".deepagents", "skills"),
|
|
13859
14830
|
dirName,
|
|
13860
14831
|
frontmatter,
|
|
13861
14832
|
body,
|
|
@@ -13884,7 +14855,7 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
13884
14855
|
}
|
|
13885
14856
|
static getSettablePaths(_options) {
|
|
13886
14857
|
return {
|
|
13887
|
-
relativeDirPath:
|
|
14858
|
+
relativeDirPath: join90(".deepagents", "skills")
|
|
13888
14859
|
};
|
|
13889
14860
|
}
|
|
13890
14861
|
getFrontmatter() {
|
|
@@ -13970,9 +14941,9 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
13970
14941
|
});
|
|
13971
14942
|
const result = DeepagentsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
13972
14943
|
if (!result.success) {
|
|
13973
|
-
const skillDirPath =
|
|
14944
|
+
const skillDirPath = join90(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
13974
14945
|
throw new Error(
|
|
13975
|
-
`Invalid frontmatter in ${
|
|
14946
|
+
`Invalid frontmatter in ${join90(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
13976
14947
|
);
|
|
13977
14948
|
}
|
|
13978
14949
|
return new _DeepagentsSkill({
|
|
@@ -14007,11 +14978,11 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
14007
14978
|
};
|
|
14008
14979
|
|
|
14009
14980
|
// src/features/skills/geminicli-skill.ts
|
|
14010
|
-
import { join as
|
|
14011
|
-
import { z as
|
|
14012
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
14013
|
-
name:
|
|
14014
|
-
description:
|
|
14981
|
+
import { join as join91 } from "path";
|
|
14982
|
+
import { z as z49 } from "zod/mini";
|
|
14983
|
+
var GeminiCliSkillFrontmatterSchema = z49.looseObject({
|
|
14984
|
+
name: z49.string(),
|
|
14985
|
+
description: z49.string()
|
|
14015
14986
|
});
|
|
14016
14987
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
14017
14988
|
constructor({
|
|
@@ -14047,7 +15018,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
14047
15018
|
global: _global = false
|
|
14048
15019
|
} = {}) {
|
|
14049
15020
|
return {
|
|
14050
|
-
relativeDirPath:
|
|
15021
|
+
relativeDirPath: join91(".gemini", "skills")
|
|
14051
15022
|
};
|
|
14052
15023
|
}
|
|
14053
15024
|
getFrontmatter() {
|
|
@@ -14127,9 +15098,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
14127
15098
|
});
|
|
14128
15099
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14129
15100
|
if (!result.success) {
|
|
14130
|
-
const skillDirPath =
|
|
15101
|
+
const skillDirPath = join91(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14131
15102
|
throw new Error(
|
|
14132
|
-
`Invalid frontmatter in ${
|
|
15103
|
+
`Invalid frontmatter in ${join91(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14133
15104
|
);
|
|
14134
15105
|
}
|
|
14135
15106
|
return new _GeminiCliSkill({
|
|
@@ -14164,16 +15135,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
14164
15135
|
};
|
|
14165
15136
|
|
|
14166
15137
|
// src/features/skills/junie-skill.ts
|
|
14167
|
-
import { join as
|
|
14168
|
-
import { z as
|
|
14169
|
-
var JunieSkillFrontmatterSchema =
|
|
14170
|
-
name:
|
|
14171
|
-
description:
|
|
15138
|
+
import { join as join92 } from "path";
|
|
15139
|
+
import { z as z50 } from "zod/mini";
|
|
15140
|
+
var JunieSkillFrontmatterSchema = z50.looseObject({
|
|
15141
|
+
name: z50.string(),
|
|
15142
|
+
description: z50.string()
|
|
14172
15143
|
});
|
|
14173
15144
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
14174
15145
|
constructor({
|
|
14175
15146
|
outputRoot = process.cwd(),
|
|
14176
|
-
relativeDirPath =
|
|
15147
|
+
relativeDirPath = join92(".junie", "skills"),
|
|
14177
15148
|
dirName,
|
|
14178
15149
|
frontmatter,
|
|
14179
15150
|
body,
|
|
@@ -14205,7 +15176,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
14205
15176
|
throw new Error("JunieSkill does not support global mode.");
|
|
14206
15177
|
}
|
|
14207
15178
|
return {
|
|
14208
|
-
relativeDirPath:
|
|
15179
|
+
relativeDirPath: join92(".junie", "skills")
|
|
14209
15180
|
};
|
|
14210
15181
|
}
|
|
14211
15182
|
getFrontmatter() {
|
|
@@ -14292,13 +15263,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
14292
15263
|
});
|
|
14293
15264
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14294
15265
|
if (!result.success) {
|
|
14295
|
-
const skillDirPath =
|
|
15266
|
+
const skillDirPath = join92(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14296
15267
|
throw new Error(
|
|
14297
|
-
`Invalid frontmatter in ${
|
|
15268
|
+
`Invalid frontmatter in ${join92(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14298
15269
|
);
|
|
14299
15270
|
}
|
|
14300
15271
|
if (result.data.name !== loaded.dirName) {
|
|
14301
|
-
const skillFilePath =
|
|
15272
|
+
const skillFilePath = join92(
|
|
14302
15273
|
loaded.outputRoot,
|
|
14303
15274
|
loaded.relativeDirPath,
|
|
14304
15275
|
loaded.dirName,
|
|
@@ -14340,17 +15311,17 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
14340
15311
|
};
|
|
14341
15312
|
|
|
14342
15313
|
// src/features/skills/kilo-skill.ts
|
|
14343
|
-
import { join as
|
|
14344
|
-
import { z as
|
|
14345
|
-
var KiloSkillFrontmatterSchema =
|
|
14346
|
-
name:
|
|
14347
|
-
description:
|
|
14348
|
-
"allowed-tools":
|
|
15314
|
+
import { join as join93 } from "path";
|
|
15315
|
+
import { z as z51 } from "zod/mini";
|
|
15316
|
+
var KiloSkillFrontmatterSchema = z51.looseObject({
|
|
15317
|
+
name: z51.string(),
|
|
15318
|
+
description: z51.string(),
|
|
15319
|
+
"allowed-tools": z51.optional(z51.array(z51.string()))
|
|
14349
15320
|
});
|
|
14350
15321
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
14351
15322
|
constructor({
|
|
14352
15323
|
outputRoot = process.cwd(),
|
|
14353
|
-
relativeDirPath =
|
|
15324
|
+
relativeDirPath = join93(".kilo", "skills"),
|
|
14354
15325
|
dirName,
|
|
14355
15326
|
frontmatter,
|
|
14356
15327
|
body,
|
|
@@ -14379,7 +15350,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
14379
15350
|
}
|
|
14380
15351
|
static getSettablePaths({ global = false } = {}) {
|
|
14381
15352
|
return {
|
|
14382
|
-
relativeDirPath: global ?
|
|
15353
|
+
relativeDirPath: global ? join93(".config", "kilo", "skills") : join93(".kilo", "skills")
|
|
14383
15354
|
};
|
|
14384
15355
|
}
|
|
14385
15356
|
getFrontmatter() {
|
|
@@ -14465,9 +15436,9 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
14465
15436
|
});
|
|
14466
15437
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14467
15438
|
if (!result.success) {
|
|
14468
|
-
const skillDirPath =
|
|
15439
|
+
const skillDirPath = join93(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14469
15440
|
throw new Error(
|
|
14470
|
-
`Invalid frontmatter in ${
|
|
15441
|
+
`Invalid frontmatter in ${join93(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14471
15442
|
);
|
|
14472
15443
|
}
|
|
14473
15444
|
return new _KiloSkill({
|
|
@@ -14501,16 +15472,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
14501
15472
|
};
|
|
14502
15473
|
|
|
14503
15474
|
// src/features/skills/kiro-skill.ts
|
|
14504
|
-
import { join as
|
|
14505
|
-
import { z as
|
|
14506
|
-
var KiroSkillFrontmatterSchema =
|
|
14507
|
-
name:
|
|
14508
|
-
description:
|
|
15475
|
+
import { join as join94 } from "path";
|
|
15476
|
+
import { z as z52 } from "zod/mini";
|
|
15477
|
+
var KiroSkillFrontmatterSchema = z52.looseObject({
|
|
15478
|
+
name: z52.string(),
|
|
15479
|
+
description: z52.string()
|
|
14509
15480
|
});
|
|
14510
15481
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
14511
15482
|
constructor({
|
|
14512
15483
|
outputRoot = process.cwd(),
|
|
14513
|
-
relativeDirPath =
|
|
15484
|
+
relativeDirPath = join94(".kiro", "skills"),
|
|
14514
15485
|
dirName,
|
|
14515
15486
|
frontmatter,
|
|
14516
15487
|
body,
|
|
@@ -14542,7 +15513,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
14542
15513
|
throw new Error("KiroSkill does not support global mode.");
|
|
14543
15514
|
}
|
|
14544
15515
|
return {
|
|
14545
|
-
relativeDirPath:
|
|
15516
|
+
relativeDirPath: join94(".kiro", "skills")
|
|
14546
15517
|
};
|
|
14547
15518
|
}
|
|
14548
15519
|
getFrontmatter() {
|
|
@@ -14630,13 +15601,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
14630
15601
|
});
|
|
14631
15602
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14632
15603
|
if (!result.success) {
|
|
14633
|
-
const skillDirPath =
|
|
15604
|
+
const skillDirPath = join94(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14634
15605
|
throw new Error(
|
|
14635
|
-
`Invalid frontmatter in ${
|
|
15606
|
+
`Invalid frontmatter in ${join94(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14636
15607
|
);
|
|
14637
15608
|
}
|
|
14638
15609
|
if (result.data.name !== loaded.dirName) {
|
|
14639
|
-
const skillFilePath =
|
|
15610
|
+
const skillFilePath = join94(
|
|
14640
15611
|
loaded.outputRoot,
|
|
14641
15612
|
loaded.relativeDirPath,
|
|
14642
15613
|
loaded.dirName,
|
|
@@ -14678,17 +15649,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
14678
15649
|
};
|
|
14679
15650
|
|
|
14680
15651
|
// src/features/skills/opencode-skill.ts
|
|
14681
|
-
import { join as
|
|
14682
|
-
import { z as
|
|
14683
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
14684
|
-
name:
|
|
14685
|
-
description:
|
|
14686
|
-
"allowed-tools":
|
|
15652
|
+
import { join as join95 } from "path";
|
|
15653
|
+
import { z as z53 } from "zod/mini";
|
|
15654
|
+
var OpenCodeSkillFrontmatterSchema = z53.looseObject({
|
|
15655
|
+
name: z53.string(),
|
|
15656
|
+
description: z53.string(),
|
|
15657
|
+
"allowed-tools": z53.optional(z53.array(z53.string()))
|
|
14687
15658
|
});
|
|
14688
15659
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
14689
15660
|
constructor({
|
|
14690
15661
|
outputRoot = process.cwd(),
|
|
14691
|
-
relativeDirPath =
|
|
15662
|
+
relativeDirPath = join95(".opencode", "skill"),
|
|
14692
15663
|
dirName,
|
|
14693
15664
|
frontmatter,
|
|
14694
15665
|
body,
|
|
@@ -14717,7 +15688,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
14717
15688
|
}
|
|
14718
15689
|
static getSettablePaths({ global = false } = {}) {
|
|
14719
15690
|
return {
|
|
14720
|
-
relativeDirPath: global ?
|
|
15691
|
+
relativeDirPath: global ? join95(".config", "opencode", "skill") : join95(".opencode", "skill")
|
|
14721
15692
|
};
|
|
14722
15693
|
}
|
|
14723
15694
|
getFrontmatter() {
|
|
@@ -14803,9 +15774,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
14803
15774
|
});
|
|
14804
15775
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14805
15776
|
if (!result.success) {
|
|
14806
|
-
const skillDirPath =
|
|
15777
|
+
const skillDirPath = join95(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14807
15778
|
throw new Error(
|
|
14808
|
-
`Invalid frontmatter in ${
|
|
15779
|
+
`Invalid frontmatter in ${join95(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14809
15780
|
);
|
|
14810
15781
|
}
|
|
14811
15782
|
return new _OpenCodeSkill({
|
|
@@ -14839,11 +15810,11 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
14839
15810
|
};
|
|
14840
15811
|
|
|
14841
15812
|
// src/features/skills/pi-skill.ts
|
|
14842
|
-
import { join as
|
|
14843
|
-
import { z as
|
|
14844
|
-
var PiSkillFrontmatterSchema =
|
|
14845
|
-
name:
|
|
14846
|
-
description:
|
|
15813
|
+
import { join as join96 } from "path";
|
|
15814
|
+
import { z as z54 } from "zod/mini";
|
|
15815
|
+
var PiSkillFrontmatterSchema = z54.looseObject({
|
|
15816
|
+
name: z54.string(),
|
|
15817
|
+
description: z54.string()
|
|
14847
15818
|
});
|
|
14848
15819
|
var PiSkill = class _PiSkill extends ToolSkill {
|
|
14849
15820
|
constructor({
|
|
@@ -14879,11 +15850,11 @@ var PiSkill = class _PiSkill extends ToolSkill {
|
|
|
14879
15850
|
static getSettablePaths({ global } = {}) {
|
|
14880
15851
|
if (global) {
|
|
14881
15852
|
return {
|
|
14882
|
-
relativeDirPath:
|
|
15853
|
+
relativeDirPath: join96(".pi", "agent", "skills")
|
|
14883
15854
|
};
|
|
14884
15855
|
}
|
|
14885
15856
|
return {
|
|
14886
|
-
relativeDirPath:
|
|
15857
|
+
relativeDirPath: join96(".pi", "skills")
|
|
14887
15858
|
};
|
|
14888
15859
|
}
|
|
14889
15860
|
getFrontmatter() {
|
|
@@ -14962,9 +15933,9 @@ var PiSkill = class _PiSkill extends ToolSkill {
|
|
|
14962
15933
|
});
|
|
14963
15934
|
const result = PiSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14964
15935
|
if (!result.success) {
|
|
14965
|
-
const skillDirPath =
|
|
15936
|
+
const skillDirPath = join96(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
14966
15937
|
throw new Error(
|
|
14967
|
-
`Invalid frontmatter in ${
|
|
15938
|
+
`Invalid frontmatter in ${join96(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14968
15939
|
);
|
|
14969
15940
|
}
|
|
14970
15941
|
return new _PiSkill({
|
|
@@ -14999,16 +15970,16 @@ var PiSkill = class _PiSkill extends ToolSkill {
|
|
|
14999
15970
|
};
|
|
15000
15971
|
|
|
15001
15972
|
// src/features/skills/replit-skill.ts
|
|
15002
|
-
import { join as
|
|
15003
|
-
import { z as
|
|
15004
|
-
var ReplitSkillFrontmatterSchema =
|
|
15005
|
-
name:
|
|
15006
|
-
description:
|
|
15973
|
+
import { join as join97 } from "path";
|
|
15974
|
+
import { z as z55 } from "zod/mini";
|
|
15975
|
+
var ReplitSkillFrontmatterSchema = z55.looseObject({
|
|
15976
|
+
name: z55.string(),
|
|
15977
|
+
description: z55.string()
|
|
15007
15978
|
});
|
|
15008
15979
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
15009
15980
|
constructor({
|
|
15010
15981
|
outputRoot = process.cwd(),
|
|
15011
|
-
relativeDirPath =
|
|
15982
|
+
relativeDirPath = join97(".agents", "skills"),
|
|
15012
15983
|
dirName,
|
|
15013
15984
|
frontmatter,
|
|
15014
15985
|
body,
|
|
@@ -15040,7 +16011,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
15040
16011
|
throw new Error("ReplitSkill does not support global mode.");
|
|
15041
16012
|
}
|
|
15042
16013
|
return {
|
|
15043
|
-
relativeDirPath:
|
|
16014
|
+
relativeDirPath: join97(".agents", "skills")
|
|
15044
16015
|
};
|
|
15045
16016
|
}
|
|
15046
16017
|
getFrontmatter() {
|
|
@@ -15120,9 +16091,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
15120
16091
|
});
|
|
15121
16092
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
15122
16093
|
if (!result.success) {
|
|
15123
|
-
const skillDirPath =
|
|
16094
|
+
const skillDirPath = join97(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
15124
16095
|
throw new Error(
|
|
15125
|
-
`Invalid frontmatter in ${
|
|
16096
|
+
`Invalid frontmatter in ${join97(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
15126
16097
|
);
|
|
15127
16098
|
}
|
|
15128
16099
|
return new _ReplitSkill({
|
|
@@ -15157,16 +16128,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
15157
16128
|
};
|
|
15158
16129
|
|
|
15159
16130
|
// src/features/skills/roo-skill.ts
|
|
15160
|
-
import { join as
|
|
15161
|
-
import { z as
|
|
15162
|
-
var RooSkillFrontmatterSchema =
|
|
15163
|
-
name:
|
|
15164
|
-
description:
|
|
16131
|
+
import { join as join98 } from "path";
|
|
16132
|
+
import { z as z56 } from "zod/mini";
|
|
16133
|
+
var RooSkillFrontmatterSchema = z56.looseObject({
|
|
16134
|
+
name: z56.string(),
|
|
16135
|
+
description: z56.string()
|
|
15165
16136
|
});
|
|
15166
16137
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
15167
16138
|
constructor({
|
|
15168
16139
|
outputRoot = process.cwd(),
|
|
15169
|
-
relativeDirPath =
|
|
16140
|
+
relativeDirPath = join98(".roo", "skills"),
|
|
15170
16141
|
dirName,
|
|
15171
16142
|
frontmatter,
|
|
15172
16143
|
body,
|
|
@@ -15197,7 +16168,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
15197
16168
|
global: _global = false
|
|
15198
16169
|
} = {}) {
|
|
15199
16170
|
return {
|
|
15200
|
-
relativeDirPath:
|
|
16171
|
+
relativeDirPath: join98(".roo", "skills")
|
|
15201
16172
|
};
|
|
15202
16173
|
}
|
|
15203
16174
|
getFrontmatter() {
|
|
@@ -15285,13 +16256,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
15285
16256
|
});
|
|
15286
16257
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
15287
16258
|
if (!result.success) {
|
|
15288
|
-
const skillDirPath =
|
|
16259
|
+
const skillDirPath = join98(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
15289
16260
|
throw new Error(
|
|
15290
|
-
`Invalid frontmatter in ${
|
|
16261
|
+
`Invalid frontmatter in ${join98(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
15291
16262
|
);
|
|
15292
16263
|
}
|
|
15293
16264
|
if (result.data.name !== loaded.dirName) {
|
|
15294
|
-
const skillFilePath =
|
|
16265
|
+
const skillFilePath = join98(
|
|
15295
16266
|
loaded.outputRoot,
|
|
15296
16267
|
loaded.relativeDirPath,
|
|
15297
16268
|
loaded.dirName,
|
|
@@ -15332,14 +16303,14 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
15332
16303
|
};
|
|
15333
16304
|
|
|
15334
16305
|
// src/features/skills/skills-utils.ts
|
|
15335
|
-
import { basename as basename4, join as
|
|
16306
|
+
import { basename as basename4, join as join99 } from "path";
|
|
15336
16307
|
async function getLocalSkillDirNames(outputRoot) {
|
|
15337
|
-
const skillsDir =
|
|
16308
|
+
const skillsDir = join99(outputRoot, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
15338
16309
|
const names = /* @__PURE__ */ new Set();
|
|
15339
16310
|
if (!await directoryExists(skillsDir)) {
|
|
15340
16311
|
return names;
|
|
15341
16312
|
}
|
|
15342
|
-
const dirPaths = await findFilesByGlobs(
|
|
16313
|
+
const dirPaths = await findFilesByGlobs(join99(skillsDir, "*"), { type: "dir" });
|
|
15343
16314
|
for (const dirPath of dirPaths) {
|
|
15344
16315
|
const name = basename4(dirPath);
|
|
15345
16316
|
if (name === basename4(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
@@ -15349,7 +16320,7 @@ async function getLocalSkillDirNames(outputRoot) {
|
|
|
15349
16320
|
}
|
|
15350
16321
|
|
|
15351
16322
|
// src/features/skills/takt-skill.ts
|
|
15352
|
-
import path3, { join as
|
|
16323
|
+
import path3, { join as join100, relative as relative5, resolve as resolve6 } from "path";
|
|
15353
16324
|
var DEFAULT_TAKT_SKILL_DIR = "knowledge";
|
|
15354
16325
|
var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
15355
16326
|
fileName;
|
|
@@ -15386,7 +16357,7 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15386
16357
|
}
|
|
15387
16358
|
static getSettablePaths(_options = {}) {
|
|
15388
16359
|
return {
|
|
15389
|
-
relativeDirPath:
|
|
16360
|
+
relativeDirPath: join100(".takt", "facets", DEFAULT_TAKT_SKILL_DIR)
|
|
15390
16361
|
};
|
|
15391
16362
|
}
|
|
15392
16363
|
/**
|
|
@@ -15397,7 +16368,7 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15397
16368
|
* malicious `relativeDirPath` cannot escape `outputRoot`.
|
|
15398
16369
|
*/
|
|
15399
16370
|
getDirPath() {
|
|
15400
|
-
const fullPath =
|
|
16371
|
+
const fullPath = join100(this.outputRoot, this.relativeDirPath);
|
|
15401
16372
|
const resolvedFull = resolve6(fullPath);
|
|
15402
16373
|
const resolvedBase = resolve6(this.outputRoot);
|
|
15403
16374
|
const rel = relative5(resolvedBase, resolvedFull);
|
|
@@ -15438,7 +16409,7 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15438
16409
|
const stem = overrideName ?? rulesyncSkill.getDirName();
|
|
15439
16410
|
assertSafeTaktName({ name: stem, featureLabel: "skill", sourceLabel });
|
|
15440
16411
|
const fileName = `${stem}.md`;
|
|
15441
|
-
const relativeDirPath =
|
|
16412
|
+
const relativeDirPath = join100(".takt", "facets", DEFAULT_TAKT_SKILL_DIR);
|
|
15442
16413
|
return new _TaktSkill({
|
|
15443
16414
|
outputRoot,
|
|
15444
16415
|
relativeDirPath,
|
|
@@ -15488,11 +16459,11 @@ var TaktSkill = class _TaktSkill extends ToolSkill {
|
|
|
15488
16459
|
};
|
|
15489
16460
|
|
|
15490
16461
|
// src/features/skills/windsurf-skill.ts
|
|
15491
|
-
import { join as
|
|
15492
|
-
import { z as
|
|
15493
|
-
var WindsurfSkillFrontmatterSchema =
|
|
15494
|
-
name:
|
|
15495
|
-
description:
|
|
16462
|
+
import { join as join101 } from "path";
|
|
16463
|
+
import { z as z57 } from "zod/mini";
|
|
16464
|
+
var WindsurfSkillFrontmatterSchema = z57.looseObject({
|
|
16465
|
+
name: z57.string(),
|
|
16466
|
+
description: z57.string()
|
|
15496
16467
|
});
|
|
15497
16468
|
var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
15498
16469
|
constructor({
|
|
@@ -15527,11 +16498,11 @@ var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
|
15527
16498
|
static getSettablePaths({ global = false } = {}) {
|
|
15528
16499
|
if (global) {
|
|
15529
16500
|
return {
|
|
15530
|
-
relativeDirPath:
|
|
16501
|
+
relativeDirPath: join101(".codeium", "windsurf", "skills")
|
|
15531
16502
|
};
|
|
15532
16503
|
}
|
|
15533
16504
|
return {
|
|
15534
|
-
relativeDirPath:
|
|
16505
|
+
relativeDirPath: join101(".windsurf", "skills")
|
|
15535
16506
|
};
|
|
15536
16507
|
}
|
|
15537
16508
|
getFrontmatter() {
|
|
@@ -15611,9 +16582,9 @@ var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
|
15611
16582
|
});
|
|
15612
16583
|
const result = WindsurfSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
15613
16584
|
if (!result.success) {
|
|
15614
|
-
const skillDirPath =
|
|
16585
|
+
const skillDirPath = join101(loaded.outputRoot, loaded.relativeDirPath, loaded.dirName);
|
|
15615
16586
|
throw new Error(
|
|
15616
|
-
`Invalid frontmatter in ${
|
|
16587
|
+
`Invalid frontmatter in ${join101(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
15617
16588
|
);
|
|
15618
16589
|
}
|
|
15619
16590
|
return new _WindsurfSkill({
|
|
@@ -15672,7 +16643,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
15672
16643
|
"takt",
|
|
15673
16644
|
"windsurf"
|
|
15674
16645
|
];
|
|
15675
|
-
var SkillsProcessorToolTargetSchema =
|
|
16646
|
+
var SkillsProcessorToolTargetSchema = z58.enum(skillsProcessorToolTargetTuple);
|
|
15676
16647
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
15677
16648
|
[
|
|
15678
16649
|
"agentsmd",
|
|
@@ -15923,10 +16894,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
15923
16894
|
)
|
|
15924
16895
|
);
|
|
15925
16896
|
const localSkillNames = new Set(localDirNames);
|
|
15926
|
-
const curatedDirPath =
|
|
16897
|
+
const curatedDirPath = join102(this.inputRoot, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
15927
16898
|
let curatedSkills = [];
|
|
15928
16899
|
if (await directoryExists(curatedDirPath)) {
|
|
15929
|
-
const curatedDirPaths = await findFilesByGlobs(
|
|
16900
|
+
const curatedDirPaths = await findFilesByGlobs(join102(curatedDirPath, "*"), { type: "dir" });
|
|
15930
16901
|
const curatedDirNames = curatedDirPaths.map((path4) => basename5(path4));
|
|
15931
16902
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
15932
16903
|
if (localSkillNames.has(name)) {
|
|
@@ -15964,11 +16935,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
15964
16935
|
const seenDirNames = /* @__PURE__ */ new Set();
|
|
15965
16936
|
const loadEntries = [];
|
|
15966
16937
|
for (const root of roots) {
|
|
15967
|
-
const skillsDirPath =
|
|
16938
|
+
const skillsDirPath = join102(this.outputRoot, root);
|
|
15968
16939
|
if (!await directoryExists(skillsDirPath)) {
|
|
15969
16940
|
continue;
|
|
15970
16941
|
}
|
|
15971
|
-
const dirPaths = await findFilesByGlobs(
|
|
16942
|
+
const dirPaths = await findFilesByGlobs(join102(skillsDirPath, "*"), { type: "dir" });
|
|
15972
16943
|
for (const dirPath of dirPaths) {
|
|
15973
16944
|
const dirName = basename5(dirPath);
|
|
15974
16945
|
if (seenDirNames.has(dirName)) {
|
|
@@ -15999,11 +16970,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
15999
16970
|
const roots = toolSkillSearchRoots(paths);
|
|
16000
16971
|
const toolSkills = [];
|
|
16001
16972
|
for (const root of roots) {
|
|
16002
|
-
const skillsDirPath =
|
|
16973
|
+
const skillsDirPath = join102(this.outputRoot, root);
|
|
16003
16974
|
if (!await directoryExists(skillsDirPath)) {
|
|
16004
16975
|
continue;
|
|
16005
16976
|
}
|
|
16006
|
-
const dirPaths = await findFilesByGlobs(
|
|
16977
|
+
const dirPaths = await findFilesByGlobs(join102(skillsDirPath, "*"), { type: "dir" });
|
|
16007
16978
|
for (const dirPath of dirPaths) {
|
|
16008
16979
|
const dirName = basename5(dirPath);
|
|
16009
16980
|
const toolSkill = factory.class.forDeletion({
|
|
@@ -16067,11 +17038,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
16067
17038
|
};
|
|
16068
17039
|
|
|
16069
17040
|
// src/features/subagents/agentsmd-subagent.ts
|
|
16070
|
-
import { join as
|
|
17041
|
+
import { join as join104 } from "path";
|
|
16071
17042
|
|
|
16072
17043
|
// src/features/subagents/simulated-subagent.ts
|
|
16073
|
-
import { basename as basename6, join as
|
|
16074
|
-
import { z as
|
|
17044
|
+
import { basename as basename6, join as join103 } from "path";
|
|
17045
|
+
import { z as z59 } from "zod/mini";
|
|
16075
17046
|
|
|
16076
17047
|
// src/features/subagents/tool-subagent.ts
|
|
16077
17048
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -16123,9 +17094,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
16123
17094
|
};
|
|
16124
17095
|
|
|
16125
17096
|
// src/features/subagents/simulated-subagent.ts
|
|
16126
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
16127
|
-
name:
|
|
16128
|
-
description:
|
|
17097
|
+
var SimulatedSubagentFrontmatterSchema = z59.object({
|
|
17098
|
+
name: z59.string(),
|
|
17099
|
+
description: z59.optional(z59.string())
|
|
16129
17100
|
});
|
|
16130
17101
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
16131
17102
|
frontmatter;
|
|
@@ -16135,7 +17106,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16135
17106
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16136
17107
|
if (!result.success) {
|
|
16137
17108
|
throw new Error(
|
|
16138
|
-
`Invalid frontmatter in ${
|
|
17109
|
+
`Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16139
17110
|
);
|
|
16140
17111
|
}
|
|
16141
17112
|
}
|
|
@@ -16186,7 +17157,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16186
17157
|
return {
|
|
16187
17158
|
success: false,
|
|
16188
17159
|
error: new Error(
|
|
16189
|
-
`Invalid frontmatter in ${
|
|
17160
|
+
`Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16190
17161
|
)
|
|
16191
17162
|
};
|
|
16192
17163
|
}
|
|
@@ -16196,7 +17167,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16196
17167
|
relativeFilePath,
|
|
16197
17168
|
validate = true
|
|
16198
17169
|
}) {
|
|
16199
|
-
const filePath =
|
|
17170
|
+
const filePath = join103(outputRoot, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
16200
17171
|
const fileContent = await readFileContent(filePath);
|
|
16201
17172
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16202
17173
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16232,7 +17203,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
16232
17203
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
16233
17204
|
static getSettablePaths() {
|
|
16234
17205
|
return {
|
|
16235
|
-
relativeDirPath:
|
|
17206
|
+
relativeDirPath: join104(".agents", "subagents")
|
|
16236
17207
|
};
|
|
16237
17208
|
}
|
|
16238
17209
|
static async fromFile(params) {
|
|
@@ -16255,11 +17226,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
16255
17226
|
};
|
|
16256
17227
|
|
|
16257
17228
|
// src/features/subagents/factorydroid-subagent.ts
|
|
16258
|
-
import { join as
|
|
17229
|
+
import { join as join105 } from "path";
|
|
16259
17230
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
16260
17231
|
static getSettablePaths(_options) {
|
|
16261
17232
|
return {
|
|
16262
|
-
relativeDirPath:
|
|
17233
|
+
relativeDirPath: join105(".factory", "droids")
|
|
16263
17234
|
};
|
|
16264
17235
|
}
|
|
16265
17236
|
static async fromFile(params) {
|
|
@@ -16282,19 +17253,19 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
16282
17253
|
};
|
|
16283
17254
|
|
|
16284
17255
|
// src/features/subagents/geminicli-subagent.ts
|
|
16285
|
-
import { join as
|
|
16286
|
-
import { z as
|
|
17256
|
+
import { join as join107 } from "path";
|
|
17257
|
+
import { z as z61 } from "zod/mini";
|
|
16287
17258
|
|
|
16288
17259
|
// 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:
|
|
17260
|
+
import { basename as basename7, join as join106 } from "path";
|
|
17261
|
+
import { z as z60 } from "zod/mini";
|
|
17262
|
+
var RulesyncSubagentFrontmatterSchema = z60.looseObject({
|
|
17263
|
+
targets: z60._default(RulesyncTargetsSchema, ["*"]),
|
|
17264
|
+
name: z60.string(),
|
|
17265
|
+
description: z60.optional(z60.string()),
|
|
17266
|
+
takt: z60.optional(
|
|
17267
|
+
z60.looseObject({
|
|
17268
|
+
name: z60.optional(z60.string())
|
|
16298
17269
|
})
|
|
16299
17270
|
)
|
|
16300
17271
|
});
|
|
@@ -16305,7 +17276,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16305
17276
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16306
17277
|
if (!parseResult.success && rest.validate !== false) {
|
|
16307
17278
|
throw new Error(
|
|
16308
|
-
`Invalid frontmatter in ${
|
|
17279
|
+
`Invalid frontmatter in ${join106(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
16309
17280
|
);
|
|
16310
17281
|
}
|
|
16311
17282
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -16338,7 +17309,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16338
17309
|
return {
|
|
16339
17310
|
success: false,
|
|
16340
17311
|
error: new Error(
|
|
16341
|
-
`Invalid frontmatter in ${
|
|
17312
|
+
`Invalid frontmatter in ${join106(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16342
17313
|
)
|
|
16343
17314
|
};
|
|
16344
17315
|
}
|
|
@@ -16347,7 +17318,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16347
17318
|
outputRoot = process.cwd(),
|
|
16348
17319
|
relativeFilePath
|
|
16349
17320
|
}) {
|
|
16350
|
-
const filePath =
|
|
17321
|
+
const filePath = join106(outputRoot, RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
16351
17322
|
const fileContent = await readFileContent(filePath);
|
|
16352
17323
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16353
17324
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16366,9 +17337,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
16366
17337
|
};
|
|
16367
17338
|
|
|
16368
17339
|
// src/features/subagents/geminicli-subagent.ts
|
|
16369
|
-
var GeminiCliSubagentFrontmatterSchema =
|
|
16370
|
-
name:
|
|
16371
|
-
description:
|
|
17340
|
+
var GeminiCliSubagentFrontmatterSchema = z61.looseObject({
|
|
17341
|
+
name: z61.string(),
|
|
17342
|
+
description: z61.optional(z61.string())
|
|
16372
17343
|
});
|
|
16373
17344
|
var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
16374
17345
|
frontmatter;
|
|
@@ -16378,7 +17349,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16378
17349
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16379
17350
|
if (!result.success) {
|
|
16380
17351
|
throw new Error(
|
|
16381
|
-
`Invalid frontmatter in ${
|
|
17352
|
+
`Invalid frontmatter in ${join107(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16382
17353
|
);
|
|
16383
17354
|
}
|
|
16384
17355
|
}
|
|
@@ -16391,7 +17362,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16391
17362
|
}
|
|
16392
17363
|
static getSettablePaths(_options = {}) {
|
|
16393
17364
|
return {
|
|
16394
|
-
relativeDirPath:
|
|
17365
|
+
relativeDirPath: join107(".gemini", "agents")
|
|
16395
17366
|
};
|
|
16396
17367
|
}
|
|
16397
17368
|
getFrontmatter() {
|
|
@@ -16459,7 +17430,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16459
17430
|
return {
|
|
16460
17431
|
success: false,
|
|
16461
17432
|
error: new Error(
|
|
16462
|
-
`Invalid frontmatter in ${
|
|
17433
|
+
`Invalid frontmatter in ${join107(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16463
17434
|
)
|
|
16464
17435
|
};
|
|
16465
17436
|
}
|
|
@@ -16477,7 +17448,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16477
17448
|
global = false
|
|
16478
17449
|
}) {
|
|
16479
17450
|
const paths = this.getSettablePaths({ global });
|
|
16480
|
-
const filePath =
|
|
17451
|
+
const filePath = join107(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16481
17452
|
const fileContent = await readFileContent(filePath);
|
|
16482
17453
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16483
17454
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16513,11 +17484,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
16513
17484
|
};
|
|
16514
17485
|
|
|
16515
17486
|
// src/features/subagents/roo-subagent.ts
|
|
16516
|
-
import { join as
|
|
17487
|
+
import { join as join108 } from "path";
|
|
16517
17488
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
16518
17489
|
static getSettablePaths() {
|
|
16519
17490
|
return {
|
|
16520
|
-
relativeDirPath:
|
|
17491
|
+
relativeDirPath: join108(".roo", "subagents")
|
|
16521
17492
|
};
|
|
16522
17493
|
}
|
|
16523
17494
|
static async fromFile(params) {
|
|
@@ -16540,11 +17511,11 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
16540
17511
|
};
|
|
16541
17512
|
|
|
16542
17513
|
// src/features/subagents/rovodev-subagent.ts
|
|
16543
|
-
import { join as
|
|
16544
|
-
import { z as
|
|
16545
|
-
var RovodevSubagentFrontmatterSchema =
|
|
16546
|
-
name:
|
|
16547
|
-
description:
|
|
17514
|
+
import { join as join109 } from "path";
|
|
17515
|
+
import { z as z62 } from "zod/mini";
|
|
17516
|
+
var RovodevSubagentFrontmatterSchema = z62.looseObject({
|
|
17517
|
+
name: z62.string(),
|
|
17518
|
+
description: z62.optional(z62.string())
|
|
16548
17519
|
});
|
|
16549
17520
|
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
16550
17521
|
frontmatter;
|
|
@@ -16554,7 +17525,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16554
17525
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16555
17526
|
if (!result.success) {
|
|
16556
17527
|
throw new Error(
|
|
16557
|
-
`Invalid frontmatter in ${
|
|
17528
|
+
`Invalid frontmatter in ${join109(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16558
17529
|
);
|
|
16559
17530
|
}
|
|
16560
17531
|
}
|
|
@@ -16566,7 +17537,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16566
17537
|
}
|
|
16567
17538
|
static getSettablePaths(_options = {}) {
|
|
16568
17539
|
return {
|
|
16569
|
-
relativeDirPath:
|
|
17540
|
+
relativeDirPath: join109(".rovodev", "subagents")
|
|
16570
17541
|
};
|
|
16571
17542
|
}
|
|
16572
17543
|
getFrontmatter() {
|
|
@@ -16629,7 +17600,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16629
17600
|
return {
|
|
16630
17601
|
success: false,
|
|
16631
17602
|
error: new Error(
|
|
16632
|
-
`Invalid frontmatter in ${
|
|
17603
|
+
`Invalid frontmatter in ${join109(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16633
17604
|
)
|
|
16634
17605
|
};
|
|
16635
17606
|
}
|
|
@@ -16646,7 +17617,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16646
17617
|
global = false
|
|
16647
17618
|
}) {
|
|
16648
17619
|
const paths = this.getSettablePaths({ global });
|
|
16649
|
-
const filePath =
|
|
17620
|
+
const filePath = join109(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16650
17621
|
const fileContent = await readFileContent(filePath);
|
|
16651
17622
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16652
17623
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16685,19 +17656,19 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
16685
17656
|
};
|
|
16686
17657
|
|
|
16687
17658
|
// src/features/subagents/subagents-processor.ts
|
|
16688
|
-
import { basename as basename9, join as
|
|
16689
|
-
import { z as
|
|
17659
|
+
import { basename as basename9, join as join122 } from "path";
|
|
17660
|
+
import { z as z72 } from "zod/mini";
|
|
16690
17661
|
|
|
16691
17662
|
// 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:
|
|
17663
|
+
import { join as join110 } from "path";
|
|
17664
|
+
import { z as z63 } from "zod/mini";
|
|
17665
|
+
var ClaudecodeSubagentFrontmatterSchema = z63.looseObject({
|
|
17666
|
+
name: z63.string(),
|
|
17667
|
+
description: z63.optional(z63.string()),
|
|
17668
|
+
model: z63.optional(z63.string()),
|
|
17669
|
+
tools: z63.optional(z63.union([z63.string(), z63.array(z63.string())])),
|
|
17670
|
+
permissionMode: z63.optional(z63.string()),
|
|
17671
|
+
skills: z63.optional(z63.union([z63.string(), z63.array(z63.string())]))
|
|
16701
17672
|
});
|
|
16702
17673
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
16703
17674
|
frontmatter;
|
|
@@ -16707,7 +17678,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16707
17678
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
16708
17679
|
if (!result.success) {
|
|
16709
17680
|
throw new Error(
|
|
16710
|
-
`Invalid frontmatter in ${
|
|
17681
|
+
`Invalid frontmatter in ${join110(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16711
17682
|
);
|
|
16712
17683
|
}
|
|
16713
17684
|
}
|
|
@@ -16719,7 +17690,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16719
17690
|
}
|
|
16720
17691
|
static getSettablePaths(_options = {}) {
|
|
16721
17692
|
return {
|
|
16722
|
-
relativeDirPath:
|
|
17693
|
+
relativeDirPath: join110(".claude", "agents")
|
|
16723
17694
|
};
|
|
16724
17695
|
}
|
|
16725
17696
|
getFrontmatter() {
|
|
@@ -16798,7 +17769,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16798
17769
|
return {
|
|
16799
17770
|
success: false,
|
|
16800
17771
|
error: new Error(
|
|
16801
|
-
`Invalid frontmatter in ${
|
|
17772
|
+
`Invalid frontmatter in ${join110(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16802
17773
|
)
|
|
16803
17774
|
};
|
|
16804
17775
|
}
|
|
@@ -16816,7 +17787,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16816
17787
|
global = false
|
|
16817
17788
|
}) {
|
|
16818
17789
|
const paths = this.getSettablePaths({ global });
|
|
16819
|
-
const filePath =
|
|
17790
|
+
const filePath = join110(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16820
17791
|
const fileContent = await readFileContent(filePath);
|
|
16821
17792
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16822
17793
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16851,16 +17822,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
16851
17822
|
};
|
|
16852
17823
|
|
|
16853
17824
|
// src/features/subagents/codexcli-subagent.ts
|
|
16854
|
-
import { join as
|
|
17825
|
+
import { join as join111 } from "path";
|
|
16855
17826
|
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:
|
|
17827
|
+
import { z as z64 } from "zod/mini";
|
|
17828
|
+
var CodexCliSubagentTomlSchema = z64.looseObject({
|
|
17829
|
+
name: z64.string(),
|
|
17830
|
+
description: z64.optional(z64.string()),
|
|
17831
|
+
developer_instructions: z64.optional(z64.string()),
|
|
17832
|
+
model: z64.optional(z64.string()),
|
|
17833
|
+
model_reasoning_effort: z64.optional(z64.string()),
|
|
17834
|
+
sandbox_mode: z64.optional(z64.string())
|
|
16864
17835
|
});
|
|
16865
17836
|
function stringifyCodexCliSubagentToml(tomlObj) {
|
|
16866
17837
|
const { developer_instructions, ...restFields } = tomlObj;
|
|
@@ -16882,7 +17853,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16882
17853
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
16883
17854
|
} catch (error) {
|
|
16884
17855
|
throw new Error(
|
|
16885
|
-
`Invalid TOML in ${
|
|
17856
|
+
`Invalid TOML in ${join111(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
16886
17857
|
{ cause: error }
|
|
16887
17858
|
);
|
|
16888
17859
|
}
|
|
@@ -16894,7 +17865,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16894
17865
|
}
|
|
16895
17866
|
static getSettablePaths(_options = {}) {
|
|
16896
17867
|
return {
|
|
16897
|
-
relativeDirPath:
|
|
17868
|
+
relativeDirPath: join111(".codex", "agents")
|
|
16898
17869
|
};
|
|
16899
17870
|
}
|
|
16900
17871
|
getBody() {
|
|
@@ -16906,7 +17877,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16906
17877
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml6.parse(this.body));
|
|
16907
17878
|
} catch (error) {
|
|
16908
17879
|
throw new Error(
|
|
16909
|
-
`Failed to parse TOML in ${
|
|
17880
|
+
`Failed to parse TOML in ${join111(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
16910
17881
|
{ cause: error }
|
|
16911
17882
|
);
|
|
16912
17883
|
}
|
|
@@ -16987,7 +17958,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
16987
17958
|
global = false
|
|
16988
17959
|
}) {
|
|
16989
17960
|
const paths = this.getSettablePaths({ global });
|
|
16990
|
-
const filePath =
|
|
17961
|
+
const filePath = join111(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
16991
17962
|
const fileContent = await readFileContent(filePath);
|
|
16992
17963
|
const subagent = new _CodexCliSubagent({
|
|
16993
17964
|
outputRoot,
|
|
@@ -17025,13 +17996,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
17025
17996
|
};
|
|
17026
17997
|
|
|
17027
17998
|
// src/features/subagents/copilot-subagent.ts
|
|
17028
|
-
import { join as
|
|
17029
|
-
import { z as
|
|
17999
|
+
import { join as join112 } from "path";
|
|
18000
|
+
import { z as z65 } from "zod/mini";
|
|
17030
18001
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
17031
|
-
var CopilotSubagentFrontmatterSchema =
|
|
17032
|
-
name:
|
|
17033
|
-
description:
|
|
17034
|
-
tools:
|
|
18002
|
+
var CopilotSubagentFrontmatterSchema = z65.looseObject({
|
|
18003
|
+
name: z65.string(),
|
|
18004
|
+
description: z65.optional(z65.string()),
|
|
18005
|
+
tools: z65.optional(z65.union([z65.string(), z65.array(z65.string())]))
|
|
17035
18006
|
});
|
|
17036
18007
|
var normalizeTools = (tools) => {
|
|
17037
18008
|
if (!tools) {
|
|
@@ -17066,7 +18037,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17066
18037
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17067
18038
|
if (!result.success) {
|
|
17068
18039
|
throw new Error(
|
|
17069
|
-
`Invalid frontmatter in ${
|
|
18040
|
+
`Invalid frontmatter in ${join112(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17070
18041
|
);
|
|
17071
18042
|
}
|
|
17072
18043
|
}
|
|
@@ -17078,7 +18049,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17078
18049
|
}
|
|
17079
18050
|
static getSettablePaths(_options = {}) {
|
|
17080
18051
|
return {
|
|
17081
|
-
relativeDirPath:
|
|
18052
|
+
relativeDirPath: join112(".github", "agents")
|
|
17082
18053
|
};
|
|
17083
18054
|
}
|
|
17084
18055
|
getFrontmatter() {
|
|
@@ -17152,7 +18123,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17152
18123
|
return {
|
|
17153
18124
|
success: false,
|
|
17154
18125
|
error: new Error(
|
|
17155
|
-
`Invalid frontmatter in ${
|
|
18126
|
+
`Invalid frontmatter in ${join112(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17156
18127
|
)
|
|
17157
18128
|
};
|
|
17158
18129
|
}
|
|
@@ -17170,7 +18141,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17170
18141
|
global = false
|
|
17171
18142
|
}) {
|
|
17172
18143
|
const paths = this.getSettablePaths({ global });
|
|
17173
|
-
const filePath =
|
|
18144
|
+
const filePath = join112(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17174
18145
|
const fileContent = await readFileContent(filePath);
|
|
17175
18146
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17176
18147
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17206,18 +18177,18 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
17206
18177
|
};
|
|
17207
18178
|
|
|
17208
18179
|
// 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:
|
|
18180
|
+
import { join as join113 } from "path";
|
|
18181
|
+
import { z as z66 } from "zod/mini";
|
|
18182
|
+
var CopilotCliSubagentFrontmatterSchema = z66.looseObject({
|
|
18183
|
+
description: z66.string(),
|
|
18184
|
+
name: z66.optional(z66.string()),
|
|
18185
|
+
target: z66.optional(z66.string()),
|
|
18186
|
+
tools: z66.optional(z66.union([z66.string(), z66.array(z66.string())])),
|
|
18187
|
+
model: z66.optional(z66.string()),
|
|
18188
|
+
"disable-model-invocation": z66.optional(z66.boolean()),
|
|
18189
|
+
"user-invocable": z66.optional(z66.boolean()),
|
|
18190
|
+
"mcp-servers": z66.optional(z66.record(z66.string(), z66.unknown())),
|
|
18191
|
+
metadata: z66.optional(z66.record(z66.string(), z66.unknown()))
|
|
17221
18192
|
});
|
|
17222
18193
|
var toCopilotCliAgentFilePath = (relativeFilePath) => {
|
|
17223
18194
|
if (relativeFilePath.endsWith(".agent.md")) {
|
|
@@ -17242,7 +18213,7 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17242
18213
|
const result = CopilotCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17243
18214
|
if (!result.success) {
|
|
17244
18215
|
throw new Error(
|
|
17245
|
-
`Invalid frontmatter in ${
|
|
18216
|
+
`Invalid frontmatter in ${join113(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17246
18217
|
);
|
|
17247
18218
|
}
|
|
17248
18219
|
}
|
|
@@ -17254,9 +18225,9 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17254
18225
|
global = false
|
|
17255
18226
|
} = {}) {
|
|
17256
18227
|
if (global) {
|
|
17257
|
-
return { relativeDirPath:
|
|
18228
|
+
return { relativeDirPath: join113(".copilot", "agents") };
|
|
17258
18229
|
}
|
|
17259
|
-
return { relativeDirPath:
|
|
18230
|
+
return { relativeDirPath: join113(".github", "agents") };
|
|
17260
18231
|
}
|
|
17261
18232
|
getFrontmatter() {
|
|
17262
18233
|
return this.frontmatter;
|
|
@@ -17334,7 +18305,7 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17334
18305
|
return {
|
|
17335
18306
|
success: false,
|
|
17336
18307
|
error: new Error(
|
|
17337
|
-
`Invalid frontmatter in ${
|
|
18308
|
+
`Invalid frontmatter in ${join113(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17338
18309
|
)
|
|
17339
18310
|
};
|
|
17340
18311
|
}
|
|
@@ -17351,7 +18322,7 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17351
18322
|
global = false
|
|
17352
18323
|
}) {
|
|
17353
18324
|
const paths = this.getSettablePaths({ global });
|
|
17354
|
-
const filePath =
|
|
18325
|
+
const filePath = join113(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17355
18326
|
const fileContent = await readFileContent(filePath);
|
|
17356
18327
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17357
18328
|
const result = CopilotCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17387,11 +18358,11 @@ var CopilotcliSubagent = class _CopilotcliSubagent extends ToolSubagent {
|
|
|
17387
18358
|
};
|
|
17388
18359
|
|
|
17389
18360
|
// src/features/subagents/cursor-subagent.ts
|
|
17390
|
-
import { join as
|
|
17391
|
-
import { z as
|
|
17392
|
-
var CursorSubagentFrontmatterSchema =
|
|
17393
|
-
name:
|
|
17394
|
-
description:
|
|
18361
|
+
import { join as join114 } from "path";
|
|
18362
|
+
import { z as z67 } from "zod/mini";
|
|
18363
|
+
var CursorSubagentFrontmatterSchema = z67.looseObject({
|
|
18364
|
+
name: z67.string(),
|
|
18365
|
+
description: z67.optional(z67.string())
|
|
17395
18366
|
});
|
|
17396
18367
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
17397
18368
|
frontmatter;
|
|
@@ -17401,7 +18372,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17401
18372
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17402
18373
|
if (!result.success) {
|
|
17403
18374
|
throw new Error(
|
|
17404
|
-
`Invalid frontmatter in ${
|
|
18375
|
+
`Invalid frontmatter in ${join114(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17405
18376
|
);
|
|
17406
18377
|
}
|
|
17407
18378
|
}
|
|
@@ -17413,7 +18384,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17413
18384
|
}
|
|
17414
18385
|
static getSettablePaths(_options = {}) {
|
|
17415
18386
|
return {
|
|
17416
|
-
relativeDirPath:
|
|
18387
|
+
relativeDirPath: join114(".cursor", "agents")
|
|
17417
18388
|
};
|
|
17418
18389
|
}
|
|
17419
18390
|
getFrontmatter() {
|
|
@@ -17480,7 +18451,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17480
18451
|
return {
|
|
17481
18452
|
success: false,
|
|
17482
18453
|
error: new Error(
|
|
17483
|
-
`Invalid frontmatter in ${
|
|
18454
|
+
`Invalid frontmatter in ${join114(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17484
18455
|
)
|
|
17485
18456
|
};
|
|
17486
18457
|
}
|
|
@@ -17498,7 +18469,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17498
18469
|
global = false
|
|
17499
18470
|
}) {
|
|
17500
18471
|
const paths = this.getSettablePaths({ global });
|
|
17501
|
-
const filePath =
|
|
18472
|
+
const filePath = join114(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17502
18473
|
const fileContent = await readFileContent(filePath);
|
|
17503
18474
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17504
18475
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17534,12 +18505,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
17534
18505
|
};
|
|
17535
18506
|
|
|
17536
18507
|
// src/features/subagents/deepagents-subagent.ts
|
|
17537
|
-
import { join as
|
|
17538
|
-
import { z as
|
|
17539
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
17540
|
-
name:
|
|
17541
|
-
description:
|
|
17542
|
-
model:
|
|
18508
|
+
import { join as join115 } from "path";
|
|
18509
|
+
import { z as z68 } from "zod/mini";
|
|
18510
|
+
var DeepagentsSubagentFrontmatterSchema = z68.looseObject({
|
|
18511
|
+
name: z68.string(),
|
|
18512
|
+
description: z68.optional(z68.string()),
|
|
18513
|
+
model: z68.optional(z68.string())
|
|
17543
18514
|
});
|
|
17544
18515
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
17545
18516
|
frontmatter;
|
|
@@ -17549,7 +18520,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17549
18520
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17550
18521
|
if (!result.success) {
|
|
17551
18522
|
throw new Error(
|
|
17552
|
-
`Invalid frontmatter in ${
|
|
18523
|
+
`Invalid frontmatter in ${join115(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17553
18524
|
);
|
|
17554
18525
|
}
|
|
17555
18526
|
}
|
|
@@ -17559,7 +18530,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17559
18530
|
}
|
|
17560
18531
|
static getSettablePaths(_options = {}) {
|
|
17561
18532
|
return {
|
|
17562
|
-
relativeDirPath:
|
|
18533
|
+
relativeDirPath: join115(".deepagents", "agents")
|
|
17563
18534
|
};
|
|
17564
18535
|
}
|
|
17565
18536
|
getFrontmatter() {
|
|
@@ -17634,7 +18605,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17634
18605
|
return {
|
|
17635
18606
|
success: false,
|
|
17636
18607
|
error: new Error(
|
|
17637
|
-
`Invalid frontmatter in ${
|
|
18608
|
+
`Invalid frontmatter in ${join115(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17638
18609
|
)
|
|
17639
18610
|
};
|
|
17640
18611
|
}
|
|
@@ -17652,7 +18623,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17652
18623
|
global = false
|
|
17653
18624
|
}) {
|
|
17654
18625
|
const paths = this.getSettablePaths({ global });
|
|
17655
|
-
const filePath =
|
|
18626
|
+
const filePath = join115(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17656
18627
|
const fileContent = await readFileContent(filePath);
|
|
17657
18628
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17658
18629
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17687,11 +18658,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
17687
18658
|
};
|
|
17688
18659
|
|
|
17689
18660
|
// src/features/subagents/junie-subagent.ts
|
|
17690
|
-
import { join as
|
|
17691
|
-
import { z as
|
|
17692
|
-
var JunieSubagentFrontmatterSchema =
|
|
17693
|
-
name:
|
|
17694
|
-
description:
|
|
18661
|
+
import { join as join116 } from "path";
|
|
18662
|
+
import { z as z69 } from "zod/mini";
|
|
18663
|
+
var JunieSubagentFrontmatterSchema = z69.looseObject({
|
|
18664
|
+
name: z69.optional(z69.string()),
|
|
18665
|
+
description: z69.string()
|
|
17695
18666
|
});
|
|
17696
18667
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
17697
18668
|
frontmatter;
|
|
@@ -17701,7 +18672,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17701
18672
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17702
18673
|
if (!result.success) {
|
|
17703
18674
|
throw new Error(
|
|
17704
|
-
`Invalid frontmatter in ${
|
|
18675
|
+
`Invalid frontmatter in ${join116(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17705
18676
|
);
|
|
17706
18677
|
}
|
|
17707
18678
|
}
|
|
@@ -17716,7 +18687,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17716
18687
|
throw new Error("JunieSubagent does not support global mode.");
|
|
17717
18688
|
}
|
|
17718
18689
|
return {
|
|
17719
|
-
relativeDirPath:
|
|
18690
|
+
relativeDirPath: join116(".junie", "agents")
|
|
17720
18691
|
};
|
|
17721
18692
|
}
|
|
17722
18693
|
getFrontmatter() {
|
|
@@ -17792,7 +18763,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17792
18763
|
return {
|
|
17793
18764
|
success: false,
|
|
17794
18765
|
error: new Error(
|
|
17795
|
-
`Invalid frontmatter in ${
|
|
18766
|
+
`Invalid frontmatter in ${join116(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17796
18767
|
)
|
|
17797
18768
|
};
|
|
17798
18769
|
}
|
|
@@ -17810,7 +18781,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17810
18781
|
global = false
|
|
17811
18782
|
}) {
|
|
17812
18783
|
const paths = this.getSettablePaths({ global });
|
|
17813
|
-
const filePath =
|
|
18784
|
+
const filePath = join116(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17814
18785
|
const fileContent = await readFileContent(filePath);
|
|
17815
18786
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17816
18787
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17845,15 +18816,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
17845
18816
|
};
|
|
17846
18817
|
|
|
17847
18818
|
// src/features/subagents/kilo-subagent.ts
|
|
17848
|
-
import { join as
|
|
18819
|
+
import { join as join118 } from "path";
|
|
17849
18820
|
|
|
17850
18821
|
// 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:
|
|
18822
|
+
import { basename as basename8, join as join117 } from "path";
|
|
18823
|
+
import { z as z70 } from "zod/mini";
|
|
18824
|
+
var OpenCodeStyleSubagentFrontmatterSchema = z70.looseObject({
|
|
18825
|
+
description: z70.optional(z70.string()),
|
|
18826
|
+
mode: z70._default(z70.string(), "subagent"),
|
|
18827
|
+
name: z70.optional(z70.string())
|
|
17857
18828
|
});
|
|
17858
18829
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
17859
18830
|
frontmatter;
|
|
@@ -17863,7 +18834,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
17863
18834
|
const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
17864
18835
|
if (!result.success) {
|
|
17865
18836
|
throw new Error(
|
|
17866
|
-
`Invalid frontmatter in ${
|
|
18837
|
+
`Invalid frontmatter in ${join117(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17867
18838
|
);
|
|
17868
18839
|
}
|
|
17869
18840
|
}
|
|
@@ -17905,7 +18876,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
17905
18876
|
return {
|
|
17906
18877
|
success: false,
|
|
17907
18878
|
error: new Error(
|
|
17908
|
-
`Invalid frontmatter in ${
|
|
18879
|
+
`Invalid frontmatter in ${join117(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17909
18880
|
)
|
|
17910
18881
|
};
|
|
17911
18882
|
}
|
|
@@ -17921,7 +18892,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
17921
18892
|
global = false
|
|
17922
18893
|
} = {}) {
|
|
17923
18894
|
return {
|
|
17924
|
-
relativeDirPath: global ?
|
|
18895
|
+
relativeDirPath: global ? join118(".config", "kilo", "agent") : join118(".kilo", "agent")
|
|
17925
18896
|
};
|
|
17926
18897
|
}
|
|
17927
18898
|
static fromRulesyncSubagent({
|
|
@@ -17965,7 +18936,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
17965
18936
|
global = false
|
|
17966
18937
|
}) {
|
|
17967
18938
|
const paths = this.getSettablePaths({ global });
|
|
17968
|
-
const filePath =
|
|
18939
|
+
const filePath = join118(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
17969
18940
|
const fileContent = await readFileContent(filePath);
|
|
17970
18941
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17971
18942
|
const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -18001,23 +18972,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
18001
18972
|
};
|
|
18002
18973
|
|
|
18003
18974
|
// 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:
|
|
18975
|
+
import { join as join119 } from "path";
|
|
18976
|
+
import { z as z71 } from "zod/mini";
|
|
18977
|
+
var KiroCliSubagentJsonSchema = z71.looseObject({
|
|
18978
|
+
name: z71.string(),
|
|
18979
|
+
description: z71.optional(z71.nullable(z71.string())),
|
|
18980
|
+
prompt: z71.optional(z71.nullable(z71.string())),
|
|
18981
|
+
tools: z71.optional(z71.nullable(z71.array(z71.string()))),
|
|
18982
|
+
toolAliases: z71.optional(z71.nullable(z71.record(z71.string(), z71.string()))),
|
|
18983
|
+
toolSettings: z71.optional(z71.nullable(z71.unknown())),
|
|
18984
|
+
toolSchema: z71.optional(z71.nullable(z71.unknown())),
|
|
18985
|
+
hooks: z71.optional(z71.nullable(z71.record(z71.string(), z71.array(z71.unknown())))),
|
|
18986
|
+
model: z71.optional(z71.nullable(z71.string())),
|
|
18987
|
+
mcpServers: z71.optional(z71.nullable(z71.record(z71.string(), z71.unknown()))),
|
|
18988
|
+
useLegacyMcpJson: z71.optional(z71.nullable(z71.boolean())),
|
|
18989
|
+
resources: z71.optional(z71.nullable(z71.array(z71.string()))),
|
|
18990
|
+
allowedTools: z71.optional(z71.nullable(z71.array(z71.string()))),
|
|
18991
|
+
includeMcpJson: z71.optional(z71.nullable(z71.boolean()))
|
|
18021
18992
|
});
|
|
18022
18993
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
18023
18994
|
body;
|
|
@@ -18028,7 +18999,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18028
18999
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
18029
19000
|
} catch (error) {
|
|
18030
19001
|
throw new Error(
|
|
18031
|
-
`Invalid JSON in ${
|
|
19002
|
+
`Invalid JSON in ${join119(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
18032
19003
|
{ cause: error }
|
|
18033
19004
|
);
|
|
18034
19005
|
}
|
|
@@ -18040,7 +19011,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18040
19011
|
}
|
|
18041
19012
|
static getSettablePaths(_options = {}) {
|
|
18042
19013
|
return {
|
|
18043
|
-
relativeDirPath:
|
|
19014
|
+
relativeDirPath: join119(".kiro", "agents")
|
|
18044
19015
|
};
|
|
18045
19016
|
}
|
|
18046
19017
|
getBody() {
|
|
@@ -18052,7 +19023,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18052
19023
|
parsed = JSON.parse(this.body);
|
|
18053
19024
|
} catch (error) {
|
|
18054
19025
|
throw new Error(
|
|
18055
|
-
`Failed to parse JSON in ${
|
|
19026
|
+
`Failed to parse JSON in ${join119(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
18056
19027
|
{ cause: error }
|
|
18057
19028
|
);
|
|
18058
19029
|
}
|
|
@@ -18133,7 +19104,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18133
19104
|
global = false
|
|
18134
19105
|
}) {
|
|
18135
19106
|
const paths = this.getSettablePaths({ global });
|
|
18136
|
-
const filePath =
|
|
19107
|
+
const filePath = join119(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
18137
19108
|
const fileContent = await readFileContent(filePath);
|
|
18138
19109
|
const subagent = new _KiroSubagent({
|
|
18139
19110
|
outputRoot,
|
|
@@ -18171,7 +19142,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
18171
19142
|
};
|
|
18172
19143
|
|
|
18173
19144
|
// src/features/subagents/opencode-subagent.ts
|
|
18174
|
-
import { join as
|
|
19145
|
+
import { join as join120 } from "path";
|
|
18175
19146
|
var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
|
|
18176
19147
|
var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
18177
19148
|
getToolTarget() {
|
|
@@ -18181,7 +19152,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
18181
19152
|
global = false
|
|
18182
19153
|
} = {}) {
|
|
18183
19154
|
return {
|
|
18184
|
-
relativeDirPath: global ?
|
|
19155
|
+
relativeDirPath: global ? join120(".config", "opencode", "agent") : join120(".opencode", "agent")
|
|
18185
19156
|
};
|
|
18186
19157
|
}
|
|
18187
19158
|
static fromRulesyncSubagent({
|
|
@@ -18225,7 +19196,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
18225
19196
|
global = false
|
|
18226
19197
|
}) {
|
|
18227
19198
|
const paths = this.getSettablePaths({ global });
|
|
18228
|
-
const filePath =
|
|
19199
|
+
const filePath = join120(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
18229
19200
|
const fileContent = await readFileContent(filePath);
|
|
18230
19201
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
18231
19202
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -18261,7 +19232,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
18261
19232
|
};
|
|
18262
19233
|
|
|
18263
19234
|
// src/features/subagents/takt-subagent.ts
|
|
18264
|
-
import { join as
|
|
19235
|
+
import { join as join121 } from "path";
|
|
18265
19236
|
var DEFAULT_TAKT_SUBAGENT_DIR = "personas";
|
|
18266
19237
|
var TaktSubagent = class _TaktSubagent extends ToolSubagent {
|
|
18267
19238
|
body;
|
|
@@ -18273,7 +19244,7 @@ var TaktSubagent = class _TaktSubagent extends ToolSubagent {
|
|
|
18273
19244
|
}
|
|
18274
19245
|
static getSettablePaths(_options = {}) {
|
|
18275
19246
|
return {
|
|
18276
|
-
relativeDirPath:
|
|
19247
|
+
relativeDirPath: join121(".takt", "facets", DEFAULT_TAKT_SUBAGENT_DIR)
|
|
18277
19248
|
};
|
|
18278
19249
|
}
|
|
18279
19250
|
getBody() {
|
|
@@ -18335,7 +19306,7 @@ var TaktSubagent = class _TaktSubagent extends ToolSubagent {
|
|
|
18335
19306
|
global = false
|
|
18336
19307
|
}) {
|
|
18337
19308
|
const paths = this.getSettablePaths({ global });
|
|
18338
|
-
const filePath =
|
|
19309
|
+
const filePath = join121(outputRoot, paths.relativeDirPath, relativeFilePath);
|
|
18339
19310
|
const fileContent = await readFileContent(filePath);
|
|
18340
19311
|
const { body } = parseFrontmatter(fileContent, filePath);
|
|
18341
19312
|
return new _TaktSubagent({
|
|
@@ -18383,7 +19354,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
18383
19354
|
"rovodev",
|
|
18384
19355
|
"takt"
|
|
18385
19356
|
];
|
|
18386
|
-
var SubagentsProcessorToolTargetSchema =
|
|
19357
|
+
var SubagentsProcessorToolTargetSchema = z72.enum(subagentsProcessorToolTargetTuple);
|
|
18387
19358
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
18388
19359
|
[
|
|
18389
19360
|
"agentsmd",
|
|
@@ -18592,7 +19563,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18592
19563
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
18593
19564
|
*/
|
|
18594
19565
|
async loadRulesyncFiles() {
|
|
18595
|
-
const subagentsDir =
|
|
19566
|
+
const subagentsDir = join122(this.inputRoot, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
18596
19567
|
const dirExists = await directoryExists(subagentsDir);
|
|
18597
19568
|
if (!dirExists) {
|
|
18598
19569
|
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -18607,7 +19578,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18607
19578
|
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
18608
19579
|
const rulesyncSubagents = [];
|
|
18609
19580
|
for (const mdFile of mdFiles) {
|
|
18610
|
-
const filepath =
|
|
19581
|
+
const filepath = join122(subagentsDir, mdFile);
|
|
18611
19582
|
try {
|
|
18612
19583
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
18613
19584
|
outputRoot: this.inputRoot,
|
|
@@ -18638,7 +19609,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18638
19609
|
const factory = this.getFactory(this.toolTarget);
|
|
18639
19610
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
18640
19611
|
const subagentFilePaths = await findFilesByGlobs(
|
|
18641
|
-
|
|
19612
|
+
join122(this.outputRoot, paths.relativeDirPath, factory.meta.filePattern)
|
|
18642
19613
|
);
|
|
18643
19614
|
if (forDeletion) {
|
|
18644
19615
|
const toolSubagents2 = subagentFilePaths.map(
|
|
@@ -18705,55 +19676,55 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
18705
19676
|
};
|
|
18706
19677
|
|
|
18707
19678
|
// src/features/rules/agentsmd-rule.ts
|
|
18708
|
-
import { join as
|
|
19679
|
+
import { join as join125 } from "path";
|
|
18709
19680
|
|
|
18710
19681
|
// src/features/rules/tool-rule.ts
|
|
18711
|
-
import { join as
|
|
19682
|
+
import { join as join124 } from "path";
|
|
18712
19683
|
|
|
18713
19684
|
// 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
|
-
|
|
19685
|
+
import { join as join123 } from "path";
|
|
19686
|
+
import { z as z73 } from "zod/mini";
|
|
19687
|
+
var RulesyncRuleFrontmatterSchema = z73.object({
|
|
19688
|
+
root: z73.optional(z73.boolean()),
|
|
19689
|
+
localRoot: z73.optional(z73.boolean()),
|
|
19690
|
+
targets: z73._default(RulesyncTargetsSchema, ["*"]),
|
|
19691
|
+
description: z73.optional(z73.string()),
|
|
19692
|
+
globs: z73.optional(z73.array(z73.string())),
|
|
19693
|
+
agentsmd: z73.optional(
|
|
19694
|
+
z73.looseObject({
|
|
18724
19695
|
// @example "path/to/subproject"
|
|
18725
|
-
subprojectPath:
|
|
19696
|
+
subprojectPath: z73.optional(z73.string())
|
|
18726
19697
|
})
|
|
18727
19698
|
),
|
|
18728
|
-
claudecode:
|
|
18729
|
-
|
|
19699
|
+
claudecode: z73.optional(
|
|
19700
|
+
z73.looseObject({
|
|
18730
19701
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
18731
19702
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
18732
|
-
paths:
|
|
19703
|
+
paths: z73.optional(z73.array(z73.string()))
|
|
18733
19704
|
})
|
|
18734
19705
|
),
|
|
18735
|
-
cursor:
|
|
18736
|
-
|
|
18737
|
-
alwaysApply:
|
|
18738
|
-
description:
|
|
18739
|
-
globs:
|
|
19706
|
+
cursor: z73.optional(
|
|
19707
|
+
z73.looseObject({
|
|
19708
|
+
alwaysApply: z73.optional(z73.boolean()),
|
|
19709
|
+
description: z73.optional(z73.string()),
|
|
19710
|
+
globs: z73.optional(z73.array(z73.string()))
|
|
18740
19711
|
})
|
|
18741
19712
|
),
|
|
18742
|
-
copilot:
|
|
18743
|
-
|
|
18744
|
-
excludeAgent:
|
|
19713
|
+
copilot: z73.optional(
|
|
19714
|
+
z73.looseObject({
|
|
19715
|
+
excludeAgent: z73.optional(z73.union([z73.literal("code-review"), z73.literal("coding-agent")]))
|
|
18745
19716
|
})
|
|
18746
19717
|
),
|
|
18747
|
-
antigravity:
|
|
18748
|
-
|
|
18749
|
-
trigger:
|
|
18750
|
-
globs:
|
|
19718
|
+
antigravity: z73.optional(
|
|
19719
|
+
z73.looseObject({
|
|
19720
|
+
trigger: z73.optional(z73.string()),
|
|
19721
|
+
globs: z73.optional(z73.array(z73.string()))
|
|
18751
19722
|
})
|
|
18752
19723
|
),
|
|
18753
|
-
takt:
|
|
18754
|
-
|
|
19724
|
+
takt: z73.optional(
|
|
19725
|
+
z73.looseObject({
|
|
18755
19726
|
// Rename the emitted file stem (e.g. "coder.md" → "{name}.md").
|
|
18756
|
-
name:
|
|
19727
|
+
name: z73.optional(z73.string())
|
|
18757
19728
|
})
|
|
18758
19729
|
)
|
|
18759
19730
|
});
|
|
@@ -18764,7 +19735,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
18764
19735
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
18765
19736
|
if (!parseResult.success && rest.validate !== false) {
|
|
18766
19737
|
throw new Error(
|
|
18767
|
-
`Invalid frontmatter in ${
|
|
19738
|
+
`Invalid frontmatter in ${join123(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
18768
19739
|
);
|
|
18769
19740
|
}
|
|
18770
19741
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -18799,7 +19770,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
18799
19770
|
return {
|
|
18800
19771
|
success: false,
|
|
18801
19772
|
error: new Error(
|
|
18802
|
-
`Invalid frontmatter in ${
|
|
19773
|
+
`Invalid frontmatter in ${join123(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
18803
19774
|
)
|
|
18804
19775
|
};
|
|
18805
19776
|
}
|
|
@@ -18809,7 +19780,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
18809
19780
|
relativeFilePath,
|
|
18810
19781
|
validate = true
|
|
18811
19782
|
}) {
|
|
18812
|
-
const filePath =
|
|
19783
|
+
const filePath = join123(
|
|
18813
19784
|
outputRoot,
|
|
18814
19785
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
18815
19786
|
relativeFilePath
|
|
@@ -18908,7 +19879,7 @@ var ToolRule = class extends ToolFile {
|
|
|
18908
19879
|
rulesyncRule,
|
|
18909
19880
|
validate = true,
|
|
18910
19881
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
18911
|
-
nonRootPath = { relativeDirPath:
|
|
19882
|
+
nonRootPath = { relativeDirPath: join124(".agents", "memories") }
|
|
18912
19883
|
}) {
|
|
18913
19884
|
const params = this.buildToolRuleParamsDefault({
|
|
18914
19885
|
outputRoot,
|
|
@@ -18919,7 +19890,7 @@ var ToolRule = class extends ToolFile {
|
|
|
18919
19890
|
});
|
|
18920
19891
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
18921
19892
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
18922
|
-
params.relativeDirPath =
|
|
19893
|
+
params.relativeDirPath = join124(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
18923
19894
|
params.relativeFilePath = "AGENTS.md";
|
|
18924
19895
|
}
|
|
18925
19896
|
return params;
|
|
@@ -18968,7 +19939,7 @@ var ToolRule = class extends ToolFile {
|
|
|
18968
19939
|
}
|
|
18969
19940
|
};
|
|
18970
19941
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
18971
|
-
return excludeToolDir ? subDir :
|
|
19942
|
+
return excludeToolDir ? subDir : join124(toolDir, subDir);
|
|
18972
19943
|
}
|
|
18973
19944
|
|
|
18974
19945
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -18997,8 +19968,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
18997
19968
|
validate = true
|
|
18998
19969
|
}) {
|
|
18999
19970
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
19000
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
19001
|
-
const fileContent = await readFileContent(
|
|
19971
|
+
const relativePath = isRoot ? "AGENTS.md" : join125(".agents", "memories", relativeFilePath);
|
|
19972
|
+
const fileContent = await readFileContent(join125(outputRoot, relativePath));
|
|
19002
19973
|
return new _AgentsMdRule({
|
|
19003
19974
|
outputRoot,
|
|
19004
19975
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -19053,21 +20024,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
19053
20024
|
};
|
|
19054
20025
|
|
|
19055
20026
|
// 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
|
-
|
|
20027
|
+
import { join as join126 } from "path";
|
|
20028
|
+
import { z as z74 } from "zod/mini";
|
|
20029
|
+
var AntigravityRuleFrontmatterSchema = z74.looseObject({
|
|
20030
|
+
trigger: z74.optional(
|
|
20031
|
+
z74.union([
|
|
20032
|
+
z74.literal("always_on"),
|
|
20033
|
+
z74.literal("glob"),
|
|
20034
|
+
z74.literal("manual"),
|
|
20035
|
+
z74.literal("model_decision"),
|
|
20036
|
+
z74.string()
|
|
19066
20037
|
// accepts any string for forward compatibility
|
|
19067
20038
|
])
|
|
19068
20039
|
),
|
|
19069
|
-
globs:
|
|
19070
|
-
description:
|
|
20040
|
+
globs: z74.optional(z74.string()),
|
|
20041
|
+
description: z74.optional(z74.string())
|
|
19071
20042
|
});
|
|
19072
20043
|
function parseGlobsString(globs) {
|
|
19073
20044
|
if (!globs) {
|
|
@@ -19212,7 +20183,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
19212
20183
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
19213
20184
|
if (!result.success) {
|
|
19214
20185
|
throw new Error(
|
|
19215
|
-
`Invalid frontmatter in ${
|
|
20186
|
+
`Invalid frontmatter in ${join126(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
19216
20187
|
);
|
|
19217
20188
|
}
|
|
19218
20189
|
}
|
|
@@ -19236,7 +20207,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
19236
20207
|
relativeFilePath,
|
|
19237
20208
|
validate = true
|
|
19238
20209
|
}) {
|
|
19239
|
-
const filePath =
|
|
20210
|
+
const filePath = join126(
|
|
19240
20211
|
outputRoot,
|
|
19241
20212
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
19242
20213
|
relativeFilePath
|
|
@@ -19376,7 +20347,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
19376
20347
|
};
|
|
19377
20348
|
|
|
19378
20349
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
19379
|
-
import { join as
|
|
20350
|
+
import { join as join127 } from "path";
|
|
19380
20351
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
19381
20352
|
toRulesyncRule() {
|
|
19382
20353
|
const rulesyncFrontmatter = {
|
|
@@ -19436,8 +20407,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
19436
20407
|
}) {
|
|
19437
20408
|
const settablePaths = this.getSettablePaths();
|
|
19438
20409
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
19439
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
19440
|
-
const fileContent = await readFileContent(
|
|
20410
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join127(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
20411
|
+
const fileContent = await readFileContent(join127(outputRoot, relativePath));
|
|
19441
20412
|
return new _AugmentcodeLegacyRule({
|
|
19442
20413
|
outputRoot,
|
|
19443
20414
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -19466,7 +20437,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
19466
20437
|
};
|
|
19467
20438
|
|
|
19468
20439
|
// src/features/rules/augmentcode-rule.ts
|
|
19469
|
-
import { join as
|
|
20440
|
+
import { join as join128 } from "path";
|
|
19470
20441
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
19471
20442
|
toRulesyncRule() {
|
|
19472
20443
|
return this.toRulesyncRuleDefault();
|
|
@@ -19497,7 +20468,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
19497
20468
|
relativeFilePath,
|
|
19498
20469
|
validate = true
|
|
19499
20470
|
}) {
|
|
19500
|
-
const filePath =
|
|
20471
|
+
const filePath = join128(
|
|
19501
20472
|
outputRoot,
|
|
19502
20473
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
19503
20474
|
relativeFilePath
|
|
@@ -19537,7 +20508,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
19537
20508
|
};
|
|
19538
20509
|
|
|
19539
20510
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
19540
|
-
import { join as
|
|
20511
|
+
import { join as join129 } from "path";
|
|
19541
20512
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
19542
20513
|
static getSettablePaths({
|
|
19543
20514
|
global,
|
|
@@ -19579,7 +20550,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
19579
20550
|
if (isRoot) {
|
|
19580
20551
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
19581
20552
|
const fileContent2 = await readFileContent(
|
|
19582
|
-
|
|
20553
|
+
join129(outputRoot, rootDirPath, paths.root.relativeFilePath)
|
|
19583
20554
|
);
|
|
19584
20555
|
return new _ClaudecodeLegacyRule({
|
|
19585
20556
|
outputRoot,
|
|
@@ -19593,8 +20564,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
19593
20564
|
if (!paths.nonRoot) {
|
|
19594
20565
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
19595
20566
|
}
|
|
19596
|
-
const relativePath =
|
|
19597
|
-
const fileContent = await readFileContent(
|
|
20567
|
+
const relativePath = join129(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
20568
|
+
const fileContent = await readFileContent(join129(outputRoot, relativePath));
|
|
19598
20569
|
return new _ClaudecodeLegacyRule({
|
|
19599
20570
|
outputRoot,
|
|
19600
20571
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -19653,10 +20624,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
19653
20624
|
};
|
|
19654
20625
|
|
|
19655
20626
|
// src/features/rules/claudecode-rule.ts
|
|
19656
|
-
import { join as
|
|
19657
|
-
import { z as
|
|
19658
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
19659
|
-
paths:
|
|
20627
|
+
import { join as join130 } from "path";
|
|
20628
|
+
import { z as z75 } from "zod/mini";
|
|
20629
|
+
var ClaudecodeRuleFrontmatterSchema = z75.object({
|
|
20630
|
+
paths: z75.optional(z75.array(z75.string()))
|
|
19660
20631
|
});
|
|
19661
20632
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
19662
20633
|
frontmatter;
|
|
@@ -19694,7 +20665,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19694
20665
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
19695
20666
|
if (!result.success) {
|
|
19696
20667
|
throw new Error(
|
|
19697
|
-
`Invalid frontmatter in ${
|
|
20668
|
+
`Invalid frontmatter in ${join130(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
19698
20669
|
);
|
|
19699
20670
|
}
|
|
19700
20671
|
}
|
|
@@ -19724,7 +20695,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19724
20695
|
if (isRoot) {
|
|
19725
20696
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
19726
20697
|
const fileContent2 = await readFileContent(
|
|
19727
|
-
|
|
20698
|
+
join130(outputRoot, rootDirPath, paths.root.relativeFilePath)
|
|
19728
20699
|
);
|
|
19729
20700
|
return new _ClaudecodeRule({
|
|
19730
20701
|
outputRoot,
|
|
@@ -19739,8 +20710,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19739
20710
|
if (!paths.nonRoot) {
|
|
19740
20711
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
19741
20712
|
}
|
|
19742
|
-
const relativePath =
|
|
19743
|
-
const filePath =
|
|
20713
|
+
const relativePath = join130(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
20714
|
+
const filePath = join130(outputRoot, relativePath);
|
|
19744
20715
|
const fileContent = await readFileContent(filePath);
|
|
19745
20716
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
19746
20717
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -19851,7 +20822,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19851
20822
|
return {
|
|
19852
20823
|
success: false,
|
|
19853
20824
|
error: new Error(
|
|
19854
|
-
`Invalid frontmatter in ${
|
|
20825
|
+
`Invalid frontmatter in ${join130(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
19855
20826
|
)
|
|
19856
20827
|
};
|
|
19857
20828
|
}
|
|
@@ -19871,10 +20842,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
19871
20842
|
};
|
|
19872
20843
|
|
|
19873
20844
|
// src/features/rules/cline-rule.ts
|
|
19874
|
-
import { join as
|
|
19875
|
-
import { z as
|
|
19876
|
-
var ClineRuleFrontmatterSchema =
|
|
19877
|
-
description:
|
|
20845
|
+
import { join as join131 } from "path";
|
|
20846
|
+
import { z as z76 } from "zod/mini";
|
|
20847
|
+
var ClineRuleFrontmatterSchema = z76.object({
|
|
20848
|
+
description: z76.string()
|
|
19878
20849
|
});
|
|
19879
20850
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
19880
20851
|
static getSettablePaths(_options = {}) {
|
|
@@ -19917,7 +20888,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
19917
20888
|
validate = true
|
|
19918
20889
|
}) {
|
|
19919
20890
|
const fileContent = await readFileContent(
|
|
19920
|
-
|
|
20891
|
+
join131(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
19921
20892
|
);
|
|
19922
20893
|
return new _ClineRule({
|
|
19923
20894
|
outputRoot,
|
|
@@ -19943,7 +20914,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
19943
20914
|
};
|
|
19944
20915
|
|
|
19945
20916
|
// src/features/rules/codexcli-rule.ts
|
|
19946
|
-
import { join as
|
|
20917
|
+
import { join as join132 } from "path";
|
|
19947
20918
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
19948
20919
|
static getSettablePaths({
|
|
19949
20920
|
global,
|
|
@@ -19978,7 +20949,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
19978
20949
|
if (isRoot) {
|
|
19979
20950
|
const relativePath2 = paths.root.relativeFilePath;
|
|
19980
20951
|
const fileContent2 = await readFileContent(
|
|
19981
|
-
|
|
20952
|
+
join132(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
19982
20953
|
);
|
|
19983
20954
|
return new _CodexcliRule({
|
|
19984
20955
|
outputRoot,
|
|
@@ -19992,8 +20963,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
19992
20963
|
if (!paths.nonRoot) {
|
|
19993
20964
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
19994
20965
|
}
|
|
19995
|
-
const relativePath =
|
|
19996
|
-
const fileContent = await readFileContent(
|
|
20966
|
+
const relativePath = join132(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
20967
|
+
const fileContent = await readFileContent(join132(outputRoot, relativePath));
|
|
19997
20968
|
return new _CodexcliRule({
|
|
19998
20969
|
outputRoot,
|
|
19999
20970
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20052,12 +21023,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
20052
21023
|
};
|
|
20053
21024
|
|
|
20054
21025
|
// src/features/rules/copilot-rule.ts
|
|
20055
|
-
import { join as
|
|
20056
|
-
import { z as
|
|
20057
|
-
var CopilotRuleFrontmatterSchema =
|
|
20058
|
-
description:
|
|
20059
|
-
applyTo:
|
|
20060
|
-
excludeAgent:
|
|
21026
|
+
import { join as join133 } from "path";
|
|
21027
|
+
import { z as z77 } from "zod/mini";
|
|
21028
|
+
var CopilotRuleFrontmatterSchema = z77.object({
|
|
21029
|
+
description: z77.optional(z77.string()),
|
|
21030
|
+
applyTo: z77.optional(z77.string()),
|
|
21031
|
+
excludeAgent: z77.optional(z77.union([z77.literal("code-review"), z77.literal("coding-agent")]))
|
|
20061
21032
|
});
|
|
20062
21033
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
20063
21034
|
frontmatter;
|
|
@@ -20089,7 +21060,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20089
21060
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
20090
21061
|
if (!result.success) {
|
|
20091
21062
|
throw new Error(
|
|
20092
|
-
`Invalid frontmatter in ${
|
|
21063
|
+
`Invalid frontmatter in ${join133(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
20093
21064
|
);
|
|
20094
21065
|
}
|
|
20095
21066
|
}
|
|
@@ -20176,11 +21147,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20176
21147
|
global = false
|
|
20177
21148
|
}) {
|
|
20178
21149
|
const paths = this.getSettablePaths({ global });
|
|
20179
|
-
const isRoot = relativeDirPath ?
|
|
21150
|
+
const isRoot = relativeDirPath ? join133(relativeDirPath, relativeFilePath) === join133(paths.root.relativeDirPath, paths.root.relativeFilePath) : relativeFilePath === paths.root.relativeFilePath;
|
|
20180
21151
|
const resolvedRelativeDirPath = relativeDirPath ?? (isRoot ? paths.root.relativeDirPath : paths.nonRoot?.relativeDirPath ?? paths.root.relativeDirPath);
|
|
20181
21152
|
if (isRoot) {
|
|
20182
|
-
const relativePath2 =
|
|
20183
|
-
const filePath2 =
|
|
21153
|
+
const relativePath2 = join133(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
21154
|
+
const filePath2 = join133(outputRoot, relativePath2);
|
|
20184
21155
|
const fileContent2 = await readFileContent(filePath2);
|
|
20185
21156
|
return new _CopilotRule({
|
|
20186
21157
|
outputRoot,
|
|
@@ -20195,8 +21166,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20195
21166
|
if (!paths.nonRoot) {
|
|
20196
21167
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20197
21168
|
}
|
|
20198
|
-
const relativePath =
|
|
20199
|
-
const filePath =
|
|
21169
|
+
const relativePath = join133(resolvedRelativeDirPath, relativeFilePath);
|
|
21170
|
+
const filePath = join133(outputRoot, relativePath);
|
|
20200
21171
|
const fileContent = await readFileContent(filePath);
|
|
20201
21172
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
20202
21173
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -20220,7 +21191,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20220
21191
|
global = false
|
|
20221
21192
|
}) {
|
|
20222
21193
|
const paths = this.getSettablePaths({ global });
|
|
20223
|
-
const isRoot =
|
|
21194
|
+
const isRoot = join133(relativeDirPath, relativeFilePath) === join133(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
20224
21195
|
return new _CopilotRule({
|
|
20225
21196
|
outputRoot,
|
|
20226
21197
|
relativeDirPath,
|
|
@@ -20242,7 +21213,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
20242
21213
|
return {
|
|
20243
21214
|
success: false,
|
|
20244
21215
|
error: new Error(
|
|
20245
|
-
`Invalid frontmatter in ${
|
|
21216
|
+
`Invalid frontmatter in ${join133(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
20246
21217
|
)
|
|
20247
21218
|
};
|
|
20248
21219
|
}
|
|
@@ -20298,12 +21269,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
20298
21269
|
};
|
|
20299
21270
|
|
|
20300
21271
|
// src/features/rules/cursor-rule.ts
|
|
20301
|
-
import { join as
|
|
20302
|
-
import { z as
|
|
20303
|
-
var CursorRuleFrontmatterSchema =
|
|
20304
|
-
description:
|
|
20305
|
-
globs:
|
|
20306
|
-
alwaysApply:
|
|
21272
|
+
import { join as join134 } from "path";
|
|
21273
|
+
import { z as z78 } from "zod/mini";
|
|
21274
|
+
var CursorRuleFrontmatterSchema = z78.object({
|
|
21275
|
+
description: z78.optional(z78.string()),
|
|
21276
|
+
globs: z78.optional(z78.string()),
|
|
21277
|
+
alwaysApply: z78.optional(z78.boolean())
|
|
20307
21278
|
});
|
|
20308
21279
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
20309
21280
|
frontmatter;
|
|
@@ -20320,7 +21291,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20320
21291
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
20321
21292
|
if (!result.success) {
|
|
20322
21293
|
throw new Error(
|
|
20323
|
-
`Invalid frontmatter in ${
|
|
21294
|
+
`Invalid frontmatter in ${join134(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
20324
21295
|
);
|
|
20325
21296
|
}
|
|
20326
21297
|
}
|
|
@@ -20436,7 +21407,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20436
21407
|
relativeFilePath,
|
|
20437
21408
|
validate = true
|
|
20438
21409
|
}) {
|
|
20439
|
-
const filePath =
|
|
21410
|
+
const filePath = join134(
|
|
20440
21411
|
outputRoot,
|
|
20441
21412
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
20442
21413
|
relativeFilePath
|
|
@@ -20446,7 +21417,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20446
21417
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
20447
21418
|
if (!result.success) {
|
|
20448
21419
|
throw new Error(
|
|
20449
|
-
`Invalid frontmatter in ${
|
|
21420
|
+
`Invalid frontmatter in ${join134(outputRoot, relativeFilePath)}: ${formatError(result.error)}`
|
|
20450
21421
|
);
|
|
20451
21422
|
}
|
|
20452
21423
|
return new _CursorRule({
|
|
@@ -20483,7 +21454,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20483
21454
|
return {
|
|
20484
21455
|
success: false,
|
|
20485
21456
|
error: new Error(
|
|
20486
|
-
`Invalid frontmatter in ${
|
|
21457
|
+
`Invalid frontmatter in ${join134(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
20487
21458
|
)
|
|
20488
21459
|
};
|
|
20489
21460
|
}
|
|
@@ -20503,7 +21474,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
20503
21474
|
};
|
|
20504
21475
|
|
|
20505
21476
|
// src/features/rules/deepagents-rule.ts
|
|
20506
|
-
import { join as
|
|
21477
|
+
import { join as join135 } from "path";
|
|
20507
21478
|
var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
20508
21479
|
constructor({ fileContent, root, ...rest }) {
|
|
20509
21480
|
super({
|
|
@@ -20530,8 +21501,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
20530
21501
|
}) {
|
|
20531
21502
|
const settablePaths = this.getSettablePaths();
|
|
20532
21503
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
20533
|
-
const relativePath = isRoot ?
|
|
20534
|
-
const fileContent = await readFileContent(
|
|
21504
|
+
const relativePath = isRoot ? join135(".deepagents", "AGENTS.md") : join135(".deepagents", "memories", relativeFilePath);
|
|
21505
|
+
const fileContent = await readFileContent(join135(outputRoot, relativePath));
|
|
20535
21506
|
return new _DeepagentsRule({
|
|
20536
21507
|
outputRoot,
|
|
20537
21508
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -20586,7 +21557,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
20586
21557
|
};
|
|
20587
21558
|
|
|
20588
21559
|
// src/features/rules/factorydroid-rule.ts
|
|
20589
|
-
import { join as
|
|
21560
|
+
import { join as join136 } from "path";
|
|
20590
21561
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
20591
21562
|
constructor({ fileContent, root, ...rest }) {
|
|
20592
21563
|
super({
|
|
@@ -20626,8 +21597,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
20626
21597
|
const paths = this.getSettablePaths({ global });
|
|
20627
21598
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
20628
21599
|
if (isRoot) {
|
|
20629
|
-
const relativePath2 =
|
|
20630
|
-
const fileContent2 = await readFileContent(
|
|
21600
|
+
const relativePath2 = join136(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
21601
|
+
const fileContent2 = await readFileContent(join136(outputRoot, relativePath2));
|
|
20631
21602
|
return new _FactorydroidRule({
|
|
20632
21603
|
outputRoot,
|
|
20633
21604
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -20640,8 +21611,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
20640
21611
|
if (!paths.nonRoot) {
|
|
20641
21612
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20642
21613
|
}
|
|
20643
|
-
const relativePath =
|
|
20644
|
-
const fileContent = await readFileContent(
|
|
21614
|
+
const relativePath = join136(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21615
|
+
const fileContent = await readFileContent(join136(outputRoot, relativePath));
|
|
20645
21616
|
return new _FactorydroidRule({
|
|
20646
21617
|
outputRoot,
|
|
20647
21618
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20700,7 +21671,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
20700
21671
|
};
|
|
20701
21672
|
|
|
20702
21673
|
// src/features/rules/geminicli-rule.ts
|
|
20703
|
-
import { join as
|
|
21674
|
+
import { join as join137 } from "path";
|
|
20704
21675
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
20705
21676
|
static getSettablePaths({
|
|
20706
21677
|
global,
|
|
@@ -20735,7 +21706,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
20735
21706
|
if (isRoot) {
|
|
20736
21707
|
const relativePath2 = paths.root.relativeFilePath;
|
|
20737
21708
|
const fileContent2 = await readFileContent(
|
|
20738
|
-
|
|
21709
|
+
join137(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
20739
21710
|
);
|
|
20740
21711
|
return new _GeminiCliRule({
|
|
20741
21712
|
outputRoot,
|
|
@@ -20749,8 +21720,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
20749
21720
|
if (!paths.nonRoot) {
|
|
20750
21721
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20751
21722
|
}
|
|
20752
|
-
const relativePath =
|
|
20753
|
-
const fileContent = await readFileContent(
|
|
21723
|
+
const relativePath = join137(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21724
|
+
const fileContent = await readFileContent(join137(outputRoot, relativePath));
|
|
20754
21725
|
return new _GeminiCliRule({
|
|
20755
21726
|
outputRoot,
|
|
20756
21727
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20809,7 +21780,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
20809
21780
|
};
|
|
20810
21781
|
|
|
20811
21782
|
// src/features/rules/goose-rule.ts
|
|
20812
|
-
import { join as
|
|
21783
|
+
import { join as join138 } from "path";
|
|
20813
21784
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
20814
21785
|
static getSettablePaths({
|
|
20815
21786
|
global,
|
|
@@ -20844,7 +21815,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
20844
21815
|
if (isRoot) {
|
|
20845
21816
|
const relativePath2 = paths.root.relativeFilePath;
|
|
20846
21817
|
const fileContent2 = await readFileContent(
|
|
20847
|
-
|
|
21818
|
+
join138(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
20848
21819
|
);
|
|
20849
21820
|
return new _GooseRule({
|
|
20850
21821
|
outputRoot,
|
|
@@ -20858,8 +21829,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
20858
21829
|
if (!paths.nonRoot) {
|
|
20859
21830
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
20860
21831
|
}
|
|
20861
|
-
const relativePath =
|
|
20862
|
-
const fileContent = await readFileContent(
|
|
21832
|
+
const relativePath = join138(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21833
|
+
const fileContent = await readFileContent(join138(outputRoot, relativePath));
|
|
20863
21834
|
return new _GooseRule({
|
|
20864
21835
|
outputRoot,
|
|
20865
21836
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -20918,7 +21889,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
20918
21889
|
};
|
|
20919
21890
|
|
|
20920
21891
|
// src/features/rules/junie-rule.ts
|
|
20921
|
-
import { join as
|
|
21892
|
+
import { join as join139 } from "path";
|
|
20922
21893
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
20923
21894
|
static getSettablePaths(_options = {}) {
|
|
20924
21895
|
return {
|
|
@@ -20947,8 +21918,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
20947
21918
|
}) {
|
|
20948
21919
|
const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
|
|
20949
21920
|
const settablePaths = this.getSettablePaths();
|
|
20950
|
-
const relativePath = isRoot ?
|
|
20951
|
-
const fileContent = await readFileContent(
|
|
21921
|
+
const relativePath = isRoot ? join139(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : join139(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
21922
|
+
const fileContent = await readFileContent(join139(outputRoot, relativePath));
|
|
20952
21923
|
return new _JunieRule({
|
|
20953
21924
|
outputRoot,
|
|
20954
21925
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -21003,7 +21974,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
21003
21974
|
};
|
|
21004
21975
|
|
|
21005
21976
|
// src/features/rules/kilo-rule.ts
|
|
21006
|
-
import { join as
|
|
21977
|
+
import { join as join140 } from "path";
|
|
21007
21978
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
21008
21979
|
static getSettablePaths({
|
|
21009
21980
|
global,
|
|
@@ -21038,7 +22009,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
21038
22009
|
if (isRoot) {
|
|
21039
22010
|
const relativePath2 = paths.root.relativeFilePath;
|
|
21040
22011
|
const fileContent2 = await readFileContent(
|
|
21041
|
-
|
|
22012
|
+
join140(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
21042
22013
|
);
|
|
21043
22014
|
return new _KiloRule({
|
|
21044
22015
|
outputRoot,
|
|
@@ -21052,8 +22023,8 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
21052
22023
|
if (!paths.nonRoot) {
|
|
21053
22024
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
21054
22025
|
}
|
|
21055
|
-
const relativePath =
|
|
21056
|
-
const fileContent = await readFileContent(
|
|
22026
|
+
const relativePath = join140(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
22027
|
+
const fileContent = await readFileContent(join140(outputRoot, relativePath));
|
|
21057
22028
|
return new _KiloRule({
|
|
21058
22029
|
outputRoot,
|
|
21059
22030
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -21112,7 +22083,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
21112
22083
|
};
|
|
21113
22084
|
|
|
21114
22085
|
// src/features/rules/kiro-rule.ts
|
|
21115
|
-
import { join as
|
|
22086
|
+
import { join as join141 } from "path";
|
|
21116
22087
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
21117
22088
|
static getSettablePaths(_options = {}) {
|
|
21118
22089
|
return {
|
|
@@ -21127,7 +22098,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
21127
22098
|
validate = true
|
|
21128
22099
|
}) {
|
|
21129
22100
|
const fileContent = await readFileContent(
|
|
21130
|
-
|
|
22101
|
+
join141(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
21131
22102
|
);
|
|
21132
22103
|
return new _KiroRule({
|
|
21133
22104
|
outputRoot,
|
|
@@ -21181,7 +22152,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
21181
22152
|
};
|
|
21182
22153
|
|
|
21183
22154
|
// src/features/rules/opencode-rule.ts
|
|
21184
|
-
import { join as
|
|
22155
|
+
import { join as join142 } from "path";
|
|
21185
22156
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
21186
22157
|
static getSettablePaths({
|
|
21187
22158
|
global,
|
|
@@ -21216,7 +22187,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
21216
22187
|
if (isRoot) {
|
|
21217
22188
|
const relativePath2 = paths.root.relativeFilePath;
|
|
21218
22189
|
const fileContent2 = await readFileContent(
|
|
21219
|
-
|
|
22190
|
+
join142(outputRoot, paths.root.relativeDirPath, relativePath2)
|
|
21220
22191
|
);
|
|
21221
22192
|
return new _OpenCodeRule({
|
|
21222
22193
|
outputRoot,
|
|
@@ -21230,8 +22201,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
21230
22201
|
if (!paths.nonRoot) {
|
|
21231
22202
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
21232
22203
|
}
|
|
21233
|
-
const relativePath =
|
|
21234
|
-
const fileContent = await readFileContent(
|
|
22204
|
+
const relativePath = join142(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
22205
|
+
const fileContent = await readFileContent(join142(outputRoot, relativePath));
|
|
21235
22206
|
return new _OpenCodeRule({
|
|
21236
22207
|
outputRoot,
|
|
21237
22208
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -21290,7 +22261,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
21290
22261
|
};
|
|
21291
22262
|
|
|
21292
22263
|
// src/features/rules/pi-rule.ts
|
|
21293
|
-
import { join as
|
|
22264
|
+
import { join as join143 } from "path";
|
|
21294
22265
|
var PiRule = class _PiRule extends ToolRule {
|
|
21295
22266
|
static getSettablePaths({
|
|
21296
22267
|
global,
|
|
@@ -21324,7 +22295,7 @@ var PiRule = class _PiRule extends ToolRule {
|
|
|
21324
22295
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
21325
22296
|
if (isRoot) {
|
|
21326
22297
|
const fileContent2 = await readFileContent(
|
|
21327
|
-
|
|
22298
|
+
join143(outputRoot, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
21328
22299
|
);
|
|
21329
22300
|
return new _PiRule({
|
|
21330
22301
|
outputRoot,
|
|
@@ -21340,8 +22311,8 @@ var PiRule = class _PiRule extends ToolRule {
|
|
|
21340
22311
|
`PiRule does not support non-root rules in global mode; expected '${paths.root.relativeFilePath}' but got '${relativeFilePath}'`
|
|
21341
22312
|
);
|
|
21342
22313
|
}
|
|
21343
|
-
const relativePath =
|
|
21344
|
-
const fileContent = await readFileContent(
|
|
22314
|
+
const relativePath = join143(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
22315
|
+
const fileContent = await readFileContent(join143(outputRoot, relativePath));
|
|
21345
22316
|
return new _PiRule({
|
|
21346
22317
|
outputRoot,
|
|
21347
22318
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -21405,7 +22376,7 @@ var PiRule = class _PiRule extends ToolRule {
|
|
|
21405
22376
|
};
|
|
21406
22377
|
|
|
21407
22378
|
// src/features/rules/qwencode-rule.ts
|
|
21408
|
-
import { join as
|
|
22379
|
+
import { join as join144 } from "path";
|
|
21409
22380
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
21410
22381
|
static getSettablePaths(_options = {}) {
|
|
21411
22382
|
return {
|
|
@@ -21424,8 +22395,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
21424
22395
|
validate = true
|
|
21425
22396
|
}) {
|
|
21426
22397
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
21427
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
21428
|
-
const fileContent = await readFileContent(
|
|
22398
|
+
const relativePath = isRoot ? "QWEN.md" : join144(".qwen", "memories", relativeFilePath);
|
|
22399
|
+
const fileContent = await readFileContent(join144(outputRoot, relativePath));
|
|
21429
22400
|
return new _QwencodeRule({
|
|
21430
22401
|
outputRoot,
|
|
21431
22402
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -21477,7 +22448,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
21477
22448
|
};
|
|
21478
22449
|
|
|
21479
22450
|
// src/features/rules/replit-rule.ts
|
|
21480
|
-
import { join as
|
|
22451
|
+
import { join as join145 } from "path";
|
|
21481
22452
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
21482
22453
|
static getSettablePaths(_options = {}) {
|
|
21483
22454
|
return {
|
|
@@ -21499,7 +22470,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
21499
22470
|
}
|
|
21500
22471
|
const relativePath = paths.root.relativeFilePath;
|
|
21501
22472
|
const fileContent = await readFileContent(
|
|
21502
|
-
|
|
22473
|
+
join145(outputRoot, paths.root.relativeDirPath, relativePath)
|
|
21503
22474
|
);
|
|
21504
22475
|
return new _ReplitRule({
|
|
21505
22476
|
outputRoot,
|
|
@@ -21565,7 +22536,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
21565
22536
|
};
|
|
21566
22537
|
|
|
21567
22538
|
// src/features/rules/roo-rule.ts
|
|
21568
|
-
import { join as
|
|
22539
|
+
import { join as join146 } from "path";
|
|
21569
22540
|
var RooRule = class _RooRule extends ToolRule {
|
|
21570
22541
|
static getSettablePaths(_options = {}) {
|
|
21571
22542
|
return {
|
|
@@ -21580,7 +22551,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
21580
22551
|
validate = true
|
|
21581
22552
|
}) {
|
|
21582
22553
|
const fileContent = await readFileContent(
|
|
21583
|
-
|
|
22554
|
+
join146(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
21584
22555
|
);
|
|
21585
22556
|
return new _RooRule({
|
|
21586
22557
|
outputRoot,
|
|
@@ -21649,7 +22620,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
21649
22620
|
};
|
|
21650
22621
|
|
|
21651
22622
|
// src/features/rules/rovodev-rule.ts
|
|
21652
|
-
import { join as
|
|
22623
|
+
import { join as join147 } from "path";
|
|
21653
22624
|
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
21654
22625
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
21655
22626
|
/**
|
|
@@ -21693,7 +22664,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21693
22664
|
root: rovodevAgents,
|
|
21694
22665
|
alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
|
|
21695
22666
|
nonRoot: {
|
|
21696
|
-
relativeDirPath:
|
|
22667
|
+
relativeDirPath: join147(".rovodev", ".rulesync", "modular-rules")
|
|
21697
22668
|
}
|
|
21698
22669
|
};
|
|
21699
22670
|
}
|
|
@@ -21732,10 +22703,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21732
22703
|
}) {
|
|
21733
22704
|
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
21734
22705
|
throw new Error(
|
|
21735
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${
|
|
22706
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join147(relativeDirPath, relativeFilePath)}`
|
|
21736
22707
|
);
|
|
21737
22708
|
}
|
|
21738
|
-
const fileContent = await readFileContent(
|
|
22709
|
+
const fileContent = await readFileContent(join147(outputRoot, relativeDirPath, relativeFilePath));
|
|
21739
22710
|
return new _RovodevRule({
|
|
21740
22711
|
outputRoot,
|
|
21741
22712
|
relativeDirPath,
|
|
@@ -21755,10 +22726,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21755
22726
|
paths
|
|
21756
22727
|
}) {
|
|
21757
22728
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
21758
|
-
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${
|
|
22729
|
+
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
22730
|
if (relativeFilePath !== "AGENTS.md") {
|
|
21760
22731
|
throw new Error(
|
|
21761
|
-
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${
|
|
22732
|
+
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${join147(relativeDirPath, relativeFilePath)}`
|
|
21762
22733
|
);
|
|
21763
22734
|
}
|
|
21764
22735
|
const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
|
|
@@ -21766,10 +22737,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21766
22737
|
);
|
|
21767
22738
|
if (!allowed) {
|
|
21768
22739
|
throw new Error(
|
|
21769
|
-
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${
|
|
22740
|
+
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${join147(relativeDirPath, relativeFilePath)}`
|
|
21770
22741
|
);
|
|
21771
22742
|
}
|
|
21772
|
-
const fileContent = await readFileContent(
|
|
22743
|
+
const fileContent = await readFileContent(join147(outputRoot, relativeDirPath, relativeFilePath));
|
|
21773
22744
|
return new _RovodevRule({
|
|
21774
22745
|
outputRoot,
|
|
21775
22746
|
relativeDirPath,
|
|
@@ -21883,7 +22854,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
21883
22854
|
};
|
|
21884
22855
|
|
|
21885
22856
|
// src/features/rules/takt-rule.ts
|
|
21886
|
-
import { join as
|
|
22857
|
+
import { join as join148 } from "path";
|
|
21887
22858
|
var DEFAULT_TAKT_RULE_DIR = "policies";
|
|
21888
22859
|
var TaktRule = class _TaktRule extends ToolRule {
|
|
21889
22860
|
static getSettablePaths({
|
|
@@ -21895,7 +22866,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21895
22866
|
root: {
|
|
21896
22867
|
relativeDirPath: buildToolPath(
|
|
21897
22868
|
".takt",
|
|
21898
|
-
|
|
22869
|
+
join148("facets", DEFAULT_TAKT_RULE_DIR),
|
|
21899
22870
|
excludeToolDir
|
|
21900
22871
|
),
|
|
21901
22872
|
relativeFilePath: "overview.md"
|
|
@@ -21906,7 +22877,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21906
22877
|
nonRoot: {
|
|
21907
22878
|
relativeDirPath: buildToolPath(
|
|
21908
22879
|
".takt",
|
|
21909
|
-
|
|
22880
|
+
join148("facets", DEFAULT_TAKT_RULE_DIR),
|
|
21910
22881
|
excludeToolDir
|
|
21911
22882
|
)
|
|
21912
22883
|
}
|
|
@@ -21924,8 +22895,8 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21924
22895
|
validate = true,
|
|
21925
22896
|
relativeDirPath: overrideDirPath
|
|
21926
22897
|
}) {
|
|
21927
|
-
const dirPath = overrideDirPath ??
|
|
21928
|
-
const filePath =
|
|
22898
|
+
const dirPath = overrideDirPath ?? join148(".takt", "facets", DEFAULT_TAKT_RULE_DIR);
|
|
22899
|
+
const filePath = join148(outputRoot, dirPath, relativeFilePath);
|
|
21929
22900
|
const fileContent = await readFileContent(filePath);
|
|
21930
22901
|
const { body } = parseFrontmatter(fileContent, filePath);
|
|
21931
22902
|
return new _TaktRule({
|
|
@@ -21964,7 +22935,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21964
22935
|
const stem = overrideName ?? sourceStem;
|
|
21965
22936
|
assertSafeTaktName({ name: stem, featureLabel: "rule", sourceLabel });
|
|
21966
22937
|
const relativeFilePath = `${stem}.md`;
|
|
21967
|
-
const relativeDirPath =
|
|
22938
|
+
const relativeDirPath = join148(".takt", "facets", DEFAULT_TAKT_RULE_DIR);
|
|
21968
22939
|
return new _TaktRule({
|
|
21969
22940
|
outputRoot,
|
|
21970
22941
|
relativeDirPath,
|
|
@@ -21989,7 +22960,7 @@ var TaktRule = class _TaktRule extends ToolRule {
|
|
|
21989
22960
|
};
|
|
21990
22961
|
|
|
21991
22962
|
// src/features/rules/warp-rule.ts
|
|
21992
|
-
import { join as
|
|
22963
|
+
import { join as join149 } from "path";
|
|
21993
22964
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
21994
22965
|
constructor({ fileContent, root, ...rest }) {
|
|
21995
22966
|
super({
|
|
@@ -22015,8 +22986,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
22015
22986
|
validate = true
|
|
22016
22987
|
}) {
|
|
22017
22988
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
22018
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
22019
|
-
const fileContent = await readFileContent(
|
|
22989
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join149(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
22990
|
+
const fileContent = await readFileContent(join149(outputRoot, relativePath));
|
|
22020
22991
|
return new _WarpRule({
|
|
22021
22992
|
outputRoot,
|
|
22022
22993
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -22071,7 +23042,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
22071
23042
|
};
|
|
22072
23043
|
|
|
22073
23044
|
// src/features/rules/windsurf-rule.ts
|
|
22074
|
-
import { join as
|
|
23045
|
+
import { join as join150 } from "path";
|
|
22075
23046
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
22076
23047
|
static getSettablePaths(_options = {}) {
|
|
22077
23048
|
return {
|
|
@@ -22086,7 +23057,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
22086
23057
|
validate = true
|
|
22087
23058
|
}) {
|
|
22088
23059
|
const fileContent = await readFileContent(
|
|
22089
|
-
|
|
23060
|
+
join150(outputRoot, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
22090
23061
|
);
|
|
22091
23062
|
return new _WindsurfRule({
|
|
22092
23063
|
outputRoot,
|
|
@@ -22186,11 +23157,11 @@ var rulesProcessorToolTargets = [
|
|
|
22186
23157
|
"warp",
|
|
22187
23158
|
"windsurf"
|
|
22188
23159
|
];
|
|
22189
|
-
var RulesProcessorToolTargetSchema =
|
|
22190
|
-
var formatRulePaths = (rules) => rules.map((r) =>
|
|
22191
|
-
var RulesFeatureOptionsSchema =
|
|
22192
|
-
ruleDiscoveryMode:
|
|
22193
|
-
includeLocalRoot:
|
|
23160
|
+
var RulesProcessorToolTargetSchema = z79.enum(rulesProcessorToolTargets);
|
|
23161
|
+
var formatRulePaths = (rules) => rules.map((r) => join151(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
23162
|
+
var RulesFeatureOptionsSchema = z79.looseObject({
|
|
23163
|
+
ruleDiscoveryMode: z79.optional(z79.enum(["none", "explicit"])),
|
|
23164
|
+
includeLocalRoot: z79.optional(z79.boolean())
|
|
22194
23165
|
});
|
|
22195
23166
|
var resolveRuleDiscoveryMode = ({
|
|
22196
23167
|
defaultMode,
|
|
@@ -22211,8 +23182,8 @@ var resolveRuleDiscoveryMode = ({
|
|
|
22211
23182
|
}
|
|
22212
23183
|
return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
|
|
22213
23184
|
};
|
|
22214
|
-
var IncludeLocalRootSchema =
|
|
22215
|
-
includeLocalRoot:
|
|
23185
|
+
var IncludeLocalRootSchema = z79.looseObject({
|
|
23186
|
+
includeLocalRoot: z79.optional(z79.boolean())
|
|
22216
23187
|
});
|
|
22217
23188
|
var resolveIncludeLocalRoot = (options) => {
|
|
22218
23189
|
if (!options) return true;
|
|
@@ -22683,7 +23654,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22683
23654
|
}).relativeDirPath;
|
|
22684
23655
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
22685
23656
|
const frontmatter = skill.getFrontmatter();
|
|
22686
|
-
const relativePath =
|
|
23657
|
+
const relativePath = join151(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
22687
23658
|
return {
|
|
22688
23659
|
name: frontmatter.name,
|
|
22689
23660
|
description: frontmatter.description,
|
|
@@ -22812,8 +23783,8 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22812
23783
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
22813
23784
|
*/
|
|
22814
23785
|
async loadRulesyncFiles() {
|
|
22815
|
-
const rulesyncOutputRoot =
|
|
22816
|
-
const files = await findFilesByGlobs(
|
|
23786
|
+
const rulesyncOutputRoot = join151(this.inputRoot, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
23787
|
+
const files = await findFilesByGlobs(join151(rulesyncOutputRoot, "**", "*.md"));
|
|
22817
23788
|
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
22818
23789
|
const rulesyncRules = await Promise.all(
|
|
22819
23790
|
files.map((file) => {
|
|
@@ -22929,13 +23900,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22929
23900
|
return [];
|
|
22930
23901
|
}
|
|
22931
23902
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
22932
|
-
|
|
23903
|
+
join151(
|
|
22933
23904
|
this.outputRoot,
|
|
22934
23905
|
settablePaths.root.relativeDirPath ?? ".",
|
|
22935
23906
|
settablePaths.root.relativeFilePath
|
|
22936
23907
|
),
|
|
22937
23908
|
settablePaths.alternativeRoots,
|
|
22938
|
-
(alt) =>
|
|
23909
|
+
(alt) => join151(this.outputRoot, alt.relativeDirPath, alt.relativeFilePath)
|
|
22939
23910
|
);
|
|
22940
23911
|
if (forDeletion) {
|
|
22941
23912
|
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
@@ -22966,7 +23937,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22966
23937
|
return [];
|
|
22967
23938
|
}
|
|
22968
23939
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
22969
|
-
|
|
23940
|
+
join151(this.outputRoot, "AGENTS.local.md")
|
|
22970
23941
|
);
|
|
22971
23942
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
22972
23943
|
}
|
|
@@ -22977,9 +23948,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22977
23948
|
return [];
|
|
22978
23949
|
}
|
|
22979
23950
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
22980
|
-
|
|
23951
|
+
join151(this.outputRoot, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
22981
23952
|
settablePaths.alternativeRoots,
|
|
22982
|
-
(alt) =>
|
|
23953
|
+
(alt) => join151(this.outputRoot, alt.relativeDirPath, "CLAUDE.local.md")
|
|
22983
23954
|
);
|
|
22984
23955
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
22985
23956
|
})();
|
|
@@ -22990,20 +23961,20 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
22990
23961
|
if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
|
|
22991
23962
|
return [];
|
|
22992
23963
|
}
|
|
22993
|
-
const primaryPaths = await findFilesByGlobs(
|
|
23964
|
+
const primaryPaths = await findFilesByGlobs(join151(this.outputRoot, ".rovodev", "AGENTS.md"));
|
|
22994
23965
|
if (primaryPaths.length === 0) {
|
|
22995
23966
|
return [];
|
|
22996
23967
|
}
|
|
22997
|
-
const mirrorPaths = await findFilesByGlobs(
|
|
23968
|
+
const mirrorPaths = await findFilesByGlobs(join151(this.outputRoot, "AGENTS.md"));
|
|
22998
23969
|
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
22999
23970
|
})();
|
|
23000
23971
|
const nonRootToolRules = await (async () => {
|
|
23001
23972
|
if (!settablePaths.nonRoot) {
|
|
23002
23973
|
return [];
|
|
23003
23974
|
}
|
|
23004
|
-
const nonRootOutputRoot =
|
|
23975
|
+
const nonRootOutputRoot = join151(this.outputRoot, settablePaths.nonRoot.relativeDirPath);
|
|
23005
23976
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
23006
|
-
|
|
23977
|
+
join151(nonRootOutputRoot, "**", `*.${factory.meta.extension}`)
|
|
23007
23978
|
);
|
|
23008
23979
|
if (forDeletion) {
|
|
23009
23980
|
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
@@ -23017,7 +23988,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
23017
23988
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
23018
23989
|
if (!ok) {
|
|
23019
23990
|
this.logger.warn(
|
|
23020
|
-
`Skipping reserved Rovodev path under modular-rules (import): ${
|
|
23991
|
+
`Skipping reserved Rovodev path under modular-rules (import): ${join151(modularRootRelative, relativeFilePath)}`
|
|
23021
23992
|
);
|
|
23022
23993
|
}
|
|
23023
23994
|
return ok;
|
|
@@ -23143,14 +24114,14 @@ s/<command> [arguments]
|
|
|
23143
24114
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
23144
24115
|
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
24116
|
|
|
23146
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
24117
|
+
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
24118
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
23148
24119
|
|
|
23149
24120
|
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
24121
|
|
|
23151
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
24122
|
+
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
24123
|
|
|
23153
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
24124
|
+
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
24125
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
23155
24126
|
const result = [
|
|
23156
24127
|
overview,
|
|
@@ -23408,7 +24379,7 @@ function buildPermissionsStrategy(ctx) {
|
|
|
23408
24379
|
}
|
|
23409
24380
|
|
|
23410
24381
|
// src/lib/generate.ts
|
|
23411
|
-
import { join as
|
|
24382
|
+
import { join as join152 } from "path";
|
|
23412
24383
|
import { intersection } from "es-toolkit";
|
|
23413
24384
|
async function processFeatureGeneration(params) {
|
|
23414
24385
|
const { config, processor, toolFiles } = params;
|
|
@@ -23482,7 +24453,7 @@ function warnUnsupportedTargets(params) {
|
|
|
23482
24453
|
}
|
|
23483
24454
|
}
|
|
23484
24455
|
async function checkRulesyncDirExists(params) {
|
|
23485
|
-
return fileExists(
|
|
24456
|
+
return fileExists(join152(params.inputRoot, RULESYNC_RELATIVE_DIR_PATH));
|
|
23486
24457
|
}
|
|
23487
24458
|
async function generate(params) {
|
|
23488
24459
|
const { config, logger } = params;
|