rulesync 8.4.0 → 8.6.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 +1 -1
- package/dist/{chunk-MMBSR2RA.js → chunk-ILMHM7BF.js} +1027 -604
- package/dist/cli/index.cjs +1494 -971
- package/dist/cli/index.js +127 -25
- package/dist/index.cjs +965 -541
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -259,8 +259,13 @@ var ALL_FEATURES = [
|
|
|
259
259
|
var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
|
|
260
260
|
var FeatureSchema = import_mini.z.enum(ALL_FEATURES);
|
|
261
261
|
var FeaturesSchema = import_mini.z.array(FeatureSchema);
|
|
262
|
+
var GitignoreDestinationSchema = import_mini.z.enum(["gitignore", "gitattributes"]);
|
|
262
263
|
var FeatureOptionsSchema = import_mini.z.record(import_mini.z.string(), import_mini.z.unknown());
|
|
263
|
-
var FeatureValueSchema = import_mini.z.union([
|
|
264
|
+
var FeatureValueSchema = import_mini.z.union([
|
|
265
|
+
import_mini.z.boolean(),
|
|
266
|
+
FeatureOptionsSchema,
|
|
267
|
+
GitignoreDestinationSchema
|
|
268
|
+
]);
|
|
264
269
|
var PerFeatureConfigSchema = import_mini.z.record(import_mini.z.string(), FeatureValueSchema);
|
|
265
270
|
var PerTargetFeaturesValueSchema = import_mini.z.union([
|
|
266
271
|
import_mini.z.array(import_mini.z.enum(ALL_FEATURES_WITH_WILDCARD)),
|
|
@@ -335,6 +340,7 @@ function hasControlCharacters(value) {
|
|
|
335
340
|
}
|
|
336
341
|
|
|
337
342
|
// src/config/config.ts
|
|
343
|
+
var GITIGNORE_DESTINATION_KEY = "gitignoreDestination";
|
|
338
344
|
var SourceEntrySchema = import_mini3.z.object({
|
|
339
345
|
source: import_mini3.z.string().check((0, import_mini3.minLength)(1, "source must be a non-empty string")),
|
|
340
346
|
skills: (0, import_mini3.optional)(import_mini3.z.array(import_mini3.z.string())),
|
|
@@ -366,6 +372,7 @@ var ConfigParamsSchema = import_mini3.z.object({
|
|
|
366
372
|
simulateSubagents: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
367
373
|
simulateSkills: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
368
374
|
gitignoreTargetsOnly: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
375
|
+
gitignoreDestination: (0, import_mini3.optional)(GitignoreDestinationSchema),
|
|
369
376
|
dryRun: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
370
377
|
check: (0, import_mini3.optional)(import_mini3.z.boolean()),
|
|
371
378
|
// Declarative skill sources
|
|
@@ -426,6 +433,7 @@ var Config = class _Config {
|
|
|
426
433
|
simulateSubagents;
|
|
427
434
|
simulateSkills;
|
|
428
435
|
gitignoreTargetsOnly;
|
|
436
|
+
gitignoreDestination;
|
|
429
437
|
dryRun;
|
|
430
438
|
check;
|
|
431
439
|
sources;
|
|
@@ -441,6 +449,7 @@ var Config = class _Config {
|
|
|
441
449
|
simulateSubagents,
|
|
442
450
|
simulateSkills,
|
|
443
451
|
gitignoreTargetsOnly,
|
|
452
|
+
gitignoreDestination,
|
|
444
453
|
dryRun,
|
|
445
454
|
check,
|
|
446
455
|
sources
|
|
@@ -466,6 +475,7 @@ var Config = class _Config {
|
|
|
466
475
|
this.simulateSubagents = simulateSubagents ?? false;
|
|
467
476
|
this.simulateSkills = simulateSkills ?? false;
|
|
468
477
|
this.gitignoreTargetsOnly = gitignoreTargetsOnly ?? true;
|
|
478
|
+
this.gitignoreDestination = gitignoreDestination ?? "gitignore";
|
|
469
479
|
this.dryRun = dryRun ?? false;
|
|
470
480
|
this.check = check ?? false;
|
|
471
481
|
this.sources = sources ?? [];
|
|
@@ -623,6 +633,36 @@ var Config = class _Config {
|
|
|
623
633
|
}
|
|
624
634
|
return void 0;
|
|
625
635
|
}
|
|
636
|
+
getGitignoreDestination(target, feature) {
|
|
637
|
+
const rootLevel = this.gitignoreDestination;
|
|
638
|
+
if (!isRulesyncConfigTargetsObject(this.targets)) {
|
|
639
|
+
return rootLevel;
|
|
640
|
+
}
|
|
641
|
+
const targetValue = this.targets[target];
|
|
642
|
+
if (!targetValue || Array.isArray(targetValue)) {
|
|
643
|
+
return rootLevel;
|
|
644
|
+
}
|
|
645
|
+
const perFeature = targetValue;
|
|
646
|
+
const toolLevel = _Config.parseGitignoreDestination(perFeature[GITIGNORE_DESTINATION_KEY]);
|
|
647
|
+
if (feature) {
|
|
648
|
+
const featureValue = perFeature[feature];
|
|
649
|
+
if (featureValue && typeof featureValue === "object" && !Array.isArray(featureValue)) {
|
|
650
|
+
const featureLevel = _Config.parseGitignoreDestination(
|
|
651
|
+
featureValue[GITIGNORE_DESTINATION_KEY]
|
|
652
|
+
);
|
|
653
|
+
if (featureLevel) {
|
|
654
|
+
return featureLevel;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return toolLevel ?? rootLevel;
|
|
659
|
+
}
|
|
660
|
+
static parseGitignoreDestination(value) {
|
|
661
|
+
if (value === "gitignore" || value === "gitattributes") {
|
|
662
|
+
return value;
|
|
663
|
+
}
|
|
664
|
+
return void 0;
|
|
665
|
+
}
|
|
626
666
|
/**
|
|
627
667
|
* Check if per-target features configuration is being used.
|
|
628
668
|
*/
|
|
@@ -703,6 +743,7 @@ var getDefaults = () => ({
|
|
|
703
743
|
simulateSubagents: false,
|
|
704
744
|
simulateSkills: false,
|
|
705
745
|
gitignoreTargetsOnly: true,
|
|
746
|
+
gitignoreDestination: "gitignore",
|
|
706
747
|
dryRun: false,
|
|
707
748
|
check: false,
|
|
708
749
|
sources: []
|
|
@@ -734,6 +775,7 @@ var mergeConfigs = (baseConfig, localConfig) => {
|
|
|
734
775
|
simulateSubagents: localConfig.simulateSubagents ?? baseConfig.simulateSubagents,
|
|
735
776
|
simulateSkills: localConfig.simulateSkills ?? baseConfig.simulateSkills,
|
|
736
777
|
gitignoreTargetsOnly: localConfig.gitignoreTargetsOnly ?? baseConfig.gitignoreTargetsOnly,
|
|
778
|
+
gitignoreDestination: localConfig.gitignoreDestination ?? baseConfig.gitignoreDestination,
|
|
737
779
|
dryRun: localConfig.dryRun ?? baseConfig.dryRun,
|
|
738
780
|
check: localConfig.check ?? baseConfig.check,
|
|
739
781
|
sources: localConfig.sources ?? baseConfig.sources
|
|
@@ -754,7 +796,8 @@ var ConfigResolver = class {
|
|
|
754
796
|
simulateSkills,
|
|
755
797
|
gitignoreTargetsOnly,
|
|
756
798
|
dryRun,
|
|
757
|
-
check
|
|
799
|
+
check,
|
|
800
|
+
gitignoreDestination
|
|
758
801
|
}) {
|
|
759
802
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
760
803
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
@@ -803,6 +846,7 @@ var ConfigResolver = class {
|
|
|
803
846
|
simulateSubagents: resolvedSimulateSubagents,
|
|
804
847
|
simulateSkills: resolvedSimulateSkills,
|
|
805
848
|
gitignoreTargetsOnly: resolvedGitignoreTargetsOnly,
|
|
849
|
+
gitignoreDestination: gitignoreDestination ?? configByFile.gitignoreDestination ?? getDefaults().gitignoreDestination,
|
|
806
850
|
dryRun: dryRun ?? configByFile.dryRun ?? getDefaults().dryRun,
|
|
807
851
|
check: check ?? configByFile.check ?? getDefaults().check,
|
|
808
852
|
sources: configByFile.sources ?? getDefaults().sources
|
|
@@ -825,7 +869,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
825
869
|
}
|
|
826
870
|
|
|
827
871
|
// src/lib/generate.ts
|
|
828
|
-
var
|
|
872
|
+
var import_node_path141 = require("path");
|
|
829
873
|
var import_es_toolkit5 = require("es-toolkit");
|
|
830
874
|
|
|
831
875
|
// src/features/commands/commands-processor.ts
|
|
@@ -9727,15 +9771,78 @@ function mapBashActionToDecision(action) {
|
|
|
9727
9771
|
|
|
9728
9772
|
// src/features/permissions/geminicli-permissions.ts
|
|
9729
9773
|
var import_node_path67 = require("path");
|
|
9774
|
+
var smolToml5 = __toESM(require("smol-toml"), 1);
|
|
9730
9775
|
var import_mini29 = require("zod/mini");
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9776
|
+
|
|
9777
|
+
// src/utils/logger.ts
|
|
9778
|
+
var BaseLogger = class {
|
|
9779
|
+
_verbose = false;
|
|
9780
|
+
_silent = false;
|
|
9781
|
+
constructor({ verbose = false, silent = false } = {}) {
|
|
9782
|
+
this._silent = silent;
|
|
9783
|
+
this._verbose = verbose && !silent;
|
|
9784
|
+
}
|
|
9785
|
+
get verbose() {
|
|
9786
|
+
return this._verbose;
|
|
9787
|
+
}
|
|
9788
|
+
get silent() {
|
|
9789
|
+
return this._silent;
|
|
9790
|
+
}
|
|
9791
|
+
configure({ verbose, silent }) {
|
|
9792
|
+
if (verbose && silent) {
|
|
9793
|
+
this._silent = false;
|
|
9794
|
+
if (!isEnvTest()) {
|
|
9795
|
+
this.onConflictingFlags();
|
|
9796
|
+
}
|
|
9797
|
+
}
|
|
9798
|
+
this._silent = silent;
|
|
9799
|
+
this._verbose = verbose && !silent;
|
|
9800
|
+
}
|
|
9801
|
+
onConflictingFlags() {
|
|
9802
|
+
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
9803
|
+
}
|
|
9804
|
+
};
|
|
9805
|
+
var ConsoleLogger = class extends BaseLogger {
|
|
9806
|
+
isSuppressed() {
|
|
9807
|
+
return isEnvTest() || this._silent;
|
|
9808
|
+
}
|
|
9809
|
+
get jsonMode() {
|
|
9810
|
+
return false;
|
|
9811
|
+
}
|
|
9812
|
+
captureData(_key, _value) {
|
|
9813
|
+
}
|
|
9814
|
+
getJsonData() {
|
|
9815
|
+
return {};
|
|
9816
|
+
}
|
|
9817
|
+
outputJson(_success, _error) {
|
|
9818
|
+
}
|
|
9819
|
+
info(message, ...args) {
|
|
9820
|
+
if (this.isSuppressed()) return;
|
|
9821
|
+
console.log(message, ...args);
|
|
9822
|
+
}
|
|
9823
|
+
success(message, ...args) {
|
|
9824
|
+
if (this.isSuppressed()) return;
|
|
9825
|
+
console.log(message, ...args);
|
|
9826
|
+
}
|
|
9827
|
+
warn(message, ...args) {
|
|
9828
|
+
if (this.isSuppressed()) return;
|
|
9829
|
+
console.warn(message, ...args);
|
|
9830
|
+
}
|
|
9831
|
+
// Errors are always emitted, even in silent mode
|
|
9832
|
+
error(message, _code, ...args) {
|
|
9833
|
+
if (isEnvTest()) return;
|
|
9834
|
+
const errorMessage = message instanceof Error ? message.message : message;
|
|
9835
|
+
console.error(errorMessage, ...args);
|
|
9836
|
+
}
|
|
9837
|
+
debug(message, ...args) {
|
|
9838
|
+
if (!this._verbose || this.isSuppressed()) return;
|
|
9839
|
+
console.log(message, ...args);
|
|
9840
|
+
}
|
|
9841
|
+
};
|
|
9842
|
+
|
|
9843
|
+
// src/features/permissions/geminicli-permissions.ts
|
|
9844
|
+
var GEMINICLI_POLICY_RELATIVE_DIR_PATH = (0, import_node_path67.join)(".gemini", "policies");
|
|
9845
|
+
var GEMINICLI_POLICY_FILE_NAME = "rulesync.toml";
|
|
9739
9846
|
var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
|
|
9740
9847
|
bash: "run_shell_command",
|
|
9741
9848
|
read: "read_file",
|
|
@@ -9743,16 +9850,32 @@ var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
|
|
|
9743
9850
|
write: "write_file",
|
|
9744
9851
|
webfetch: "web_fetch"
|
|
9745
9852
|
};
|
|
9853
|
+
var GEMINICLI_TO_RULESYNC_TOOL_NAME = Object.fromEntries(
|
|
9854
|
+
Object.entries(RULESYNC_TO_GEMINICLI_TOOL_NAME).map(([k, v]) => [v, k])
|
|
9855
|
+
);
|
|
9856
|
+
var PRIORITY_DENY = 1e6;
|
|
9857
|
+
var PRIORITY_ASK = 1e3;
|
|
9858
|
+
var PRIORITY_ALLOW = 1;
|
|
9859
|
+
var SINGLE_STAR_REGEX = '[^/\\"]*';
|
|
9860
|
+
var DOUBLE_STAR_REGEX = '[^\\"]*';
|
|
9861
|
+
var SINGLE_CHAR_REGEX = '[^/\\"]';
|
|
9862
|
+
var LEGACY_SINGLE_STAR_REGEX = '[^\\"]*';
|
|
9863
|
+
var LEGACY_DOUBLE_STAR_REGEX = ".*";
|
|
9864
|
+
var COMMAND_ARGS_ANCHOR = '"command":"';
|
|
9865
|
+
var VALUE_END_ANCHOR = '\\"';
|
|
9866
|
+
var RESERVED_OBJECT_KEYS = /* @__PURE__ */ new Set([
|
|
9867
|
+
"__proto__",
|
|
9868
|
+
"constructor",
|
|
9869
|
+
"prototype"
|
|
9870
|
+
]);
|
|
9871
|
+
var moduleLogger = new ConsoleLogger();
|
|
9746
9872
|
var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
9747
9873
|
static getSettablePaths(_options = {}) {
|
|
9748
9874
|
return {
|
|
9749
|
-
relativeDirPath:
|
|
9750
|
-
relativeFilePath:
|
|
9875
|
+
relativeDirPath: GEMINICLI_POLICY_RELATIVE_DIR_PATH,
|
|
9876
|
+
relativeFilePath: GEMINICLI_POLICY_FILE_NAME
|
|
9751
9877
|
};
|
|
9752
9878
|
}
|
|
9753
|
-
isDeletable() {
|
|
9754
|
-
return false;
|
|
9755
|
-
}
|
|
9756
9879
|
static async fromFile({
|
|
9757
9880
|
baseDir = process.cwd(),
|
|
9758
9881
|
validate = true,
|
|
@@ -9760,7 +9883,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
9760
9883
|
}) {
|
|
9761
9884
|
const paths = this.getSettablePaths({ global });
|
|
9762
9885
|
const filePath = (0, import_node_path67.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
9763
|
-
const fileContent = await readFileContentOrNull(filePath) ??
|
|
9886
|
+
const fileContent = await readFileContentOrNull(filePath) ?? "";
|
|
9764
9887
|
return new _GeminicliPermissions({
|
|
9765
9888
|
baseDir,
|
|
9766
9889
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -9769,63 +9892,72 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
9769
9892
|
validate
|
|
9770
9893
|
});
|
|
9771
9894
|
}
|
|
9772
|
-
static
|
|
9895
|
+
static fromRulesyncPermissions({
|
|
9773
9896
|
baseDir = process.cwd(),
|
|
9774
9897
|
rulesyncPermissions,
|
|
9775
9898
|
validate = true,
|
|
9776
|
-
|
|
9777
|
-
|
|
9899
|
+
global = false,
|
|
9900
|
+
logger = moduleLogger
|
|
9778
9901
|
}) {
|
|
9779
9902
|
const paths = this.getSettablePaths({ global });
|
|
9780
|
-
const
|
|
9781
|
-
const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
|
|
9782
|
-
const settingsResult = GeminiCliSettingsSchema.safeParse(JSON.parse(existingContent));
|
|
9783
|
-
if (!settingsResult.success) {
|
|
9784
|
-
throw new Error(
|
|
9785
|
-
`Failed to parse existing Gemini CLI settings at ${filePath}: ${formatError(settingsResult.error)}`
|
|
9786
|
-
);
|
|
9787
|
-
}
|
|
9788
|
-
const { allowed, exclude } = convertRulesyncToGeminicliTools({
|
|
9789
|
-
config: rulesyncPermissions.getJson(),
|
|
9790
|
-
logger
|
|
9791
|
-
});
|
|
9792
|
-
const merged = {
|
|
9793
|
-
...settingsResult.data,
|
|
9794
|
-
tools: {
|
|
9795
|
-
...settingsResult.data.tools,
|
|
9796
|
-
...allowed.length > 0 ? { allowed } : {},
|
|
9797
|
-
...exclude.length > 0 ? { exclude } : {}
|
|
9798
|
-
}
|
|
9799
|
-
};
|
|
9903
|
+
const fileContent = buildGeminicliPolicyContent(rulesyncPermissions.getJson(), logger);
|
|
9800
9904
|
return new _GeminicliPermissions({
|
|
9801
9905
|
baseDir,
|
|
9802
9906
|
relativeDirPath: paths.relativeDirPath,
|
|
9803
9907
|
relativeFilePath: paths.relativeFilePath,
|
|
9804
|
-
fileContent
|
|
9908
|
+
fileContent,
|
|
9805
9909
|
validate
|
|
9806
9910
|
});
|
|
9807
9911
|
}
|
|
9808
9912
|
toRulesyncPermissions() {
|
|
9809
|
-
let settings;
|
|
9810
|
-
try {
|
|
9811
|
-
const parsed = JSON.parse(this.getFileContent());
|
|
9812
|
-
settings = GeminiCliSettingsSchema.parse(parsed);
|
|
9813
|
-
} catch (error) {
|
|
9814
|
-
throw new Error(
|
|
9815
|
-
`Failed to parse Gemini CLI permissions content in ${(0, import_node_path67.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
9816
|
-
{ cause: error }
|
|
9817
|
-
);
|
|
9818
|
-
}
|
|
9819
9913
|
const permission = {};
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9914
|
+
const fileContent = this.getFileContent();
|
|
9915
|
+
if (fileContent.trim().length > 0) {
|
|
9916
|
+
let parsed;
|
|
9917
|
+
try {
|
|
9918
|
+
parsed = smolToml5.parse(fileContent);
|
|
9919
|
+
} catch (error) {
|
|
9920
|
+
throw new Error(
|
|
9921
|
+
`Failed to parse Gemini CLI policy TOML in ${(0, import_node_path67.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
|
|
9922
|
+
{ cause: error }
|
|
9923
|
+
);
|
|
9924
|
+
}
|
|
9925
|
+
const rules = extractRules(parsed, moduleLogger);
|
|
9926
|
+
for (const [index, rule] of rules.entries()) {
|
|
9927
|
+
const mappedCategory = Object.hasOwn(GEMINICLI_TO_RULESYNC_TOOL_NAME, rule.toolName) ? GEMINICLI_TO_RULESYNC_TOOL_NAME[rule.toolName] : void 0;
|
|
9928
|
+
const category = mappedCategory ?? rule.toolName;
|
|
9929
|
+
if (RESERVED_OBJECT_KEYS.has(category)) {
|
|
9930
|
+
moduleLogger.warn(
|
|
9931
|
+
`Skipping rule #${index} in ${this.getRelativeFilePath()}: toolName "${rule.toolName}" maps to a reserved object key ("${category}") and would risk prototype pollution.`
|
|
9932
|
+
);
|
|
9933
|
+
continue;
|
|
9934
|
+
}
|
|
9935
|
+
const action = mapFromGeminicliDecision(rule.decision);
|
|
9936
|
+
if (!action) {
|
|
9937
|
+
moduleLogger.warn(
|
|
9938
|
+
`Skipping rule #${index} (toolName="${rule.toolName}", commandPrefix=${JSON.stringify(rule.commandPrefix)}, argsPattern=${JSON.stringify(rule.argsPattern)}) in ${this.getRelativeFilePath()}: unknown decision ${JSON.stringify(rule.decision)}`
|
|
9939
|
+
);
|
|
9940
|
+
continue;
|
|
9941
|
+
}
|
|
9942
|
+
if (rule.toolName === "run_shell_command" && rule.commandPrefix !== void 0 && rule.argsPattern !== void 0) {
|
|
9943
|
+
moduleLogger.warn(
|
|
9944
|
+
`Rule #${index} in ${this.getRelativeFilePath()} sets both commandPrefix and argsPattern; rulesync will honor argsPattern and ignore commandPrefix=${JSON.stringify(rule.commandPrefix)}.`
|
|
9945
|
+
);
|
|
9946
|
+
}
|
|
9947
|
+
const pattern = extractPattern(rule);
|
|
9948
|
+
if (RESERVED_OBJECT_KEYS.has(pattern)) {
|
|
9949
|
+
moduleLogger.warn(
|
|
9950
|
+
`Skipping rule #${index} in ${this.getRelativeFilePath()}: pattern "${pattern}" is a reserved object key.`
|
|
9951
|
+
);
|
|
9952
|
+
continue;
|
|
9953
|
+
}
|
|
9954
|
+
const existing = Object.hasOwn(permission, category) ? permission[category] : void 0;
|
|
9955
|
+
const target = existing ?? {};
|
|
9956
|
+
if (existing === void 0) {
|
|
9957
|
+
permission[category] = target;
|
|
9958
|
+
}
|
|
9959
|
+
target[pattern] = action;
|
|
9960
|
+
}
|
|
9829
9961
|
}
|
|
9830
9962
|
return this.toRulesyncPermissionsDefault({
|
|
9831
9963
|
fileContent: JSON.stringify({ permission }, null, 2)
|
|
@@ -9843,50 +9975,238 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
|
|
|
9843
9975
|
baseDir,
|
|
9844
9976
|
relativeDirPath,
|
|
9845
9977
|
relativeFilePath,
|
|
9846
|
-
fileContent:
|
|
9978
|
+
fileContent: "",
|
|
9847
9979
|
validate: false
|
|
9848
9980
|
});
|
|
9849
9981
|
}
|
|
9850
9982
|
};
|
|
9851
|
-
function
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
const allowed = [];
|
|
9856
|
-
const exclude = [];
|
|
9857
|
-
for (const [toolName, rules] of Object.entries(config.permission)) {
|
|
9983
|
+
function buildGeminicliPolicyContent(config, logger) {
|
|
9984
|
+
const rules = [];
|
|
9985
|
+
let order = 0;
|
|
9986
|
+
for (const [toolName, entries] of Object.entries(config.permission)) {
|
|
9858
9987
|
const mappedToolName = RULESYNC_TO_GEMINICLI_TOOL_NAME[toolName] ?? toolName;
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
if (action === "ask") {
|
|
9864
|
-
logger?.warn(
|
|
9865
|
-
`Gemini CLI does not support explicit "ask" rules in settings. Skipping ${toolName}:${pattern}`
|
|
9988
|
+
for (const [pattern, action] of Object.entries(entries)) {
|
|
9989
|
+
if (pattern === "") {
|
|
9990
|
+
logger.warn(
|
|
9991
|
+
`Skipping rule "${toolName}: "": empty pattern is not a valid permission target and would silently match every invocation (bash) or nothing (other tools).`
|
|
9866
9992
|
);
|
|
9867
9993
|
continue;
|
|
9868
9994
|
}
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9995
|
+
if (hasUnsafeAnchorChar(pattern)) {
|
|
9996
|
+
logger.warn(
|
|
9997
|
+
`Skipping rule "${toolName}: ${pattern}": pattern contains a character (" or \\) that would break JSON-anchor matching in the Gemini CLI Policy Engine.`
|
|
9998
|
+
);
|
|
9999
|
+
continue;
|
|
10000
|
+
}
|
|
10001
|
+
const decision = mapToGeminicliDecision(action);
|
|
10002
|
+
if (mappedToolName === "run_shell_command" && (pattern === "*" || pattern === "**") && decision !== "ask_user") {
|
|
10003
|
+
logger.warn(
|
|
10004
|
+
`Skipping rule "${toolName}: ${pattern}" with decision ${decision}: bash match-all patterns are only supported with "ask" because they would otherwise affect every shell command.`
|
|
10005
|
+
);
|
|
10006
|
+
continue;
|
|
9874
10007
|
}
|
|
10008
|
+
const currentRule = {
|
|
10009
|
+
toolName: mappedToolName,
|
|
10010
|
+
decision,
|
|
10011
|
+
priority: priorityForDecision(decision)
|
|
10012
|
+
};
|
|
10013
|
+
if (mappedToolName === "run_shell_command") {
|
|
10014
|
+
applyShellPattern({ rule: currentRule, pattern, toolName, logger });
|
|
10015
|
+
} else if (pattern !== "*") {
|
|
10016
|
+
currentRule.argsPattern = buildNonShellArgsPattern(pattern);
|
|
10017
|
+
}
|
|
10018
|
+
rules.push({ rule: currentRule, order: order++ });
|
|
9875
10019
|
}
|
|
9876
10020
|
}
|
|
9877
|
-
|
|
10021
|
+
rules.sort((a, b) => {
|
|
10022
|
+
const diff = toNumber(b.rule.priority) - toNumber(a.rule.priority);
|
|
10023
|
+
return diff !== 0 ? diff : a.order - b.order;
|
|
10024
|
+
});
|
|
10025
|
+
return smolToml5.stringify({ rule: rules.map((entry) => entry.rule) });
|
|
9878
10026
|
}
|
|
9879
|
-
function
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
return
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
10027
|
+
function buildNonShellArgsPattern(pattern) {
|
|
10028
|
+
return `"${globPatternToRegex(pattern)}${VALUE_END_ANCHOR}`;
|
|
10029
|
+
}
|
|
10030
|
+
function hasUnsafeAnchorChar(pattern) {
|
|
10031
|
+
return pattern.includes('"') || pattern.includes("\\");
|
|
10032
|
+
}
|
|
10033
|
+
function toNumber(value) {
|
|
10034
|
+
return typeof value === "number" ? value : 0;
|
|
10035
|
+
}
|
|
10036
|
+
function applyShellPattern({
|
|
10037
|
+
rule,
|
|
10038
|
+
pattern,
|
|
10039
|
+
toolName,
|
|
10040
|
+
logger
|
|
10041
|
+
}) {
|
|
10042
|
+
if (pattern === "*") {
|
|
10043
|
+
return;
|
|
10044
|
+
}
|
|
10045
|
+
const trailingWildcardStripped = pattern.endsWith(" *") ? pattern.slice(0, -2) : pattern;
|
|
10046
|
+
if (hasGlobMetacharacter(trailingWildcardStripped)) {
|
|
10047
|
+
rule.argsPattern = `${COMMAND_ARGS_ANCHOR}${globPatternToRegex(pattern)}`;
|
|
10048
|
+
logger.warn(
|
|
10049
|
+
`Gemini CLI does not support glob metacharacters inside a bash command prefix; emitting argsPattern for rule "${toolName}: ${pattern}".`
|
|
10050
|
+
);
|
|
10051
|
+
return;
|
|
10052
|
+
}
|
|
10053
|
+
rule.commandPrefix = trailingWildcardStripped;
|
|
10054
|
+
}
|
|
10055
|
+
function hasGlobMetacharacter(pattern) {
|
|
10056
|
+
return /[*?[\]]/.test(pattern);
|
|
10057
|
+
}
|
|
10058
|
+
function priorityForDecision(decision) {
|
|
10059
|
+
if (decision === "deny") return PRIORITY_DENY;
|
|
10060
|
+
if (decision === "ask_user") return PRIORITY_ASK;
|
|
10061
|
+
return PRIORITY_ALLOW;
|
|
10062
|
+
}
|
|
10063
|
+
function mapToGeminicliDecision(action) {
|
|
10064
|
+
if (action === "ask") {
|
|
10065
|
+
return "ask_user";
|
|
10066
|
+
}
|
|
10067
|
+
return action;
|
|
10068
|
+
}
|
|
10069
|
+
function mapFromGeminicliDecision(decision) {
|
|
10070
|
+
if (decision === "allow") return "allow";
|
|
10071
|
+
if (decision === "deny") return "deny";
|
|
10072
|
+
if (decision === "ask_user") return "ask";
|
|
10073
|
+
return null;
|
|
10074
|
+
}
|
|
10075
|
+
function globPatternToRegex(pattern) {
|
|
10076
|
+
let regex = "";
|
|
10077
|
+
let i = 0;
|
|
10078
|
+
while (i < pattern.length) {
|
|
10079
|
+
const char = pattern[i];
|
|
10080
|
+
if (char === void 0) {
|
|
10081
|
+
break;
|
|
10082
|
+
}
|
|
10083
|
+
if (char === "*" && pattern[i + 1] === "*") {
|
|
10084
|
+
regex += DOUBLE_STAR_REGEX;
|
|
10085
|
+
i += 2;
|
|
10086
|
+
continue;
|
|
10087
|
+
}
|
|
10088
|
+
if (char === "*") {
|
|
10089
|
+
regex += SINGLE_STAR_REGEX;
|
|
10090
|
+
i += 1;
|
|
10091
|
+
continue;
|
|
10092
|
+
}
|
|
10093
|
+
if (char === "?") {
|
|
10094
|
+
regex += SINGLE_CHAR_REGEX;
|
|
10095
|
+
i += 1;
|
|
10096
|
+
continue;
|
|
10097
|
+
}
|
|
10098
|
+
if (char === "[") {
|
|
10099
|
+
regex += escapeRegexChar(char);
|
|
10100
|
+
i += 1;
|
|
10101
|
+
continue;
|
|
10102
|
+
}
|
|
10103
|
+
if (char === "]") {
|
|
10104
|
+
regex += escapeRegexChar(char);
|
|
10105
|
+
i += 1;
|
|
10106
|
+
continue;
|
|
10107
|
+
}
|
|
10108
|
+
if (isRegexMetacharacter(char)) {
|
|
10109
|
+
regex += `\\${char}`;
|
|
10110
|
+
i += 1;
|
|
10111
|
+
continue;
|
|
10112
|
+
}
|
|
10113
|
+
regex += char;
|
|
10114
|
+
i += 1;
|
|
10115
|
+
}
|
|
10116
|
+
return regex;
|
|
10117
|
+
}
|
|
10118
|
+
function escapeRegexChar(char) {
|
|
10119
|
+
return `\\${char}`;
|
|
10120
|
+
}
|
|
10121
|
+
function isRegexMetacharacter(char) {
|
|
10122
|
+
return /[.+^${}()|\\]/.test(char);
|
|
10123
|
+
}
|
|
10124
|
+
function regexToGlobPattern(regex) {
|
|
10125
|
+
let source = regex;
|
|
10126
|
+
if (source.endsWith(VALUE_END_ANCHOR)) {
|
|
10127
|
+
source = source.slice(0, -VALUE_END_ANCHOR.length);
|
|
10128
|
+
}
|
|
10129
|
+
let glob = "";
|
|
10130
|
+
let i = 0;
|
|
10131
|
+
while (i < source.length) {
|
|
10132
|
+
if (source.startsWith(DOUBLE_STAR_REGEX, i)) {
|
|
10133
|
+
glob += "**";
|
|
10134
|
+
i += DOUBLE_STAR_REGEX.length;
|
|
10135
|
+
continue;
|
|
10136
|
+
}
|
|
10137
|
+
if (source.startsWith(LEGACY_DOUBLE_STAR_REGEX, i)) {
|
|
10138
|
+
glob += "**";
|
|
10139
|
+
i += LEGACY_DOUBLE_STAR_REGEX.length;
|
|
10140
|
+
continue;
|
|
10141
|
+
}
|
|
10142
|
+
if (source.startsWith(SINGLE_STAR_REGEX, i)) {
|
|
10143
|
+
glob += "*";
|
|
10144
|
+
i += SINGLE_STAR_REGEX.length;
|
|
10145
|
+
continue;
|
|
10146
|
+
}
|
|
10147
|
+
if (source.startsWith(LEGACY_SINGLE_STAR_REGEX, i)) {
|
|
10148
|
+
glob += "*";
|
|
10149
|
+
i += LEGACY_SINGLE_STAR_REGEX.length;
|
|
10150
|
+
continue;
|
|
10151
|
+
}
|
|
10152
|
+
if (source.startsWith(SINGLE_CHAR_REGEX, i)) {
|
|
10153
|
+
glob += "?";
|
|
10154
|
+
i += SINGLE_CHAR_REGEX.length;
|
|
10155
|
+
continue;
|
|
10156
|
+
}
|
|
10157
|
+
const char = source[i];
|
|
10158
|
+
if (char === "\\") {
|
|
10159
|
+
const escaped = source[i + 1];
|
|
10160
|
+
if (escaped !== void 0) {
|
|
10161
|
+
glob += escaped;
|
|
10162
|
+
i += 2;
|
|
10163
|
+
continue;
|
|
10164
|
+
}
|
|
10165
|
+
}
|
|
10166
|
+
glob += char ?? "";
|
|
10167
|
+
i += 1;
|
|
10168
|
+
}
|
|
10169
|
+
return glob;
|
|
10170
|
+
}
|
|
10171
|
+
var GeminicliPolicyRuleSchema = import_mini29.z.looseObject({
|
|
10172
|
+
toolName: import_mini29.z.string(),
|
|
10173
|
+
decision: import_mini29.z.optional(import_mini29.z.unknown()),
|
|
10174
|
+
commandPrefix: import_mini29.z.optional(import_mini29.z.string()),
|
|
10175
|
+
argsPattern: import_mini29.z.optional(import_mini29.z.string())
|
|
10176
|
+
});
|
|
10177
|
+
var GeminicliPolicyFileSchema = import_mini29.z.looseObject({
|
|
10178
|
+
rule: import_mini29.z.optional(import_mini29.z.array(import_mini29.z.looseObject({})))
|
|
10179
|
+
});
|
|
10180
|
+
function extractRules(parsed, logger) {
|
|
10181
|
+
const parsedFile = GeminicliPolicyFileSchema.safeParse(parsed);
|
|
10182
|
+
if (!parsedFile.success || !parsedFile.data.rule) {
|
|
10183
|
+
return [];
|
|
10184
|
+
}
|
|
10185
|
+
const rules = [];
|
|
10186
|
+
for (const [index, entry] of parsedFile.data.rule.entries()) {
|
|
10187
|
+
const result = GeminicliPolicyRuleSchema.safeParse(entry);
|
|
10188
|
+
if (result.success) {
|
|
10189
|
+
rules.push(result.data);
|
|
10190
|
+
continue;
|
|
10191
|
+
}
|
|
10192
|
+
logger.warn(
|
|
10193
|
+
`Skipping malformed Gemini CLI policy rule at index ${index}: ${formatError(result.error)}`
|
|
10194
|
+
);
|
|
10195
|
+
}
|
|
10196
|
+
return rules;
|
|
10197
|
+
}
|
|
10198
|
+
function extractPattern(rule) {
|
|
10199
|
+
if (rule.toolName === "run_shell_command") {
|
|
10200
|
+
if (rule.argsPattern) {
|
|
10201
|
+
const stripped = rule.argsPattern.startsWith(COMMAND_ARGS_ANCHOR) ? rule.argsPattern.slice(COMMAND_ARGS_ANCHOR.length) : rule.argsPattern;
|
|
10202
|
+
return regexToGlobPattern(stripped);
|
|
10203
|
+
}
|
|
10204
|
+
if (!rule.commandPrefix) return "*";
|
|
10205
|
+
return rule.commandPrefix.endsWith(" *") || rule.commandPrefix.endsWith("*") ? rule.commandPrefix : `${rule.commandPrefix} *`;
|
|
10206
|
+
}
|
|
10207
|
+
if (!rule.argsPattern) return "*";
|
|
10208
|
+
const regex = rule.argsPattern.startsWith('"') ? rule.argsPattern.slice(1) : rule.argsPattern;
|
|
10209
|
+
return regexToGlobPattern(regex);
|
|
9890
10210
|
}
|
|
9891
10211
|
|
|
9892
10212
|
// src/features/permissions/kiro-permissions.ts
|
|
@@ -10376,9 +10696,9 @@ var PermissionsProcessor = class extends FeatureProcessor {
|
|
|
10376
10696
|
};
|
|
10377
10697
|
|
|
10378
10698
|
// src/features/rules/rules-processor.ts
|
|
10379
|
-
var
|
|
10699
|
+
var import_node_path140 = require("path");
|
|
10380
10700
|
var import_toon = require("@toon-format/toon");
|
|
10381
|
-
var
|
|
10701
|
+
var import_mini72 = require("zod/mini");
|
|
10382
10702
|
|
|
10383
10703
|
// src/constants/general.ts
|
|
10384
10704
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -11166,8 +11486,8 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
|
|
|
11166
11486
|
};
|
|
11167
11487
|
|
|
11168
11488
|
// src/features/skills/skills-processor.ts
|
|
11169
|
-
var
|
|
11170
|
-
var
|
|
11489
|
+
var import_node_path95 = require("path");
|
|
11490
|
+
var import_mini52 = require("zod/mini");
|
|
11171
11491
|
|
|
11172
11492
|
// src/types/dir-feature-processor.ts
|
|
11173
11493
|
var import_node_path77 = require("path");
|
|
@@ -13807,40 +14127,201 @@ async function getLocalSkillDirNames(baseDir) {
|
|
|
13807
14127
|
return names;
|
|
13808
14128
|
}
|
|
13809
14129
|
|
|
13810
|
-
// src/features/skills/
|
|
13811
|
-
var
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
|
|
13830
|
-
|
|
13831
|
-
|
|
13832
|
-
|
|
13833
|
-
|
|
13834
|
-
|
|
13835
|
-
|
|
13836
|
-
|
|
13837
|
-
|
|
13838
|
-
|
|
13839
|
-
}
|
|
13840
|
-
|
|
13841
|
-
|
|
13842
|
-
|
|
13843
|
-
|
|
14130
|
+
// src/features/skills/windsurf-skill.ts
|
|
14131
|
+
var import_node_path94 = require("path");
|
|
14132
|
+
var import_mini51 = require("zod/mini");
|
|
14133
|
+
var WindsurfSkillFrontmatterSchema = import_mini51.z.looseObject({
|
|
14134
|
+
name: import_mini51.z.string(),
|
|
14135
|
+
description: import_mini51.z.string()
|
|
14136
|
+
});
|
|
14137
|
+
var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
|
|
14138
|
+
constructor({
|
|
14139
|
+
baseDir = process.cwd(),
|
|
14140
|
+
relativeDirPath = _WindsurfSkill.getSettablePaths().relativeDirPath,
|
|
14141
|
+
dirName,
|
|
14142
|
+
frontmatter,
|
|
14143
|
+
body,
|
|
14144
|
+
otherFiles = [],
|
|
14145
|
+
validate = true,
|
|
14146
|
+
global = false
|
|
14147
|
+
}) {
|
|
14148
|
+
super({
|
|
14149
|
+
baseDir,
|
|
14150
|
+
relativeDirPath,
|
|
14151
|
+
dirName,
|
|
14152
|
+
mainFile: {
|
|
14153
|
+
name: SKILL_FILE_NAME,
|
|
14154
|
+
body,
|
|
14155
|
+
frontmatter: { ...frontmatter }
|
|
14156
|
+
},
|
|
14157
|
+
otherFiles,
|
|
14158
|
+
global
|
|
14159
|
+
});
|
|
14160
|
+
if (validate) {
|
|
14161
|
+
const result = this.validate();
|
|
14162
|
+
if (!result.success) {
|
|
14163
|
+
throw result.error;
|
|
14164
|
+
}
|
|
14165
|
+
}
|
|
14166
|
+
}
|
|
14167
|
+
static getSettablePaths({ global = false } = {}) {
|
|
14168
|
+
if (global) {
|
|
14169
|
+
return {
|
|
14170
|
+
relativeDirPath: (0, import_node_path94.join)(".codeium", "windsurf", "skills")
|
|
14171
|
+
};
|
|
14172
|
+
}
|
|
14173
|
+
return {
|
|
14174
|
+
relativeDirPath: (0, import_node_path94.join)(".windsurf", "skills")
|
|
14175
|
+
};
|
|
14176
|
+
}
|
|
14177
|
+
getFrontmatter() {
|
|
14178
|
+
const result = WindsurfSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
|
|
14179
|
+
return result;
|
|
14180
|
+
}
|
|
14181
|
+
getBody() {
|
|
14182
|
+
return this.mainFile?.body ?? "";
|
|
14183
|
+
}
|
|
14184
|
+
validate() {
|
|
14185
|
+
if (!this.mainFile) {
|
|
14186
|
+
return {
|
|
14187
|
+
success: false,
|
|
14188
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
14189
|
+
};
|
|
14190
|
+
}
|
|
14191
|
+
const result = WindsurfSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
14192
|
+
if (!result.success) {
|
|
14193
|
+
return {
|
|
14194
|
+
success: false,
|
|
14195
|
+
error: new Error(
|
|
14196
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
14197
|
+
)
|
|
14198
|
+
};
|
|
14199
|
+
}
|
|
14200
|
+
return { success: true, error: null };
|
|
14201
|
+
}
|
|
14202
|
+
toRulesyncSkill() {
|
|
14203
|
+
const frontmatter = this.getFrontmatter();
|
|
14204
|
+
const rulesyncFrontmatter = {
|
|
14205
|
+
name: frontmatter.name,
|
|
14206
|
+
description: frontmatter.description,
|
|
14207
|
+
targets: ["*"]
|
|
14208
|
+
};
|
|
14209
|
+
return new RulesyncSkill({
|
|
14210
|
+
baseDir: this.baseDir,
|
|
14211
|
+
relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
|
|
14212
|
+
dirName: this.getDirName(),
|
|
14213
|
+
frontmatter: rulesyncFrontmatter,
|
|
14214
|
+
body: this.getBody(),
|
|
14215
|
+
otherFiles: this.getOtherFiles(),
|
|
14216
|
+
validate: true,
|
|
14217
|
+
global: this.global
|
|
14218
|
+
});
|
|
14219
|
+
}
|
|
14220
|
+
static fromRulesyncSkill({
|
|
14221
|
+
baseDir = process.cwd(),
|
|
14222
|
+
rulesyncSkill,
|
|
14223
|
+
validate = true,
|
|
14224
|
+
global = false
|
|
14225
|
+
}) {
|
|
14226
|
+
const settablePaths = _WindsurfSkill.getSettablePaths({ global });
|
|
14227
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
14228
|
+
const windsurfFrontmatter = {
|
|
14229
|
+
name: rulesyncFrontmatter.name,
|
|
14230
|
+
description: rulesyncFrontmatter.description
|
|
14231
|
+
};
|
|
14232
|
+
return new _WindsurfSkill({
|
|
14233
|
+
baseDir,
|
|
14234
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
14235
|
+
dirName: rulesyncSkill.getDirName(),
|
|
14236
|
+
frontmatter: windsurfFrontmatter,
|
|
14237
|
+
body: rulesyncSkill.getBody(),
|
|
14238
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
14239
|
+
validate,
|
|
14240
|
+
global
|
|
14241
|
+
});
|
|
14242
|
+
}
|
|
14243
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
14244
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
14245
|
+
return targets.includes("*") || targets.includes("windsurf");
|
|
14246
|
+
}
|
|
14247
|
+
static async fromDir(params) {
|
|
14248
|
+
const loaded = await this.loadSkillDirContent({
|
|
14249
|
+
...params,
|
|
14250
|
+
getSettablePaths: _WindsurfSkill.getSettablePaths
|
|
14251
|
+
});
|
|
14252
|
+
const result = WindsurfSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
14253
|
+
if (!result.success) {
|
|
14254
|
+
const skillDirPath = (0, import_node_path94.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
14255
|
+
throw new Error(
|
|
14256
|
+
`Invalid frontmatter in ${(0, import_node_path94.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
14257
|
+
);
|
|
14258
|
+
}
|
|
14259
|
+
return new _WindsurfSkill({
|
|
14260
|
+
baseDir: loaded.baseDir,
|
|
14261
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
14262
|
+
dirName: loaded.dirName,
|
|
14263
|
+
frontmatter: result.data,
|
|
14264
|
+
body: loaded.body,
|
|
14265
|
+
otherFiles: loaded.otherFiles,
|
|
14266
|
+
validate: true,
|
|
14267
|
+
global: loaded.global
|
|
14268
|
+
});
|
|
14269
|
+
}
|
|
14270
|
+
static forDeletion({
|
|
14271
|
+
baseDir = process.cwd(),
|
|
14272
|
+
relativeDirPath,
|
|
14273
|
+
dirName,
|
|
14274
|
+
global = false
|
|
14275
|
+
}) {
|
|
14276
|
+
const settablePaths = _WindsurfSkill.getSettablePaths({ global });
|
|
14277
|
+
return new _WindsurfSkill({
|
|
14278
|
+
baseDir,
|
|
14279
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
14280
|
+
dirName,
|
|
14281
|
+
frontmatter: { name: "", description: "" },
|
|
14282
|
+
body: "",
|
|
14283
|
+
otherFiles: [],
|
|
14284
|
+
validate: false,
|
|
14285
|
+
global
|
|
14286
|
+
});
|
|
14287
|
+
}
|
|
14288
|
+
};
|
|
14289
|
+
|
|
14290
|
+
// src/features/skills/skills-processor.ts
|
|
14291
|
+
var skillsProcessorToolTargetTuple = [
|
|
14292
|
+
"agentsmd",
|
|
14293
|
+
"agentsskills",
|
|
14294
|
+
"antigravity",
|
|
14295
|
+
"claudecode",
|
|
14296
|
+
"claudecode-legacy",
|
|
14297
|
+
"cline",
|
|
14298
|
+
"codexcli",
|
|
14299
|
+
"copilot",
|
|
14300
|
+
"cursor",
|
|
14301
|
+
"deepagents",
|
|
14302
|
+
"factorydroid",
|
|
14303
|
+
"geminicli",
|
|
14304
|
+
"junie",
|
|
14305
|
+
"kilo",
|
|
14306
|
+
"kiro",
|
|
14307
|
+
"opencode",
|
|
14308
|
+
"replit",
|
|
14309
|
+
"roo",
|
|
14310
|
+
"rovodev",
|
|
14311
|
+
"windsurf"
|
|
14312
|
+
];
|
|
14313
|
+
var SkillsProcessorToolTargetSchema = import_mini52.z.enum(skillsProcessorToolTargetTuple);
|
|
14314
|
+
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
14315
|
+
[
|
|
14316
|
+
"agentsmd",
|
|
14317
|
+
{
|
|
14318
|
+
class: AgentsmdSkill,
|
|
14319
|
+
meta: { supportsProject: true, supportsSimulated: true, supportsGlobal: false }
|
|
14320
|
+
}
|
|
14321
|
+
],
|
|
14322
|
+
[
|
|
14323
|
+
"agentsskills",
|
|
14324
|
+
{
|
|
13844
14325
|
class: AgentsSkillsSkill,
|
|
13845
14326
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: false }
|
|
13846
14327
|
}
|
|
@@ -13963,6 +14444,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
13963
14444
|
class: RovodevSkill,
|
|
13964
14445
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
13965
14446
|
}
|
|
14447
|
+
],
|
|
14448
|
+
[
|
|
14449
|
+
"windsurf",
|
|
14450
|
+
{
|
|
14451
|
+
class: WindsurfSkill,
|
|
14452
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
14453
|
+
}
|
|
13966
14454
|
]
|
|
13967
14455
|
]);
|
|
13968
14456
|
var defaultGetFactory4 = (target) => {
|
|
@@ -14053,11 +14541,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
14053
14541
|
)
|
|
14054
14542
|
);
|
|
14055
14543
|
const localSkillNames = new Set(localDirNames);
|
|
14056
|
-
const curatedDirPath = (0,
|
|
14544
|
+
const curatedDirPath = (0, import_node_path95.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
14057
14545
|
let curatedSkills = [];
|
|
14058
14546
|
if (await directoryExists(curatedDirPath)) {
|
|
14059
|
-
const curatedDirPaths = await findFilesByGlobs((0,
|
|
14060
|
-
const curatedDirNames = curatedDirPaths.map((path3) => (0,
|
|
14547
|
+
const curatedDirPaths = await findFilesByGlobs((0, import_node_path95.join)(curatedDirPath, "*"), { type: "dir" });
|
|
14548
|
+
const curatedDirNames = curatedDirPaths.map((path3) => (0, import_node_path95.basename)(path3));
|
|
14061
14549
|
const nonConflicting = curatedDirNames.filter((name) => {
|
|
14062
14550
|
if (localSkillNames.has(name)) {
|
|
14063
14551
|
this.logger.debug(`Skipping curated skill "${name}": local skill takes precedence.`);
|
|
@@ -14094,13 +14582,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
14094
14582
|
const seenDirNames = /* @__PURE__ */ new Set();
|
|
14095
14583
|
const loadEntries = [];
|
|
14096
14584
|
for (const root of roots) {
|
|
14097
|
-
const skillsDirPath = (0,
|
|
14585
|
+
const skillsDirPath = (0, import_node_path95.join)(this.baseDir, root);
|
|
14098
14586
|
if (!await directoryExists(skillsDirPath)) {
|
|
14099
14587
|
continue;
|
|
14100
14588
|
}
|
|
14101
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
14589
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path95.join)(skillsDirPath, "*"), { type: "dir" });
|
|
14102
14590
|
for (const dirPath of dirPaths) {
|
|
14103
|
-
const dirName = (0,
|
|
14591
|
+
const dirName = (0, import_node_path95.basename)(dirPath);
|
|
14104
14592
|
if (seenDirNames.has(dirName)) {
|
|
14105
14593
|
continue;
|
|
14106
14594
|
}
|
|
@@ -14129,13 +14617,13 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
14129
14617
|
const roots = toolSkillSearchRoots(paths);
|
|
14130
14618
|
const toolSkills = [];
|
|
14131
14619
|
for (const root of roots) {
|
|
14132
|
-
const skillsDirPath = (0,
|
|
14620
|
+
const skillsDirPath = (0, import_node_path95.join)(this.baseDir, root);
|
|
14133
14621
|
if (!await directoryExists(skillsDirPath)) {
|
|
14134
14622
|
continue;
|
|
14135
14623
|
}
|
|
14136
|
-
const dirPaths = await findFilesByGlobs((0,
|
|
14624
|
+
const dirPaths = await findFilesByGlobs((0, import_node_path95.join)(skillsDirPath, "*"), { type: "dir" });
|
|
14137
14625
|
for (const dirPath of dirPaths) {
|
|
14138
|
-
const dirName = (0,
|
|
14626
|
+
const dirName = (0, import_node_path95.basename)(dirPath);
|
|
14139
14627
|
const toolSkill = factory.class.forDeletion({
|
|
14140
14628
|
baseDir: this.baseDir,
|
|
14141
14629
|
relativeDirPath: root,
|
|
@@ -14197,11 +14685,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
14197
14685
|
};
|
|
14198
14686
|
|
|
14199
14687
|
// src/features/subagents/agentsmd-subagent.ts
|
|
14200
|
-
var
|
|
14688
|
+
var import_node_path97 = require("path");
|
|
14201
14689
|
|
|
14202
14690
|
// src/features/subagents/simulated-subagent.ts
|
|
14203
|
-
var
|
|
14204
|
-
var
|
|
14691
|
+
var import_node_path96 = require("path");
|
|
14692
|
+
var import_mini53 = require("zod/mini");
|
|
14205
14693
|
|
|
14206
14694
|
// src/features/subagents/tool-subagent.ts
|
|
14207
14695
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -14253,9 +14741,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
14253
14741
|
};
|
|
14254
14742
|
|
|
14255
14743
|
// src/features/subagents/simulated-subagent.ts
|
|
14256
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
14257
|
-
name:
|
|
14258
|
-
description:
|
|
14744
|
+
var SimulatedSubagentFrontmatterSchema = import_mini53.z.object({
|
|
14745
|
+
name: import_mini53.z.string(),
|
|
14746
|
+
description: import_mini53.z.optional(import_mini53.z.string())
|
|
14259
14747
|
});
|
|
14260
14748
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
14261
14749
|
frontmatter;
|
|
@@ -14265,7 +14753,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
14265
14753
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14266
14754
|
if (!result.success) {
|
|
14267
14755
|
throw new Error(
|
|
14268
|
-
`Invalid frontmatter in ${(0,
|
|
14756
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14269
14757
|
);
|
|
14270
14758
|
}
|
|
14271
14759
|
}
|
|
@@ -14316,7 +14804,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
14316
14804
|
return {
|
|
14317
14805
|
success: false,
|
|
14318
14806
|
error: new Error(
|
|
14319
|
-
`Invalid frontmatter in ${(0,
|
|
14807
|
+
`Invalid frontmatter in ${(0, import_node_path96.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14320
14808
|
)
|
|
14321
14809
|
};
|
|
14322
14810
|
}
|
|
@@ -14326,7 +14814,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
14326
14814
|
relativeFilePath,
|
|
14327
14815
|
validate = true
|
|
14328
14816
|
}) {
|
|
14329
|
-
const filePath = (0,
|
|
14817
|
+
const filePath = (0, import_node_path96.join)(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
14330
14818
|
const fileContent = await readFileContent(filePath);
|
|
14331
14819
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14332
14820
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14336,7 +14824,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
14336
14824
|
return {
|
|
14337
14825
|
baseDir,
|
|
14338
14826
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
14339
|
-
relativeFilePath: (0,
|
|
14827
|
+
relativeFilePath: (0, import_node_path96.basename)(relativeFilePath),
|
|
14340
14828
|
frontmatter: result.data,
|
|
14341
14829
|
body: content.trim(),
|
|
14342
14830
|
validate
|
|
@@ -14362,7 +14850,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
14362
14850
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
14363
14851
|
static getSettablePaths() {
|
|
14364
14852
|
return {
|
|
14365
|
-
relativeDirPath: (0,
|
|
14853
|
+
relativeDirPath: (0, import_node_path97.join)(".agents", "subagents")
|
|
14366
14854
|
};
|
|
14367
14855
|
}
|
|
14368
14856
|
static async fromFile(params) {
|
|
@@ -14385,11 +14873,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
14385
14873
|
};
|
|
14386
14874
|
|
|
14387
14875
|
// src/features/subagents/factorydroid-subagent.ts
|
|
14388
|
-
var
|
|
14876
|
+
var import_node_path98 = require("path");
|
|
14389
14877
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
14390
14878
|
static getSettablePaths(_options) {
|
|
14391
14879
|
return {
|
|
14392
|
-
relativeDirPath: (0,
|
|
14880
|
+
relativeDirPath: (0, import_node_path98.join)(".factory", "droids")
|
|
14393
14881
|
};
|
|
14394
14882
|
}
|
|
14395
14883
|
static async fromFile(params) {
|
|
@@ -14412,16 +14900,16 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
14412
14900
|
};
|
|
14413
14901
|
|
|
14414
14902
|
// src/features/subagents/geminicli-subagent.ts
|
|
14415
|
-
var
|
|
14416
|
-
var
|
|
14903
|
+
var import_node_path100 = require("path");
|
|
14904
|
+
var import_mini55 = require("zod/mini");
|
|
14417
14905
|
|
|
14418
14906
|
// src/features/subagents/rulesync-subagent.ts
|
|
14419
|
-
var
|
|
14420
|
-
var
|
|
14421
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
14422
|
-
targets:
|
|
14423
|
-
name:
|
|
14424
|
-
description:
|
|
14907
|
+
var import_node_path99 = require("path");
|
|
14908
|
+
var import_mini54 = require("zod/mini");
|
|
14909
|
+
var RulesyncSubagentFrontmatterSchema = import_mini54.z.looseObject({
|
|
14910
|
+
targets: import_mini54.z._default(RulesyncTargetsSchema, ["*"]),
|
|
14911
|
+
name: import_mini54.z.string(),
|
|
14912
|
+
description: import_mini54.z.optional(import_mini54.z.string())
|
|
14425
14913
|
});
|
|
14426
14914
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
14427
14915
|
frontmatter;
|
|
@@ -14430,7 +14918,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
14430
14918
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14431
14919
|
if (!parseResult.success && rest.validate !== false) {
|
|
14432
14920
|
throw new Error(
|
|
14433
|
-
`Invalid frontmatter in ${(0,
|
|
14921
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
14434
14922
|
);
|
|
14435
14923
|
}
|
|
14436
14924
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -14463,7 +14951,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
14463
14951
|
return {
|
|
14464
14952
|
success: false,
|
|
14465
14953
|
error: new Error(
|
|
14466
|
-
`Invalid frontmatter in ${(0,
|
|
14954
|
+
`Invalid frontmatter in ${(0, import_node_path99.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14467
14955
|
)
|
|
14468
14956
|
};
|
|
14469
14957
|
}
|
|
@@ -14471,14 +14959,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
14471
14959
|
static async fromFile({
|
|
14472
14960
|
relativeFilePath
|
|
14473
14961
|
}) {
|
|
14474
|
-
const filePath = (0,
|
|
14962
|
+
const filePath = (0, import_node_path99.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
|
|
14475
14963
|
const fileContent = await readFileContent(filePath);
|
|
14476
14964
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14477
14965
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14478
14966
|
if (!result.success) {
|
|
14479
14967
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
14480
14968
|
}
|
|
14481
|
-
const filename = (0,
|
|
14969
|
+
const filename = (0, import_node_path99.basename)(relativeFilePath);
|
|
14482
14970
|
return new _RulesyncSubagent({
|
|
14483
14971
|
baseDir: process.cwd(),
|
|
14484
14972
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -14490,9 +14978,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
14490
14978
|
};
|
|
14491
14979
|
|
|
14492
14980
|
// src/features/subagents/geminicli-subagent.ts
|
|
14493
|
-
var GeminiCliSubagentFrontmatterSchema =
|
|
14494
|
-
name:
|
|
14495
|
-
description:
|
|
14981
|
+
var GeminiCliSubagentFrontmatterSchema = import_mini55.z.looseObject({
|
|
14982
|
+
name: import_mini55.z.string(),
|
|
14983
|
+
description: import_mini55.z.optional(import_mini55.z.string())
|
|
14496
14984
|
});
|
|
14497
14985
|
var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
14498
14986
|
frontmatter;
|
|
@@ -14502,7 +14990,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
14502
14990
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14503
14991
|
if (!result.success) {
|
|
14504
14992
|
throw new Error(
|
|
14505
|
-
`Invalid frontmatter in ${(0,
|
|
14993
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14506
14994
|
);
|
|
14507
14995
|
}
|
|
14508
14996
|
}
|
|
@@ -14515,7 +15003,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
14515
15003
|
}
|
|
14516
15004
|
static getSettablePaths(_options = {}) {
|
|
14517
15005
|
return {
|
|
14518
|
-
relativeDirPath: (0,
|
|
15006
|
+
relativeDirPath: (0, import_node_path100.join)(".gemini", "agents")
|
|
14519
15007
|
};
|
|
14520
15008
|
}
|
|
14521
15009
|
getFrontmatter() {
|
|
@@ -14583,7 +15071,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
14583
15071
|
return {
|
|
14584
15072
|
success: false,
|
|
14585
15073
|
error: new Error(
|
|
14586
|
-
`Invalid frontmatter in ${(0,
|
|
15074
|
+
`Invalid frontmatter in ${(0, import_node_path100.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14587
15075
|
)
|
|
14588
15076
|
};
|
|
14589
15077
|
}
|
|
@@ -14601,7 +15089,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
14601
15089
|
global = false
|
|
14602
15090
|
}) {
|
|
14603
15091
|
const paths = this.getSettablePaths({ global });
|
|
14604
|
-
const filePath = (0,
|
|
15092
|
+
const filePath = (0, import_node_path100.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14605
15093
|
const fileContent = await readFileContent(filePath);
|
|
14606
15094
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14607
15095
|
const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14637,11 +15125,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
|
|
|
14637
15125
|
};
|
|
14638
15126
|
|
|
14639
15127
|
// src/features/subagents/roo-subagent.ts
|
|
14640
|
-
var
|
|
15128
|
+
var import_node_path101 = require("path");
|
|
14641
15129
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
14642
15130
|
static getSettablePaths() {
|
|
14643
15131
|
return {
|
|
14644
|
-
relativeDirPath: (0,
|
|
15132
|
+
relativeDirPath: (0, import_node_path101.join)(".roo", "subagents")
|
|
14645
15133
|
};
|
|
14646
15134
|
}
|
|
14647
15135
|
static async fromFile(params) {
|
|
@@ -14664,11 +15152,11 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
14664
15152
|
};
|
|
14665
15153
|
|
|
14666
15154
|
// src/features/subagents/rovodev-subagent.ts
|
|
14667
|
-
var
|
|
14668
|
-
var
|
|
14669
|
-
var RovodevSubagentFrontmatterSchema =
|
|
14670
|
-
name:
|
|
14671
|
-
description:
|
|
15155
|
+
var import_node_path102 = require("path");
|
|
15156
|
+
var import_mini56 = require("zod/mini");
|
|
15157
|
+
var RovodevSubagentFrontmatterSchema = import_mini56.z.looseObject({
|
|
15158
|
+
name: import_mini56.z.string(),
|
|
15159
|
+
description: import_mini56.z.optional(import_mini56.z.string())
|
|
14672
15160
|
});
|
|
14673
15161
|
var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
14674
15162
|
frontmatter;
|
|
@@ -14678,7 +15166,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
14678
15166
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14679
15167
|
if (!result.success) {
|
|
14680
15168
|
throw new Error(
|
|
14681
|
-
`Invalid frontmatter in ${(0,
|
|
15169
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14682
15170
|
);
|
|
14683
15171
|
}
|
|
14684
15172
|
}
|
|
@@ -14690,7 +15178,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
14690
15178
|
}
|
|
14691
15179
|
static getSettablePaths(_options = {}) {
|
|
14692
15180
|
return {
|
|
14693
|
-
relativeDirPath: (0,
|
|
15181
|
+
relativeDirPath: (0, import_node_path102.join)(".rovodev", "subagents")
|
|
14694
15182
|
};
|
|
14695
15183
|
}
|
|
14696
15184
|
getFrontmatter() {
|
|
@@ -14753,7 +15241,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
14753
15241
|
return {
|
|
14754
15242
|
success: false,
|
|
14755
15243
|
error: new Error(
|
|
14756
|
-
`Invalid frontmatter in ${(0,
|
|
15244
|
+
`Invalid frontmatter in ${(0, import_node_path102.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14757
15245
|
)
|
|
14758
15246
|
};
|
|
14759
15247
|
}
|
|
@@ -14770,7 +15258,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
14770
15258
|
global = false
|
|
14771
15259
|
}) {
|
|
14772
15260
|
const paths = this.getSettablePaths({ global });
|
|
14773
|
-
const filePath = (0,
|
|
15261
|
+
const filePath = (0, import_node_path102.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14774
15262
|
const fileContent = await readFileContent(filePath);
|
|
14775
15263
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14776
15264
|
const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14809,19 +15297,19 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
|
|
|
14809
15297
|
};
|
|
14810
15298
|
|
|
14811
15299
|
// src/features/subagents/subagents-processor.ts
|
|
14812
|
-
var
|
|
14813
|
-
var
|
|
15300
|
+
var import_node_path113 = require("path");
|
|
15301
|
+
var import_mini65 = require("zod/mini");
|
|
14814
15302
|
|
|
14815
15303
|
// src/features/subagents/claudecode-subagent.ts
|
|
14816
|
-
var
|
|
14817
|
-
var
|
|
14818
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
14819
|
-
name:
|
|
14820
|
-
description:
|
|
14821
|
-
model:
|
|
14822
|
-
tools:
|
|
14823
|
-
permissionMode:
|
|
14824
|
-
skills:
|
|
15304
|
+
var import_node_path103 = require("path");
|
|
15305
|
+
var import_mini57 = require("zod/mini");
|
|
15306
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini57.z.looseObject({
|
|
15307
|
+
name: import_mini57.z.string(),
|
|
15308
|
+
description: import_mini57.z.optional(import_mini57.z.string()),
|
|
15309
|
+
model: import_mini57.z.optional(import_mini57.z.string()),
|
|
15310
|
+
tools: import_mini57.z.optional(import_mini57.z.union([import_mini57.z.string(), import_mini57.z.array(import_mini57.z.string())])),
|
|
15311
|
+
permissionMode: import_mini57.z.optional(import_mini57.z.string()),
|
|
15312
|
+
skills: import_mini57.z.optional(import_mini57.z.union([import_mini57.z.string(), import_mini57.z.array(import_mini57.z.string())]))
|
|
14825
15313
|
});
|
|
14826
15314
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
14827
15315
|
frontmatter;
|
|
@@ -14831,7 +15319,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
14831
15319
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
14832
15320
|
if (!result.success) {
|
|
14833
15321
|
throw new Error(
|
|
14834
|
-
`Invalid frontmatter in ${(0,
|
|
15322
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
14835
15323
|
);
|
|
14836
15324
|
}
|
|
14837
15325
|
}
|
|
@@ -14843,7 +15331,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
14843
15331
|
}
|
|
14844
15332
|
static getSettablePaths(_options = {}) {
|
|
14845
15333
|
return {
|
|
14846
|
-
relativeDirPath: (0,
|
|
15334
|
+
relativeDirPath: (0, import_node_path103.join)(".claude", "agents")
|
|
14847
15335
|
};
|
|
14848
15336
|
}
|
|
14849
15337
|
getFrontmatter() {
|
|
@@ -14922,7 +15410,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
14922
15410
|
return {
|
|
14923
15411
|
success: false,
|
|
14924
15412
|
error: new Error(
|
|
14925
|
-
`Invalid frontmatter in ${(0,
|
|
15413
|
+
`Invalid frontmatter in ${(0, import_node_path103.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
14926
15414
|
)
|
|
14927
15415
|
};
|
|
14928
15416
|
}
|
|
@@ -14940,7 +15428,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
14940
15428
|
global = false
|
|
14941
15429
|
}) {
|
|
14942
15430
|
const paths = this.getSettablePaths({ global });
|
|
14943
|
-
const filePath = (0,
|
|
15431
|
+
const filePath = (0, import_node_path103.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
14944
15432
|
const fileContent = await readFileContent(filePath);
|
|
14945
15433
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
14946
15434
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -14975,26 +15463,26 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
14975
15463
|
};
|
|
14976
15464
|
|
|
14977
15465
|
// src/features/subagents/codexcli-subagent.ts
|
|
14978
|
-
var
|
|
14979
|
-
var
|
|
14980
|
-
var
|
|
14981
|
-
var CodexCliSubagentTomlSchema =
|
|
14982
|
-
name:
|
|
14983
|
-
description:
|
|
14984
|
-
developer_instructions:
|
|
14985
|
-
model:
|
|
14986
|
-
model_reasoning_effort:
|
|
14987
|
-
sandbox_mode:
|
|
15466
|
+
var import_node_path104 = require("path");
|
|
15467
|
+
var smolToml6 = __toESM(require("smol-toml"), 1);
|
|
15468
|
+
var import_mini58 = require("zod/mini");
|
|
15469
|
+
var CodexCliSubagentTomlSchema = import_mini58.z.looseObject({
|
|
15470
|
+
name: import_mini58.z.string(),
|
|
15471
|
+
description: import_mini58.z.optional(import_mini58.z.string()),
|
|
15472
|
+
developer_instructions: import_mini58.z.optional(import_mini58.z.string()),
|
|
15473
|
+
model: import_mini58.z.optional(import_mini58.z.string()),
|
|
15474
|
+
model_reasoning_effort: import_mini58.z.optional(import_mini58.z.string()),
|
|
15475
|
+
sandbox_mode: import_mini58.z.optional(import_mini58.z.string())
|
|
14988
15476
|
});
|
|
14989
15477
|
function stringifyCodexCliSubagentToml(tomlObj) {
|
|
14990
15478
|
const { developer_instructions, ...restFields } = tomlObj;
|
|
14991
|
-
const restToml =
|
|
15479
|
+
const restToml = smolToml6.stringify(restFields).trimEnd();
|
|
14992
15480
|
if (developer_instructions === void 0) {
|
|
14993
15481
|
return restToml;
|
|
14994
15482
|
}
|
|
14995
|
-
const developerInstructionsToml = developer_instructions.includes("\n") ? developer_instructions.includes("'''") ?
|
|
15483
|
+
const developerInstructionsToml = developer_instructions.includes("\n") ? developer_instructions.includes("'''") ? smolToml6.stringify({ developer_instructions }).trimEnd() : `developer_instructions = '''
|
|
14996
15484
|
${developer_instructions}
|
|
14997
|
-
'''` :
|
|
15485
|
+
'''` : smolToml6.stringify({ developer_instructions }).trimEnd();
|
|
14998
15486
|
return [restToml, developerInstructionsToml].filter((value) => value.length > 0).join("\n");
|
|
14999
15487
|
}
|
|
15000
15488
|
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
@@ -15002,11 +15490,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15002
15490
|
constructor({ body, ...rest }) {
|
|
15003
15491
|
if (rest.validate !== false) {
|
|
15004
15492
|
try {
|
|
15005
|
-
const parsed =
|
|
15493
|
+
const parsed = smolToml6.parse(body);
|
|
15006
15494
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
15007
15495
|
} catch (error) {
|
|
15008
15496
|
throw new Error(
|
|
15009
|
-
`Invalid TOML in ${(0,
|
|
15497
|
+
`Invalid TOML in ${(0, import_node_path104.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
15010
15498
|
{ cause: error }
|
|
15011
15499
|
);
|
|
15012
15500
|
}
|
|
@@ -15018,7 +15506,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15018
15506
|
}
|
|
15019
15507
|
static getSettablePaths(_options = {}) {
|
|
15020
15508
|
return {
|
|
15021
|
-
relativeDirPath: (0,
|
|
15509
|
+
relativeDirPath: (0, import_node_path104.join)(".codex", "agents")
|
|
15022
15510
|
};
|
|
15023
15511
|
}
|
|
15024
15512
|
getBody() {
|
|
@@ -15027,10 +15515,10 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15027
15515
|
toRulesyncSubagent() {
|
|
15028
15516
|
let parsed;
|
|
15029
15517
|
try {
|
|
15030
|
-
parsed = CodexCliSubagentTomlSchema.parse(
|
|
15518
|
+
parsed = CodexCliSubagentTomlSchema.parse(smolToml6.parse(this.body));
|
|
15031
15519
|
} catch (error) {
|
|
15032
15520
|
throw new Error(
|
|
15033
|
-
`Failed to parse TOML in ${(0,
|
|
15521
|
+
`Failed to parse TOML in ${(0, import_node_path104.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
15034
15522
|
{ cause: error }
|
|
15035
15523
|
);
|
|
15036
15524
|
}
|
|
@@ -15088,7 +15576,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15088
15576
|
}
|
|
15089
15577
|
validate() {
|
|
15090
15578
|
try {
|
|
15091
|
-
const parsed =
|
|
15579
|
+
const parsed = smolToml6.parse(this.body);
|
|
15092
15580
|
CodexCliSubagentTomlSchema.parse(parsed);
|
|
15093
15581
|
return { success: true, error: null };
|
|
15094
15582
|
} catch (error) {
|
|
@@ -15111,7 +15599,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15111
15599
|
global = false
|
|
15112
15600
|
}) {
|
|
15113
15601
|
const paths = this.getSettablePaths({ global });
|
|
15114
|
-
const filePath = (0,
|
|
15602
|
+
const filePath = (0, import_node_path104.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
15115
15603
|
const fileContent = await readFileContent(filePath);
|
|
15116
15604
|
const subagent = new _CodexCliSubagent({
|
|
15117
15605
|
baseDir,
|
|
@@ -15149,13 +15637,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
|
15149
15637
|
};
|
|
15150
15638
|
|
|
15151
15639
|
// src/features/subagents/copilot-subagent.ts
|
|
15152
|
-
var
|
|
15153
|
-
var
|
|
15640
|
+
var import_node_path105 = require("path");
|
|
15641
|
+
var import_mini59 = require("zod/mini");
|
|
15154
15642
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
15155
|
-
var CopilotSubagentFrontmatterSchema =
|
|
15156
|
-
name:
|
|
15157
|
-
description:
|
|
15158
|
-
tools:
|
|
15643
|
+
var CopilotSubagentFrontmatterSchema = import_mini59.z.looseObject({
|
|
15644
|
+
name: import_mini59.z.string(),
|
|
15645
|
+
description: import_mini59.z.optional(import_mini59.z.string()),
|
|
15646
|
+
tools: import_mini59.z.optional(import_mini59.z.union([import_mini59.z.string(), import_mini59.z.array(import_mini59.z.string())]))
|
|
15159
15647
|
});
|
|
15160
15648
|
var normalizeTools = (tools) => {
|
|
15161
15649
|
if (!tools) {
|
|
@@ -15175,7 +15663,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15175
15663
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
15176
15664
|
if (!result.success) {
|
|
15177
15665
|
throw new Error(
|
|
15178
|
-
`Invalid frontmatter in ${(0,
|
|
15666
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15179
15667
|
);
|
|
15180
15668
|
}
|
|
15181
15669
|
}
|
|
@@ -15187,7 +15675,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15187
15675
|
}
|
|
15188
15676
|
static getSettablePaths(_options = {}) {
|
|
15189
15677
|
return {
|
|
15190
|
-
relativeDirPath: (0,
|
|
15678
|
+
relativeDirPath: (0, import_node_path105.join)(".github", "agents")
|
|
15191
15679
|
};
|
|
15192
15680
|
}
|
|
15193
15681
|
getFrontmatter() {
|
|
@@ -15265,7 +15753,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15265
15753
|
return {
|
|
15266
15754
|
success: false,
|
|
15267
15755
|
error: new Error(
|
|
15268
|
-
`Invalid frontmatter in ${(0,
|
|
15756
|
+
`Invalid frontmatter in ${(0, import_node_path105.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15269
15757
|
)
|
|
15270
15758
|
};
|
|
15271
15759
|
}
|
|
@@ -15283,7 +15771,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15283
15771
|
global = false
|
|
15284
15772
|
}) {
|
|
15285
15773
|
const paths = this.getSettablePaths({ global });
|
|
15286
|
-
const filePath = (0,
|
|
15774
|
+
const filePath = (0, import_node_path105.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
15287
15775
|
const fileContent = await readFileContent(filePath);
|
|
15288
15776
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15289
15777
|
const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15319,11 +15807,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
15319
15807
|
};
|
|
15320
15808
|
|
|
15321
15809
|
// src/features/subagents/cursor-subagent.ts
|
|
15322
|
-
var
|
|
15323
|
-
var
|
|
15324
|
-
var CursorSubagentFrontmatterSchema =
|
|
15325
|
-
name:
|
|
15326
|
-
description:
|
|
15810
|
+
var import_node_path106 = require("path");
|
|
15811
|
+
var import_mini60 = require("zod/mini");
|
|
15812
|
+
var CursorSubagentFrontmatterSchema = import_mini60.z.looseObject({
|
|
15813
|
+
name: import_mini60.z.string(),
|
|
15814
|
+
description: import_mini60.z.optional(import_mini60.z.string())
|
|
15327
15815
|
});
|
|
15328
15816
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
15329
15817
|
frontmatter;
|
|
@@ -15333,7 +15821,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
15333
15821
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
15334
15822
|
if (!result.success) {
|
|
15335
15823
|
throw new Error(
|
|
15336
|
-
`Invalid frontmatter in ${(0,
|
|
15824
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15337
15825
|
);
|
|
15338
15826
|
}
|
|
15339
15827
|
}
|
|
@@ -15345,7 +15833,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
15345
15833
|
}
|
|
15346
15834
|
static getSettablePaths(_options = {}) {
|
|
15347
15835
|
return {
|
|
15348
|
-
relativeDirPath: (0,
|
|
15836
|
+
relativeDirPath: (0, import_node_path106.join)(".cursor", "agents")
|
|
15349
15837
|
};
|
|
15350
15838
|
}
|
|
15351
15839
|
getFrontmatter() {
|
|
@@ -15412,7 +15900,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
15412
15900
|
return {
|
|
15413
15901
|
success: false,
|
|
15414
15902
|
error: new Error(
|
|
15415
|
-
`Invalid frontmatter in ${(0,
|
|
15903
|
+
`Invalid frontmatter in ${(0, import_node_path106.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15416
15904
|
)
|
|
15417
15905
|
};
|
|
15418
15906
|
}
|
|
@@ -15430,7 +15918,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
15430
15918
|
global = false
|
|
15431
15919
|
}) {
|
|
15432
15920
|
const paths = this.getSettablePaths({ global });
|
|
15433
|
-
const filePath = (0,
|
|
15921
|
+
const filePath = (0, import_node_path106.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
15434
15922
|
const fileContent = await readFileContent(filePath);
|
|
15435
15923
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15436
15924
|
const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15466,12 +15954,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
15466
15954
|
};
|
|
15467
15955
|
|
|
15468
15956
|
// src/features/subagents/deepagents-subagent.ts
|
|
15469
|
-
var
|
|
15470
|
-
var
|
|
15471
|
-
var DeepagentsSubagentFrontmatterSchema =
|
|
15472
|
-
name:
|
|
15473
|
-
description:
|
|
15474
|
-
model:
|
|
15957
|
+
var import_node_path107 = require("path");
|
|
15958
|
+
var import_mini61 = require("zod/mini");
|
|
15959
|
+
var DeepagentsSubagentFrontmatterSchema = import_mini61.z.looseObject({
|
|
15960
|
+
name: import_mini61.z.string(),
|
|
15961
|
+
description: import_mini61.z.optional(import_mini61.z.string()),
|
|
15962
|
+
model: import_mini61.z.optional(import_mini61.z.string())
|
|
15475
15963
|
});
|
|
15476
15964
|
var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
15477
15965
|
frontmatter;
|
|
@@ -15481,7 +15969,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
15481
15969
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
15482
15970
|
if (!result.success) {
|
|
15483
15971
|
throw new Error(
|
|
15484
|
-
`Invalid frontmatter in ${(0,
|
|
15972
|
+
`Invalid frontmatter in ${(0, import_node_path107.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15485
15973
|
);
|
|
15486
15974
|
}
|
|
15487
15975
|
}
|
|
@@ -15491,7 +15979,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
15491
15979
|
}
|
|
15492
15980
|
static getSettablePaths(_options = {}) {
|
|
15493
15981
|
return {
|
|
15494
|
-
relativeDirPath: (0,
|
|
15982
|
+
relativeDirPath: (0, import_node_path107.join)(".deepagents", "agents")
|
|
15495
15983
|
};
|
|
15496
15984
|
}
|
|
15497
15985
|
getFrontmatter() {
|
|
@@ -15566,7 +16054,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
15566
16054
|
return {
|
|
15567
16055
|
success: false,
|
|
15568
16056
|
error: new Error(
|
|
15569
|
-
`Invalid frontmatter in ${(0,
|
|
16057
|
+
`Invalid frontmatter in ${(0, import_node_path107.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15570
16058
|
)
|
|
15571
16059
|
};
|
|
15572
16060
|
}
|
|
@@ -15584,7 +16072,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
15584
16072
|
global = false
|
|
15585
16073
|
}) {
|
|
15586
16074
|
const paths = this.getSettablePaths({ global });
|
|
15587
|
-
const filePath = (0,
|
|
16075
|
+
const filePath = (0, import_node_path107.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
15588
16076
|
const fileContent = await readFileContent(filePath);
|
|
15589
16077
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15590
16078
|
const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15619,11 +16107,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
|
|
|
15619
16107
|
};
|
|
15620
16108
|
|
|
15621
16109
|
// src/features/subagents/junie-subagent.ts
|
|
15622
|
-
var
|
|
15623
|
-
var
|
|
15624
|
-
var JunieSubagentFrontmatterSchema =
|
|
15625
|
-
name:
|
|
15626
|
-
description:
|
|
16110
|
+
var import_node_path108 = require("path");
|
|
16111
|
+
var import_mini62 = require("zod/mini");
|
|
16112
|
+
var JunieSubagentFrontmatterSchema = import_mini62.z.looseObject({
|
|
16113
|
+
name: import_mini62.z.optional(import_mini62.z.string()),
|
|
16114
|
+
description: import_mini62.z.string()
|
|
15627
16115
|
});
|
|
15628
16116
|
var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
15629
16117
|
frontmatter;
|
|
@@ -15633,7 +16121,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
15633
16121
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
15634
16122
|
if (!result.success) {
|
|
15635
16123
|
throw new Error(
|
|
15636
|
-
`Invalid frontmatter in ${(0,
|
|
16124
|
+
`Invalid frontmatter in ${(0, import_node_path108.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15637
16125
|
);
|
|
15638
16126
|
}
|
|
15639
16127
|
}
|
|
@@ -15648,7 +16136,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
15648
16136
|
throw new Error("JunieSubagent does not support global mode.");
|
|
15649
16137
|
}
|
|
15650
16138
|
return {
|
|
15651
|
-
relativeDirPath: (0,
|
|
16139
|
+
relativeDirPath: (0, import_node_path108.join)(".junie", "agents")
|
|
15652
16140
|
};
|
|
15653
16141
|
}
|
|
15654
16142
|
getFrontmatter() {
|
|
@@ -15724,7 +16212,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
15724
16212
|
return {
|
|
15725
16213
|
success: false,
|
|
15726
16214
|
error: new Error(
|
|
15727
|
-
`Invalid frontmatter in ${(0,
|
|
16215
|
+
`Invalid frontmatter in ${(0, import_node_path108.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15728
16216
|
)
|
|
15729
16217
|
};
|
|
15730
16218
|
}
|
|
@@ -15742,7 +16230,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
15742
16230
|
global = false
|
|
15743
16231
|
}) {
|
|
15744
16232
|
const paths = this.getSettablePaths({ global });
|
|
15745
|
-
const filePath = (0,
|
|
16233
|
+
const filePath = (0, import_node_path108.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
15746
16234
|
const fileContent = await readFileContent(filePath);
|
|
15747
16235
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15748
16236
|
const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15777,15 +16265,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
|
|
|
15777
16265
|
};
|
|
15778
16266
|
|
|
15779
16267
|
// src/features/subagents/kilo-subagent.ts
|
|
15780
|
-
var
|
|
16268
|
+
var import_node_path110 = require("path");
|
|
15781
16269
|
|
|
15782
16270
|
// src/features/subagents/opencode-style-subagent.ts
|
|
15783
|
-
var
|
|
15784
|
-
var
|
|
15785
|
-
var OpenCodeStyleSubagentFrontmatterSchema =
|
|
15786
|
-
description:
|
|
15787
|
-
mode:
|
|
15788
|
-
name:
|
|
16271
|
+
var import_node_path109 = require("path");
|
|
16272
|
+
var import_mini63 = require("zod/mini");
|
|
16273
|
+
var OpenCodeStyleSubagentFrontmatterSchema = import_mini63.z.looseObject({
|
|
16274
|
+
description: import_mini63.z.optional(import_mini63.z.string()),
|
|
16275
|
+
mode: import_mini63.z._default(import_mini63.z.string(), "subagent"),
|
|
16276
|
+
name: import_mini63.z.optional(import_mini63.z.string())
|
|
15789
16277
|
});
|
|
15790
16278
|
var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
15791
16279
|
frontmatter;
|
|
@@ -15795,7 +16283,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
15795
16283
|
const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
15796
16284
|
if (!result.success) {
|
|
15797
16285
|
throw new Error(
|
|
15798
|
-
`Invalid frontmatter in ${(0,
|
|
16286
|
+
`Invalid frontmatter in ${(0, import_node_path109.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
15799
16287
|
);
|
|
15800
16288
|
}
|
|
15801
16289
|
}
|
|
@@ -15815,7 +16303,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
15815
16303
|
const { description, mode, name, ...toolSection } = this.frontmatter;
|
|
15816
16304
|
const rulesyncFrontmatter = {
|
|
15817
16305
|
targets: ["*"],
|
|
15818
|
-
name: name ?? (0,
|
|
16306
|
+
name: name ?? (0, import_node_path109.basename)(this.getRelativeFilePath(), ".md"),
|
|
15819
16307
|
description,
|
|
15820
16308
|
[this.getToolTarget()]: { mode, ...toolSection }
|
|
15821
16309
|
};
|
|
@@ -15837,7 +16325,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
|
|
|
15837
16325
|
return {
|
|
15838
16326
|
success: false,
|
|
15839
16327
|
error: new Error(
|
|
15840
|
-
`Invalid frontmatter in ${(0,
|
|
16328
|
+
`Invalid frontmatter in ${(0, import_node_path109.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
15841
16329
|
)
|
|
15842
16330
|
};
|
|
15843
16331
|
}
|
|
@@ -15853,7 +16341,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
15853
16341
|
global = false
|
|
15854
16342
|
} = {}) {
|
|
15855
16343
|
return {
|
|
15856
|
-
relativeDirPath: global ? (0,
|
|
16344
|
+
relativeDirPath: global ? (0, import_node_path110.join)(".config", "kilo", "agent") : (0, import_node_path110.join)(".kilo", "agent")
|
|
15857
16345
|
};
|
|
15858
16346
|
}
|
|
15859
16347
|
static fromRulesyncSubagent({
|
|
@@ -15897,7 +16385,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
15897
16385
|
global = false
|
|
15898
16386
|
}) {
|
|
15899
16387
|
const paths = this.getSettablePaths({ global });
|
|
15900
|
-
const filePath = (0,
|
|
16388
|
+
const filePath = (0, import_node_path110.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
15901
16389
|
const fileContent = await readFileContent(filePath);
|
|
15902
16390
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
15903
16391
|
const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -15933,23 +16421,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
|
|
|
15933
16421
|
};
|
|
15934
16422
|
|
|
15935
16423
|
// src/features/subagents/kiro-subagent.ts
|
|
15936
|
-
var
|
|
15937
|
-
var
|
|
15938
|
-
var KiroCliSubagentJsonSchema =
|
|
15939
|
-
name:
|
|
15940
|
-
description:
|
|
15941
|
-
prompt:
|
|
15942
|
-
tools:
|
|
15943
|
-
toolAliases:
|
|
15944
|
-
toolSettings:
|
|
15945
|
-
toolSchema:
|
|
15946
|
-
hooks:
|
|
15947
|
-
model:
|
|
15948
|
-
mcpServers:
|
|
15949
|
-
useLegacyMcpJson:
|
|
15950
|
-
resources:
|
|
15951
|
-
allowedTools:
|
|
15952
|
-
includeMcpJson:
|
|
16424
|
+
var import_node_path111 = require("path");
|
|
16425
|
+
var import_mini64 = require("zod/mini");
|
|
16426
|
+
var KiroCliSubagentJsonSchema = import_mini64.z.looseObject({
|
|
16427
|
+
name: import_mini64.z.string(),
|
|
16428
|
+
description: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.string())),
|
|
16429
|
+
prompt: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.string())),
|
|
16430
|
+
tools: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.array(import_mini64.z.string()))),
|
|
16431
|
+
toolAliases: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.record(import_mini64.z.string(), import_mini64.z.string()))),
|
|
16432
|
+
toolSettings: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.unknown())),
|
|
16433
|
+
toolSchema: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.unknown())),
|
|
16434
|
+
hooks: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.record(import_mini64.z.string(), import_mini64.z.array(import_mini64.z.unknown())))),
|
|
16435
|
+
model: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.string())),
|
|
16436
|
+
mcpServers: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.record(import_mini64.z.string(), import_mini64.z.unknown()))),
|
|
16437
|
+
useLegacyMcpJson: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.boolean())),
|
|
16438
|
+
resources: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.array(import_mini64.z.string()))),
|
|
16439
|
+
allowedTools: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.array(import_mini64.z.string()))),
|
|
16440
|
+
includeMcpJson: import_mini64.z.optional(import_mini64.z.nullable(import_mini64.z.boolean()))
|
|
15953
16441
|
});
|
|
15954
16442
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
15955
16443
|
body;
|
|
@@ -15960,7 +16448,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
15960
16448
|
KiroCliSubagentJsonSchema.parse(parsed);
|
|
15961
16449
|
} catch (error) {
|
|
15962
16450
|
throw new Error(
|
|
15963
|
-
`Invalid JSON in ${(0,
|
|
16451
|
+
`Invalid JSON in ${(0, import_node_path111.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
|
|
15964
16452
|
{ cause: error }
|
|
15965
16453
|
);
|
|
15966
16454
|
}
|
|
@@ -15972,7 +16460,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
15972
16460
|
}
|
|
15973
16461
|
static getSettablePaths(_options = {}) {
|
|
15974
16462
|
return {
|
|
15975
|
-
relativeDirPath: (0,
|
|
16463
|
+
relativeDirPath: (0, import_node_path111.join)(".kiro", "agents")
|
|
15976
16464
|
};
|
|
15977
16465
|
}
|
|
15978
16466
|
getBody() {
|
|
@@ -15984,7 +16472,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
15984
16472
|
parsed = JSON.parse(this.body);
|
|
15985
16473
|
} catch (error) {
|
|
15986
16474
|
throw new Error(
|
|
15987
|
-
`Failed to parse JSON in ${(0,
|
|
16475
|
+
`Failed to parse JSON in ${(0, import_node_path111.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
15988
16476
|
{ cause: error }
|
|
15989
16477
|
);
|
|
15990
16478
|
}
|
|
@@ -16065,7 +16553,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
16065
16553
|
global = false
|
|
16066
16554
|
}) {
|
|
16067
16555
|
const paths = this.getSettablePaths({ global });
|
|
16068
|
-
const filePath = (0,
|
|
16556
|
+
const filePath = (0, import_node_path111.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
16069
16557
|
const fileContent = await readFileContent(filePath);
|
|
16070
16558
|
const subagent = new _KiroSubagent({
|
|
16071
16559
|
baseDir,
|
|
@@ -16103,7 +16591,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
16103
16591
|
};
|
|
16104
16592
|
|
|
16105
16593
|
// src/features/subagents/opencode-subagent.ts
|
|
16106
|
-
var
|
|
16594
|
+
var import_node_path112 = require("path");
|
|
16107
16595
|
var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
|
|
16108
16596
|
var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
16109
16597
|
getToolTarget() {
|
|
@@ -16113,7 +16601,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
16113
16601
|
global = false
|
|
16114
16602
|
} = {}) {
|
|
16115
16603
|
return {
|
|
16116
|
-
relativeDirPath: global ? (0,
|
|
16604
|
+
relativeDirPath: global ? (0, import_node_path112.join)(".config", "opencode", "agent") : (0, import_node_path112.join)(".opencode", "agent")
|
|
16117
16605
|
};
|
|
16118
16606
|
}
|
|
16119
16607
|
static fromRulesyncSubagent({
|
|
@@ -16157,7 +16645,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
|
|
|
16157
16645
|
global = false
|
|
16158
16646
|
}) {
|
|
16159
16647
|
const paths = this.getSettablePaths({ global });
|
|
16160
|
-
const filePath = (0,
|
|
16648
|
+
const filePath = (0, import_node_path112.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
16161
16649
|
const fileContent = await readFileContent(filePath);
|
|
16162
16650
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
16163
16651
|
const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -16210,7 +16698,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
16210
16698
|
"roo",
|
|
16211
16699
|
"rovodev"
|
|
16212
16700
|
];
|
|
16213
|
-
var SubagentsProcessorToolTargetSchema =
|
|
16701
|
+
var SubagentsProcessorToolTargetSchema = import_mini65.z.enum(subagentsProcessorToolTargetTuple);
|
|
16214
16702
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
16215
16703
|
[
|
|
16216
16704
|
"agentsmd",
|
|
@@ -16401,7 +16889,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
16401
16889
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
16402
16890
|
*/
|
|
16403
16891
|
async loadRulesyncFiles() {
|
|
16404
|
-
const subagentsDir = (0,
|
|
16892
|
+
const subagentsDir = (0, import_node_path113.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
16405
16893
|
const dirExists = await directoryExists(subagentsDir);
|
|
16406
16894
|
if (!dirExists) {
|
|
16407
16895
|
this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -16416,7 +16904,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
16416
16904
|
this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
16417
16905
|
const rulesyncSubagents = [];
|
|
16418
16906
|
for (const mdFile of mdFiles) {
|
|
16419
|
-
const filepath = (0,
|
|
16907
|
+
const filepath = (0, import_node_path113.join)(subagentsDir, mdFile);
|
|
16420
16908
|
try {
|
|
16421
16909
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
16422
16910
|
relativeFilePath: mdFile,
|
|
@@ -16446,14 +16934,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
16446
16934
|
const factory = this.getFactory(this.toolTarget);
|
|
16447
16935
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
16448
16936
|
const subagentFilePaths = await findFilesByGlobs(
|
|
16449
|
-
(0,
|
|
16937
|
+
(0, import_node_path113.join)(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
|
|
16450
16938
|
);
|
|
16451
16939
|
if (forDeletion) {
|
|
16452
16940
|
const toolSubagents2 = subagentFilePaths.map(
|
|
16453
16941
|
(path3) => factory.class.forDeletion({
|
|
16454
16942
|
baseDir: this.baseDir,
|
|
16455
16943
|
relativeDirPath: paths.relativeDirPath,
|
|
16456
|
-
relativeFilePath: (0,
|
|
16944
|
+
relativeFilePath: (0, import_node_path113.basename)(path3),
|
|
16457
16945
|
global: this.global
|
|
16458
16946
|
})
|
|
16459
16947
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -16466,7 +16954,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
16466
16954
|
subagentFilePaths.map(
|
|
16467
16955
|
(path3) => factory.class.fromFile({
|
|
16468
16956
|
baseDir: this.baseDir,
|
|
16469
|
-
relativeFilePath: (0,
|
|
16957
|
+
relativeFilePath: (0, import_node_path113.basename)(path3),
|
|
16470
16958
|
global: this.global
|
|
16471
16959
|
})
|
|
16472
16960
|
)
|
|
@@ -16513,49 +17001,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
16513
17001
|
};
|
|
16514
17002
|
|
|
16515
17003
|
// src/features/rules/agentsmd-rule.ts
|
|
16516
|
-
var
|
|
17004
|
+
var import_node_path116 = require("path");
|
|
16517
17005
|
|
|
16518
17006
|
// src/features/rules/tool-rule.ts
|
|
16519
|
-
var
|
|
17007
|
+
var import_node_path115 = require("path");
|
|
16520
17008
|
|
|
16521
17009
|
// src/features/rules/rulesync-rule.ts
|
|
16522
|
-
var
|
|
16523
|
-
var
|
|
16524
|
-
var RulesyncRuleFrontmatterSchema =
|
|
16525
|
-
root:
|
|
16526
|
-
localRoot:
|
|
16527
|
-
targets:
|
|
16528
|
-
description:
|
|
16529
|
-
globs:
|
|
16530
|
-
agentsmd:
|
|
16531
|
-
|
|
17010
|
+
var import_node_path114 = require("path");
|
|
17011
|
+
var import_mini66 = require("zod/mini");
|
|
17012
|
+
var RulesyncRuleFrontmatterSchema = import_mini66.z.object({
|
|
17013
|
+
root: import_mini66.z.optional(import_mini66.z.boolean()),
|
|
17014
|
+
localRoot: import_mini66.z.optional(import_mini66.z.boolean()),
|
|
17015
|
+
targets: import_mini66.z._default(RulesyncTargetsSchema, ["*"]),
|
|
17016
|
+
description: import_mini66.z.optional(import_mini66.z.string()),
|
|
17017
|
+
globs: import_mini66.z.optional(import_mini66.z.array(import_mini66.z.string())),
|
|
17018
|
+
agentsmd: import_mini66.z.optional(
|
|
17019
|
+
import_mini66.z.looseObject({
|
|
16532
17020
|
// @example "path/to/subproject"
|
|
16533
|
-
subprojectPath:
|
|
17021
|
+
subprojectPath: import_mini66.z.optional(import_mini66.z.string())
|
|
16534
17022
|
})
|
|
16535
17023
|
),
|
|
16536
|
-
claudecode:
|
|
16537
|
-
|
|
17024
|
+
claudecode: import_mini66.z.optional(
|
|
17025
|
+
import_mini66.z.looseObject({
|
|
16538
17026
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
16539
17027
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
16540
|
-
paths:
|
|
17028
|
+
paths: import_mini66.z.optional(import_mini66.z.array(import_mini66.z.string()))
|
|
16541
17029
|
})
|
|
16542
17030
|
),
|
|
16543
|
-
cursor:
|
|
16544
|
-
|
|
16545
|
-
alwaysApply:
|
|
16546
|
-
description:
|
|
16547
|
-
globs:
|
|
17031
|
+
cursor: import_mini66.z.optional(
|
|
17032
|
+
import_mini66.z.looseObject({
|
|
17033
|
+
alwaysApply: import_mini66.z.optional(import_mini66.z.boolean()),
|
|
17034
|
+
description: import_mini66.z.optional(import_mini66.z.string()),
|
|
17035
|
+
globs: import_mini66.z.optional(import_mini66.z.array(import_mini66.z.string()))
|
|
16548
17036
|
})
|
|
16549
17037
|
),
|
|
16550
|
-
copilot:
|
|
16551
|
-
|
|
16552
|
-
excludeAgent:
|
|
17038
|
+
copilot: import_mini66.z.optional(
|
|
17039
|
+
import_mini66.z.looseObject({
|
|
17040
|
+
excludeAgent: import_mini66.z.optional(import_mini66.z.union([import_mini66.z.literal("code-review"), import_mini66.z.literal("coding-agent")]))
|
|
16553
17041
|
})
|
|
16554
17042
|
),
|
|
16555
|
-
antigravity:
|
|
16556
|
-
|
|
16557
|
-
trigger:
|
|
16558
|
-
globs:
|
|
17043
|
+
antigravity: import_mini66.z.optional(
|
|
17044
|
+
import_mini66.z.looseObject({
|
|
17045
|
+
trigger: import_mini66.z.optional(import_mini66.z.string()),
|
|
17046
|
+
globs: import_mini66.z.optional(import_mini66.z.array(import_mini66.z.string()))
|
|
16559
17047
|
})
|
|
16560
17048
|
)
|
|
16561
17049
|
});
|
|
@@ -16566,7 +17054,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
16566
17054
|
const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
16567
17055
|
if (!parseResult.success && rest.validate !== false) {
|
|
16568
17056
|
throw new Error(
|
|
16569
|
-
`Invalid frontmatter in ${(0,
|
|
17057
|
+
`Invalid frontmatter in ${(0, import_node_path114.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
16570
17058
|
);
|
|
16571
17059
|
}
|
|
16572
17060
|
const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
|
|
@@ -16601,7 +17089,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
16601
17089
|
return {
|
|
16602
17090
|
success: false,
|
|
16603
17091
|
error: new Error(
|
|
16604
|
-
`Invalid frontmatter in ${(0,
|
|
17092
|
+
`Invalid frontmatter in ${(0, import_node_path114.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
16605
17093
|
)
|
|
16606
17094
|
};
|
|
16607
17095
|
}
|
|
@@ -16610,7 +17098,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
16610
17098
|
relativeFilePath,
|
|
16611
17099
|
validate = true
|
|
16612
17100
|
}) {
|
|
16613
|
-
const filePath = (0,
|
|
17101
|
+
const filePath = (0, import_node_path114.join)(
|
|
16614
17102
|
process.cwd(),
|
|
16615
17103
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
16616
17104
|
relativeFilePath
|
|
@@ -16709,7 +17197,7 @@ var ToolRule = class extends ToolFile {
|
|
|
16709
17197
|
rulesyncRule,
|
|
16710
17198
|
validate = true,
|
|
16711
17199
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
16712
|
-
nonRootPath = { relativeDirPath: (0,
|
|
17200
|
+
nonRootPath = { relativeDirPath: (0, import_node_path115.join)(".agents", "memories") }
|
|
16713
17201
|
}) {
|
|
16714
17202
|
const params = this.buildToolRuleParamsDefault({
|
|
16715
17203
|
baseDir,
|
|
@@ -16720,7 +17208,7 @@ var ToolRule = class extends ToolFile {
|
|
|
16720
17208
|
});
|
|
16721
17209
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
16722
17210
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
16723
|
-
params.relativeDirPath = (0,
|
|
17211
|
+
params.relativeDirPath = (0, import_node_path115.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
16724
17212
|
params.relativeFilePath = "AGENTS.md";
|
|
16725
17213
|
}
|
|
16726
17214
|
return params;
|
|
@@ -16769,7 +17257,7 @@ var ToolRule = class extends ToolFile {
|
|
|
16769
17257
|
}
|
|
16770
17258
|
};
|
|
16771
17259
|
function buildToolPath(toolDir, subDir, excludeToolDir) {
|
|
16772
|
-
return excludeToolDir ? subDir : (0,
|
|
17260
|
+
return excludeToolDir ? subDir : (0, import_node_path115.join)(toolDir, subDir);
|
|
16773
17261
|
}
|
|
16774
17262
|
|
|
16775
17263
|
// src/features/rules/agentsmd-rule.ts
|
|
@@ -16798,8 +17286,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
16798
17286
|
validate = true
|
|
16799
17287
|
}) {
|
|
16800
17288
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
16801
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
16802
|
-
const fileContent = await readFileContent((0,
|
|
17289
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path116.join)(".agents", "memories", relativeFilePath);
|
|
17290
|
+
const fileContent = await readFileContent((0, import_node_path116.join)(baseDir, relativePath));
|
|
16803
17291
|
return new _AgentsMdRule({
|
|
16804
17292
|
baseDir,
|
|
16805
17293
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -16854,21 +17342,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
16854
17342
|
};
|
|
16855
17343
|
|
|
16856
17344
|
// src/features/rules/antigravity-rule.ts
|
|
16857
|
-
var
|
|
16858
|
-
var
|
|
16859
|
-
var AntigravityRuleFrontmatterSchema =
|
|
16860
|
-
trigger:
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
17345
|
+
var import_node_path117 = require("path");
|
|
17346
|
+
var import_mini67 = require("zod/mini");
|
|
17347
|
+
var AntigravityRuleFrontmatterSchema = import_mini67.z.looseObject({
|
|
17348
|
+
trigger: import_mini67.z.optional(
|
|
17349
|
+
import_mini67.z.union([
|
|
17350
|
+
import_mini67.z.literal("always_on"),
|
|
17351
|
+
import_mini67.z.literal("glob"),
|
|
17352
|
+
import_mini67.z.literal("manual"),
|
|
17353
|
+
import_mini67.z.literal("model_decision"),
|
|
17354
|
+
import_mini67.z.string()
|
|
16867
17355
|
// accepts any string for forward compatibility
|
|
16868
17356
|
])
|
|
16869
17357
|
),
|
|
16870
|
-
globs:
|
|
16871
|
-
description:
|
|
17358
|
+
globs: import_mini67.z.optional(import_mini67.z.string()),
|
|
17359
|
+
description: import_mini67.z.optional(import_mini67.z.string())
|
|
16872
17360
|
});
|
|
16873
17361
|
function parseGlobsString(globs) {
|
|
16874
17362
|
if (!globs) {
|
|
@@ -17013,7 +17501,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
17013
17501
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
17014
17502
|
if (!result.success) {
|
|
17015
17503
|
throw new Error(
|
|
17016
|
-
`Invalid frontmatter in ${(0,
|
|
17504
|
+
`Invalid frontmatter in ${(0, import_node_path117.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17017
17505
|
);
|
|
17018
17506
|
}
|
|
17019
17507
|
}
|
|
@@ -17037,7 +17525,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
17037
17525
|
relativeFilePath,
|
|
17038
17526
|
validate = true
|
|
17039
17527
|
}) {
|
|
17040
|
-
const filePath = (0,
|
|
17528
|
+
const filePath = (0, import_node_path117.join)(
|
|
17041
17529
|
baseDir,
|
|
17042
17530
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
17043
17531
|
relativeFilePath
|
|
@@ -17177,7 +17665,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
17177
17665
|
};
|
|
17178
17666
|
|
|
17179
17667
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
17180
|
-
var
|
|
17668
|
+
var import_node_path118 = require("path");
|
|
17181
17669
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
17182
17670
|
toRulesyncRule() {
|
|
17183
17671
|
const rulesyncFrontmatter = {
|
|
@@ -17237,8 +17725,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
17237
17725
|
}) {
|
|
17238
17726
|
const settablePaths = this.getSettablePaths();
|
|
17239
17727
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
17240
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
17241
|
-
const fileContent = await readFileContent((0,
|
|
17728
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path118.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17729
|
+
const fileContent = await readFileContent((0, import_node_path118.join)(baseDir, relativePath));
|
|
17242
17730
|
return new _AugmentcodeLegacyRule({
|
|
17243
17731
|
baseDir,
|
|
17244
17732
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -17267,7 +17755,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
17267
17755
|
};
|
|
17268
17756
|
|
|
17269
17757
|
// src/features/rules/augmentcode-rule.ts
|
|
17270
|
-
var
|
|
17758
|
+
var import_node_path119 = require("path");
|
|
17271
17759
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
17272
17760
|
toRulesyncRule() {
|
|
17273
17761
|
return this.toRulesyncRuleDefault();
|
|
@@ -17298,7 +17786,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
17298
17786
|
relativeFilePath,
|
|
17299
17787
|
validate = true
|
|
17300
17788
|
}) {
|
|
17301
|
-
const filePath = (0,
|
|
17789
|
+
const filePath = (0, import_node_path119.join)(
|
|
17302
17790
|
baseDir,
|
|
17303
17791
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
17304
17792
|
relativeFilePath
|
|
@@ -17338,7 +17826,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
17338
17826
|
};
|
|
17339
17827
|
|
|
17340
17828
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
17341
|
-
var
|
|
17829
|
+
var import_node_path120 = require("path");
|
|
17342
17830
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
17343
17831
|
static getSettablePaths({
|
|
17344
17832
|
global,
|
|
@@ -17380,7 +17868,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
17380
17868
|
if (isRoot) {
|
|
17381
17869
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17382
17870
|
const fileContent2 = await readFileContent(
|
|
17383
|
-
(0,
|
|
17871
|
+
(0, import_node_path120.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
17384
17872
|
);
|
|
17385
17873
|
return new _ClaudecodeLegacyRule({
|
|
17386
17874
|
baseDir,
|
|
@@ -17394,8 +17882,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
17394
17882
|
if (!paths.nonRoot) {
|
|
17395
17883
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17396
17884
|
}
|
|
17397
|
-
const relativePath = (0,
|
|
17398
|
-
const fileContent = await readFileContent((0,
|
|
17885
|
+
const relativePath = (0, import_node_path120.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
17886
|
+
const fileContent = await readFileContent((0, import_node_path120.join)(baseDir, relativePath));
|
|
17399
17887
|
return new _ClaudecodeLegacyRule({
|
|
17400
17888
|
baseDir,
|
|
17401
17889
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17454,10 +17942,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
17454
17942
|
};
|
|
17455
17943
|
|
|
17456
17944
|
// src/features/rules/claudecode-rule.ts
|
|
17457
|
-
var
|
|
17458
|
-
var
|
|
17459
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
17460
|
-
paths:
|
|
17945
|
+
var import_node_path121 = require("path");
|
|
17946
|
+
var import_mini68 = require("zod/mini");
|
|
17947
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini68.z.object({
|
|
17948
|
+
paths: import_mini68.z.optional(import_mini68.z.array(import_mini68.z.string()))
|
|
17461
17949
|
});
|
|
17462
17950
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
17463
17951
|
frontmatter;
|
|
@@ -17495,7 +17983,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
17495
17983
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
17496
17984
|
if (!result.success) {
|
|
17497
17985
|
throw new Error(
|
|
17498
|
-
`Invalid frontmatter in ${(0,
|
|
17986
|
+
`Invalid frontmatter in ${(0, import_node_path121.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17499
17987
|
);
|
|
17500
17988
|
}
|
|
17501
17989
|
}
|
|
@@ -17525,7 +18013,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
17525
18013
|
if (isRoot) {
|
|
17526
18014
|
const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
17527
18015
|
const fileContent2 = await readFileContent(
|
|
17528
|
-
(0,
|
|
18016
|
+
(0, import_node_path121.join)(baseDir, rootDirPath, paths.root.relativeFilePath)
|
|
17529
18017
|
);
|
|
17530
18018
|
return new _ClaudecodeRule({
|
|
17531
18019
|
baseDir,
|
|
@@ -17540,8 +18028,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
17540
18028
|
if (!paths.nonRoot) {
|
|
17541
18029
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17542
18030
|
}
|
|
17543
|
-
const relativePath = (0,
|
|
17544
|
-
const filePath = (0,
|
|
18031
|
+
const relativePath = (0, import_node_path121.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
18032
|
+
const filePath = (0, import_node_path121.join)(baseDir, relativePath);
|
|
17545
18033
|
const fileContent = await readFileContent(filePath);
|
|
17546
18034
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
17547
18035
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -17652,7 +18140,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
17652
18140
|
return {
|
|
17653
18141
|
success: false,
|
|
17654
18142
|
error: new Error(
|
|
17655
|
-
`Invalid frontmatter in ${(0,
|
|
18143
|
+
`Invalid frontmatter in ${(0, import_node_path121.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
17656
18144
|
)
|
|
17657
18145
|
};
|
|
17658
18146
|
}
|
|
@@ -17672,10 +18160,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
17672
18160
|
};
|
|
17673
18161
|
|
|
17674
18162
|
// src/features/rules/cline-rule.ts
|
|
17675
|
-
var
|
|
17676
|
-
var
|
|
17677
|
-
var ClineRuleFrontmatterSchema =
|
|
17678
|
-
description:
|
|
18163
|
+
var import_node_path122 = require("path");
|
|
18164
|
+
var import_mini69 = require("zod/mini");
|
|
18165
|
+
var ClineRuleFrontmatterSchema = import_mini69.z.object({
|
|
18166
|
+
description: import_mini69.z.string()
|
|
17679
18167
|
});
|
|
17680
18168
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
17681
18169
|
static getSettablePaths(_options = {}) {
|
|
@@ -17718,7 +18206,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
17718
18206
|
validate = true
|
|
17719
18207
|
}) {
|
|
17720
18208
|
const fileContent = await readFileContent(
|
|
17721
|
-
(0,
|
|
18209
|
+
(0, import_node_path122.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
17722
18210
|
);
|
|
17723
18211
|
return new _ClineRule({
|
|
17724
18212
|
baseDir,
|
|
@@ -17744,7 +18232,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
17744
18232
|
};
|
|
17745
18233
|
|
|
17746
18234
|
// src/features/rules/codexcli-rule.ts
|
|
17747
|
-
var
|
|
18235
|
+
var import_node_path123 = require("path");
|
|
17748
18236
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
17749
18237
|
static getSettablePaths({
|
|
17750
18238
|
global,
|
|
@@ -17779,7 +18267,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
17779
18267
|
if (isRoot) {
|
|
17780
18268
|
const relativePath2 = paths.root.relativeFilePath;
|
|
17781
18269
|
const fileContent2 = await readFileContent(
|
|
17782
|
-
(0,
|
|
18270
|
+
(0, import_node_path123.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
17783
18271
|
);
|
|
17784
18272
|
return new _CodexcliRule({
|
|
17785
18273
|
baseDir,
|
|
@@ -17793,8 +18281,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
17793
18281
|
if (!paths.nonRoot) {
|
|
17794
18282
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17795
18283
|
}
|
|
17796
|
-
const relativePath = (0,
|
|
17797
|
-
const fileContent = await readFileContent((0,
|
|
18284
|
+
const relativePath = (0, import_node_path123.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
18285
|
+
const fileContent = await readFileContent((0, import_node_path123.join)(baseDir, relativePath));
|
|
17798
18286
|
return new _CodexcliRule({
|
|
17799
18287
|
baseDir,
|
|
17800
18288
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -17853,12 +18341,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
17853
18341
|
};
|
|
17854
18342
|
|
|
17855
18343
|
// src/features/rules/copilot-rule.ts
|
|
17856
|
-
var
|
|
17857
|
-
var
|
|
17858
|
-
var CopilotRuleFrontmatterSchema =
|
|
17859
|
-
description:
|
|
17860
|
-
applyTo:
|
|
17861
|
-
excludeAgent:
|
|
18344
|
+
var import_node_path124 = require("path");
|
|
18345
|
+
var import_mini70 = require("zod/mini");
|
|
18346
|
+
var CopilotRuleFrontmatterSchema = import_mini70.z.object({
|
|
18347
|
+
description: import_mini70.z.optional(import_mini70.z.string()),
|
|
18348
|
+
applyTo: import_mini70.z.optional(import_mini70.z.string()),
|
|
18349
|
+
excludeAgent: import_mini70.z.optional(import_mini70.z.union([import_mini70.z.literal("code-review"), import_mini70.z.literal("coding-agent")]))
|
|
17862
18350
|
});
|
|
17863
18351
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
17864
18352
|
frontmatter;
|
|
@@ -17890,7 +18378,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
17890
18378
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
17891
18379
|
if (!result.success) {
|
|
17892
18380
|
throw new Error(
|
|
17893
|
-
`Invalid frontmatter in ${(0,
|
|
18381
|
+
`Invalid frontmatter in ${(0, import_node_path124.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
17894
18382
|
);
|
|
17895
18383
|
}
|
|
17896
18384
|
}
|
|
@@ -17980,8 +18468,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
17980
18468
|
const paths = this.getSettablePaths({ global });
|
|
17981
18469
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
17982
18470
|
if (isRoot) {
|
|
17983
|
-
const relativePath2 = (0,
|
|
17984
|
-
const filePath2 = (0,
|
|
18471
|
+
const relativePath2 = (0, import_node_path124.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
18472
|
+
const filePath2 = (0, import_node_path124.join)(baseDir, relativePath2);
|
|
17985
18473
|
const fileContent2 = await readFileContent(filePath2);
|
|
17986
18474
|
return new _CopilotRule({
|
|
17987
18475
|
baseDir,
|
|
@@ -17996,8 +18484,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
17996
18484
|
if (!paths.nonRoot) {
|
|
17997
18485
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
17998
18486
|
}
|
|
17999
|
-
const relativePath = (0,
|
|
18000
|
-
const filePath = (0,
|
|
18487
|
+
const relativePath = (0, import_node_path124.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
18488
|
+
const filePath = (0, import_node_path124.join)(baseDir, relativePath);
|
|
18001
18489
|
const fileContent = await readFileContent(filePath);
|
|
18002
18490
|
const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
|
|
18003
18491
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -18043,7 +18531,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
18043
18531
|
return {
|
|
18044
18532
|
success: false,
|
|
18045
18533
|
error: new Error(
|
|
18046
|
-
`Invalid frontmatter in ${(0,
|
|
18534
|
+
`Invalid frontmatter in ${(0, import_node_path124.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
18047
18535
|
)
|
|
18048
18536
|
};
|
|
18049
18537
|
}
|
|
@@ -18099,12 +18587,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
|
|
|
18099
18587
|
};
|
|
18100
18588
|
|
|
18101
18589
|
// src/features/rules/cursor-rule.ts
|
|
18102
|
-
var
|
|
18103
|
-
var
|
|
18104
|
-
var CursorRuleFrontmatterSchema =
|
|
18105
|
-
description:
|
|
18106
|
-
globs:
|
|
18107
|
-
alwaysApply:
|
|
18590
|
+
var import_node_path125 = require("path");
|
|
18591
|
+
var import_mini71 = require("zod/mini");
|
|
18592
|
+
var CursorRuleFrontmatterSchema = import_mini71.z.object({
|
|
18593
|
+
description: import_mini71.z.optional(import_mini71.z.string()),
|
|
18594
|
+
globs: import_mini71.z.optional(import_mini71.z.string()),
|
|
18595
|
+
alwaysApply: import_mini71.z.optional(import_mini71.z.boolean())
|
|
18108
18596
|
});
|
|
18109
18597
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
18110
18598
|
frontmatter;
|
|
@@ -18121,7 +18609,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
18121
18609
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
18122
18610
|
if (!result.success) {
|
|
18123
18611
|
throw new Error(
|
|
18124
|
-
`Invalid frontmatter in ${(0,
|
|
18612
|
+
`Invalid frontmatter in ${(0, import_node_path125.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
18125
18613
|
);
|
|
18126
18614
|
}
|
|
18127
18615
|
}
|
|
@@ -18237,7 +18725,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
18237
18725
|
relativeFilePath,
|
|
18238
18726
|
validate = true
|
|
18239
18727
|
}) {
|
|
18240
|
-
const filePath = (0,
|
|
18728
|
+
const filePath = (0, import_node_path125.join)(
|
|
18241
18729
|
baseDir,
|
|
18242
18730
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
18243
18731
|
relativeFilePath
|
|
@@ -18247,7 +18735,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
18247
18735
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
18248
18736
|
if (!result.success) {
|
|
18249
18737
|
throw new Error(
|
|
18250
|
-
`Invalid frontmatter in ${(0,
|
|
18738
|
+
`Invalid frontmatter in ${(0, import_node_path125.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
18251
18739
|
);
|
|
18252
18740
|
}
|
|
18253
18741
|
return new _CursorRule({
|
|
@@ -18284,7 +18772,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
18284
18772
|
return {
|
|
18285
18773
|
success: false,
|
|
18286
18774
|
error: new Error(
|
|
18287
|
-
`Invalid frontmatter in ${(0,
|
|
18775
|
+
`Invalid frontmatter in ${(0, import_node_path125.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
18288
18776
|
)
|
|
18289
18777
|
};
|
|
18290
18778
|
}
|
|
@@ -18304,7 +18792,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
18304
18792
|
};
|
|
18305
18793
|
|
|
18306
18794
|
// src/features/rules/deepagents-rule.ts
|
|
18307
|
-
var
|
|
18795
|
+
var import_node_path126 = require("path");
|
|
18308
18796
|
var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
18309
18797
|
constructor({ fileContent, root, ...rest }) {
|
|
18310
18798
|
super({
|
|
@@ -18331,8 +18819,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
18331
18819
|
}) {
|
|
18332
18820
|
const settablePaths = this.getSettablePaths();
|
|
18333
18821
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
18334
|
-
const relativePath = isRoot ? (0,
|
|
18335
|
-
const fileContent = await readFileContent((0,
|
|
18822
|
+
const relativePath = isRoot ? (0, import_node_path126.join)(".deepagents", "AGENTS.md") : (0, import_node_path126.join)(".deepagents", "memories", relativeFilePath);
|
|
18823
|
+
const fileContent = await readFileContent((0, import_node_path126.join)(baseDir, relativePath));
|
|
18336
18824
|
return new _DeepagentsRule({
|
|
18337
18825
|
baseDir,
|
|
18338
18826
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -18387,7 +18875,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
|
|
|
18387
18875
|
};
|
|
18388
18876
|
|
|
18389
18877
|
// src/features/rules/factorydroid-rule.ts
|
|
18390
|
-
var
|
|
18878
|
+
var import_node_path127 = require("path");
|
|
18391
18879
|
var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
18392
18880
|
constructor({ fileContent, root, ...rest }) {
|
|
18393
18881
|
super({
|
|
@@ -18427,8 +18915,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
18427
18915
|
const paths = this.getSettablePaths({ global });
|
|
18428
18916
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
18429
18917
|
if (isRoot) {
|
|
18430
|
-
const relativePath2 = (0,
|
|
18431
|
-
const fileContent2 = await readFileContent((0,
|
|
18918
|
+
const relativePath2 = (0, import_node_path127.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
18919
|
+
const fileContent2 = await readFileContent((0, import_node_path127.join)(baseDir, relativePath2));
|
|
18432
18920
|
return new _FactorydroidRule({
|
|
18433
18921
|
baseDir,
|
|
18434
18922
|
relativeDirPath: paths.root.relativeDirPath,
|
|
@@ -18441,8 +18929,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
18441
18929
|
if (!paths.nonRoot) {
|
|
18442
18930
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
18443
18931
|
}
|
|
18444
|
-
const relativePath = (0,
|
|
18445
|
-
const fileContent = await readFileContent((0,
|
|
18932
|
+
const relativePath = (0, import_node_path127.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
18933
|
+
const fileContent = await readFileContent((0, import_node_path127.join)(baseDir, relativePath));
|
|
18446
18934
|
return new _FactorydroidRule({
|
|
18447
18935
|
baseDir,
|
|
18448
18936
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -18501,7 +18989,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
|
|
|
18501
18989
|
};
|
|
18502
18990
|
|
|
18503
18991
|
// src/features/rules/geminicli-rule.ts
|
|
18504
|
-
var
|
|
18992
|
+
var import_node_path128 = require("path");
|
|
18505
18993
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
18506
18994
|
static getSettablePaths({
|
|
18507
18995
|
global,
|
|
@@ -18536,7 +19024,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
18536
19024
|
if (isRoot) {
|
|
18537
19025
|
const relativePath2 = paths.root.relativeFilePath;
|
|
18538
19026
|
const fileContent2 = await readFileContent(
|
|
18539
|
-
(0,
|
|
19027
|
+
(0, import_node_path128.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
18540
19028
|
);
|
|
18541
19029
|
return new _GeminiCliRule({
|
|
18542
19030
|
baseDir,
|
|
@@ -18550,8 +19038,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
18550
19038
|
if (!paths.nonRoot) {
|
|
18551
19039
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
18552
19040
|
}
|
|
18553
|
-
const relativePath = (0,
|
|
18554
|
-
const fileContent = await readFileContent((0,
|
|
19041
|
+
const relativePath = (0, import_node_path128.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
19042
|
+
const fileContent = await readFileContent((0, import_node_path128.join)(baseDir, relativePath));
|
|
18555
19043
|
return new _GeminiCliRule({
|
|
18556
19044
|
baseDir,
|
|
18557
19045
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -18610,7 +19098,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
18610
19098
|
};
|
|
18611
19099
|
|
|
18612
19100
|
// src/features/rules/goose-rule.ts
|
|
18613
|
-
var
|
|
19101
|
+
var import_node_path129 = require("path");
|
|
18614
19102
|
var GooseRule = class _GooseRule extends ToolRule {
|
|
18615
19103
|
static getSettablePaths({
|
|
18616
19104
|
global,
|
|
@@ -18645,7 +19133,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
18645
19133
|
if (isRoot) {
|
|
18646
19134
|
const relativePath2 = paths.root.relativeFilePath;
|
|
18647
19135
|
const fileContent2 = await readFileContent(
|
|
18648
|
-
(0,
|
|
19136
|
+
(0, import_node_path129.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
18649
19137
|
);
|
|
18650
19138
|
return new _GooseRule({
|
|
18651
19139
|
baseDir,
|
|
@@ -18659,8 +19147,8 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
18659
19147
|
if (!paths.nonRoot) {
|
|
18660
19148
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
18661
19149
|
}
|
|
18662
|
-
const relativePath = (0,
|
|
18663
|
-
const fileContent = await readFileContent((0,
|
|
19150
|
+
const relativePath = (0, import_node_path129.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
19151
|
+
const fileContent = await readFileContent((0, import_node_path129.join)(baseDir, relativePath));
|
|
18664
19152
|
return new _GooseRule({
|
|
18665
19153
|
baseDir,
|
|
18666
19154
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -18719,7 +19207,7 @@ var GooseRule = class _GooseRule extends ToolRule {
|
|
|
18719
19207
|
};
|
|
18720
19208
|
|
|
18721
19209
|
// src/features/rules/junie-rule.ts
|
|
18722
|
-
var
|
|
19210
|
+
var import_node_path130 = require("path");
|
|
18723
19211
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
18724
19212
|
static getSettablePaths(_options = {}) {
|
|
18725
19213
|
return {
|
|
@@ -18748,8 +19236,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
18748
19236
|
}) {
|
|
18749
19237
|
const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
|
|
18750
19238
|
const settablePaths = this.getSettablePaths();
|
|
18751
|
-
const relativePath = isRoot ? (0,
|
|
18752
|
-
const fileContent = await readFileContent((0,
|
|
19239
|
+
const relativePath = isRoot ? (0, import_node_path130.join)(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : (0, import_node_path130.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
19240
|
+
const fileContent = await readFileContent((0, import_node_path130.join)(baseDir, relativePath));
|
|
18753
19241
|
return new _JunieRule({
|
|
18754
19242
|
baseDir,
|
|
18755
19243
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -18804,7 +19292,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
18804
19292
|
};
|
|
18805
19293
|
|
|
18806
19294
|
// src/features/rules/kilo-rule.ts
|
|
18807
|
-
var
|
|
19295
|
+
var import_node_path131 = require("path");
|
|
18808
19296
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
18809
19297
|
static getSettablePaths({
|
|
18810
19298
|
global,
|
|
@@ -18839,7 +19327,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
18839
19327
|
if (isRoot) {
|
|
18840
19328
|
const relativePath2 = paths.root.relativeFilePath;
|
|
18841
19329
|
const fileContent2 = await readFileContent(
|
|
18842
|
-
(0,
|
|
19330
|
+
(0, import_node_path131.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
18843
19331
|
);
|
|
18844
19332
|
return new _KiloRule({
|
|
18845
19333
|
baseDir,
|
|
@@ -18853,8 +19341,8 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
18853
19341
|
if (!paths.nonRoot) {
|
|
18854
19342
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
18855
19343
|
}
|
|
18856
|
-
const relativePath = (0,
|
|
18857
|
-
const fileContent = await readFileContent((0,
|
|
19344
|
+
const relativePath = (0, import_node_path131.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
19345
|
+
const fileContent = await readFileContent((0, import_node_path131.join)(baseDir, relativePath));
|
|
18858
19346
|
return new _KiloRule({
|
|
18859
19347
|
baseDir,
|
|
18860
19348
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -18913,7 +19401,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
18913
19401
|
};
|
|
18914
19402
|
|
|
18915
19403
|
// src/features/rules/kiro-rule.ts
|
|
18916
|
-
var
|
|
19404
|
+
var import_node_path132 = require("path");
|
|
18917
19405
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
18918
19406
|
static getSettablePaths(_options = {}) {
|
|
18919
19407
|
return {
|
|
@@ -18928,7 +19416,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
18928
19416
|
validate = true
|
|
18929
19417
|
}) {
|
|
18930
19418
|
const fileContent = await readFileContent(
|
|
18931
|
-
(0,
|
|
19419
|
+
(0, import_node_path132.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
18932
19420
|
);
|
|
18933
19421
|
return new _KiroRule({
|
|
18934
19422
|
baseDir,
|
|
@@ -18982,7 +19470,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
18982
19470
|
};
|
|
18983
19471
|
|
|
18984
19472
|
// src/features/rules/opencode-rule.ts
|
|
18985
|
-
var
|
|
19473
|
+
var import_node_path133 = require("path");
|
|
18986
19474
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
18987
19475
|
static getSettablePaths({
|
|
18988
19476
|
global,
|
|
@@ -19017,7 +19505,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
19017
19505
|
if (isRoot) {
|
|
19018
19506
|
const relativePath2 = paths.root.relativeFilePath;
|
|
19019
19507
|
const fileContent2 = await readFileContent(
|
|
19020
|
-
(0,
|
|
19508
|
+
(0, import_node_path133.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
19021
19509
|
);
|
|
19022
19510
|
return new _OpenCodeRule({
|
|
19023
19511
|
baseDir,
|
|
@@ -19031,8 +19519,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
19031
19519
|
if (!paths.nonRoot) {
|
|
19032
19520
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
19033
19521
|
}
|
|
19034
|
-
const relativePath = (0,
|
|
19035
|
-
const fileContent = await readFileContent((0,
|
|
19522
|
+
const relativePath = (0, import_node_path133.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
19523
|
+
const fileContent = await readFileContent((0, import_node_path133.join)(baseDir, relativePath));
|
|
19036
19524
|
return new _OpenCodeRule({
|
|
19037
19525
|
baseDir,
|
|
19038
19526
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -19091,7 +19579,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
19091
19579
|
};
|
|
19092
19580
|
|
|
19093
19581
|
// src/features/rules/qwencode-rule.ts
|
|
19094
|
-
var
|
|
19582
|
+
var import_node_path134 = require("path");
|
|
19095
19583
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
19096
19584
|
static getSettablePaths(_options = {}) {
|
|
19097
19585
|
return {
|
|
@@ -19110,8 +19598,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
19110
19598
|
validate = true
|
|
19111
19599
|
}) {
|
|
19112
19600
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
19113
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
19114
|
-
const fileContent = await readFileContent((0,
|
|
19601
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path134.join)(".qwen", "memories", relativeFilePath);
|
|
19602
|
+
const fileContent = await readFileContent((0, import_node_path134.join)(baseDir, relativePath));
|
|
19115
19603
|
return new _QwencodeRule({
|
|
19116
19604
|
baseDir,
|
|
19117
19605
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -19163,7 +19651,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
19163
19651
|
};
|
|
19164
19652
|
|
|
19165
19653
|
// src/features/rules/replit-rule.ts
|
|
19166
|
-
var
|
|
19654
|
+
var import_node_path135 = require("path");
|
|
19167
19655
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
19168
19656
|
static getSettablePaths(_options = {}) {
|
|
19169
19657
|
return {
|
|
@@ -19185,7 +19673,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
19185
19673
|
}
|
|
19186
19674
|
const relativePath = paths.root.relativeFilePath;
|
|
19187
19675
|
const fileContent = await readFileContent(
|
|
19188
|
-
(0,
|
|
19676
|
+
(0, import_node_path135.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
19189
19677
|
);
|
|
19190
19678
|
return new _ReplitRule({
|
|
19191
19679
|
baseDir,
|
|
@@ -19251,7 +19739,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
19251
19739
|
};
|
|
19252
19740
|
|
|
19253
19741
|
// src/features/rules/roo-rule.ts
|
|
19254
|
-
var
|
|
19742
|
+
var import_node_path136 = require("path");
|
|
19255
19743
|
var RooRule = class _RooRule extends ToolRule {
|
|
19256
19744
|
static getSettablePaths(_options = {}) {
|
|
19257
19745
|
return {
|
|
@@ -19266,7 +19754,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
19266
19754
|
validate = true
|
|
19267
19755
|
}) {
|
|
19268
19756
|
const fileContent = await readFileContent(
|
|
19269
|
-
(0,
|
|
19757
|
+
(0, import_node_path136.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
19270
19758
|
);
|
|
19271
19759
|
return new _RooRule({
|
|
19272
19760
|
baseDir,
|
|
@@ -19335,7 +19823,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
19335
19823
|
};
|
|
19336
19824
|
|
|
19337
19825
|
// src/features/rules/rovodev-rule.ts
|
|
19338
|
-
var
|
|
19826
|
+
var import_node_path137 = require("path");
|
|
19339
19827
|
var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
|
|
19340
19828
|
var RovodevRule = class _RovodevRule extends ToolRule {
|
|
19341
19829
|
/**
|
|
@@ -19379,7 +19867,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
19379
19867
|
root: rovodevAgents,
|
|
19380
19868
|
alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
|
|
19381
19869
|
nonRoot: {
|
|
19382
|
-
relativeDirPath: (0,
|
|
19870
|
+
relativeDirPath: (0, import_node_path137.join)(".rovodev", ".rulesync", "modular-rules")
|
|
19383
19871
|
}
|
|
19384
19872
|
};
|
|
19385
19873
|
}
|
|
@@ -19418,10 +19906,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
19418
19906
|
}) {
|
|
19419
19907
|
if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
|
|
19420
19908
|
throw new Error(
|
|
19421
|
-
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0,
|
|
19909
|
+
`Reserved Rovodev memory basename under modular-rules (not a modular rule): ${(0, import_node_path137.join)(relativeDirPath, relativeFilePath)}`
|
|
19422
19910
|
);
|
|
19423
19911
|
}
|
|
19424
|
-
const fileContent = await readFileContent((0,
|
|
19912
|
+
const fileContent = await readFileContent((0, import_node_path137.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
19425
19913
|
return new _RovodevRule({
|
|
19426
19914
|
baseDir,
|
|
19427
19915
|
relativeDirPath,
|
|
@@ -19441,10 +19929,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
19441
19929
|
paths
|
|
19442
19930
|
}) {
|
|
19443
19931
|
const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
|
|
19444
|
-
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0,
|
|
19932
|
+
const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${(0, import_node_path137.join)(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : (0, import_node_path137.join)(paths.root.relativeDirPath, paths.root.relativeFilePath);
|
|
19445
19933
|
if (relativeFilePath !== "AGENTS.md") {
|
|
19446
19934
|
throw new Error(
|
|
19447
|
-
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${(0,
|
|
19935
|
+
`Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${(0, import_node_path137.join)(relativeDirPath, relativeFilePath)}`
|
|
19448
19936
|
);
|
|
19449
19937
|
}
|
|
19450
19938
|
const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
|
|
@@ -19452,10 +19940,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
19452
19940
|
);
|
|
19453
19941
|
if (!allowed) {
|
|
19454
19942
|
throw new Error(
|
|
19455
|
-
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${(0,
|
|
19943
|
+
`Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${(0, import_node_path137.join)(relativeDirPath, relativeFilePath)}`
|
|
19456
19944
|
);
|
|
19457
19945
|
}
|
|
19458
|
-
const fileContent = await readFileContent((0,
|
|
19946
|
+
const fileContent = await readFileContent((0, import_node_path137.join)(baseDir, relativeDirPath, relativeFilePath));
|
|
19459
19947
|
return new _RovodevRule({
|
|
19460
19948
|
baseDir,
|
|
19461
19949
|
relativeDirPath,
|
|
@@ -19569,7 +20057,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
|
|
|
19569
20057
|
};
|
|
19570
20058
|
|
|
19571
20059
|
// src/features/rules/warp-rule.ts
|
|
19572
|
-
var
|
|
20060
|
+
var import_node_path138 = require("path");
|
|
19573
20061
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
19574
20062
|
constructor({ fileContent, root, ...rest }) {
|
|
19575
20063
|
super({
|
|
@@ -19595,8 +20083,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
19595
20083
|
validate = true
|
|
19596
20084
|
}) {
|
|
19597
20085
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
19598
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
19599
|
-
const fileContent = await readFileContent((0,
|
|
20086
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path138.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
20087
|
+
const fileContent = await readFileContent((0, import_node_path138.join)(baseDir, relativePath));
|
|
19600
20088
|
return new _WarpRule({
|
|
19601
20089
|
baseDir,
|
|
19602
20090
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -19651,7 +20139,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
19651
20139
|
};
|
|
19652
20140
|
|
|
19653
20141
|
// src/features/rules/windsurf-rule.ts
|
|
19654
|
-
var
|
|
20142
|
+
var import_node_path139 = require("path");
|
|
19655
20143
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
19656
20144
|
static getSettablePaths(_options = {}) {
|
|
19657
20145
|
return {
|
|
@@ -19666,7 +20154,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
19666
20154
|
validate = true
|
|
19667
20155
|
}) {
|
|
19668
20156
|
const fileContent = await readFileContent(
|
|
19669
|
-
(0,
|
|
20157
|
+
(0, import_node_path139.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
19670
20158
|
);
|
|
19671
20159
|
return new _WindsurfRule({
|
|
19672
20160
|
baseDir,
|
|
@@ -19764,11 +20252,11 @@ var rulesProcessorToolTargets = [
|
|
|
19764
20252
|
"warp",
|
|
19765
20253
|
"windsurf"
|
|
19766
20254
|
];
|
|
19767
|
-
var RulesProcessorToolTargetSchema =
|
|
19768
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
19769
|
-
var RulesFeatureOptionsSchema =
|
|
19770
|
-
ruleDiscoveryMode:
|
|
19771
|
-
includeLocalRoot:
|
|
20255
|
+
var RulesProcessorToolTargetSchema = import_mini72.z.enum(rulesProcessorToolTargets);
|
|
20256
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path140.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
20257
|
+
var RulesFeatureOptionsSchema = import_mini72.z.looseObject({
|
|
20258
|
+
ruleDiscoveryMode: import_mini72.z.optional(import_mini72.z.enum(["none", "explicit"])),
|
|
20259
|
+
includeLocalRoot: import_mini72.z.optional(import_mini72.z.boolean())
|
|
19772
20260
|
});
|
|
19773
20261
|
var resolveRuleDiscoveryMode = ({
|
|
19774
20262
|
defaultMode,
|
|
@@ -19789,8 +20277,8 @@ var resolveRuleDiscoveryMode = ({
|
|
|
19789
20277
|
}
|
|
19790
20278
|
return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
|
|
19791
20279
|
};
|
|
19792
|
-
var IncludeLocalRootSchema =
|
|
19793
|
-
includeLocalRoot:
|
|
20280
|
+
var IncludeLocalRootSchema = import_mini72.z.looseObject({
|
|
20281
|
+
includeLocalRoot: import_mini72.z.optional(import_mini72.z.boolean())
|
|
19794
20282
|
});
|
|
19795
20283
|
var resolveIncludeLocalRoot = (options) => {
|
|
19796
20284
|
if (!options) return true;
|
|
@@ -20096,6 +20584,8 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
20096
20584
|
extension: "md",
|
|
20097
20585
|
supportsGlobal: false,
|
|
20098
20586
|
ruleDiscoveryMode: "auto"
|
|
20587
|
+
// No additionalConventions.skills needed: Windsurf Cascade auto-discovers
|
|
20588
|
+
// skills from .windsurf/skills/ and ~/.codeium/windsurf/skills/ directories.
|
|
20099
20589
|
}
|
|
20100
20590
|
}
|
|
20101
20591
|
]
|
|
@@ -20233,7 +20723,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20233
20723
|
}).relativeDirPath;
|
|
20234
20724
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
20235
20725
|
const frontmatter = skill.getFrontmatter();
|
|
20236
|
-
const relativePath = (0,
|
|
20726
|
+
const relativePath = (0, import_node_path140.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
20237
20727
|
return {
|
|
20238
20728
|
name: frontmatter.name,
|
|
20239
20729
|
description: frontmatter.description,
|
|
@@ -20362,12 +20852,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20362
20852
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
20363
20853
|
*/
|
|
20364
20854
|
async loadRulesyncFiles() {
|
|
20365
|
-
const rulesyncBaseDir = (0,
|
|
20366
|
-
const files = await findFilesByGlobs((0,
|
|
20855
|
+
const rulesyncBaseDir = (0, import_node_path140.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
20856
|
+
const files = await findFilesByGlobs((0, import_node_path140.join)(rulesyncBaseDir, "**", "*.md"));
|
|
20367
20857
|
this.logger.debug(`Found ${files.length} rulesync files`);
|
|
20368
20858
|
const rulesyncRules = await Promise.all(
|
|
20369
20859
|
files.map((file) => {
|
|
20370
|
-
const relativeFilePath = (0,
|
|
20860
|
+
const relativeFilePath = (0, import_node_path140.relative)(rulesyncBaseDir, file);
|
|
20371
20861
|
checkPathTraversal({
|
|
20372
20862
|
relativePath: relativeFilePath,
|
|
20373
20863
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -20442,7 +20932,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20442
20932
|
global: this.global
|
|
20443
20933
|
});
|
|
20444
20934
|
const resolveRelativeDirPath = (filePath) => {
|
|
20445
|
-
const dirName = (0,
|
|
20935
|
+
const dirName = (0, import_node_path140.dirname)((0, import_node_path140.relative)(this.baseDir, filePath));
|
|
20446
20936
|
return dirName === "" ? "." : dirName;
|
|
20447
20937
|
};
|
|
20448
20938
|
const buildDeletionRulesFromPaths = (filePaths, opts) => {
|
|
@@ -20450,7 +20940,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20450
20940
|
const effectiveBaseDir = isNonRoot ? opts.baseDirOverride : this.baseDir;
|
|
20451
20941
|
return filePaths.map((filePath) => {
|
|
20452
20942
|
const relativeDirPath = isNonRoot ? opts.relativeDirPathOverride : resolveRelativeDirPath(filePath);
|
|
20453
|
-
const relativeFilePath = isNonRoot ? (0,
|
|
20943
|
+
const relativeFilePath = isNonRoot ? (0, import_node_path140.relative)(effectiveBaseDir, filePath) : (0, import_node_path140.basename)(filePath);
|
|
20454
20944
|
checkPathTraversal({
|
|
20455
20945
|
relativePath: isNonRoot ? relativeFilePath : relativeDirPath,
|
|
20456
20946
|
intendedRootDir: effectiveBaseDir
|
|
@@ -20478,13 +20968,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20478
20968
|
return [];
|
|
20479
20969
|
}
|
|
20480
20970
|
const uniqueRootFilePaths = await findFilesWithFallback(
|
|
20481
|
-
(0,
|
|
20971
|
+
(0, import_node_path140.join)(
|
|
20482
20972
|
this.baseDir,
|
|
20483
20973
|
settablePaths.root.relativeDirPath ?? ".",
|
|
20484
20974
|
settablePaths.root.relativeFilePath
|
|
20485
20975
|
),
|
|
20486
20976
|
settablePaths.alternativeRoots,
|
|
20487
|
-
(alt) => (0,
|
|
20977
|
+
(alt) => (0, import_node_path140.join)(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
|
|
20488
20978
|
);
|
|
20489
20979
|
if (forDeletion) {
|
|
20490
20980
|
return buildDeletionRulesFromPaths(uniqueRootFilePaths);
|
|
@@ -20498,7 +20988,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20498
20988
|
});
|
|
20499
20989
|
return factory.class.fromFile({
|
|
20500
20990
|
baseDir: this.baseDir,
|
|
20501
|
-
relativeFilePath: (0,
|
|
20991
|
+
relativeFilePath: (0, import_node_path140.basename)(filePath),
|
|
20502
20992
|
relativeDirPath,
|
|
20503
20993
|
global: this.global
|
|
20504
20994
|
});
|
|
@@ -20515,7 +21005,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20515
21005
|
return [];
|
|
20516
21006
|
}
|
|
20517
21007
|
const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
|
|
20518
|
-
(0,
|
|
21008
|
+
(0, import_node_path140.join)(this.baseDir, "AGENTS.local.md")
|
|
20519
21009
|
);
|
|
20520
21010
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
|
|
20521
21011
|
}
|
|
@@ -20526,9 +21016,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20526
21016
|
return [];
|
|
20527
21017
|
}
|
|
20528
21018
|
const uniqueLocalRootFilePaths = await findFilesWithFallback(
|
|
20529
|
-
(0,
|
|
21019
|
+
(0, import_node_path140.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
|
|
20530
21020
|
settablePaths.alternativeRoots,
|
|
20531
|
-
(alt) => (0,
|
|
21021
|
+
(alt) => (0, import_node_path140.join)(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
|
|
20532
21022
|
);
|
|
20533
21023
|
return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
|
|
20534
21024
|
})();
|
|
@@ -20539,20 +21029,20 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20539
21029
|
if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
|
|
20540
21030
|
return [];
|
|
20541
21031
|
}
|
|
20542
|
-
const primaryPaths = await findFilesByGlobs((0,
|
|
21032
|
+
const primaryPaths = await findFilesByGlobs((0, import_node_path140.join)(this.baseDir, ".rovodev", "AGENTS.md"));
|
|
20543
21033
|
if (primaryPaths.length === 0) {
|
|
20544
21034
|
return [];
|
|
20545
21035
|
}
|
|
20546
|
-
const mirrorPaths = await findFilesByGlobs((0,
|
|
21036
|
+
const mirrorPaths = await findFilesByGlobs((0, import_node_path140.join)(this.baseDir, "AGENTS.md"));
|
|
20547
21037
|
return buildDeletionRulesFromPaths(mirrorPaths);
|
|
20548
21038
|
})();
|
|
20549
21039
|
const nonRootToolRules = await (async () => {
|
|
20550
21040
|
if (!settablePaths.nonRoot) {
|
|
20551
21041
|
return [];
|
|
20552
21042
|
}
|
|
20553
|
-
const nonRootBaseDir = (0,
|
|
21043
|
+
const nonRootBaseDir = (0, import_node_path140.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
20554
21044
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
20555
|
-
(0,
|
|
21045
|
+
(0, import_node_path140.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
20556
21046
|
);
|
|
20557
21047
|
if (forDeletion) {
|
|
20558
21048
|
return buildDeletionRulesFromPaths(nonRootFilePaths, {
|
|
@@ -20562,18 +21052,18 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
20562
21052
|
}
|
|
20563
21053
|
const modularRootRelative = settablePaths.nonRoot.relativeDirPath;
|
|
20564
21054
|
const nonRootPathsForImport = this.toolTarget === "rovodev" ? nonRootFilePaths.filter((filePath) => {
|
|
20565
|
-
const relativeFilePath = (0,
|
|
21055
|
+
const relativeFilePath = (0, import_node_path140.relative)(nonRootBaseDir, filePath);
|
|
20566
21056
|
const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
|
|
20567
21057
|
if (!ok) {
|
|
20568
21058
|
this.logger.warn(
|
|
20569
|
-
`Skipping reserved Rovodev path under modular-rules (import): ${(0,
|
|
21059
|
+
`Skipping reserved Rovodev path under modular-rules (import): ${(0, import_node_path140.join)(modularRootRelative, relativeFilePath)}`
|
|
20570
21060
|
);
|
|
20571
21061
|
}
|
|
20572
21062
|
return ok;
|
|
20573
21063
|
}) : nonRootFilePaths;
|
|
20574
21064
|
return await Promise.all(
|
|
20575
21065
|
nonRootPathsForImport.map((filePath) => {
|
|
20576
|
-
const relativeFilePath = (0,
|
|
21066
|
+
const relativeFilePath = (0, import_node_path140.relative)(nonRootBaseDir, filePath);
|
|
20577
21067
|
checkPathTraversal({
|
|
20578
21068
|
relativePath: relativeFilePath,
|
|
20579
21069
|
intendedRootDir: nonRootBaseDir
|
|
@@ -20692,14 +21182,14 @@ s/<command> [arguments]
|
|
|
20692
21182
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
20693
21183
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
20694
21184
|
|
|
20695
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
21185
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path140.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
20696
21186
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
20697
21187
|
|
|
20698
21188
|
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.
|
|
20699
21189
|
|
|
20700
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
21190
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path140.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
20701
21191
|
|
|
20702
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
21192
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path140.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
20703
21193
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
20704
21194
|
const result = [
|
|
20705
21195
|
overview,
|
|
@@ -20799,7 +21289,7 @@ function warnUnsupportedTargets(params) {
|
|
|
20799
21289
|
}
|
|
20800
21290
|
}
|
|
20801
21291
|
async function checkRulesyncDirExists(params) {
|
|
20802
|
-
return fileExists((0,
|
|
21292
|
+
return fileExists((0, import_node_path141.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
20803
21293
|
}
|
|
20804
21294
|
async function generate(params) {
|
|
20805
21295
|
const { config, logger } = params;
|
|
@@ -21410,72 +21900,6 @@ async function importPermissionsCore(params) {
|
|
|
21410
21900
|
return writtenCount;
|
|
21411
21901
|
}
|
|
21412
21902
|
|
|
21413
|
-
// src/utils/logger.ts
|
|
21414
|
-
var BaseLogger = class {
|
|
21415
|
-
_verbose = false;
|
|
21416
|
-
_silent = false;
|
|
21417
|
-
constructor({ verbose = false, silent = false } = {}) {
|
|
21418
|
-
this._silent = silent;
|
|
21419
|
-
this._verbose = verbose && !silent;
|
|
21420
|
-
}
|
|
21421
|
-
get verbose() {
|
|
21422
|
-
return this._verbose;
|
|
21423
|
-
}
|
|
21424
|
-
get silent() {
|
|
21425
|
-
return this._silent;
|
|
21426
|
-
}
|
|
21427
|
-
configure({ verbose, silent }) {
|
|
21428
|
-
if (verbose && silent) {
|
|
21429
|
-
this._silent = false;
|
|
21430
|
-
if (!isEnvTest()) {
|
|
21431
|
-
this.onConflictingFlags();
|
|
21432
|
-
}
|
|
21433
|
-
}
|
|
21434
|
-
this._silent = silent;
|
|
21435
|
-
this._verbose = verbose && !silent;
|
|
21436
|
-
}
|
|
21437
|
-
onConflictingFlags() {
|
|
21438
|
-
console.warn("Both --verbose and --silent specified; --silent takes precedence");
|
|
21439
|
-
}
|
|
21440
|
-
};
|
|
21441
|
-
var ConsoleLogger = class extends BaseLogger {
|
|
21442
|
-
isSuppressed() {
|
|
21443
|
-
return isEnvTest() || this._silent;
|
|
21444
|
-
}
|
|
21445
|
-
get jsonMode() {
|
|
21446
|
-
return false;
|
|
21447
|
-
}
|
|
21448
|
-
captureData(_key, _value) {
|
|
21449
|
-
}
|
|
21450
|
-
getJsonData() {
|
|
21451
|
-
return {};
|
|
21452
|
-
}
|
|
21453
|
-
outputJson(_success, _error) {
|
|
21454
|
-
}
|
|
21455
|
-
info(message, ...args) {
|
|
21456
|
-
if (this.isSuppressed()) return;
|
|
21457
|
-
console.log(message, ...args);
|
|
21458
|
-
}
|
|
21459
|
-
success(message, ...args) {
|
|
21460
|
-
if (this.isSuppressed()) return;
|
|
21461
|
-
console.log(message, ...args);
|
|
21462
|
-
}
|
|
21463
|
-
warn(message, ...args) {
|
|
21464
|
-
if (this.isSuppressed()) return;
|
|
21465
|
-
console.warn(message, ...args);
|
|
21466
|
-
}
|
|
21467
|
-
// Errors are always emitted, even in silent mode
|
|
21468
|
-
error(message, _code, ...args) {
|
|
21469
|
-
if (isEnvTest()) return;
|
|
21470
|
-
const errorMessage = message instanceof Error ? message.message : message;
|
|
21471
|
-
console.error(errorMessage, ...args);
|
|
21472
|
-
}
|
|
21473
|
-
debug(message, ...args) {
|
|
21474
|
-
if (!this._verbose || this.isSuppressed()) return;
|
|
21475
|
-
console.log(message, ...args);
|
|
21476
|
-
}
|
|
21477
|
-
};
|
|
21478
|
-
|
|
21479
21903
|
// src/index.ts
|
|
21480
21904
|
async function generate2(options = {}) {
|
|
21481
21905
|
const { silent = true, verbose = false, ...rest } = options;
|