rulesync 7.28.0 → 7.30.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 +29 -27
- package/dist/{chunk-AKHOQKVV.js → chunk-IGW5DFPU.js} +1498 -752
- package/dist/cli/index.cjs +1403 -638
- package/dist/cli/index.js +29 -10
- package/dist/index.cjs +1530 -784
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,7 @@ var RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH = join(
|
|
|
66
66
|
".curated"
|
|
67
67
|
);
|
|
68
68
|
var RULESYNC_MCP_FILE_NAME = "mcp.json";
|
|
69
|
+
var RULESYNC_PERMISSIONS_FILE_NAME = "permissions.json";
|
|
69
70
|
var RULESYNC_MCP_SCHEMA_URL = "https://github.com/dyoshikawa/rulesync/releases/latest/download/mcp-schema.json";
|
|
70
71
|
var MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
71
72
|
|
|
@@ -258,10 +259,21 @@ var ALL_FEATURES = [
|
|
|
258
259
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
259
260
|
var FeatureSchema = import_mini.z.enum(ALL_FEATURES);
|
|
260
261
|
var FeaturesSchema = import_mini.z.array(FeatureSchema);
|
|
262
|
+
var FeatureOptionsSchema = import_mini.z.record(import_mini.z.string(), import_mini.z.unknown());
|
|
263
|
+
var FeatureValueSchema = import_mini.z.union([import_mini.z.boolean(), FeatureOptionsSchema]);
|
|
264
|
+
var PerFeatureConfigSchema = import_mini.z.record(import_mini.z.string(), FeatureValueSchema);
|
|
261
265
|
var RulesyncFeaturesSchema = import_mini.z.union([
|
|
262
266
|
import_mini.z.array(import_mini.z.enum(ALL_FEATURES_WITH_WILDCARD)),
|
|
263
|
-
import_mini.z.record(
|
|
267
|
+
import_mini.z.record(
|
|
268
|
+
import_mini.z.string(),
|
|
269
|
+
import_mini.z.union([import_mini.z.array(import_mini.z.enum(ALL_FEATURES_WITH_WILDCARD)), PerFeatureConfigSchema])
|
|
270
|
+
)
|
|
264
271
|
]);
|
|
272
|
+
var isFeatureValueEnabled = (value) => {
|
|
273
|
+
if (value === true) return true;
|
|
274
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) return true;
|
|
275
|
+
return false;
|
|
276
|
+
};
|
|
265
277
|
|
|
266
278
|
// src/types/tool-targets.ts
|
|
267
279
|
var import_mini2 = require("zod/mini");
|
|
@@ -360,7 +372,7 @@ var CONFLICTING_TARGET_PAIRS = [
|
|
|
360
372
|
["claudecode", "claudecode-legacy"]
|
|
361
373
|
];
|
|
362
374
|
var LEGACY_TARGETS = ["augmentcode-legacy", "claudecode-legacy"];
|
|
363
|
-
var Config = class {
|
|
375
|
+
var Config = class _Config {
|
|
364
376
|
baseDirs;
|
|
365
377
|
targets;
|
|
366
378
|
features;
|
|
@@ -435,26 +447,23 @@ var Config = class {
|
|
|
435
447
|
const perTargetFeatures = this.features;
|
|
436
448
|
if (target) {
|
|
437
449
|
const targetFeatures = perTargetFeatures[target];
|
|
438
|
-
if (!targetFeatures
|
|
450
|
+
if (!targetFeatures) {
|
|
439
451
|
return [];
|
|
440
452
|
}
|
|
441
|
-
|
|
442
|
-
return [...ALL_FEATURES];
|
|
443
|
-
}
|
|
444
|
-
return targetFeatures.filter((feature) => feature !== "*");
|
|
453
|
+
return _Config.normalizeTargetFeatures(targetFeatures);
|
|
445
454
|
}
|
|
446
455
|
const allFeatures = [];
|
|
447
456
|
for (const features of Object.values(perTargetFeatures)) {
|
|
448
|
-
if (features
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if (feature !== "*" && !allFeatures.includes(feature)) {
|
|
454
|
-
allFeatures.push(feature);
|
|
455
|
-
}
|
|
457
|
+
if (!features) continue;
|
|
458
|
+
const normalized = _Config.normalizeTargetFeatures(features);
|
|
459
|
+
for (const feature of normalized) {
|
|
460
|
+
if (!allFeatures.includes(feature)) {
|
|
461
|
+
allFeatures.push(feature);
|
|
456
462
|
}
|
|
457
463
|
}
|
|
464
|
+
if (allFeatures.length === ALL_FEATURES.length) {
|
|
465
|
+
return allFeatures;
|
|
466
|
+
}
|
|
458
467
|
}
|
|
459
468
|
return allFeatures;
|
|
460
469
|
}
|
|
@@ -463,6 +472,47 @@ var Config = class {
|
|
|
463
472
|
}
|
|
464
473
|
return this.features.filter((feature) => feature !== "*");
|
|
465
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Normalize a per-target features value (array or per-feature object) into
|
|
477
|
+
* the flat list of enabled features.
|
|
478
|
+
*/
|
|
479
|
+
static normalizeTargetFeatures(value) {
|
|
480
|
+
if (Array.isArray(value)) {
|
|
481
|
+
if (value.length === 0) return [];
|
|
482
|
+
if (value.includes("*")) return [...ALL_FEATURES];
|
|
483
|
+
return value.filter((feature) => feature !== "*");
|
|
484
|
+
}
|
|
485
|
+
if (isFeatureValueEnabled(value["*"])) {
|
|
486
|
+
return [...ALL_FEATURES];
|
|
487
|
+
}
|
|
488
|
+
const enabled = [];
|
|
489
|
+
for (const [key, val] of Object.entries(value)) {
|
|
490
|
+
if (key === "*") continue;
|
|
491
|
+
if (!isFeatureValueEnabled(val)) continue;
|
|
492
|
+
enabled.push(key);
|
|
493
|
+
}
|
|
494
|
+
return enabled;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Returns the per-feature options object for a given target/feature, if any.
|
|
498
|
+
* Returns `undefined` when no per-feature options were provided or when the
|
|
499
|
+
* feature is not enabled for the given target.
|
|
500
|
+
*/
|
|
501
|
+
getFeatureOptions(target, feature) {
|
|
502
|
+
if (Array.isArray(this.features)) {
|
|
503
|
+
return void 0;
|
|
504
|
+
}
|
|
505
|
+
const targetFeatures = this.features[target];
|
|
506
|
+
if (!targetFeatures || Array.isArray(targetFeatures)) {
|
|
507
|
+
return void 0;
|
|
508
|
+
}
|
|
509
|
+
const perFeature = targetFeatures;
|
|
510
|
+
const value = perFeature[feature];
|
|
511
|
+
if (value && typeof value === "object" && isFeatureValueEnabled(value)) {
|
|
512
|
+
return value;
|
|
513
|
+
}
|
|
514
|
+
return void 0;
|
|
515
|
+
}
|
|
466
516
|
/**
|
|
467
517
|
* Check if per-target features configuration is being used.
|
|
468
518
|
*/
|
|
@@ -614,8 +664,8 @@ function getBaseDirsInLightOfGlobal({
|
|
|
614
664
|
}
|
|
615
665
|
|
|
616
666
|
// src/lib/generate.ts
|
|
617
|
-
var
|
|
618
|
-
var
|
|
667
|
+
var import_node_path137 = require("path");
|
|
668
|
+
var import_es_toolkit5 = require("es-toolkit");
|
|
619
669
|
|
|
620
670
|
// src/features/commands/commands-processor.ts
|
|
621
671
|
var import_node_path23 = require("path");
|
|
@@ -5362,7 +5412,7 @@ var HooksProcessor = class extends FeatureProcessor {
|
|
|
5362
5412
|
};
|
|
5363
5413
|
|
|
5364
5414
|
// src/features/ignore/ignore-processor.ts
|
|
5365
|
-
var
|
|
5415
|
+
var import_mini22 = require("zod/mini");
|
|
5366
5416
|
|
|
5367
5417
|
// src/features/ignore/augmentcode-ignore.ts
|
|
5368
5418
|
var import_node_path35 = require("path");
|
|
@@ -5438,7 +5488,7 @@ var ToolIgnore = class extends ToolFile {
|
|
|
5438
5488
|
}
|
|
5439
5489
|
}
|
|
5440
5490
|
}
|
|
5441
|
-
static getSettablePaths() {
|
|
5491
|
+
static getSettablePaths(_params) {
|
|
5442
5492
|
throw new Error("Please implement this method in the subclass.");
|
|
5443
5493
|
}
|
|
5444
5494
|
getPatterns() {
|
|
@@ -5541,21 +5591,47 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
5541
5591
|
// src/features/ignore/claudecode-ignore.ts
|
|
5542
5592
|
var import_node_path36 = require("path");
|
|
5543
5593
|
var import_es_toolkit2 = require("es-toolkit");
|
|
5594
|
+
var import_mini21 = require("zod/mini");
|
|
5595
|
+
var SHARED_SETTINGS_FILE = "settings.json";
|
|
5596
|
+
var LOCAL_SETTINGS_FILE = "settings.local.json";
|
|
5597
|
+
var DEFAULT_FILE_MODE = "shared";
|
|
5598
|
+
var ClaudecodeIgnoreOptionsSchema = import_mini21.z.looseObject({
|
|
5599
|
+
fileMode: import_mini21.z.optional(import_mini21.z.enum(["shared", "local"]))
|
|
5600
|
+
});
|
|
5601
|
+
var resolveFileMode = (options) => {
|
|
5602
|
+
if (!options) return DEFAULT_FILE_MODE;
|
|
5603
|
+
const parsed = ClaudecodeIgnoreOptionsSchema.safeParse(options);
|
|
5604
|
+
if (!parsed.success) {
|
|
5605
|
+
throw new Error(
|
|
5606
|
+
`Invalid options for claudecode ignore feature: ${parsed.error.message}. \`fileMode\` must be either "shared" or "local".`
|
|
5607
|
+
);
|
|
5608
|
+
}
|
|
5609
|
+
return parsed.data.fileMode ?? DEFAULT_FILE_MODE;
|
|
5610
|
+
};
|
|
5611
|
+
var fileNameForMode = (fileMode) => {
|
|
5612
|
+
return fileMode === "local" ? LOCAL_SETTINGS_FILE : SHARED_SETTINGS_FILE;
|
|
5613
|
+
};
|
|
5544
5614
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
5545
5615
|
constructor(params) {
|
|
5546
5616
|
super(params);
|
|
5547
5617
|
const jsonValue = JSON.parse(this.fileContent);
|
|
5548
5618
|
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
5549
5619
|
}
|
|
5550
|
-
static getSettablePaths() {
|
|
5620
|
+
static getSettablePaths(params) {
|
|
5621
|
+
const fileMode = resolveFileMode(params?.options);
|
|
5551
5622
|
return {
|
|
5552
5623
|
relativeDirPath: ".claude",
|
|
5553
|
-
relativeFilePath:
|
|
5624
|
+
relativeFilePath: fileNameForMode(fileMode)
|
|
5554
5625
|
};
|
|
5555
5626
|
}
|
|
5556
5627
|
/**
|
|
5557
|
-
* ClaudecodeIgnore uses settings.json, which can
|
|
5558
|
-
* It should not be deleted by rulesync.
|
|
5628
|
+
* ClaudecodeIgnore uses settings.json (or settings.local.json), which can
|
|
5629
|
+
* include non-ignore settings. It should not be deleted by rulesync.
|
|
5630
|
+
*
|
|
5631
|
+
* NOTE: Because this returns `false`, switching `fileMode` (e.g. from
|
|
5632
|
+
* `"local"` to `"shared"`) will not automatically clean up deny patterns
|
|
5633
|
+
* in the previously-used file. Users must manually remove stale deny
|
|
5634
|
+
* entries from the old file when changing `fileMode`.
|
|
5559
5635
|
*/
|
|
5560
5636
|
isDeletable() {
|
|
5561
5637
|
return false;
|
|
@@ -5577,16 +5653,14 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
5577
5653
|
}
|
|
5578
5654
|
static async fromRulesyncIgnore({
|
|
5579
5655
|
baseDir = process.cwd(),
|
|
5580
|
-
rulesyncIgnore
|
|
5656
|
+
rulesyncIgnore,
|
|
5657
|
+
options
|
|
5581
5658
|
}) {
|
|
5582
5659
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
5583
5660
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
5584
5661
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
5585
|
-
const
|
|
5586
|
-
|
|
5587
|
-
this.getSettablePaths().relativeDirPath,
|
|
5588
|
-
this.getSettablePaths().relativeFilePath
|
|
5589
|
-
);
|
|
5662
|
+
const paths = this.getSettablePaths({ options });
|
|
5663
|
+
const filePath = (0, import_node_path36.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
5590
5664
|
const exists = await fileExists(filePath);
|
|
5591
5665
|
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
5592
5666
|
const existingJsonValue = JSON.parse(existingFileContent);
|
|
@@ -5607,27 +5681,29 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
5607
5681
|
};
|
|
5608
5682
|
return new _ClaudecodeIgnore({
|
|
5609
5683
|
baseDir,
|
|
5610
|
-
relativeDirPath:
|
|
5611
|
-
relativeFilePath:
|
|
5684
|
+
relativeDirPath: paths.relativeDirPath,
|
|
5685
|
+
relativeFilePath: paths.relativeFilePath,
|
|
5612
5686
|
fileContent: JSON.stringify(jsonValue, null, 2),
|
|
5613
5687
|
validate: true
|
|
5614
5688
|
});
|
|
5615
5689
|
}
|
|
5616
5690
|
static async fromFile({
|
|
5617
5691
|
baseDir = process.cwd(),
|
|
5618
|
-
validate = true
|
|
5692
|
+
validate = true,
|
|
5693
|
+
options
|
|
5619
5694
|
}) {
|
|
5620
|
-
const
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
)
|
|
5626
|
-
|
|
5695
|
+
const fileMode = resolveFileMode(options);
|
|
5696
|
+
const paths = this.getSettablePaths({ options });
|
|
5697
|
+
const filePath = (0, import_node_path36.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
5698
|
+
const exists = await fileExists(filePath);
|
|
5699
|
+
if (!exists && fileMode === "shared") {
|
|
5700
|
+
throw new Error(`File not found: ${filePath}`);
|
|
5701
|
+
}
|
|
5702
|
+
const fileContent = exists ? await readFileContent(filePath) : "{}";
|
|
5627
5703
|
return new _ClaudecodeIgnore({
|
|
5628
5704
|
baseDir,
|
|
5629
|
-
relativeDirPath:
|
|
5630
|
-
relativeFilePath:
|
|
5705
|
+
relativeDirPath: paths.relativeDirPath,
|
|
5706
|
+
relativeFilePath: paths.relativeFilePath,
|
|
5631
5707
|
fileContent,
|
|
5632
5708
|
validate
|
|
5633
5709
|
});
|
|
@@ -6364,7 +6440,7 @@ var ignoreProcessorToolTargets = [
|
|
|
6364
6440
|
"windsurf",
|
|
6365
6441
|
"zed"
|
|
6366
6442
|
];
|
|
6367
|
-
var IgnoreProcessorToolTargetSchema =
|
|
6443
|
+
var IgnoreProcessorToolTargetSchema = import_mini22.z.enum(ignoreProcessorToolTargets);
|
|
6368
6444
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
6369
6445
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
6370
6446
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
@@ -6391,12 +6467,14 @@ var defaultGetFactory2 = (target) => {
|
|
|
6391
6467
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
6392
6468
|
toolTarget;
|
|
6393
6469
|
getFactory;
|
|
6470
|
+
featureOptions;
|
|
6394
6471
|
constructor({
|
|
6395
6472
|
baseDir = process.cwd(),
|
|
6396
6473
|
toolTarget,
|
|
6397
6474
|
getFactory = defaultGetFactory2,
|
|
6398
6475
|
dryRun = false,
|
|
6399
|
-
logger
|
|
6476
|
+
logger,
|
|
6477
|
+
featureOptions
|
|
6400
6478
|
}) {
|
|
6401
6479
|
super({ baseDir, dryRun, logger });
|
|
6402
6480
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -6407,6 +6485,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6407
6485
|
}
|
|
6408
6486
|
this.toolTarget = result.data;
|
|
6409
6487
|
this.getFactory = getFactory;
|
|
6488
|
+
this.featureOptions = featureOptions;
|
|
6410
6489
|
}
|
|
6411
6490
|
async writeToolIgnoresFromRulesyncIgnores(rulesyncIgnores) {
|
|
6412
6491
|
const toolIgnores = await this.convertRulesyncFilesToToolFiles(rulesyncIgnores);
|
|
@@ -6435,7 +6514,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6435
6514
|
} = {}) {
|
|
6436
6515
|
try {
|
|
6437
6516
|
const factory = this.getFactory(this.toolTarget);
|
|
6438
|
-
const paths = factory.class.getSettablePaths();
|
|
6517
|
+
const paths = factory.class.getSettablePaths({ options: this.featureOptions });
|
|
6439
6518
|
if (forDeletion) {
|
|
6440
6519
|
const toolIgnore = factory.class.forDeletion({
|
|
6441
6520
|
baseDir: this.baseDir,
|
|
@@ -6459,7 +6538,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6459
6538
|
}
|
|
6460
6539
|
async loadToolIgnores() {
|
|
6461
6540
|
const factory = this.getFactory(this.toolTarget);
|
|
6462
|
-
return [await factory.class.fromFile({ baseDir: this.baseDir })];
|
|
6541
|
+
return [await factory.class.fromFile({ baseDir: this.baseDir, options: this.featureOptions })];
|
|
6463
6542
|
}
|
|
6464
6543
|
/**
|
|
6465
6544
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -6475,7 +6554,8 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6475
6554
|
const factory = this.getFactory(this.toolTarget);
|
|
6476
6555
|
const toolIgnore = await factory.class.fromRulesyncIgnore({
|
|
6477
6556
|
baseDir: this.baseDir,
|
|
6478
|
-
rulesyncIgnore
|
|
6557
|
+
rulesyncIgnore,
|
|
6558
|
+
options: this.featureOptions
|
|
6479
6559
|
});
|
|
6480
6560
|
return [toolIgnore];
|
|
6481
6561
|
}
|
|
@@ -6503,7 +6583,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
6503
6583
|
};
|
|
6504
6584
|
|
|
6505
6585
|
// src/features/mcp/mcp-processor.ts
|
|
6506
|
-
var
|
|
6586
|
+
var import_mini27 = require("zod/mini");
|
|
6507
6587
|
|
|
6508
6588
|
// src/features/mcp/claudecode-mcp.ts
|
|
6509
6589
|
var import_node_path49 = require("path");
|
|
@@ -6511,47 +6591,47 @@ var import_node_path49 = require("path");
|
|
|
6511
6591
|
// src/features/mcp/rulesync-mcp.ts
|
|
6512
6592
|
var import_node_path48 = require("path");
|
|
6513
6593
|
var import_object = require("es-toolkit/object");
|
|
6514
|
-
var
|
|
6594
|
+
var import_mini24 = require("zod/mini");
|
|
6515
6595
|
|
|
6516
6596
|
// src/types/mcp.ts
|
|
6517
|
-
var
|
|
6518
|
-
var McpServerSchema =
|
|
6519
|
-
type:
|
|
6520
|
-
command:
|
|
6521
|
-
args:
|
|
6522
|
-
url:
|
|
6523
|
-
httpUrl:
|
|
6524
|
-
env:
|
|
6525
|
-
disabled:
|
|
6526
|
-
networkTimeout:
|
|
6527
|
-
timeout:
|
|
6528
|
-
trust:
|
|
6529
|
-
cwd:
|
|
6530
|
-
transport:
|
|
6531
|
-
alwaysAllow:
|
|
6532
|
-
tools:
|
|
6533
|
-
kiroAutoApprove:
|
|
6534
|
-
kiroAutoBlock:
|
|
6535
|
-
headers:
|
|
6536
|
-
enabledTools:
|
|
6537
|
-
disabledTools:
|
|
6597
|
+
var import_mini23 = require("zod/mini");
|
|
6598
|
+
var McpServerSchema = import_mini23.z.looseObject({
|
|
6599
|
+
type: import_mini23.z.optional(import_mini23.z.enum(["local", "stdio", "sse", "http"])),
|
|
6600
|
+
command: import_mini23.z.optional(import_mini23.z.union([import_mini23.z.string(), import_mini23.z.array(import_mini23.z.string())])),
|
|
6601
|
+
args: import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string())),
|
|
6602
|
+
url: import_mini23.z.optional(import_mini23.z.string()),
|
|
6603
|
+
httpUrl: import_mini23.z.optional(import_mini23.z.string()),
|
|
6604
|
+
env: import_mini23.z.optional(import_mini23.z.record(import_mini23.z.string(), import_mini23.z.string())),
|
|
6605
|
+
disabled: import_mini23.z.optional(import_mini23.z.boolean()),
|
|
6606
|
+
networkTimeout: import_mini23.z.optional(import_mini23.z.number()),
|
|
6607
|
+
timeout: import_mini23.z.optional(import_mini23.z.number()),
|
|
6608
|
+
trust: import_mini23.z.optional(import_mini23.z.boolean()),
|
|
6609
|
+
cwd: import_mini23.z.optional(import_mini23.z.string()),
|
|
6610
|
+
transport: import_mini23.z.optional(import_mini23.z.enum(["local", "stdio", "sse", "http"])),
|
|
6611
|
+
alwaysAllow: import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string())),
|
|
6612
|
+
tools: import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string())),
|
|
6613
|
+
kiroAutoApprove: import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string())),
|
|
6614
|
+
kiroAutoBlock: import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string())),
|
|
6615
|
+
headers: import_mini23.z.optional(import_mini23.z.record(import_mini23.z.string(), import_mini23.z.string())),
|
|
6616
|
+
enabledTools: import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string())),
|
|
6617
|
+
disabledTools: import_mini23.z.optional(import_mini23.z.array(import_mini23.z.string()))
|
|
6538
6618
|
});
|
|
6539
|
-
var McpServersSchema =
|
|
6619
|
+
var McpServersSchema = import_mini23.z.record(import_mini23.z.string(), McpServerSchema);
|
|
6540
6620
|
function isMcpServers(value) {
|
|
6541
6621
|
return value !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6542
6622
|
}
|
|
6543
6623
|
|
|
6544
6624
|
// src/features/mcp/rulesync-mcp.ts
|
|
6545
|
-
var RulesyncMcpServerSchema =
|
|
6546
|
-
targets:
|
|
6547
|
-
description:
|
|
6548
|
-
exposed:
|
|
6625
|
+
var RulesyncMcpServerSchema = import_mini24.z.extend(McpServerSchema, {
|
|
6626
|
+
targets: import_mini24.z.optional(RulesyncTargetsSchema),
|
|
6627
|
+
description: import_mini24.z.optional(import_mini24.z.string()),
|
|
6628
|
+
exposed: import_mini24.z.optional(import_mini24.z.boolean())
|
|
6549
6629
|
});
|
|
6550
|
-
var RulesyncMcpConfigSchema =
|
|
6551
|
-
mcpServers:
|
|
6630
|
+
var RulesyncMcpConfigSchema = import_mini24.z.object({
|
|
6631
|
+
mcpServers: import_mini24.z.record(import_mini24.z.string(), RulesyncMcpServerSchema)
|
|
6552
6632
|
});
|
|
6553
|
-
var RulesyncMcpFileSchema =
|
|
6554
|
-
$schema:
|
|
6633
|
+
var RulesyncMcpFileSchema = import_mini24.z.looseObject({
|
|
6634
|
+
$schema: import_mini24.z.optional(import_mini24.z.string()),
|
|
6555
6635
|
...RulesyncMcpConfigSchema.shape
|
|
6556
6636
|
});
|
|
6557
6637
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
@@ -7752,25 +7832,25 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
7752
7832
|
// src/features/mcp/kilo-mcp.ts
|
|
7753
7833
|
var import_node_path59 = require("path");
|
|
7754
7834
|
var import_jsonc_parser3 = require("jsonc-parser");
|
|
7755
|
-
var
|
|
7756
|
-
var KiloMcpLocalServerSchema =
|
|
7757
|
-
type:
|
|
7758
|
-
command:
|
|
7759
|
-
environment:
|
|
7760
|
-
enabled:
|
|
7761
|
-
cwd:
|
|
7835
|
+
var import_mini25 = require("zod/mini");
|
|
7836
|
+
var KiloMcpLocalServerSchema = import_mini25.z.object({
|
|
7837
|
+
type: import_mini25.z.literal("local"),
|
|
7838
|
+
command: import_mini25.z.array(import_mini25.z.string()),
|
|
7839
|
+
environment: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), import_mini25.z.string())),
|
|
7840
|
+
enabled: import_mini25.z._default(import_mini25.z.boolean(), true),
|
|
7841
|
+
cwd: import_mini25.z.optional(import_mini25.z.string())
|
|
7762
7842
|
});
|
|
7763
|
-
var KiloMcpRemoteServerSchema =
|
|
7764
|
-
type:
|
|
7765
|
-
url:
|
|
7766
|
-
headers:
|
|
7767
|
-
enabled:
|
|
7843
|
+
var KiloMcpRemoteServerSchema = import_mini25.z.object({
|
|
7844
|
+
type: import_mini25.z.literal("remote"),
|
|
7845
|
+
url: import_mini25.z.string(),
|
|
7846
|
+
headers: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), import_mini25.z.string())),
|
|
7847
|
+
enabled: import_mini25.z._default(import_mini25.z.boolean(), true)
|
|
7768
7848
|
});
|
|
7769
|
-
var KiloMcpServerSchema =
|
|
7770
|
-
var KiloConfigSchema =
|
|
7771
|
-
$schema:
|
|
7772
|
-
mcp:
|
|
7773
|
-
tools:
|
|
7849
|
+
var KiloMcpServerSchema = import_mini25.z.union([KiloMcpLocalServerSchema, KiloMcpRemoteServerSchema]);
|
|
7850
|
+
var KiloConfigSchema = import_mini25.z.looseObject({
|
|
7851
|
+
$schema: import_mini25.z.optional(import_mini25.z.string()),
|
|
7852
|
+
mcp: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), KiloMcpServerSchema)),
|
|
7853
|
+
tools: import_mini25.z.optional(import_mini25.z.record(import_mini25.z.string(), import_mini25.z.boolean()))
|
|
7774
7854
|
});
|
|
7775
7855
|
function convertFromKiloFormat(kiloMcp, tools) {
|
|
7776
7856
|
return Object.fromEntries(
|
|
@@ -8067,28 +8147,28 @@ var KiroMcp = class _KiroMcp extends ToolMcp {
|
|
|
8067
8147
|
// src/features/mcp/opencode-mcp.ts
|
|
8068
8148
|
var import_node_path61 = require("path");
|
|
8069
8149
|
var import_jsonc_parser4 = require("jsonc-parser");
|
|
8070
|
-
var
|
|
8071
|
-
var OpencodeMcpLocalServerSchema =
|
|
8072
|
-
type:
|
|
8073
|
-
command:
|
|
8074
|
-
environment:
|
|
8075
|
-
enabled:
|
|
8076
|
-
cwd:
|
|
8150
|
+
var import_mini26 = require("zod/mini");
|
|
8151
|
+
var OpencodeMcpLocalServerSchema = import_mini26.z.object({
|
|
8152
|
+
type: import_mini26.z.literal("local"),
|
|
8153
|
+
command: import_mini26.z.array(import_mini26.z.string()),
|
|
8154
|
+
environment: import_mini26.z.optional(import_mini26.z.record(import_mini26.z.string(), import_mini26.z.string())),
|
|
8155
|
+
enabled: import_mini26.z._default(import_mini26.z.boolean(), true),
|
|
8156
|
+
cwd: import_mini26.z.optional(import_mini26.z.string())
|
|
8077
8157
|
});
|
|
8078
|
-
var OpencodeMcpRemoteServerSchema =
|
|
8079
|
-
type:
|
|
8080
|
-
url:
|
|
8081
|
-
headers:
|
|
8082
|
-
enabled:
|
|
8158
|
+
var OpencodeMcpRemoteServerSchema = import_mini26.z.object({
|
|
8159
|
+
type: import_mini26.z.literal("remote"),
|
|
8160
|
+
url: import_mini26.z.string(),
|
|
8161
|
+
headers: import_mini26.z.optional(import_mini26.z.record(import_mini26.z.string(), import_mini26.z.string())),
|
|
8162
|
+
enabled: import_mini26.z._default(import_mini26.z.boolean(), true)
|
|
8083
8163
|
});
|
|
8084
|
-
var OpencodeMcpServerSchema =
|
|
8164
|
+
var OpencodeMcpServerSchema = import_mini26.z.union([
|
|
8085
8165
|
OpencodeMcpLocalServerSchema,
|
|
8086
8166
|
OpencodeMcpRemoteServerSchema
|
|
8087
8167
|
]);
|
|
8088
|
-
var OpencodeConfigSchema =
|
|
8089
|
-
$schema:
|
|
8090
|
-
mcp:
|
|
8091
|
-
tools:
|
|
8168
|
+
var OpencodeConfigSchema = import_mini26.z.looseObject({
|
|
8169
|
+
$schema: import_mini26.z.optional(import_mini26.z.string()),
|
|
8170
|
+
mcp: import_mini26.z.optional(import_mini26.z.record(import_mini26.z.string(), OpencodeMcpServerSchema)),
|
|
8171
|
+
tools: import_mini26.z.optional(import_mini26.z.record(import_mini26.z.string(), import_mini26.z.boolean()))
|
|
8092
8172
|
});
|
|
8093
8173
|
function convertFromOpencodeFormat(opencodeMcp, tools) {
|
|
8094
8174
|
return Object.fromEntries(
|
|
@@ -8559,7 +8639,7 @@ var mcpProcessorToolTargetTuple = [
|
|
|
8559
8639
|
"roo",
|
|
8560
8640
|
"rovodev"
|
|
8561
8641
|
];
|
|
8562
|
-
var McpProcessorToolTargetSchema =
|
|
8642
|
+
var McpProcessorToolTargetSchema = import_mini27.z.enum(mcpProcessorToolTargetTuple);
|
|
8563
8643
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
8564
8644
|
[
|
|
8565
8645
|
"claudecode",
|
|
@@ -8897,131 +8977,713 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
8897
8977
|
}
|
|
8898
8978
|
};
|
|
8899
8979
|
|
|
8900
|
-
// src/features/
|
|
8901
|
-
var
|
|
8902
|
-
var import_toon = require("@toon-format/toon");
|
|
8903
|
-
var import_mini65 = require("zod/mini");
|
|
8904
|
-
|
|
8905
|
-
// src/constants/general.ts
|
|
8906
|
-
var SKILL_FILE_NAME = "SKILL.md";
|
|
8980
|
+
// src/features/permissions/permissions-processor.ts
|
|
8981
|
+
var import_mini30 = require("zod/mini");
|
|
8907
8982
|
|
|
8908
|
-
// src/features/
|
|
8909
|
-
var
|
|
8983
|
+
// src/features/permissions/claudecode-permissions.ts
|
|
8984
|
+
var import_node_path65 = require("path");
|
|
8985
|
+
var import_es_toolkit4 = require("es-toolkit");
|
|
8910
8986
|
|
|
8911
|
-
// src/features/
|
|
8912
|
-
var
|
|
8913
|
-
var import_mini27 = require("zod/mini");
|
|
8987
|
+
// src/features/permissions/rulesync-permissions.ts
|
|
8988
|
+
var import_node_path64 = require("path");
|
|
8914
8989
|
|
|
8915
|
-
// src/
|
|
8916
|
-
var
|
|
8990
|
+
// src/types/permissions.ts
|
|
8991
|
+
var import_mini28 = require("zod/mini");
|
|
8992
|
+
var PermissionActionSchema = import_mini28.z.enum(["allow", "ask", "deny"]);
|
|
8993
|
+
var PermissionRulesSchema = import_mini28.z.record(import_mini28.z.string(), PermissionActionSchema);
|
|
8994
|
+
var PermissionsConfigSchema = import_mini28.z.looseObject({
|
|
8995
|
+
permission: import_mini28.z.record(import_mini28.z.string(), PermissionRulesSchema)
|
|
8996
|
+
});
|
|
8997
|
+
var RulesyncPermissionsFileSchema = import_mini28.z.looseObject({
|
|
8998
|
+
$schema: import_mini28.z.optional(import_mini28.z.string()),
|
|
8999
|
+
...PermissionsConfigSchema.shape
|
|
9000
|
+
});
|
|
8917
9001
|
|
|
8918
|
-
// src/
|
|
8919
|
-
var
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
constructor({
|
|
9002
|
+
// src/features/permissions/rulesync-permissions.ts
|
|
9003
|
+
var RulesyncPermissions = class _RulesyncPermissions extends RulesyncFile {
|
|
9004
|
+
json;
|
|
9005
|
+
constructor(params) {
|
|
9006
|
+
super({ ...params });
|
|
9007
|
+
this.json = JSON.parse(this.fileContent);
|
|
9008
|
+
if (params.validate) {
|
|
9009
|
+
const result = this.validate();
|
|
9010
|
+
if (!result.success) {
|
|
9011
|
+
throw result.error;
|
|
9012
|
+
}
|
|
9013
|
+
}
|
|
9014
|
+
}
|
|
9015
|
+
static getSettablePaths() {
|
|
9016
|
+
return {
|
|
9017
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
9018
|
+
relativeFilePath: RULESYNC_PERMISSIONS_FILE_NAME
|
|
9019
|
+
};
|
|
9020
|
+
}
|
|
9021
|
+
validate() {
|
|
9022
|
+
const result = RulesyncPermissionsFileSchema.safeParse(this.json);
|
|
9023
|
+
if (!result.success) {
|
|
9024
|
+
return { success: false, error: result.error };
|
|
9025
|
+
}
|
|
9026
|
+
return { success: true, error: null };
|
|
9027
|
+
}
|
|
9028
|
+
static async fromFile({
|
|
8946
9029
|
baseDir = process.cwd(),
|
|
8947
|
-
|
|
8948
|
-
dirName,
|
|
8949
|
-
mainFile,
|
|
8950
|
-
otherFiles = [],
|
|
8951
|
-
global = false
|
|
9030
|
+
validate = true
|
|
8952
9031
|
}) {
|
|
8953
|
-
|
|
8954
|
-
|
|
9032
|
+
const paths = _RulesyncPermissions.getSettablePaths();
|
|
9033
|
+
const filePath = (0, import_node_path64.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
9034
|
+
if (!await fileExists(filePath)) {
|
|
9035
|
+
throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
|
|
8955
9036
|
}
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
9037
|
+
const fileContent = await readFileContent(filePath);
|
|
9038
|
+
return new _RulesyncPermissions({
|
|
9039
|
+
baseDir,
|
|
9040
|
+
relativeDirPath: paths.relativeDirPath,
|
|
9041
|
+
relativeFilePath: paths.relativeFilePath,
|
|
9042
|
+
fileContent,
|
|
9043
|
+
validate
|
|
9044
|
+
});
|
|
8962
9045
|
}
|
|
8963
|
-
|
|
9046
|
+
getJson() {
|
|
9047
|
+
return this.json;
|
|
9048
|
+
}
|
|
9049
|
+
};
|
|
9050
|
+
|
|
9051
|
+
// src/features/permissions/tool-permissions.ts
|
|
9052
|
+
var ToolPermissions = class extends ToolFile {
|
|
9053
|
+
static getSettablePaths(_options) {
|
|
8964
9054
|
throw new Error("Please implement this method in the subclass.");
|
|
8965
9055
|
}
|
|
8966
|
-
|
|
8967
|
-
return
|
|
9056
|
+
validate() {
|
|
9057
|
+
return { success: true, error: null };
|
|
8968
9058
|
}
|
|
8969
|
-
|
|
8970
|
-
|
|
9059
|
+
static fromRulesyncPermissions(_params) {
|
|
9060
|
+
throw new Error("Please implement this method in the subclass.");
|
|
8971
9061
|
}
|
|
8972
|
-
|
|
8973
|
-
|
|
9062
|
+
toRulesyncPermissionsDefault({
|
|
9063
|
+
fileContent
|
|
9064
|
+
}) {
|
|
9065
|
+
return new RulesyncPermissions({
|
|
9066
|
+
baseDir: this.baseDir,
|
|
9067
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
9068
|
+
relativeFilePath: RULESYNC_PERMISSIONS_FILE_NAME,
|
|
9069
|
+
fileContent
|
|
9070
|
+
});
|
|
8974
9071
|
}
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
const resolvedFull = (0, import_node_path64.resolve)(fullPath);
|
|
8978
|
-
const resolvedBase = (0, import_node_path64.resolve)(this.baseDir);
|
|
8979
|
-
const rel = (0, import_node_path64.relative)(resolvedBase, resolvedFull);
|
|
8980
|
-
if (rel.startsWith("..") || import_node_path64.default.isAbsolute(rel)) {
|
|
8981
|
-
throw new Error(
|
|
8982
|
-
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
8983
|
-
);
|
|
8984
|
-
}
|
|
8985
|
-
return fullPath;
|
|
9072
|
+
static async fromFile(_params) {
|
|
9073
|
+
throw new Error("Please implement this method in the subclass.");
|
|
8986
9074
|
}
|
|
8987
|
-
|
|
8988
|
-
|
|
9075
|
+
static forDeletion(_params) {
|
|
9076
|
+
throw new Error("Please implement this method in the subclass.");
|
|
8989
9077
|
}
|
|
8990
|
-
|
|
8991
|
-
|
|
9078
|
+
};
|
|
9079
|
+
|
|
9080
|
+
// src/features/permissions/claudecode-permissions.ts
|
|
9081
|
+
var CANONICAL_TO_CLAUDE_TOOL_NAMES = {
|
|
9082
|
+
bash: "Bash",
|
|
9083
|
+
read: "Read",
|
|
9084
|
+
edit: "Edit",
|
|
9085
|
+
write: "Write",
|
|
9086
|
+
webfetch: "WebFetch",
|
|
9087
|
+
websearch: "WebSearch",
|
|
9088
|
+
grep: "Grep",
|
|
9089
|
+
glob: "Glob",
|
|
9090
|
+
notebookedit: "NotebookEdit",
|
|
9091
|
+
agent: "Agent"
|
|
9092
|
+
};
|
|
9093
|
+
var CLAUDE_TO_CANONICAL_TOOL_NAMES = Object.fromEntries(
|
|
9094
|
+
Object.entries(CANONICAL_TO_CLAUDE_TOOL_NAMES).map(([k, v]) => [v, k])
|
|
9095
|
+
);
|
|
9096
|
+
function toClaudeToolName(canonical) {
|
|
9097
|
+
return CANONICAL_TO_CLAUDE_TOOL_NAMES[canonical] ?? canonical;
|
|
9098
|
+
}
|
|
9099
|
+
function toCanonicalToolName(claudeName) {
|
|
9100
|
+
return CLAUDE_TO_CANONICAL_TOOL_NAMES[claudeName] ?? claudeName;
|
|
9101
|
+
}
|
|
9102
|
+
function parseClaudePermissionEntry(entry) {
|
|
9103
|
+
const parenIndex = entry.indexOf("(");
|
|
9104
|
+
if (parenIndex === -1) {
|
|
9105
|
+
return { toolName: entry, pattern: "*" };
|
|
8992
9106
|
}
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
getRelativePathFromCwd() {
|
|
8997
|
-
return toPosixPath(import_node_path64.default.join(this.relativeDirPath, this.dirName));
|
|
9107
|
+
const toolName = entry.slice(0, parenIndex);
|
|
9108
|
+
if (!entry.endsWith(")")) {
|
|
9109
|
+
return { toolName, pattern: "*" };
|
|
8998
9110
|
}
|
|
8999
|
-
|
|
9000
|
-
|
|
9111
|
+
const pattern = entry.slice(parenIndex + 1, -1);
|
|
9112
|
+
return { toolName, pattern: pattern || "*" };
|
|
9113
|
+
}
|
|
9114
|
+
function buildClaudePermissionEntry(toolName, pattern) {
|
|
9115
|
+
if (pattern === "*") {
|
|
9116
|
+
return toolName;
|
|
9001
9117
|
}
|
|
9002
|
-
|
|
9003
|
-
|
|
9118
|
+
return `${toolName}(${pattern})`;
|
|
9119
|
+
}
|
|
9120
|
+
var ClaudecodePermissions = class _ClaudecodePermissions extends ToolPermissions {
|
|
9121
|
+
constructor(params) {
|
|
9122
|
+
super({
|
|
9123
|
+
...params,
|
|
9124
|
+
fileContent: params.fileContent ?? "{}"
|
|
9125
|
+
});
|
|
9004
9126
|
}
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
const
|
|
9019
|
-
const
|
|
9020
|
-
const
|
|
9127
|
+
isDeletable() {
|
|
9128
|
+
return false;
|
|
9129
|
+
}
|
|
9130
|
+
static getSettablePaths() {
|
|
9131
|
+
return {
|
|
9132
|
+
relativeDirPath: ".claude",
|
|
9133
|
+
relativeFilePath: "settings.json"
|
|
9134
|
+
};
|
|
9135
|
+
}
|
|
9136
|
+
static async fromFile({
|
|
9137
|
+
baseDir = process.cwd(),
|
|
9138
|
+
validate = true
|
|
9139
|
+
}) {
|
|
9140
|
+
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
9141
|
+
const filePath = (0, import_node_path65.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
9142
|
+
const fileContent = await readFileContentOrNull(filePath) ?? '{"permissions":{}}';
|
|
9143
|
+
return new _ClaudecodePermissions({
|
|
9144
|
+
baseDir,
|
|
9145
|
+
relativeDirPath: paths.relativeDirPath,
|
|
9146
|
+
relativeFilePath: paths.relativeFilePath,
|
|
9147
|
+
fileContent,
|
|
9148
|
+
validate
|
|
9149
|
+
});
|
|
9150
|
+
}
|
|
9151
|
+
static async fromRulesyncPermissions({
|
|
9152
|
+
baseDir = process.cwd(),
|
|
9153
|
+
rulesyncPermissions,
|
|
9154
|
+
logger
|
|
9155
|
+
}) {
|
|
9156
|
+
const paths = _ClaudecodePermissions.getSettablePaths();
|
|
9157
|
+
const filePath = (0, import_node_path65.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
9158
|
+
const existingContent = await readOrInitializeFileContent(
|
|
9159
|
+
filePath,
|
|
9160
|
+
JSON.stringify({}, null, 2)
|
|
9161
|
+
);
|
|
9162
|
+
let settings;
|
|
9163
|
+
try {
|
|
9164
|
+
settings = JSON.parse(existingContent);
|
|
9165
|
+
} catch (error) {
|
|
9166
|
+
throw new Error(
|
|
9167
|
+
`Failed to parse existing Claude settings at ${filePath}: ${formatError(error)}`,
|
|
9168
|
+
{ cause: error }
|
|
9169
|
+
);
|
|
9170
|
+
}
|
|
9171
|
+
const config = rulesyncPermissions.getJson();
|
|
9172
|
+
const { allow, ask, deny } = convertRulesyncToClaudePermissions(config);
|
|
9173
|
+
const managedToolNames = new Set(
|
|
9174
|
+
Object.keys(config.permission).map((category) => toClaudeToolName(category))
|
|
9175
|
+
);
|
|
9176
|
+
const existingPermissions = settings.permissions ?? {};
|
|
9177
|
+
const preservedAllow = (existingPermissions.allow ?? []).filter(
|
|
9178
|
+
(entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
|
|
9179
|
+
);
|
|
9180
|
+
const preservedAsk = (existingPermissions.ask ?? []).filter(
|
|
9181
|
+
(entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
|
|
9182
|
+
);
|
|
9183
|
+
const preservedDeny = (existingPermissions.deny ?? []).filter(
|
|
9184
|
+
(entry) => !managedToolNames.has(parseClaudePermissionEntry(entry).toolName)
|
|
9185
|
+
);
|
|
9186
|
+
if (logger && managedToolNames.has("Read")) {
|
|
9187
|
+
const droppedReadDenyEntries = (existingPermissions.deny ?? []).filter((entry) => {
|
|
9188
|
+
const { toolName } = parseClaudePermissionEntry(entry);
|
|
9189
|
+
return toolName === "Read";
|
|
9190
|
+
});
|
|
9191
|
+
if (droppedReadDenyEntries.length > 0) {
|
|
9192
|
+
logger.warn(
|
|
9193
|
+
`Permissions feature manages 'Read' tool and will overwrite ${droppedReadDenyEntries.length} existing Read deny entries (possibly from ignore feature). Permissions take precedence.`
|
|
9194
|
+
);
|
|
9195
|
+
}
|
|
9196
|
+
}
|
|
9197
|
+
const mergedPermissions = {
|
|
9198
|
+
...existingPermissions
|
|
9199
|
+
};
|
|
9200
|
+
const mergedAllow = (0, import_es_toolkit4.uniq)([...preservedAllow, ...allow].toSorted());
|
|
9201
|
+
const mergedAsk = (0, import_es_toolkit4.uniq)([...preservedAsk, ...ask].toSorted());
|
|
9202
|
+
const mergedDeny = (0, import_es_toolkit4.uniq)([...preservedDeny, ...deny].toSorted());
|
|
9203
|
+
if (mergedAllow.length > 0) {
|
|
9204
|
+
mergedPermissions.allow = mergedAllow;
|
|
9205
|
+
} else {
|
|
9206
|
+
delete mergedPermissions.allow;
|
|
9207
|
+
}
|
|
9208
|
+
if (mergedAsk.length > 0) {
|
|
9209
|
+
mergedPermissions.ask = mergedAsk;
|
|
9210
|
+
} else {
|
|
9211
|
+
delete mergedPermissions.ask;
|
|
9212
|
+
}
|
|
9213
|
+
if (mergedDeny.length > 0) {
|
|
9214
|
+
mergedPermissions.deny = mergedDeny;
|
|
9215
|
+
} else {
|
|
9216
|
+
delete mergedPermissions.deny;
|
|
9217
|
+
}
|
|
9218
|
+
const merged = { ...settings, permissions: mergedPermissions };
|
|
9219
|
+
const fileContent = JSON.stringify(merged, null, 2);
|
|
9220
|
+
return new _ClaudecodePermissions({
|
|
9221
|
+
baseDir,
|
|
9222
|
+
relativeDirPath: paths.relativeDirPath,
|
|
9223
|
+
relativeFilePath: paths.relativeFilePath,
|
|
9224
|
+
fileContent,
|
|
9225
|
+
validate: true
|
|
9226
|
+
});
|
|
9227
|
+
}
|
|
9228
|
+
toRulesyncPermissions() {
|
|
9229
|
+
let settings;
|
|
9230
|
+
try {
|
|
9231
|
+
settings = JSON.parse(this.getFileContent());
|
|
9232
|
+
} catch (error) {
|
|
9233
|
+
throw new Error(
|
|
9234
|
+
`Failed to parse Claude permissions content in ${(0, import_node_path65.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
9235
|
+
{ cause: error }
|
|
9236
|
+
);
|
|
9237
|
+
}
|
|
9238
|
+
const permissions = settings.permissions ?? {};
|
|
9239
|
+
const config = convertClaudeToRulesyncPermissions({
|
|
9240
|
+
allow: permissions.allow ?? [],
|
|
9241
|
+
ask: permissions.ask ?? [],
|
|
9242
|
+
deny: permissions.deny ?? []
|
|
9243
|
+
});
|
|
9244
|
+
return this.toRulesyncPermissionsDefault({
|
|
9245
|
+
fileContent: JSON.stringify(config, null, 2)
|
|
9246
|
+
});
|
|
9247
|
+
}
|
|
9248
|
+
validate() {
|
|
9249
|
+
return { success: true, error: null };
|
|
9250
|
+
}
|
|
9251
|
+
static forDeletion({
|
|
9252
|
+
baseDir = process.cwd(),
|
|
9253
|
+
relativeDirPath,
|
|
9254
|
+
relativeFilePath
|
|
9255
|
+
}) {
|
|
9256
|
+
return new _ClaudecodePermissions({
|
|
9257
|
+
baseDir,
|
|
9258
|
+
relativeDirPath,
|
|
9259
|
+
relativeFilePath,
|
|
9260
|
+
fileContent: JSON.stringify({ permissions: {} }, null, 2),
|
|
9261
|
+
validate: false
|
|
9262
|
+
});
|
|
9263
|
+
}
|
|
9264
|
+
};
|
|
9265
|
+
function convertRulesyncToClaudePermissions(config) {
|
|
9266
|
+
const allow = [];
|
|
9267
|
+
const ask = [];
|
|
9268
|
+
const deny = [];
|
|
9269
|
+
for (const [category, rules] of Object.entries(config.permission)) {
|
|
9270
|
+
const claudeToolName = toClaudeToolName(category);
|
|
9271
|
+
for (const [pattern, action] of Object.entries(rules)) {
|
|
9272
|
+
const entry = buildClaudePermissionEntry(claudeToolName, pattern);
|
|
9273
|
+
switch (action) {
|
|
9274
|
+
case "allow":
|
|
9275
|
+
allow.push(entry);
|
|
9276
|
+
break;
|
|
9277
|
+
case "ask":
|
|
9278
|
+
ask.push(entry);
|
|
9279
|
+
break;
|
|
9280
|
+
case "deny":
|
|
9281
|
+
deny.push(entry);
|
|
9282
|
+
break;
|
|
9283
|
+
}
|
|
9284
|
+
}
|
|
9285
|
+
}
|
|
9286
|
+
return { allow, ask, deny };
|
|
9287
|
+
}
|
|
9288
|
+
function convertClaudeToRulesyncPermissions(params) {
|
|
9289
|
+
const permission = {};
|
|
9290
|
+
const processEntries = (entries, action) => {
|
|
9291
|
+
for (const entry of entries) {
|
|
9292
|
+
const { toolName, pattern } = parseClaudePermissionEntry(entry);
|
|
9293
|
+
const canonical = toCanonicalToolName(toolName);
|
|
9294
|
+
if (!permission[canonical]) {
|
|
9295
|
+
permission[canonical] = {};
|
|
9296
|
+
}
|
|
9297
|
+
permission[canonical][pattern] = action;
|
|
9298
|
+
}
|
|
9299
|
+
};
|
|
9300
|
+
processEntries(params.allow, "allow");
|
|
9301
|
+
processEntries(params.ask, "ask");
|
|
9302
|
+
processEntries(params.deny, "deny");
|
|
9303
|
+
return { permission };
|
|
9304
|
+
}
|
|
9305
|
+
|
|
9306
|
+
// src/features/permissions/opencode-permissions.ts
|
|
9307
|
+
var import_node_path66 = require("path");
|
|
9308
|
+
var import_jsonc_parser5 = require("jsonc-parser");
|
|
9309
|
+
var import_mini29 = require("zod/mini");
|
|
9310
|
+
var OpencodePermissionSchema = import_mini29.z.union([
|
|
9311
|
+
import_mini29.z.enum(["allow", "ask", "deny"]),
|
|
9312
|
+
import_mini29.z.record(import_mini29.z.string(), import_mini29.z.enum(["allow", "ask", "deny"]))
|
|
9313
|
+
]);
|
|
9314
|
+
var OpencodePermissionsConfigSchema = import_mini29.z.looseObject({
|
|
9315
|
+
permission: import_mini29.z.optional(import_mini29.z.record(import_mini29.z.string(), OpencodePermissionSchema))
|
|
9316
|
+
});
|
|
9317
|
+
var OpencodePermissions = class _OpencodePermissions extends ToolPermissions {
|
|
9318
|
+
json;
|
|
9319
|
+
constructor(params) {
|
|
9320
|
+
super(params);
|
|
9321
|
+
this.json = OpencodePermissionsConfigSchema.parse((0, import_jsonc_parser5.parse)(this.fileContent || "{}"));
|
|
9322
|
+
}
|
|
9323
|
+
getJson() {
|
|
9324
|
+
return this.json;
|
|
9325
|
+
}
|
|
9326
|
+
isDeletable() {
|
|
9327
|
+
return false;
|
|
9328
|
+
}
|
|
9329
|
+
static getSettablePaths({
|
|
9330
|
+
global = false
|
|
9331
|
+
} = {}) {
|
|
9332
|
+
return global ? { relativeDirPath: (0, import_node_path66.join)(".config", "opencode"), relativeFilePath: "opencode.json" } : { relativeDirPath: ".", relativeFilePath: "opencode.json" };
|
|
9333
|
+
}
|
|
9334
|
+
static async fromFile({
|
|
9335
|
+
baseDir = process.cwd(),
|
|
9336
|
+
validate = true,
|
|
9337
|
+
global = false
|
|
9338
|
+
}) {
|
|
9339
|
+
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
9340
|
+
const jsonDir = (0, import_node_path66.join)(baseDir, basePaths.relativeDirPath);
|
|
9341
|
+
const jsoncPath = (0, import_node_path66.join)(jsonDir, "opencode.jsonc");
|
|
9342
|
+
const jsonPath = (0, import_node_path66.join)(jsonDir, "opencode.json");
|
|
9343
|
+
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
9344
|
+
let relativeFilePath = "opencode.jsonc";
|
|
9345
|
+
if (!fileContent) {
|
|
9346
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
9347
|
+
if (fileContent) {
|
|
9348
|
+
relativeFilePath = "opencode.json";
|
|
9349
|
+
}
|
|
9350
|
+
}
|
|
9351
|
+
const parsed = (0, import_jsonc_parser5.parse)(fileContent ?? "{}");
|
|
9352
|
+
const nextJson = { ...parsed, permission: parsed.permission ?? {} };
|
|
9353
|
+
return new _OpencodePermissions({
|
|
9354
|
+
baseDir,
|
|
9355
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
9356
|
+
relativeFilePath,
|
|
9357
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
9358
|
+
validate
|
|
9359
|
+
});
|
|
9360
|
+
}
|
|
9361
|
+
static async fromRulesyncPermissions({
|
|
9362
|
+
baseDir = process.cwd(),
|
|
9363
|
+
rulesyncPermissions,
|
|
9364
|
+
global = false
|
|
9365
|
+
}) {
|
|
9366
|
+
const basePaths = _OpencodePermissions.getSettablePaths({ global });
|
|
9367
|
+
const jsonDir = (0, import_node_path66.join)(baseDir, basePaths.relativeDirPath);
|
|
9368
|
+
const jsoncPath = (0, import_node_path66.join)(jsonDir, "opencode.jsonc");
|
|
9369
|
+
const jsonPath = (0, import_node_path66.join)(jsonDir, "opencode.json");
|
|
9370
|
+
let fileContent = await readFileContentOrNull(jsoncPath);
|
|
9371
|
+
let relativeFilePath = "opencode.jsonc";
|
|
9372
|
+
if (!fileContent) {
|
|
9373
|
+
fileContent = await readFileContentOrNull(jsonPath);
|
|
9374
|
+
if (fileContent) {
|
|
9375
|
+
relativeFilePath = "opencode.json";
|
|
9376
|
+
}
|
|
9377
|
+
}
|
|
9378
|
+
const parsed = (0, import_jsonc_parser5.parse)(fileContent ?? "{}");
|
|
9379
|
+
const nextJson = {
|
|
9380
|
+
...parsed,
|
|
9381
|
+
permission: rulesyncPermissions.getJson().permission
|
|
9382
|
+
};
|
|
9383
|
+
return new _OpencodePermissions({
|
|
9384
|
+
baseDir,
|
|
9385
|
+
relativeDirPath: basePaths.relativeDirPath,
|
|
9386
|
+
relativeFilePath,
|
|
9387
|
+
fileContent: JSON.stringify(nextJson, null, 2),
|
|
9388
|
+
validate: true
|
|
9389
|
+
});
|
|
9390
|
+
}
|
|
9391
|
+
toRulesyncPermissions() {
|
|
9392
|
+
const permission = this.normalizePermission(this.json.permission);
|
|
9393
|
+
return this.toRulesyncPermissionsDefault({
|
|
9394
|
+
fileContent: JSON.stringify({ permission }, null, 2)
|
|
9395
|
+
});
|
|
9396
|
+
}
|
|
9397
|
+
validate() {
|
|
9398
|
+
try {
|
|
9399
|
+
const json = JSON.parse(this.fileContent || "{}");
|
|
9400
|
+
const result = OpencodePermissionsConfigSchema.safeParse(json);
|
|
9401
|
+
if (!result.success) {
|
|
9402
|
+
return { success: false, error: result.error };
|
|
9403
|
+
}
|
|
9404
|
+
return { success: true, error: null };
|
|
9405
|
+
} catch (error) {
|
|
9406
|
+
return {
|
|
9407
|
+
success: false,
|
|
9408
|
+
error: new Error(`Failed to parse OpenCode permissions JSON: ${formatError(error)}`)
|
|
9409
|
+
};
|
|
9410
|
+
}
|
|
9411
|
+
}
|
|
9412
|
+
static forDeletion({
|
|
9413
|
+
baseDir = process.cwd(),
|
|
9414
|
+
relativeDirPath,
|
|
9415
|
+
relativeFilePath
|
|
9416
|
+
}) {
|
|
9417
|
+
return new _OpencodePermissions({
|
|
9418
|
+
baseDir,
|
|
9419
|
+
relativeDirPath,
|
|
9420
|
+
relativeFilePath,
|
|
9421
|
+
fileContent: JSON.stringify({ permission: {} }, null, 2),
|
|
9422
|
+
validate: false
|
|
9423
|
+
});
|
|
9424
|
+
}
|
|
9425
|
+
normalizePermission(permission) {
|
|
9426
|
+
if (!permission) {
|
|
9427
|
+
return {};
|
|
9428
|
+
}
|
|
9429
|
+
return Object.fromEntries(
|
|
9430
|
+
Object.entries(permission).map(([tool, value]) => [
|
|
9431
|
+
tool,
|
|
9432
|
+
typeof value === "string" ? { "*": value } : value
|
|
9433
|
+
])
|
|
9434
|
+
);
|
|
9435
|
+
}
|
|
9436
|
+
};
|
|
9437
|
+
|
|
9438
|
+
// src/features/permissions/permissions-processor.ts
|
|
9439
|
+
var permissionsProcessorToolTargetTuple = ["claudecode", "opencode"];
|
|
9440
|
+
var PermissionsProcessorToolTargetSchema = import_mini30.z.enum(permissionsProcessorToolTargetTuple);
|
|
9441
|
+
var toolPermissionsFactories = /* @__PURE__ */ new Map([
|
|
9442
|
+
[
|
|
9443
|
+
"claudecode",
|
|
9444
|
+
{
|
|
9445
|
+
class: ClaudecodePermissions,
|
|
9446
|
+
meta: {
|
|
9447
|
+
supportsProject: true,
|
|
9448
|
+
supportsGlobal: false,
|
|
9449
|
+
supportsImport: true
|
|
9450
|
+
}
|
|
9451
|
+
}
|
|
9452
|
+
],
|
|
9453
|
+
[
|
|
9454
|
+
"opencode",
|
|
9455
|
+
{
|
|
9456
|
+
class: OpencodePermissions,
|
|
9457
|
+
meta: {
|
|
9458
|
+
supportsProject: true,
|
|
9459
|
+
supportsGlobal: true,
|
|
9460
|
+
supportsImport: true
|
|
9461
|
+
}
|
|
9462
|
+
}
|
|
9463
|
+
]
|
|
9464
|
+
]);
|
|
9465
|
+
var PermissionsProcessor = class extends FeatureProcessor {
|
|
9466
|
+
toolTarget;
|
|
9467
|
+
global;
|
|
9468
|
+
constructor({
|
|
9469
|
+
baseDir = process.cwd(),
|
|
9470
|
+
toolTarget,
|
|
9471
|
+
global = false,
|
|
9472
|
+
dryRun = false,
|
|
9473
|
+
logger
|
|
9474
|
+
}) {
|
|
9475
|
+
super({ baseDir, dryRun, logger });
|
|
9476
|
+
const result = PermissionsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
9477
|
+
if (!result.success) {
|
|
9478
|
+
throw new Error(
|
|
9479
|
+
`Invalid tool target for PermissionsProcessor: ${toolTarget}. ${formatError(result.error)}`
|
|
9480
|
+
);
|
|
9481
|
+
}
|
|
9482
|
+
this.toolTarget = result.data;
|
|
9483
|
+
this.global = global;
|
|
9484
|
+
}
|
|
9485
|
+
async loadRulesyncFiles() {
|
|
9486
|
+
try {
|
|
9487
|
+
return [
|
|
9488
|
+
await RulesyncPermissions.fromFile({
|
|
9489
|
+
baseDir: process.cwd(),
|
|
9490
|
+
validate: true
|
|
9491
|
+
})
|
|
9492
|
+
];
|
|
9493
|
+
} catch (error) {
|
|
9494
|
+
this.logger.error(
|
|
9495
|
+
`Failed to load Rulesync permissions file (${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH}): ${formatError(error)}`
|
|
9496
|
+
);
|
|
9497
|
+
return [];
|
|
9498
|
+
}
|
|
9499
|
+
}
|
|
9500
|
+
async loadToolFiles({
|
|
9501
|
+
forDeletion = false
|
|
9502
|
+
} = {}) {
|
|
9503
|
+
try {
|
|
9504
|
+
const factory = toolPermissionsFactories.get(this.toolTarget);
|
|
9505
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
9506
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
9507
|
+
if (forDeletion) {
|
|
9508
|
+
const toolPermissions2 = factory.class.forDeletion({
|
|
9509
|
+
baseDir: this.baseDir,
|
|
9510
|
+
relativeDirPath: paths.relativeDirPath,
|
|
9511
|
+
relativeFilePath: paths.relativeFilePath,
|
|
9512
|
+
global: this.global
|
|
9513
|
+
});
|
|
9514
|
+
const list = toolPermissions2.isDeletable?.() !== false ? [toolPermissions2] : [];
|
|
9515
|
+
return list;
|
|
9516
|
+
}
|
|
9517
|
+
const toolPermissions = await factory.class.fromFile({
|
|
9518
|
+
baseDir: this.baseDir,
|
|
9519
|
+
validate: true,
|
|
9520
|
+
global: this.global
|
|
9521
|
+
});
|
|
9522
|
+
return [toolPermissions];
|
|
9523
|
+
} catch (error) {
|
|
9524
|
+
const msg = `Failed to load permissions files for tool target: ${this.toolTarget}: ${formatError(error)}`;
|
|
9525
|
+
if (error instanceof Error && error.message.includes("no such file or directory")) {
|
|
9526
|
+
this.logger.debug(msg);
|
|
9527
|
+
} else {
|
|
9528
|
+
this.logger.error(msg);
|
|
9529
|
+
}
|
|
9530
|
+
return [];
|
|
9531
|
+
}
|
|
9532
|
+
}
|
|
9533
|
+
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
9534
|
+
const rulesyncPermissions = rulesyncFiles.find(
|
|
9535
|
+
(f) => f instanceof RulesyncPermissions
|
|
9536
|
+
);
|
|
9537
|
+
if (!rulesyncPermissions) {
|
|
9538
|
+
throw new Error(`No ${RULESYNC_PERMISSIONS_RELATIVE_FILE_PATH} found.`);
|
|
9539
|
+
}
|
|
9540
|
+
const factory = toolPermissionsFactories.get(this.toolTarget);
|
|
9541
|
+
if (!factory) throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
9542
|
+
const toolPermissions = await factory.class.fromRulesyncPermissions({
|
|
9543
|
+
baseDir: this.baseDir,
|
|
9544
|
+
rulesyncPermissions,
|
|
9545
|
+
logger: this.logger,
|
|
9546
|
+
global: this.global
|
|
9547
|
+
});
|
|
9548
|
+
return [toolPermissions];
|
|
9549
|
+
}
|
|
9550
|
+
async convertToolFilesToRulesyncFiles(toolFiles) {
|
|
9551
|
+
const permissions = toolFiles.filter((f) => f instanceof ToolPermissions);
|
|
9552
|
+
return permissions.map((p) => p.toRulesyncPermissions());
|
|
9553
|
+
}
|
|
9554
|
+
static getToolTargets({
|
|
9555
|
+
global = false,
|
|
9556
|
+
importOnly = false
|
|
9557
|
+
} = {}) {
|
|
9558
|
+
return [...toolPermissionsFactories.entries()].filter(([, f]) => global ? f.meta.supportsGlobal : f.meta.supportsProject).filter(([, f]) => importOnly ? f.meta.supportsImport : true).map(([target]) => target);
|
|
9559
|
+
}
|
|
9560
|
+
};
|
|
9561
|
+
|
|
9562
|
+
// src/features/rules/rules-processor.ts
|
|
9563
|
+
var import_node_path136 = require("path");
|
|
9564
|
+
var import_toon = require("@toon-format/toon");
|
|
9565
|
+
var import_mini69 = require("zod/mini");
|
|
9566
|
+
|
|
9567
|
+
// src/constants/general.ts
|
|
9568
|
+
var SKILL_FILE_NAME = "SKILL.md";
|
|
9569
|
+
|
|
9570
|
+
// src/features/skills/agentsmd-skill.ts
|
|
9571
|
+
var import_node_path70 = require("path");
|
|
9572
|
+
|
|
9573
|
+
// src/features/skills/simulated-skill.ts
|
|
9574
|
+
var import_node_path69 = require("path");
|
|
9575
|
+
var import_mini31 = require("zod/mini");
|
|
9576
|
+
|
|
9577
|
+
// src/features/skills/tool-skill.ts
|
|
9578
|
+
var import_node_path68 = require("path");
|
|
9579
|
+
|
|
9580
|
+
// src/types/ai-dir.ts
|
|
9581
|
+
var import_node_path67 = __toESM(require("path"), 1);
|
|
9582
|
+
var AiDir = class {
|
|
9583
|
+
/**
|
|
9584
|
+
* @example "."
|
|
9585
|
+
*/
|
|
9586
|
+
baseDir;
|
|
9587
|
+
/**
|
|
9588
|
+
* @example ".rulesync/skills"
|
|
9589
|
+
*/
|
|
9590
|
+
relativeDirPath;
|
|
9591
|
+
/**
|
|
9592
|
+
* @example "my-skill"
|
|
9593
|
+
*/
|
|
9594
|
+
dirName;
|
|
9595
|
+
/**
|
|
9596
|
+
* Optional main file with frontmatter support
|
|
9597
|
+
*/
|
|
9598
|
+
mainFile;
|
|
9599
|
+
/**
|
|
9600
|
+
* Additional files in the directory
|
|
9601
|
+
*/
|
|
9602
|
+
otherFiles;
|
|
9603
|
+
/**
|
|
9604
|
+
* @example false
|
|
9605
|
+
*/
|
|
9606
|
+
global;
|
|
9607
|
+
constructor({
|
|
9608
|
+
baseDir = process.cwd(),
|
|
9609
|
+
relativeDirPath,
|
|
9610
|
+
dirName,
|
|
9611
|
+
mainFile,
|
|
9612
|
+
otherFiles = [],
|
|
9613
|
+
global = false
|
|
9614
|
+
}) {
|
|
9615
|
+
if (dirName.includes(import_node_path67.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
9616
|
+
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
9617
|
+
}
|
|
9618
|
+
this.baseDir = baseDir;
|
|
9619
|
+
this.relativeDirPath = relativeDirPath;
|
|
9620
|
+
this.dirName = dirName;
|
|
9621
|
+
this.mainFile = mainFile;
|
|
9622
|
+
this.otherFiles = otherFiles;
|
|
9623
|
+
this.global = global;
|
|
9624
|
+
}
|
|
9625
|
+
static async fromDir(_params) {
|
|
9626
|
+
throw new Error("Please implement this method in the subclass.");
|
|
9627
|
+
}
|
|
9628
|
+
getBaseDir() {
|
|
9629
|
+
return this.baseDir;
|
|
9630
|
+
}
|
|
9631
|
+
getRelativeDirPath() {
|
|
9632
|
+
return this.relativeDirPath;
|
|
9633
|
+
}
|
|
9634
|
+
getDirName() {
|
|
9635
|
+
return this.dirName;
|
|
9636
|
+
}
|
|
9637
|
+
getDirPath() {
|
|
9638
|
+
const fullPath = import_node_path67.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
9639
|
+
const resolvedFull = (0, import_node_path67.resolve)(fullPath);
|
|
9640
|
+
const resolvedBase = (0, import_node_path67.resolve)(this.baseDir);
|
|
9641
|
+
const rel = (0, import_node_path67.relative)(resolvedBase, resolvedFull);
|
|
9642
|
+
if (rel.startsWith("..") || import_node_path67.default.isAbsolute(rel)) {
|
|
9643
|
+
throw new Error(
|
|
9644
|
+
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
9645
|
+
);
|
|
9646
|
+
}
|
|
9647
|
+
return fullPath;
|
|
9648
|
+
}
|
|
9649
|
+
getMainFile() {
|
|
9650
|
+
return this.mainFile;
|
|
9651
|
+
}
|
|
9652
|
+
getOtherFiles() {
|
|
9653
|
+
return this.otherFiles;
|
|
9654
|
+
}
|
|
9655
|
+
/**
|
|
9656
|
+
* Returns the relative path from CWD with POSIX separators for consistent cross-platform output.
|
|
9657
|
+
*/
|
|
9658
|
+
getRelativePathFromCwd() {
|
|
9659
|
+
return toPosixPath(import_node_path67.default.join(this.relativeDirPath, this.dirName));
|
|
9660
|
+
}
|
|
9661
|
+
getGlobal() {
|
|
9662
|
+
return this.global;
|
|
9663
|
+
}
|
|
9664
|
+
setMainFile(name, body, frontmatter) {
|
|
9665
|
+
this.mainFile = { name, body, frontmatter };
|
|
9666
|
+
}
|
|
9667
|
+
/**
|
|
9668
|
+
* Recursively collects all files from a directory, excluding the specified main file.
|
|
9669
|
+
* This is a common utility for loading additional files alongside the main file.
|
|
9670
|
+
*
|
|
9671
|
+
* @param baseDir - The base directory path
|
|
9672
|
+
* @param relativeDirPath - The relative path to the directory containing the skill
|
|
9673
|
+
* @param dirName - The name of the directory
|
|
9674
|
+
* @param excludeFileName - The name of the file to exclude (typically the main file)
|
|
9675
|
+
* @returns Array of files with their relative paths and buffers
|
|
9676
|
+
*/
|
|
9677
|
+
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
9678
|
+
const dirPath = (0, import_node_path67.join)(baseDir, relativeDirPath, dirName);
|
|
9679
|
+
const glob = (0, import_node_path67.join)(dirPath, "**", "*");
|
|
9680
|
+
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
9681
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path67.basename)(filePath) !== excludeFileName);
|
|
9682
|
+
const files = await Promise.all(
|
|
9021
9683
|
filteredPaths.map(async (filePath) => {
|
|
9022
9684
|
const fileBuffer = await readFileBuffer(filePath);
|
|
9023
9685
|
return {
|
|
9024
|
-
relativeFilePathToDirPath: (0,
|
|
9686
|
+
relativeFilePathToDirPath: (0, import_node_path67.relative)(dirPath, filePath),
|
|
9025
9687
|
fileBuffer
|
|
9026
9688
|
};
|
|
9027
9689
|
})
|
|
@@ -9115,8 +9777,8 @@ var ToolSkill = class extends AiDir {
|
|
|
9115
9777
|
}) {
|
|
9116
9778
|
const settablePaths = getSettablePaths({ global });
|
|
9117
9779
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
9118
|
-
const skillDirPath = (0,
|
|
9119
|
-
const skillFilePath = (0,
|
|
9780
|
+
const skillDirPath = (0, import_node_path68.join)(baseDir, actualRelativeDirPath, dirName);
|
|
9781
|
+
const skillFilePath = (0, import_node_path68.join)(skillDirPath, SKILL_FILE_NAME);
|
|
9120
9782
|
if (!await fileExists(skillFilePath)) {
|
|
9121
9783
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
9122
9784
|
}
|
|
@@ -9140,16 +9802,16 @@ var ToolSkill = class extends AiDir {
|
|
|
9140
9802
|
}
|
|
9141
9803
|
requireMainFileFrontmatter() {
|
|
9142
9804
|
if (!this.mainFile?.frontmatter) {
|
|
9143
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
9805
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path68.join)(this.relativeDirPath, this.dirName)}`);
|
|
9144
9806
|
}
|
|
9145
9807
|
return this.mainFile.frontmatter;
|
|
9146
9808
|
}
|
|
9147
9809
|
};
|
|
9148
9810
|
|
|
9149
9811
|
// src/features/skills/simulated-skill.ts
|
|
9150
|
-
var SimulatedSkillFrontmatterSchema =
|
|
9151
|
-
name:
|
|
9152
|
-
description:
|
|
9812
|
+
var SimulatedSkillFrontmatterSchema = import_mini31.z.looseObject({
|
|
9813
|
+
name: import_mini31.z.string(),
|
|
9814
|
+
description: import_mini31.z.string()
|
|
9153
9815
|
});
|
|
9154
9816
|
var SimulatedSkill = class extends ToolSkill {
|
|
9155
9817
|
frontmatter;
|
|
@@ -9180,7 +9842,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
9180
9842
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
9181
9843
|
if (!result.success) {
|
|
9182
9844
|
throw new Error(
|
|
9183
|
-
`Invalid frontmatter in ${(0,
|
|
9845
|
+
`Invalid frontmatter in ${(0, import_node_path69.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
9184
9846
|
);
|
|
9185
9847
|
}
|
|
9186
9848
|
}
|
|
@@ -9239,8 +9901,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
9239
9901
|
}) {
|
|
9240
9902
|
const settablePaths = this.getSettablePaths();
|
|
9241
9903
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
9242
|
-
const skillDirPath = (0,
|
|
9243
|
-
const skillFilePath = (0,
|
|
9904
|
+
const skillDirPath = (0, import_node_path69.join)(baseDir, actualRelativeDirPath, dirName);
|
|
9905
|
+
const skillFilePath = (0, import_node_path69.join)(skillDirPath, SKILL_FILE_NAME);
|
|
9244
9906
|
if (!await fileExists(skillFilePath)) {
|
|
9245
9907
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
9246
9908
|
}
|
|
@@ -9317,7 +9979,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
9317
9979
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
9318
9980
|
}
|
|
9319
9981
|
return {
|
|
9320
|
-
relativeDirPath: (0,
|
|
9982
|
+
relativeDirPath: (0, import_node_path70.join)(".agents", "skills")
|
|
9321
9983
|
};
|
|
9322
9984
|
}
|
|
9323
9985
|
static async fromDir(params) {
|
|
@@ -9344,11 +10006,11 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
9344
10006
|
};
|
|
9345
10007
|
|
|
9346
10008
|
// src/features/skills/factorydroid-skill.ts
|
|
9347
|
-
var
|
|
10009
|
+
var import_node_path71 = require("path");
|
|
9348
10010
|
var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
9349
10011
|
static getSettablePaths(_options) {
|
|
9350
10012
|
return {
|
|
9351
|
-
relativeDirPath: (0,
|
|
10013
|
+
relativeDirPath: (0, import_node_path71.join)(".factory", "skills")
|
|
9352
10014
|
};
|
|
9353
10015
|
}
|
|
9354
10016
|
static async fromDir(params) {
|
|
@@ -9375,50 +10037,50 @@ var FactorydroidSkill = class _FactorydroidSkill extends SimulatedSkill {
|
|
|
9375
10037
|
};
|
|
9376
10038
|
|
|
9377
10039
|
// src/features/skills/rovodev-skill.ts
|
|
9378
|
-
var
|
|
9379
|
-
var
|
|
10040
|
+
var import_node_path73 = require("path");
|
|
10041
|
+
var import_mini33 = require("zod/mini");
|
|
9380
10042
|
|
|
9381
10043
|
// src/features/skills/rulesync-skill.ts
|
|
9382
|
-
var
|
|
9383
|
-
var
|
|
9384
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
9385
|
-
name:
|
|
9386
|
-
description:
|
|
9387
|
-
targets:
|
|
9388
|
-
claudecode:
|
|
9389
|
-
|
|
9390
|
-
"allowed-tools":
|
|
9391
|
-
model:
|
|
9392
|
-
"disable-model-invocation":
|
|
10044
|
+
var import_node_path72 = require("path");
|
|
10045
|
+
var import_mini32 = require("zod/mini");
|
|
10046
|
+
var RulesyncSkillFrontmatterSchemaInternal = import_mini32.z.looseObject({
|
|
10047
|
+
name: import_mini32.z.string(),
|
|
10048
|
+
description: import_mini32.z.string(),
|
|
10049
|
+
targets: import_mini32.z._default(RulesyncTargetsSchema, ["*"]),
|
|
10050
|
+
claudecode: import_mini32.z.optional(
|
|
10051
|
+
import_mini32.z.looseObject({
|
|
10052
|
+
"allowed-tools": import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string())),
|
|
10053
|
+
model: import_mini32.z.optional(import_mini32.z.string()),
|
|
10054
|
+
"disable-model-invocation": import_mini32.z.optional(import_mini32.z.boolean())
|
|
9393
10055
|
})
|
|
9394
10056
|
),
|
|
9395
|
-
codexcli:
|
|
9396
|
-
|
|
9397
|
-
"short-description":
|
|
10057
|
+
codexcli: import_mini32.z.optional(
|
|
10058
|
+
import_mini32.z.looseObject({
|
|
10059
|
+
"short-description": import_mini32.z.optional(import_mini32.z.string())
|
|
9398
10060
|
})
|
|
9399
10061
|
),
|
|
9400
|
-
opencode:
|
|
9401
|
-
|
|
9402
|
-
"allowed-tools":
|
|
10062
|
+
opencode: import_mini32.z.optional(
|
|
10063
|
+
import_mini32.z.looseObject({
|
|
10064
|
+
"allowed-tools": import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
|
|
9403
10065
|
})
|
|
9404
10066
|
),
|
|
9405
|
-
kilo:
|
|
9406
|
-
|
|
9407
|
-
"allowed-tools":
|
|
10067
|
+
kilo: import_mini32.z.optional(
|
|
10068
|
+
import_mini32.z.looseObject({
|
|
10069
|
+
"allowed-tools": import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
|
|
9408
10070
|
})
|
|
9409
10071
|
),
|
|
9410
|
-
deepagents:
|
|
9411
|
-
|
|
9412
|
-
"allowed-tools":
|
|
10072
|
+
deepagents: import_mini32.z.optional(
|
|
10073
|
+
import_mini32.z.looseObject({
|
|
10074
|
+
"allowed-tools": import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
|
|
9413
10075
|
})
|
|
9414
10076
|
),
|
|
9415
|
-
copilot:
|
|
9416
|
-
|
|
9417
|
-
license:
|
|
10077
|
+
copilot: import_mini32.z.optional(
|
|
10078
|
+
import_mini32.z.looseObject({
|
|
10079
|
+
license: import_mini32.z.optional(import_mini32.z.string())
|
|
9418
10080
|
})
|
|
9419
10081
|
),
|
|
9420
|
-
cline:
|
|
9421
|
-
roo:
|
|
10082
|
+
cline: import_mini32.z.optional(import_mini32.z.looseObject({})),
|
|
10083
|
+
roo: import_mini32.z.optional(import_mini32.z.looseObject({}))
|
|
9422
10084
|
});
|
|
9423
10085
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
9424
10086
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -9458,7 +10120,7 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
9458
10120
|
}
|
|
9459
10121
|
getFrontmatter() {
|
|
9460
10122
|
if (!this.mainFile?.frontmatter) {
|
|
9461
|
-
throw new Error(`Frontmatter is not defined in ${(0,
|
|
10123
|
+
throw new Error(`Frontmatter is not defined in ${(0, import_node_path72.join)(this.relativeDirPath, this.dirName)}`);
|
|
9462
10124
|
}
|
|
9463
10125
|
const result = RulesyncSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
9464
10126
|
return result;
|
|
@@ -9484,8 +10146,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
9484
10146
|
dirName,
|
|
9485
10147
|
global = false
|
|
9486
10148
|
}) {
|
|
9487
|
-
const skillDirPath = (0,
|
|
9488
|
-
const skillFilePath = (0,
|
|
10149
|
+
const skillDirPath = (0, import_node_path72.join)(baseDir, relativeDirPath, dirName);
|
|
10150
|
+
const skillFilePath = (0, import_node_path72.join)(skillDirPath, SKILL_FILE_NAME);
|
|
9489
10151
|
if (!await fileExists(skillFilePath)) {
|
|
9490
10152
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
9491
10153
|
}
|
|
@@ -9515,14 +10177,14 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
9515
10177
|
};
|
|
9516
10178
|
|
|
9517
10179
|
// src/features/skills/rovodev-skill.ts
|
|
9518
|
-
var RovodevSkillFrontmatterSchema =
|
|
9519
|
-
name:
|
|
9520
|
-
description:
|
|
10180
|
+
var RovodevSkillFrontmatterSchema = import_mini33.z.looseObject({
|
|
10181
|
+
name: import_mini33.z.string(),
|
|
10182
|
+
description: import_mini33.z.string()
|
|
9521
10183
|
});
|
|
9522
10184
|
var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
9523
10185
|
constructor({
|
|
9524
10186
|
baseDir = process.cwd(),
|
|
9525
|
-
relativeDirPath = (0,
|
|
10187
|
+
relativeDirPath = (0, import_node_path73.join)(".rovodev", "skills"),
|
|
9526
10188
|
dirName,
|
|
9527
10189
|
frontmatter,
|
|
9528
10190
|
body,
|
|
@@ -9551,8 +10213,8 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
9551
10213
|
}
|
|
9552
10214
|
static getSettablePaths(_options) {
|
|
9553
10215
|
return {
|
|
9554
|
-
relativeDirPath: (0,
|
|
9555
|
-
alternativeSkillRoots: [(0,
|
|
10216
|
+
relativeDirPath: (0, import_node_path73.join)(".rovodev", "skills"),
|
|
10217
|
+
alternativeSkillRoots: [(0, import_node_path73.join)(".agents", "skills")]
|
|
9556
10218
|
};
|
|
9557
10219
|
}
|
|
9558
10220
|
getFrontmatter() {
|
|
@@ -9640,13 +10302,13 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
9640
10302
|
});
|
|
9641
10303
|
const result = RovodevSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9642
10304
|
if (!result.success) {
|
|
9643
|
-
const skillDirPath = (0,
|
|
10305
|
+
const skillDirPath = (0, import_node_path73.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9644
10306
|
throw new Error(
|
|
9645
|
-
`Invalid frontmatter in ${(0,
|
|
10307
|
+
`Invalid frontmatter in ${(0, import_node_path73.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9646
10308
|
);
|
|
9647
10309
|
}
|
|
9648
10310
|
if (result.data.name !== loaded.dirName) {
|
|
9649
|
-
const skillFilePath = (0,
|
|
10311
|
+
const skillFilePath = (0, import_node_path73.join)(
|
|
9650
10312
|
loaded.baseDir,
|
|
9651
10313
|
loaded.relativeDirPath,
|
|
9652
10314
|
loaded.dirName,
|
|
@@ -9688,11 +10350,11 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
9688
10350
|
};
|
|
9689
10351
|
|
|
9690
10352
|
// src/features/skills/skills-processor.ts
|
|
9691
|
-
var
|
|
9692
|
-
var
|
|
10353
|
+
var import_node_path91 = require("path");
|
|
10354
|
+
var import_mini49 = require("zod/mini");
|
|
9693
10355
|
|
|
9694
10356
|
// src/types/dir-feature-processor.ts
|
|
9695
|
-
var
|
|
10357
|
+
var import_node_path74 = require("path");
|
|
9696
10358
|
var DirFeatureProcessor = class {
|
|
9697
10359
|
baseDir;
|
|
9698
10360
|
dryRun;
|
|
@@ -9732,7 +10394,7 @@ var DirFeatureProcessor = class {
|
|
|
9732
10394
|
const mainFile = aiDir.getMainFile();
|
|
9733
10395
|
let mainFileContent;
|
|
9734
10396
|
if (mainFile) {
|
|
9735
|
-
const mainFilePath = (0,
|
|
10397
|
+
const mainFilePath = (0, import_node_path74.join)(dirPath, mainFile.name);
|
|
9736
10398
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter, {
|
|
9737
10399
|
avoidBlockScalars: this.avoidBlockScalars
|
|
9738
10400
|
});
|
|
@@ -9752,7 +10414,7 @@ var DirFeatureProcessor = class {
|
|
|
9752
10414
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
9753
10415
|
otherFileContents.push(contentWithNewline);
|
|
9754
10416
|
if (!dirHasChanges) {
|
|
9755
|
-
const filePath = (0,
|
|
10417
|
+
const filePath = (0, import_node_path74.join)(dirPath, file.relativeFilePathToDirPath);
|
|
9756
10418
|
const existingContent = await readFileContentOrNull(filePath);
|
|
9757
10419
|
if (!fileContentsEquivalent({
|
|
9758
10420
|
filePath,
|
|
@@ -9770,24 +10432,24 @@ var DirFeatureProcessor = class {
|
|
|
9770
10432
|
if (this.dryRun) {
|
|
9771
10433
|
this.logger.info(`[DRY RUN] Would create directory: ${dirPath}`);
|
|
9772
10434
|
if (mainFile) {
|
|
9773
|
-
this.logger.info(`[DRY RUN] Would write: ${(0,
|
|
9774
|
-
changedPaths.push((0,
|
|
10435
|
+
this.logger.info(`[DRY RUN] Would write: ${(0, import_node_path74.join)(dirPath, mainFile.name)}`);
|
|
10436
|
+
changedPaths.push((0, import_node_path74.join)(relativeDir, mainFile.name));
|
|
9775
10437
|
}
|
|
9776
10438
|
for (const file of otherFiles) {
|
|
9777
10439
|
this.logger.info(
|
|
9778
|
-
`[DRY RUN] Would write: ${(0,
|
|
10440
|
+
`[DRY RUN] Would write: ${(0, import_node_path74.join)(dirPath, file.relativeFilePathToDirPath)}`
|
|
9779
10441
|
);
|
|
9780
|
-
changedPaths.push((0,
|
|
10442
|
+
changedPaths.push((0, import_node_path74.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
9781
10443
|
}
|
|
9782
10444
|
} else {
|
|
9783
10445
|
await ensureDir(dirPath);
|
|
9784
10446
|
if (mainFile && mainFileContent) {
|
|
9785
|
-
const mainFilePath = (0,
|
|
10447
|
+
const mainFilePath = (0, import_node_path74.join)(dirPath, mainFile.name);
|
|
9786
10448
|
await writeFileContent(mainFilePath, mainFileContent);
|
|
9787
|
-
changedPaths.push((0,
|
|
10449
|
+
changedPaths.push((0, import_node_path74.join)(relativeDir, mainFile.name));
|
|
9788
10450
|
}
|
|
9789
10451
|
for (const [i, file] of otherFiles.entries()) {
|
|
9790
|
-
const filePath = (0,
|
|
10452
|
+
const filePath = (0, import_node_path74.join)(dirPath, file.relativeFilePathToDirPath);
|
|
9791
10453
|
const content = otherFileContents[i];
|
|
9792
10454
|
if (content === void 0) {
|
|
9793
10455
|
throw new Error(
|
|
@@ -9795,7 +10457,7 @@ var DirFeatureProcessor = class {
|
|
|
9795
10457
|
);
|
|
9796
10458
|
}
|
|
9797
10459
|
await writeFileContent(filePath, content);
|
|
9798
|
-
changedPaths.push((0,
|
|
10460
|
+
changedPaths.push((0, import_node_path74.join)(relativeDir, file.relativeFilePathToDirPath));
|
|
9799
10461
|
}
|
|
9800
10462
|
}
|
|
9801
10463
|
changedCount++;
|
|
@@ -9827,16 +10489,16 @@ var DirFeatureProcessor = class {
|
|
|
9827
10489
|
};
|
|
9828
10490
|
|
|
9829
10491
|
// src/features/skills/agentsskills-skill.ts
|
|
9830
|
-
var
|
|
9831
|
-
var
|
|
9832
|
-
var AgentsSkillsSkillFrontmatterSchema =
|
|
9833
|
-
name:
|
|
9834
|
-
description:
|
|
10492
|
+
var import_node_path75 = require("path");
|
|
10493
|
+
var import_mini34 = require("zod/mini");
|
|
10494
|
+
var AgentsSkillsSkillFrontmatterSchema = import_mini34.z.looseObject({
|
|
10495
|
+
name: import_mini34.z.string(),
|
|
10496
|
+
description: import_mini34.z.string()
|
|
9835
10497
|
});
|
|
9836
10498
|
var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
9837
10499
|
constructor({
|
|
9838
10500
|
baseDir = process.cwd(),
|
|
9839
|
-
relativeDirPath = (0,
|
|
10501
|
+
relativeDirPath = (0, import_node_path75.join)(".agents", "skills"),
|
|
9840
10502
|
dirName,
|
|
9841
10503
|
frontmatter,
|
|
9842
10504
|
body,
|
|
@@ -9868,7 +10530,7 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
9868
10530
|
throw new Error("AgentsSkillsSkill does not support global mode.");
|
|
9869
10531
|
}
|
|
9870
10532
|
return {
|
|
9871
|
-
relativeDirPath: (0,
|
|
10533
|
+
relativeDirPath: (0, import_node_path75.join)(".agents", "skills")
|
|
9872
10534
|
};
|
|
9873
10535
|
}
|
|
9874
10536
|
getFrontmatter() {
|
|
@@ -9948,9 +10610,9 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
9948
10610
|
});
|
|
9949
10611
|
const result = AgentsSkillsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
9950
10612
|
if (!result.success) {
|
|
9951
|
-
const skillDirPath = (0,
|
|
10613
|
+
const skillDirPath = (0, import_node_path75.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
9952
10614
|
throw new Error(
|
|
9953
|
-
`Invalid frontmatter in ${(0,
|
|
10615
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
9954
10616
|
);
|
|
9955
10617
|
}
|
|
9956
10618
|
return new _AgentsSkillsSkill({
|
|
@@ -9985,16 +10647,16 @@ var AgentsSkillsSkill = class _AgentsSkillsSkill extends ToolSkill {
|
|
|
9985
10647
|
};
|
|
9986
10648
|
|
|
9987
10649
|
// src/features/skills/antigravity-skill.ts
|
|
9988
|
-
var
|
|
9989
|
-
var
|
|
9990
|
-
var AntigravitySkillFrontmatterSchema =
|
|
9991
|
-
name:
|
|
9992
|
-
description:
|
|
10650
|
+
var import_node_path76 = require("path");
|
|
10651
|
+
var import_mini35 = require("zod/mini");
|
|
10652
|
+
var AntigravitySkillFrontmatterSchema = import_mini35.z.looseObject({
|
|
10653
|
+
name: import_mini35.z.string(),
|
|
10654
|
+
description: import_mini35.z.string()
|
|
9993
10655
|
});
|
|
9994
10656
|
var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
9995
10657
|
constructor({
|
|
9996
10658
|
baseDir = process.cwd(),
|
|
9997
|
-
relativeDirPath = (0,
|
|
10659
|
+
relativeDirPath = (0, import_node_path76.join)(".agent", "skills"),
|
|
9998
10660
|
dirName,
|
|
9999
10661
|
frontmatter,
|
|
10000
10662
|
body,
|
|
@@ -10026,11 +10688,11 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
10026
10688
|
} = {}) {
|
|
10027
10689
|
if (global) {
|
|
10028
10690
|
return {
|
|
10029
|
-
relativeDirPath: (0,
|
|
10691
|
+
relativeDirPath: (0, import_node_path76.join)(".gemini", "antigravity", "skills")
|
|
10030
10692
|
};
|
|
10031
10693
|
}
|
|
10032
10694
|
return {
|
|
10033
|
-
relativeDirPath: (0,
|
|
10695
|
+
relativeDirPath: (0, import_node_path76.join)(".agent", "skills")
|
|
10034
10696
|
};
|
|
10035
10697
|
}
|
|
10036
10698
|
getFrontmatter() {
|
|
@@ -10110,9 +10772,9 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
10110
10772
|
});
|
|
10111
10773
|
const result = AntigravitySkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10112
10774
|
if (!result.success) {
|
|
10113
|
-
const skillDirPath = (0,
|
|
10775
|
+
const skillDirPath = (0, import_node_path76.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10114
10776
|
throw new Error(
|
|
10115
|
-
`Invalid frontmatter in ${(0,
|
|
10777
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10116
10778
|
);
|
|
10117
10779
|
}
|
|
10118
10780
|
return new _AntigravitySkill({
|
|
@@ -10146,19 +10808,19 @@ var AntigravitySkill = class _AntigravitySkill extends ToolSkill {
|
|
|
10146
10808
|
};
|
|
10147
10809
|
|
|
10148
10810
|
// src/features/skills/claudecode-skill.ts
|
|
10149
|
-
var
|
|
10150
|
-
var
|
|
10151
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
10152
|
-
name:
|
|
10153
|
-
description:
|
|
10154
|
-
"allowed-tools":
|
|
10155
|
-
model:
|
|
10156
|
-
"disable-model-invocation":
|
|
10811
|
+
var import_node_path77 = require("path");
|
|
10812
|
+
var import_mini36 = require("zod/mini");
|
|
10813
|
+
var ClaudecodeSkillFrontmatterSchema = import_mini36.z.looseObject({
|
|
10814
|
+
name: import_mini36.z.string(),
|
|
10815
|
+
description: import_mini36.z.string(),
|
|
10816
|
+
"allowed-tools": import_mini36.z.optional(import_mini36.z.array(import_mini36.z.string())),
|
|
10817
|
+
model: import_mini36.z.optional(import_mini36.z.string()),
|
|
10818
|
+
"disable-model-invocation": import_mini36.z.optional(import_mini36.z.boolean())
|
|
10157
10819
|
});
|
|
10158
10820
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
10159
10821
|
constructor({
|
|
10160
10822
|
baseDir = process.cwd(),
|
|
10161
|
-
relativeDirPath = (0,
|
|
10823
|
+
relativeDirPath = (0, import_node_path77.join)(".claude", "skills"),
|
|
10162
10824
|
dirName,
|
|
10163
10825
|
frontmatter,
|
|
10164
10826
|
body,
|
|
@@ -10189,7 +10851,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
10189
10851
|
global: _global = false
|
|
10190
10852
|
} = {}) {
|
|
10191
10853
|
return {
|
|
10192
|
-
relativeDirPath: (0,
|
|
10854
|
+
relativeDirPath: (0, import_node_path77.join)(".claude", "skills")
|
|
10193
10855
|
};
|
|
10194
10856
|
}
|
|
10195
10857
|
getFrontmatter() {
|
|
@@ -10286,9 +10948,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
10286
10948
|
});
|
|
10287
10949
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10288
10950
|
if (!result.success) {
|
|
10289
|
-
const skillDirPath = (0,
|
|
10951
|
+
const skillDirPath = (0, import_node_path77.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10290
10952
|
throw new Error(
|
|
10291
|
-
`Invalid frontmatter in ${(0,
|
|
10953
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10292
10954
|
);
|
|
10293
10955
|
}
|
|
10294
10956
|
return new _ClaudecodeSkill({
|
|
@@ -10322,16 +10984,16 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
10322
10984
|
};
|
|
10323
10985
|
|
|
10324
10986
|
// src/features/skills/cline-skill.ts
|
|
10325
|
-
var
|
|
10326
|
-
var
|
|
10327
|
-
var ClineSkillFrontmatterSchema =
|
|
10328
|
-
name:
|
|
10329
|
-
description:
|
|
10987
|
+
var import_node_path78 = require("path");
|
|
10988
|
+
var import_mini37 = require("zod/mini");
|
|
10989
|
+
var ClineSkillFrontmatterSchema = import_mini37.z.looseObject({
|
|
10990
|
+
name: import_mini37.z.string(),
|
|
10991
|
+
description: import_mini37.z.string()
|
|
10330
10992
|
});
|
|
10331
10993
|
var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
10332
10994
|
constructor({
|
|
10333
10995
|
baseDir = process.cwd(),
|
|
10334
|
-
relativeDirPath = (0,
|
|
10996
|
+
relativeDirPath = (0, import_node_path78.join)(".cline", "skills"),
|
|
10335
10997
|
dirName,
|
|
10336
10998
|
frontmatter,
|
|
10337
10999
|
body,
|
|
@@ -10360,7 +11022,7 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
10360
11022
|
}
|
|
10361
11023
|
static getSettablePaths(_options = {}) {
|
|
10362
11024
|
return {
|
|
10363
|
-
relativeDirPath: (0,
|
|
11025
|
+
relativeDirPath: (0, import_node_path78.join)(".cline", "skills")
|
|
10364
11026
|
};
|
|
10365
11027
|
}
|
|
10366
11028
|
getFrontmatter() {
|
|
@@ -10448,13 +11110,13 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
10448
11110
|
});
|
|
10449
11111
|
const result = ClineSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10450
11112
|
if (!result.success) {
|
|
10451
|
-
const skillDirPath = (0,
|
|
11113
|
+
const skillDirPath = (0, import_node_path78.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10452
11114
|
throw new Error(
|
|
10453
|
-
`Invalid frontmatter in ${(0,
|
|
11115
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10454
11116
|
);
|
|
10455
11117
|
}
|
|
10456
11118
|
if (result.data.name !== loaded.dirName) {
|
|
10457
|
-
const skillFilePath = (0,
|
|
11119
|
+
const skillFilePath = (0, import_node_path78.join)(
|
|
10458
11120
|
loaded.baseDir,
|
|
10459
11121
|
loaded.relativeDirPath,
|
|
10460
11122
|
loaded.dirName,
|
|
@@ -10495,21 +11157,21 @@ var ClineSkill = class _ClineSkill extends ToolSkill {
|
|
|
10495
11157
|
};
|
|
10496
11158
|
|
|
10497
11159
|
// src/features/skills/codexcli-skill.ts
|
|
10498
|
-
var
|
|
10499
|
-
var
|
|
10500
|
-
var CodexCliSkillFrontmatterSchema =
|
|
10501
|
-
name:
|
|
10502
|
-
description:
|
|
10503
|
-
metadata:
|
|
10504
|
-
|
|
10505
|
-
"short-description":
|
|
11160
|
+
var import_node_path79 = require("path");
|
|
11161
|
+
var import_mini38 = require("zod/mini");
|
|
11162
|
+
var CodexCliSkillFrontmatterSchema = import_mini38.z.looseObject({
|
|
11163
|
+
name: import_mini38.z.string(),
|
|
11164
|
+
description: import_mini38.z.string(),
|
|
11165
|
+
metadata: import_mini38.z.optional(
|
|
11166
|
+
import_mini38.z.looseObject({
|
|
11167
|
+
"short-description": import_mini38.z.optional(import_mini38.z.string())
|
|
10506
11168
|
})
|
|
10507
11169
|
)
|
|
10508
11170
|
});
|
|
10509
11171
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
10510
11172
|
constructor({
|
|
10511
11173
|
baseDir = process.cwd(),
|
|
10512
|
-
relativeDirPath = (0,
|
|
11174
|
+
relativeDirPath = (0, import_node_path79.join)(".codex", "skills"),
|
|
10513
11175
|
dirName,
|
|
10514
11176
|
frontmatter,
|
|
10515
11177
|
body,
|
|
@@ -10540,7 +11202,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
10540
11202
|
global: _global = false
|
|
10541
11203
|
} = {}) {
|
|
10542
11204
|
return {
|
|
10543
|
-
relativeDirPath: (0,
|
|
11205
|
+
relativeDirPath: (0, import_node_path79.join)(".codex", "skills")
|
|
10544
11206
|
};
|
|
10545
11207
|
}
|
|
10546
11208
|
getFrontmatter() {
|
|
@@ -10630,9 +11292,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
10630
11292
|
});
|
|
10631
11293
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10632
11294
|
if (!result.success) {
|
|
10633
|
-
const skillDirPath = (0,
|
|
11295
|
+
const skillDirPath = (0, import_node_path79.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10634
11296
|
throw new Error(
|
|
10635
|
-
`Invalid frontmatter in ${(0,
|
|
11297
|
+
`Invalid frontmatter in ${(0, import_node_path79.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10636
11298
|
);
|
|
10637
11299
|
}
|
|
10638
11300
|
return new _CodexCliSkill({
|
|
@@ -10666,17 +11328,17 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
10666
11328
|
};
|
|
10667
11329
|
|
|
10668
11330
|
// src/features/skills/copilot-skill.ts
|
|
10669
|
-
var
|
|
10670
|
-
var
|
|
10671
|
-
var CopilotSkillFrontmatterSchema =
|
|
10672
|
-
name:
|
|
10673
|
-
description:
|
|
10674
|
-
license:
|
|
11331
|
+
var import_node_path80 = require("path");
|
|
11332
|
+
var import_mini39 = require("zod/mini");
|
|
11333
|
+
var CopilotSkillFrontmatterSchema = import_mini39.z.looseObject({
|
|
11334
|
+
name: import_mini39.z.string(),
|
|
11335
|
+
description: import_mini39.z.string(),
|
|
11336
|
+
license: import_mini39.z.optional(import_mini39.z.string())
|
|
10675
11337
|
});
|
|
10676
11338
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
10677
11339
|
constructor({
|
|
10678
11340
|
baseDir = process.cwd(),
|
|
10679
|
-
relativeDirPath = (0,
|
|
11341
|
+
relativeDirPath = (0, import_node_path80.join)(".github", "skills"),
|
|
10680
11342
|
dirName,
|
|
10681
11343
|
frontmatter,
|
|
10682
11344
|
body,
|
|
@@ -10708,7 +11370,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
10708
11370
|
throw new Error("CopilotSkill does not support global mode.");
|
|
10709
11371
|
}
|
|
10710
11372
|
return {
|
|
10711
|
-
relativeDirPath: (0,
|
|
11373
|
+
relativeDirPath: (0, import_node_path80.join)(".github", "skills")
|
|
10712
11374
|
};
|
|
10713
11375
|
}
|
|
10714
11376
|
getFrontmatter() {
|
|
@@ -10794,9 +11456,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
10794
11456
|
});
|
|
10795
11457
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10796
11458
|
if (!result.success) {
|
|
10797
|
-
const skillDirPath = (0,
|
|
11459
|
+
const skillDirPath = (0, import_node_path80.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10798
11460
|
throw new Error(
|
|
10799
|
-
`Invalid frontmatter in ${(0,
|
|
11461
|
+
`Invalid frontmatter in ${(0, import_node_path80.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10800
11462
|
);
|
|
10801
11463
|
}
|
|
10802
11464
|
return new _CopilotSkill({
|
|
@@ -10831,16 +11493,16 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
10831
11493
|
};
|
|
10832
11494
|
|
|
10833
11495
|
// src/features/skills/cursor-skill.ts
|
|
10834
|
-
var
|
|
10835
|
-
var
|
|
10836
|
-
var CursorSkillFrontmatterSchema =
|
|
10837
|
-
name:
|
|
10838
|
-
description:
|
|
11496
|
+
var import_node_path81 = require("path");
|
|
11497
|
+
var import_mini40 = require("zod/mini");
|
|
11498
|
+
var CursorSkillFrontmatterSchema = import_mini40.z.looseObject({
|
|
11499
|
+
name: import_mini40.z.string(),
|
|
11500
|
+
description: import_mini40.z.string()
|
|
10839
11501
|
});
|
|
10840
11502
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
10841
11503
|
constructor({
|
|
10842
11504
|
baseDir = process.cwd(),
|
|
10843
|
-
relativeDirPath = (0,
|
|
11505
|
+
relativeDirPath = (0, import_node_path81.join)(".cursor", "skills"),
|
|
10844
11506
|
dirName,
|
|
10845
11507
|
frontmatter,
|
|
10846
11508
|
body,
|
|
@@ -10869,7 +11531,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
10869
11531
|
}
|
|
10870
11532
|
static getSettablePaths(_options) {
|
|
10871
11533
|
return {
|
|
10872
|
-
relativeDirPath: (0,
|
|
11534
|
+
relativeDirPath: (0, import_node_path81.join)(".cursor", "skills")
|
|
10873
11535
|
};
|
|
10874
11536
|
}
|
|
10875
11537
|
getFrontmatter() {
|
|
@@ -10949,9 +11611,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
10949
11611
|
});
|
|
10950
11612
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
10951
11613
|
if (!result.success) {
|
|
10952
|
-
const skillDirPath = (0,
|
|
11614
|
+
const skillDirPath = (0, import_node_path81.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
10953
11615
|
throw new Error(
|
|
10954
|
-
`Invalid frontmatter in ${(0,
|
|
11616
|
+
`Invalid frontmatter in ${(0, import_node_path81.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
10955
11617
|
);
|
|
10956
11618
|
}
|
|
10957
11619
|
return new _CursorSkill({
|
|
@@ -10986,17 +11648,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
10986
11648
|
};
|
|
10987
11649
|
|
|
10988
11650
|
// src/features/skills/deepagents-skill.ts
|
|
10989
|
-
var
|
|
10990
|
-
var
|
|
10991
|
-
var DeepagentsSkillFrontmatterSchema =
|
|
10992
|
-
name:
|
|
10993
|
-
description:
|
|
10994
|
-
"allowed-tools":
|
|
11651
|
+
var import_node_path82 = require("path");
|
|
11652
|
+
var import_mini41 = require("zod/mini");
|
|
11653
|
+
var DeepagentsSkillFrontmatterSchema = import_mini41.z.looseObject({
|
|
11654
|
+
name: import_mini41.z.string(),
|
|
11655
|
+
description: import_mini41.z.string(),
|
|
11656
|
+
"allowed-tools": import_mini41.z.optional(import_mini41.z.array(import_mini41.z.string()))
|
|
10995
11657
|
});
|
|
10996
11658
|
var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
10997
11659
|
constructor({
|
|
10998
11660
|
baseDir = process.cwd(),
|
|
10999
|
-
relativeDirPath = (0,
|
|
11661
|
+
relativeDirPath = (0, import_node_path82.join)(".deepagents", "skills"),
|
|
11000
11662
|
dirName,
|
|
11001
11663
|
frontmatter,
|
|
11002
11664
|
body,
|
|
@@ -11025,7 +11687,7 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
11025
11687
|
}
|
|
11026
11688
|
static getSettablePaths(_options) {
|
|
11027
11689
|
return {
|
|
11028
|
-
relativeDirPath: (0,
|
|
11690
|
+
relativeDirPath: (0, import_node_path82.join)(".deepagents", "skills")
|
|
11029
11691
|
};
|
|
11030
11692
|
}
|
|
11031
11693
|
getFrontmatter() {
|
|
@@ -11111,9 +11773,9 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
11111
11773
|
});
|
|
11112
11774
|
const result = DeepagentsSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11113
11775
|
if (!result.success) {
|
|
11114
|
-
const skillDirPath = (0,
|
|
11776
|
+
const skillDirPath = (0, import_node_path82.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11115
11777
|
throw new Error(
|
|
11116
|
-
`Invalid frontmatter in ${(0,
|
|
11778
|
+
`Invalid frontmatter in ${(0, import_node_path82.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11117
11779
|
);
|
|
11118
11780
|
}
|
|
11119
11781
|
return new _DeepagentsSkill({
|
|
@@ -11148,11 +11810,11 @@ var DeepagentsSkill = class _DeepagentsSkill extends ToolSkill {
|
|
|
11148
11810
|
};
|
|
11149
11811
|
|
|
11150
11812
|
// src/features/skills/geminicli-skill.ts
|
|
11151
|
-
var
|
|
11152
|
-
var
|
|
11153
|
-
var GeminiCliSkillFrontmatterSchema =
|
|
11154
|
-
name:
|
|
11155
|
-
description:
|
|
11813
|
+
var import_node_path83 = require("path");
|
|
11814
|
+
var import_mini42 = require("zod/mini");
|
|
11815
|
+
var GeminiCliSkillFrontmatterSchema = import_mini42.z.looseObject({
|
|
11816
|
+
name: import_mini42.z.string(),
|
|
11817
|
+
description: import_mini42.z.string()
|
|
11156
11818
|
});
|
|
11157
11819
|
var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
11158
11820
|
constructor({
|
|
@@ -11188,7 +11850,7 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
11188
11850
|
global: _global = false
|
|
11189
11851
|
} = {}) {
|
|
11190
11852
|
return {
|
|
11191
|
-
relativeDirPath: (0,
|
|
11853
|
+
relativeDirPath: (0, import_node_path83.join)(".gemini", "skills")
|
|
11192
11854
|
};
|
|
11193
11855
|
}
|
|
11194
11856
|
getFrontmatter() {
|
|
@@ -11268,9 +11930,9 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
11268
11930
|
});
|
|
11269
11931
|
const result = GeminiCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11270
11932
|
if (!result.success) {
|
|
11271
|
-
const skillDirPath = (0,
|
|
11933
|
+
const skillDirPath = (0, import_node_path83.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11272
11934
|
throw new Error(
|
|
11273
|
-
`Invalid frontmatter in ${(0,
|
|
11935
|
+
`Invalid frontmatter in ${(0, import_node_path83.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11274
11936
|
);
|
|
11275
11937
|
}
|
|
11276
11938
|
return new _GeminiCliSkill({
|
|
@@ -11305,16 +11967,16 @@ var GeminiCliSkill = class _GeminiCliSkill extends ToolSkill {
|
|
|
11305
11967
|
};
|
|
11306
11968
|
|
|
11307
11969
|
// src/features/skills/junie-skill.ts
|
|
11308
|
-
var
|
|
11309
|
-
var
|
|
11310
|
-
var JunieSkillFrontmatterSchema =
|
|
11311
|
-
name:
|
|
11312
|
-
description:
|
|
11970
|
+
var import_node_path84 = require("path");
|
|
11971
|
+
var import_mini43 = require("zod/mini");
|
|
11972
|
+
var JunieSkillFrontmatterSchema = import_mini43.z.looseObject({
|
|
11973
|
+
name: import_mini43.z.string(),
|
|
11974
|
+
description: import_mini43.z.string()
|
|
11313
11975
|
});
|
|
11314
11976
|
var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
11315
11977
|
constructor({
|
|
11316
11978
|
baseDir = process.cwd(),
|
|
11317
|
-
relativeDirPath = (0,
|
|
11979
|
+
relativeDirPath = (0, import_node_path84.join)(".junie", "skills"),
|
|
11318
11980
|
dirName,
|
|
11319
11981
|
frontmatter,
|
|
11320
11982
|
body,
|
|
@@ -11346,7 +12008,7 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
11346
12008
|
throw new Error("JunieSkill does not support global mode.");
|
|
11347
12009
|
}
|
|
11348
12010
|
return {
|
|
11349
|
-
relativeDirPath: (0,
|
|
12011
|
+
relativeDirPath: (0, import_node_path84.join)(".junie", "skills")
|
|
11350
12012
|
};
|
|
11351
12013
|
}
|
|
11352
12014
|
getFrontmatter() {
|
|
@@ -11433,13 +12095,13 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
11433
12095
|
});
|
|
11434
12096
|
const result = JunieSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11435
12097
|
if (!result.success) {
|
|
11436
|
-
const skillDirPath = (0,
|
|
12098
|
+
const skillDirPath = (0, import_node_path84.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11437
12099
|
throw new Error(
|
|
11438
|
-
`Invalid frontmatter in ${(0,
|
|
12100
|
+
`Invalid frontmatter in ${(0, import_node_path84.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11439
12101
|
);
|
|
11440
12102
|
}
|
|
11441
12103
|
if (result.data.name !== loaded.dirName) {
|
|
11442
|
-
const skillFilePath = (0,
|
|
12104
|
+
const skillFilePath = (0, import_node_path84.join)(
|
|
11443
12105
|
loaded.baseDir,
|
|
11444
12106
|
loaded.relativeDirPath,
|
|
11445
12107
|
loaded.dirName,
|
|
@@ -11481,17 +12143,17 @@ var JunieSkill = class _JunieSkill extends ToolSkill {
|
|
|
11481
12143
|
};
|
|
11482
12144
|
|
|
11483
12145
|
// src/features/skills/kilo-skill.ts
|
|
11484
|
-
var
|
|
11485
|
-
var
|
|
11486
|
-
var KiloSkillFrontmatterSchema =
|
|
11487
|
-
name:
|
|
11488
|
-
description:
|
|
11489
|
-
"allowed-tools":
|
|
12146
|
+
var import_node_path85 = require("path");
|
|
12147
|
+
var import_mini44 = require("zod/mini");
|
|
12148
|
+
var KiloSkillFrontmatterSchema = import_mini44.z.looseObject({
|
|
12149
|
+
name: import_mini44.z.string(),
|
|
12150
|
+
description: import_mini44.z.string(),
|
|
12151
|
+
"allowed-tools": import_mini44.z.optional(import_mini44.z.array(import_mini44.z.string()))
|
|
11490
12152
|
});
|
|
11491
12153
|
var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
11492
12154
|
constructor({
|
|
11493
12155
|
baseDir = process.cwd(),
|
|
11494
|
-
relativeDirPath = (0,
|
|
12156
|
+
relativeDirPath = (0, import_node_path85.join)(".kilo", "skills"),
|
|
11495
12157
|
dirName,
|
|
11496
12158
|
frontmatter,
|
|
11497
12159
|
body,
|
|
@@ -11520,7 +12182,7 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
11520
12182
|
}
|
|
11521
12183
|
static getSettablePaths({ global = false } = {}) {
|
|
11522
12184
|
return {
|
|
11523
|
-
relativeDirPath: global ? (0,
|
|
12185
|
+
relativeDirPath: global ? (0, import_node_path85.join)(".config", "kilo", "skills") : (0, import_node_path85.join)(".kilo", "skills")
|
|
11524
12186
|
};
|
|
11525
12187
|
}
|
|
11526
12188
|
getFrontmatter() {
|
|
@@ -11606,9 +12268,9 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
11606
12268
|
});
|
|
11607
12269
|
const result = KiloSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11608
12270
|
if (!result.success) {
|
|
11609
|
-
const skillDirPath = (0,
|
|
12271
|
+
const skillDirPath = (0, import_node_path85.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11610
12272
|
throw new Error(
|
|
11611
|
-
`Invalid frontmatter in ${(0,
|
|
12273
|
+
`Invalid frontmatter in ${(0, import_node_path85.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11612
12274
|
);
|
|
11613
12275
|
}
|
|
11614
12276
|
return new _KiloSkill({
|
|
@@ -11642,16 +12304,16 @@ var KiloSkill = class _KiloSkill extends ToolSkill {
|
|
|
11642
12304
|
};
|
|
11643
12305
|
|
|
11644
12306
|
// src/features/skills/kiro-skill.ts
|
|
11645
|
-
var
|
|
11646
|
-
var
|
|
11647
|
-
var KiroSkillFrontmatterSchema =
|
|
11648
|
-
name:
|
|
11649
|
-
description:
|
|
12307
|
+
var import_node_path86 = require("path");
|
|
12308
|
+
var import_mini45 = require("zod/mini");
|
|
12309
|
+
var KiroSkillFrontmatterSchema = import_mini45.z.looseObject({
|
|
12310
|
+
name: import_mini45.z.string(),
|
|
12311
|
+
description: import_mini45.z.string()
|
|
11650
12312
|
});
|
|
11651
12313
|
var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
11652
12314
|
constructor({
|
|
11653
12315
|
baseDir = process.cwd(),
|
|
11654
|
-
relativeDirPath = (0,
|
|
12316
|
+
relativeDirPath = (0, import_node_path86.join)(".kiro", "skills"),
|
|
11655
12317
|
dirName,
|
|
11656
12318
|
frontmatter,
|
|
11657
12319
|
body,
|
|
@@ -11683,7 +12345,7 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
11683
12345
|
throw new Error("KiroSkill does not support global mode.");
|
|
11684
12346
|
}
|
|
11685
12347
|
return {
|
|
11686
|
-
relativeDirPath: (0,
|
|
12348
|
+
relativeDirPath: (0, import_node_path86.join)(".kiro", "skills")
|
|
11687
12349
|
};
|
|
11688
12350
|
}
|
|
11689
12351
|
getFrontmatter() {
|
|
@@ -11771,13 +12433,13 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
11771
12433
|
});
|
|
11772
12434
|
const result = KiroSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11773
12435
|
if (!result.success) {
|
|
11774
|
-
const skillDirPath = (0,
|
|
12436
|
+
const skillDirPath = (0, import_node_path86.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11775
12437
|
throw new Error(
|
|
11776
|
-
`Invalid frontmatter in ${(0,
|
|
12438
|
+
`Invalid frontmatter in ${(0, import_node_path86.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11777
12439
|
);
|
|
11778
12440
|
}
|
|
11779
12441
|
if (result.data.name !== loaded.dirName) {
|
|
11780
|
-
const skillFilePath = (0,
|
|
12442
|
+
const skillFilePath = (0, import_node_path86.join)(
|
|
11781
12443
|
loaded.baseDir,
|
|
11782
12444
|
loaded.relativeDirPath,
|
|
11783
12445
|
loaded.dirName,
|
|
@@ -11819,17 +12481,17 @@ var KiroSkill = class _KiroSkill extends ToolSkill {
|
|
|
11819
12481
|
};
|
|
11820
12482
|
|
|
11821
12483
|
// src/features/skills/opencode-skill.ts
|
|
11822
|
-
var
|
|
11823
|
-
var
|
|
11824
|
-
var OpenCodeSkillFrontmatterSchema =
|
|
11825
|
-
name:
|
|
11826
|
-
description:
|
|
11827
|
-
"allowed-tools":
|
|
12484
|
+
var import_node_path87 = require("path");
|
|
12485
|
+
var import_mini46 = require("zod/mini");
|
|
12486
|
+
var OpenCodeSkillFrontmatterSchema = import_mini46.z.looseObject({
|
|
12487
|
+
name: import_mini46.z.string(),
|
|
12488
|
+
description: import_mini46.z.string(),
|
|
12489
|
+
"allowed-tools": import_mini46.z.optional(import_mini46.z.array(import_mini46.z.string()))
|
|
11828
12490
|
});
|
|
11829
12491
|
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
11830
12492
|
constructor({
|
|
11831
12493
|
baseDir = process.cwd(),
|
|
11832
|
-
relativeDirPath = (0,
|
|
12494
|
+
relativeDirPath = (0, import_node_path87.join)(".opencode", "skill"),
|
|
11833
12495
|
dirName,
|
|
11834
12496
|
frontmatter,
|
|
11835
12497
|
body,
|
|
@@ -11858,7 +12520,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
11858
12520
|
}
|
|
11859
12521
|
static getSettablePaths({ global = false } = {}) {
|
|
11860
12522
|
return {
|
|
11861
|
-
relativeDirPath: global ? (0,
|
|
12523
|
+
relativeDirPath: global ? (0, import_node_path87.join)(".config", "opencode", "skill") : (0, import_node_path87.join)(".opencode", "skill")
|
|
11862
12524
|
};
|
|
11863
12525
|
}
|
|
11864
12526
|
getFrontmatter() {
|
|
@@ -11944,9 +12606,9 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
11944
12606
|
});
|
|
11945
12607
|
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
11946
12608
|
if (!result.success) {
|
|
11947
|
-
const skillDirPath = (0,
|
|
12609
|
+
const skillDirPath = (0, import_node_path87.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
11948
12610
|
throw new Error(
|
|
11949
|
-
`Invalid frontmatter in ${(0,
|
|
12611
|
+
`Invalid frontmatter in ${(0, import_node_path87.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
11950
12612
|
);
|
|
11951
12613
|
}
|
|
11952
12614
|
return new _OpenCodeSkill({
|
|
@@ -11980,16 +12642,16 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
11980
12642
|
};
|
|
11981
12643
|
|
|
11982
12644
|
// src/features/skills/replit-skill.ts
|
|
11983
|
-
var
|
|
11984
|
-
var
|
|
11985
|
-
var ReplitSkillFrontmatterSchema =
|
|
11986
|
-
name:
|
|
11987
|
-
description:
|
|
12645
|
+
var import_node_path88 = require("path");
|
|
12646
|
+
var import_mini47 = require("zod/mini");
|
|
12647
|
+
var ReplitSkillFrontmatterSchema = import_mini47.z.looseObject({
|
|
12648
|
+
name: import_mini47.z.string(),
|
|
12649
|
+
description: import_mini47.z.string()
|
|
11988
12650
|
});
|
|
11989
12651
|
var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
11990
12652
|
constructor({
|
|
11991
12653
|
baseDir = process.cwd(),
|
|
11992
|
-
relativeDirPath = (0,
|
|
12654
|
+
relativeDirPath = (0, import_node_path88.join)(".agents", "skills"),
|
|
11993
12655
|
dirName,
|
|
11994
12656
|
frontmatter,
|
|
11995
12657
|
body,
|
|
@@ -12021,7 +12683,7 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
12021
12683
|
throw new Error("ReplitSkill does not support global mode.");
|
|
12022
12684
|
}
|
|
12023
12685
|
return {
|
|
12024
|
-
relativeDirPath: (0,
|
|
12686
|
+
relativeDirPath: (0, import_node_path88.join)(".agents", "skills")
|
|
12025
12687
|
};
|
|
12026
12688
|
}
|
|
12027
12689
|
getFrontmatter() {
|
|
@@ -12101,9 +12763,9 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
12101
12763
|
});
|
|
12102
12764
|
const result = ReplitSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12103
12765
|
if (!result.success) {
|
|
12104
|
-
const skillDirPath = (0,
|
|
12766
|
+
const skillDirPath = (0, import_node_path88.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
12105
12767
|
throw new Error(
|
|
12106
|
-
`Invalid frontmatter in ${(0,
|
|
12768
|
+
`Invalid frontmatter in ${(0, import_node_path88.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12107
12769
|
);
|
|
12108
12770
|
}
|
|
12109
12771
|
return new _ReplitSkill({
|
|
@@ -12138,16 +12800,16 @@ var ReplitSkill = class _ReplitSkill extends ToolSkill {
|
|
|
12138
12800
|
};
|
|
12139
12801
|
|
|
12140
12802
|
// src/features/skills/roo-skill.ts
|
|
12141
|
-
var
|
|
12142
|
-
var
|
|
12143
|
-
var RooSkillFrontmatterSchema =
|
|
12144
|
-
name:
|
|
12145
|
-
description:
|
|
12803
|
+
var import_node_path89 = require("path");
|
|
12804
|
+
var import_mini48 = require("zod/mini");
|
|
12805
|
+
var RooSkillFrontmatterSchema = import_mini48.z.looseObject({
|
|
12806
|
+
name: import_mini48.z.string(),
|
|
12807
|
+
description: import_mini48.z.string()
|
|
12146
12808
|
});
|
|
12147
12809
|
var RooSkill = class _RooSkill extends ToolSkill {
|
|
12148
12810
|
constructor({
|
|
12149
12811
|
baseDir = process.cwd(),
|
|
12150
|
-
relativeDirPath = (0,
|
|
12812
|
+
relativeDirPath = (0, import_node_path89.join)(".roo", "skills"),
|
|
12151
12813
|
dirName,
|
|
12152
12814
|
frontmatter,
|
|
12153
12815
|
body,
|
|
@@ -12178,7 +12840,7 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
12178
12840
|
global: _global = false
|
|
12179
12841
|
} = {}) {
|
|
12180
12842
|
return {
|
|
12181
|
-
relativeDirPath: (0,
|
|
12843
|
+
relativeDirPath: (0, import_node_path89.join)(".roo", "skills")
|
|
12182
12844
|
};
|
|
12183
12845
|
}
|
|
12184
12846
|
getFrontmatter() {
|
|
@@ -12266,13 +12928,13 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
12266
12928
|
});
|
|
12267
12929
|
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
12268
12930
|
if (!result.success) {
|
|
12269
|
-
const skillDirPath = (0,
|
|
12931
|
+
const skillDirPath = (0, import_node_path89.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
12270
12932
|
throw new Error(
|
|
12271
|
-
`Invalid frontmatter in ${(0,
|
|
12933
|
+
`Invalid frontmatter in ${(0, import_node_path89.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
12272
12934
|
);
|
|
12273
12935
|
}
|
|
12274
12936
|
if (result.data.name !== loaded.dirName) {
|
|
12275
|
-
const skillFilePath = (0,
|
|
12937
|
+
const skillFilePath = (0, import_node_path89.join)(
|
|
12276
12938
|
loaded.baseDir,
|
|
12277
12939
|
loaded.relativeDirPath,
|
|
12278
12940
|
loaded.dirName,
|
|
@@ -12313,17 +12975,17 @@ var RooSkill = class _RooSkill extends ToolSkill {
|
|
|
12313
12975
|
};
|
|
12314
12976
|
|
|
12315
12977
|
// src/features/skills/skills-utils.ts
|
|
12316
|
-
var
|
|
12978
|
+
var import_node_path90 = require("path");
|
|
12317
12979
|
async function getLocalSkillDirNames(baseDir) {
|
|
12318
|
-
const skillsDir = (0,
|
|
12980
|
+
const skillsDir = (0, import_node_path90.join)(baseDir, RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
12319
12981
|
const names = /* @__PURE__ */ new Set();
|
|
12320
12982
|
if (!await directoryExists(skillsDir)) {
|
|
12321
12983
|
return names;
|
|
12322
12984
|
}
|
|
12323
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
12985
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path90.join)(skillsDir, "*"), { type: "dir" });
|
|
12324
12986
|
for (const dirPath of dirPaths) {
|
|
12325
|
-
const name = (0,
|
|
12326
|
-
if (name === (0,
|
|
12987
|
+
const name = (0, import_node_path90.basename)(dirPath);
|
|
12988
|
+
if (name === (0, import_node_path90.basename)(RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH)) continue;
|
|
12327
12989
|
names.add(name);
|
|
12328
12990
|
}
|
|
12329
12991
|
return names;
|
|
@@ -12351,7 +13013,7 @@ var skillsProcessorToolTargetTuple = [
|
|
|
12351
13013
|
"roo",
|
|
12352
13014
|
"rovodev"
|
|
12353
13015
|
];
|
|
12354
|
-
var SkillsProcessorToolTargetSchema =
|
|
13016
|
+
var SkillsProcessorToolTargetSchema = import_mini49.z.enum(skillsProcessorToolTargetTuple);
|
|
12355
13017
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
12356
13018
|
[
|
|
12357
13019
|
"agentsmd",
|
|
@@ -12575,11 +13237,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12575
13237
|
)
|
|
12576
13238
|
);
|
|
12577
13239
|
const localSkillNames = new Set(localDirNames);
|
|
12578
|
-
const curatedDirPath = (0,
|
|
13240
|
+
const curatedDirPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
12579
13241
|
let curatedSkills = [];
|
|
12580
13242
|
if (await directoryExists(curatedDirPath)) {
|
|
12581
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
12582
|
-
const curatedDirNames = curatedDirPaths.map((path3) => (0,
|
|
13243
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path91.join)(curatedDirPath, "*"), { type: "dir" });
|
|
13244
|
+
const curatedDirNames = curatedDirPaths.map((path3) => (0, import_node_path91.basename)(path3));
|
|
12583
13245
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
12584
13246
|
if (localSkillNames.has(name)) {
|
|
12585
13247
|
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -12616,13 +13278,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12616
13278
|
const seenDirNames = /* @__PURE__ */ new Set();
|
|
12617
13279
|
const loadEntries = [];
|
|
12618
13280
|
for (const root of roots) {
|
|
12619
|
-
const skillsDirPath = (0,
|
|
13281
|
+
const skillsDirPath = (0, import_node_path91.join)(this.baseDir, root);
|
|
12620
13282
|
if (!await directoryExists(skillsDirPath)) {
|
|
12621
13283
|
continue;
|
|
12622
13284
|
}
|
|
12623
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
13285
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path91.join)(skillsDirPath, "*"), { type: "dir" });
|
|
12624
13286
|
for (const dirPath of dirPaths) {
|
|
12625
|
-
const dirName = (0,
|
|
13287
|
+
const dirName = (0, import_node_path91.basename)(dirPath);
|
|
12626
13288
|
if (seenDirNames.has(dirName)) {
|
|
12627
13289
|
continue;
|
|
12628
13290
|
}
|
|
@@ -12651,13 +13313,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12651
13313
|
const roots = toolSkillSearchRoots(paths);
|
|
12652
13314
|
const toolSkills = [];
|
|
12653
13315
|
for (const root of roots) {
|
|
12654
|
-
const skillsDirPath = (0,
|
|
13316
|
+
const skillsDirPath = (0, import_node_path91.join)(this.baseDir, root);
|
|
12655
13317
|
if (!await directoryExists(skillsDirPath)) {
|
|
12656
13318
|
continue;
|
|
12657
13319
|
}
|
|
12658
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
13320
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path91.join)(skillsDirPath, "*"), { type: "dir" });
|
|
12659
13321
|
for (const dirPath of dirPaths) {
|
|
12660
|
-
const dirName = (0,
|
|
13322
|
+
const dirName = (0, import_node_path91.basename)(dirPath);
|
|
12661
13323
|
const toolSkill = factory.class.forDeletion({
|
|
12662
13324
|
baseDir: this.baseDir,
|
|
12663
13325
|
relativeDirPath: root,
|
|
@@ -12719,11 +13381,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
12719
13381
|
};
|
|
12720
13382
|
|
|
12721
13383
|
// src/features/subagents/agentsmd-subagent.ts
|
|
12722
|
-
var
|
|
13384
|
+
var import_node_path93 = require("path");
|
|
12723
13385
|
|
|
12724
13386
|
// src/features/subagents/simulated-subagent.ts
|
|
12725
|
-
var
|
|
12726
|
-
var
|
|
13387
|
+
var import_node_path92 = require("path");
|
|
13388
|
+
var import_mini50 = require("zod/mini");
|
|
12727
13389
|
|
|
12728
13390
|
// src/features/subagents/tool-subagent.ts
|
|
12729
13391
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -12775,9 +13437,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
12775
13437
|
};
|
|
12776
13438
|
|
|
12777
13439
|
// src/features/subagents/simulated-subagent.ts
|
|
12778
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
12779
|
-
name:
|
|
12780
|
-
description:
|
|
13440
|
+
var SimulatedSubagentFrontmatterSchema = import_mini50.z.object({
|
|
13441
|
+
name: import_mini50.z.string(),
|
|
13442
|
+
description: import_mini50.z.optional(import_mini50.z.string())
|
|
12781
13443
|
});
|
|
12782
13444
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
12783
13445
|
frontmatter;
|
|
@@ -12787,7 +13449,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12787
13449
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12788
13450
|
if (!result.success) {
|
|
12789
13451
|
throw new Error(
|
|
12790
|
-
`Invalid frontmatter in ${(0,
|
|
13452
|
+
`Invalid frontmatter in ${(0, import_node_path92.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
12791
13453
|
);
|
|
12792
13454
|
}
|
|
12793
13455
|
}
|
|
@@ -12838,7 +13500,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12838
13500
|
return {
|
|
12839
13501
|
success: false,
|
|
12840
13502
|
error: new Error(
|
|
12841
|
-
`Invalid frontmatter in ${(0,
|
|
13503
|
+
`Invalid frontmatter in ${(0, import_node_path92.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12842
13504
|
)
|
|
12843
13505
|
};
|
|
12844
13506
|
}
|
|
@@ -12848,7 +13510,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12848
13510
|
relativeFilePath,
|
|
12849
13511
|
validate = true
|
|
12850
13512
|
}) {
|
|
12851
|
-
const filePath = (0,
|
|
13513
|
+
const filePath = (0, import_node_path92.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
12852
13514
|
const fileContent = await readFileContent(filePath);
|
|
12853
13515
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12854
13516
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -12858,7 +13520,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12858
13520
|
return {
|
|
12859
13521
|
baseDir,
|
|
12860
13522
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
12861
|
-
relativeFilePath: (0,
|
|
13523
|
+
relativeFilePath: (0, import_node_path92.basename)(relativeFilePath),
|
|
12862
13524
|
frontmatter: result.data,
|
|
12863
13525
|
body: content.trim(),
|
|
12864
13526
|
validate
|
|
@@ -12884,7 +13546,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
12884
13546
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
12885
13547
|
static getSettablePaths() {
|
|
12886
13548
|
return {
|
|
12887
|
-
relativeDirPath: (0,
|
|
13549
|
+
relativeDirPath: (0, import_node_path93.join)(".agents", "subagents")
|
|
12888
13550
|
};
|
|
12889
13551
|
}
|
|
12890
13552
|
static async fromFile(params) {
|
|
@@ -12907,11 +13569,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
12907
13569
|
};
|
|
12908
13570
|
|
|
12909
13571
|
// src/features/subagents/factorydroid-subagent.ts
|
|
12910
|
-
var
|
|
13572
|
+
var import_node_path94 = require("path");
|
|
12911
13573
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
12912
13574
|
static getSettablePaths(_options) {
|
|
12913
13575
|
return {
|
|
12914
|
-
relativeDirPath: (0,
|
|
13576
|
+
relativeDirPath: (0, import_node_path94.join)(".factory", "droids")
|
|
12915
13577
|
};
|
|
12916
13578
|
}
|
|
12917
13579
|
static async fromFile(params) {
|
|
@@ -12934,16 +13596,16 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
12934
13596
|
};
|
|
12935
13597
|
|
|
12936
13598
|
// src/features/subagents/geminicli-subagent.ts
|
|
12937
|
-
var
|
|
12938
|
-
var
|
|
12939
|
-
|
|
12940
|
-
// src/features/subagents/rulesync-subagent.ts
|
|
12941
|
-
var
|
|
12942
|
-
var
|
|
12943
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
12944
|
-
targets:
|
|
12945
|
-
name:
|
|
12946
|
-
description:
|
|
13599
|
+
var import_node_path96 = require("path");
|
|
13600
|
+
var import_mini52 = require("zod/mini");
|
|
13601
|
+
|
|
13602
|
+
// src/features/subagents/rulesync-subagent.ts
|
|
13603
|
+
var import_node_path95 = require("path");
|
|
13604
|
+
var import_mini51 = require("zod/mini");
|
|
13605
|
+
var RulesyncSubagentFrontmatterSchema = import_mini51.z.looseObject({
|
|
13606
|
+
targets: import_mini51.z._default(RulesyncTargetsSchema, ["*"]),
|
|
13607
|
+
name: import_mini51.z.string(),
|
|
13608
|
+
description: import_mini51.z.optional(import_mini51.z.string())
|
|
12947
13609
|
});
|
|
12948
13610
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
12949
13611
|
frontmatter;
|
|
@@ -12952,7 +13614,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12952
13614
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
12953
13615
|
if (!parseResult.success && rest.validate !== false) {
|
|
12954
13616
|
throw new Error(
|
|
12955
|
-
`Invalid frontmatter in ${(0,
|
|
13617
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
12956
13618
|
);
|
|
12957
13619
|
}
|
|
12958
13620
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -12985,7 +13647,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12985
13647
|
return {
|
|
12986
13648
|
success: false,
|
|
12987
13649
|
error: new Error(
|
|
12988
|
-
`Invalid frontmatter in ${(0,
|
|
13650
|
+
`Invalid frontmatter in ${(0, import_node_path95.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
12989
13651
|
)
|
|
12990
13652
|
};
|
|
12991
13653
|
}
|
|
@@ -12993,14 +13655,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
12993
13655
|
static async fromFile({
|
|
12994
13656
|
relativeFilePath
|
|
12995
13657
|
}) {
|
|
12996
|
-
const filePath = (0,
|
|
13658
|
+
const filePath = (0, import_node_path95.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
12997
13659
|
const fileContent = await readFileContent(filePath);
|
|
12998
13660
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
12999
13661
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13000
13662
|
if (!result.success) {
|
|
13001
13663
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
13002
13664
|
}
|
|
13003
|
-
const filename = (0,
|
|
13665
|
+
const filename = (0, import_node_path95.basename)(relativeFilePath);
|
|
13004
13666
|
return new _RulesyncSubagent({
|
|
13005
13667
|
baseDir: process.cwd(),
|
|
13006
13668
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -13012,9 +13674,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
13012
13674
|
};
|
|
13013
13675
|
|
|
13014
13676
|
// src/features/subagents/geminicli-subagent.ts
|
|
13015
|
-
var GeminiCliSubagentFrontmatterSchema =
|
|
13016
|
-
name:
|
|
13017
|
-
description:
|
|
13677
|
+
var GeminiCliSubagentFrontmatterSchema = import_mini52.z.looseObject({
|
|
13678
|
+
name: import_mini52.z.string(),
|
|
13679
|
+
description: import_mini52.z.optional(import_mini52.z.string())
|
|
13018
13680
|
});
|
|
13019
13681
|
var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
13020
13682
|
frontmatter;
|
|
@@ -13024,7 +13686,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
13024
13686
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13025
13687
|
if (!result.success) {
|
|
13026
13688
|
throw new Error(
|
|
13027
|
-
`Invalid frontmatter in ${(0,
|
|
13689
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13028
13690
|
);
|
|
13029
13691
|
}
|
|
13030
13692
|
}
|
|
@@ -13037,7 +13699,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
13037
13699
|
}
|
|
13038
13700
|
static getSettablePaths(_options = {}) {
|
|
13039
13701
|
return {
|
|
13040
|
-
relativeDirPath: (0,
|
|
13702
|
+
relativeDirPath: (0, import_node_path96.join)(".gemini", "agents")
|
|
13041
13703
|
};
|
|
13042
13704
|
}
|
|
13043
13705
|
getFrontmatter() {
|
|
@@ -13105,7 +13767,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
13105
13767
|
return {
|
|
13106
13768
|
success: false,
|
|
13107
13769
|
error: new Error(
|
|
13108
|
-
`Invalid frontmatter in ${(0,
|
|
13770
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13109
13771
|
)
|
|
13110
13772
|
};
|
|
13111
13773
|
}
|
|
@@ -13123,7 +13785,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
13123
13785
|
global = false
|
|
13124
13786
|
}) {
|
|
13125
13787
|
const paths = this.getSettablePaths({ global });
|
|
13126
|
-
const filePath = (0,
|
|
13788
|
+
const filePath = (0, import_node_path96.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13127
13789
|
const fileContent = await readFileContent(filePath);
|
|
13128
13790
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13129
13791
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13159,11 +13821,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
13159
13821
|
};
|
|
13160
13822
|
|
|
13161
13823
|
// src/features/subagents/roo-subagent.ts
|
|
13162
|
-
var
|
|
13824
|
+
var import_node_path97 = require("path");
|
|
13163
13825
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
13164
13826
|
static getSettablePaths() {
|
|
13165
13827
|
return {
|
|
13166
|
-
relativeDirPath: (0,
|
|
13828
|
+
relativeDirPath: (0, import_node_path97.join)(".roo", "subagents")
|
|
13167
13829
|
};
|
|
13168
13830
|
}
|
|
13169
13831
|
static async fromFile(params) {
|
|
@@ -13186,11 +13848,11 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
13186
13848
|
};
|
|
13187
13849
|
|
|
13188
13850
|
// src/features/subagents/rovodev-subagent.ts
|
|
13189
|
-
var
|
|
13190
|
-
var
|
|
13191
|
-
var RovodevSubagentFrontmatterSchema =
|
|
13192
|
-
name:
|
|
13193
|
-
description:
|
|
13851
|
+
var import_node_path98 = require("path");
|
|
13852
|
+
var import_mini53 = require("zod/mini");
|
|
13853
|
+
var RovodevSubagentFrontmatterSchema = import_mini53.z.looseObject({
|
|
13854
|
+
name: import_mini53.z.string(),
|
|
13855
|
+
description: import_mini53.z.optional(import_mini53.z.string())
|
|
13194
13856
|
});
|
|
13195
13857
|
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
13196
13858
|
frontmatter;
|
|
@@ -13200,7 +13862,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13200
13862
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13201
13863
|
if (!result.success) {
|
|
13202
13864
|
throw new Error(
|
|
13203
|
-
`Invalid frontmatter in ${(0,
|
|
13865
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13204
13866
|
);
|
|
13205
13867
|
}
|
|
13206
13868
|
}
|
|
@@ -13212,7 +13874,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13212
13874
|
}
|
|
13213
13875
|
static getSettablePaths(_options = {}) {
|
|
13214
13876
|
return {
|
|
13215
|
-
relativeDirPath: (0,
|
|
13877
|
+
relativeDirPath: (0, import_node_path98.join)(".rovodev", "subagents")
|
|
13216
13878
|
};
|
|
13217
13879
|
}
|
|
13218
13880
|
getFrontmatter() {
|
|
@@ -13275,7 +13937,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13275
13937
|
return {
|
|
13276
13938
|
success: false,
|
|
13277
13939
|
error: new Error(
|
|
13278
|
-
`Invalid frontmatter in ${(0,
|
|
13940
|
+
`Invalid frontmatter in ${(0, import_node_path98.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13279
13941
|
)
|
|
13280
13942
|
};
|
|
13281
13943
|
}
|
|
@@ -13292,7 +13954,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13292
13954
|
global = false
|
|
13293
13955
|
}) {
|
|
13294
13956
|
const paths = this.getSettablePaths({ global });
|
|
13295
|
-
const filePath = (0,
|
|
13957
|
+
const filePath = (0, import_node_path98.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13296
13958
|
const fileContent = await readFileContent(filePath);
|
|
13297
13959
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13298
13960
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13331,19 +13993,19 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
13331
13993
|
};
|
|
13332
13994
|
|
|
13333
13995
|
// src/features/subagents/subagents-processor.ts
|
|
13334
|
-
var
|
|
13335
|
-
var
|
|
13996
|
+
var import_node_path109 = require("path");
|
|
13997
|
+
var import_mini62 = require("zod/mini");
|
|
13336
13998
|
|
|
13337
13999
|
// src/features/subagents/claudecode-subagent.ts
|
|
13338
|
-
var
|
|
13339
|
-
var
|
|
13340
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
13341
|
-
name:
|
|
13342
|
-
description:
|
|
13343
|
-
model:
|
|
13344
|
-
tools:
|
|
13345
|
-
permissionMode:
|
|
13346
|
-
skills:
|
|
14000
|
+
var import_node_path99 = require("path");
|
|
14001
|
+
var import_mini54 = require("zod/mini");
|
|
14002
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini54.z.looseObject({
|
|
14003
|
+
name: import_mini54.z.string(),
|
|
14004
|
+
description: import_mini54.z.optional(import_mini54.z.string()),
|
|
14005
|
+
model: import_mini54.z.optional(import_mini54.z.string()),
|
|
14006
|
+
tools: import_mini54.z.optional(import_mini54.z.union([import_mini54.z.string(), import_mini54.z.array(import_mini54.z.string())])),
|
|
14007
|
+
permissionMode: import_mini54.z.optional(import_mini54.z.string()),
|
|
14008
|
+
skills: import_mini54.z.optional(import_mini54.z.union([import_mini54.z.string(), import_mini54.z.array(import_mini54.z.string())]))
|
|
13347
14009
|
});
|
|
13348
14010
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
13349
14011
|
frontmatter;
|
|
@@ -13353,7 +14015,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13353
14015
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13354
14016
|
if (!result.success) {
|
|
13355
14017
|
throw new Error(
|
|
13356
|
-
`Invalid frontmatter in ${(0,
|
|
14018
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13357
14019
|
);
|
|
13358
14020
|
}
|
|
13359
14021
|
}
|
|
@@ -13365,7 +14027,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13365
14027
|
}
|
|
13366
14028
|
static getSettablePaths(_options = {}) {
|
|
13367
14029
|
return {
|
|
13368
|
-
relativeDirPath: (0,
|
|
14030
|
+
relativeDirPath: (0, import_node_path99.join)(".claude", "agents")
|
|
13369
14031
|
};
|
|
13370
14032
|
}
|
|
13371
14033
|
getFrontmatter() {
|
|
@@ -13444,7 +14106,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13444
14106
|
return {
|
|
13445
14107
|
success: false,
|
|
13446
14108
|
error: new Error(
|
|
13447
|
-
`Invalid frontmatter in ${(0,
|
|
14109
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13448
14110
|
)
|
|
13449
14111
|
};
|
|
13450
14112
|
}
|
|
@@ -13462,7 +14124,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13462
14124
|
global = false
|
|
13463
14125
|
}) {
|
|
13464
14126
|
const paths = this.getSettablePaths({ global });
|
|
13465
|
-
const filePath = (0,
|
|
14127
|
+
const filePath = (0, import_node_path99.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13466
14128
|
const fileContent = await readFileContent(filePath);
|
|
13467
14129
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13468
14130
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13497,16 +14159,16 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
13497
14159
|
};
|
|
13498
14160
|
|
|
13499
14161
|
// src/features/subagents/codexcli-subagent.ts
|
|
13500
|
-
var
|
|
14162
|
+
var import_node_path100 = require("path");
|
|
13501
14163
|
var smolToml4 = __toESM(require("smol-toml"), 1);
|
|
13502
|
-
var
|
|
13503
|
-
var CodexCliSubagentTomlSchema =
|
|
13504
|
-
name:
|
|
13505
|
-
description:
|
|
13506
|
-
developer_instructions:
|
|
13507
|
-
model:
|
|
13508
|
-
model_reasoning_effort:
|
|
13509
|
-
sandbox_mode:
|
|
14164
|
+
var import_mini55 = require("zod/mini");
|
|
14165
|
+
var CodexCliSubagentTomlSchema = import_mini55.z.looseObject({
|
|
14166
|
+
name: import_mini55.z.string(),
|
|
14167
|
+
description: import_mini55.z.optional(import_mini55.z.string()),
|
|
14168
|
+
developer_instructions: import_mini55.z.optional(import_mini55.z.string()),
|
|
14169
|
+
model: import_mini55.z.optional(import_mini55.z.string()),
|
|
14170
|
+
model_reasoning_effort: import_mini55.z.optional(import_mini55.z.string()),
|
|
14171
|
+
sandbox_mode: import_mini55.z.optional(import_mini55.z.string())
|
|
13510
14172
|
});
|
|
13511
14173
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
13512
14174
|
body;
|
|
@@ -13517,7 +14179,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13517
14179
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
13518
14180
|
} catch (error) {
|
|
13519
14181
|
throw new Error(
|
|
13520
|
-
`Invalid TOML in ${(0,
|
|
14182
|
+
`Invalid TOML in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
13521
14183
|
{ cause: error }
|
|
13522
14184
|
);
|
|
13523
14185
|
}
|
|
@@ -13529,7 +14191,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13529
14191
|
}
|
|
13530
14192
|
static getSettablePaths(_options = {}) {
|
|
13531
14193
|
return {
|
|
13532
|
-
relativeDirPath: (0,
|
|
14194
|
+
relativeDirPath: (0, import_node_path100.join)(".codex", "agents")
|
|
13533
14195
|
};
|
|
13534
14196
|
}
|
|
13535
14197
|
getBody() {
|
|
@@ -13541,7 +14203,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13541
14203
|
parsed = CodexCliSubagentTomlSchema.parse(smolToml4.parse(this.body));
|
|
13542
14204
|
} catch (error) {
|
|
13543
14205
|
throw new Error(
|
|
13544
|
-
`Failed to parse TOML in ${(0,
|
|
14206
|
+
`Failed to parse TOML in ${(0, import_node_path100.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
13545
14207
|
{ cause: error }
|
|
13546
14208
|
);
|
|
13547
14209
|
}
|
|
@@ -13622,7 +14284,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13622
14284
|
global = false
|
|
13623
14285
|
}) {
|
|
13624
14286
|
const paths = this.getSettablePaths({ global });
|
|
13625
|
-
const filePath = (0,
|
|
14287
|
+
const filePath = (0, import_node_path100.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13626
14288
|
const fileContent = await readFileContent(filePath);
|
|
13627
14289
|
const subagent = new _CodexCliSubagent({
|
|
13628
14290
|
baseDir,
|
|
@@ -13660,13 +14322,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
13660
14322
|
};
|
|
13661
14323
|
|
|
13662
14324
|
// src/features/subagents/copilot-subagent.ts
|
|
13663
|
-
var
|
|
13664
|
-
var
|
|
14325
|
+
var import_node_path101 = require("path");
|
|
14326
|
+
var import_mini56 = require("zod/mini");
|
|
13665
14327
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
13666
|
-
var CopilotSubagentFrontmatterSchema =
|
|
13667
|
-
name:
|
|
13668
|
-
description:
|
|
13669
|
-
tools:
|
|
14328
|
+
var CopilotSubagentFrontmatterSchema = import_mini56.z.looseObject({
|
|
14329
|
+
name: import_mini56.z.string(),
|
|
14330
|
+
description: import_mini56.z.optional(import_mini56.z.string()),
|
|
14331
|
+
tools: import_mini56.z.optional(import_mini56.z.union([import_mini56.z.string(), import_mini56.z.array(import_mini56.z.string())]))
|
|
13670
14332
|
});
|
|
13671
14333
|
var normalizeTools = (tools) => {
|
|
13672
14334
|
if (!tools) {
|
|
@@ -13686,7 +14348,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13686
14348
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13687
14349
|
if (!result.success) {
|
|
13688
14350
|
throw new Error(
|
|
13689
|
-
`Invalid frontmatter in ${(0,
|
|
14351
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13690
14352
|
);
|
|
13691
14353
|
}
|
|
13692
14354
|
}
|
|
@@ -13698,7 +14360,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13698
14360
|
}
|
|
13699
14361
|
static getSettablePaths(_options = {}) {
|
|
13700
14362
|
return {
|
|
13701
|
-
relativeDirPath: (0,
|
|
14363
|
+
relativeDirPath: (0, import_node_path101.join)(".github", "agents")
|
|
13702
14364
|
};
|
|
13703
14365
|
}
|
|
13704
14366
|
getFrontmatter() {
|
|
@@ -13772,7 +14434,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13772
14434
|
return {
|
|
13773
14435
|
success: false,
|
|
13774
14436
|
error: new Error(
|
|
13775
|
-
`Invalid frontmatter in ${(0,
|
|
14437
|
+
`Invalid frontmatter in ${(0, import_node_path101.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13776
14438
|
)
|
|
13777
14439
|
};
|
|
13778
14440
|
}
|
|
@@ -13790,7 +14452,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13790
14452
|
global = false
|
|
13791
14453
|
}) {
|
|
13792
14454
|
const paths = this.getSettablePaths({ global });
|
|
13793
|
-
const filePath = (0,
|
|
14455
|
+
const filePath = (0, import_node_path101.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13794
14456
|
const fileContent = await readFileContent(filePath);
|
|
13795
14457
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13796
14458
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13826,11 +14488,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
13826
14488
|
};
|
|
13827
14489
|
|
|
13828
14490
|
// src/features/subagents/cursor-subagent.ts
|
|
13829
|
-
var
|
|
13830
|
-
var
|
|
13831
|
-
var CursorSubagentFrontmatterSchema =
|
|
13832
|
-
name:
|
|
13833
|
-
description:
|
|
14491
|
+
var import_node_path102 = require("path");
|
|
14492
|
+
var import_mini57 = require("zod/mini");
|
|
14493
|
+
var CursorSubagentFrontmatterSchema = import_mini57.z.looseObject({
|
|
14494
|
+
name: import_mini57.z.string(),
|
|
14495
|
+
description: import_mini57.z.optional(import_mini57.z.string())
|
|
13834
14496
|
});
|
|
13835
14497
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
13836
14498
|
frontmatter;
|
|
@@ -13840,7 +14502,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13840
14502
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13841
14503
|
if (!result.success) {
|
|
13842
14504
|
throw new Error(
|
|
13843
|
-
`Invalid frontmatter in ${(0,
|
|
14505
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13844
14506
|
);
|
|
13845
14507
|
}
|
|
13846
14508
|
}
|
|
@@ -13852,7 +14514,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13852
14514
|
}
|
|
13853
14515
|
static getSettablePaths(_options = {}) {
|
|
13854
14516
|
return {
|
|
13855
|
-
relativeDirPath: (0,
|
|
14517
|
+
relativeDirPath: (0, import_node_path102.join)(".cursor", "agents")
|
|
13856
14518
|
};
|
|
13857
14519
|
}
|
|
13858
14520
|
getFrontmatter() {
|
|
@@ -13919,7 +14581,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13919
14581
|
return {
|
|
13920
14582
|
success: false,
|
|
13921
14583
|
error: new Error(
|
|
13922
|
-
`Invalid frontmatter in ${(0,
|
|
14584
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
13923
14585
|
)
|
|
13924
14586
|
};
|
|
13925
14587
|
}
|
|
@@ -13937,7 +14599,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13937
14599
|
global = false
|
|
13938
14600
|
}) {
|
|
13939
14601
|
const paths = this.getSettablePaths({ global });
|
|
13940
|
-
const filePath = (0,
|
|
14602
|
+
const filePath = (0, import_node_path102.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
13941
14603
|
const fileContent = await readFileContent(filePath);
|
|
13942
14604
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
13943
14605
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -13973,12 +14635,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
13973
14635
|
};
|
|
13974
14636
|
|
|
13975
14637
|
// src/features/subagents/deepagents-subagent.ts
|
|
13976
|
-
var
|
|
13977
|
-
var
|
|
13978
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
13979
|
-
name:
|
|
13980
|
-
description:
|
|
13981
|
-
model:
|
|
14638
|
+
var import_node_path103 = require("path");
|
|
14639
|
+
var import_mini58 = require("zod/mini");
|
|
14640
|
+
var DeepagentsSubagentFrontmatterSchema = import_mini58.z.looseObject({
|
|
14641
|
+
name: import_mini58.z.string(),
|
|
14642
|
+
description: import_mini58.z.optional(import_mini58.z.string()),
|
|
14643
|
+
model: import_mini58.z.optional(import_mini58.z.string())
|
|
13982
14644
|
});
|
|
13983
14645
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
13984
14646
|
frontmatter;
|
|
@@ -13988,7 +14650,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13988
14650
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
13989
14651
|
if (!result.success) {
|
|
13990
14652
|
throw new Error(
|
|
13991
|
-
`Invalid frontmatter in ${(0,
|
|
14653
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
13992
14654
|
);
|
|
13993
14655
|
}
|
|
13994
14656
|
}
|
|
@@ -13998,7 +14660,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
13998
14660
|
}
|
|
13999
14661
|
static getSettablePaths(_options = {}) {
|
|
14000
14662
|
return {
|
|
14001
|
-
relativeDirPath: (0,
|
|
14663
|
+
relativeDirPath: (0, import_node_path103.join)(".deepagents", "agents")
|
|
14002
14664
|
};
|
|
14003
14665
|
}
|
|
14004
14666
|
getFrontmatter() {
|
|
@@ -14073,7 +14735,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
14073
14735
|
return {
|
|
14074
14736
|
success: false,
|
|
14075
14737
|
error: new Error(
|
|
14076
|
-
`Invalid frontmatter in ${(0,
|
|
14738
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14077
14739
|
)
|
|
14078
14740
|
};
|
|
14079
14741
|
}
|
|
@@ -14091,7 +14753,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
14091
14753
|
global = false
|
|
14092
14754
|
}) {
|
|
14093
14755
|
const paths = this.getSettablePaths({ global });
|
|
14094
|
-
const filePath = (0,
|
|
14756
|
+
const filePath = (0, import_node_path103.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14095
14757
|
const fileContent = await readFileContent(filePath);
|
|
14096
14758
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14097
14759
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14126,11 +14788,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
14126
14788
|
};
|
|
14127
14789
|
|
|
14128
14790
|
// src/features/subagents/junie-subagent.ts
|
|
14129
|
-
var
|
|
14130
|
-
var
|
|
14131
|
-
var JunieSubagentFrontmatterSchema =
|
|
14132
|
-
name:
|
|
14133
|
-
description:
|
|
14791
|
+
var import_node_path104 = require("path");
|
|
14792
|
+
var import_mini59 = require("zod/mini");
|
|
14793
|
+
var JunieSubagentFrontmatterSchema = import_mini59.z.looseObject({
|
|
14794
|
+
name: import_mini59.z.optional(import_mini59.z.string()),
|
|
14795
|
+
description: import_mini59.z.string()
|
|
14134
14796
|
});
|
|
14135
14797
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
14136
14798
|
frontmatter;
|
|
@@ -14140,7 +14802,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14140
14802
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14141
14803
|
if (!result.success) {
|
|
14142
14804
|
throw new Error(
|
|
14143
|
-
`Invalid frontmatter in ${(0,
|
|
14805
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14144
14806
|
);
|
|
14145
14807
|
}
|
|
14146
14808
|
}
|
|
@@ -14155,7 +14817,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14155
14817
|
throw new Error("JunieSubagent does not support global mode.");
|
|
14156
14818
|
}
|
|
14157
14819
|
return {
|
|
14158
|
-
relativeDirPath: (0,
|
|
14820
|
+
relativeDirPath: (0, import_node_path104.join)(".junie", "agents")
|
|
14159
14821
|
};
|
|
14160
14822
|
}
|
|
14161
14823
|
getFrontmatter() {
|
|
@@ -14231,7 +14893,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14231
14893
|
return {
|
|
14232
14894
|
success: false,
|
|
14233
14895
|
error: new Error(
|
|
14234
|
-
`Invalid frontmatter in ${(0,
|
|
14896
|
+
`Invalid frontmatter in ${(0, import_node_path104.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14235
14897
|
)
|
|
14236
14898
|
};
|
|
14237
14899
|
}
|
|
@@ -14249,7 +14911,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14249
14911
|
global = false
|
|
14250
14912
|
}) {
|
|
14251
14913
|
const paths = this.getSettablePaths({ global });
|
|
14252
|
-
const filePath = (0,
|
|
14914
|
+
const filePath = (0, import_node_path104.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14253
14915
|
const fileContent = await readFileContent(filePath);
|
|
14254
14916
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14255
14917
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14284,15 +14946,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
14284
14946
|
};
|
|
14285
14947
|
|
|
14286
14948
|
// src/features/subagents/kilo-subagent.ts
|
|
14287
|
-
var
|
|
14949
|
+
var import_node_path106 = require("path");
|
|
14288
14950
|
|
|
14289
14951
|
// src/features/subagents/opencode-style-subagent.ts
|
|
14290
|
-
var
|
|
14291
|
-
var
|
|
14292
|
-
var OpenCodeStyleSubagentFrontmatterSchema =
|
|
14293
|
-
description:
|
|
14294
|
-
mode:
|
|
14295
|
-
name:
|
|
14952
|
+
var import_node_path105 = require("path");
|
|
14953
|
+
var import_mini60 = require("zod/mini");
|
|
14954
|
+
var OpenCodeStyleSubagentFrontmatterSchema = import_mini60.z.looseObject({
|
|
14955
|
+
description: import_mini60.z.optional(import_mini60.z.string()),
|
|
14956
|
+
mode: import_mini60.z._default(import_mini60.z.string(), "subagent"),
|
|
14957
|
+
name: import_mini60.z.optional(import_mini60.z.string())
|
|
14296
14958
|
});
|
|
14297
14959
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
14298
14960
|
frontmatter;
|
|
@@ -14302,7 +14964,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14302
14964
|
const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14303
14965
|
if (!result.success) {
|
|
14304
14966
|
throw new Error(
|
|
14305
|
-
`Invalid frontmatter in ${(0,
|
|
14967
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14306
14968
|
);
|
|
14307
14969
|
}
|
|
14308
14970
|
}
|
|
@@ -14322,7 +14984,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14322
14984
|
const { description, mode, name, ...toolSection } = this.frontmatter;
|
|
14323
14985
|
const rulesyncFrontmatter = {
|
|
14324
14986
|
targets: ["*"],
|
|
14325
|
-
name: name ?? (0,
|
|
14987
|
+
name: name ?? (0, import_node_path105.basename)(this.getRelativeFilePath(), ".md"),
|
|
14326
14988
|
description,
|
|
14327
14989
|
[this.getToolTarget()]: { mode, ...toolSection }
|
|
14328
14990
|
};
|
|
@@ -14344,7 +15006,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
14344
15006
|
return {
|
|
14345
15007
|
success: false,
|
|
14346
15008
|
error: new Error(
|
|
14347
|
-
`Invalid frontmatter in ${(0,
|
|
15009
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14348
15010
|
)
|
|
14349
15011
|
};
|
|
14350
15012
|
}
|
|
@@ -14360,7 +15022,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14360
15022
|
global = false
|
|
14361
15023
|
} = {}) {
|
|
14362
15024
|
return {
|
|
14363
|
-
relativeDirPath: global ? (0,
|
|
15025
|
+
relativeDirPath: global ? (0, import_node_path106.join)(".config", "kilo", "agent") : (0, import_node_path106.join)(".kilo", "agent")
|
|
14364
15026
|
};
|
|
14365
15027
|
}
|
|
14366
15028
|
static fromRulesyncSubagent({
|
|
@@ -14404,7 +15066,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14404
15066
|
global = false
|
|
14405
15067
|
}) {
|
|
14406
15068
|
const paths = this.getSettablePaths({ global });
|
|
14407
|
-
const filePath = (0,
|
|
15069
|
+
const filePath = (0, import_node_path106.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14408
15070
|
const fileContent = await readFileContent(filePath);
|
|
14409
15071
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14410
15072
|
const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14440,23 +15102,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
14440
15102
|
};
|
|
14441
15103
|
|
|
14442
15104
|
// src/features/subagents/kiro-subagent.ts
|
|
14443
|
-
var
|
|
14444
|
-
var
|
|
14445
|
-
var KiroCliSubagentJsonSchema =
|
|
14446
|
-
name:
|
|
14447
|
-
description:
|
|
14448
|
-
prompt:
|
|
14449
|
-
tools:
|
|
14450
|
-
toolAliases:
|
|
14451
|
-
toolSettings:
|
|
14452
|
-
toolSchema:
|
|
14453
|
-
hooks:
|
|
14454
|
-
model:
|
|
14455
|
-
mcpServers:
|
|
14456
|
-
useLegacyMcpJson:
|
|
14457
|
-
resources:
|
|
14458
|
-
allowedTools:
|
|
14459
|
-
includeMcpJson:
|
|
15105
|
+
var import_node_path107 = require("path");
|
|
15106
|
+
var import_mini61 = require("zod/mini");
|
|
15107
|
+
var KiroCliSubagentJsonSchema = import_mini61.z.looseObject({
|
|
15108
|
+
name: import_mini61.z.string(),
|
|
15109
|
+
description: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.string())),
|
|
15110
|
+
prompt: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.string())),
|
|
15111
|
+
tools: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.array(import_mini61.z.string()))),
|
|
15112
|
+
toolAliases: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.record(import_mini61.z.string(), import_mini61.z.string()))),
|
|
15113
|
+
toolSettings: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.unknown())),
|
|
15114
|
+
toolSchema: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.unknown())),
|
|
15115
|
+
hooks: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.record(import_mini61.z.string(), import_mini61.z.array(import_mini61.z.unknown())))),
|
|
15116
|
+
model: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.string())),
|
|
15117
|
+
mcpServers: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.record(import_mini61.z.string(), import_mini61.z.unknown()))),
|
|
15118
|
+
useLegacyMcpJson: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.boolean())),
|
|
15119
|
+
resources: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.array(import_mini61.z.string()))),
|
|
15120
|
+
allowedTools: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.array(import_mini61.z.string()))),
|
|
15121
|
+
includeMcpJson: import_mini61.z.optional(import_mini61.z.nullable(import_mini61.z.boolean()))
|
|
14460
15122
|
});
|
|
14461
15123
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
14462
15124
|
body;
|
|
@@ -14467,7 +15129,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14467
15129
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
14468
15130
|
} catch (error) {
|
|
14469
15131
|
throw new Error(
|
|
14470
|
-
`Invalid JSON in ${(0,
|
|
15132
|
+
`Invalid JSON in ${(0, import_node_path107.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
14471
15133
|
{ cause: error }
|
|
14472
15134
|
);
|
|
14473
15135
|
}
|
|
@@ -14479,7 +15141,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14479
15141
|
}
|
|
14480
15142
|
static getSettablePaths(_options = {}) {
|
|
14481
15143
|
return {
|
|
14482
|
-
relativeDirPath: (0,
|
|
15144
|
+
relativeDirPath: (0, import_node_path107.join)(".kiro", "agents")
|
|
14483
15145
|
};
|
|
14484
15146
|
}
|
|
14485
15147
|
getBody() {
|
|
@@ -14491,7 +15153,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14491
15153
|
parsed = JSON.parse(this.body);
|
|
14492
15154
|
} catch (error) {
|
|
14493
15155
|
throw new Error(
|
|
14494
|
-
`Failed to parse JSON in ${(0,
|
|
15156
|
+
`Failed to parse JSON in ${(0, import_node_path107.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
14495
15157
|
{ cause: error }
|
|
14496
15158
|
);
|
|
14497
15159
|
}
|
|
@@ -14572,7 +15234,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14572
15234
|
global = false
|
|
14573
15235
|
}) {
|
|
14574
15236
|
const paths = this.getSettablePaths({ global });
|
|
14575
|
-
const filePath = (0,
|
|
15237
|
+
const filePath = (0, import_node_path107.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14576
15238
|
const fileContent = await readFileContent(filePath);
|
|
14577
15239
|
const subagent = new _KiroSubagent({
|
|
14578
15240
|
baseDir,
|
|
@@ -14610,7 +15272,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
14610
15272
|
};
|
|
14611
15273
|
|
|
14612
15274
|
// src/features/subagents/opencode-subagent.ts
|
|
14613
|
-
var
|
|
15275
|
+
var import_node_path108 = require("path");
|
|
14614
15276
|
var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
|
|
14615
15277
|
var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
14616
15278
|
getToolTarget() {
|
|
@@ -14620,7 +15282,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
14620
15282
|
global = false
|
|
14621
15283
|
} = {}) {
|
|
14622
15284
|
return {
|
|
14623
|
-
relativeDirPath: global ? (0,
|
|
15285
|
+
relativeDirPath: global ? (0, import_node_path108.join)(".config", "opencode", "agent") : (0, import_node_path108.join)(".opencode", "agent")
|
|
14624
15286
|
};
|
|
14625
15287
|
}
|
|
14626
15288
|
static fromRulesyncSubagent({
|
|
@@ -14664,7 +15326,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
14664
15326
|
global = false
|
|
14665
15327
|
}) {
|
|
14666
15328
|
const paths = this.getSettablePaths({ global });
|
|
14667
|
-
const filePath = (0,
|
|
15329
|
+
const filePath = (0, import_node_path108.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14668
15330
|
const fileContent = await readFileContent(filePath);
|
|
14669
15331
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14670
15332
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14717,7 +15379,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
14717
15379
|
"roo",
|
|
14718
15380
|
"rovodev"
|
|
14719
15381
|
];
|
|
14720
|
-
var SubagentsProcessorToolTargetSchema =
|
|
15382
|
+
var SubagentsProcessorToolTargetSchema = import_mini62.z.enum(subagentsProcessorToolTargetTuple);
|
|
14721
15383
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
14722
15384
|
[
|
|
14723
15385
|
"agentsmd",
|
|
@@ -14908,7 +15570,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14908
15570
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
14909
15571
|
*/
|
|
14910
15572
|
async loadRulesyncFiles() {
|
|
14911
|
-
const subagentsDir = (0,
|
|
15573
|
+
const subagentsDir = (0, import_node_path109.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
14912
15574
|
const dirExists = await directoryExists(subagentsDir);
|
|
14913
15575
|
if (!dirExists) {
|
|
14914
15576
|
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -14923,7 +15585,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14923
15585
|
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
14924
15586
|
const rulesyncSubagents = [];
|
|
14925
15587
|
for (const mdFile of mdFiles) {
|
|
14926
|
-
const filepath = (0,
|
|
15588
|
+
const filepath = (0, import_node_path109.join)(subagentsDir, mdFile);
|
|
14927
15589
|
try {
|
|
14928
15590
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
14929
15591
|
relativeFilePath: mdFile,
|
|
@@ -14953,14 +15615,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14953
15615
|
const factory = this.getFactory(this.toolTarget);
|
|
14954
15616
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
14955
15617
|
const subagentFilePaths = await findFilesByGlobs(
|
|
14956
|
-
(0,
|
|
15618
|
+
(0, import_node_path109.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
14957
15619
|
);
|
|
14958
15620
|
if (forDeletion) {
|
|
14959
15621
|
const toolSubagents2 = subagentFilePaths.map(
|
|
14960
15622
|
(path3) => factory.class.forDeletion({
|
|
14961
15623
|
baseDir: this.baseDir,
|
|
14962
15624
|
relativeDirPath: paths.relativeDirPath,
|
|
14963
|
-
relativeFilePath: (0,
|
|
15625
|
+
relativeFilePath: (0, import_node_path109.basename)(path3),
|
|
14964
15626
|
global: this.global
|
|
14965
15627
|
})
|
|
14966
15628
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -14973,7 +15635,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
14973
15635
|
subagentFilePaths.map(
|
|
14974
15636
|
(path3) => factory.class.fromFile({
|
|
14975
15637
|
baseDir: this.baseDir,
|
|
14976
|
-
relativeFilePath: (0,
|
|
15638
|
+
relativeFilePath: (0, import_node_path109.basename)(path3),
|
|
14977
15639
|
global: this.global
|
|
14978
15640
|
})
|
|
14979
15641
|
)
|
|
@@ -15020,49 +15682,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
15020
15682
|
};
|
|
15021
15683
|
|
|
15022
15684
|
// src/features/rules/agentsmd-rule.ts
|
|
15023
|
-
var
|
|
15685
|
+
var import_node_path112 = require("path");
|
|
15024
15686
|
|
|
15025
15687
|
// src/features/rules/tool-rule.ts
|
|
15026
|
-
var
|
|
15688
|
+
var import_node_path111 = require("path");
|
|
15027
15689
|
|
|
15028
15690
|
// src/features/rules/rulesync-rule.ts
|
|
15029
|
-
var
|
|
15030
|
-
var
|
|
15031
|
-
var RulesyncRuleFrontmatterSchema =
|
|
15032
|
-
root:
|
|
15033
|
-
localRoot:
|
|
15034
|
-
targets:
|
|
15035
|
-
description:
|
|
15036
|
-
globs:
|
|
15037
|
-
agentsmd:
|
|
15038
|
-
|
|
15691
|
+
var import_node_path110 = require("path");
|
|
15692
|
+
var import_mini63 = require("zod/mini");
|
|
15693
|
+
var RulesyncRuleFrontmatterSchema = import_mini63.z.object({
|
|
15694
|
+
root: import_mini63.z.optional(import_mini63.z.boolean()),
|
|
15695
|
+
localRoot: import_mini63.z.optional(import_mini63.z.boolean()),
|
|
15696
|
+
targets: import_mini63.z._default(RulesyncTargetsSchema, ["*"]),
|
|
15697
|
+
description: import_mini63.z.optional(import_mini63.z.string()),
|
|
15698
|
+
globs: import_mini63.z.optional(import_mini63.z.array(import_mini63.z.string())),
|
|
15699
|
+
agentsmd: import_mini63.z.optional(
|
|
15700
|
+
import_mini63.z.looseObject({
|
|
15039
15701
|
// @example "path/to/subproject"
|
|
15040
|
-
subprojectPath:
|
|
15702
|
+
subprojectPath: import_mini63.z.optional(import_mini63.z.string())
|
|
15041
15703
|
})
|
|
15042
15704
|
),
|
|
15043
|
-
claudecode:
|
|
15044
|
-
|
|
15705
|
+
claudecode: import_mini63.z.optional(
|
|
15706
|
+
import_mini63.z.looseObject({
|
|
15045
15707
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
15046
15708
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
15047
|
-
paths:
|
|
15709
|
+
paths: import_mini63.z.optional(import_mini63.z.array(import_mini63.z.string()))
|
|
15048
15710
|
})
|
|
15049
15711
|
),
|
|
15050
|
-
cursor:
|
|
15051
|
-
|
|
15052
|
-
alwaysApply:
|
|
15053
|
-
description:
|
|
15054
|
-
globs:
|
|
15712
|
+
cursor: import_mini63.z.optional(
|
|
15713
|
+
import_mini63.z.looseObject({
|
|
15714
|
+
alwaysApply: import_mini63.z.optional(import_mini63.z.boolean()),
|
|
15715
|
+
description: import_mini63.z.optional(import_mini63.z.string()),
|
|
15716
|
+
globs: import_mini63.z.optional(import_mini63.z.array(import_mini63.z.string()))
|
|
15055
15717
|
})
|
|
15056
15718
|
),
|
|
15057
|
-
copilot:
|
|
15058
|
-
|
|
15059
|
-
excludeAgent:
|
|
15719
|
+
copilot: import_mini63.z.optional(
|
|
15720
|
+
import_mini63.z.looseObject({
|
|
15721
|
+
excludeAgent: import_mini63.z.optional(import_mini63.z.union([import_mini63.z.literal("code-review"), import_mini63.z.literal("coding-agent")]))
|
|
15060
15722
|
})
|
|
15061
15723
|
),
|
|
15062
|
-
antigravity:
|
|
15063
|
-
|
|
15064
|
-
trigger:
|
|
15065
|
-
globs:
|
|
15724
|
+
antigravity: import_mini63.z.optional(
|
|
15725
|
+
import_mini63.z.looseObject({
|
|
15726
|
+
trigger: import_mini63.z.optional(import_mini63.z.string()),
|
|
15727
|
+
globs: import_mini63.z.optional(import_mini63.z.array(import_mini63.z.string()))
|
|
15066
15728
|
})
|
|
15067
15729
|
)
|
|
15068
15730
|
});
|
|
@@ -15073,7 +15735,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
15073
15735
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15074
15736
|
if (!parseResult.success && rest.validate !== false) {
|
|
15075
15737
|
throw new Error(
|
|
15076
|
-
`Invalid frontmatter in ${(0,
|
|
15738
|
+
`Invalid frontmatter in ${(0, import_node_path110.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
15077
15739
|
);
|
|
15078
15740
|
}
|
|
15079
15741
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -15108,7 +15770,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
15108
15770
|
return {
|
|
15109
15771
|
success: false,
|
|
15110
15772
|
error: new Error(
|
|
15111
|
-
`Invalid frontmatter in ${(0,
|
|
15773
|
+
`Invalid frontmatter in ${(0, import_node_path110.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15112
15774
|
)
|
|
15113
15775
|
};
|
|
15114
15776
|
}
|
|
@@ -15117,7 +15779,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
15117
15779
|
relativeFilePath,
|
|
15118
15780
|
validate = true
|
|
15119
15781
|
}) {
|
|
15120
|
-
const filePath = (0,
|
|
15782
|
+
const filePath = (0, import_node_path110.join)(
|
|
15121
15783
|
process.cwd(),
|
|
15122
15784
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
15123
15785
|
relativeFilePath
|
|
@@ -15216,7 +15878,7 @@ var ToolRule = class extends ToolFile {
|
|
|
15216
15878
|
rulesyncRule,
|
|
15217
15879
|
validate = true,
|
|
15218
15880
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
15219
|
-
nonRootPath = { relativeDirPath: (0,
|
|
15881
|
+
nonRootPath = { relativeDirPath: (0, import_node_path111.join)(".agents", "memories") }
|
|
15220
15882
|
}) {
|
|
15221
15883
|
const params = this.buildToolRuleParamsDefault({
|
|
15222
15884
|
baseDir,
|
|
@@ -15227,7 +15889,7 @@ var ToolRule = class extends ToolFile {
|
|
|
15227
15889
|
});
|
|
15228
15890
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
15229
15891
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
15230
|
-
params.relativeDirPath = (0,
|
|
15892
|
+
params.relativeDirPath = (0, import_node_path111.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
15231
15893
|
params.relativeFilePath = "AGENTS.md";
|
|
15232
15894
|
}
|
|
15233
15895
|
return params;
|
|
@@ -15276,7 +15938,7 @@ var ToolRule = class extends ToolFile {
|
|
|
15276
15938
|
}
|
|
15277
15939
|
};
|
|
15278
15940
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
15279
|
-
return excludeToolDir ? subDir : (0,
|
|
15941
|
+
return excludeToolDir ? subDir : (0, import_node_path111.join)(toolDir, subDir);
|
|
15280
15942
|
}
|
|
15281
15943
|
|
|
15282
15944
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -15305,8 +15967,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
15305
15967
|
validate = true
|
|
15306
15968
|
}) {
|
|
15307
15969
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
15308
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
15309
|
-
const fileContent = await readFileContent((0,
|
|
15970
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path112.join)(".agents", "memories", relativeFilePath);
|
|
15971
|
+
const fileContent = await readFileContent((0, import_node_path112.join)(baseDir, relativePath));
|
|
15310
15972
|
return new _AgentsMdRule({
|
|
15311
15973
|
baseDir,
|
|
15312
15974
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -15361,21 +16023,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
15361
16023
|
};
|
|
15362
16024
|
|
|
15363
16025
|
// src/features/rules/antigravity-rule.ts
|
|
15364
|
-
var
|
|
15365
|
-
var
|
|
15366
|
-
var AntigravityRuleFrontmatterSchema =
|
|
15367
|
-
trigger:
|
|
15368
|
-
|
|
15369
|
-
|
|
15370
|
-
|
|
15371
|
-
|
|
15372
|
-
|
|
15373
|
-
|
|
16026
|
+
var import_node_path113 = require("path");
|
|
16027
|
+
var import_mini64 = require("zod/mini");
|
|
16028
|
+
var AntigravityRuleFrontmatterSchema = import_mini64.z.looseObject({
|
|
16029
|
+
trigger: import_mini64.z.optional(
|
|
16030
|
+
import_mini64.z.union([
|
|
16031
|
+
import_mini64.z.literal("always_on"),
|
|
16032
|
+
import_mini64.z.literal("glob"),
|
|
16033
|
+
import_mini64.z.literal("manual"),
|
|
16034
|
+
import_mini64.z.literal("model_decision"),
|
|
16035
|
+
import_mini64.z.string()
|
|
15374
16036
|
// accepts any string for forward compatibility
|
|
15375
16037
|
])
|
|
15376
16038
|
),
|
|
15377
|
-
globs:
|
|
15378
|
-
description:
|
|
16039
|
+
globs: import_mini64.z.optional(import_mini64.z.string()),
|
|
16040
|
+
description: import_mini64.z.optional(import_mini64.z.string())
|
|
15379
16041
|
});
|
|
15380
16042
|
function parseGlobsString(globs) {
|
|
15381
16043
|
if (!globs) {
|
|
@@ -15520,7 +16182,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15520
16182
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
15521
16183
|
if (!result.success) {
|
|
15522
16184
|
throw new Error(
|
|
15523
|
-
`Invalid frontmatter in ${(0,
|
|
16185
|
+
`Invalid frontmatter in ${(0, import_node_path113.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15524
16186
|
);
|
|
15525
16187
|
}
|
|
15526
16188
|
}
|
|
@@ -15544,7 +16206,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15544
16206
|
relativeFilePath,
|
|
15545
16207
|
validate = true
|
|
15546
16208
|
}) {
|
|
15547
|
-
const filePath = (0,
|
|
16209
|
+
const filePath = (0, import_node_path113.join)(
|
|
15548
16210
|
baseDir,
|
|
15549
16211
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
15550
16212
|
relativeFilePath
|
|
@@ -15684,7 +16346,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
15684
16346
|
};
|
|
15685
16347
|
|
|
15686
16348
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
15687
|
-
var
|
|
16349
|
+
var import_node_path114 = require("path");
|
|
15688
16350
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
15689
16351
|
toRulesyncRule() {
|
|
15690
16352
|
const rulesyncFrontmatter = {
|
|
@@ -15744,8 +16406,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
15744
16406
|
}) {
|
|
15745
16407
|
const settablePaths = this.getSettablePaths();
|
|
15746
16408
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
15747
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
15748
|
-
const fileContent = await readFileContent((0,
|
|
16409
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path114.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16410
|
+
const fileContent = await readFileContent((0, import_node_path114.join)(baseDir, relativePath));
|
|
15749
16411
|
return new _AugmentcodeLegacyRule({
|
|
15750
16412
|
baseDir,
|
|
15751
16413
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -15774,7 +16436,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
15774
16436
|
};
|
|
15775
16437
|
|
|
15776
16438
|
// src/features/rules/augmentcode-rule.ts
|
|
15777
|
-
var
|
|
16439
|
+
var import_node_path115 = require("path");
|
|
15778
16440
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
15779
16441
|
toRulesyncRule() {
|
|
15780
16442
|
return this.toRulesyncRuleDefault();
|
|
@@ -15805,7 +16467,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
15805
16467
|
relativeFilePath,
|
|
15806
16468
|
validate = true
|
|
15807
16469
|
}) {
|
|
15808
|
-
const filePath = (0,
|
|
16470
|
+
const filePath = (0, import_node_path115.join)(
|
|
15809
16471
|
baseDir,
|
|
15810
16472
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
15811
16473
|
relativeFilePath
|
|
@@ -15845,7 +16507,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
15845
16507
|
};
|
|
15846
16508
|
|
|
15847
16509
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
15848
|
-
var
|
|
16510
|
+
var import_node_path116 = require("path");
|
|
15849
16511
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
15850
16512
|
static getSettablePaths({
|
|
15851
16513
|
global,
|
|
@@ -15887,7 +16549,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15887
16549
|
if (isRoot) {
|
|
15888
16550
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
15889
16551
|
const fileContent2 = await readFileContent(
|
|
15890
|
-
(0,
|
|
16552
|
+
(0, import_node_path116.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
15891
16553
|
);
|
|
15892
16554
|
return new _ClaudecodeLegacyRule({
|
|
15893
16555
|
baseDir,
|
|
@@ -15901,8 +16563,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15901
16563
|
if (!paths.nonRoot) {
|
|
15902
16564
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
15903
16565
|
}
|
|
15904
|
-
const relativePath = (0,
|
|
15905
|
-
const fileContent = await readFileContent((0,
|
|
16566
|
+
const relativePath = (0, import_node_path116.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16567
|
+
const fileContent = await readFileContent((0, import_node_path116.join)(baseDir, relativePath));
|
|
15906
16568
|
return new _ClaudecodeLegacyRule({
|
|
15907
16569
|
baseDir,
|
|
15908
16570
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -15961,10 +16623,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
15961
16623
|
};
|
|
15962
16624
|
|
|
15963
16625
|
// src/features/rules/claudecode-rule.ts
|
|
15964
|
-
var
|
|
15965
|
-
var
|
|
15966
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
15967
|
-
paths:
|
|
16626
|
+
var import_node_path117 = require("path");
|
|
16627
|
+
var import_mini65 = require("zod/mini");
|
|
16628
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini65.z.object({
|
|
16629
|
+
paths: import_mini65.z.optional(import_mini65.z.array(import_mini65.z.string()))
|
|
15968
16630
|
});
|
|
15969
16631
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
15970
16632
|
frontmatter;
|
|
@@ -16002,7 +16664,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
16002
16664
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16003
16665
|
if (!result.success) {
|
|
16004
16666
|
throw new Error(
|
|
16005
|
-
`Invalid frontmatter in ${(0,
|
|
16667
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16006
16668
|
);
|
|
16007
16669
|
}
|
|
16008
16670
|
}
|
|
@@ -16032,7 +16694,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
16032
16694
|
if (isRoot) {
|
|
16033
16695
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
16034
16696
|
const fileContent2 = await readFileContent(
|
|
16035
|
-
(0,
|
|
16697
|
+
(0, import_node_path117.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
16036
16698
|
);
|
|
16037
16699
|
return new _ClaudecodeRule({
|
|
16038
16700
|
baseDir,
|
|
@@ -16047,8 +16709,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
16047
16709
|
if (!paths.nonRoot) {
|
|
16048
16710
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16049
16711
|
}
|
|
16050
|
-
const relativePath = (0,
|
|
16051
|
-
const filePath = (0,
|
|
16712
|
+
const relativePath = (0, import_node_path117.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16713
|
+
const filePath = (0, import_node_path117.join)(baseDir, relativePath);
|
|
16052
16714
|
const fileContent = await readFileContent(filePath);
|
|
16053
16715
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16054
16716
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16159,7 +16821,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
16159
16821
|
return {
|
|
16160
16822
|
success: false,
|
|
16161
16823
|
error: new Error(
|
|
16162
|
-
`Invalid frontmatter in ${(0,
|
|
16824
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16163
16825
|
)
|
|
16164
16826
|
};
|
|
16165
16827
|
}
|
|
@@ -16179,10 +16841,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
16179
16841
|
};
|
|
16180
16842
|
|
|
16181
16843
|
// src/features/rules/cline-rule.ts
|
|
16182
|
-
var
|
|
16183
|
-
var
|
|
16184
|
-
var ClineRuleFrontmatterSchema =
|
|
16185
|
-
description:
|
|
16844
|
+
var import_node_path118 = require("path");
|
|
16845
|
+
var import_mini66 = require("zod/mini");
|
|
16846
|
+
var ClineRuleFrontmatterSchema = import_mini66.z.object({
|
|
16847
|
+
description: import_mini66.z.string()
|
|
16186
16848
|
});
|
|
16187
16849
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
16188
16850
|
static getSettablePaths(_options = {}) {
|
|
@@ -16225,7 +16887,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
16225
16887
|
validate = true
|
|
16226
16888
|
}) {
|
|
16227
16889
|
const fileContent = await readFileContent(
|
|
16228
|
-
(0,
|
|
16890
|
+
(0, import_node_path118.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
16229
16891
|
);
|
|
16230
16892
|
return new _ClineRule({
|
|
16231
16893
|
baseDir,
|
|
@@ -16251,7 +16913,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
16251
16913
|
};
|
|
16252
16914
|
|
|
16253
16915
|
// src/features/rules/codexcli-rule.ts
|
|
16254
|
-
var
|
|
16916
|
+
var import_node_path119 = require("path");
|
|
16255
16917
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
16256
16918
|
static getSettablePaths({
|
|
16257
16919
|
global,
|
|
@@ -16286,7 +16948,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16286
16948
|
if (isRoot) {
|
|
16287
16949
|
const relativePath2 = paths.root.relativeFilePath;
|
|
16288
16950
|
const fileContent2 = await readFileContent(
|
|
16289
|
-
(0,
|
|
16951
|
+
(0, import_node_path119.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
16290
16952
|
);
|
|
16291
16953
|
return new _CodexcliRule({
|
|
16292
16954
|
baseDir,
|
|
@@ -16300,8 +16962,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16300
16962
|
if (!paths.nonRoot) {
|
|
16301
16963
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16302
16964
|
}
|
|
16303
|
-
const relativePath = (0,
|
|
16304
|
-
const fileContent = await readFileContent((0,
|
|
16965
|
+
const relativePath = (0, import_node_path119.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
16966
|
+
const fileContent = await readFileContent((0, import_node_path119.join)(baseDir, relativePath));
|
|
16305
16967
|
return new _CodexcliRule({
|
|
16306
16968
|
baseDir,
|
|
16307
16969
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -16360,12 +17022,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
16360
17022
|
};
|
|
16361
17023
|
|
|
16362
17024
|
// src/features/rules/copilot-rule.ts
|
|
16363
|
-
var
|
|
16364
|
-
var
|
|
16365
|
-
var CopilotRuleFrontmatterSchema =
|
|
16366
|
-
description:
|
|
16367
|
-
applyTo:
|
|
16368
|
-
excludeAgent:
|
|
17025
|
+
var import_node_path120 = require("path");
|
|
17026
|
+
var import_mini67 = require("zod/mini");
|
|
17027
|
+
var CopilotRuleFrontmatterSchema = import_mini67.z.object({
|
|
17028
|
+
description: import_mini67.z.optional(import_mini67.z.string()),
|
|
17029
|
+
applyTo: import_mini67.z.optional(import_mini67.z.string()),
|
|
17030
|
+
excludeAgent: import_mini67.z.optional(import_mini67.z.union([import_mini67.z.literal("code-review"), import_mini67.z.literal("coding-agent")]))
|
|
16369
17031
|
});
|
|
16370
17032
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
16371
17033
|
frontmatter;
|
|
@@ -16397,7 +17059,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16397
17059
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16398
17060
|
if (!result.success) {
|
|
16399
17061
|
throw new Error(
|
|
16400
|
-
`Invalid frontmatter in ${(0,
|
|
17062
|
+
`Invalid frontmatter in ${(0, import_node_path120.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16401
17063
|
);
|
|
16402
17064
|
}
|
|
16403
17065
|
}
|
|
@@ -16487,8 +17149,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16487
17149
|
const paths = this.getSettablePaths({ global });
|
|
16488
17150
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
16489
17151
|
if (isRoot) {
|
|
16490
|
-
const relativePath2 = (0,
|
|
16491
|
-
const filePath2 = (0,
|
|
17152
|
+
const relativePath2 = (0, import_node_path120.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
17153
|
+
const filePath2 = (0, import_node_path120.join)(baseDir, relativePath2);
|
|
16492
17154
|
const fileContent2 = await readFileContent(filePath2);
|
|
16493
17155
|
return new _CopilotRule({
|
|
16494
17156
|
baseDir,
|
|
@@ -16503,8 +17165,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16503
17165
|
if (!paths.nonRoot) {
|
|
16504
17166
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16505
17167
|
}
|
|
16506
|
-
const relativePath = (0,
|
|
16507
|
-
const filePath = (0,
|
|
17168
|
+
const relativePath = (0, import_node_path120.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17169
|
+
const filePath = (0, import_node_path120.join)(baseDir, relativePath);
|
|
16508
17170
|
const fileContent = await readFileContent(filePath);
|
|
16509
17171
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16510
17172
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16550,7 +17212,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
16550
17212
|
return {
|
|
16551
17213
|
success: false,
|
|
16552
17214
|
error: new Error(
|
|
16553
|
-
`Invalid frontmatter in ${(0,
|
|
17215
|
+
`Invalid frontmatter in ${(0, import_node_path120.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16554
17216
|
)
|
|
16555
17217
|
};
|
|
16556
17218
|
}
|
|
@@ -16606,12 +17268,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
16606
17268
|
};
|
|
16607
17269
|
|
|
16608
17270
|
// src/features/rules/cursor-rule.ts
|
|
16609
|
-
var
|
|
16610
|
-
var
|
|
16611
|
-
var CursorRuleFrontmatterSchema =
|
|
16612
|
-
description:
|
|
16613
|
-
globs:
|
|
16614
|
-
alwaysApply:
|
|
17271
|
+
var import_node_path121 = require("path");
|
|
17272
|
+
var import_mini68 = require("zod/mini");
|
|
17273
|
+
var CursorRuleFrontmatterSchema = import_mini68.z.object({
|
|
17274
|
+
description: import_mini68.z.optional(import_mini68.z.string()),
|
|
17275
|
+
globs: import_mini68.z.optional(import_mini68.z.string()),
|
|
17276
|
+
alwaysApply: import_mini68.z.optional(import_mini68.z.boolean())
|
|
16615
17277
|
});
|
|
16616
17278
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
16617
17279
|
frontmatter;
|
|
@@ -16628,7 +17290,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16628
17290
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16629
17291
|
if (!result.success) {
|
|
16630
17292
|
throw new Error(
|
|
16631
|
-
`Invalid frontmatter in ${(0,
|
|
17293
|
+
`Invalid frontmatter in ${(0, import_node_path121.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
16632
17294
|
);
|
|
16633
17295
|
}
|
|
16634
17296
|
}
|
|
@@ -16744,7 +17406,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16744
17406
|
relativeFilePath,
|
|
16745
17407
|
validate = true
|
|
16746
17408
|
}) {
|
|
16747
|
-
const filePath = (0,
|
|
17409
|
+
const filePath = (0, import_node_path121.join)(
|
|
16748
17410
|
baseDir,
|
|
16749
17411
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
16750
17412
|
relativeFilePath
|
|
@@ -16754,7 +17416,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16754
17416
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16755
17417
|
if (!result.success) {
|
|
16756
17418
|
throw new Error(
|
|
16757
|
-
`Invalid frontmatter in ${(0,
|
|
17419
|
+
`Invalid frontmatter in ${(0, import_node_path121.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
16758
17420
|
);
|
|
16759
17421
|
}
|
|
16760
17422
|
return new _CursorRule({
|
|
@@ -16791,7 +17453,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16791
17453
|
return {
|
|
16792
17454
|
success: false,
|
|
16793
17455
|
error: new Error(
|
|
16794
|
-
`Invalid frontmatter in ${(0,
|
|
17456
|
+
`Invalid frontmatter in ${(0, import_node_path121.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16795
17457
|
)
|
|
16796
17458
|
};
|
|
16797
17459
|
}
|
|
@@ -16811,7 +17473,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
16811
17473
|
};
|
|
16812
17474
|
|
|
16813
17475
|
// src/features/rules/deepagents-rule.ts
|
|
16814
|
-
var
|
|
17476
|
+
var import_node_path122 = require("path");
|
|
16815
17477
|
var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
16816
17478
|
constructor({ fileContent, root, ...rest }) {
|
|
16817
17479
|
super({
|
|
@@ -16838,8 +17500,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
16838
17500
|
}) {
|
|
16839
17501
|
const settablePaths = this.getSettablePaths();
|
|
16840
17502
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
16841
|
-
const relativePath = isRoot ? (0,
|
|
16842
|
-
const fileContent = await readFileContent((0,
|
|
17503
|
+
const relativePath = isRoot ? (0, import_node_path122.join)(".deepagents", "AGENTS.md") : (0, import_node_path122.join)(".deepagents", "memories", relativeFilePath);
|
|
17504
|
+
const fileContent = await readFileContent((0, import_node_path122.join)(baseDir, relativePath));
|
|
16843
17505
|
return new _DeepagentsRule({
|
|
16844
17506
|
baseDir,
|
|
16845
17507
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -16894,7 +17556,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
16894
17556
|
};
|
|
16895
17557
|
|
|
16896
17558
|
// src/features/rules/factorydroid-rule.ts
|
|
16897
|
-
var
|
|
17559
|
+
var import_node_path123 = require("path");
|
|
16898
17560
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
16899
17561
|
constructor({ fileContent, root, ...rest }) {
|
|
16900
17562
|
super({
|
|
@@ -16934,8 +17596,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16934
17596
|
const paths = this.getSettablePaths({ global });
|
|
16935
17597
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
16936
17598
|
if (isRoot) {
|
|
16937
|
-
const relativePath2 = (0,
|
|
16938
|
-
const fileContent2 = await readFileContent((0,
|
|
17599
|
+
const relativePath2 = (0, import_node_path123.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
17600
|
+
const fileContent2 = await readFileContent((0, import_node_path123.join)(baseDir, relativePath2));
|
|
16939
17601
|
return new _FactorydroidRule({
|
|
16940
17602
|
baseDir,
|
|
16941
17603
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -16948,8 +17610,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
16948
17610
|
if (!paths.nonRoot) {
|
|
16949
17611
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
16950
17612
|
}
|
|
16951
|
-
const relativePath = (0,
|
|
16952
|
-
const fileContent = await readFileContent((0,
|
|
17613
|
+
const relativePath = (0, import_node_path123.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17614
|
+
const fileContent = await readFileContent((0, import_node_path123.join)(baseDir, relativePath));
|
|
16953
17615
|
return new _FactorydroidRule({
|
|
16954
17616
|
baseDir,
|
|
16955
17617
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17008,7 +17670,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
17008
17670
|
};
|
|
17009
17671
|
|
|
17010
17672
|
// src/features/rules/geminicli-rule.ts
|
|
17011
|
-
var
|
|
17673
|
+
var import_node_path124 = require("path");
|
|
17012
17674
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
17013
17675
|
static getSettablePaths({
|
|
17014
17676
|
global,
|
|
@@ -17043,7 +17705,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
17043
17705
|
if (isRoot) {
|
|
17044
17706
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17045
17707
|
const fileContent2 = await readFileContent(
|
|
17046
|
-
(0,
|
|
17708
|
+
(0, import_node_path124.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17047
17709
|
);
|
|
17048
17710
|
return new _GeminiCliRule({
|
|
17049
17711
|
baseDir,
|
|
@@ -17057,8 +17719,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
17057
17719
|
if (!paths.nonRoot) {
|
|
17058
17720
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17059
17721
|
}
|
|
17060
|
-
const relativePath = (0,
|
|
17061
|
-
const fileContent = await readFileContent((0,
|
|
17722
|
+
const relativePath = (0, import_node_path124.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17723
|
+
const fileContent = await readFileContent((0, import_node_path124.join)(baseDir, relativePath));
|
|
17062
17724
|
return new _GeminiCliRule({
|
|
17063
17725
|
baseDir,
|
|
17064
17726
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17117,7 +17779,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
17117
17779
|
};
|
|
17118
17780
|
|
|
17119
17781
|
// src/features/rules/goose-rule.ts
|
|
17120
|
-
var
|
|
17782
|
+
var import_node_path125 = require("path");
|
|
17121
17783
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
17122
17784
|
static getSettablePaths({
|
|
17123
17785
|
global,
|
|
@@ -17152,7 +17814,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
17152
17814
|
if (isRoot) {
|
|
17153
17815
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17154
17816
|
const fileContent2 = await readFileContent(
|
|
17155
|
-
(0,
|
|
17817
|
+
(0, import_node_path125.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17156
17818
|
);
|
|
17157
17819
|
return new _GooseRule({
|
|
17158
17820
|
baseDir,
|
|
@@ -17166,8 +17828,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
17166
17828
|
if (!paths.nonRoot) {
|
|
17167
17829
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17168
17830
|
}
|
|
17169
|
-
const relativePath = (0,
|
|
17170
|
-
const fileContent = await readFileContent((0,
|
|
17831
|
+
const relativePath = (0, import_node_path125.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17832
|
+
const fileContent = await readFileContent((0, import_node_path125.join)(baseDir, relativePath));
|
|
17171
17833
|
return new _GooseRule({
|
|
17172
17834
|
baseDir,
|
|
17173
17835
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17226,7 +17888,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
17226
17888
|
};
|
|
17227
17889
|
|
|
17228
17890
|
// src/features/rules/junie-rule.ts
|
|
17229
|
-
var
|
|
17891
|
+
var import_node_path126 = require("path");
|
|
17230
17892
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
17231
17893
|
static getSettablePaths(_options = {}) {
|
|
17232
17894
|
return {
|
|
@@ -17255,8 +17917,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
17255
17917
|
}) {
|
|
17256
17918
|
const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
|
|
17257
17919
|
const settablePaths = this.getSettablePaths();
|
|
17258
|
-
const relativePath = isRoot ? (0,
|
|
17259
|
-
const fileContent = await readFileContent((0,
|
|
17920
|
+
const relativePath = isRoot ? (0, import_node_path126.join)(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : (0, import_node_path126.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17921
|
+
const fileContent = await readFileContent((0, import_node_path126.join)(baseDir, relativePath));
|
|
17260
17922
|
return new _JunieRule({
|
|
17261
17923
|
baseDir,
|
|
17262
17924
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -17311,7 +17973,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
17311
17973
|
};
|
|
17312
17974
|
|
|
17313
17975
|
// src/features/rules/kilo-rule.ts
|
|
17314
|
-
var
|
|
17976
|
+
var import_node_path127 = require("path");
|
|
17315
17977
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
17316
17978
|
static getSettablePaths({
|
|
17317
17979
|
global,
|
|
@@ -17346,7 +18008,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17346
18008
|
if (isRoot) {
|
|
17347
18009
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17348
18010
|
const fileContent2 = await readFileContent(
|
|
17349
|
-
(0,
|
|
18011
|
+
(0, import_node_path127.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17350
18012
|
);
|
|
17351
18013
|
return new _KiloRule({
|
|
17352
18014
|
baseDir,
|
|
@@ -17360,8 +18022,8 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17360
18022
|
if (!paths.nonRoot) {
|
|
17361
18023
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17362
18024
|
}
|
|
17363
|
-
const relativePath = (0,
|
|
17364
|
-
const fileContent = await readFileContent((0,
|
|
18025
|
+
const relativePath = (0, import_node_path127.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
18026
|
+
const fileContent = await readFileContent((0, import_node_path127.join)(baseDir, relativePath));
|
|
17365
18027
|
return new _KiloRule({
|
|
17366
18028
|
baseDir,
|
|
17367
18029
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17420,7 +18082,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
17420
18082
|
};
|
|
17421
18083
|
|
|
17422
18084
|
// src/features/rules/kiro-rule.ts
|
|
17423
|
-
var
|
|
18085
|
+
var import_node_path128 = require("path");
|
|
17424
18086
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
17425
18087
|
static getSettablePaths(_options = {}) {
|
|
17426
18088
|
return {
|
|
@@ -17435,7 +18097,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
17435
18097
|
validate = true
|
|
17436
18098
|
}) {
|
|
17437
18099
|
const fileContent = await readFileContent(
|
|
17438
|
-
(0,
|
|
18100
|
+
(0, import_node_path128.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17439
18101
|
);
|
|
17440
18102
|
return new _KiroRule({
|
|
17441
18103
|
baseDir,
|
|
@@ -17489,7 +18151,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
17489
18151
|
};
|
|
17490
18152
|
|
|
17491
18153
|
// src/features/rules/opencode-rule.ts
|
|
17492
|
-
var
|
|
18154
|
+
var import_node_path129 = require("path");
|
|
17493
18155
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
17494
18156
|
static getSettablePaths({
|
|
17495
18157
|
global,
|
|
@@ -17524,7 +18186,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17524
18186
|
if (isRoot) {
|
|
17525
18187
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17526
18188
|
const fileContent2 = await readFileContent(
|
|
17527
|
-
(0,
|
|
18189
|
+
(0, import_node_path129.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17528
18190
|
);
|
|
17529
18191
|
return new _OpenCodeRule({
|
|
17530
18192
|
baseDir,
|
|
@@ -17538,8 +18200,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17538
18200
|
if (!paths.nonRoot) {
|
|
17539
18201
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17540
18202
|
}
|
|
17541
|
-
const relativePath = (0,
|
|
17542
|
-
const fileContent = await readFileContent((0,
|
|
18203
|
+
const relativePath = (0, import_node_path129.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
18204
|
+
const fileContent = await readFileContent((0, import_node_path129.join)(baseDir, relativePath));
|
|
17543
18205
|
return new _OpenCodeRule({
|
|
17544
18206
|
baseDir,
|
|
17545
18207
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17598,7 +18260,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
17598
18260
|
};
|
|
17599
18261
|
|
|
17600
18262
|
// src/features/rules/qwencode-rule.ts
|
|
17601
|
-
var
|
|
18263
|
+
var import_node_path130 = require("path");
|
|
17602
18264
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
17603
18265
|
static getSettablePaths(_options = {}) {
|
|
17604
18266
|
return {
|
|
@@ -17617,8 +18279,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
17617
18279
|
validate = true
|
|
17618
18280
|
}) {
|
|
17619
18281
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
17620
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
17621
|
-
const fileContent = await readFileContent((0,
|
|
18282
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path130.join)(".qwen", "memories", relativeFilePath);
|
|
18283
|
+
const fileContent = await readFileContent((0, import_node_path130.join)(baseDir, relativePath));
|
|
17622
18284
|
return new _QwencodeRule({
|
|
17623
18285
|
baseDir,
|
|
17624
18286
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -17670,7 +18332,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
17670
18332
|
};
|
|
17671
18333
|
|
|
17672
18334
|
// src/features/rules/replit-rule.ts
|
|
17673
|
-
var
|
|
18335
|
+
var import_node_path131 = require("path");
|
|
17674
18336
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
17675
18337
|
static getSettablePaths(_options = {}) {
|
|
17676
18338
|
return {
|
|
@@ -17692,7 +18354,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
17692
18354
|
}
|
|
17693
18355
|
const relativePath = paths.root.relativeFilePath;
|
|
17694
18356
|
const fileContent = await readFileContent(
|
|
17695
|
-
(0,
|
|
18357
|
+
(0, import_node_path131.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
17696
18358
|
);
|
|
17697
18359
|
return new _ReplitRule({
|
|
17698
18360
|
baseDir,
|
|
@@ -17758,7 +18420,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
17758
18420
|
};
|
|
17759
18421
|
|
|
17760
18422
|
// src/features/rules/roo-rule.ts
|
|
17761
|
-
var
|
|
18423
|
+
var import_node_path132 = require("path");
|
|
17762
18424
|
var RooRule = class _RooRule extends ToolRule {
|
|
17763
18425
|
static getSettablePaths(_options = {}) {
|
|
17764
18426
|
return {
|
|
@@ -17773,7 +18435,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
17773
18435
|
validate = true
|
|
17774
18436
|
}) {
|
|
17775
18437
|
const fileContent = await readFileContent(
|
|
17776
|
-
(0,
|
|
18438
|
+
(0, import_node_path132.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17777
18439
|
);
|
|
17778
18440
|
return new _RooRule({
|
|
17779
18441
|
baseDir,
|
|
@@ -17842,7 +18504,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
17842
18504
|
};
|
|
17843
18505
|
|
|
17844
18506
|
// src/features/rules/rovodev-rule.ts
|
|
17845
|
-
var
|
|
18507
|
+
var import_node_path133 = require("path");
|
|
17846
18508
|
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
17847
18509
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
17848
18510
|
/**
|
|
@@ -17886,7 +18548,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17886
18548
|
root: rovodevAgents,
|
|
17887
18549
|
alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
|
|
17888
18550
|
nonRoot: {
|
|
17889
|
-
relativeDirPath: (0,
|
|
18551
|
+
relativeDirPath: (0, import_node_path133.join)(".rovodev", ".rulesync", "modular-rules")
|
|
17890
18552
|
}
|
|
17891
18553
|
};
|
|
17892
18554
|
}
|
|
@@ -17925,10 +18587,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17925
18587
|
}) {
|
|
17926
18588
|
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
17927
18589
|
throw new Error(
|
|
17928
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0,
|
|
18590
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0, import_node_path133.join)(relativeDirPath, relativeFilePath)}`
|
|
17929
18591
|
);
|
|
17930
18592
|
}
|
|
17931
|
-
const fileContent = await readFileContent((0,
|
|
18593
|
+
const fileContent = await readFileContent((0, import_node_path133.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
17932
18594
|
return new _RovodevRule({
|
|
17933
18595
|
baseDir,
|
|
17934
18596
|
relativeDirPath,
|
|
@@ -17948,10 +18610,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17948
18610
|
paths
|
|
17949
18611
|
}) {
|
|
17950
18612
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17951
|
-
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0,
|
|
18613
|
+
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0, import_node_path133.join)(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : (0, import_node_path133.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
17952
18614
|
if (relativeFilePath !== "AGENTS.md") {
|
|
17953
18615
|
throw new Error(
|
|
17954
|
-
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${(0,
|
|
18616
|
+
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${(0, import_node_path133.join)(relativeDirPath, relativeFilePath)}`
|
|
17955
18617
|
);
|
|
17956
18618
|
}
|
|
17957
18619
|
const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
|
|
@@ -17959,10 +18621,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
17959
18621
|
);
|
|
17960
18622
|
if (!allowed) {
|
|
17961
18623
|
throw new Error(
|
|
17962
|
-
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${(0,
|
|
18624
|
+
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${(0, import_node_path133.join)(relativeDirPath, relativeFilePath)}`
|
|
17963
18625
|
);
|
|
17964
18626
|
}
|
|
17965
|
-
const fileContent = await readFileContent((0,
|
|
18627
|
+
const fileContent = await readFileContent((0, import_node_path133.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
17966
18628
|
return new _RovodevRule({
|
|
17967
18629
|
baseDir,
|
|
17968
18630
|
relativeDirPath,
|
|
@@ -18076,7 +18738,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
18076
18738
|
};
|
|
18077
18739
|
|
|
18078
18740
|
// src/features/rules/warp-rule.ts
|
|
18079
|
-
var
|
|
18741
|
+
var import_node_path134 = require("path");
|
|
18080
18742
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
18081
18743
|
constructor({ fileContent, root, ...rest }) {
|
|
18082
18744
|
super({
|
|
@@ -18102,8 +18764,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
18102
18764
|
validate = true
|
|
18103
18765
|
}) {
|
|
18104
18766
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
18105
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
18106
|
-
const fileContent = await readFileContent((0,
|
|
18767
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path134.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
18768
|
+
const fileContent = await readFileContent((0, import_node_path134.join)(baseDir, relativePath));
|
|
18107
18769
|
return new _WarpRule({
|
|
18108
18770
|
baseDir,
|
|
18109
18771
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -18158,7 +18820,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
18158
18820
|
};
|
|
18159
18821
|
|
|
18160
18822
|
// src/features/rules/windsurf-rule.ts
|
|
18161
|
-
var
|
|
18823
|
+
var import_node_path135 = require("path");
|
|
18162
18824
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
18163
18825
|
static getSettablePaths(_options = {}) {
|
|
18164
18826
|
return {
|
|
@@ -18173,7 +18835,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
18173
18835
|
validate = true
|
|
18174
18836
|
}) {
|
|
18175
18837
|
const fileContent = await readFileContent(
|
|
18176
|
-
(0,
|
|
18838
|
+
(0, import_node_path135.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
18177
18839
|
);
|
|
18178
18840
|
return new _WindsurfRule({
|
|
18179
18841
|
baseDir,
|
|
@@ -18252,8 +18914,8 @@ var rulesProcessorToolTargets = [
|
|
|
18252
18914
|
"warp",
|
|
18253
18915
|
"windsurf"
|
|
18254
18916
|
];
|
|
18255
|
-
var RulesProcessorToolTargetSchema =
|
|
18256
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
18917
|
+
var RulesProcessorToolTargetSchema = import_mini69.z.enum(rulesProcessorToolTargets);
|
|
18918
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path136.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
18257
18919
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
18258
18920
|
[
|
|
18259
18921
|
"agentsmd",
|
|
@@ -18681,7 +19343,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18681
19343
|
}).relativeDirPath;
|
|
18682
19344
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
18683
19345
|
const frontmatter = skill.getFrontmatter();
|
|
18684
|
-
const relativePath = (0,
|
|
19346
|
+
const relativePath = (0, import_node_path136.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
18685
19347
|
return {
|
|
18686
19348
|
name: frontmatter.name,
|
|
18687
19349
|
description: frontmatter.description,
|
|
@@ -18806,12 +19468,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18806
19468
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
18807
19469
|
*/
|
|
18808
19470
|
async loadRulesyncFiles() {
|
|
18809
|
-
const rulesyncBaseDir = (0,
|
|
18810
|
-
const files = await findFilesByGlobs((0,
|
|
19471
|
+
const rulesyncBaseDir = (0, import_node_path136.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
19472
|
+
const files = await findFilesByGlobs((0, import_node_path136.join)(rulesyncBaseDir, "**", "*.md"));
|
|
18811
19473
|
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
18812
19474
|
const rulesyncRules = await Promise.all(
|
|
18813
19475
|
files.map((file) => {
|
|
18814
|
-
const relativeFilePath = (0,
|
|
19476
|
+
const relativeFilePath = (0, import_node_path136.relative)(rulesyncBaseDir, file);
|
|
18815
19477
|
checkPathTraversal({
|
|
18816
19478
|
relativePath: relativeFilePath,
|
|
18817
19479
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -18886,7 +19548,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18886
19548
|
global: this.global
|
|
18887
19549
|
});
|
|
18888
19550
|
const resolveRelativeDirPath = (filePath) => {
|
|
18889
|
-
const dirName = (0,
|
|
19551
|
+
const dirName = (0, import_node_path136.dirname)((0, import_node_path136.relative)(this.baseDir, filePath));
|
|
18890
19552
|
return dirName === "" ? "." : dirName;
|
|
18891
19553
|
};
|
|
18892
19554
|
const buildDeletionRulesFromPaths = (filePaths, opts) => {
|
|
@@ -18894,7 +19556,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18894
19556
|
const effectiveBaseDir = isNonRoot ? opts.baseDirOverride : this.baseDir;
|
|
18895
19557
|
return filePaths.map((filePath) => {
|
|
18896
19558
|
const relativeDirPath = isNonRoot ? opts.relativeDirPathOverride : resolveRelativeDirPath(filePath);
|
|
18897
|
-
const relativeFilePath = isNonRoot ? (0,
|
|
19559
|
+
const relativeFilePath = isNonRoot ? (0, import_node_path136.relative)(effectiveBaseDir, filePath) : (0, import_node_path136.basename)(filePath);
|
|
18898
19560
|
checkPathTraversal({
|
|
18899
19561
|
relativePath: isNonRoot ? relativeFilePath : relativeDirPath,
|
|
18900
19562
|
intendedRootDir: effectiveBaseDir
|
|
@@ -18922,13 +19584,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18922
19584
|
return [];
|
|
18923
19585
|
}
|
|
18924
19586
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
18925
|
-
(0,
|
|
19587
|
+
(0, import_node_path136.join)(
|
|
18926
19588
|
this.baseDir,
|
|
18927
19589
|
settablePaths.root.relativeDirPath ?? ".",
|
|
18928
19590
|
settablePaths.root.relativeFilePath
|
|
18929
19591
|
),
|
|
18930
19592
|
settablePaths.alternativeRoots,
|
|
18931
|
-
(alt) => (0,
|
|
19593
|
+
(alt) => (0, import_node_path136.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
18932
19594
|
);
|
|
18933
19595
|
if (forDeletion) {
|
|
18934
19596
|
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
@@ -18942,7 +19604,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18942
19604
|
});
|
|
18943
19605
|
return factory.class.fromFile({
|
|
18944
19606
|
baseDir: this.baseDir,
|
|
18945
|
-
relativeFilePath: (0,
|
|
19607
|
+
relativeFilePath: (0, import_node_path136.basename)(filePath),
|
|
18946
19608
|
relativeDirPath,
|
|
18947
19609
|
global: this.global
|
|
18948
19610
|
});
|
|
@@ -18959,7 +19621,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18959
19621
|
return [];
|
|
18960
19622
|
}
|
|
18961
19623
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
18962
|
-
(0,
|
|
19624
|
+
(0, import_node_path136.join)(this.baseDir, "AGENTS.local.md")
|
|
18963
19625
|
);
|
|
18964
19626
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
18965
19627
|
}
|
|
@@ -18970,9 +19632,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18970
19632
|
return [];
|
|
18971
19633
|
}
|
|
18972
19634
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
18973
|
-
(0,
|
|
19635
|
+
(0, import_node_path136.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
18974
19636
|
settablePaths.alternativeRoots,
|
|
18975
|
-
(alt) => (0,
|
|
19637
|
+
(alt) => (0, import_node_path136.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
18976
19638
|
);
|
|
18977
19639
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
18978
19640
|
})();
|
|
@@ -18983,20 +19645,20 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
18983
19645
|
if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
|
|
18984
19646
|
return [];
|
|
18985
19647
|
}
|
|
18986
|
-
const primaryPaths = await findFilesByGlobs((0,
|
|
19648
|
+
const primaryPaths = await findFilesByGlobs((0, import_node_path136.join)(this.baseDir, ".rovodev", "AGENTS.md"));
|
|
18987
19649
|
if (primaryPaths.length === 0) {
|
|
18988
19650
|
return [];
|
|
18989
19651
|
}
|
|
18990
|
-
const mirrorPaths = await findFilesByGlobs((0,
|
|
19652
|
+
const mirrorPaths = await findFilesByGlobs((0, import_node_path136.join)(this.baseDir, "AGENTS.md"));
|
|
18991
19653
|
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
18992
19654
|
})();
|
|
18993
19655
|
const nonRootToolRules = await (async () => {
|
|
18994
19656
|
if (!settablePaths.nonRoot) {
|
|
18995
19657
|
return [];
|
|
18996
19658
|
}
|
|
18997
|
-
const nonRootBaseDir = (0,
|
|
19659
|
+
const nonRootBaseDir = (0, import_node_path136.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
18998
19660
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
18999
|
-
(0,
|
|
19661
|
+
(0, import_node_path136.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
19000
19662
|
);
|
|
19001
19663
|
if (forDeletion) {
|
|
19002
19664
|
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
@@ -19006,18 +19668,18 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
19006
19668
|
}
|
|
19007
19669
|
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
19008
19670
|
const nonRootPathsForImport = this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
19009
|
-
const relativeFilePath = (0,
|
|
19671
|
+
const relativeFilePath = (0, import_node_path136.relative)(nonRootBaseDir, filePath);
|
|
19010
19672
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
19011
19673
|
if (!ok) {
|
|
19012
19674
|
this.logger.warn(
|
|
19013
|
-
`Skipping reserved Rovodev path under modular-rules (import): ${(0,
|
|
19675
|
+
`Skipping reserved Rovodev path under modular-rules (import): ${(0, import_node_path136.join)(modularRootRelative, relativeFilePath)}`
|
|
19014
19676
|
);
|
|
19015
19677
|
}
|
|
19016
19678
|
return ok;
|
|
19017
19679
|
}) : nonRootFilePaths;
|
|
19018
19680
|
return await Promise.all(
|
|
19019
19681
|
nonRootPathsForImport.map((filePath) => {
|
|
19020
|
-
const relativeFilePath = (0,
|
|
19682
|
+
const relativeFilePath = (0, import_node_path136.relative)(nonRootBaseDir, filePath);
|
|
19021
19683
|
checkPathTraversal({
|
|
19022
19684
|
relativePath: relativeFilePath,
|
|
19023
19685
|
intendedRootDir: nonRootBaseDir
|
|
@@ -19136,14 +19798,14 @@ s/<command> [arguments]
|
|
|
19136
19798
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
19137
19799
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
19138
19800
|
|
|
19139
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
19801
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path136.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
19140
19802
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
19141
19803
|
|
|
19142
19804
|
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.
|
|
19143
19805
|
|
|
19144
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
19806
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path136.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
19145
19807
|
|
|
19146
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
19808
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path136.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
19147
19809
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
19148
19810
|
const result = [
|
|
19149
19811
|
overview,
|
|
@@ -19243,7 +19905,7 @@ function warnUnsupportedTargets(params) {
|
|
|
19243
19905
|
}
|
|
19244
19906
|
}
|
|
19245
19907
|
async function checkRulesyncDirExists(params) {
|
|
19246
|
-
return fileExists((0,
|
|
19908
|
+
return fileExists((0, import_node_path137.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
19247
19909
|
}
|
|
19248
19910
|
async function generate(params) {
|
|
19249
19911
|
const { config, logger } = params;
|
|
@@ -19253,8 +19915,9 @@ async function generate(params) {
|
|
|
19253
19915
|
const subagentsResult = await generateSubagentsCore({ config, logger });
|
|
19254
19916
|
const skillsResult = await generateSkillsCore({ config, logger });
|
|
19255
19917
|
const hooksResult = await generateHooksCore({ config, logger });
|
|
19918
|
+
const permissionsResult = await generatePermissionsCore({ config, logger });
|
|
19256
19919
|
const rulesResult = await generateRulesCore({ config, logger, skills: skillsResult.skills });
|
|
19257
|
-
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || rulesResult.hasDiff;
|
|
19920
|
+
const hasDiff = ignoreResult.hasDiff || mcpResult.hasDiff || commandsResult.hasDiff || subagentsResult.hasDiff || skillsResult.hasDiff || hooksResult.hasDiff || permissionsResult.hasDiff || rulesResult.hasDiff;
|
|
19258
19921
|
return {
|
|
19259
19922
|
rulesCount: rulesResult.count,
|
|
19260
19923
|
rulesPaths: rulesResult.paths,
|
|
@@ -19270,6 +19933,8 @@ async function generate(params) {
|
|
|
19270
19933
|
skillsPaths: skillsResult.paths,
|
|
19271
19934
|
hooksCount: hooksResult.count,
|
|
19272
19935
|
hooksPaths: hooksResult.paths,
|
|
19936
|
+
permissionsCount: permissionsResult.count,
|
|
19937
|
+
permissionsPaths: permissionsResult.paths,
|
|
19273
19938
|
skills: skillsResult.skills,
|
|
19274
19939
|
hasDiff
|
|
19275
19940
|
};
|
|
@@ -19280,7 +19945,7 @@ async function generateRulesCore(params) {
|
|
|
19280
19945
|
const allPaths = [];
|
|
19281
19946
|
let hasDiff = false;
|
|
19282
19947
|
const supportedTargets = RulesProcessor.getToolTargets({ global: config.getGlobal() });
|
|
19283
|
-
const toolTargets = (0,
|
|
19948
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedTargets);
|
|
19284
19949
|
warnUnsupportedTargets({ config, supportedTargets, featureName: "rules", logger });
|
|
19285
19950
|
for (const baseDir of config.getBaseDirs()) {
|
|
19286
19951
|
for (const toolTarget of toolTargets) {
|
|
@@ -19322,7 +19987,7 @@ async function generateIgnoreCore(params) {
|
|
|
19322
19987
|
let totalCount = 0;
|
|
19323
19988
|
const allPaths = [];
|
|
19324
19989
|
let hasDiff = false;
|
|
19325
|
-
for (const toolTarget of (0,
|
|
19990
|
+
for (const toolTarget of (0, import_es_toolkit5.intersection)(config.getTargets(), supportedIgnoreTargets)) {
|
|
19326
19991
|
if (!config.getFeatures(toolTarget).includes("ignore")) {
|
|
19327
19992
|
continue;
|
|
19328
19993
|
}
|
|
@@ -19332,7 +19997,8 @@ async function generateIgnoreCore(params) {
|
|
|
19332
19997
|
baseDir: baseDir === process.cwd() ? "." : baseDir,
|
|
19333
19998
|
toolTarget,
|
|
19334
19999
|
dryRun: config.isPreviewMode(),
|
|
19335
|
-
logger
|
|
20000
|
+
logger,
|
|
20001
|
+
featureOptions: config.getFeatureOptions(toolTarget, "ignore")
|
|
19336
20002
|
});
|
|
19337
20003
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
19338
20004
|
const result = await processFeatureWithRulesyncFiles({ config, processor, rulesyncFiles });
|
|
@@ -19355,7 +20021,7 @@ async function generateMcpCore(params) {
|
|
|
19355
20021
|
const allPaths = [];
|
|
19356
20022
|
let hasDiff = false;
|
|
19357
20023
|
const supportedMcpTargets = McpProcessor.getToolTargets({ global: config.getGlobal() });
|
|
19358
|
-
const toolTargets = (0,
|
|
20024
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedMcpTargets);
|
|
19359
20025
|
warnUnsupportedTargets({
|
|
19360
20026
|
config,
|
|
19361
20027
|
supportedTargets: supportedMcpTargets,
|
|
@@ -19392,7 +20058,7 @@ async function generateCommandsCore(params) {
|
|
|
19392
20058
|
global: config.getGlobal(),
|
|
19393
20059
|
includeSimulated: config.getSimulateCommands()
|
|
19394
20060
|
});
|
|
19395
|
-
const toolTargets = (0,
|
|
20061
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedCommandsTargets);
|
|
19396
20062
|
warnUnsupportedTargets({
|
|
19397
20063
|
config,
|
|
19398
20064
|
supportedTargets: supportedCommandsTargets,
|
|
@@ -19430,7 +20096,7 @@ async function generateSubagentsCore(params) {
|
|
|
19430
20096
|
global: config.getGlobal(),
|
|
19431
20097
|
includeSimulated: config.getSimulateSubagents()
|
|
19432
20098
|
});
|
|
19433
|
-
const toolTargets = (0,
|
|
20099
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedSubagentsTargets);
|
|
19434
20100
|
warnUnsupportedTargets({
|
|
19435
20101
|
config,
|
|
19436
20102
|
supportedTargets: supportedSubagentsTargets,
|
|
@@ -19469,7 +20135,7 @@ async function generateSkillsCore(params) {
|
|
|
19469
20135
|
global: config.getGlobal(),
|
|
19470
20136
|
includeSimulated: config.getSimulateSkills()
|
|
19471
20137
|
});
|
|
19472
|
-
const toolTargets = (0,
|
|
20138
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedSkillsTargets);
|
|
19473
20139
|
warnUnsupportedTargets({
|
|
19474
20140
|
config,
|
|
19475
20141
|
supportedTargets: supportedSkillsTargets,
|
|
@@ -19514,7 +20180,7 @@ async function generateHooksCore(params) {
|
|
|
19514
20180
|
const allPaths = [];
|
|
19515
20181
|
let hasDiff = false;
|
|
19516
20182
|
const supportedHooksTargets = HooksProcessor.getToolTargets({ global: config.getGlobal() });
|
|
19517
|
-
const toolTargets = (0,
|
|
20183
|
+
const toolTargets = (0, import_es_toolkit5.intersection)(config.getTargets(), supportedHooksTargets);
|
|
19518
20184
|
warnUnsupportedTargets({
|
|
19519
20185
|
config,
|
|
19520
20186
|
supportedTargets: supportedHooksTargets,
|
|
@@ -19542,6 +20208,48 @@ async function generateHooksCore(params) {
|
|
|
19542
20208
|
}
|
|
19543
20209
|
return { count: totalCount, paths: allPaths, hasDiff };
|
|
19544
20210
|
}
|
|
20211
|
+
async function generatePermissionsCore(params) {
|
|
20212
|
+
const { config, logger } = params;
|
|
20213
|
+
const supportedPermissionsTargets = PermissionsProcessor.getToolTargets({
|
|
20214
|
+
global: config.getGlobal()
|
|
20215
|
+
});
|
|
20216
|
+
warnUnsupportedTargets({
|
|
20217
|
+
config,
|
|
20218
|
+
supportedTargets: supportedPermissionsTargets,
|
|
20219
|
+
featureName: "permissions",
|
|
20220
|
+
logger
|
|
20221
|
+
});
|
|
20222
|
+
let totalCount = 0;
|
|
20223
|
+
const allPaths = [];
|
|
20224
|
+
let hasDiff = false;
|
|
20225
|
+
for (const baseDir of config.getBaseDirs()) {
|
|
20226
|
+
for (const toolTarget of (0, import_es_toolkit5.intersection)(config.getTargets(), supportedPermissionsTargets)) {
|
|
20227
|
+
if (!config.getFeatures(toolTarget).includes("permissions")) {
|
|
20228
|
+
continue;
|
|
20229
|
+
}
|
|
20230
|
+
try {
|
|
20231
|
+
const processor = new PermissionsProcessor({
|
|
20232
|
+
baseDir,
|
|
20233
|
+
toolTarget,
|
|
20234
|
+
global: config.getGlobal(),
|
|
20235
|
+
dryRun: config.isPreviewMode(),
|
|
20236
|
+
logger
|
|
20237
|
+
});
|
|
20238
|
+
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
20239
|
+
const result = await processFeatureWithRulesyncFiles({ config, processor, rulesyncFiles });
|
|
20240
|
+
totalCount += result.count;
|
|
20241
|
+
allPaths.push(...result.paths);
|
|
20242
|
+
if (result.hasDiff) hasDiff = true;
|
|
20243
|
+
} catch (error) {
|
|
20244
|
+
logger.warn(
|
|
20245
|
+
`Failed to generate ${toolTarget} permissions files for ${baseDir}: ${formatError(error)}`
|
|
20246
|
+
);
|
|
20247
|
+
continue;
|
|
20248
|
+
}
|
|
20249
|
+
}
|
|
20250
|
+
}
|
|
20251
|
+
return { count: totalCount, paths: allPaths, hasDiff };
|
|
20252
|
+
}
|
|
19545
20253
|
|
|
19546
20254
|
// src/lib/import.ts
|
|
19547
20255
|
async function importFromTool(params) {
|
|
@@ -19553,6 +20261,7 @@ async function importFromTool(params) {
|
|
|
19553
20261
|
const subagentsCount = await importSubagentsCore({ config, tool, logger });
|
|
19554
20262
|
const skillsCount = await importSkillsCore({ config, tool, logger });
|
|
19555
20263
|
const hooksCount = await importHooksCore({ config, tool, logger });
|
|
20264
|
+
const permissionsCount = await importPermissionsCore({ config, tool, logger });
|
|
19556
20265
|
return {
|
|
19557
20266
|
rulesCount,
|
|
19558
20267
|
ignoreCount,
|
|
@@ -19560,7 +20269,8 @@ async function importFromTool(params) {
|
|
|
19560
20269
|
commandsCount,
|
|
19561
20270
|
subagentsCount,
|
|
19562
20271
|
skillsCount,
|
|
19563
|
-
hooksCount
|
|
20272
|
+
hooksCount,
|
|
20273
|
+
permissionsCount
|
|
19564
20274
|
};
|
|
19565
20275
|
}
|
|
19566
20276
|
async function importRulesCore(params) {
|
|
@@ -19606,7 +20316,8 @@ async function importIgnoreCore(params) {
|
|
|
19606
20316
|
const ignoreProcessor = new IgnoreProcessor({
|
|
19607
20317
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
19608
20318
|
toolTarget: tool,
|
|
19609
|
-
logger
|
|
20319
|
+
logger,
|
|
20320
|
+
featureOptions: config.getFeatureOptions(tool, "ignore")
|
|
19610
20321
|
});
|
|
19611
20322
|
const toolFiles = await ignoreProcessor.loadToolFiles();
|
|
19612
20323
|
if (toolFiles.length === 0) {
|
|
@@ -19768,6 +20479,41 @@ async function importHooksCore(params) {
|
|
|
19768
20479
|
}
|
|
19769
20480
|
return writtenCount;
|
|
19770
20481
|
}
|
|
20482
|
+
async function importPermissionsCore(params) {
|
|
20483
|
+
const { config, tool, logger } = params;
|
|
20484
|
+
if (!config.getFeatures(tool).includes("permissions")) {
|
|
20485
|
+
return 0;
|
|
20486
|
+
}
|
|
20487
|
+
const allTargets = PermissionsProcessor.getToolTargets({ global: config.getGlobal() });
|
|
20488
|
+
const importableTargets = PermissionsProcessor.getToolTargets({
|
|
20489
|
+
global: config.getGlobal(),
|
|
20490
|
+
importOnly: true
|
|
20491
|
+
});
|
|
20492
|
+
if (!allTargets.includes(tool)) {
|
|
20493
|
+
return 0;
|
|
20494
|
+
}
|
|
20495
|
+
if (!importableTargets.includes(tool)) {
|
|
20496
|
+
logger.warn(`Import is not supported for ${tool} permissions. Skipping.`);
|
|
20497
|
+
return 0;
|
|
20498
|
+
}
|
|
20499
|
+
const permissionsProcessor = new PermissionsProcessor({
|
|
20500
|
+
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
20501
|
+
toolTarget: tool,
|
|
20502
|
+
global: config.getGlobal(),
|
|
20503
|
+
logger
|
|
20504
|
+
});
|
|
20505
|
+
const toolFiles = await permissionsProcessor.loadToolFiles();
|
|
20506
|
+
if (toolFiles.length === 0) {
|
|
20507
|
+
logger.warn(`No permissions files found for ${tool}. Skipping import.`);
|
|
20508
|
+
return 0;
|
|
20509
|
+
}
|
|
20510
|
+
const rulesyncFiles = await permissionsProcessor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
20511
|
+
const { count: writtenCount } = await permissionsProcessor.writeAiFiles(rulesyncFiles);
|
|
20512
|
+
if (config.getVerbose() && writtenCount > 0) {
|
|
20513
|
+
logger.success(`Created ${writtenCount} permissions file(s)`);
|
|
20514
|
+
}
|
|
20515
|
+
return writtenCount;
|
|
20516
|
+
}
|
|
19771
20517
|
|
|
19772
20518
|
// src/utils/logger.ts
|
|
19773
20519
|
var BaseLogger = class {
|