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.
@@ -30,8 +30,13 @@ var ALL_FEATURES = [
30
30
  var ALL_FEATURES_WITH_WILDCARD = [...ALL_FEATURES, "*"];
31
31
  var FeatureSchema = z.enum(ALL_FEATURES);
32
32
  var FeaturesSchema = z.array(FeatureSchema);
33
+ var GitignoreDestinationSchema = z.enum(["gitignore", "gitattributes"]);
33
34
  var FeatureOptionsSchema = z.record(z.string(), z.unknown());
34
- var FeatureValueSchema = z.union([z.boolean(), FeatureOptionsSchema]);
35
+ var FeatureValueSchema = z.union([
36
+ z.boolean(),
37
+ FeatureOptionsSchema,
38
+ GitignoreDestinationSchema
39
+ ]);
35
40
  var PerFeatureConfigSchema = z.record(z.string(), FeatureValueSchema);
36
41
  var PerTargetFeaturesValueSchema = z.union([
37
42
  z.array(z.enum(ALL_FEATURES_WITH_WILDCARD)),
@@ -327,6 +332,7 @@ function hasControlCharacters(value) {
327
332
  }
328
333
 
329
334
  // src/config/config.ts
335
+ var GITIGNORE_DESTINATION_KEY = "gitignoreDestination";
330
336
  var SourceEntrySchema = z3.object({
331
337
  source: z3.string().check(minLength(1, "source must be a non-empty string")),
332
338
  skills: optional(z3.array(z3.string())),
@@ -358,6 +364,7 @@ var ConfigParamsSchema = z3.object({
358
364
  simulateSubagents: optional(z3.boolean()),
359
365
  simulateSkills: optional(z3.boolean()),
360
366
  gitignoreTargetsOnly: optional(z3.boolean()),
367
+ gitignoreDestination: optional(GitignoreDestinationSchema),
361
368
  dryRun: optional(z3.boolean()),
362
369
  check: optional(z3.boolean()),
363
370
  // Declarative skill sources
@@ -418,6 +425,7 @@ var Config = class _Config {
418
425
  simulateSubagents;
419
426
  simulateSkills;
420
427
  gitignoreTargetsOnly;
428
+ gitignoreDestination;
421
429
  dryRun;
422
430
  check;
423
431
  sources;
@@ -433,6 +441,7 @@ var Config = class _Config {
433
441
  simulateSubagents,
434
442
  simulateSkills,
435
443
  gitignoreTargetsOnly,
444
+ gitignoreDestination,
436
445
  dryRun,
437
446
  check,
438
447
  sources
@@ -458,6 +467,7 @@ var Config = class _Config {
458
467
  this.simulateSubagents = simulateSubagents ?? false;
459
468
  this.simulateSkills = simulateSkills ?? false;
460
469
  this.gitignoreTargetsOnly = gitignoreTargetsOnly ?? true;
470
+ this.gitignoreDestination = gitignoreDestination ?? "gitignore";
461
471
  this.dryRun = dryRun ?? false;
462
472
  this.check = check ?? false;
463
473
  this.sources = sources ?? [];
@@ -615,6 +625,36 @@ var Config = class _Config {
615
625
  }
616
626
  return void 0;
617
627
  }
628
+ getGitignoreDestination(target, feature) {
629
+ const rootLevel = this.gitignoreDestination;
630
+ if (!isRulesyncConfigTargetsObject(this.targets)) {
631
+ return rootLevel;
632
+ }
633
+ const targetValue = this.targets[target];
634
+ if (!targetValue || Array.isArray(targetValue)) {
635
+ return rootLevel;
636
+ }
637
+ const perFeature = targetValue;
638
+ const toolLevel = _Config.parseGitignoreDestination(perFeature[GITIGNORE_DESTINATION_KEY]);
639
+ if (feature) {
640
+ const featureValue = perFeature[feature];
641
+ if (featureValue && typeof featureValue === "object" && !Array.isArray(featureValue)) {
642
+ const featureLevel = _Config.parseGitignoreDestination(
643
+ featureValue[GITIGNORE_DESTINATION_KEY]
644
+ );
645
+ if (featureLevel) {
646
+ return featureLevel;
647
+ }
648
+ }
649
+ }
650
+ return toolLevel ?? rootLevel;
651
+ }
652
+ static parseGitignoreDestination(value) {
653
+ if (value === "gitignore" || value === "gitattributes") {
654
+ return value;
655
+ }
656
+ return void 0;
657
+ }
618
658
  /**
619
659
  * Check if per-target features configuration is being used.
620
660
  */
@@ -695,6 +735,7 @@ var getDefaults = () => ({
695
735
  simulateSubagents: false,
696
736
  simulateSkills: false,
697
737
  gitignoreTargetsOnly: true,
738
+ gitignoreDestination: "gitignore",
698
739
  dryRun: false,
699
740
  check: false,
700
741
  sources: []
@@ -726,6 +767,7 @@ var mergeConfigs = (baseConfig, localConfig) => {
726
767
  simulateSubagents: localConfig.simulateSubagents ?? baseConfig.simulateSubagents,
727
768
  simulateSkills: localConfig.simulateSkills ?? baseConfig.simulateSkills,
728
769
  gitignoreTargetsOnly: localConfig.gitignoreTargetsOnly ?? baseConfig.gitignoreTargetsOnly,
770
+ gitignoreDestination: localConfig.gitignoreDestination ?? baseConfig.gitignoreDestination,
729
771
  dryRun: localConfig.dryRun ?? baseConfig.dryRun,
730
772
  check: localConfig.check ?? baseConfig.check,
731
773
  sources: localConfig.sources ?? baseConfig.sources
@@ -746,7 +788,8 @@ var ConfigResolver = class {
746
788
  simulateSkills,
747
789
  gitignoreTargetsOnly,
748
790
  dryRun,
749
- check
791
+ check,
792
+ gitignoreDestination
750
793
  }) {
751
794
  const validatedConfigPath = resolvePath(configPath, process.cwd());
752
795
  const baseConfig = await loadConfigFromFile(validatedConfigPath);
@@ -795,6 +838,7 @@ var ConfigResolver = class {
795
838
  simulateSubagents: resolvedSimulateSubagents,
796
839
  simulateSkills: resolvedSimulateSkills,
797
840
  gitignoreTargetsOnly: resolvedGitignoreTargetsOnly,
841
+ gitignoreDestination: gitignoreDestination ?? configByFile.gitignoreDestination ?? getDefaults().gitignoreDestination,
798
842
  dryRun: dryRun ?? configByFile.dryRun ?? getDefaults().dryRun,
799
843
  check: check ?? configByFile.check ?? getDefaults().check,
800
844
  sources: configByFile.sources ?? getDefaults().sources
@@ -816,8 +860,178 @@ function getBaseDirsInLightOfGlobal({
816
860
  return resolvedBaseDirs;
817
861
  }
818
862
 
863
+ // src/types/json-output.ts
864
+ var ErrorCodes = {
865
+ CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
866
+ RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
867
+ INVALID_TARGET: "INVALID_TARGET",
868
+ FETCH_FAILED: "FETCH_FAILED",
869
+ WRITE_FAILED: "WRITE_FAILED",
870
+ VALIDATION_FAILED: "VALIDATION_FAILED",
871
+ GENERATION_FAILED: "GENERATION_FAILED",
872
+ IMPORT_FAILED: "IMPORT_FAILED",
873
+ INSTALL_FAILED: "INSTALL_FAILED",
874
+ UPDATE_FAILED: "UPDATE_FAILED",
875
+ GITIGNORE_FAILED: "GITIGNORE_FAILED",
876
+ INIT_FAILED: "INIT_FAILED",
877
+ MCP_FAILED: "MCP_FAILED",
878
+ UNKNOWN_ERROR: "UNKNOWN_ERROR"
879
+ };
880
+ var CLIError = class extends Error {
881
+ constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
882
+ super(message);
883
+ this.code = code;
884
+ this.exitCode = exitCode;
885
+ this.name = "CLIError";
886
+ }
887
+ };
888
+
889
+ // src/utils/logger.ts
890
+ var BaseLogger = class {
891
+ _verbose = false;
892
+ _silent = false;
893
+ constructor({ verbose = false, silent = false } = {}) {
894
+ this._silent = silent;
895
+ this._verbose = verbose && !silent;
896
+ }
897
+ get verbose() {
898
+ return this._verbose;
899
+ }
900
+ get silent() {
901
+ return this._silent;
902
+ }
903
+ configure({ verbose, silent }) {
904
+ if (verbose && silent) {
905
+ this._silent = false;
906
+ if (!isEnvTest()) {
907
+ this.onConflictingFlags();
908
+ }
909
+ }
910
+ this._silent = silent;
911
+ this._verbose = verbose && !silent;
912
+ }
913
+ onConflictingFlags() {
914
+ console.warn("Both --verbose and --silent specified; --silent takes precedence");
915
+ }
916
+ };
917
+ var ConsoleLogger = class extends BaseLogger {
918
+ isSuppressed() {
919
+ return isEnvTest() || this._silent;
920
+ }
921
+ get jsonMode() {
922
+ return false;
923
+ }
924
+ captureData(_key, _value) {
925
+ }
926
+ getJsonData() {
927
+ return {};
928
+ }
929
+ outputJson(_success, _error) {
930
+ }
931
+ info(message, ...args) {
932
+ if (this.isSuppressed()) return;
933
+ console.log(message, ...args);
934
+ }
935
+ success(message, ...args) {
936
+ if (this.isSuppressed()) return;
937
+ console.log(message, ...args);
938
+ }
939
+ warn(message, ...args) {
940
+ if (this.isSuppressed()) return;
941
+ console.warn(message, ...args);
942
+ }
943
+ // Errors are always emitted, even in silent mode
944
+ error(message, _code, ...args) {
945
+ if (isEnvTest()) return;
946
+ const errorMessage = message instanceof Error ? message.message : message;
947
+ console.error(errorMessage, ...args);
948
+ }
949
+ debug(message, ...args) {
950
+ if (!this._verbose || this.isSuppressed()) return;
951
+ console.log(message, ...args);
952
+ }
953
+ };
954
+ var JsonLogger = class extends BaseLogger {
955
+ _jsonOutputDone = false;
956
+ _jsonData = {};
957
+ _commandName;
958
+ _version;
959
+ constructor({
960
+ command,
961
+ version,
962
+ verbose = false,
963
+ silent = false
964
+ }) {
965
+ super({ verbose, silent });
966
+ this._commandName = command;
967
+ this._version = version;
968
+ }
969
+ // Suppress raw console.warn in JSON mode to avoid non-JSON text on stderr
970
+ onConflictingFlags() {
971
+ }
972
+ get jsonMode() {
973
+ return true;
974
+ }
975
+ captureData(key, value) {
976
+ this._jsonData[key] = value;
977
+ }
978
+ getJsonData() {
979
+ return { ...this._jsonData };
980
+ }
981
+ outputJson(success, error) {
982
+ if (this._jsonOutputDone) return;
983
+ this._jsonOutputDone = true;
984
+ const output = {
985
+ success,
986
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
987
+ command: this._commandName,
988
+ version: this._version
989
+ };
990
+ if (success) {
991
+ output.data = this._jsonData;
992
+ } else if (error) {
993
+ output.error = {
994
+ code: error.code,
995
+ message: error.message
996
+ };
997
+ if (error.details) {
998
+ output.error.details = error.details;
999
+ }
1000
+ if (error.stack) {
1001
+ output.error.stack = error.stack;
1002
+ }
1003
+ }
1004
+ const jsonStr = JSON.stringify(output, null, 2);
1005
+ if (success) {
1006
+ console.log(jsonStr);
1007
+ } else {
1008
+ console.error(jsonStr);
1009
+ }
1010
+ }
1011
+ info(_message, ..._args) {
1012
+ }
1013
+ success(_message, ..._args) {
1014
+ }
1015
+ warn(_message, ..._args) {
1016
+ }
1017
+ error(message, code, ..._args) {
1018
+ if (isEnvTest()) return;
1019
+ const errorMessage = message instanceof Error ? message.message : message;
1020
+ const errorInfo = {
1021
+ code: code || ErrorCodes.UNKNOWN_ERROR,
1022
+ message: errorMessage
1023
+ };
1024
+ if (this._verbose && message instanceof Error && message.stack) {
1025
+ errorInfo.stack = message.stack;
1026
+ }
1027
+ this.outputJson(false, errorInfo);
1028
+ }
1029
+ debug(_message, ..._args) {
1030
+ }
1031
+ };
1032
+
819
1033
  // src/lib/generate.ts
820
- import { join as join137 } from "path";
1034
+ import { join as join138 } from "path";
821
1035
  import { intersection } from "es-toolkit";
822
1036
 
823
1037
  // src/features/commands/commands-processor.ts
@@ -9719,15 +9933,10 @@ function mapBashActionToDecision(action) {
9719
9933
 
9720
9934
  // src/features/permissions/geminicli-permissions.ts
9721
9935
  import { join as join64 } from "path";
9936
+ import * as smolToml5 from "smol-toml";
9722
9937
  import { z as z29 } from "zod/mini";
9723
- var GeminiCliSettingsSchema = z29.looseObject({
9724
- tools: z29.optional(
9725
- z29.looseObject({
9726
- allowed: z29.optional(z29.array(z29.string())),
9727
- exclude: z29.optional(z29.array(z29.string()))
9728
- })
9729
- )
9730
- });
9938
+ var GEMINICLI_POLICY_RELATIVE_DIR_PATH = join64(".gemini", "policies");
9939
+ var GEMINICLI_POLICY_FILE_NAME = "rulesync.toml";
9731
9940
  var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
9732
9941
  bash: "run_shell_command",
9733
9942
  read: "read_file",
@@ -9735,16 +9944,32 @@ var RULESYNC_TO_GEMINICLI_TOOL_NAME = {
9735
9944
  write: "write_file",
9736
9945
  webfetch: "web_fetch"
9737
9946
  };
9947
+ var GEMINICLI_TO_RULESYNC_TOOL_NAME = Object.fromEntries(
9948
+ Object.entries(RULESYNC_TO_GEMINICLI_TOOL_NAME).map(([k, v]) => [v, k])
9949
+ );
9950
+ var PRIORITY_DENY = 1e6;
9951
+ var PRIORITY_ASK = 1e3;
9952
+ var PRIORITY_ALLOW = 1;
9953
+ var SINGLE_STAR_REGEX = '[^/\\"]*';
9954
+ var DOUBLE_STAR_REGEX = '[^\\"]*';
9955
+ var SINGLE_CHAR_REGEX = '[^/\\"]';
9956
+ var LEGACY_SINGLE_STAR_REGEX = '[^\\"]*';
9957
+ var LEGACY_DOUBLE_STAR_REGEX = ".*";
9958
+ var COMMAND_ARGS_ANCHOR = '"command":"';
9959
+ var VALUE_END_ANCHOR = '\\"';
9960
+ var RESERVED_OBJECT_KEYS = /* @__PURE__ */ new Set([
9961
+ "__proto__",
9962
+ "constructor",
9963
+ "prototype"
9964
+ ]);
9965
+ var moduleLogger = new ConsoleLogger();
9738
9966
  var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
9739
9967
  static getSettablePaths(_options = {}) {
9740
9968
  return {
9741
- relativeDirPath: ".gemini",
9742
- relativeFilePath: "settings.json"
9969
+ relativeDirPath: GEMINICLI_POLICY_RELATIVE_DIR_PATH,
9970
+ relativeFilePath: GEMINICLI_POLICY_FILE_NAME
9743
9971
  };
9744
9972
  }
9745
- isDeletable() {
9746
- return false;
9747
- }
9748
9973
  static async fromFile({
9749
9974
  baseDir = process.cwd(),
9750
9975
  validate = true,
@@ -9752,7 +9977,7 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
9752
9977
  }) {
9753
9978
  const paths = this.getSettablePaths({ global });
9754
9979
  const filePath = join64(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9755
- const fileContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
9980
+ const fileContent = await readFileContentOrNull(filePath) ?? "";
9756
9981
  return new _GeminicliPermissions({
9757
9982
  baseDir,
9758
9983
  relativeDirPath: paths.relativeDirPath,
@@ -9761,63 +9986,72 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
9761
9986
  validate
9762
9987
  });
9763
9988
  }
9764
- static async fromRulesyncPermissions({
9989
+ static fromRulesyncPermissions({
9765
9990
  baseDir = process.cwd(),
9766
9991
  rulesyncPermissions,
9767
9992
  validate = true,
9768
- logger,
9769
- global = false
9993
+ global = false,
9994
+ logger = moduleLogger
9770
9995
  }) {
9771
9996
  const paths = this.getSettablePaths({ global });
9772
- const filePath = join64(baseDir, paths.relativeDirPath, paths.relativeFilePath);
9773
- const existingContent = await readFileContentOrNull(filePath) ?? JSON.stringify({}, null, 2);
9774
- const settingsResult = GeminiCliSettingsSchema.safeParse(JSON.parse(existingContent));
9775
- if (!settingsResult.success) {
9776
- throw new Error(
9777
- `Failed to parse existing Gemini CLI settings at ${filePath}: ${formatError(settingsResult.error)}`
9778
- );
9779
- }
9780
- const { allowed, exclude } = convertRulesyncToGeminicliTools({
9781
- config: rulesyncPermissions.getJson(),
9782
- logger
9783
- });
9784
- const merged = {
9785
- ...settingsResult.data,
9786
- tools: {
9787
- ...settingsResult.data.tools,
9788
- ...allowed.length > 0 ? { allowed } : {},
9789
- ...exclude.length > 0 ? { exclude } : {}
9790
- }
9791
- };
9997
+ const fileContent = buildGeminicliPolicyContent(rulesyncPermissions.getJson(), logger);
9792
9998
  return new _GeminicliPermissions({
9793
9999
  baseDir,
9794
10000
  relativeDirPath: paths.relativeDirPath,
9795
10001
  relativeFilePath: paths.relativeFilePath,
9796
- fileContent: JSON.stringify(merged, null, 2),
10002
+ fileContent,
9797
10003
  validate
9798
10004
  });
9799
10005
  }
9800
10006
  toRulesyncPermissions() {
9801
- let settings;
9802
- try {
9803
- const parsed = JSON.parse(this.getFileContent());
9804
- settings = GeminiCliSettingsSchema.parse(parsed);
9805
- } catch (error) {
9806
- throw new Error(
9807
- `Failed to parse Gemini CLI permissions content in ${join64(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
9808
- { cause: error }
9809
- );
9810
- }
9811
10007
  const permission = {};
9812
- for (const toolEntry of settings.tools?.allowed ?? []) {
9813
- const mapped = parseGeminicliToolEntry({ entry: toolEntry });
9814
- const rules = permission[mapped.category] ??= {};
9815
- rules[mapped.pattern] = "allow";
9816
- }
9817
- for (const toolEntry of settings.tools?.exclude ?? []) {
9818
- const mapped = parseGeminicliToolEntry({ entry: toolEntry });
9819
- const rules = permission[mapped.category] ??= {};
9820
- rules[mapped.pattern] = "deny";
10008
+ const fileContent = this.getFileContent();
10009
+ if (fileContent.trim().length > 0) {
10010
+ let parsed;
10011
+ try {
10012
+ parsed = smolToml5.parse(fileContent);
10013
+ } catch (error) {
10014
+ throw new Error(
10015
+ `Failed to parse Gemini CLI policy TOML in ${join64(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${formatError(error)}`,
10016
+ { cause: error }
10017
+ );
10018
+ }
10019
+ const rules = extractRules(parsed, moduleLogger);
10020
+ for (const [index, rule] of rules.entries()) {
10021
+ const mappedCategory = Object.hasOwn(GEMINICLI_TO_RULESYNC_TOOL_NAME, rule.toolName) ? GEMINICLI_TO_RULESYNC_TOOL_NAME[rule.toolName] : void 0;
10022
+ const category = mappedCategory ?? rule.toolName;
10023
+ if (RESERVED_OBJECT_KEYS.has(category)) {
10024
+ moduleLogger.warn(
10025
+ `Skipping rule #${index} in ${this.getRelativeFilePath()}: toolName "${rule.toolName}" maps to a reserved object key ("${category}") and would risk prototype pollution.`
10026
+ );
10027
+ continue;
10028
+ }
10029
+ const action = mapFromGeminicliDecision(rule.decision);
10030
+ if (!action) {
10031
+ moduleLogger.warn(
10032
+ `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)}`
10033
+ );
10034
+ continue;
10035
+ }
10036
+ if (rule.toolName === "run_shell_command" && rule.commandPrefix !== void 0 && rule.argsPattern !== void 0) {
10037
+ moduleLogger.warn(
10038
+ `Rule #${index} in ${this.getRelativeFilePath()} sets both commandPrefix and argsPattern; rulesync will honor argsPattern and ignore commandPrefix=${JSON.stringify(rule.commandPrefix)}.`
10039
+ );
10040
+ }
10041
+ const pattern = extractPattern(rule);
10042
+ if (RESERVED_OBJECT_KEYS.has(pattern)) {
10043
+ moduleLogger.warn(
10044
+ `Skipping rule #${index} in ${this.getRelativeFilePath()}: pattern "${pattern}" is a reserved object key.`
10045
+ );
10046
+ continue;
10047
+ }
10048
+ const existing = Object.hasOwn(permission, category) ? permission[category] : void 0;
10049
+ const target = existing ?? {};
10050
+ if (existing === void 0) {
10051
+ permission[category] = target;
10052
+ }
10053
+ target[pattern] = action;
10054
+ }
9821
10055
  }
9822
10056
  return this.toRulesyncPermissionsDefault({
9823
10057
  fileContent: JSON.stringify({ permission }, null, 2)
@@ -9835,50 +10069,238 @@ var GeminicliPermissions = class _GeminicliPermissions extends ToolPermissions {
9835
10069
  baseDir,
9836
10070
  relativeDirPath,
9837
10071
  relativeFilePath,
9838
- fileContent: JSON.stringify({}, null, 2),
10072
+ fileContent: "",
9839
10073
  validate: false
9840
10074
  });
9841
10075
  }
9842
10076
  };
9843
- function convertRulesyncToGeminicliTools({
9844
- config,
9845
- logger
9846
- }) {
9847
- const allowed = [];
9848
- const exclude = [];
9849
- for (const [toolName, rules] of Object.entries(config.permission)) {
10077
+ function buildGeminicliPolicyContent(config, logger) {
10078
+ const rules = [];
10079
+ let order = 0;
10080
+ for (const [toolName, entries] of Object.entries(config.permission)) {
9850
10081
  const mappedToolName = RULESYNC_TO_GEMINICLI_TOOL_NAME[toolName] ?? toolName;
9851
- if (!RULESYNC_TO_GEMINICLI_TOOL_NAME[toolName]) {
9852
- logger?.warn(`Gemini CLI permissions use direct tool names. Mapping as-is: ${toolName}`);
9853
- }
9854
- for (const [pattern, action] of Object.entries(rules)) {
9855
- if (action === "ask") {
9856
- logger?.warn(
9857
- `Gemini CLI does not support explicit "ask" rules in settings. Skipping ${toolName}:${pattern}`
10082
+ for (const [pattern, action] of Object.entries(entries)) {
10083
+ if (pattern === "") {
10084
+ logger.warn(
10085
+ `Skipping rule "${toolName}: "": empty pattern is not a valid permission target and would silently match every invocation (bash) or nothing (other tools).`
9858
10086
  );
9859
10087
  continue;
9860
10088
  }
9861
- const geminiEntry = pattern === "*" ? mappedToolName : `${mappedToolName}(${pattern})`;
9862
- if (action === "allow") {
9863
- allowed.push(geminiEntry);
9864
- } else {
9865
- exclude.push(geminiEntry);
10089
+ if (hasUnsafeAnchorChar(pattern)) {
10090
+ logger.warn(
10091
+ `Skipping rule "${toolName}: ${pattern}": pattern contains a character (" or \\) that would break JSON-anchor matching in the Gemini CLI Policy Engine.`
10092
+ );
10093
+ continue;
10094
+ }
10095
+ const decision = mapToGeminicliDecision(action);
10096
+ if (mappedToolName === "run_shell_command" && (pattern === "*" || pattern === "**") && decision !== "ask_user") {
10097
+ logger.warn(
10098
+ `Skipping rule "${toolName}: ${pattern}" with decision ${decision}: bash match-all patterns are only supported with "ask" because they would otherwise affect every shell command.`
10099
+ );
10100
+ continue;
10101
+ }
10102
+ const currentRule = {
10103
+ toolName: mappedToolName,
10104
+ decision,
10105
+ priority: priorityForDecision(decision)
10106
+ };
10107
+ if (mappedToolName === "run_shell_command") {
10108
+ applyShellPattern({ rule: currentRule, pattern, toolName, logger });
10109
+ } else if (pattern !== "*") {
10110
+ currentRule.argsPattern = buildNonShellArgsPattern(pattern);
9866
10111
  }
10112
+ rules.push({ rule: currentRule, order: order++ });
9867
10113
  }
9868
10114
  }
9869
- return { allowed, exclude };
10115
+ rules.sort((a, b) => {
10116
+ const diff = toNumber(b.rule.priority) - toNumber(a.rule.priority);
10117
+ return diff !== 0 ? diff : a.order - b.order;
10118
+ });
10119
+ return smolToml5.stringify({ rule: rules.map((entry) => entry.rule) });
9870
10120
  }
9871
- function parseGeminicliToolEntry({ entry }) {
9872
- const match = /^([^()]+?)(?:\((.*)\))?$/.exec(entry);
9873
- if (!match) return { category: entry, pattern: "*" };
9874
- const rawToolName = match[1]?.trim() ?? entry;
9875
- const mappedCategory = Object.entries(RULESYNC_TO_GEMINICLI_TOOL_NAME).find(
9876
- ([, value]) => value === rawToolName
9877
- )?.[0];
9878
- return {
9879
- category: mappedCategory ?? rawToolName,
9880
- pattern: (match[2] ?? "*").trim()
9881
- };
10121
+ function buildNonShellArgsPattern(pattern) {
10122
+ return `"${globPatternToRegex(pattern)}${VALUE_END_ANCHOR}`;
10123
+ }
10124
+ function hasUnsafeAnchorChar(pattern) {
10125
+ return pattern.includes('"') || pattern.includes("\\");
10126
+ }
10127
+ function toNumber(value) {
10128
+ return typeof value === "number" ? value : 0;
10129
+ }
10130
+ function applyShellPattern({
10131
+ rule,
10132
+ pattern,
10133
+ toolName,
10134
+ logger
10135
+ }) {
10136
+ if (pattern === "*") {
10137
+ return;
10138
+ }
10139
+ const trailingWildcardStripped = pattern.endsWith(" *") ? pattern.slice(0, -2) : pattern;
10140
+ if (hasGlobMetacharacter(trailingWildcardStripped)) {
10141
+ rule.argsPattern = `${COMMAND_ARGS_ANCHOR}${globPatternToRegex(pattern)}`;
10142
+ logger.warn(
10143
+ `Gemini CLI does not support glob metacharacters inside a bash command prefix; emitting argsPattern for rule "${toolName}: ${pattern}".`
10144
+ );
10145
+ return;
10146
+ }
10147
+ rule.commandPrefix = trailingWildcardStripped;
10148
+ }
10149
+ function hasGlobMetacharacter(pattern) {
10150
+ return /[*?[\]]/.test(pattern);
10151
+ }
10152
+ function priorityForDecision(decision) {
10153
+ if (decision === "deny") return PRIORITY_DENY;
10154
+ if (decision === "ask_user") return PRIORITY_ASK;
10155
+ return PRIORITY_ALLOW;
10156
+ }
10157
+ function mapToGeminicliDecision(action) {
10158
+ if (action === "ask") {
10159
+ return "ask_user";
10160
+ }
10161
+ return action;
10162
+ }
10163
+ function mapFromGeminicliDecision(decision) {
10164
+ if (decision === "allow") return "allow";
10165
+ if (decision === "deny") return "deny";
10166
+ if (decision === "ask_user") return "ask";
10167
+ return null;
10168
+ }
10169
+ function globPatternToRegex(pattern) {
10170
+ let regex = "";
10171
+ let i = 0;
10172
+ while (i < pattern.length) {
10173
+ const char = pattern[i];
10174
+ if (char === void 0) {
10175
+ break;
10176
+ }
10177
+ if (char === "*" && pattern[i + 1] === "*") {
10178
+ regex += DOUBLE_STAR_REGEX;
10179
+ i += 2;
10180
+ continue;
10181
+ }
10182
+ if (char === "*") {
10183
+ regex += SINGLE_STAR_REGEX;
10184
+ i += 1;
10185
+ continue;
10186
+ }
10187
+ if (char === "?") {
10188
+ regex += SINGLE_CHAR_REGEX;
10189
+ i += 1;
10190
+ continue;
10191
+ }
10192
+ if (char === "[") {
10193
+ regex += escapeRegexChar(char);
10194
+ i += 1;
10195
+ continue;
10196
+ }
10197
+ if (char === "]") {
10198
+ regex += escapeRegexChar(char);
10199
+ i += 1;
10200
+ continue;
10201
+ }
10202
+ if (isRegexMetacharacter(char)) {
10203
+ regex += `\\${char}`;
10204
+ i += 1;
10205
+ continue;
10206
+ }
10207
+ regex += char;
10208
+ i += 1;
10209
+ }
10210
+ return regex;
10211
+ }
10212
+ function escapeRegexChar(char) {
10213
+ return `\\${char}`;
10214
+ }
10215
+ function isRegexMetacharacter(char) {
10216
+ return /[.+^${}()|\\]/.test(char);
10217
+ }
10218
+ function regexToGlobPattern(regex) {
10219
+ let source = regex;
10220
+ if (source.endsWith(VALUE_END_ANCHOR)) {
10221
+ source = source.slice(0, -VALUE_END_ANCHOR.length);
10222
+ }
10223
+ let glob = "";
10224
+ let i = 0;
10225
+ while (i < source.length) {
10226
+ if (source.startsWith(DOUBLE_STAR_REGEX, i)) {
10227
+ glob += "**";
10228
+ i += DOUBLE_STAR_REGEX.length;
10229
+ continue;
10230
+ }
10231
+ if (source.startsWith(LEGACY_DOUBLE_STAR_REGEX, i)) {
10232
+ glob += "**";
10233
+ i += LEGACY_DOUBLE_STAR_REGEX.length;
10234
+ continue;
10235
+ }
10236
+ if (source.startsWith(SINGLE_STAR_REGEX, i)) {
10237
+ glob += "*";
10238
+ i += SINGLE_STAR_REGEX.length;
10239
+ continue;
10240
+ }
10241
+ if (source.startsWith(LEGACY_SINGLE_STAR_REGEX, i)) {
10242
+ glob += "*";
10243
+ i += LEGACY_SINGLE_STAR_REGEX.length;
10244
+ continue;
10245
+ }
10246
+ if (source.startsWith(SINGLE_CHAR_REGEX, i)) {
10247
+ glob += "?";
10248
+ i += SINGLE_CHAR_REGEX.length;
10249
+ continue;
10250
+ }
10251
+ const char = source[i];
10252
+ if (char === "\\") {
10253
+ const escaped = source[i + 1];
10254
+ if (escaped !== void 0) {
10255
+ glob += escaped;
10256
+ i += 2;
10257
+ continue;
10258
+ }
10259
+ }
10260
+ glob += char ?? "";
10261
+ i += 1;
10262
+ }
10263
+ return glob;
10264
+ }
10265
+ var GeminicliPolicyRuleSchema = z29.looseObject({
10266
+ toolName: z29.string(),
10267
+ decision: z29.optional(z29.unknown()),
10268
+ commandPrefix: z29.optional(z29.string()),
10269
+ argsPattern: z29.optional(z29.string())
10270
+ });
10271
+ var GeminicliPolicyFileSchema = z29.looseObject({
10272
+ rule: z29.optional(z29.array(z29.looseObject({})))
10273
+ });
10274
+ function extractRules(parsed, logger) {
10275
+ const parsedFile = GeminicliPolicyFileSchema.safeParse(parsed);
10276
+ if (!parsedFile.success || !parsedFile.data.rule) {
10277
+ return [];
10278
+ }
10279
+ const rules = [];
10280
+ for (const [index, entry] of parsedFile.data.rule.entries()) {
10281
+ const result = GeminicliPolicyRuleSchema.safeParse(entry);
10282
+ if (result.success) {
10283
+ rules.push(result.data);
10284
+ continue;
10285
+ }
10286
+ logger.warn(
10287
+ `Skipping malformed Gemini CLI policy rule at index ${index}: ${formatError(result.error)}`
10288
+ );
10289
+ }
10290
+ return rules;
10291
+ }
10292
+ function extractPattern(rule) {
10293
+ if (rule.toolName === "run_shell_command") {
10294
+ if (rule.argsPattern) {
10295
+ const stripped = rule.argsPattern.startsWith(COMMAND_ARGS_ANCHOR) ? rule.argsPattern.slice(COMMAND_ARGS_ANCHOR.length) : rule.argsPattern;
10296
+ return regexToGlobPattern(stripped);
10297
+ }
10298
+ if (!rule.commandPrefix) return "*";
10299
+ return rule.commandPrefix.endsWith(" *") || rule.commandPrefix.endsWith("*") ? rule.commandPrefix : `${rule.commandPrefix} *`;
10300
+ }
10301
+ if (!rule.argsPattern) return "*";
10302
+ const regex = rule.argsPattern.startsWith('"') ? rule.argsPattern.slice(1) : rule.argsPattern;
10303
+ return regexToGlobPattern(regex);
9882
10304
  }
9883
10305
 
9884
10306
  // src/features/permissions/kiro-permissions.ts
@@ -10368,9 +10790,9 @@ var PermissionsProcessor = class extends FeatureProcessor {
10368
10790
  };
10369
10791
 
10370
10792
  // src/features/rules/rules-processor.ts
10371
- import { basename as basename10, dirname as dirname3, join as join136, relative as relative5 } from "path";
10793
+ import { basename as basename10, dirname as dirname3, join as join137, relative as relative5 } from "path";
10372
10794
  import { encode } from "@toon-format/toon";
10373
- import { z as z71 } from "zod/mini";
10795
+ import { z as z72 } from "zod/mini";
10374
10796
 
10375
10797
  // src/constants/general.ts
10376
10798
  var SKILL_FILE_NAME = "SKILL.md";
@@ -11158,8 +11580,8 @@ var RovodevSkill = class _RovodevSkill extends ToolSkill {
11158
11580
  };
11159
11581
 
11160
11582
  // src/features/skills/skills-processor.ts
11161
- import { basename as basename5, join as join91 } from "path";
11162
- import { z as z51 } from "zod/mini";
11583
+ import { basename as basename5, join as join92 } from "path";
11584
+ import { z as z52 } from "zod/mini";
11163
11585
 
11164
11586
  // src/types/dir-feature-processor.ts
11165
11587
  import { join as join74 } from "path";
@@ -13799,6 +14221,166 @@ async function getLocalSkillDirNames(baseDir) {
13799
14221
  return names;
13800
14222
  }
13801
14223
 
14224
+ // src/features/skills/windsurf-skill.ts
14225
+ import { join as join91 } from "path";
14226
+ import { z as z51 } from "zod/mini";
14227
+ var WindsurfSkillFrontmatterSchema = z51.looseObject({
14228
+ name: z51.string(),
14229
+ description: z51.string()
14230
+ });
14231
+ var WindsurfSkill = class _WindsurfSkill extends ToolSkill {
14232
+ constructor({
14233
+ baseDir = process.cwd(),
14234
+ relativeDirPath = _WindsurfSkill.getSettablePaths().relativeDirPath,
14235
+ dirName,
14236
+ frontmatter,
14237
+ body,
14238
+ otherFiles = [],
14239
+ validate = true,
14240
+ global = false
14241
+ }) {
14242
+ super({
14243
+ baseDir,
14244
+ relativeDirPath,
14245
+ dirName,
14246
+ mainFile: {
14247
+ name: SKILL_FILE_NAME,
14248
+ body,
14249
+ frontmatter: { ...frontmatter }
14250
+ },
14251
+ otherFiles,
14252
+ global
14253
+ });
14254
+ if (validate) {
14255
+ const result = this.validate();
14256
+ if (!result.success) {
14257
+ throw result.error;
14258
+ }
14259
+ }
14260
+ }
14261
+ static getSettablePaths({ global = false } = {}) {
14262
+ if (global) {
14263
+ return {
14264
+ relativeDirPath: join91(".codeium", "windsurf", "skills")
14265
+ };
14266
+ }
14267
+ return {
14268
+ relativeDirPath: join91(".windsurf", "skills")
14269
+ };
14270
+ }
14271
+ getFrontmatter() {
14272
+ const result = WindsurfSkillFrontmatterSchema.parse(this.requireMainFileFrontmatter());
14273
+ return result;
14274
+ }
14275
+ getBody() {
14276
+ return this.mainFile?.body ?? "";
14277
+ }
14278
+ validate() {
14279
+ if (!this.mainFile) {
14280
+ return {
14281
+ success: false,
14282
+ error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
14283
+ };
14284
+ }
14285
+ const result = WindsurfSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
14286
+ if (!result.success) {
14287
+ return {
14288
+ success: false,
14289
+ error: new Error(
14290
+ `Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
14291
+ )
14292
+ };
14293
+ }
14294
+ return { success: true, error: null };
14295
+ }
14296
+ toRulesyncSkill() {
14297
+ const frontmatter = this.getFrontmatter();
14298
+ const rulesyncFrontmatter = {
14299
+ name: frontmatter.name,
14300
+ description: frontmatter.description,
14301
+ targets: ["*"]
14302
+ };
14303
+ return new RulesyncSkill({
14304
+ baseDir: this.baseDir,
14305
+ relativeDirPath: RULESYNC_SKILLS_RELATIVE_DIR_PATH,
14306
+ dirName: this.getDirName(),
14307
+ frontmatter: rulesyncFrontmatter,
14308
+ body: this.getBody(),
14309
+ otherFiles: this.getOtherFiles(),
14310
+ validate: true,
14311
+ global: this.global
14312
+ });
14313
+ }
14314
+ static fromRulesyncSkill({
14315
+ baseDir = process.cwd(),
14316
+ rulesyncSkill,
14317
+ validate = true,
14318
+ global = false
14319
+ }) {
14320
+ const settablePaths = _WindsurfSkill.getSettablePaths({ global });
14321
+ const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
14322
+ const windsurfFrontmatter = {
14323
+ name: rulesyncFrontmatter.name,
14324
+ description: rulesyncFrontmatter.description
14325
+ };
14326
+ return new _WindsurfSkill({
14327
+ baseDir,
14328
+ relativeDirPath: settablePaths.relativeDirPath,
14329
+ dirName: rulesyncSkill.getDirName(),
14330
+ frontmatter: windsurfFrontmatter,
14331
+ body: rulesyncSkill.getBody(),
14332
+ otherFiles: rulesyncSkill.getOtherFiles(),
14333
+ validate,
14334
+ global
14335
+ });
14336
+ }
14337
+ static isTargetedByRulesyncSkill(rulesyncSkill) {
14338
+ const targets = rulesyncSkill.getFrontmatter().targets;
14339
+ return targets.includes("*") || targets.includes("windsurf");
14340
+ }
14341
+ static async fromDir(params) {
14342
+ const loaded = await this.loadSkillDirContent({
14343
+ ...params,
14344
+ getSettablePaths: _WindsurfSkill.getSettablePaths
14345
+ });
14346
+ const result = WindsurfSkillFrontmatterSchema.safeParse(loaded.frontmatter);
14347
+ if (!result.success) {
14348
+ const skillDirPath = join91(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
14349
+ throw new Error(
14350
+ `Invalid frontmatter in ${join91(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
14351
+ );
14352
+ }
14353
+ return new _WindsurfSkill({
14354
+ baseDir: loaded.baseDir,
14355
+ relativeDirPath: loaded.relativeDirPath,
14356
+ dirName: loaded.dirName,
14357
+ frontmatter: result.data,
14358
+ body: loaded.body,
14359
+ otherFiles: loaded.otherFiles,
14360
+ validate: true,
14361
+ global: loaded.global
14362
+ });
14363
+ }
14364
+ static forDeletion({
14365
+ baseDir = process.cwd(),
14366
+ relativeDirPath,
14367
+ dirName,
14368
+ global = false
14369
+ }) {
14370
+ const settablePaths = _WindsurfSkill.getSettablePaths({ global });
14371
+ return new _WindsurfSkill({
14372
+ baseDir,
14373
+ relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
14374
+ dirName,
14375
+ frontmatter: { name: "", description: "" },
14376
+ body: "",
14377
+ otherFiles: [],
14378
+ validate: false,
14379
+ global
14380
+ });
14381
+ }
14382
+ };
14383
+
13802
14384
  // src/features/skills/skills-processor.ts
13803
14385
  var skillsProcessorToolTargetTuple = [
13804
14386
  "agentsmd",
@@ -13819,9 +14401,10 @@ var skillsProcessorToolTargetTuple = [
13819
14401
  "opencode",
13820
14402
  "replit",
13821
14403
  "roo",
13822
- "rovodev"
14404
+ "rovodev",
14405
+ "windsurf"
13823
14406
  ];
13824
- var SkillsProcessorToolTargetSchema = z51.enum(skillsProcessorToolTargetTuple);
14407
+ var SkillsProcessorToolTargetSchema = z52.enum(skillsProcessorToolTargetTuple);
13825
14408
  var toolSkillFactories = /* @__PURE__ */ new Map([
13826
14409
  [
13827
14410
  "agentsmd",
@@ -13955,6 +14538,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
13955
14538
  class: RovodevSkill,
13956
14539
  meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
13957
14540
  }
14541
+ ],
14542
+ [
14543
+ "windsurf",
14544
+ {
14545
+ class: WindsurfSkill,
14546
+ meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
14547
+ }
13958
14548
  ]
13959
14549
  ]);
13960
14550
  var defaultGetFactory4 = (target) => {
@@ -14045,10 +14635,10 @@ var SkillsProcessor = class extends DirFeatureProcessor {
14045
14635
  )
14046
14636
  );
14047
14637
  const localSkillNames = new Set(localDirNames);
14048
- const curatedDirPath = join91(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
14638
+ const curatedDirPath = join92(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
14049
14639
  let curatedSkills = [];
14050
14640
  if (await directoryExists(curatedDirPath)) {
14051
- const curatedDirPaths = await findFilesByGlobs(join91(curatedDirPath, "*"), { type: "dir" });
14641
+ const curatedDirPaths = await findFilesByGlobs(join92(curatedDirPath, "*"), { type: "dir" });
14052
14642
  const curatedDirNames = curatedDirPaths.map((path3) => basename5(path3));
14053
14643
  const nonConflicting = curatedDirNames.filter((name) => {
14054
14644
  if (localSkillNames.has(name)) {
@@ -14086,11 +14676,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
14086
14676
  const seenDirNames = /* @__PURE__ */ new Set();
14087
14677
  const loadEntries = [];
14088
14678
  for (const root of roots) {
14089
- const skillsDirPath = join91(this.baseDir, root);
14679
+ const skillsDirPath = join92(this.baseDir, root);
14090
14680
  if (!await directoryExists(skillsDirPath)) {
14091
14681
  continue;
14092
14682
  }
14093
- const dirPaths = await findFilesByGlobs(join91(skillsDirPath, "*"), { type: "dir" });
14683
+ const dirPaths = await findFilesByGlobs(join92(skillsDirPath, "*"), { type: "dir" });
14094
14684
  for (const dirPath of dirPaths) {
14095
14685
  const dirName = basename5(dirPath);
14096
14686
  if (seenDirNames.has(dirName)) {
@@ -14121,11 +14711,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
14121
14711
  const roots = toolSkillSearchRoots(paths);
14122
14712
  const toolSkills = [];
14123
14713
  for (const root of roots) {
14124
- const skillsDirPath = join91(this.baseDir, root);
14714
+ const skillsDirPath = join92(this.baseDir, root);
14125
14715
  if (!await directoryExists(skillsDirPath)) {
14126
14716
  continue;
14127
14717
  }
14128
- const dirPaths = await findFilesByGlobs(join91(skillsDirPath, "*"), { type: "dir" });
14718
+ const dirPaths = await findFilesByGlobs(join92(skillsDirPath, "*"), { type: "dir" });
14129
14719
  for (const dirPath of dirPaths) {
14130
14720
  const dirName = basename5(dirPath);
14131
14721
  const toolSkill = factory.class.forDeletion({
@@ -14189,11 +14779,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
14189
14779
  };
14190
14780
 
14191
14781
  // src/features/subagents/agentsmd-subagent.ts
14192
- import { join as join93 } from "path";
14782
+ import { join as join94 } from "path";
14193
14783
 
14194
14784
  // src/features/subagents/simulated-subagent.ts
14195
- import { basename as basename6, join as join92 } from "path";
14196
- import { z as z52 } from "zod/mini";
14785
+ import { basename as basename6, join as join93 } from "path";
14786
+ import { z as z53 } from "zod/mini";
14197
14787
 
14198
14788
  // src/features/subagents/tool-subagent.ts
14199
14789
  var ToolSubagent = class extends ToolFile {
@@ -14245,9 +14835,9 @@ var ToolSubagent = class extends ToolFile {
14245
14835
  };
14246
14836
 
14247
14837
  // src/features/subagents/simulated-subagent.ts
14248
- var SimulatedSubagentFrontmatterSchema = z52.object({
14249
- name: z52.string(),
14250
- description: z52.optional(z52.string())
14838
+ var SimulatedSubagentFrontmatterSchema = z53.object({
14839
+ name: z53.string(),
14840
+ description: z53.optional(z53.string())
14251
14841
  });
14252
14842
  var SimulatedSubagent = class extends ToolSubagent {
14253
14843
  frontmatter;
@@ -14257,7 +14847,7 @@ var SimulatedSubagent = class extends ToolSubagent {
14257
14847
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
14258
14848
  if (!result.success) {
14259
14849
  throw new Error(
14260
- `Invalid frontmatter in ${join92(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14850
+ `Invalid frontmatter in ${join93(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14261
14851
  );
14262
14852
  }
14263
14853
  }
@@ -14308,7 +14898,7 @@ var SimulatedSubagent = class extends ToolSubagent {
14308
14898
  return {
14309
14899
  success: false,
14310
14900
  error: new Error(
14311
- `Invalid frontmatter in ${join92(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14901
+ `Invalid frontmatter in ${join93(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14312
14902
  )
14313
14903
  };
14314
14904
  }
@@ -14318,7 +14908,7 @@ var SimulatedSubagent = class extends ToolSubagent {
14318
14908
  relativeFilePath,
14319
14909
  validate = true
14320
14910
  }) {
14321
- const filePath = join92(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
14911
+ const filePath = join93(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
14322
14912
  const fileContent = await readFileContent(filePath);
14323
14913
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14324
14914
  const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14354,7 +14944,7 @@ var SimulatedSubagent = class extends ToolSubagent {
14354
14944
  var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
14355
14945
  static getSettablePaths() {
14356
14946
  return {
14357
- relativeDirPath: join93(".agents", "subagents")
14947
+ relativeDirPath: join94(".agents", "subagents")
14358
14948
  };
14359
14949
  }
14360
14950
  static async fromFile(params) {
@@ -14377,11 +14967,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
14377
14967
  };
14378
14968
 
14379
14969
  // src/features/subagents/factorydroid-subagent.ts
14380
- import { join as join94 } from "path";
14970
+ import { join as join95 } from "path";
14381
14971
  var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
14382
14972
  static getSettablePaths(_options) {
14383
14973
  return {
14384
- relativeDirPath: join94(".factory", "droids")
14974
+ relativeDirPath: join95(".factory", "droids")
14385
14975
  };
14386
14976
  }
14387
14977
  static async fromFile(params) {
@@ -14404,16 +14994,16 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
14404
14994
  };
14405
14995
 
14406
14996
  // src/features/subagents/geminicli-subagent.ts
14407
- import { join as join96 } from "path";
14408
- import { z as z54 } from "zod/mini";
14997
+ import { join as join97 } from "path";
14998
+ import { z as z55 } from "zod/mini";
14409
14999
 
14410
15000
  // src/features/subagents/rulesync-subagent.ts
14411
- import { basename as basename7, join as join95 } from "path";
14412
- import { z as z53 } from "zod/mini";
14413
- var RulesyncSubagentFrontmatterSchema = z53.looseObject({
14414
- targets: z53._default(RulesyncTargetsSchema, ["*"]),
14415
- name: z53.string(),
14416
- description: z53.optional(z53.string())
15001
+ import { basename as basename7, join as join96 } from "path";
15002
+ import { z as z54 } from "zod/mini";
15003
+ var RulesyncSubagentFrontmatterSchema = z54.looseObject({
15004
+ targets: z54._default(RulesyncTargetsSchema, ["*"]),
15005
+ name: z54.string(),
15006
+ description: z54.optional(z54.string())
14417
15007
  });
14418
15008
  var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
14419
15009
  frontmatter;
@@ -14422,7 +15012,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
14422
15012
  const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
14423
15013
  if (!parseResult.success && rest.validate !== false) {
14424
15014
  throw new Error(
14425
- `Invalid frontmatter in ${join95(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
15015
+ `Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
14426
15016
  );
14427
15017
  }
14428
15018
  const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
@@ -14455,7 +15045,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
14455
15045
  return {
14456
15046
  success: false,
14457
15047
  error: new Error(
14458
- `Invalid frontmatter in ${join95(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15048
+ `Invalid frontmatter in ${join96(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14459
15049
  )
14460
15050
  };
14461
15051
  }
@@ -14463,7 +15053,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
14463
15053
  static async fromFile({
14464
15054
  relativeFilePath
14465
15055
  }) {
14466
- const filePath = join95(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
15056
+ const filePath = join96(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath);
14467
15057
  const fileContent = await readFileContent(filePath);
14468
15058
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14469
15059
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14482,9 +15072,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
14482
15072
  };
14483
15073
 
14484
15074
  // src/features/subagents/geminicli-subagent.ts
14485
- var GeminiCliSubagentFrontmatterSchema = z54.looseObject({
14486
- name: z54.string(),
14487
- description: z54.optional(z54.string())
15075
+ var GeminiCliSubagentFrontmatterSchema = z55.looseObject({
15076
+ name: z55.string(),
15077
+ description: z55.optional(z55.string())
14488
15078
  });
14489
15079
  var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
14490
15080
  frontmatter;
@@ -14494,7 +15084,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
14494
15084
  const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
14495
15085
  if (!result.success) {
14496
15086
  throw new Error(
14497
- `Invalid frontmatter in ${join96(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15087
+ `Invalid frontmatter in ${join97(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14498
15088
  );
14499
15089
  }
14500
15090
  }
@@ -14507,7 +15097,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
14507
15097
  }
14508
15098
  static getSettablePaths(_options = {}) {
14509
15099
  return {
14510
- relativeDirPath: join96(".gemini", "agents")
15100
+ relativeDirPath: join97(".gemini", "agents")
14511
15101
  };
14512
15102
  }
14513
15103
  getFrontmatter() {
@@ -14575,7 +15165,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
14575
15165
  return {
14576
15166
  success: false,
14577
15167
  error: new Error(
14578
- `Invalid frontmatter in ${join96(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15168
+ `Invalid frontmatter in ${join97(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14579
15169
  )
14580
15170
  };
14581
15171
  }
@@ -14593,7 +15183,7 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
14593
15183
  global = false
14594
15184
  }) {
14595
15185
  const paths = this.getSettablePaths({ global });
14596
- const filePath = join96(baseDir, paths.relativeDirPath, relativeFilePath);
15186
+ const filePath = join97(baseDir, paths.relativeDirPath, relativeFilePath);
14597
15187
  const fileContent = await readFileContent(filePath);
14598
15188
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14599
15189
  const result = GeminiCliSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14629,11 +15219,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends ToolSubagent {
14629
15219
  };
14630
15220
 
14631
15221
  // src/features/subagents/roo-subagent.ts
14632
- import { join as join97 } from "path";
15222
+ import { join as join98 } from "path";
14633
15223
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
14634
15224
  static getSettablePaths() {
14635
15225
  return {
14636
- relativeDirPath: join97(".roo", "subagents")
15226
+ relativeDirPath: join98(".roo", "subagents")
14637
15227
  };
14638
15228
  }
14639
15229
  static async fromFile(params) {
@@ -14656,11 +15246,11 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
14656
15246
  };
14657
15247
 
14658
15248
  // src/features/subagents/rovodev-subagent.ts
14659
- import { join as join98 } from "path";
14660
- import { z as z55 } from "zod/mini";
14661
- var RovodevSubagentFrontmatterSchema = z55.looseObject({
14662
- name: z55.string(),
14663
- description: z55.optional(z55.string())
15249
+ import { join as join99 } from "path";
15250
+ import { z as z56 } from "zod/mini";
15251
+ var RovodevSubagentFrontmatterSchema = z56.looseObject({
15252
+ name: z56.string(),
15253
+ description: z56.optional(z56.string())
14664
15254
  });
14665
15255
  var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
14666
15256
  frontmatter;
@@ -14670,7 +15260,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
14670
15260
  const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
14671
15261
  if (!result.success) {
14672
15262
  throw new Error(
14673
- `Invalid frontmatter in ${join98(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15263
+ `Invalid frontmatter in ${join99(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14674
15264
  );
14675
15265
  }
14676
15266
  }
@@ -14682,7 +15272,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
14682
15272
  }
14683
15273
  static getSettablePaths(_options = {}) {
14684
15274
  return {
14685
- relativeDirPath: join98(".rovodev", "subagents")
15275
+ relativeDirPath: join99(".rovodev", "subagents")
14686
15276
  };
14687
15277
  }
14688
15278
  getFrontmatter() {
@@ -14745,7 +15335,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
14745
15335
  return {
14746
15336
  success: false,
14747
15337
  error: new Error(
14748
- `Invalid frontmatter in ${join98(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15338
+ `Invalid frontmatter in ${join99(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14749
15339
  )
14750
15340
  };
14751
15341
  }
@@ -14762,7 +15352,7 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
14762
15352
  global = false
14763
15353
  }) {
14764
15354
  const paths = this.getSettablePaths({ global });
14765
- const filePath = join98(baseDir, paths.relativeDirPath, relativeFilePath);
15355
+ const filePath = join99(baseDir, paths.relativeDirPath, relativeFilePath);
14766
15356
  const fileContent = await readFileContent(filePath);
14767
15357
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14768
15358
  const result = RovodevSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14801,19 +15391,19 @@ var RovodevSubagent = class _RovodevSubagent extends ToolSubagent {
14801
15391
  };
14802
15392
 
14803
15393
  // src/features/subagents/subagents-processor.ts
14804
- import { basename as basename9, join as join109 } from "path";
14805
- import { z as z64 } from "zod/mini";
15394
+ import { basename as basename9, join as join110 } from "path";
15395
+ import { z as z65 } from "zod/mini";
14806
15396
 
14807
15397
  // src/features/subagents/claudecode-subagent.ts
14808
- import { join as join99 } from "path";
14809
- import { z as z56 } from "zod/mini";
14810
- var ClaudecodeSubagentFrontmatterSchema = z56.looseObject({
14811
- name: z56.string(),
14812
- description: z56.optional(z56.string()),
14813
- model: z56.optional(z56.string()),
14814
- tools: z56.optional(z56.union([z56.string(), z56.array(z56.string())])),
14815
- permissionMode: z56.optional(z56.string()),
14816
- skills: z56.optional(z56.union([z56.string(), z56.array(z56.string())]))
15398
+ import { join as join100 } from "path";
15399
+ import { z as z57 } from "zod/mini";
15400
+ var ClaudecodeSubagentFrontmatterSchema = z57.looseObject({
15401
+ name: z57.string(),
15402
+ description: z57.optional(z57.string()),
15403
+ model: z57.optional(z57.string()),
15404
+ tools: z57.optional(z57.union([z57.string(), z57.array(z57.string())])),
15405
+ permissionMode: z57.optional(z57.string()),
15406
+ skills: z57.optional(z57.union([z57.string(), z57.array(z57.string())]))
14817
15407
  });
14818
15408
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
14819
15409
  frontmatter;
@@ -14823,7 +15413,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
14823
15413
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
14824
15414
  if (!result.success) {
14825
15415
  throw new Error(
14826
- `Invalid frontmatter in ${join99(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15416
+ `Invalid frontmatter in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
14827
15417
  );
14828
15418
  }
14829
15419
  }
@@ -14835,7 +15425,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
14835
15425
  }
14836
15426
  static getSettablePaths(_options = {}) {
14837
15427
  return {
14838
- relativeDirPath: join99(".claude", "agents")
15428
+ relativeDirPath: join100(".claude", "agents")
14839
15429
  };
14840
15430
  }
14841
15431
  getFrontmatter() {
@@ -14914,7 +15504,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
14914
15504
  return {
14915
15505
  success: false,
14916
15506
  error: new Error(
14917
- `Invalid frontmatter in ${join99(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15507
+ `Invalid frontmatter in ${join100(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
14918
15508
  )
14919
15509
  };
14920
15510
  }
@@ -14932,7 +15522,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
14932
15522
  global = false
14933
15523
  }) {
14934
15524
  const paths = this.getSettablePaths({ global });
14935
- const filePath = join99(baseDir, paths.relativeDirPath, relativeFilePath);
15525
+ const filePath = join100(baseDir, paths.relativeDirPath, relativeFilePath);
14936
15526
  const fileContent = await readFileContent(filePath);
14937
15527
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
14938
15528
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -14967,26 +15557,26 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
14967
15557
  };
14968
15558
 
14969
15559
  // src/features/subagents/codexcli-subagent.ts
14970
- import { join as join100 } from "path";
14971
- import * as smolToml5 from "smol-toml";
14972
- import { z as z57 } from "zod/mini";
14973
- var CodexCliSubagentTomlSchema = z57.looseObject({
14974
- name: z57.string(),
14975
- description: z57.optional(z57.string()),
14976
- developer_instructions: z57.optional(z57.string()),
14977
- model: z57.optional(z57.string()),
14978
- model_reasoning_effort: z57.optional(z57.string()),
14979
- sandbox_mode: z57.optional(z57.string())
15560
+ import { join as join101 } from "path";
15561
+ import * as smolToml6 from "smol-toml";
15562
+ import { z as z58 } from "zod/mini";
15563
+ var CodexCliSubagentTomlSchema = z58.looseObject({
15564
+ name: z58.string(),
15565
+ description: z58.optional(z58.string()),
15566
+ developer_instructions: z58.optional(z58.string()),
15567
+ model: z58.optional(z58.string()),
15568
+ model_reasoning_effort: z58.optional(z58.string()),
15569
+ sandbox_mode: z58.optional(z58.string())
14980
15570
  });
14981
15571
  function stringifyCodexCliSubagentToml(tomlObj) {
14982
15572
  const { developer_instructions, ...restFields } = tomlObj;
14983
- const restToml = smolToml5.stringify(restFields).trimEnd();
15573
+ const restToml = smolToml6.stringify(restFields).trimEnd();
14984
15574
  if (developer_instructions === void 0) {
14985
15575
  return restToml;
14986
15576
  }
14987
- const developerInstructionsToml = developer_instructions.includes("\n") ? developer_instructions.includes("'''") ? smolToml5.stringify({ developer_instructions }).trimEnd() : `developer_instructions = '''
15577
+ const developerInstructionsToml = developer_instructions.includes("\n") ? developer_instructions.includes("'''") ? smolToml6.stringify({ developer_instructions }).trimEnd() : `developer_instructions = '''
14988
15578
  ${developer_instructions}
14989
- '''` : smolToml5.stringify({ developer_instructions }).trimEnd();
15579
+ '''` : smolToml6.stringify({ developer_instructions }).trimEnd();
14990
15580
  return [restToml, developerInstructionsToml].filter((value) => value.length > 0).join("\n");
14991
15581
  }
14992
15582
  var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
@@ -14994,11 +15584,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
14994
15584
  constructor({ body, ...rest }) {
14995
15585
  if (rest.validate !== false) {
14996
15586
  try {
14997
- const parsed = smolToml5.parse(body);
15587
+ const parsed = smolToml6.parse(body);
14998
15588
  CodexCliSubagentTomlSchema.parse(parsed);
14999
15589
  } catch (error) {
15000
15590
  throw new Error(
15001
- `Invalid TOML in ${join100(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
15591
+ `Invalid TOML in ${join101(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
15002
15592
  { cause: error }
15003
15593
  );
15004
15594
  }
@@ -15010,7 +15600,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
15010
15600
  }
15011
15601
  static getSettablePaths(_options = {}) {
15012
15602
  return {
15013
- relativeDirPath: join100(".codex", "agents")
15603
+ relativeDirPath: join101(".codex", "agents")
15014
15604
  };
15015
15605
  }
15016
15606
  getBody() {
@@ -15019,10 +15609,10 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
15019
15609
  toRulesyncSubagent() {
15020
15610
  let parsed;
15021
15611
  try {
15022
- parsed = CodexCliSubagentTomlSchema.parse(smolToml5.parse(this.body));
15612
+ parsed = CodexCliSubagentTomlSchema.parse(smolToml6.parse(this.body));
15023
15613
  } catch (error) {
15024
15614
  throw new Error(
15025
- `Failed to parse TOML in ${join100(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
15615
+ `Failed to parse TOML in ${join101(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
15026
15616
  { cause: error }
15027
15617
  );
15028
15618
  }
@@ -15080,7 +15670,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
15080
15670
  }
15081
15671
  validate() {
15082
15672
  try {
15083
- const parsed = smolToml5.parse(this.body);
15673
+ const parsed = smolToml6.parse(this.body);
15084
15674
  CodexCliSubagentTomlSchema.parse(parsed);
15085
15675
  return { success: true, error: null };
15086
15676
  } catch (error) {
@@ -15103,7 +15693,7 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
15103
15693
  global = false
15104
15694
  }) {
15105
15695
  const paths = this.getSettablePaths({ global });
15106
- const filePath = join100(baseDir, paths.relativeDirPath, relativeFilePath);
15696
+ const filePath = join101(baseDir, paths.relativeDirPath, relativeFilePath);
15107
15697
  const fileContent = await readFileContent(filePath);
15108
15698
  const subagent = new _CodexCliSubagent({
15109
15699
  baseDir,
@@ -15141,13 +15731,13 @@ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
15141
15731
  };
15142
15732
 
15143
15733
  // src/features/subagents/copilot-subagent.ts
15144
- import { join as join101 } from "path";
15145
- import { z as z58 } from "zod/mini";
15734
+ import { join as join102 } from "path";
15735
+ import { z as z59 } from "zod/mini";
15146
15736
  var REQUIRED_TOOL = "agent/runSubagent";
15147
- var CopilotSubagentFrontmatterSchema = z58.looseObject({
15148
- name: z58.string(),
15149
- description: z58.optional(z58.string()),
15150
- tools: z58.optional(z58.union([z58.string(), z58.array(z58.string())]))
15737
+ var CopilotSubagentFrontmatterSchema = z59.looseObject({
15738
+ name: z59.string(),
15739
+ description: z59.optional(z59.string()),
15740
+ tools: z59.optional(z59.union([z59.string(), z59.array(z59.string())]))
15151
15741
  });
15152
15742
  var normalizeTools = (tools) => {
15153
15743
  if (!tools) {
@@ -15167,7 +15757,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
15167
15757
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
15168
15758
  if (!result.success) {
15169
15759
  throw new Error(
15170
- `Invalid frontmatter in ${join101(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15760
+ `Invalid frontmatter in ${join102(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15171
15761
  );
15172
15762
  }
15173
15763
  }
@@ -15179,7 +15769,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
15179
15769
  }
15180
15770
  static getSettablePaths(_options = {}) {
15181
15771
  return {
15182
- relativeDirPath: join101(".github", "agents")
15772
+ relativeDirPath: join102(".github", "agents")
15183
15773
  };
15184
15774
  }
15185
15775
  getFrontmatter() {
@@ -15257,7 +15847,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
15257
15847
  return {
15258
15848
  success: false,
15259
15849
  error: new Error(
15260
- `Invalid frontmatter in ${join101(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15850
+ `Invalid frontmatter in ${join102(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15261
15851
  )
15262
15852
  };
15263
15853
  }
@@ -15275,7 +15865,7 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
15275
15865
  global = false
15276
15866
  }) {
15277
15867
  const paths = this.getSettablePaths({ global });
15278
- const filePath = join101(baseDir, paths.relativeDirPath, relativeFilePath);
15868
+ const filePath = join102(baseDir, paths.relativeDirPath, relativeFilePath);
15279
15869
  const fileContent = await readFileContent(filePath);
15280
15870
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
15281
15871
  const result = CopilotSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -15311,11 +15901,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
15311
15901
  };
15312
15902
 
15313
15903
  // src/features/subagents/cursor-subagent.ts
15314
- import { join as join102 } from "path";
15315
- import { z as z59 } from "zod/mini";
15316
- var CursorSubagentFrontmatterSchema = z59.looseObject({
15317
- name: z59.string(),
15318
- description: z59.optional(z59.string())
15904
+ import { join as join103 } from "path";
15905
+ import { z as z60 } from "zod/mini";
15906
+ var CursorSubagentFrontmatterSchema = z60.looseObject({
15907
+ name: z60.string(),
15908
+ description: z60.optional(z60.string())
15319
15909
  });
15320
15910
  var CursorSubagent = class _CursorSubagent extends ToolSubagent {
15321
15911
  frontmatter;
@@ -15325,7 +15915,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
15325
15915
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
15326
15916
  if (!result.success) {
15327
15917
  throw new Error(
15328
- `Invalid frontmatter in ${join102(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15918
+ `Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15329
15919
  );
15330
15920
  }
15331
15921
  }
@@ -15337,7 +15927,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
15337
15927
  }
15338
15928
  static getSettablePaths(_options = {}) {
15339
15929
  return {
15340
- relativeDirPath: join102(".cursor", "agents")
15930
+ relativeDirPath: join103(".cursor", "agents")
15341
15931
  };
15342
15932
  }
15343
15933
  getFrontmatter() {
@@ -15404,7 +15994,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
15404
15994
  return {
15405
15995
  success: false,
15406
15996
  error: new Error(
15407
- `Invalid frontmatter in ${join102(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15997
+ `Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15408
15998
  )
15409
15999
  };
15410
16000
  }
@@ -15422,7 +16012,7 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
15422
16012
  global = false
15423
16013
  }) {
15424
16014
  const paths = this.getSettablePaths({ global });
15425
- const filePath = join102(baseDir, paths.relativeDirPath, relativeFilePath);
16015
+ const filePath = join103(baseDir, paths.relativeDirPath, relativeFilePath);
15426
16016
  const fileContent = await readFileContent(filePath);
15427
16017
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
15428
16018
  const result = CursorSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -15458,12 +16048,12 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
15458
16048
  };
15459
16049
 
15460
16050
  // src/features/subagents/deepagents-subagent.ts
15461
- import { join as join103 } from "path";
15462
- import { z as z60 } from "zod/mini";
15463
- var DeepagentsSubagentFrontmatterSchema = z60.looseObject({
15464
- name: z60.string(),
15465
- description: z60.optional(z60.string()),
15466
- model: z60.optional(z60.string())
16051
+ import { join as join104 } from "path";
16052
+ import { z as z61 } from "zod/mini";
16053
+ var DeepagentsSubagentFrontmatterSchema = z61.looseObject({
16054
+ name: z61.string(),
16055
+ description: z61.optional(z61.string()),
16056
+ model: z61.optional(z61.string())
15467
16057
  });
15468
16058
  var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
15469
16059
  frontmatter;
@@ -15473,7 +16063,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
15473
16063
  const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
15474
16064
  if (!result.success) {
15475
16065
  throw new Error(
15476
- `Invalid frontmatter in ${join103(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
16066
+ `Invalid frontmatter in ${join104(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15477
16067
  );
15478
16068
  }
15479
16069
  }
@@ -15483,7 +16073,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
15483
16073
  }
15484
16074
  static getSettablePaths(_options = {}) {
15485
16075
  return {
15486
- relativeDirPath: join103(".deepagents", "agents")
16076
+ relativeDirPath: join104(".deepagents", "agents")
15487
16077
  };
15488
16078
  }
15489
16079
  getFrontmatter() {
@@ -15558,7 +16148,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
15558
16148
  return {
15559
16149
  success: false,
15560
16150
  error: new Error(
15561
- `Invalid frontmatter in ${join103(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16151
+ `Invalid frontmatter in ${join104(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15562
16152
  )
15563
16153
  };
15564
16154
  }
@@ -15576,7 +16166,7 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
15576
16166
  global = false
15577
16167
  }) {
15578
16168
  const paths = this.getSettablePaths({ global });
15579
- const filePath = join103(baseDir, paths.relativeDirPath, relativeFilePath);
16169
+ const filePath = join104(baseDir, paths.relativeDirPath, relativeFilePath);
15580
16170
  const fileContent = await readFileContent(filePath);
15581
16171
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
15582
16172
  const result = DeepagentsSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -15611,11 +16201,11 @@ var DeepagentsSubagent = class _DeepagentsSubagent extends ToolSubagent {
15611
16201
  };
15612
16202
 
15613
16203
  // src/features/subagents/junie-subagent.ts
15614
- import { join as join104 } from "path";
15615
- import { z as z61 } from "zod/mini";
15616
- var JunieSubagentFrontmatterSchema = z61.looseObject({
15617
- name: z61.optional(z61.string()),
15618
- description: z61.string()
16204
+ import { join as join105 } from "path";
16205
+ import { z as z62 } from "zod/mini";
16206
+ var JunieSubagentFrontmatterSchema = z62.looseObject({
16207
+ name: z62.optional(z62.string()),
16208
+ description: z62.string()
15619
16209
  });
15620
16210
  var JunieSubagent = class _JunieSubagent extends ToolSubagent {
15621
16211
  frontmatter;
@@ -15625,7 +16215,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
15625
16215
  const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
15626
16216
  if (!result.success) {
15627
16217
  throw new Error(
15628
- `Invalid frontmatter in ${join104(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
16218
+ `Invalid frontmatter in ${join105(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15629
16219
  );
15630
16220
  }
15631
16221
  }
@@ -15640,7 +16230,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
15640
16230
  throw new Error("JunieSubagent does not support global mode.");
15641
16231
  }
15642
16232
  return {
15643
- relativeDirPath: join104(".junie", "agents")
16233
+ relativeDirPath: join105(".junie", "agents")
15644
16234
  };
15645
16235
  }
15646
16236
  getFrontmatter() {
@@ -15716,7 +16306,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
15716
16306
  return {
15717
16307
  success: false,
15718
16308
  error: new Error(
15719
- `Invalid frontmatter in ${join104(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16309
+ `Invalid frontmatter in ${join105(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15720
16310
  )
15721
16311
  };
15722
16312
  }
@@ -15734,7 +16324,7 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
15734
16324
  global = false
15735
16325
  }) {
15736
16326
  const paths = this.getSettablePaths({ global });
15737
- const filePath = join104(baseDir, paths.relativeDirPath, relativeFilePath);
16327
+ const filePath = join105(baseDir, paths.relativeDirPath, relativeFilePath);
15738
16328
  const fileContent = await readFileContent(filePath);
15739
16329
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
15740
16330
  const result = JunieSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -15769,15 +16359,15 @@ var JunieSubagent = class _JunieSubagent extends ToolSubagent {
15769
16359
  };
15770
16360
 
15771
16361
  // src/features/subagents/kilo-subagent.ts
15772
- import { join as join106 } from "path";
16362
+ import { join as join107 } from "path";
15773
16363
 
15774
16364
  // src/features/subagents/opencode-style-subagent.ts
15775
- import { basename as basename8, join as join105 } from "path";
15776
- import { z as z62 } from "zod/mini";
15777
- var OpenCodeStyleSubagentFrontmatterSchema = z62.looseObject({
15778
- description: z62.optional(z62.string()),
15779
- mode: z62._default(z62.string(), "subagent"),
15780
- name: z62.optional(z62.string())
16365
+ import { basename as basename8, join as join106 } from "path";
16366
+ import { z as z63 } from "zod/mini";
16367
+ var OpenCodeStyleSubagentFrontmatterSchema = z63.looseObject({
16368
+ description: z63.optional(z63.string()),
16369
+ mode: z63._default(z63.string(), "subagent"),
16370
+ name: z63.optional(z63.string())
15781
16371
  });
15782
16372
  var OpenCodeStyleSubagent = class extends ToolSubagent {
15783
16373
  frontmatter;
@@ -15787,7 +16377,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
15787
16377
  const result = OpenCodeStyleSubagentFrontmatterSchema.safeParse(frontmatter);
15788
16378
  if (!result.success) {
15789
16379
  throw new Error(
15790
- `Invalid frontmatter in ${join105(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
16380
+ `Invalid frontmatter in ${join106(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
15791
16381
  );
15792
16382
  }
15793
16383
  }
@@ -15829,7 +16419,7 @@ var OpenCodeStyleSubagent = class extends ToolSubagent {
15829
16419
  return {
15830
16420
  success: false,
15831
16421
  error: new Error(
15832
- `Invalid frontmatter in ${join105(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16422
+ `Invalid frontmatter in ${join106(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
15833
16423
  )
15834
16424
  };
15835
16425
  }
@@ -15845,7 +16435,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
15845
16435
  global = false
15846
16436
  } = {}) {
15847
16437
  return {
15848
- relativeDirPath: global ? join106(".config", "kilo", "agent") : join106(".kilo", "agent")
16438
+ relativeDirPath: global ? join107(".config", "kilo", "agent") : join107(".kilo", "agent")
15849
16439
  };
15850
16440
  }
15851
16441
  static fromRulesyncSubagent({
@@ -15889,7 +16479,7 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
15889
16479
  global = false
15890
16480
  }) {
15891
16481
  const paths = this.getSettablePaths({ global });
15892
- const filePath = join106(baseDir, paths.relativeDirPath, relativeFilePath);
16482
+ const filePath = join107(baseDir, paths.relativeDirPath, relativeFilePath);
15893
16483
  const fileContent = await readFileContent(filePath);
15894
16484
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
15895
16485
  const result = KiloSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -15925,23 +16515,23 @@ var KiloSubagent = class _KiloSubagent extends OpenCodeStyleSubagent {
15925
16515
  };
15926
16516
 
15927
16517
  // src/features/subagents/kiro-subagent.ts
15928
- import { join as join107 } from "path";
15929
- import { z as z63 } from "zod/mini";
15930
- var KiroCliSubagentJsonSchema = z63.looseObject({
15931
- name: z63.string(),
15932
- description: z63.optional(z63.nullable(z63.string())),
15933
- prompt: z63.optional(z63.nullable(z63.string())),
15934
- tools: z63.optional(z63.nullable(z63.array(z63.string()))),
15935
- toolAliases: z63.optional(z63.nullable(z63.record(z63.string(), z63.string()))),
15936
- toolSettings: z63.optional(z63.nullable(z63.unknown())),
15937
- toolSchema: z63.optional(z63.nullable(z63.unknown())),
15938
- hooks: z63.optional(z63.nullable(z63.record(z63.string(), z63.array(z63.unknown())))),
15939
- model: z63.optional(z63.nullable(z63.string())),
15940
- mcpServers: z63.optional(z63.nullable(z63.record(z63.string(), z63.unknown()))),
15941
- useLegacyMcpJson: z63.optional(z63.nullable(z63.boolean())),
15942
- resources: z63.optional(z63.nullable(z63.array(z63.string()))),
15943
- allowedTools: z63.optional(z63.nullable(z63.array(z63.string()))),
15944
- includeMcpJson: z63.optional(z63.nullable(z63.boolean()))
16518
+ import { join as join108 } from "path";
16519
+ import { z as z64 } from "zod/mini";
16520
+ var KiroCliSubagentJsonSchema = z64.looseObject({
16521
+ name: z64.string(),
16522
+ description: z64.optional(z64.nullable(z64.string())),
16523
+ prompt: z64.optional(z64.nullable(z64.string())),
16524
+ tools: z64.optional(z64.nullable(z64.array(z64.string()))),
16525
+ toolAliases: z64.optional(z64.nullable(z64.record(z64.string(), z64.string()))),
16526
+ toolSettings: z64.optional(z64.nullable(z64.unknown())),
16527
+ toolSchema: z64.optional(z64.nullable(z64.unknown())),
16528
+ hooks: z64.optional(z64.nullable(z64.record(z64.string(), z64.array(z64.unknown())))),
16529
+ model: z64.optional(z64.nullable(z64.string())),
16530
+ mcpServers: z64.optional(z64.nullable(z64.record(z64.string(), z64.unknown()))),
16531
+ useLegacyMcpJson: z64.optional(z64.nullable(z64.boolean())),
16532
+ resources: z64.optional(z64.nullable(z64.array(z64.string()))),
16533
+ allowedTools: z64.optional(z64.nullable(z64.array(z64.string()))),
16534
+ includeMcpJson: z64.optional(z64.nullable(z64.boolean()))
15945
16535
  });
15946
16536
  var KiroSubagent = class _KiroSubagent extends ToolSubagent {
15947
16537
  body;
@@ -15952,7 +16542,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
15952
16542
  KiroCliSubagentJsonSchema.parse(parsed);
15953
16543
  } catch (error) {
15954
16544
  throw new Error(
15955
- `Invalid JSON in ${join107(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
16545
+ `Invalid JSON in ${join108(rest.relativeDirPath, rest.relativeFilePath)}: ${error instanceof Error ? error.message : String(error)}`,
15956
16546
  { cause: error }
15957
16547
  );
15958
16548
  }
@@ -15964,7 +16554,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
15964
16554
  }
15965
16555
  static getSettablePaths(_options = {}) {
15966
16556
  return {
15967
- relativeDirPath: join107(".kiro", "agents")
16557
+ relativeDirPath: join108(".kiro", "agents")
15968
16558
  };
15969
16559
  }
15970
16560
  getBody() {
@@ -15976,7 +16566,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
15976
16566
  parsed = JSON.parse(this.body);
15977
16567
  } catch (error) {
15978
16568
  throw new Error(
15979
- `Failed to parse JSON in ${join107(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
16569
+ `Failed to parse JSON in ${join108(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
15980
16570
  { cause: error }
15981
16571
  );
15982
16572
  }
@@ -16057,7 +16647,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
16057
16647
  global = false
16058
16648
  }) {
16059
16649
  const paths = this.getSettablePaths({ global });
16060
- const filePath = join107(baseDir, paths.relativeDirPath, relativeFilePath);
16650
+ const filePath = join108(baseDir, paths.relativeDirPath, relativeFilePath);
16061
16651
  const fileContent = await readFileContent(filePath);
16062
16652
  const subagent = new _KiroSubagent({
16063
16653
  baseDir,
@@ -16095,7 +16685,7 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
16095
16685
  };
16096
16686
 
16097
16687
  // src/features/subagents/opencode-subagent.ts
16098
- import { join as join108 } from "path";
16688
+ import { join as join109 } from "path";
16099
16689
  var OpenCodeSubagentFrontmatterSchema = OpenCodeStyleSubagentFrontmatterSchema;
16100
16690
  var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
16101
16691
  getToolTarget() {
@@ -16105,7 +16695,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
16105
16695
  global = false
16106
16696
  } = {}) {
16107
16697
  return {
16108
- relativeDirPath: global ? join108(".config", "opencode", "agent") : join108(".opencode", "agent")
16698
+ relativeDirPath: global ? join109(".config", "opencode", "agent") : join109(".opencode", "agent")
16109
16699
  };
16110
16700
  }
16111
16701
  static fromRulesyncSubagent({
@@ -16149,7 +16739,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends OpenCodeStyleSubagent {
16149
16739
  global = false
16150
16740
  }) {
16151
16741
  const paths = this.getSettablePaths({ global });
16152
- const filePath = join108(baseDir, paths.relativeDirPath, relativeFilePath);
16742
+ const filePath = join109(baseDir, paths.relativeDirPath, relativeFilePath);
16153
16743
  const fileContent = await readFileContent(filePath);
16154
16744
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
16155
16745
  const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -16202,7 +16792,7 @@ var subagentsProcessorToolTargetTuple = [
16202
16792
  "roo",
16203
16793
  "rovodev"
16204
16794
  ];
16205
- var SubagentsProcessorToolTargetSchema = z64.enum(subagentsProcessorToolTargetTuple);
16795
+ var SubagentsProcessorToolTargetSchema = z65.enum(subagentsProcessorToolTargetTuple);
16206
16796
  var toolSubagentFactories = /* @__PURE__ */ new Map([
16207
16797
  [
16208
16798
  "agentsmd",
@@ -16393,7 +16983,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
16393
16983
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
16394
16984
  */
16395
16985
  async loadRulesyncFiles() {
16396
- const subagentsDir = join109(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
16986
+ const subagentsDir = join110(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
16397
16987
  const dirExists = await directoryExists(subagentsDir);
16398
16988
  if (!dirExists) {
16399
16989
  this.logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -16408,7 +16998,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
16408
16998
  this.logger.debug(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
16409
16999
  const rulesyncSubagents = [];
16410
17000
  for (const mdFile of mdFiles) {
16411
- const filepath = join109(subagentsDir, mdFile);
17001
+ const filepath = join110(subagentsDir, mdFile);
16412
17002
  try {
16413
17003
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
16414
17004
  relativeFilePath: mdFile,
@@ -16438,7 +17028,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
16438
17028
  const factory = this.getFactory(this.toolTarget);
16439
17029
  const paths = factory.class.getSettablePaths({ global: this.global });
16440
17030
  const subagentFilePaths = await findFilesByGlobs(
16441
- join109(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
17031
+ join110(this.baseDir, paths.relativeDirPath, factory.meta.filePattern)
16442
17032
  );
16443
17033
  if (forDeletion) {
16444
17034
  const toolSubagents2 = subagentFilePaths.map(
@@ -16505,49 +17095,49 @@ var SubagentsProcessor = class extends FeatureProcessor {
16505
17095
  };
16506
17096
 
16507
17097
  // src/features/rules/agentsmd-rule.ts
16508
- import { join as join112 } from "path";
17098
+ import { join as join113 } from "path";
16509
17099
 
16510
17100
  // src/features/rules/tool-rule.ts
16511
- import { join as join111 } from "path";
17101
+ import { join as join112 } from "path";
16512
17102
 
16513
17103
  // src/features/rules/rulesync-rule.ts
16514
- import { join as join110 } from "path";
16515
- import { z as z65 } from "zod/mini";
16516
- var RulesyncRuleFrontmatterSchema = z65.object({
16517
- root: z65.optional(z65.boolean()),
16518
- localRoot: z65.optional(z65.boolean()),
16519
- targets: z65._default(RulesyncTargetsSchema, ["*"]),
16520
- description: z65.optional(z65.string()),
16521
- globs: z65.optional(z65.array(z65.string())),
16522
- agentsmd: z65.optional(
16523
- z65.looseObject({
17104
+ import { join as join111 } from "path";
17105
+ import { z as z66 } from "zod/mini";
17106
+ var RulesyncRuleFrontmatterSchema = z66.object({
17107
+ root: z66.optional(z66.boolean()),
17108
+ localRoot: z66.optional(z66.boolean()),
17109
+ targets: z66._default(RulesyncTargetsSchema, ["*"]),
17110
+ description: z66.optional(z66.string()),
17111
+ globs: z66.optional(z66.array(z66.string())),
17112
+ agentsmd: z66.optional(
17113
+ z66.looseObject({
16524
17114
  // @example "path/to/subproject"
16525
- subprojectPath: z65.optional(z65.string())
17115
+ subprojectPath: z66.optional(z66.string())
16526
17116
  })
16527
17117
  ),
16528
- claudecode: z65.optional(
16529
- z65.looseObject({
17118
+ claudecode: z66.optional(
17119
+ z66.looseObject({
16530
17120
  // Glob patterns for conditional rules (takes precedence over globs)
16531
17121
  // @example ["src/**/*.ts", "tests/**/*.test.ts"]
16532
- paths: z65.optional(z65.array(z65.string()))
17122
+ paths: z66.optional(z66.array(z66.string()))
16533
17123
  })
16534
17124
  ),
16535
- cursor: z65.optional(
16536
- z65.looseObject({
16537
- alwaysApply: z65.optional(z65.boolean()),
16538
- description: z65.optional(z65.string()),
16539
- globs: z65.optional(z65.array(z65.string()))
17125
+ cursor: z66.optional(
17126
+ z66.looseObject({
17127
+ alwaysApply: z66.optional(z66.boolean()),
17128
+ description: z66.optional(z66.string()),
17129
+ globs: z66.optional(z66.array(z66.string()))
16540
17130
  })
16541
17131
  ),
16542
- copilot: z65.optional(
16543
- z65.looseObject({
16544
- excludeAgent: z65.optional(z65.union([z65.literal("code-review"), z65.literal("coding-agent")]))
17132
+ copilot: z66.optional(
17133
+ z66.looseObject({
17134
+ excludeAgent: z66.optional(z66.union([z66.literal("code-review"), z66.literal("coding-agent")]))
16545
17135
  })
16546
17136
  ),
16547
- antigravity: z65.optional(
16548
- z65.looseObject({
16549
- trigger: z65.optional(z65.string()),
16550
- globs: z65.optional(z65.array(z65.string()))
17137
+ antigravity: z66.optional(
17138
+ z66.looseObject({
17139
+ trigger: z66.optional(z66.string()),
17140
+ globs: z66.optional(z66.array(z66.string()))
16551
17141
  })
16552
17142
  )
16553
17143
  });
@@ -16558,7 +17148,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
16558
17148
  const parseResult = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
16559
17149
  if (!parseResult.success && rest.validate !== false) {
16560
17150
  throw new Error(
16561
- `Invalid frontmatter in ${join110(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
17151
+ `Invalid frontmatter in ${join111(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
16562
17152
  );
16563
17153
  }
16564
17154
  const parsedFrontmatter = parseResult.success ? parseResult.data : { ...frontmatter, targets: frontmatter.targets ?? ["*"] };
@@ -16593,7 +17183,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
16593
17183
  return {
16594
17184
  success: false,
16595
17185
  error: new Error(
16596
- `Invalid frontmatter in ${join110(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
17186
+ `Invalid frontmatter in ${join111(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
16597
17187
  )
16598
17188
  };
16599
17189
  }
@@ -16602,7 +17192,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
16602
17192
  relativeFilePath,
16603
17193
  validate = true
16604
17194
  }) {
16605
- const filePath = join110(
17195
+ const filePath = join111(
16606
17196
  process.cwd(),
16607
17197
  this.getSettablePaths().recommended.relativeDirPath,
16608
17198
  relativeFilePath
@@ -16701,7 +17291,7 @@ var ToolRule = class extends ToolFile {
16701
17291
  rulesyncRule,
16702
17292
  validate = true,
16703
17293
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
16704
- nonRootPath = { relativeDirPath: join111(".agents", "memories") }
17294
+ nonRootPath = { relativeDirPath: join112(".agents", "memories") }
16705
17295
  }) {
16706
17296
  const params = this.buildToolRuleParamsDefault({
16707
17297
  baseDir,
@@ -16712,7 +17302,7 @@ var ToolRule = class extends ToolFile {
16712
17302
  });
16713
17303
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
16714
17304
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
16715
- params.relativeDirPath = join111(rulesyncFrontmatter.agentsmd.subprojectPath);
17305
+ params.relativeDirPath = join112(rulesyncFrontmatter.agentsmd.subprojectPath);
16716
17306
  params.relativeFilePath = "AGENTS.md";
16717
17307
  }
16718
17308
  return params;
@@ -16761,7 +17351,7 @@ var ToolRule = class extends ToolFile {
16761
17351
  }
16762
17352
  };
16763
17353
  function buildToolPath(toolDir, subDir, excludeToolDir) {
16764
- return excludeToolDir ? subDir : join111(toolDir, subDir);
17354
+ return excludeToolDir ? subDir : join112(toolDir, subDir);
16765
17355
  }
16766
17356
 
16767
17357
  // src/features/rules/agentsmd-rule.ts
@@ -16790,8 +17380,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
16790
17380
  validate = true
16791
17381
  }) {
16792
17382
  const isRoot = relativeFilePath === "AGENTS.md";
16793
- const relativePath = isRoot ? "AGENTS.md" : join112(".agents", "memories", relativeFilePath);
16794
- const fileContent = await readFileContent(join112(baseDir, relativePath));
17383
+ const relativePath = isRoot ? "AGENTS.md" : join113(".agents", "memories", relativeFilePath);
17384
+ const fileContent = await readFileContent(join113(baseDir, relativePath));
16795
17385
  return new _AgentsMdRule({
16796
17386
  baseDir,
16797
17387
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -16846,21 +17436,21 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
16846
17436
  };
16847
17437
 
16848
17438
  // src/features/rules/antigravity-rule.ts
16849
- import { join as join113 } from "path";
16850
- import { z as z66 } from "zod/mini";
16851
- var AntigravityRuleFrontmatterSchema = z66.looseObject({
16852
- trigger: z66.optional(
16853
- z66.union([
16854
- z66.literal("always_on"),
16855
- z66.literal("glob"),
16856
- z66.literal("manual"),
16857
- z66.literal("model_decision"),
16858
- z66.string()
17439
+ import { join as join114 } from "path";
17440
+ import { z as z67 } from "zod/mini";
17441
+ var AntigravityRuleFrontmatterSchema = z67.looseObject({
17442
+ trigger: z67.optional(
17443
+ z67.union([
17444
+ z67.literal("always_on"),
17445
+ z67.literal("glob"),
17446
+ z67.literal("manual"),
17447
+ z67.literal("model_decision"),
17448
+ z67.string()
16859
17449
  // accepts any string for forward compatibility
16860
17450
  ])
16861
17451
  ),
16862
- globs: z66.optional(z66.string()),
16863
- description: z66.optional(z66.string())
17452
+ globs: z67.optional(z67.string()),
17453
+ description: z67.optional(z67.string())
16864
17454
  });
16865
17455
  function parseGlobsString(globs) {
16866
17456
  if (!globs) {
@@ -17005,7 +17595,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
17005
17595
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
17006
17596
  if (!result.success) {
17007
17597
  throw new Error(
17008
- `Invalid frontmatter in ${join113(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
17598
+ `Invalid frontmatter in ${join114(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
17009
17599
  );
17010
17600
  }
17011
17601
  }
@@ -17029,7 +17619,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
17029
17619
  relativeFilePath,
17030
17620
  validate = true
17031
17621
  }) {
17032
- const filePath = join113(
17622
+ const filePath = join114(
17033
17623
  baseDir,
17034
17624
  this.getSettablePaths().nonRoot.relativeDirPath,
17035
17625
  relativeFilePath
@@ -17169,7 +17759,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
17169
17759
  };
17170
17760
 
17171
17761
  // src/features/rules/augmentcode-legacy-rule.ts
17172
- import { join as join114 } from "path";
17762
+ import { join as join115 } from "path";
17173
17763
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
17174
17764
  toRulesyncRule() {
17175
17765
  const rulesyncFrontmatter = {
@@ -17229,8 +17819,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
17229
17819
  }) {
17230
17820
  const settablePaths = this.getSettablePaths();
17231
17821
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
17232
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : join114(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
17233
- const fileContent = await readFileContent(join114(baseDir, relativePath));
17822
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : join115(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
17823
+ const fileContent = await readFileContent(join115(baseDir, relativePath));
17234
17824
  return new _AugmentcodeLegacyRule({
17235
17825
  baseDir,
17236
17826
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -17259,7 +17849,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
17259
17849
  };
17260
17850
 
17261
17851
  // src/features/rules/augmentcode-rule.ts
17262
- import { join as join115 } from "path";
17852
+ import { join as join116 } from "path";
17263
17853
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
17264
17854
  toRulesyncRule() {
17265
17855
  return this.toRulesyncRuleDefault();
@@ -17290,7 +17880,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
17290
17880
  relativeFilePath,
17291
17881
  validate = true
17292
17882
  }) {
17293
- const filePath = join115(
17883
+ const filePath = join116(
17294
17884
  baseDir,
17295
17885
  this.getSettablePaths().nonRoot.relativeDirPath,
17296
17886
  relativeFilePath
@@ -17330,7 +17920,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
17330
17920
  };
17331
17921
 
17332
17922
  // src/features/rules/claudecode-legacy-rule.ts
17333
- import { join as join116 } from "path";
17923
+ import { join as join117 } from "path";
17334
17924
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
17335
17925
  static getSettablePaths({
17336
17926
  global,
@@ -17372,7 +17962,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
17372
17962
  if (isRoot) {
17373
17963
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
17374
17964
  const fileContent2 = await readFileContent(
17375
- join116(baseDir, rootDirPath, paths.root.relativeFilePath)
17965
+ join117(baseDir, rootDirPath, paths.root.relativeFilePath)
17376
17966
  );
17377
17967
  return new _ClaudecodeLegacyRule({
17378
17968
  baseDir,
@@ -17386,8 +17976,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
17386
17976
  if (!paths.nonRoot) {
17387
17977
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17388
17978
  }
17389
- const relativePath = join116(paths.nonRoot.relativeDirPath, relativeFilePath);
17390
- const fileContent = await readFileContent(join116(baseDir, relativePath));
17979
+ const relativePath = join117(paths.nonRoot.relativeDirPath, relativeFilePath);
17980
+ const fileContent = await readFileContent(join117(baseDir, relativePath));
17391
17981
  return new _ClaudecodeLegacyRule({
17392
17982
  baseDir,
17393
17983
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -17446,10 +18036,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
17446
18036
  };
17447
18037
 
17448
18038
  // src/features/rules/claudecode-rule.ts
17449
- import { join as join117 } from "path";
17450
- import { z as z67 } from "zod/mini";
17451
- var ClaudecodeRuleFrontmatterSchema = z67.object({
17452
- paths: z67.optional(z67.array(z67.string()))
18039
+ import { join as join118 } from "path";
18040
+ import { z as z68 } from "zod/mini";
18041
+ var ClaudecodeRuleFrontmatterSchema = z68.object({
18042
+ paths: z68.optional(z68.array(z68.string()))
17453
18043
  });
17454
18044
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
17455
18045
  frontmatter;
@@ -17487,7 +18077,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
17487
18077
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
17488
18078
  if (!result.success) {
17489
18079
  throw new Error(
17490
- `Invalid frontmatter in ${join117(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
18080
+ `Invalid frontmatter in ${join118(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
17491
18081
  );
17492
18082
  }
17493
18083
  }
@@ -17517,7 +18107,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
17517
18107
  if (isRoot) {
17518
18108
  const rootDirPath = overrideDirPath ?? paths.root.relativeDirPath;
17519
18109
  const fileContent2 = await readFileContent(
17520
- join117(baseDir, rootDirPath, paths.root.relativeFilePath)
18110
+ join118(baseDir, rootDirPath, paths.root.relativeFilePath)
17521
18111
  );
17522
18112
  return new _ClaudecodeRule({
17523
18113
  baseDir,
@@ -17532,8 +18122,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
17532
18122
  if (!paths.nonRoot) {
17533
18123
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17534
18124
  }
17535
- const relativePath = join117(paths.nonRoot.relativeDirPath, relativeFilePath);
17536
- const filePath = join117(baseDir, relativePath);
18125
+ const relativePath = join118(paths.nonRoot.relativeDirPath, relativeFilePath);
18126
+ const filePath = join118(baseDir, relativePath);
17537
18127
  const fileContent = await readFileContent(filePath);
17538
18128
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
17539
18129
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
@@ -17644,7 +18234,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
17644
18234
  return {
17645
18235
  success: false,
17646
18236
  error: new Error(
17647
- `Invalid frontmatter in ${join117(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
18237
+ `Invalid frontmatter in ${join118(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
17648
18238
  )
17649
18239
  };
17650
18240
  }
@@ -17664,10 +18254,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
17664
18254
  };
17665
18255
 
17666
18256
  // src/features/rules/cline-rule.ts
17667
- import { join as join118 } from "path";
17668
- import { z as z68 } from "zod/mini";
17669
- var ClineRuleFrontmatterSchema = z68.object({
17670
- description: z68.string()
18257
+ import { join as join119 } from "path";
18258
+ import { z as z69 } from "zod/mini";
18259
+ var ClineRuleFrontmatterSchema = z69.object({
18260
+ description: z69.string()
17671
18261
  });
17672
18262
  var ClineRule = class _ClineRule extends ToolRule {
17673
18263
  static getSettablePaths(_options = {}) {
@@ -17710,7 +18300,7 @@ var ClineRule = class _ClineRule extends ToolRule {
17710
18300
  validate = true
17711
18301
  }) {
17712
18302
  const fileContent = await readFileContent(
17713
- join118(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
18303
+ join119(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
17714
18304
  );
17715
18305
  return new _ClineRule({
17716
18306
  baseDir,
@@ -17736,7 +18326,7 @@ var ClineRule = class _ClineRule extends ToolRule {
17736
18326
  };
17737
18327
 
17738
18328
  // src/features/rules/codexcli-rule.ts
17739
- import { join as join119 } from "path";
18329
+ import { join as join120 } from "path";
17740
18330
  var CodexcliRule = class _CodexcliRule extends ToolRule {
17741
18331
  static getSettablePaths({
17742
18332
  global,
@@ -17771,7 +18361,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
17771
18361
  if (isRoot) {
17772
18362
  const relativePath2 = paths.root.relativeFilePath;
17773
18363
  const fileContent2 = await readFileContent(
17774
- join119(baseDir, paths.root.relativeDirPath, relativePath2)
18364
+ join120(baseDir, paths.root.relativeDirPath, relativePath2)
17775
18365
  );
17776
18366
  return new _CodexcliRule({
17777
18367
  baseDir,
@@ -17785,8 +18375,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
17785
18375
  if (!paths.nonRoot) {
17786
18376
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17787
18377
  }
17788
- const relativePath = join119(paths.nonRoot.relativeDirPath, relativeFilePath);
17789
- const fileContent = await readFileContent(join119(baseDir, relativePath));
18378
+ const relativePath = join120(paths.nonRoot.relativeDirPath, relativeFilePath);
18379
+ const fileContent = await readFileContent(join120(baseDir, relativePath));
17790
18380
  return new _CodexcliRule({
17791
18381
  baseDir,
17792
18382
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -17845,12 +18435,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
17845
18435
  };
17846
18436
 
17847
18437
  // src/features/rules/copilot-rule.ts
17848
- import { join as join120 } from "path";
17849
- import { z as z69 } from "zod/mini";
17850
- var CopilotRuleFrontmatterSchema = z69.object({
17851
- description: z69.optional(z69.string()),
17852
- applyTo: z69.optional(z69.string()),
17853
- excludeAgent: z69.optional(z69.union([z69.literal("code-review"), z69.literal("coding-agent")]))
18438
+ import { join as join121 } from "path";
18439
+ import { z as z70 } from "zod/mini";
18440
+ var CopilotRuleFrontmatterSchema = z70.object({
18441
+ description: z70.optional(z70.string()),
18442
+ applyTo: z70.optional(z70.string()),
18443
+ excludeAgent: z70.optional(z70.union([z70.literal("code-review"), z70.literal("coding-agent")]))
17854
18444
  });
17855
18445
  var CopilotRule = class _CopilotRule extends ToolRule {
17856
18446
  frontmatter;
@@ -17882,7 +18472,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
17882
18472
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
17883
18473
  if (!result.success) {
17884
18474
  throw new Error(
17885
- `Invalid frontmatter in ${join120(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
18475
+ `Invalid frontmatter in ${join121(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
17886
18476
  );
17887
18477
  }
17888
18478
  }
@@ -17972,8 +18562,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
17972
18562
  const paths = this.getSettablePaths({ global });
17973
18563
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
17974
18564
  if (isRoot) {
17975
- const relativePath2 = join120(paths.root.relativeDirPath, paths.root.relativeFilePath);
17976
- const filePath2 = join120(baseDir, relativePath2);
18565
+ const relativePath2 = join121(paths.root.relativeDirPath, paths.root.relativeFilePath);
18566
+ const filePath2 = join121(baseDir, relativePath2);
17977
18567
  const fileContent2 = await readFileContent(filePath2);
17978
18568
  return new _CopilotRule({
17979
18569
  baseDir,
@@ -17988,8 +18578,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
17988
18578
  if (!paths.nonRoot) {
17989
18579
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
17990
18580
  }
17991
- const relativePath = join120(paths.nonRoot.relativeDirPath, relativeFilePath);
17992
- const filePath = join120(baseDir, relativePath);
18581
+ const relativePath = join121(paths.nonRoot.relativeDirPath, relativeFilePath);
18582
+ const filePath = join121(baseDir, relativePath);
17993
18583
  const fileContent = await readFileContent(filePath);
17994
18584
  const { frontmatter, body: content } = parseFrontmatter(fileContent, filePath);
17995
18585
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
@@ -18035,7 +18625,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
18035
18625
  return {
18036
18626
  success: false,
18037
18627
  error: new Error(
18038
- `Invalid frontmatter in ${join120(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
18628
+ `Invalid frontmatter in ${join121(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
18039
18629
  )
18040
18630
  };
18041
18631
  }
@@ -18091,12 +18681,12 @@ var CopilotcliRule = class _CopilotcliRule extends CopilotRule {
18091
18681
  };
18092
18682
 
18093
18683
  // src/features/rules/cursor-rule.ts
18094
- import { join as join121 } from "path";
18095
- import { z as z70 } from "zod/mini";
18096
- var CursorRuleFrontmatterSchema = z70.object({
18097
- description: z70.optional(z70.string()),
18098
- globs: z70.optional(z70.string()),
18099
- alwaysApply: z70.optional(z70.boolean())
18684
+ import { join as join122 } from "path";
18685
+ import { z as z71 } from "zod/mini";
18686
+ var CursorRuleFrontmatterSchema = z71.object({
18687
+ description: z71.optional(z71.string()),
18688
+ globs: z71.optional(z71.string()),
18689
+ alwaysApply: z71.optional(z71.boolean())
18100
18690
  });
18101
18691
  var CursorRule = class _CursorRule extends ToolRule {
18102
18692
  frontmatter;
@@ -18113,7 +18703,7 @@ var CursorRule = class _CursorRule extends ToolRule {
18113
18703
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
18114
18704
  if (!result.success) {
18115
18705
  throw new Error(
18116
- `Invalid frontmatter in ${join121(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
18706
+ `Invalid frontmatter in ${join122(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
18117
18707
  );
18118
18708
  }
18119
18709
  }
@@ -18229,7 +18819,7 @@ var CursorRule = class _CursorRule extends ToolRule {
18229
18819
  relativeFilePath,
18230
18820
  validate = true
18231
18821
  }) {
18232
- const filePath = join121(
18822
+ const filePath = join122(
18233
18823
  baseDir,
18234
18824
  this.getSettablePaths().nonRoot.relativeDirPath,
18235
18825
  relativeFilePath
@@ -18239,7 +18829,7 @@ var CursorRule = class _CursorRule extends ToolRule {
18239
18829
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
18240
18830
  if (!result.success) {
18241
18831
  throw new Error(
18242
- `Invalid frontmatter in ${join121(baseDir, relativeFilePath)}: ${formatError(result.error)}`
18832
+ `Invalid frontmatter in ${join122(baseDir, relativeFilePath)}: ${formatError(result.error)}`
18243
18833
  );
18244
18834
  }
18245
18835
  return new _CursorRule({
@@ -18276,7 +18866,7 @@ var CursorRule = class _CursorRule extends ToolRule {
18276
18866
  return {
18277
18867
  success: false,
18278
18868
  error: new Error(
18279
- `Invalid frontmatter in ${join121(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
18869
+ `Invalid frontmatter in ${join122(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
18280
18870
  )
18281
18871
  };
18282
18872
  }
@@ -18296,7 +18886,7 @@ var CursorRule = class _CursorRule extends ToolRule {
18296
18886
  };
18297
18887
 
18298
18888
  // src/features/rules/deepagents-rule.ts
18299
- import { join as join122 } from "path";
18889
+ import { join as join123 } from "path";
18300
18890
  var DeepagentsRule = class _DeepagentsRule extends ToolRule {
18301
18891
  constructor({ fileContent, root, ...rest }) {
18302
18892
  super({
@@ -18323,8 +18913,8 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
18323
18913
  }) {
18324
18914
  const settablePaths = this.getSettablePaths();
18325
18915
  const isRoot = relativeFilePath === "AGENTS.md";
18326
- const relativePath = isRoot ? join122(".deepagents", "AGENTS.md") : join122(".deepagents", "memories", relativeFilePath);
18327
- const fileContent = await readFileContent(join122(baseDir, relativePath));
18916
+ const relativePath = isRoot ? join123(".deepagents", "AGENTS.md") : join123(".deepagents", "memories", relativeFilePath);
18917
+ const fileContent = await readFileContent(join123(baseDir, relativePath));
18328
18918
  return new _DeepagentsRule({
18329
18919
  baseDir,
18330
18920
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -18379,7 +18969,7 @@ var DeepagentsRule = class _DeepagentsRule extends ToolRule {
18379
18969
  };
18380
18970
 
18381
18971
  // src/features/rules/factorydroid-rule.ts
18382
- import { join as join123 } from "path";
18972
+ import { join as join124 } from "path";
18383
18973
  var FactorydroidRule = class _FactorydroidRule extends ToolRule {
18384
18974
  constructor({ fileContent, root, ...rest }) {
18385
18975
  super({
@@ -18419,8 +19009,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
18419
19009
  const paths = this.getSettablePaths({ global });
18420
19010
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
18421
19011
  if (isRoot) {
18422
- const relativePath2 = join123(paths.root.relativeDirPath, paths.root.relativeFilePath);
18423
- const fileContent2 = await readFileContent(join123(baseDir, relativePath2));
19012
+ const relativePath2 = join124(paths.root.relativeDirPath, paths.root.relativeFilePath);
19013
+ const fileContent2 = await readFileContent(join124(baseDir, relativePath2));
18424
19014
  return new _FactorydroidRule({
18425
19015
  baseDir,
18426
19016
  relativeDirPath: paths.root.relativeDirPath,
@@ -18433,8 +19023,8 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
18433
19023
  if (!paths.nonRoot) {
18434
19024
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
18435
19025
  }
18436
- const relativePath = join123(paths.nonRoot.relativeDirPath, relativeFilePath);
18437
- const fileContent = await readFileContent(join123(baseDir, relativePath));
19026
+ const relativePath = join124(paths.nonRoot.relativeDirPath, relativeFilePath);
19027
+ const fileContent = await readFileContent(join124(baseDir, relativePath));
18438
19028
  return new _FactorydroidRule({
18439
19029
  baseDir,
18440
19030
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -18493,7 +19083,7 @@ var FactorydroidRule = class _FactorydroidRule extends ToolRule {
18493
19083
  };
18494
19084
 
18495
19085
  // src/features/rules/geminicli-rule.ts
18496
- import { join as join124 } from "path";
19086
+ import { join as join125 } from "path";
18497
19087
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
18498
19088
  static getSettablePaths({
18499
19089
  global,
@@ -18528,7 +19118,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
18528
19118
  if (isRoot) {
18529
19119
  const relativePath2 = paths.root.relativeFilePath;
18530
19120
  const fileContent2 = await readFileContent(
18531
- join124(baseDir, paths.root.relativeDirPath, relativePath2)
19121
+ join125(baseDir, paths.root.relativeDirPath, relativePath2)
18532
19122
  );
18533
19123
  return new _GeminiCliRule({
18534
19124
  baseDir,
@@ -18542,8 +19132,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
18542
19132
  if (!paths.nonRoot) {
18543
19133
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
18544
19134
  }
18545
- const relativePath = join124(paths.nonRoot.relativeDirPath, relativeFilePath);
18546
- const fileContent = await readFileContent(join124(baseDir, relativePath));
19135
+ const relativePath = join125(paths.nonRoot.relativeDirPath, relativeFilePath);
19136
+ const fileContent = await readFileContent(join125(baseDir, relativePath));
18547
19137
  return new _GeminiCliRule({
18548
19138
  baseDir,
18549
19139
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -18602,7 +19192,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
18602
19192
  };
18603
19193
 
18604
19194
  // src/features/rules/goose-rule.ts
18605
- import { join as join125 } from "path";
19195
+ import { join as join126 } from "path";
18606
19196
  var GooseRule = class _GooseRule extends ToolRule {
18607
19197
  static getSettablePaths({
18608
19198
  global,
@@ -18637,7 +19227,7 @@ var GooseRule = class _GooseRule extends ToolRule {
18637
19227
  if (isRoot) {
18638
19228
  const relativePath2 = paths.root.relativeFilePath;
18639
19229
  const fileContent2 = await readFileContent(
18640
- join125(baseDir, paths.root.relativeDirPath, relativePath2)
19230
+ join126(baseDir, paths.root.relativeDirPath, relativePath2)
18641
19231
  );
18642
19232
  return new _GooseRule({
18643
19233
  baseDir,
@@ -18651,8 +19241,8 @@ var GooseRule = class _GooseRule extends ToolRule {
18651
19241
  if (!paths.nonRoot) {
18652
19242
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
18653
19243
  }
18654
- const relativePath = join125(paths.nonRoot.relativeDirPath, relativeFilePath);
18655
- const fileContent = await readFileContent(join125(baseDir, relativePath));
19244
+ const relativePath = join126(paths.nonRoot.relativeDirPath, relativeFilePath);
19245
+ const fileContent = await readFileContent(join126(baseDir, relativePath));
18656
19246
  return new _GooseRule({
18657
19247
  baseDir,
18658
19248
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -18711,7 +19301,7 @@ var GooseRule = class _GooseRule extends ToolRule {
18711
19301
  };
18712
19302
 
18713
19303
  // src/features/rules/junie-rule.ts
18714
- import { join as join126 } from "path";
19304
+ import { join as join127 } from "path";
18715
19305
  var JunieRule = class _JunieRule extends ToolRule {
18716
19306
  static getSettablePaths(_options = {}) {
18717
19307
  return {
@@ -18740,8 +19330,8 @@ var JunieRule = class _JunieRule extends ToolRule {
18740
19330
  }) {
18741
19331
  const isRoot = _JunieRule.isRootRelativeFilePath(relativeFilePath);
18742
19332
  const settablePaths = this.getSettablePaths();
18743
- const relativePath = isRoot ? join126(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : join126(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
18744
- const fileContent = await readFileContent(join126(baseDir, relativePath));
19333
+ const relativePath = isRoot ? join127(settablePaths.root.relativeDirPath, settablePaths.root.relativeFilePath) : join127(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
19334
+ const fileContent = await readFileContent(join127(baseDir, relativePath));
18745
19335
  return new _JunieRule({
18746
19336
  baseDir,
18747
19337
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -18796,7 +19386,7 @@ var JunieRule = class _JunieRule extends ToolRule {
18796
19386
  };
18797
19387
 
18798
19388
  // src/features/rules/kilo-rule.ts
18799
- import { join as join127 } from "path";
19389
+ import { join as join128 } from "path";
18800
19390
  var KiloRule = class _KiloRule extends ToolRule {
18801
19391
  static getSettablePaths({
18802
19392
  global,
@@ -18831,7 +19421,7 @@ var KiloRule = class _KiloRule extends ToolRule {
18831
19421
  if (isRoot) {
18832
19422
  const relativePath2 = paths.root.relativeFilePath;
18833
19423
  const fileContent2 = await readFileContent(
18834
- join127(baseDir, paths.root.relativeDirPath, relativePath2)
19424
+ join128(baseDir, paths.root.relativeDirPath, relativePath2)
18835
19425
  );
18836
19426
  return new _KiloRule({
18837
19427
  baseDir,
@@ -18845,8 +19435,8 @@ var KiloRule = class _KiloRule extends ToolRule {
18845
19435
  if (!paths.nonRoot) {
18846
19436
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
18847
19437
  }
18848
- const relativePath = join127(paths.nonRoot.relativeDirPath, relativeFilePath);
18849
- const fileContent = await readFileContent(join127(baseDir, relativePath));
19438
+ const relativePath = join128(paths.nonRoot.relativeDirPath, relativeFilePath);
19439
+ const fileContent = await readFileContent(join128(baseDir, relativePath));
18850
19440
  return new _KiloRule({
18851
19441
  baseDir,
18852
19442
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -18905,7 +19495,7 @@ var KiloRule = class _KiloRule extends ToolRule {
18905
19495
  };
18906
19496
 
18907
19497
  // src/features/rules/kiro-rule.ts
18908
- import { join as join128 } from "path";
19498
+ import { join as join129 } from "path";
18909
19499
  var KiroRule = class _KiroRule extends ToolRule {
18910
19500
  static getSettablePaths(_options = {}) {
18911
19501
  return {
@@ -18920,7 +19510,7 @@ var KiroRule = class _KiroRule extends ToolRule {
18920
19510
  validate = true
18921
19511
  }) {
18922
19512
  const fileContent = await readFileContent(
18923
- join128(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
19513
+ join129(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
18924
19514
  );
18925
19515
  return new _KiroRule({
18926
19516
  baseDir,
@@ -18974,7 +19564,7 @@ var KiroRule = class _KiroRule extends ToolRule {
18974
19564
  };
18975
19565
 
18976
19566
  // src/features/rules/opencode-rule.ts
18977
- import { join as join129 } from "path";
19567
+ import { join as join130 } from "path";
18978
19568
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
18979
19569
  static getSettablePaths({
18980
19570
  global,
@@ -19009,7 +19599,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
19009
19599
  if (isRoot) {
19010
19600
  const relativePath2 = paths.root.relativeFilePath;
19011
19601
  const fileContent2 = await readFileContent(
19012
- join129(baseDir, paths.root.relativeDirPath, relativePath2)
19602
+ join130(baseDir, paths.root.relativeDirPath, relativePath2)
19013
19603
  );
19014
19604
  return new _OpenCodeRule({
19015
19605
  baseDir,
@@ -19023,8 +19613,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
19023
19613
  if (!paths.nonRoot) {
19024
19614
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
19025
19615
  }
19026
- const relativePath = join129(paths.nonRoot.relativeDirPath, relativeFilePath);
19027
- const fileContent = await readFileContent(join129(baseDir, relativePath));
19616
+ const relativePath = join130(paths.nonRoot.relativeDirPath, relativeFilePath);
19617
+ const fileContent = await readFileContent(join130(baseDir, relativePath));
19028
19618
  return new _OpenCodeRule({
19029
19619
  baseDir,
19030
19620
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -19083,7 +19673,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
19083
19673
  };
19084
19674
 
19085
19675
  // src/features/rules/qwencode-rule.ts
19086
- import { join as join130 } from "path";
19676
+ import { join as join131 } from "path";
19087
19677
  var QwencodeRule = class _QwencodeRule extends ToolRule {
19088
19678
  static getSettablePaths(_options = {}) {
19089
19679
  return {
@@ -19102,8 +19692,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
19102
19692
  validate = true
19103
19693
  }) {
19104
19694
  const isRoot = relativeFilePath === "QWEN.md";
19105
- const relativePath = isRoot ? "QWEN.md" : join130(".qwen", "memories", relativeFilePath);
19106
- const fileContent = await readFileContent(join130(baseDir, relativePath));
19695
+ const relativePath = isRoot ? "QWEN.md" : join131(".qwen", "memories", relativeFilePath);
19696
+ const fileContent = await readFileContent(join131(baseDir, relativePath));
19107
19697
  return new _QwencodeRule({
19108
19698
  baseDir,
19109
19699
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -19155,7 +19745,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
19155
19745
  };
19156
19746
 
19157
19747
  // src/features/rules/replit-rule.ts
19158
- import { join as join131 } from "path";
19748
+ import { join as join132 } from "path";
19159
19749
  var ReplitRule = class _ReplitRule extends ToolRule {
19160
19750
  static getSettablePaths(_options = {}) {
19161
19751
  return {
@@ -19177,7 +19767,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
19177
19767
  }
19178
19768
  const relativePath = paths.root.relativeFilePath;
19179
19769
  const fileContent = await readFileContent(
19180
- join131(baseDir, paths.root.relativeDirPath, relativePath)
19770
+ join132(baseDir, paths.root.relativeDirPath, relativePath)
19181
19771
  );
19182
19772
  return new _ReplitRule({
19183
19773
  baseDir,
@@ -19243,7 +19833,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
19243
19833
  };
19244
19834
 
19245
19835
  // src/features/rules/roo-rule.ts
19246
- import { join as join132 } from "path";
19836
+ import { join as join133 } from "path";
19247
19837
  var RooRule = class _RooRule extends ToolRule {
19248
19838
  static getSettablePaths(_options = {}) {
19249
19839
  return {
@@ -19258,7 +19848,7 @@ var RooRule = class _RooRule extends ToolRule {
19258
19848
  validate = true
19259
19849
  }) {
19260
19850
  const fileContent = await readFileContent(
19261
- join132(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
19851
+ join133(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
19262
19852
  );
19263
19853
  return new _RooRule({
19264
19854
  baseDir,
@@ -19327,7 +19917,7 @@ var RooRule = class _RooRule extends ToolRule {
19327
19917
  };
19328
19918
 
19329
19919
  // src/features/rules/rovodev-rule.ts
19330
- import { join as join133 } from "path";
19920
+ import { join as join134 } from "path";
19331
19921
  var DISALLOWED_ROVODEV_MODULAR_RULE_BASENAMES = /* @__PURE__ */ new Set(["agents.md", "agents.local.md"]);
19332
19922
  var RovodevRule = class _RovodevRule extends ToolRule {
19333
19923
  /**
@@ -19371,7 +19961,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
19371
19961
  root: rovodevAgents,
19372
19962
  alternativeRoots: [{ relativeDirPath: ".", relativeFilePath: "AGENTS.md" }],
19373
19963
  nonRoot: {
19374
- relativeDirPath: join133(".rovodev", ".rulesync", "modular-rules")
19964
+ relativeDirPath: join134(".rovodev", ".rulesync", "modular-rules")
19375
19965
  }
19376
19966
  };
19377
19967
  }
@@ -19410,10 +20000,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
19410
20000
  }) {
19411
20001
  if (!this.isAllowedModularRulesRelativePath(relativeFilePath)) {
19412
20002
  throw new Error(
19413
- `Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join133(relativeDirPath, relativeFilePath)}`
20003
+ `Reserved Rovodev memory basename under modular-rules (not a modular rule): ${join134(relativeDirPath, relativeFilePath)}`
19414
20004
  );
19415
20005
  }
19416
- const fileContent = await readFileContent(join133(baseDir, relativeDirPath, relativeFilePath));
20006
+ const fileContent = await readFileContent(join134(baseDir, relativeDirPath, relativeFilePath));
19417
20007
  return new _RovodevRule({
19418
20008
  baseDir,
19419
20009
  relativeDirPath,
@@ -19433,10 +20023,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
19433
20023
  paths
19434
20024
  }) {
19435
20025
  const relativeDirPath = overrideDirPath ?? paths.root.relativeDirPath;
19436
- const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${join133(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : join133(paths.root.relativeDirPath, paths.root.relativeFilePath);
20026
+ const agentsMdExpectedLocationsDescription = "alternativeRoots" in paths && paths.alternativeRoots && paths.alternativeRoots.length > 0 ? `${join134(paths.root.relativeDirPath, paths.root.relativeFilePath)} or project root` : join134(paths.root.relativeDirPath, paths.root.relativeFilePath);
19437
20027
  if (relativeFilePath !== "AGENTS.md") {
19438
20028
  throw new Error(
19439
- `Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${join133(relativeDirPath, relativeFilePath)}`
20029
+ `Rovodev rules support only AGENTS.md at ${agentsMdExpectedLocationsDescription}, got: ${join134(relativeDirPath, relativeFilePath)}`
19440
20030
  );
19441
20031
  }
19442
20032
  const allowed = relativeDirPath === paths.root.relativeDirPath || "alternativeRoots" in paths && paths.alternativeRoots?.some(
@@ -19444,10 +20034,10 @@ var RovodevRule = class _RovodevRule extends ToolRule {
19444
20034
  );
19445
20035
  if (!allowed) {
19446
20036
  throw new Error(
19447
- `Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${join133(relativeDirPath, relativeFilePath)}`
20037
+ `Rovodev AGENTS.md must be at ${agentsMdExpectedLocationsDescription}, got: ${join134(relativeDirPath, relativeFilePath)}`
19448
20038
  );
19449
20039
  }
19450
- const fileContent = await readFileContent(join133(baseDir, relativeDirPath, relativeFilePath));
20040
+ const fileContent = await readFileContent(join134(baseDir, relativeDirPath, relativeFilePath));
19451
20041
  return new _RovodevRule({
19452
20042
  baseDir,
19453
20043
  relativeDirPath,
@@ -19561,7 +20151,7 @@ var RovodevRule = class _RovodevRule extends ToolRule {
19561
20151
  };
19562
20152
 
19563
20153
  // src/features/rules/warp-rule.ts
19564
- import { join as join134 } from "path";
20154
+ import { join as join135 } from "path";
19565
20155
  var WarpRule = class _WarpRule extends ToolRule {
19566
20156
  constructor({ fileContent, root, ...rest }) {
19567
20157
  super({
@@ -19587,8 +20177,8 @@ var WarpRule = class _WarpRule extends ToolRule {
19587
20177
  validate = true
19588
20178
  }) {
19589
20179
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
19590
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join134(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
19591
- const fileContent = await readFileContent(join134(baseDir, relativePath));
20180
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join135(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
20181
+ const fileContent = await readFileContent(join135(baseDir, relativePath));
19592
20182
  return new _WarpRule({
19593
20183
  baseDir,
19594
20184
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -19643,7 +20233,7 @@ var WarpRule = class _WarpRule extends ToolRule {
19643
20233
  };
19644
20234
 
19645
20235
  // src/features/rules/windsurf-rule.ts
19646
- import { join as join135 } from "path";
20236
+ import { join as join136 } from "path";
19647
20237
  var WindsurfRule = class _WindsurfRule extends ToolRule {
19648
20238
  static getSettablePaths(_options = {}) {
19649
20239
  return {
@@ -19658,7 +20248,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
19658
20248
  validate = true
19659
20249
  }) {
19660
20250
  const fileContent = await readFileContent(
19661
- join135(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
20251
+ join136(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
19662
20252
  );
19663
20253
  return new _WindsurfRule({
19664
20254
  baseDir,
@@ -19756,11 +20346,11 @@ var rulesProcessorToolTargets = [
19756
20346
  "warp",
19757
20347
  "windsurf"
19758
20348
  ];
19759
- var RulesProcessorToolTargetSchema = z71.enum(rulesProcessorToolTargets);
19760
- var formatRulePaths = (rules) => rules.map((r) => join136(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
19761
- var RulesFeatureOptionsSchema = z71.looseObject({
19762
- ruleDiscoveryMode: z71.optional(z71.enum(["none", "explicit"])),
19763
- includeLocalRoot: z71.optional(z71.boolean())
20349
+ var RulesProcessorToolTargetSchema = z72.enum(rulesProcessorToolTargets);
20350
+ var formatRulePaths = (rules) => rules.map((r) => join137(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
20351
+ var RulesFeatureOptionsSchema = z72.looseObject({
20352
+ ruleDiscoveryMode: z72.optional(z72.enum(["none", "explicit"])),
20353
+ includeLocalRoot: z72.optional(z72.boolean())
19764
20354
  });
19765
20355
  var resolveRuleDiscoveryMode = ({
19766
20356
  defaultMode,
@@ -19781,8 +20371,8 @@ var resolveRuleDiscoveryMode = ({
19781
20371
  }
19782
20372
  return parsed.data.ruleDiscoveryMode === "none" ? "auto" : "toon";
19783
20373
  };
19784
- var IncludeLocalRootSchema = z71.looseObject({
19785
- includeLocalRoot: z71.optional(z71.boolean())
20374
+ var IncludeLocalRootSchema = z72.looseObject({
20375
+ includeLocalRoot: z72.optional(z72.boolean())
19786
20376
  });
19787
20377
  var resolveIncludeLocalRoot = (options) => {
19788
20378
  if (!options) return true;
@@ -20088,6 +20678,8 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
20088
20678
  extension: "md",
20089
20679
  supportsGlobal: false,
20090
20680
  ruleDiscoveryMode: "auto"
20681
+ // No additionalConventions.skills needed: Windsurf Cascade auto-discovers
20682
+ // skills from .windsurf/skills/ and ~/.codeium/windsurf/skills/ directories.
20091
20683
  }
20092
20684
  }
20093
20685
  ]
@@ -20225,7 +20817,7 @@ var RulesProcessor = class extends FeatureProcessor {
20225
20817
  }).relativeDirPath;
20226
20818
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
20227
20819
  const frontmatter = skill.getFrontmatter();
20228
- const relativePath = join136(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
20820
+ const relativePath = join137(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
20229
20821
  return {
20230
20822
  name: frontmatter.name,
20231
20823
  description: frontmatter.description,
@@ -20354,8 +20946,8 @@ var RulesProcessor = class extends FeatureProcessor {
20354
20946
  * Load and parse rulesync rule files from .rulesync/rules/ directory
20355
20947
  */
20356
20948
  async loadRulesyncFiles() {
20357
- const rulesyncBaseDir = join136(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
20358
- const files = await findFilesByGlobs(join136(rulesyncBaseDir, "**", "*.md"));
20949
+ const rulesyncBaseDir = join137(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
20950
+ const files = await findFilesByGlobs(join137(rulesyncBaseDir, "**", "*.md"));
20359
20951
  this.logger.debug(`Found ${files.length} rulesync files`);
20360
20952
  const rulesyncRules = await Promise.all(
20361
20953
  files.map((file) => {
@@ -20470,13 +21062,13 @@ var RulesProcessor = class extends FeatureProcessor {
20470
21062
  return [];
20471
21063
  }
20472
21064
  const uniqueRootFilePaths = await findFilesWithFallback(
20473
- join136(
21065
+ join137(
20474
21066
  this.baseDir,
20475
21067
  settablePaths.root.relativeDirPath ?? ".",
20476
21068
  settablePaths.root.relativeFilePath
20477
21069
  ),
20478
21070
  settablePaths.alternativeRoots,
20479
- (alt) => join136(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
21071
+ (alt) => join137(this.baseDir, alt.relativeDirPath, alt.relativeFilePath)
20480
21072
  );
20481
21073
  if (forDeletion) {
20482
21074
  return buildDeletionRulesFromPaths(uniqueRootFilePaths);
@@ -20507,7 +21099,7 @@ var RulesProcessor = class extends FeatureProcessor {
20507
21099
  return [];
20508
21100
  }
20509
21101
  const uniqueLocalRootFilePaths2 = await findFilesByGlobs(
20510
- join136(this.baseDir, "AGENTS.local.md")
21102
+ join137(this.baseDir, "AGENTS.local.md")
20511
21103
  );
20512
21104
  return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths2);
20513
21105
  }
@@ -20518,9 +21110,9 @@ var RulesProcessor = class extends FeatureProcessor {
20518
21110
  return [];
20519
21111
  }
20520
21112
  const uniqueLocalRootFilePaths = await findFilesWithFallback(
20521
- join136(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
21113
+ join137(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md"),
20522
21114
  settablePaths.alternativeRoots,
20523
- (alt) => join136(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
21115
+ (alt) => join137(this.baseDir, alt.relativeDirPath, "CLAUDE.local.md")
20524
21116
  );
20525
21117
  return buildDeletionRulesFromPaths(uniqueLocalRootFilePaths);
20526
21118
  })();
@@ -20531,20 +21123,20 @@ var RulesProcessor = class extends FeatureProcessor {
20531
21123
  if (!forDeletion || this.toolTarget !== "rovodev" || this.global) {
20532
21124
  return [];
20533
21125
  }
20534
- const primaryPaths = await findFilesByGlobs(join136(this.baseDir, ".rovodev", "AGENTS.md"));
21126
+ const primaryPaths = await findFilesByGlobs(join137(this.baseDir, ".rovodev", "AGENTS.md"));
20535
21127
  if (primaryPaths.length === 0) {
20536
21128
  return [];
20537
21129
  }
20538
- const mirrorPaths = await findFilesByGlobs(join136(this.baseDir, "AGENTS.md"));
21130
+ const mirrorPaths = await findFilesByGlobs(join137(this.baseDir, "AGENTS.md"));
20539
21131
  return buildDeletionRulesFromPaths(mirrorPaths);
20540
21132
  })();
20541
21133
  const nonRootToolRules = await (async () => {
20542
21134
  if (!settablePaths.nonRoot) {
20543
21135
  return [];
20544
21136
  }
20545
- const nonRootBaseDir = join136(this.baseDir, settablePaths.nonRoot.relativeDirPath);
21137
+ const nonRootBaseDir = join137(this.baseDir, settablePaths.nonRoot.relativeDirPath);
20546
21138
  const nonRootFilePaths = await findFilesByGlobs(
20547
- join136(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
21139
+ join137(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
20548
21140
  );
20549
21141
  if (forDeletion) {
20550
21142
  return buildDeletionRulesFromPaths(nonRootFilePaths, {
@@ -20558,7 +21150,7 @@ var RulesProcessor = class extends FeatureProcessor {
20558
21150
  const ok = RovodevRule.isAllowedModularRulesRelativePath(relativeFilePath);
20559
21151
  if (!ok) {
20560
21152
  this.logger.warn(
20561
- `Skipping reserved Rovodev path under modular-rules (import): ${join136(modularRootRelative, relativeFilePath)}`
21153
+ `Skipping reserved Rovodev path under modular-rules (import): ${join137(modularRootRelative, relativeFilePath)}`
20562
21154
  );
20563
21155
  }
20564
21156
  return ok;
@@ -20684,14 +21276,14 @@ s/<command> [arguments]
20684
21276
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
20685
21277
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
20686
21278
 
20687
- When users call a custom slash command, you have to look for the markdown file, \`${join136(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
21279
+ When users call a custom slash command, you have to look for the markdown file, \`${join137(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
20688
21280
  const subagentsSection = subagents ? `## Simulated Subagents
20689
21281
 
20690
21282
  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.
20691
21283
 
20692
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${join136(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
21284
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${join137(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
20693
21285
 
20694
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join136(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
21286
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join137(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
20695
21287
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
20696
21288
  const result = [
20697
21289
  overview,
@@ -20791,7 +21383,7 @@ function warnUnsupportedTargets(params) {
20791
21383
  }
20792
21384
  }
20793
21385
  async function checkRulesyncDirExists(params) {
20794
- return fileExists(join137(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
21386
+ return fileExists(join138(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
20795
21387
  }
20796
21388
  async function generate(params) {
20797
21389
  const { config, logger } = params;
@@ -21402,176 +21994,6 @@ async function importPermissionsCore(params) {
21402
21994
  return writtenCount;
21403
21995
  }
21404
21996
 
21405
- // src/types/json-output.ts
21406
- var ErrorCodes = {
21407
- CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
21408
- RULESYNC_DIR_NOT_FOUND: "RULESYNC_DIR_NOT_FOUND",
21409
- INVALID_TARGET: "INVALID_TARGET",
21410
- FETCH_FAILED: "FETCH_FAILED",
21411
- WRITE_FAILED: "WRITE_FAILED",
21412
- VALIDATION_FAILED: "VALIDATION_FAILED",
21413
- GENERATION_FAILED: "GENERATION_FAILED",
21414
- IMPORT_FAILED: "IMPORT_FAILED",
21415
- INSTALL_FAILED: "INSTALL_FAILED",
21416
- UPDATE_FAILED: "UPDATE_FAILED",
21417
- GITIGNORE_FAILED: "GITIGNORE_FAILED",
21418
- INIT_FAILED: "INIT_FAILED",
21419
- MCP_FAILED: "MCP_FAILED",
21420
- UNKNOWN_ERROR: "UNKNOWN_ERROR"
21421
- };
21422
- var CLIError = class extends Error {
21423
- constructor(message, code = ErrorCodes.UNKNOWN_ERROR, exitCode = 1) {
21424
- super(message);
21425
- this.code = code;
21426
- this.exitCode = exitCode;
21427
- this.name = "CLIError";
21428
- }
21429
- };
21430
-
21431
- // src/utils/logger.ts
21432
- var BaseLogger = class {
21433
- _verbose = false;
21434
- _silent = false;
21435
- constructor({ verbose = false, silent = false } = {}) {
21436
- this._silent = silent;
21437
- this._verbose = verbose && !silent;
21438
- }
21439
- get verbose() {
21440
- return this._verbose;
21441
- }
21442
- get silent() {
21443
- return this._silent;
21444
- }
21445
- configure({ verbose, silent }) {
21446
- if (verbose && silent) {
21447
- this._silent = false;
21448
- if (!isEnvTest()) {
21449
- this.onConflictingFlags();
21450
- }
21451
- }
21452
- this._silent = silent;
21453
- this._verbose = verbose && !silent;
21454
- }
21455
- onConflictingFlags() {
21456
- console.warn("Both --verbose and --silent specified; --silent takes precedence");
21457
- }
21458
- };
21459
- var ConsoleLogger = class extends BaseLogger {
21460
- isSuppressed() {
21461
- return isEnvTest() || this._silent;
21462
- }
21463
- get jsonMode() {
21464
- return false;
21465
- }
21466
- captureData(_key, _value) {
21467
- }
21468
- getJsonData() {
21469
- return {};
21470
- }
21471
- outputJson(_success, _error) {
21472
- }
21473
- info(message, ...args) {
21474
- if (this.isSuppressed()) return;
21475
- console.log(message, ...args);
21476
- }
21477
- success(message, ...args) {
21478
- if (this.isSuppressed()) return;
21479
- console.log(message, ...args);
21480
- }
21481
- warn(message, ...args) {
21482
- if (this.isSuppressed()) return;
21483
- console.warn(message, ...args);
21484
- }
21485
- // Errors are always emitted, even in silent mode
21486
- error(message, _code, ...args) {
21487
- if (isEnvTest()) return;
21488
- const errorMessage = message instanceof Error ? message.message : message;
21489
- console.error(errorMessage, ...args);
21490
- }
21491
- debug(message, ...args) {
21492
- if (!this._verbose || this.isSuppressed()) return;
21493
- console.log(message, ...args);
21494
- }
21495
- };
21496
- var JsonLogger = class extends BaseLogger {
21497
- _jsonOutputDone = false;
21498
- _jsonData = {};
21499
- _commandName;
21500
- _version;
21501
- constructor({
21502
- command,
21503
- version,
21504
- verbose = false,
21505
- silent = false
21506
- }) {
21507
- super({ verbose, silent });
21508
- this._commandName = command;
21509
- this._version = version;
21510
- }
21511
- // Suppress raw console.warn in JSON mode to avoid non-JSON text on stderr
21512
- onConflictingFlags() {
21513
- }
21514
- get jsonMode() {
21515
- return true;
21516
- }
21517
- captureData(key, value) {
21518
- this._jsonData[key] = value;
21519
- }
21520
- getJsonData() {
21521
- return { ...this._jsonData };
21522
- }
21523
- outputJson(success, error) {
21524
- if (this._jsonOutputDone) return;
21525
- this._jsonOutputDone = true;
21526
- const output = {
21527
- success,
21528
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
21529
- command: this._commandName,
21530
- version: this._version
21531
- };
21532
- if (success) {
21533
- output.data = this._jsonData;
21534
- } else if (error) {
21535
- output.error = {
21536
- code: error.code,
21537
- message: error.message
21538
- };
21539
- if (error.details) {
21540
- output.error.details = error.details;
21541
- }
21542
- if (error.stack) {
21543
- output.error.stack = error.stack;
21544
- }
21545
- }
21546
- const jsonStr = JSON.stringify(output, null, 2);
21547
- if (success) {
21548
- console.log(jsonStr);
21549
- } else {
21550
- console.error(jsonStr);
21551
- }
21552
- }
21553
- info(_message, ..._args) {
21554
- }
21555
- success(_message, ..._args) {
21556
- }
21557
- warn(_message, ..._args) {
21558
- }
21559
- error(message, code, ..._args) {
21560
- if (isEnvTest()) return;
21561
- const errorMessage = message instanceof Error ? message.message : message;
21562
- const errorInfo = {
21563
- code: code || ErrorCodes.UNKNOWN_ERROR,
21564
- message: errorMessage
21565
- };
21566
- if (this._verbose && message instanceof Error && message.stack) {
21567
- errorInfo.stack = message.stack;
21568
- }
21569
- this.outputJson(false, errorInfo);
21570
- }
21571
- debug(_message, ..._args) {
21572
- }
21573
- };
21574
-
21575
21997
  export {
21576
21998
  RULESYNC_CONFIG_RELATIVE_FILE_PATH,
21577
21999
  RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH,
@@ -21617,6 +22039,7 @@ export {
21617
22039
  ALL_TOOL_TARGETS,
21618
22040
  ALL_TOOL_TARGETS_WITH_WILDCARD,
21619
22041
  findControlCharacter,
22042
+ GITIGNORE_DESTINATION_KEY,
21620
22043
  ConfigResolver,
21621
22044
  stringifyFrontmatter,
21622
22045
  RulesyncCommandFrontmatterSchema,
@@ -21628,6 +22051,10 @@ export {
21628
22051
  IgnoreProcessor,
21629
22052
  RulesyncMcp,
21630
22053
  McpProcessor,
22054
+ ErrorCodes,
22055
+ CLIError,
22056
+ ConsoleLogger,
22057
+ JsonLogger,
21631
22058
  SKILL_FILE_NAME,
21632
22059
  RulesyncSkillFrontmatterSchema,
21633
22060
  RulesyncSkill,
@@ -21641,9 +22068,5 @@ export {
21641
22068
  RulesProcessor,
21642
22069
  checkRulesyncDirExists,
21643
22070
  generate,
21644
- importFromTool,
21645
- ErrorCodes,
21646
- CLIError,
21647
- ConsoleLogger,
21648
- JsonLogger
22071
+ importFromTool
21649
22072
  };