rulesync 7.5.0 → 7.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -129,7 +129,7 @@ var logger = new Logger();
129
129
 
130
130
  // src/lib/fetch.ts
131
131
  var import_promise = require("es-toolkit/promise");
132
- var import_node_path109 = require("path");
132
+ var import_node_path110 = require("path");
133
133
 
134
134
  // src/constants/rulesync-paths.ts
135
135
  var import_node_path = require("path");
@@ -791,6 +791,7 @@ var ALL_TOOL_TARGETS = [
791
791
  "cursor",
792
792
  "factorydroid",
793
793
  "geminicli",
794
+ "goose",
794
795
  "junie",
795
796
  "kilo",
796
797
  "kiro",
@@ -3581,7 +3582,7 @@ var HooksProcessor = class extends FeatureProcessor {
3581
3582
  try {
3582
3583
  return [
3583
3584
  await RulesyncHooks.fromFile({
3584
- baseDir: this.baseDir,
3585
+ baseDir: process.cwd(),
3585
3586
  validate: true
3586
3587
  })
3587
3588
  ];
@@ -5183,24 +5184,25 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
5183
5184
  getToml() {
5184
5185
  return this.toml;
5185
5186
  }
5186
- static getSettablePaths({ global } = {}) {
5187
- if (!global) {
5188
- throw new Error("CodexcliMcp only supports global mode. Please pass { global: true }.");
5189
- }
5187
+ static getSettablePaths(_options = {}) {
5190
5188
  return {
5191
5189
  relativeDirPath: ".codex",
5192
5190
  relativeFilePath: "config.toml"
5193
5191
  };
5194
5192
  }
5193
+ /**
5194
+ * config.toml may contain other Codex settings, so it should not be deleted.
5195
+ */
5196
+ isDeletable() {
5197
+ return false;
5198
+ }
5195
5199
  static async fromFile({
5196
5200
  baseDir = process.cwd(),
5197
5201
  validate = true,
5198
5202
  global = false
5199
5203
  }) {
5200
5204
  const paths = this.getSettablePaths({ global });
5201
- const fileContent = await readFileContent(
5202
- (0, import_node_path41.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
5203
- );
5205
+ const fileContent = await readFileContentOrNull((0, import_node_path41.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
5204
5206
  return new _CodexcliMcp({
5205
5207
  baseDir,
5206
5208
  relativeDirPath: paths.relativeDirPath,
@@ -6256,7 +6258,7 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
6256
6258
  {
6257
6259
  class: CodexcliMcp,
6258
6260
  meta: {
6259
- supportsProject: false,
6261
+ supportsProject: true,
6260
6262
  supportsGlobal: true,
6261
6263
  supportsEnabledTools: true,
6262
6264
  supportsDisabledTools: true
@@ -6516,8 +6518,8 @@ var McpProcessor = class extends FeatureProcessor {
6516
6518
 
6517
6519
  // src/features/rules/rules-processor.ts
6518
6520
  var import_toon = require("@toon-format/toon");
6519
- var import_node_path108 = require("path");
6520
- var import_mini48 = require("zod/mini");
6521
+ var import_node_path109 = require("path");
6522
+ var import_mini49 = require("zod/mini");
6521
6523
 
6522
6524
  // src/constants/general.ts
6523
6525
  var SKILL_FILE_NAME = "SKILL.md";
@@ -9413,14 +9415,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
9413
9415
  * Local skills take precedence over curated skills with the same name.
9414
9416
  */
9415
9417
  async loadRulesyncDirs() {
9416
- const localDirNames = [...await getLocalSkillDirNames(this.baseDir)];
9418
+ const localDirNames = [...await getLocalSkillDirNames(process.cwd())];
9417
9419
  const localSkills = await Promise.all(
9418
9420
  localDirNames.map(
9419
- (dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
9421
+ (dirName) => RulesyncSkill.fromDir({ baseDir: process.cwd(), dirName, global: this.global })
9420
9422
  )
9421
9423
  );
9422
9424
  const localSkillNames = new Set(localDirNames);
9423
- const curatedDirPath = (0, import_node_path71.join)(this.baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
9425
+ const curatedDirPath = (0, import_node_path71.join)(process.cwd(), RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
9424
9426
  let curatedSkills = [];
9425
9427
  if (await directoryExists(curatedDirPath)) {
9426
9428
  const curatedDirPaths = await findFilesByGlobs((0, import_node_path71.join)(curatedDirPath, "*"), { type: "dir" });
@@ -9436,7 +9438,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
9436
9438
  curatedSkills = await Promise.all(
9437
9439
  nonConflicting.map(
9438
9440
  (dirName) => RulesyncSkill.fromDir({
9439
- baseDir: this.baseDir,
9441
+ baseDir: process.cwd(),
9440
9442
  relativeDirPath: curatedRelativeDirPath,
9441
9443
  dirName,
9442
9444
  global: this.global
@@ -9716,39 +9718,12 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
9716
9718
  }
9717
9719
  };
9718
9720
 
9719
- // src/features/subagents/codexcli-subagent.ts
9720
- var import_node_path74 = require("path");
9721
- var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
9722
- static getSettablePaths() {
9723
- return {
9724
- relativeDirPath: (0, import_node_path74.join)(".codex", "subagents")
9725
- };
9726
- }
9727
- static async fromFile(params) {
9728
- const baseParams = await this.fromFileDefault(params);
9729
- return new _CodexCliSubagent(baseParams);
9730
- }
9731
- static fromRulesyncSubagent(params) {
9732
- const baseParams = this.fromRulesyncSubagentDefault(params);
9733
- return new _CodexCliSubagent(baseParams);
9734
- }
9735
- static isTargetedByRulesyncSubagent(rulesyncSubagent) {
9736
- return this.isTargetedByRulesyncSubagentDefault({
9737
- rulesyncSubagent,
9738
- toolTarget: "codexcli"
9739
- });
9740
- }
9741
- static forDeletion(params) {
9742
- return new _CodexCliSubagent(this.forDeletionDefault(params));
9743
- }
9744
- };
9745
-
9746
9721
  // src/features/subagents/factorydroid-subagent.ts
9747
- var import_node_path75 = require("path");
9722
+ var import_node_path74 = require("path");
9748
9723
  var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
9749
9724
  static getSettablePaths(_options) {
9750
9725
  return {
9751
- relativeDirPath: (0, import_node_path75.join)(".factory", "droids")
9726
+ relativeDirPath: (0, import_node_path74.join)(".factory", "droids")
9752
9727
  };
9753
9728
  }
9754
9729
  static async fromFile(params) {
@@ -9771,11 +9746,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
9771
9746
  };
9772
9747
 
9773
9748
  // src/features/subagents/geminicli-subagent.ts
9774
- var import_node_path76 = require("path");
9749
+ var import_node_path75 = require("path");
9775
9750
  var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
9776
9751
  static getSettablePaths() {
9777
9752
  return {
9778
- relativeDirPath: (0, import_node_path76.join)(".gemini", "subagents")
9753
+ relativeDirPath: (0, import_node_path75.join)(".gemini", "subagents")
9779
9754
  };
9780
9755
  }
9781
9756
  static async fromFile(params) {
@@ -9798,11 +9773,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
9798
9773
  };
9799
9774
 
9800
9775
  // src/features/subagents/roo-subagent.ts
9801
- var import_node_path77 = require("path");
9776
+ var import_node_path76 = require("path");
9802
9777
  var RooSubagent = class _RooSubagent extends SimulatedSubagent {
9803
9778
  static getSettablePaths() {
9804
9779
  return {
9805
- relativeDirPath: (0, import_node_path77.join)(".roo", "subagents")
9780
+ relativeDirPath: (0, import_node_path76.join)(".roo", "subagents")
9806
9781
  };
9807
9782
  }
9808
9783
  static async fromFile(params) {
@@ -9826,14 +9801,14 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
9826
9801
 
9827
9802
  // src/features/subagents/subagents-processor.ts
9828
9803
  var import_node_path84 = require("path");
9829
- var import_mini41 = require("zod/mini");
9804
+ var import_mini42 = require("zod/mini");
9830
9805
 
9831
9806
  // src/features/subagents/claudecode-subagent.ts
9832
- var import_node_path79 = require("path");
9807
+ var import_node_path78 = require("path");
9833
9808
  var import_mini36 = require("zod/mini");
9834
9809
 
9835
9810
  // src/features/subagents/rulesync-subagent.ts
9836
- var import_node_path78 = require("path");
9811
+ var import_node_path77 = require("path");
9837
9812
  var import_mini35 = require("zod/mini");
9838
9813
  var RulesyncSubagentFrontmatterSchema = import_mini35.z.looseObject({
9839
9814
  targets: import_mini35.z._default(RulesyncTargetsSchema, ["*"]),
@@ -9847,7 +9822,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
9847
9822
  const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
9848
9823
  if (!parseResult.success && rest.validate !== false) {
9849
9824
  throw new Error(
9850
- `Invalid frontmatter in ${(0, import_node_path78.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
9825
+ `Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
9851
9826
  );
9852
9827
  }
9853
9828
  const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
@@ -9880,7 +9855,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
9880
9855
  return {
9881
9856
  success: false,
9882
9857
  error: new Error(
9883
- `Invalid frontmatter in ${(0, import_node_path78.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
9858
+ `Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
9884
9859
  )
9885
9860
  };
9886
9861
  }
@@ -9889,14 +9864,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
9889
9864
  relativeFilePath
9890
9865
  }) {
9891
9866
  const fileContent = await readFileContent(
9892
- (0, import_node_path78.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
9867
+ (0, import_node_path77.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
9893
9868
  );
9894
9869
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
9895
9870
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
9896
9871
  if (!result.success) {
9897
9872
  throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
9898
9873
  }
9899
- const filename = (0, import_node_path78.basename)(relativeFilePath);
9874
+ const filename = (0, import_node_path77.basename)(relativeFilePath);
9900
9875
  return new _RulesyncSubagent({
9901
9876
  baseDir: process.cwd(),
9902
9877
  relativeDirPath: this.getSettablePaths().relativeDirPath,
@@ -9924,7 +9899,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
9924
9899
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
9925
9900
  if (!result.success) {
9926
9901
  throw new Error(
9927
- `Invalid frontmatter in ${(0, import_node_path79.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
9902
+ `Invalid frontmatter in ${(0, import_node_path78.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
9928
9903
  );
9929
9904
  }
9930
9905
  }
@@ -9936,7 +9911,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
9936
9911
  }
9937
9912
  static getSettablePaths(_options = {}) {
9938
9913
  return {
9939
- relativeDirPath: (0, import_node_path79.join)(".claude", "agents")
9914
+ relativeDirPath: (0, import_node_path78.join)(".claude", "agents")
9940
9915
  };
9941
9916
  }
9942
9917
  getFrontmatter() {
@@ -10012,7 +9987,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10012
9987
  return {
10013
9988
  success: false,
10014
9989
  error: new Error(
10015
- `Invalid frontmatter in ${(0, import_node_path79.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
9990
+ `Invalid frontmatter in ${(0, import_node_path78.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
10016
9991
  )
10017
9992
  };
10018
9993
  }
@@ -10030,7 +10005,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10030
10005
  global = false
10031
10006
  }) {
10032
10007
  const paths = this.getSettablePaths({ global });
10033
- const filePath = (0, import_node_path79.join)(baseDir, paths.relativeDirPath, relativeFilePath);
10008
+ const filePath = (0, import_node_path78.join)(baseDir, paths.relativeDirPath, relativeFilePath);
10034
10009
  const fileContent = await readFileContent(filePath);
10035
10010
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
10036
10011
  const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
@@ -10064,14 +10039,158 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
10064
10039
  }
10065
10040
  };
10066
10041
 
10042
+ // src/features/subagents/codexcli-subagent.ts
10043
+ var import_node_path79 = require("path");
10044
+ var smolToml2 = __toESM(require("smol-toml"), 1);
10045
+ var import_mini37 = require("zod/mini");
10046
+ var CodexCliSubagentTomlSchema = import_mini37.z.looseObject({
10047
+ name: import_mini37.z.string(),
10048
+ description: import_mini37.z.optional(import_mini37.z.string()),
10049
+ developer_instructions: import_mini37.z.optional(import_mini37.z.string()),
10050
+ model: import_mini37.z.optional(import_mini37.z.string()),
10051
+ model_reasoning_effort: import_mini37.z.optional(import_mini37.z.string()),
10052
+ sandbox_mode: import_mini37.z.optional(import_mini37.z.string())
10053
+ });
10054
+ var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
10055
+ body;
10056
+ constructor({ body, ...rest }) {
10057
+ super({
10058
+ ...rest
10059
+ });
10060
+ this.body = body;
10061
+ }
10062
+ static getSettablePaths(_options = {}) {
10063
+ return {
10064
+ relativeDirPath: (0, import_node_path79.join)(".codex", "agents")
10065
+ };
10066
+ }
10067
+ getBody() {
10068
+ return this.body;
10069
+ }
10070
+ toRulesyncSubagent() {
10071
+ let parsed;
10072
+ try {
10073
+ parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
10074
+ } catch (error) {
10075
+ throw new Error(
10076
+ `Failed to parse TOML in ${(0, import_node_path79.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
10077
+ { cause: error }
10078
+ );
10079
+ }
10080
+ const { name, description, developer_instructions, ...restFields } = parsed;
10081
+ const codexcliSection = {
10082
+ ...restFields
10083
+ };
10084
+ const rulesyncFrontmatter = {
10085
+ targets: ["codexcli"],
10086
+ name,
10087
+ description: description ?? "",
10088
+ // Only include codexcli section if there are fields
10089
+ ...Object.keys(codexcliSection).length > 0 && { codexcli: codexcliSection }
10090
+ };
10091
+ return new RulesyncSubagent({
10092
+ baseDir: ".",
10093
+ frontmatter: rulesyncFrontmatter,
10094
+ body: developer_instructions ?? "",
10095
+ relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
10096
+ relativeFilePath: this.getRelativeFilePath().replace(/\.toml$/, ".md"),
10097
+ validate: true
10098
+ });
10099
+ }
10100
+ static fromRulesyncSubagent({
10101
+ baseDir = process.cwd(),
10102
+ rulesyncSubagent,
10103
+ validate = true,
10104
+ global = false
10105
+ }) {
10106
+ const frontmatter = rulesyncSubagent.getFrontmatter();
10107
+ const rawSection = frontmatter.codexcli ?? {};
10108
+ const {
10109
+ name: _n,
10110
+ description: _d,
10111
+ developer_instructions: _di,
10112
+ ...codexcliSection
10113
+ } = rawSection;
10114
+ const tomlObj = {
10115
+ name: frontmatter.name,
10116
+ ...frontmatter.description ? { description: frontmatter.description } : {},
10117
+ ...rulesyncSubagent.getBody() ? { developer_instructions: rulesyncSubagent.getBody() } : {},
10118
+ ...codexcliSection
10119
+ };
10120
+ const body = smolToml2.stringify(tomlObj);
10121
+ const paths = this.getSettablePaths({ global });
10122
+ const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".toml");
10123
+ return new _CodexCliSubagent({
10124
+ baseDir,
10125
+ body,
10126
+ relativeDirPath: paths.relativeDirPath,
10127
+ relativeFilePath,
10128
+ fileContent: body,
10129
+ validate,
10130
+ global
10131
+ });
10132
+ }
10133
+ validate() {
10134
+ try {
10135
+ const parsed = smolToml2.parse(this.body);
10136
+ CodexCliSubagentTomlSchema.parse(parsed);
10137
+ return { success: true, error: null };
10138
+ } catch (error) {
10139
+ return {
10140
+ success: false,
10141
+ error: error instanceof Error ? error : new Error(String(error))
10142
+ };
10143
+ }
10144
+ }
10145
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
10146
+ return this.isTargetedByRulesyncSubagentDefault({
10147
+ rulesyncSubagent,
10148
+ toolTarget: "codexcli"
10149
+ });
10150
+ }
10151
+ static async fromFile({
10152
+ baseDir = process.cwd(),
10153
+ relativeFilePath,
10154
+ validate = true,
10155
+ global = false
10156
+ }) {
10157
+ const paths = this.getSettablePaths({ global });
10158
+ const filePath = (0, import_node_path79.join)(baseDir, paths.relativeDirPath, relativeFilePath);
10159
+ const fileContent = await readFileContent(filePath);
10160
+ return new _CodexCliSubagent({
10161
+ baseDir,
10162
+ relativeDirPath: paths.relativeDirPath,
10163
+ relativeFilePath,
10164
+ body: fileContent.trim(),
10165
+ fileContent,
10166
+ validate,
10167
+ global
10168
+ });
10169
+ }
10170
+ static forDeletion({
10171
+ baseDir = process.cwd(),
10172
+ relativeDirPath,
10173
+ relativeFilePath
10174
+ }) {
10175
+ return new _CodexCliSubagent({
10176
+ baseDir,
10177
+ relativeDirPath,
10178
+ relativeFilePath,
10179
+ body: "",
10180
+ fileContent: "",
10181
+ validate: false
10182
+ });
10183
+ }
10184
+ };
10185
+
10067
10186
  // src/features/subagents/copilot-subagent.ts
10068
10187
  var import_node_path80 = require("path");
10069
- var import_mini37 = require("zod/mini");
10188
+ var import_mini38 = require("zod/mini");
10070
10189
  var REQUIRED_TOOL = "agent/runSubagent";
10071
- var CopilotSubagentFrontmatterSchema = import_mini37.z.looseObject({
10072
- name: import_mini37.z.string(),
10073
- description: import_mini37.z.string(),
10074
- tools: import_mini37.z.optional(import_mini37.z.union([import_mini37.z.string(), import_mini37.z.array(import_mini37.z.string())]))
10190
+ var CopilotSubagentFrontmatterSchema = import_mini38.z.looseObject({
10191
+ name: import_mini38.z.string(),
10192
+ description: import_mini38.z.string(),
10193
+ tools: import_mini38.z.optional(import_mini38.z.union([import_mini38.z.string(), import_mini38.z.array(import_mini38.z.string())]))
10075
10194
  });
10076
10195
  var normalizeTools = (tools) => {
10077
10196
  if (!tools) {
@@ -10232,10 +10351,10 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
10232
10351
 
10233
10352
  // src/features/subagents/cursor-subagent.ts
10234
10353
  var import_node_path81 = require("path");
10235
- var import_mini38 = require("zod/mini");
10236
- var CursorSubagentFrontmatterSchema = import_mini38.z.looseObject({
10237
- name: import_mini38.z.string(),
10238
- description: import_mini38.z.string()
10354
+ var import_mini39 = require("zod/mini");
10355
+ var CursorSubagentFrontmatterSchema = import_mini39.z.looseObject({
10356
+ name: import_mini39.z.string(),
10357
+ description: import_mini39.z.string()
10239
10358
  });
10240
10359
  var CursorSubagent = class _CursorSubagent extends ToolSubagent {
10241
10360
  frontmatter;
@@ -10379,22 +10498,22 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
10379
10498
 
10380
10499
  // src/features/subagents/kiro-subagent.ts
10381
10500
  var import_node_path82 = require("path");
10382
- var import_mini39 = require("zod/mini");
10383
- var KiroCliSubagentJsonSchema = import_mini39.z.looseObject({
10384
- name: import_mini39.z.string(),
10385
- description: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.string())),
10386
- prompt: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.string())),
10387
- tools: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.array(import_mini39.z.string()))),
10388
- toolAliases: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.record(import_mini39.z.string(), import_mini39.z.string()))),
10389
- toolSettings: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.unknown())),
10390
- toolSchema: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.unknown())),
10391
- hooks: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.record(import_mini39.z.string(), import_mini39.z.array(import_mini39.z.unknown())))),
10392
- model: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.string())),
10393
- mcpServers: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.record(import_mini39.z.string(), import_mini39.z.unknown()))),
10394
- useLegacyMcpJson: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.boolean())),
10395
- resources: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.array(import_mini39.z.string()))),
10396
- allowedTools: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.array(import_mini39.z.string()))),
10397
- includeMcpJson: import_mini39.z.optional(import_mini39.z.nullable(import_mini39.z.boolean()))
10501
+ var import_mini40 = require("zod/mini");
10502
+ var KiroCliSubagentJsonSchema = import_mini40.z.looseObject({
10503
+ name: import_mini40.z.string(),
10504
+ description: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.string())),
10505
+ prompt: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.string())),
10506
+ tools: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.array(import_mini40.z.string()))),
10507
+ toolAliases: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.record(import_mini40.z.string(), import_mini40.z.string()))),
10508
+ toolSettings: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.unknown())),
10509
+ toolSchema: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.unknown())),
10510
+ hooks: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.record(import_mini40.z.string(), import_mini40.z.array(import_mini40.z.unknown())))),
10511
+ model: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.string())),
10512
+ mcpServers: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.record(import_mini40.z.string(), import_mini40.z.unknown()))),
10513
+ useLegacyMcpJson: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.boolean())),
10514
+ resources: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.array(import_mini40.z.string()))),
10515
+ allowedTools: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.array(import_mini40.z.string()))),
10516
+ includeMcpJson: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.boolean()))
10398
10517
  });
10399
10518
  var KiroSubagent = class _KiroSubagent extends ToolSubagent {
10400
10519
  body;
@@ -10516,11 +10635,11 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
10516
10635
 
10517
10636
  // src/features/subagents/opencode-subagent.ts
10518
10637
  var import_node_path83 = require("path");
10519
- var import_mini40 = require("zod/mini");
10520
- var OpenCodeSubagentFrontmatterSchema = import_mini40.z.looseObject({
10521
- description: import_mini40.z.string(),
10522
- mode: import_mini40.z._default(import_mini40.z.string(), "subagent"),
10523
- name: import_mini40.z.optional(import_mini40.z.string())
10638
+ var import_mini41 = require("zod/mini");
10639
+ var OpenCodeSubagentFrontmatterSchema = import_mini41.z.looseObject({
10640
+ description: import_mini41.z.string(),
10641
+ mode: import_mini41.z._default(import_mini41.z.string(), "subagent"),
10642
+ name: import_mini41.z.optional(import_mini41.z.string())
10524
10643
  });
10525
10644
  var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
10526
10645
  frontmatter;
@@ -10676,7 +10795,7 @@ var subagentsProcessorToolTargetTuple = [
10676
10795
  "opencode",
10677
10796
  "roo"
10678
10797
  ];
10679
- var SubagentsProcessorToolTargetSchema = import_mini41.z.enum(subagentsProcessorToolTargetTuple);
10798
+ var SubagentsProcessorToolTargetSchema = import_mini42.z.enum(subagentsProcessorToolTargetTuple);
10680
10799
  var toolSubagentFactories = /* @__PURE__ */ new Map([
10681
10800
  [
10682
10801
  "agentsmd",
@@ -10703,7 +10822,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
10703
10822
  "codexcli",
10704
10823
  {
10705
10824
  class: CodexCliSubagent,
10706
- meta: { supportsSimulated: true, supportsGlobal: false, filePattern: "*.md" }
10825
+ meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.toml" }
10707
10826
  }
10708
10827
  ],
10709
10828
  [
@@ -10838,7 +10957,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
10838
10957
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
10839
10958
  */
10840
10959
  async loadRulesyncFiles() {
10841
- const subagentsDir = (0, import_node_path84.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
10960
+ const subagentsDir = (0, import_node_path84.join)(process.cwd(), RulesyncSubagent.getSettablePaths().relativeDirPath);
10842
10961
  const dirExists = await directoryExists(subagentsDir);
10843
10962
  if (!dirExists) {
10844
10963
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -10955,42 +11074,42 @@ var import_node_path86 = require("path");
10955
11074
 
10956
11075
  // src/features/rules/rulesync-rule.ts
10957
11076
  var import_node_path85 = require("path");
10958
- var import_mini42 = require("zod/mini");
10959
- var RulesyncRuleFrontmatterSchema = import_mini42.z.object({
10960
- root: import_mini42.z.optional(import_mini42.z.boolean()),
10961
- localRoot: import_mini42.z.optional(import_mini42.z.boolean()),
10962
- targets: import_mini42.z._default(RulesyncTargetsSchema, ["*"]),
10963
- description: import_mini42.z.optional(import_mini42.z.string()),
10964
- globs: import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string())),
10965
- agentsmd: import_mini42.z.optional(
10966
- import_mini42.z.object({
11077
+ var import_mini43 = require("zod/mini");
11078
+ var RulesyncRuleFrontmatterSchema = import_mini43.z.object({
11079
+ root: import_mini43.z.optional(import_mini43.z.boolean()),
11080
+ localRoot: import_mini43.z.optional(import_mini43.z.boolean()),
11081
+ targets: import_mini43.z._default(RulesyncTargetsSchema, ["*"]),
11082
+ description: import_mini43.z.optional(import_mini43.z.string()),
11083
+ globs: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string())),
11084
+ agentsmd: import_mini43.z.optional(
11085
+ import_mini43.z.object({
10967
11086
  // @example "path/to/subproject"
10968
- subprojectPath: import_mini42.z.optional(import_mini42.z.string())
11087
+ subprojectPath: import_mini43.z.optional(import_mini43.z.string())
10969
11088
  })
10970
11089
  ),
10971
- claudecode: import_mini42.z.optional(
10972
- import_mini42.z.object({
11090
+ claudecode: import_mini43.z.optional(
11091
+ import_mini43.z.object({
10973
11092
  // Glob patterns for conditional rules (takes precedence over globs)
10974
11093
  // @example ["src/**/*.ts", "tests/**/*.test.ts"]
10975
- paths: import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string()))
11094
+ paths: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string()))
10976
11095
  })
10977
11096
  ),
10978
- cursor: import_mini42.z.optional(
10979
- import_mini42.z.object({
10980
- alwaysApply: import_mini42.z.optional(import_mini42.z.boolean()),
10981
- description: import_mini42.z.optional(import_mini42.z.string()),
10982
- globs: import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string()))
11097
+ cursor: import_mini43.z.optional(
11098
+ import_mini43.z.object({
11099
+ alwaysApply: import_mini43.z.optional(import_mini43.z.boolean()),
11100
+ description: import_mini43.z.optional(import_mini43.z.string()),
11101
+ globs: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string()))
10983
11102
  })
10984
11103
  ),
10985
- copilot: import_mini42.z.optional(
10986
- import_mini42.z.object({
10987
- excludeAgent: import_mini42.z.optional(import_mini42.z.union([import_mini42.z.literal("code-review"), import_mini42.z.literal("coding-agent")]))
11104
+ copilot: import_mini43.z.optional(
11105
+ import_mini43.z.object({
11106
+ excludeAgent: import_mini43.z.optional(import_mini43.z.union([import_mini43.z.literal("code-review"), import_mini43.z.literal("coding-agent")]))
10988
11107
  })
10989
11108
  ),
10990
- antigravity: import_mini42.z.optional(
10991
- import_mini42.z.looseObject({
10992
- trigger: import_mini42.z.optional(import_mini42.z.string()),
10993
- globs: import_mini42.z.optional(import_mini42.z.array(import_mini42.z.string()))
11109
+ antigravity: import_mini43.z.optional(
11110
+ import_mini43.z.looseObject({
11111
+ trigger: import_mini43.z.optional(import_mini43.z.string()),
11112
+ globs: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string()))
10994
11113
  })
10995
11114
  )
10996
11115
  });
@@ -11293,20 +11412,20 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
11293
11412
 
11294
11413
  // src/features/rules/antigravity-rule.ts
11295
11414
  var import_node_path88 = require("path");
11296
- var import_mini43 = require("zod/mini");
11297
- var AntigravityRuleFrontmatterSchema = import_mini43.z.looseObject({
11298
- trigger: import_mini43.z.optional(
11299
- import_mini43.z.union([
11300
- import_mini43.z.literal("always_on"),
11301
- import_mini43.z.literal("glob"),
11302
- import_mini43.z.literal("manual"),
11303
- import_mini43.z.literal("model_decision"),
11304
- import_mini43.z.string()
11415
+ var import_mini44 = require("zod/mini");
11416
+ var AntigravityRuleFrontmatterSchema = import_mini44.z.looseObject({
11417
+ trigger: import_mini44.z.optional(
11418
+ import_mini44.z.union([
11419
+ import_mini44.z.literal("always_on"),
11420
+ import_mini44.z.literal("glob"),
11421
+ import_mini44.z.literal("manual"),
11422
+ import_mini44.z.literal("model_decision"),
11423
+ import_mini44.z.string()
11305
11424
  // accepts any string for forward compatibility
11306
11425
  ])
11307
11426
  ),
11308
- globs: import_mini43.z.optional(import_mini43.z.string()),
11309
- description: import_mini43.z.optional(import_mini43.z.string())
11427
+ globs: import_mini44.z.optional(import_mini44.z.string()),
11428
+ description: import_mini44.z.optional(import_mini44.z.string())
11310
11429
  });
11311
11430
  function parseGlobsString(globs) {
11312
11431
  if (!globs) {
@@ -11885,9 +12004,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
11885
12004
 
11886
12005
  // src/features/rules/claudecode-rule.ts
11887
12006
  var import_node_path92 = require("path");
11888
- var import_mini44 = require("zod/mini");
11889
- var ClaudecodeRuleFrontmatterSchema = import_mini44.z.object({
11890
- paths: import_mini44.z.optional(import_mini44.z.array(import_mini44.z.string()))
12007
+ var import_mini45 = require("zod/mini");
12008
+ var ClaudecodeRuleFrontmatterSchema = import_mini45.z.object({
12009
+ paths: import_mini45.z.optional(import_mini45.z.array(import_mini45.z.string()))
11891
12010
  });
11892
12011
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
11893
12012
  frontmatter;
@@ -12096,9 +12215,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
12096
12215
 
12097
12216
  // src/features/rules/cline-rule.ts
12098
12217
  var import_node_path93 = require("path");
12099
- var import_mini45 = require("zod/mini");
12100
- var ClineRuleFrontmatterSchema = import_mini45.z.object({
12101
- description: import_mini45.z.string()
12218
+ var import_mini46 = require("zod/mini");
12219
+ var ClineRuleFrontmatterSchema = import_mini46.z.object({
12220
+ description: import_mini46.z.string()
12102
12221
  });
12103
12222
  var ClineRule = class _ClineRule extends ToolRule {
12104
12223
  static getSettablePaths(_options = {}) {
@@ -12277,11 +12396,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
12277
12396
 
12278
12397
  // src/features/rules/copilot-rule.ts
12279
12398
  var import_node_path95 = require("path");
12280
- var import_mini46 = require("zod/mini");
12281
- var CopilotRuleFrontmatterSchema = import_mini46.z.object({
12282
- description: import_mini46.z.optional(import_mini46.z.string()),
12283
- applyTo: import_mini46.z.optional(import_mini46.z.string()),
12284
- excludeAgent: import_mini46.z.optional(import_mini46.z.union([import_mini46.z.literal("code-review"), import_mini46.z.literal("coding-agent")]))
12399
+ var import_mini47 = require("zod/mini");
12400
+ var CopilotRuleFrontmatterSchema = import_mini47.z.object({
12401
+ description: import_mini47.z.optional(import_mini47.z.string()),
12402
+ applyTo: import_mini47.z.optional(import_mini47.z.string()),
12403
+ excludeAgent: import_mini47.z.optional(import_mini47.z.union([import_mini47.z.literal("code-review"), import_mini47.z.literal("coding-agent")]))
12285
12404
  });
12286
12405
  var CopilotRule = class _CopilotRule extends ToolRule {
12287
12406
  frontmatter;
@@ -12484,11 +12603,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
12484
12603
 
12485
12604
  // src/features/rules/cursor-rule.ts
12486
12605
  var import_node_path96 = require("path");
12487
- var import_mini47 = require("zod/mini");
12488
- var CursorRuleFrontmatterSchema = import_mini47.z.object({
12489
- description: import_mini47.z.optional(import_mini47.z.string()),
12490
- globs: import_mini47.z.optional(import_mini47.z.string()),
12491
- alwaysApply: import_mini47.z.optional(import_mini47.z.boolean())
12606
+ var import_mini48 = require("zod/mini");
12607
+ var CursorRuleFrontmatterSchema = import_mini48.z.object({
12608
+ description: import_mini48.z.optional(import_mini48.z.string()),
12609
+ globs: import_mini48.z.optional(import_mini48.z.string()),
12610
+ alwaysApply: import_mini48.z.optional(import_mini48.z.boolean())
12492
12611
  });
12493
12612
  var CursorRule = class _CursorRule extends ToolRule {
12494
12613
  frontmatter;
@@ -12907,8 +13026,117 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
12907
13026
  }
12908
13027
  };
12909
13028
 
12910
- // src/features/rules/junie-rule.ts
13029
+ // src/features/rules/goose-rule.ts
12911
13030
  var import_node_path99 = require("path");
13031
+ var GooseRule = class _GooseRule extends ToolRule {
13032
+ static getSettablePaths({
13033
+ global,
13034
+ excludeToolDir
13035
+ } = {}) {
13036
+ if (global) {
13037
+ return {
13038
+ root: {
13039
+ relativeDirPath: ".",
13040
+ relativeFilePath: ".goosehints"
13041
+ }
13042
+ };
13043
+ }
13044
+ return {
13045
+ root: {
13046
+ relativeDirPath: ".",
13047
+ relativeFilePath: ".goosehints"
13048
+ },
13049
+ nonRoot: {
13050
+ relativeDirPath: buildToolPath(".goose", "memories", excludeToolDir)
13051
+ }
13052
+ };
13053
+ }
13054
+ static async fromFile({
13055
+ baseDir = process.cwd(),
13056
+ relativeFilePath,
13057
+ validate = true,
13058
+ global = false
13059
+ }) {
13060
+ const paths = this.getSettablePaths({ global });
13061
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
13062
+ if (isRoot) {
13063
+ const relativePath2 = paths.root.relativeFilePath;
13064
+ const fileContent2 = await readFileContent(
13065
+ (0, import_node_path99.join)(baseDir, paths.root.relativeDirPath, relativePath2)
13066
+ );
13067
+ return new _GooseRule({
13068
+ baseDir,
13069
+ relativeDirPath: paths.root.relativeDirPath,
13070
+ relativeFilePath: paths.root.relativeFilePath,
13071
+ fileContent: fileContent2,
13072
+ validate,
13073
+ root: true
13074
+ });
13075
+ }
13076
+ if (!paths.nonRoot) {
13077
+ throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13078
+ }
13079
+ const relativePath = (0, import_node_path99.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13080
+ const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
13081
+ return new _GooseRule({
13082
+ baseDir,
13083
+ relativeDirPath: paths.nonRoot.relativeDirPath,
13084
+ relativeFilePath,
13085
+ fileContent,
13086
+ validate,
13087
+ root: false
13088
+ });
13089
+ }
13090
+ static fromRulesyncRule({
13091
+ baseDir = process.cwd(),
13092
+ rulesyncRule,
13093
+ validate = true,
13094
+ global = false
13095
+ }) {
13096
+ const paths = this.getSettablePaths({ global });
13097
+ return new _GooseRule(
13098
+ this.buildToolRuleParamsDefault({
13099
+ baseDir,
13100
+ rulesyncRule,
13101
+ validate,
13102
+ rootPath: paths.root,
13103
+ nonRootPath: paths.nonRoot
13104
+ })
13105
+ );
13106
+ }
13107
+ toRulesyncRule() {
13108
+ return this.toRulesyncRuleDefault();
13109
+ }
13110
+ validate() {
13111
+ return { success: true, error: null };
13112
+ }
13113
+ static forDeletion({
13114
+ baseDir = process.cwd(),
13115
+ relativeDirPath,
13116
+ relativeFilePath,
13117
+ global = false
13118
+ }) {
13119
+ const paths = this.getSettablePaths({ global });
13120
+ const isRoot = relativeFilePath === paths.root.relativeFilePath;
13121
+ return new _GooseRule({
13122
+ baseDir,
13123
+ relativeDirPath,
13124
+ relativeFilePath,
13125
+ fileContent: "",
13126
+ validate: false,
13127
+ root: isRoot
13128
+ });
13129
+ }
13130
+ static isTargetedByRulesyncRule(rulesyncRule) {
13131
+ return this.isTargetedByRulesyncRuleDefault({
13132
+ rulesyncRule,
13133
+ toolTarget: "goose"
13134
+ });
13135
+ }
13136
+ };
13137
+
13138
+ // src/features/rules/junie-rule.ts
13139
+ var import_node_path100 = require("path");
12912
13140
  var JunieRule = class _JunieRule extends ToolRule {
12913
13141
  static getSettablePaths(_options = {}) {
12914
13142
  return {
@@ -12927,8 +13155,8 @@ var JunieRule = class _JunieRule extends ToolRule {
12927
13155
  validate = true
12928
13156
  }) {
12929
13157
  const isRoot = relativeFilePath === "guidelines.md";
12930
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path99.join)(".junie", "memories", relativeFilePath);
12931
- const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
13158
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path100.join)(".junie", "memories", relativeFilePath);
13159
+ const fileContent = await readFileContent((0, import_node_path100.join)(baseDir, relativePath));
12932
13160
  return new _JunieRule({
12933
13161
  baseDir,
12934
13162
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -12983,7 +13211,7 @@ var JunieRule = class _JunieRule extends ToolRule {
12983
13211
  };
12984
13212
 
12985
13213
  // src/features/rules/kilo-rule.ts
12986
- var import_node_path100 = require("path");
13214
+ var import_node_path101 = require("path");
12987
13215
  var KiloRule = class _KiloRule extends ToolRule {
12988
13216
  static getSettablePaths(_options = {}) {
12989
13217
  return {
@@ -12998,7 +13226,7 @@ var KiloRule = class _KiloRule extends ToolRule {
12998
13226
  validate = true
12999
13227
  }) {
13000
13228
  const fileContent = await readFileContent(
13001
- (0, import_node_path100.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13229
+ (0, import_node_path101.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13002
13230
  );
13003
13231
  return new _KiloRule({
13004
13232
  baseDir,
@@ -13050,7 +13278,7 @@ var KiloRule = class _KiloRule extends ToolRule {
13050
13278
  };
13051
13279
 
13052
13280
  // src/features/rules/kiro-rule.ts
13053
- var import_node_path101 = require("path");
13281
+ var import_node_path102 = require("path");
13054
13282
  var KiroRule = class _KiroRule extends ToolRule {
13055
13283
  static getSettablePaths(_options = {}) {
13056
13284
  return {
@@ -13065,7 +13293,7 @@ var KiroRule = class _KiroRule extends ToolRule {
13065
13293
  validate = true
13066
13294
  }) {
13067
13295
  const fileContent = await readFileContent(
13068
- (0, import_node_path101.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13296
+ (0, import_node_path102.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13069
13297
  );
13070
13298
  return new _KiroRule({
13071
13299
  baseDir,
@@ -13119,7 +13347,7 @@ var KiroRule = class _KiroRule extends ToolRule {
13119
13347
  };
13120
13348
 
13121
13349
  // src/features/rules/opencode-rule.ts
13122
- var import_node_path102 = require("path");
13350
+ var import_node_path103 = require("path");
13123
13351
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
13124
13352
  static getSettablePaths({
13125
13353
  global,
@@ -13154,7 +13382,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
13154
13382
  if (isRoot) {
13155
13383
  const relativePath2 = paths.root.relativeFilePath;
13156
13384
  const fileContent2 = await readFileContent(
13157
- (0, import_node_path102.join)(baseDir, paths.root.relativeDirPath, relativePath2)
13385
+ (0, import_node_path103.join)(baseDir, paths.root.relativeDirPath, relativePath2)
13158
13386
  );
13159
13387
  return new _OpenCodeRule({
13160
13388
  baseDir,
@@ -13168,8 +13396,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
13168
13396
  if (!paths.nonRoot) {
13169
13397
  throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
13170
13398
  }
13171
- const relativePath = (0, import_node_path102.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13172
- const fileContent = await readFileContent((0, import_node_path102.join)(baseDir, relativePath));
13399
+ const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
13400
+ const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
13173
13401
  return new _OpenCodeRule({
13174
13402
  baseDir,
13175
13403
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -13228,7 +13456,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
13228
13456
  };
13229
13457
 
13230
13458
  // src/features/rules/qwencode-rule.ts
13231
- var import_node_path103 = require("path");
13459
+ var import_node_path104 = require("path");
13232
13460
  var QwencodeRule = class _QwencodeRule extends ToolRule {
13233
13461
  static getSettablePaths(_options = {}) {
13234
13462
  return {
@@ -13247,8 +13475,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
13247
13475
  validate = true
13248
13476
  }) {
13249
13477
  const isRoot = relativeFilePath === "QWEN.md";
13250
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path103.join)(".qwen", "memories", relativeFilePath);
13251
- const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
13478
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path104.join)(".qwen", "memories", relativeFilePath);
13479
+ const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
13252
13480
  return new _QwencodeRule({
13253
13481
  baseDir,
13254
13482
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -13300,7 +13528,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
13300
13528
  };
13301
13529
 
13302
13530
  // src/features/rules/replit-rule.ts
13303
- var import_node_path104 = require("path");
13531
+ var import_node_path105 = require("path");
13304
13532
  var ReplitRule = class _ReplitRule extends ToolRule {
13305
13533
  static getSettablePaths(_options = {}) {
13306
13534
  return {
@@ -13322,7 +13550,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
13322
13550
  }
13323
13551
  const relativePath = paths.root.relativeFilePath;
13324
13552
  const fileContent = await readFileContent(
13325
- (0, import_node_path104.join)(baseDir, paths.root.relativeDirPath, relativePath)
13553
+ (0, import_node_path105.join)(baseDir, paths.root.relativeDirPath, relativePath)
13326
13554
  );
13327
13555
  return new _ReplitRule({
13328
13556
  baseDir,
@@ -13388,7 +13616,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
13388
13616
  };
13389
13617
 
13390
13618
  // src/features/rules/roo-rule.ts
13391
- var import_node_path105 = require("path");
13619
+ var import_node_path106 = require("path");
13392
13620
  var RooRule = class _RooRule extends ToolRule {
13393
13621
  static getSettablePaths(_options = {}) {
13394
13622
  return {
@@ -13403,7 +13631,7 @@ var RooRule = class _RooRule extends ToolRule {
13403
13631
  validate = true
13404
13632
  }) {
13405
13633
  const fileContent = await readFileContent(
13406
- (0, import_node_path105.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13634
+ (0, import_node_path106.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13407
13635
  );
13408
13636
  return new _RooRule({
13409
13637
  baseDir,
@@ -13472,7 +13700,7 @@ var RooRule = class _RooRule extends ToolRule {
13472
13700
  };
13473
13701
 
13474
13702
  // src/features/rules/warp-rule.ts
13475
- var import_node_path106 = require("path");
13703
+ var import_node_path107 = require("path");
13476
13704
  var WarpRule = class _WarpRule extends ToolRule {
13477
13705
  constructor({ fileContent, root, ...rest }) {
13478
13706
  super({
@@ -13498,8 +13726,8 @@ var WarpRule = class _WarpRule extends ToolRule {
13498
13726
  validate = true
13499
13727
  }) {
13500
13728
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
13501
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path106.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
13502
- const fileContent = await readFileContent((0, import_node_path106.join)(baseDir, relativePath));
13729
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path107.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
13730
+ const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
13503
13731
  return new _WarpRule({
13504
13732
  baseDir,
13505
13733
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -13554,7 +13782,7 @@ var WarpRule = class _WarpRule extends ToolRule {
13554
13782
  };
13555
13783
 
13556
13784
  // src/features/rules/windsurf-rule.ts
13557
- var import_node_path107 = require("path");
13785
+ var import_node_path108 = require("path");
13558
13786
  var WindsurfRule = class _WindsurfRule extends ToolRule {
13559
13787
  static getSettablePaths(_options = {}) {
13560
13788
  return {
@@ -13569,7 +13797,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
13569
13797
  validate = true
13570
13798
  }) {
13571
13799
  const fileContent = await readFileContent(
13572
- (0, import_node_path107.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13800
+ (0, import_node_path108.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
13573
13801
  );
13574
13802
  return new _WindsurfRule({
13575
13803
  baseDir,
@@ -13634,6 +13862,7 @@ var rulesProcessorToolTargets = [
13634
13862
  "cursor",
13635
13863
  "factorydroid",
13636
13864
  "geminicli",
13865
+ "goose",
13637
13866
  "junie",
13638
13867
  "kilo",
13639
13868
  "kiro",
@@ -13644,8 +13873,8 @@ var rulesProcessorToolTargets = [
13644
13873
  "warp",
13645
13874
  "windsurf"
13646
13875
  ];
13647
- var RulesProcessorToolTargetSchema = import_mini48.z.enum(rulesProcessorToolTargets);
13648
- var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path108.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
13876
+ var RulesProcessorToolTargetSchema = import_mini49.z.enum(rulesProcessorToolTargets);
13877
+ var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path109.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
13649
13878
  var toolRuleFactories = /* @__PURE__ */ new Map([
13650
13879
  [
13651
13880
  "agentsmd",
@@ -13736,10 +13965,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
13736
13965
  meta: {
13737
13966
  extension: "md",
13738
13967
  supportsGlobal: true,
13739
- ruleDiscoveryMode: "toon",
13740
- additionalConventions: {
13741
- subagents: { subagentClass: CodexCliSubagent }
13742
- }
13968
+ ruleDiscoveryMode: "toon"
13743
13969
  }
13744
13970
  }
13745
13971
  ],
@@ -13795,6 +14021,17 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
13795
14021
  }
13796
14022
  }
13797
14023
  ],
14024
+ [
14025
+ "goose",
14026
+ {
14027
+ class: GooseRule,
14028
+ meta: {
14029
+ extension: "md",
14030
+ supportsGlobal: true,
14031
+ ruleDiscoveryMode: "toon"
14032
+ }
14033
+ }
14034
+ ],
13798
14035
  [
13799
14036
  "junie",
13800
14037
  {
@@ -14012,7 +14249,7 @@ var RulesProcessor = class extends FeatureProcessor {
14012
14249
  }).relativeDirPath;
14013
14250
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
14014
14251
  const frontmatter = skill.getFrontmatter();
14015
- const relativePath = (0, import_node_path108.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
14252
+ const relativePath = (0, import_node_path109.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
14016
14253
  return {
14017
14254
  name: frontmatter.name,
14018
14255
  description: frontmatter.description,
@@ -14125,12 +14362,12 @@ var RulesProcessor = class extends FeatureProcessor {
14125
14362
  * Load and parse rulesync rule files from .rulesync/rules/ directory
14126
14363
  */
14127
14364
  async loadRulesyncFiles() {
14128
- const rulesyncBaseDir = (0, import_node_path108.join)(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
14129
- const files = await findFilesByGlobs((0, import_node_path108.join)(rulesyncBaseDir, "**", "*.md"));
14365
+ const rulesyncBaseDir = (0, import_node_path109.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
14366
+ const files = await findFilesByGlobs((0, import_node_path109.join)(rulesyncBaseDir, "**", "*.md"));
14130
14367
  logger.debug(`Found ${files.length} rulesync files`);
14131
14368
  const rulesyncRules = await Promise.all(
14132
14369
  files.map((file) => {
14133
- const relativeFilePath = (0, import_node_path108.relative)(rulesyncBaseDir, file);
14370
+ const relativeFilePath = (0, import_node_path109.relative)(rulesyncBaseDir, file);
14134
14371
  checkPathTraversal({
14135
14372
  relativePath: relativeFilePath,
14136
14373
  intendedRootDir: rulesyncBaseDir
@@ -14193,7 +14430,7 @@ var RulesProcessor = class extends FeatureProcessor {
14193
14430
  return [];
14194
14431
  }
14195
14432
  const rootFilePaths = await findFilesByGlobs(
14196
- (0, import_node_path108.join)(
14433
+ (0, import_node_path109.join)(
14197
14434
  this.baseDir,
14198
14435
  settablePaths.root.relativeDirPath ?? ".",
14199
14436
  settablePaths.root.relativeFilePath
@@ -14204,7 +14441,7 @@ var RulesProcessor = class extends FeatureProcessor {
14204
14441
  (filePath) => factory.class.forDeletion({
14205
14442
  baseDir: this.baseDir,
14206
14443
  relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
14207
- relativeFilePath: (0, import_node_path108.basename)(filePath),
14444
+ relativeFilePath: (0, import_node_path109.basename)(filePath),
14208
14445
  global: this.global
14209
14446
  })
14210
14447
  ).filter((rule) => rule.isDeletable());
@@ -14213,7 +14450,7 @@ var RulesProcessor = class extends FeatureProcessor {
14213
14450
  rootFilePaths.map(
14214
14451
  (filePath) => factory.class.fromFile({
14215
14452
  baseDir: this.baseDir,
14216
- relativeFilePath: (0, import_node_path108.basename)(filePath),
14453
+ relativeFilePath: (0, import_node_path109.basename)(filePath),
14217
14454
  global: this.global
14218
14455
  })
14219
14456
  )
@@ -14231,13 +14468,13 @@ var RulesProcessor = class extends FeatureProcessor {
14231
14468
  return [];
14232
14469
  }
14233
14470
  const localRootFilePaths = await findFilesByGlobs(
14234
- (0, import_node_path108.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
14471
+ (0, import_node_path109.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
14235
14472
  );
14236
14473
  return localRootFilePaths.map(
14237
14474
  (filePath) => factory.class.forDeletion({
14238
14475
  baseDir: this.baseDir,
14239
14476
  relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
14240
- relativeFilePath: (0, import_node_path108.basename)(filePath),
14477
+ relativeFilePath: (0, import_node_path109.basename)(filePath),
14241
14478
  global: this.global
14242
14479
  })
14243
14480
  ).filter((rule) => rule.isDeletable());
@@ -14247,13 +14484,13 @@ var RulesProcessor = class extends FeatureProcessor {
14247
14484
  if (!settablePaths.nonRoot) {
14248
14485
  return [];
14249
14486
  }
14250
- const nonRootBaseDir = (0, import_node_path108.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
14487
+ const nonRootBaseDir = (0, import_node_path109.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
14251
14488
  const nonRootFilePaths = await findFilesByGlobs(
14252
- (0, import_node_path108.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
14489
+ (0, import_node_path109.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
14253
14490
  );
14254
14491
  if (forDeletion) {
14255
14492
  return nonRootFilePaths.map((filePath) => {
14256
- const relativeFilePath = (0, import_node_path108.relative)(nonRootBaseDir, filePath);
14493
+ const relativeFilePath = (0, import_node_path109.relative)(nonRootBaseDir, filePath);
14257
14494
  checkPathTraversal({
14258
14495
  relativePath: relativeFilePath,
14259
14496
  intendedRootDir: nonRootBaseDir
@@ -14268,7 +14505,7 @@ var RulesProcessor = class extends FeatureProcessor {
14268
14505
  }
14269
14506
  return await Promise.all(
14270
14507
  nonRootFilePaths.map((filePath) => {
14271
- const relativeFilePath = (0, import_node_path108.relative)(nonRootBaseDir, filePath);
14508
+ const relativeFilePath = (0, import_node_path109.relative)(nonRootBaseDir, filePath);
14272
14509
  checkPathTraversal({
14273
14510
  relativePath: relativeFilePath,
14274
14511
  intendedRootDir: nonRootBaseDir
@@ -14381,14 +14618,14 @@ s/<command> [arguments]
14381
14618
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
14382
14619
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
14383
14620
 
14384
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path108.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
14621
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path109.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
14385
14622
  const subagentsSection = subagents ? `## Simulated Subagents
14386
14623
 
14387
14624
  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.
14388
14625
 
14389
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path108.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
14626
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path109.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
14390
14627
 
14391
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path108.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
14628
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path109.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
14392
14629
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
14393
14630
  const result = [
14394
14631
  overview,
@@ -14420,51 +14657,51 @@ var import_request_error = require("@octokit/request-error");
14420
14657
  var import_rest = require("@octokit/rest");
14421
14658
 
14422
14659
  // src/types/fetch.ts
14423
- var import_mini50 = require("zod/mini");
14660
+ var import_mini51 = require("zod/mini");
14424
14661
 
14425
14662
  // src/types/fetch-targets.ts
14426
- var import_mini49 = require("zod/mini");
14663
+ var import_mini50 = require("zod/mini");
14427
14664
  var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
14428
- var FetchTargetSchema = import_mini49.z.enum(ALL_FETCH_TARGETS);
14665
+ var FetchTargetSchema = import_mini50.z.enum(ALL_FETCH_TARGETS);
14429
14666
 
14430
14667
  // src/types/fetch.ts
14431
- var ConflictStrategySchema = import_mini50.z.enum(["skip", "overwrite"]);
14432
- var GitHubFileTypeSchema = import_mini50.z.enum(["file", "dir", "symlink", "submodule"]);
14433
- var GitHubFileEntrySchema = import_mini50.z.looseObject({
14434
- name: import_mini50.z.string(),
14435
- path: import_mini50.z.string(),
14436
- sha: import_mini50.z.string(),
14437
- size: import_mini50.z.number(),
14668
+ var ConflictStrategySchema = import_mini51.z.enum(["skip", "overwrite"]);
14669
+ var GitHubFileTypeSchema = import_mini51.z.enum(["file", "dir", "symlink", "submodule"]);
14670
+ var GitHubFileEntrySchema = import_mini51.z.looseObject({
14671
+ name: import_mini51.z.string(),
14672
+ path: import_mini51.z.string(),
14673
+ sha: import_mini51.z.string(),
14674
+ size: import_mini51.z.number(),
14438
14675
  type: GitHubFileTypeSchema,
14439
- download_url: import_mini50.z.nullable(import_mini50.z.string())
14676
+ download_url: import_mini51.z.nullable(import_mini51.z.string())
14440
14677
  });
14441
- var FetchOptionsSchema = import_mini50.z.looseObject({
14442
- target: import_mini50.z.optional(FetchTargetSchema),
14443
- features: import_mini50.z.optional(import_mini50.z.array(import_mini50.z.enum(ALL_FEATURES_WITH_WILDCARD))),
14444
- ref: import_mini50.z.optional(import_mini50.z.string()),
14445
- path: import_mini50.z.optional(import_mini50.z.string()),
14446
- output: import_mini50.z.optional(import_mini50.z.string()),
14447
- conflict: import_mini50.z.optional(ConflictStrategySchema),
14448
- token: import_mini50.z.optional(import_mini50.z.string()),
14449
- verbose: import_mini50.z.optional(import_mini50.z.boolean()),
14450
- silent: import_mini50.z.optional(import_mini50.z.boolean())
14678
+ var FetchOptionsSchema = import_mini51.z.looseObject({
14679
+ target: import_mini51.z.optional(FetchTargetSchema),
14680
+ features: import_mini51.z.optional(import_mini51.z.array(import_mini51.z.enum(ALL_FEATURES_WITH_WILDCARD))),
14681
+ ref: import_mini51.z.optional(import_mini51.z.string()),
14682
+ path: import_mini51.z.optional(import_mini51.z.string()),
14683
+ output: import_mini51.z.optional(import_mini51.z.string()),
14684
+ conflict: import_mini51.z.optional(ConflictStrategySchema),
14685
+ token: import_mini51.z.optional(import_mini51.z.string()),
14686
+ verbose: import_mini51.z.optional(import_mini51.z.boolean()),
14687
+ silent: import_mini51.z.optional(import_mini51.z.boolean())
14451
14688
  });
14452
- var FetchFileStatusSchema = import_mini50.z.enum(["created", "overwritten", "skipped"]);
14453
- var GitHubRepoInfoSchema = import_mini50.z.looseObject({
14454
- default_branch: import_mini50.z.string(),
14455
- private: import_mini50.z.boolean()
14689
+ var FetchFileStatusSchema = import_mini51.z.enum(["created", "overwritten", "skipped"]);
14690
+ var GitHubRepoInfoSchema = import_mini51.z.looseObject({
14691
+ default_branch: import_mini51.z.string(),
14692
+ private: import_mini51.z.boolean()
14456
14693
  });
14457
- var GitHubReleaseAssetSchema = import_mini50.z.looseObject({
14458
- name: import_mini50.z.string(),
14459
- browser_download_url: import_mini50.z.string(),
14460
- size: import_mini50.z.number()
14694
+ var GitHubReleaseAssetSchema = import_mini51.z.looseObject({
14695
+ name: import_mini51.z.string(),
14696
+ browser_download_url: import_mini51.z.string(),
14697
+ size: import_mini51.z.number()
14461
14698
  });
14462
- var GitHubReleaseSchema = import_mini50.z.looseObject({
14463
- tag_name: import_mini50.z.string(),
14464
- name: import_mini50.z.nullable(import_mini50.z.string()),
14465
- prerelease: import_mini50.z.boolean(),
14466
- draft: import_mini50.z.boolean(),
14467
- assets: import_mini50.z.array(GitHubReleaseAssetSchema)
14699
+ var GitHubReleaseSchema = import_mini51.z.looseObject({
14700
+ tag_name: import_mini51.z.string(),
14701
+ name: import_mini51.z.nullable(import_mini51.z.string()),
14702
+ prerelease: import_mini51.z.boolean(),
14703
+ draft: import_mini51.z.boolean(),
14704
+ assets: import_mini51.z.array(GitHubReleaseAssetSchema)
14468
14705
  });
14469
14706
 
14470
14707
  // src/lib/github-client.ts
@@ -14764,9 +15001,9 @@ async function listDirectoryRecursive(params) {
14764
15001
  }
14765
15002
 
14766
15003
  // src/types/git-provider.ts
14767
- var import_mini51 = require("zod/mini");
15004
+ var import_mini52 = require("zod/mini");
14768
15005
  var ALL_GIT_PROVIDERS = ["github", "gitlab"];
14769
- var GitProviderSchema = import_mini51.z.enum(ALL_GIT_PROVIDERS);
15006
+ var GitProviderSchema = import_mini52.z.enum(ALL_GIT_PROVIDERS);
14770
15007
 
14771
15008
  // src/lib/source-parser.ts
14772
15009
  var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
@@ -14891,8 +15128,8 @@ async function processFeatureConversion(params) {
14891
15128
  }
14892
15129
  const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
14893
15130
  for (const file of rulesyncFiles) {
14894
- const relativePath = (0, import_node_path109.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
14895
- const outputPath = (0, import_node_path109.join)(outputDir, relativePath);
15131
+ const relativePath = (0, import_node_path110.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
15132
+ const outputPath = (0, import_node_path110.join)(outputDir, relativePath);
14896
15133
  await writeFileContent(outputPath, file.getFileContent());
14897
15134
  paths.push(relativePath);
14898
15135
  }
@@ -15038,7 +15275,7 @@ async function fetchFiles(params) {
15038
15275
  skipped: 0
15039
15276
  };
15040
15277
  }
15041
- const outputBasePath = (0, import_node_path109.join)(baseDir, outputDir);
15278
+ const outputBasePath = (0, import_node_path110.join)(baseDir, outputDir);
15042
15279
  for (const { relativePath, size } of filesToFetch) {
15043
15280
  checkPathTraversal({
15044
15281
  relativePath,
@@ -15048,7 +15285,7 @@ async function fetchFiles(params) {
15048
15285
  }
15049
15286
  const results = await Promise.all(
15050
15287
  filesToFetch.map(async ({ remotePath, relativePath }) => {
15051
- const localPath = (0, import_node_path109.join)(outputBasePath, relativePath);
15288
+ const localPath = (0, import_node_path110.join)(outputBasePath, relativePath);
15052
15289
  const exists = await fileExists(localPath);
15053
15290
  if (exists && conflictStrategy === "skip") {
15054
15291
  logger.debug(`Skipping existing file: ${relativePath}`);
@@ -15090,7 +15327,7 @@ async function collectFeatureFiles(params) {
15090
15327
  );
15091
15328
  const results = await Promise.all(
15092
15329
  tasks.map(async ({ featurePath }) => {
15093
- const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path109.join)(basePath, featurePath);
15330
+ const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path110.join)(basePath, featurePath);
15094
15331
  const collected = [];
15095
15332
  try {
15096
15333
  if (featurePath.includes(".")) {
@@ -15190,7 +15427,7 @@ async function fetchAndConvertToolFiles(params) {
15190
15427
  relativePath: toolRelativePath,
15191
15428
  intendedRootDir: tempDir
15192
15429
  });
15193
- const localPath = (0, import_node_path109.join)(tempDir, toolRelativePath);
15430
+ const localPath = (0, import_node_path110.join)(tempDir, toolRelativePath);
15194
15431
  const content = await withSemaphore(
15195
15432
  semaphore,
15196
15433
  () => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
@@ -15199,7 +15436,7 @@ async function fetchAndConvertToolFiles(params) {
15199
15436
  logger.debug(`Fetched to temp: ${toolRelativePath}`);
15200
15437
  })
15201
15438
  );
15202
- const outputBasePath = (0, import_node_path109.join)(baseDir, outputDir);
15439
+ const outputBasePath = (0, import_node_path110.join)(baseDir, outputDir);
15203
15440
  const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
15204
15441
  tempDir,
15205
15442
  outputDir: outputBasePath,
@@ -15272,7 +15509,7 @@ function mapToToolPath(relativePath, toolPaths) {
15272
15509
  if (relativePath.startsWith("rules/")) {
15273
15510
  const restPath = relativePath.substring("rules/".length);
15274
15511
  if (toolPaths.rules?.nonRoot) {
15275
- return (0, import_node_path109.join)(toolPaths.rules.nonRoot, restPath);
15512
+ return (0, import_node_path110.join)(toolPaths.rules.nonRoot, restPath);
15276
15513
  }
15277
15514
  }
15278
15515
  if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
@@ -15281,19 +15518,19 @@ function mapToToolPath(relativePath, toolPaths) {
15281
15518
  if (relativePath.startsWith("commands/")) {
15282
15519
  const restPath = relativePath.substring("commands/".length);
15283
15520
  if (toolPaths.commands) {
15284
- return (0, import_node_path109.join)(toolPaths.commands, restPath);
15521
+ return (0, import_node_path110.join)(toolPaths.commands, restPath);
15285
15522
  }
15286
15523
  }
15287
15524
  if (relativePath.startsWith("subagents/")) {
15288
15525
  const restPath = relativePath.substring("subagents/".length);
15289
15526
  if (toolPaths.subagents) {
15290
- return (0, import_node_path109.join)(toolPaths.subagents, restPath);
15527
+ return (0, import_node_path110.join)(toolPaths.subagents, restPath);
15291
15528
  }
15292
15529
  }
15293
15530
  if (relativePath.startsWith("skills/")) {
15294
15531
  const restPath = relativePath.substring("skills/".length);
15295
15532
  if (toolPaths.skills) {
15296
- return (0, import_node_path109.join)(toolPaths.skills, restPath);
15533
+ return (0, import_node_path110.join)(toolPaths.skills, restPath);
15297
15534
  }
15298
15535
  }
15299
15536
  return relativePath;
@@ -15346,37 +15583,37 @@ async function fetchCommand(options) {
15346
15583
 
15347
15584
  // src/config/config-resolver.ts
15348
15585
  var import_jsonc_parser = require("jsonc-parser");
15349
- var import_node_path110 = require("path");
15586
+ var import_node_path111 = require("path");
15350
15587
 
15351
15588
  // src/config/config.ts
15352
- var import_mini52 = require("zod/mini");
15353
- var SourceEntrySchema = import_mini52.z.object({
15354
- source: import_mini52.z.string().check((0, import_mini52.minLength)(1, "source must be a non-empty string")),
15355
- skills: (0, import_mini52.optional)(import_mini52.z.array(import_mini52.z.string()))
15589
+ var import_mini53 = require("zod/mini");
15590
+ var SourceEntrySchema = import_mini53.z.object({
15591
+ source: import_mini53.z.string().check((0, import_mini53.minLength)(1, "source must be a non-empty string")),
15592
+ skills: (0, import_mini53.optional)(import_mini53.z.array(import_mini53.z.string()))
15356
15593
  });
15357
- var ConfigParamsSchema = import_mini52.z.object({
15358
- baseDirs: import_mini52.z.array(import_mini52.z.string()),
15594
+ var ConfigParamsSchema = import_mini53.z.object({
15595
+ baseDirs: import_mini53.z.array(import_mini53.z.string()),
15359
15596
  targets: RulesyncTargetsSchema,
15360
15597
  features: RulesyncFeaturesSchema,
15361
- verbose: import_mini52.z.boolean(),
15362
- delete: import_mini52.z.boolean(),
15598
+ verbose: import_mini53.z.boolean(),
15599
+ delete: import_mini53.z.boolean(),
15363
15600
  // New non-experimental options
15364
- global: (0, import_mini52.optional)(import_mini52.z.boolean()),
15365
- silent: (0, import_mini52.optional)(import_mini52.z.boolean()),
15366
- simulateCommands: (0, import_mini52.optional)(import_mini52.z.boolean()),
15367
- simulateSubagents: (0, import_mini52.optional)(import_mini52.z.boolean()),
15368
- simulateSkills: (0, import_mini52.optional)(import_mini52.z.boolean()),
15369
- dryRun: (0, import_mini52.optional)(import_mini52.z.boolean()),
15370
- check: (0, import_mini52.optional)(import_mini52.z.boolean()),
15601
+ global: (0, import_mini53.optional)(import_mini53.z.boolean()),
15602
+ silent: (0, import_mini53.optional)(import_mini53.z.boolean()),
15603
+ simulateCommands: (0, import_mini53.optional)(import_mini53.z.boolean()),
15604
+ simulateSubagents: (0, import_mini53.optional)(import_mini53.z.boolean()),
15605
+ simulateSkills: (0, import_mini53.optional)(import_mini53.z.boolean()),
15606
+ dryRun: (0, import_mini53.optional)(import_mini53.z.boolean()),
15607
+ check: (0, import_mini53.optional)(import_mini53.z.boolean()),
15371
15608
  // Declarative skill sources
15372
- sources: (0, import_mini52.optional)(import_mini52.z.array(SourceEntrySchema))
15609
+ sources: (0, import_mini53.optional)(import_mini53.z.array(SourceEntrySchema))
15373
15610
  });
15374
- var PartialConfigParamsSchema = import_mini52.z.partial(ConfigParamsSchema);
15375
- var ConfigFileSchema = import_mini52.z.object({
15376
- $schema: (0, import_mini52.optional)(import_mini52.z.string()),
15377
- ...import_mini52.z.partial(ConfigParamsSchema).shape
15611
+ var PartialConfigParamsSchema = import_mini53.z.partial(ConfigParamsSchema);
15612
+ var ConfigFileSchema = import_mini53.z.object({
15613
+ $schema: (0, import_mini53.optional)(import_mini53.z.string()),
15614
+ ...import_mini53.z.partial(ConfigParamsSchema).shape
15378
15615
  });
15379
- var RequiredConfigParamsSchema = import_mini52.z.required(ConfigParamsSchema);
15616
+ var RequiredConfigParamsSchema = import_mini53.z.required(ConfigParamsSchema);
15380
15617
  var CONFLICTING_TARGET_PAIRS = [
15381
15618
  ["augmentcode", "augmentcode-legacy"],
15382
15619
  ["claudecode", "claudecode-legacy"]
@@ -15597,8 +15834,8 @@ var ConfigResolver = class {
15597
15834
  }) {
15598
15835
  const validatedConfigPath = resolvePath(configPath, process.cwd());
15599
15836
  const baseConfig = await loadConfigFromFile(validatedConfigPath);
15600
- const configDir = (0, import_node_path110.dirname)(validatedConfigPath);
15601
- const localConfigPath = (0, import_node_path110.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
15837
+ const configDir = (0, import_node_path111.dirname)(validatedConfigPath);
15838
+ const localConfigPath = (0, import_node_path111.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
15602
15839
  const localConfig = await loadConfigFromFile(localConfigPath);
15603
15840
  const configByFile = mergeConfigs(baseConfig, localConfig);
15604
15841
  const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
@@ -15633,7 +15870,7 @@ function getBaseDirsInLightOfGlobal({
15633
15870
  if (global) {
15634
15871
  return [getHomeDirectory()];
15635
15872
  }
15636
- const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path110.resolve)(baseDir));
15873
+ const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path111.resolve)(baseDir));
15637
15874
  resolvedBaseDirs.forEach((baseDir) => {
15638
15875
  validateBaseDir(baseDir);
15639
15876
  });
@@ -15642,7 +15879,7 @@ function getBaseDirsInLightOfGlobal({
15642
15879
 
15643
15880
  // src/lib/generate.ts
15644
15881
  var import_es_toolkit4 = require("es-toolkit");
15645
- var import_node_path111 = require("path");
15882
+ var import_node_path112 = require("path");
15646
15883
  async function processFeatureGeneration(params) {
15647
15884
  const { config, processor, toolFiles } = params;
15648
15885
  let totalCount = 0;
@@ -15687,7 +15924,7 @@ async function processEmptyFeatureGeneration(params) {
15687
15924
  return { count: totalCount, paths: [], hasDiff };
15688
15925
  }
15689
15926
  async function checkRulesyncDirExists(params) {
15690
- return fileExists((0, import_node_path111.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
15927
+ return fileExists((0, import_node_path112.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
15691
15928
  }
15692
15929
  async function generate(params) {
15693
15930
  const { config } = params;
@@ -16133,7 +16370,7 @@ async function generateCommand(options) {
16133
16370
  }
16134
16371
 
16135
16372
  // src/cli/commands/gitignore.ts
16136
- var import_node_path112 = require("path");
16373
+ var import_node_path113 = require("path");
16137
16374
  var RULESYNC_HEADER = "# Generated by Rulesync";
16138
16375
  var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
16139
16376
  var RULESYNC_IGNORE_ENTRIES = [
@@ -16167,7 +16404,8 @@ var RULESYNC_IGNORE_ENTRIES = [
16167
16404
  "**/.codexignore",
16168
16405
  "**/.codex/memories/",
16169
16406
  "**/.codex/skills/",
16170
- "**/.codex/subagents/",
16407
+ "**/.codex/agents/",
16408
+ "**/.codex/config.toml",
16171
16409
  // Cursor
16172
16410
  "**/.cursor/",
16173
16411
  "**/.cursorignore",
@@ -16185,6 +16423,10 @@ var RULESYNC_IGNORE_ENTRIES = [
16185
16423
  "**/.gemini/subagents/",
16186
16424
  "**/.gemini/skills/",
16187
16425
  "**/.geminiignore",
16426
+ // Goose
16427
+ "**/.goosehints",
16428
+ "**/.goose/",
16429
+ "**/.gooseignore",
16188
16430
  // GitHub Copilot
16189
16431
  "**/.github/copilot-instructions.md",
16190
16432
  "**/.github/instructions/",
@@ -16283,7 +16525,7 @@ var removeExistingRulesyncEntries = (content) => {
16283
16525
  return result;
16284
16526
  };
16285
16527
  var gitignoreCommand = async () => {
16286
- const gitignorePath = (0, import_node_path112.join)(process.cwd(), ".gitignore");
16528
+ const gitignorePath = (0, import_node_path113.join)(process.cwd(), ".gitignore");
16287
16529
  let gitignoreContent = "";
16288
16530
  if (await fileExists(gitignorePath)) {
16289
16531
  gitignoreContent = await readFileContent(gitignorePath);
@@ -16563,7 +16805,7 @@ async function importCommand(options) {
16563
16805
  }
16564
16806
 
16565
16807
  // src/lib/init.ts
16566
- var import_node_path113 = require("path");
16808
+ var import_node_path114 = require("path");
16567
16809
  async function init() {
16568
16810
  const sampleFiles = await createSampleFiles();
16569
16811
  const configFile = await createConfigFile();
@@ -16753,27 +16995,27 @@ Keep the summary concise and ready to reuse in future tasks.`
16753
16995
  await ensureDir(subagentPaths.relativeDirPath);
16754
16996
  await ensureDir(skillPaths.relativeDirPath);
16755
16997
  await ensureDir(ignorePaths.recommended.relativeDirPath);
16756
- const ruleFilepath = (0, import_node_path113.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
16998
+ const ruleFilepath = (0, import_node_path114.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
16757
16999
  results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
16758
- const mcpFilepath = (0, import_node_path113.join)(
17000
+ const mcpFilepath = (0, import_node_path114.join)(
16759
17001
  mcpPaths.recommended.relativeDirPath,
16760
17002
  mcpPaths.recommended.relativeFilePath
16761
17003
  );
16762
17004
  results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
16763
- const commandFilepath = (0, import_node_path113.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
17005
+ const commandFilepath = (0, import_node_path114.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
16764
17006
  results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
16765
- const subagentFilepath = (0, import_node_path113.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
17007
+ const subagentFilepath = (0, import_node_path114.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
16766
17008
  results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
16767
- const skillDirPath = (0, import_node_path113.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
17009
+ const skillDirPath = (0, import_node_path114.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
16768
17010
  await ensureDir(skillDirPath);
16769
- const skillFilepath = (0, import_node_path113.join)(skillDirPath, SKILL_FILE_NAME);
17011
+ const skillFilepath = (0, import_node_path114.join)(skillDirPath, SKILL_FILE_NAME);
16770
17012
  results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
16771
- const ignoreFilepath = (0, import_node_path113.join)(
17013
+ const ignoreFilepath = (0, import_node_path114.join)(
16772
17014
  ignorePaths.recommended.relativeDirPath,
16773
17015
  ignorePaths.recommended.relativeFilePath
16774
17016
  );
16775
17017
  results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
16776
- const hooksFilepath = (0, import_node_path113.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
17018
+ const hooksFilepath = (0, import_node_path114.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
16777
17019
  results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
16778
17020
  return results;
16779
17021
  }
@@ -16812,32 +17054,32 @@ async function initCommand() {
16812
17054
 
16813
17055
  // src/lib/sources.ts
16814
17056
  var import_promise2 = require("es-toolkit/promise");
16815
- var import_node_path115 = require("path");
17057
+ var import_node_path116 = require("path");
16816
17058
 
16817
17059
  // src/lib/sources-lock.ts
16818
17060
  var import_node_crypto = require("crypto");
16819
- var import_node_path114 = require("path");
16820
- var import_mini53 = require("zod/mini");
17061
+ var import_node_path115 = require("path");
17062
+ var import_mini54 = require("zod/mini");
16821
17063
  var LOCKFILE_VERSION = 1;
16822
- var LockedSkillSchema = import_mini53.z.object({
16823
- integrity: import_mini53.z.string()
17064
+ var LockedSkillSchema = import_mini54.z.object({
17065
+ integrity: import_mini54.z.string()
16824
17066
  });
16825
- var LockedSourceSchema = import_mini53.z.object({
16826
- requestedRef: (0, import_mini53.optional)(import_mini53.z.string()),
16827
- resolvedRef: import_mini53.z.string(),
16828
- resolvedAt: (0, import_mini53.optional)(import_mini53.z.string()),
16829
- skills: import_mini53.z.record(import_mini53.z.string(), LockedSkillSchema)
17067
+ var LockedSourceSchema = import_mini54.z.object({
17068
+ requestedRef: (0, import_mini54.optional)(import_mini54.z.string()),
17069
+ resolvedRef: import_mini54.z.string(),
17070
+ resolvedAt: (0, import_mini54.optional)(import_mini54.z.string()),
17071
+ skills: import_mini54.z.record(import_mini54.z.string(), LockedSkillSchema)
16830
17072
  });
16831
- var SourcesLockSchema = import_mini53.z.object({
16832
- lockfileVersion: import_mini53.z.number(),
16833
- sources: import_mini53.z.record(import_mini53.z.string(), LockedSourceSchema)
17073
+ var SourcesLockSchema = import_mini54.z.object({
17074
+ lockfileVersion: import_mini54.z.number(),
17075
+ sources: import_mini54.z.record(import_mini54.z.string(), LockedSourceSchema)
16834
17076
  });
16835
- var LegacyLockedSourceSchema = import_mini53.z.object({
16836
- resolvedRef: import_mini53.z.string(),
16837
- skills: import_mini53.z.array(import_mini53.z.string())
17077
+ var LegacyLockedSourceSchema = import_mini54.z.object({
17078
+ resolvedRef: import_mini54.z.string(),
17079
+ skills: import_mini54.z.array(import_mini54.z.string())
16838
17080
  });
16839
- var LegacySourcesLockSchema = import_mini53.z.object({
16840
- sources: import_mini53.z.record(import_mini53.z.string(), LegacyLockedSourceSchema)
17081
+ var LegacySourcesLockSchema = import_mini54.z.object({
17082
+ sources: import_mini54.z.record(import_mini54.z.string(), LegacyLockedSourceSchema)
16841
17083
  });
16842
17084
  function migrateLegacyLock(legacy) {
16843
17085
  const sources = {};
@@ -16860,7 +17102,7 @@ function createEmptyLock() {
16860
17102
  return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
16861
17103
  }
16862
17104
  async function readLockFile(params) {
16863
- const lockPath = (0, import_node_path114.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
17105
+ const lockPath = (0, import_node_path115.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
16864
17106
  if (!await fileExists(lockPath)) {
16865
17107
  logger.debug("No sources lockfile found, starting fresh.");
16866
17108
  return createEmptyLock();
@@ -16888,7 +17130,7 @@ async function readLockFile(params) {
16888
17130
  }
16889
17131
  }
16890
17132
  async function writeLockFile(params) {
16891
- const lockPath = (0, import_node_path114.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
17133
+ const lockPath = (0, import_node_path115.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
16892
17134
  const content = JSON.stringify(params.lock, null, 2) + "\n";
16893
17135
  await writeFileContent(lockPath, content);
16894
17136
  logger.debug(`Wrote sources lockfile to ${lockPath}`);
@@ -17029,7 +17271,7 @@ async function resolveAndFetchSources(params) {
17029
17271
  async function checkLockedSkillsExist(curatedDir, skillNames) {
17030
17272
  if (skillNames.length === 0) return true;
17031
17273
  for (const name of skillNames) {
17032
- if (!await directoryExists((0, import_node_path115.join)(curatedDir, name))) {
17274
+ if (!await directoryExists((0, import_node_path116.join)(curatedDir, name))) {
17033
17275
  return false;
17034
17276
  }
17035
17277
  }
@@ -17059,7 +17301,7 @@ async function fetchSource(params) {
17059
17301
  ref = resolvedSha;
17060
17302
  logger.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
17061
17303
  }
17062
- const curatedDir = (0, import_node_path115.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
17304
+ const curatedDir = (0, import_node_path116.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
17063
17305
  if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
17064
17306
  const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
17065
17307
  if (allExist) {
@@ -17089,10 +17331,10 @@ async function fetchSource(params) {
17089
17331
  const semaphore = new import_promise2.Semaphore(FETCH_CONCURRENCY_LIMIT);
17090
17332
  const fetchedSkills = {};
17091
17333
  if (locked) {
17092
- const resolvedCuratedDir = (0, import_node_path115.resolve)(curatedDir);
17334
+ const resolvedCuratedDir = (0, import_node_path116.resolve)(curatedDir);
17093
17335
  for (const prevSkill of lockedSkillNames) {
17094
- const prevDir = (0, import_node_path115.join)(curatedDir, prevSkill);
17095
- if (!(0, import_node_path115.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path115.sep)) {
17336
+ const prevDir = (0, import_node_path116.join)(curatedDir, prevSkill);
17337
+ if (!(0, import_node_path116.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path116.sep)) {
17096
17338
  logger.warn(
17097
17339
  `Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
17098
17340
  );
@@ -17142,10 +17384,10 @@ async function fetchSource(params) {
17142
17384
  const skillFiles = [];
17143
17385
  for (const file of files) {
17144
17386
  const relativeToSkill = file.path.substring(skillDir.path.length + 1);
17145
- const localFilePath = (0, import_node_path115.join)(curatedDir, skillDir.name, relativeToSkill);
17387
+ const localFilePath = (0, import_node_path116.join)(curatedDir, skillDir.name, relativeToSkill);
17146
17388
  checkPathTraversal({
17147
17389
  relativePath: relativeToSkill,
17148
- intendedRootDir: (0, import_node_path115.join)(curatedDir, skillDir.name)
17390
+ intendedRootDir: (0, import_node_path116.join)(curatedDir, skillDir.name)
17149
17391
  });
17150
17392
  const content = await withSemaphore(
17151
17393
  semaphore,
@@ -17228,15 +17470,15 @@ async function installCommand(options) {
17228
17470
  var import_fastmcp = require("fastmcp");
17229
17471
 
17230
17472
  // src/mcp/tools.ts
17231
- var import_mini62 = require("zod/mini");
17473
+ var import_mini63 = require("zod/mini");
17232
17474
 
17233
17475
  // src/mcp/commands.ts
17234
- var import_node_path116 = require("path");
17235
- var import_mini54 = require("zod/mini");
17476
+ var import_node_path117 = require("path");
17477
+ var import_mini55 = require("zod/mini");
17236
17478
  var maxCommandSizeBytes = 1024 * 1024;
17237
17479
  var maxCommandsCount = 1e3;
17238
17480
  async function listCommands() {
17239
- const commandsDir = (0, import_node_path116.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
17481
+ const commandsDir = (0, import_node_path117.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
17240
17482
  try {
17241
17483
  const files = await listDirectoryFiles(commandsDir);
17242
17484
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -17248,7 +17490,7 @@ async function listCommands() {
17248
17490
  });
17249
17491
  const frontmatter = command.getFrontmatter();
17250
17492
  return {
17251
- relativePathFromCwd: (0, import_node_path116.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
17493
+ relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
17252
17494
  frontmatter
17253
17495
  };
17254
17496
  } catch (error) {
@@ -17270,13 +17512,13 @@ async function getCommand({ relativePathFromCwd }) {
17270
17512
  relativePath: relativePathFromCwd,
17271
17513
  intendedRootDir: process.cwd()
17272
17514
  });
17273
- const filename = (0, import_node_path116.basename)(relativePathFromCwd);
17515
+ const filename = (0, import_node_path117.basename)(relativePathFromCwd);
17274
17516
  try {
17275
17517
  const command = await RulesyncCommand.fromFile({
17276
17518
  relativeFilePath: filename
17277
17519
  });
17278
17520
  return {
17279
- relativePathFromCwd: (0, import_node_path116.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
17521
+ relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
17280
17522
  frontmatter: command.getFrontmatter(),
17281
17523
  body: command.getBody()
17282
17524
  };
@@ -17295,7 +17537,7 @@ async function putCommand({
17295
17537
  relativePath: relativePathFromCwd,
17296
17538
  intendedRootDir: process.cwd()
17297
17539
  });
17298
- const filename = (0, import_node_path116.basename)(relativePathFromCwd);
17540
+ const filename = (0, import_node_path117.basename)(relativePathFromCwd);
17299
17541
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
17300
17542
  if (estimatedSize > maxCommandSizeBytes) {
17301
17543
  throw new Error(
@@ -17305,7 +17547,7 @@ async function putCommand({
17305
17547
  try {
17306
17548
  const existingCommands = await listCommands();
17307
17549
  const isUpdate = existingCommands.some(
17308
- (command2) => command2.relativePathFromCwd === (0, import_node_path116.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
17550
+ (command2) => command2.relativePathFromCwd === (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
17309
17551
  );
17310
17552
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
17311
17553
  throw new Error(
@@ -17322,11 +17564,11 @@ async function putCommand({
17322
17564
  fileContent,
17323
17565
  validate: true
17324
17566
  });
17325
- const commandsDir = (0, import_node_path116.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
17567
+ const commandsDir = (0, import_node_path117.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
17326
17568
  await ensureDir(commandsDir);
17327
17569
  await writeFileContent(command.getFilePath(), command.getFileContent());
17328
17570
  return {
17329
- relativePathFromCwd: (0, import_node_path116.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
17571
+ relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
17330
17572
  frontmatter: command.getFrontmatter(),
17331
17573
  body: command.getBody()
17332
17574
  };
@@ -17341,12 +17583,12 @@ async function deleteCommand({ relativePathFromCwd }) {
17341
17583
  relativePath: relativePathFromCwd,
17342
17584
  intendedRootDir: process.cwd()
17343
17585
  });
17344
- const filename = (0, import_node_path116.basename)(relativePathFromCwd);
17345
- const fullPath = (0, import_node_path116.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
17586
+ const filename = (0, import_node_path117.basename)(relativePathFromCwd);
17587
+ const fullPath = (0, import_node_path117.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
17346
17588
  try {
17347
17589
  await removeFile(fullPath);
17348
17590
  return {
17349
- relativePathFromCwd: (0, import_node_path116.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
17591
+ relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
17350
17592
  };
17351
17593
  } catch (error) {
17352
17594
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -17355,23 +17597,23 @@ async function deleteCommand({ relativePathFromCwd }) {
17355
17597
  }
17356
17598
  }
17357
17599
  var commandToolSchemas = {
17358
- listCommands: import_mini54.z.object({}),
17359
- getCommand: import_mini54.z.object({
17360
- relativePathFromCwd: import_mini54.z.string()
17600
+ listCommands: import_mini55.z.object({}),
17601
+ getCommand: import_mini55.z.object({
17602
+ relativePathFromCwd: import_mini55.z.string()
17361
17603
  }),
17362
- putCommand: import_mini54.z.object({
17363
- relativePathFromCwd: import_mini54.z.string(),
17604
+ putCommand: import_mini55.z.object({
17605
+ relativePathFromCwd: import_mini55.z.string(),
17364
17606
  frontmatter: RulesyncCommandFrontmatterSchema,
17365
- body: import_mini54.z.string()
17607
+ body: import_mini55.z.string()
17366
17608
  }),
17367
- deleteCommand: import_mini54.z.object({
17368
- relativePathFromCwd: import_mini54.z.string()
17609
+ deleteCommand: import_mini55.z.object({
17610
+ relativePathFromCwd: import_mini55.z.string()
17369
17611
  })
17370
17612
  };
17371
17613
  var commandTools = {
17372
17614
  listCommands: {
17373
17615
  name: "listCommands",
17374
- description: `List all commands from ${(0, import_node_path116.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
17616
+ description: `List all commands from ${(0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
17375
17617
  parameters: commandToolSchemas.listCommands,
17376
17618
  execute: async () => {
17377
17619
  const commands = await listCommands();
@@ -17413,15 +17655,15 @@ var commandTools = {
17413
17655
  };
17414
17656
 
17415
17657
  // src/mcp/generate.ts
17416
- var import_mini55 = require("zod/mini");
17417
- var generateOptionsSchema = import_mini55.z.object({
17418
- targets: import_mini55.z.optional(import_mini55.z.array(import_mini55.z.string())),
17419
- features: import_mini55.z.optional(import_mini55.z.array(import_mini55.z.string())),
17420
- delete: import_mini55.z.optional(import_mini55.z.boolean()),
17421
- global: import_mini55.z.optional(import_mini55.z.boolean()),
17422
- simulateCommands: import_mini55.z.optional(import_mini55.z.boolean()),
17423
- simulateSubagents: import_mini55.z.optional(import_mini55.z.boolean()),
17424
- simulateSkills: import_mini55.z.optional(import_mini55.z.boolean())
17658
+ var import_mini56 = require("zod/mini");
17659
+ var generateOptionsSchema = import_mini56.z.object({
17660
+ targets: import_mini56.z.optional(import_mini56.z.array(import_mini56.z.string())),
17661
+ features: import_mini56.z.optional(import_mini56.z.array(import_mini56.z.string())),
17662
+ delete: import_mini56.z.optional(import_mini56.z.boolean()),
17663
+ global: import_mini56.z.optional(import_mini56.z.boolean()),
17664
+ simulateCommands: import_mini56.z.optional(import_mini56.z.boolean()),
17665
+ simulateSubagents: import_mini56.z.optional(import_mini56.z.boolean()),
17666
+ simulateSkills: import_mini56.z.optional(import_mini56.z.boolean())
17425
17667
  });
17426
17668
  async function executeGenerate(options = {}) {
17427
17669
  try {
@@ -17498,11 +17740,11 @@ var generateTools = {
17498
17740
  };
17499
17741
 
17500
17742
  // src/mcp/ignore.ts
17501
- var import_node_path117 = require("path");
17502
- var import_mini56 = require("zod/mini");
17743
+ var import_node_path118 = require("path");
17744
+ var import_mini57 = require("zod/mini");
17503
17745
  var maxIgnoreFileSizeBytes = 100 * 1024;
17504
17746
  async function getIgnoreFile() {
17505
- const ignoreFilePath = (0, import_node_path117.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
17747
+ const ignoreFilePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
17506
17748
  try {
17507
17749
  const content = await readFileContent(ignoreFilePath);
17508
17750
  return {
@@ -17519,7 +17761,7 @@ async function getIgnoreFile() {
17519
17761
  }
17520
17762
  }
17521
17763
  async function putIgnoreFile({ content }) {
17522
- const ignoreFilePath = (0, import_node_path117.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
17764
+ const ignoreFilePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
17523
17765
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
17524
17766
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
17525
17767
  throw new Error(
@@ -17543,8 +17785,8 @@ async function putIgnoreFile({ content }) {
17543
17785
  }
17544
17786
  }
17545
17787
  async function deleteIgnoreFile() {
17546
- const aiignorePath = (0, import_node_path117.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
17547
- const legacyIgnorePath = (0, import_node_path117.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
17788
+ const aiignorePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
17789
+ const legacyIgnorePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
17548
17790
  try {
17549
17791
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
17550
17792
  return {
@@ -17562,11 +17804,11 @@ async function deleteIgnoreFile() {
17562
17804
  }
17563
17805
  }
17564
17806
  var ignoreToolSchemas = {
17565
- getIgnoreFile: import_mini56.z.object({}),
17566
- putIgnoreFile: import_mini56.z.object({
17567
- content: import_mini56.z.string()
17807
+ getIgnoreFile: import_mini57.z.object({}),
17808
+ putIgnoreFile: import_mini57.z.object({
17809
+ content: import_mini57.z.string()
17568
17810
  }),
17569
- deleteIgnoreFile: import_mini56.z.object({})
17811
+ deleteIgnoreFile: import_mini57.z.object({})
17570
17812
  };
17571
17813
  var ignoreTools = {
17572
17814
  getIgnoreFile: {
@@ -17599,11 +17841,11 @@ var ignoreTools = {
17599
17841
  };
17600
17842
 
17601
17843
  // src/mcp/import.ts
17602
- var import_mini57 = require("zod/mini");
17603
- var importOptionsSchema = import_mini57.z.object({
17604
- target: import_mini57.z.string(),
17605
- features: import_mini57.z.optional(import_mini57.z.array(import_mini57.z.string())),
17606
- global: import_mini57.z.optional(import_mini57.z.boolean())
17844
+ var import_mini58 = require("zod/mini");
17845
+ var importOptionsSchema = import_mini58.z.object({
17846
+ target: import_mini58.z.string(),
17847
+ features: import_mini58.z.optional(import_mini58.z.array(import_mini58.z.string())),
17848
+ global: import_mini58.z.optional(import_mini58.z.boolean())
17607
17849
  });
17608
17850
  async function executeImport(options) {
17609
17851
  try {
@@ -17672,15 +17914,15 @@ var importTools = {
17672
17914
  };
17673
17915
 
17674
17916
  // src/mcp/mcp.ts
17675
- var import_node_path118 = require("path");
17676
- var import_mini58 = require("zod/mini");
17917
+ var import_node_path119 = require("path");
17918
+ var import_mini59 = require("zod/mini");
17677
17919
  var maxMcpSizeBytes = 1024 * 1024;
17678
17920
  async function getMcpFile() {
17679
17921
  try {
17680
17922
  const rulesyncMcp = await RulesyncMcp.fromFile({
17681
17923
  validate: true
17682
17924
  });
17683
- const relativePathFromCwd = (0, import_node_path118.join)(
17925
+ const relativePathFromCwd = (0, import_node_path119.join)(
17684
17926
  rulesyncMcp.getRelativeDirPath(),
17685
17927
  rulesyncMcp.getRelativeFilePath()
17686
17928
  );
@@ -17718,7 +17960,7 @@ async function putMcpFile({ content }) {
17718
17960
  const paths = RulesyncMcp.getSettablePaths();
17719
17961
  const relativeDirPath = paths.recommended.relativeDirPath;
17720
17962
  const relativeFilePath = paths.recommended.relativeFilePath;
17721
- const fullPath = (0, import_node_path118.join)(baseDir, relativeDirPath, relativeFilePath);
17963
+ const fullPath = (0, import_node_path119.join)(baseDir, relativeDirPath, relativeFilePath);
17722
17964
  const rulesyncMcp = new RulesyncMcp({
17723
17965
  baseDir,
17724
17966
  relativeDirPath,
@@ -17726,9 +17968,9 @@ async function putMcpFile({ content }) {
17726
17968
  fileContent: content,
17727
17969
  validate: true
17728
17970
  });
17729
- await ensureDir((0, import_node_path118.join)(baseDir, relativeDirPath));
17971
+ await ensureDir((0, import_node_path119.join)(baseDir, relativeDirPath));
17730
17972
  await writeFileContent(fullPath, content);
17731
- const relativePathFromCwd = (0, import_node_path118.join)(relativeDirPath, relativeFilePath);
17973
+ const relativePathFromCwd = (0, import_node_path119.join)(relativeDirPath, relativeFilePath);
17732
17974
  return {
17733
17975
  relativePathFromCwd,
17734
17976
  content: rulesyncMcp.getFileContent()
@@ -17746,15 +17988,15 @@ async function deleteMcpFile() {
17746
17988
  try {
17747
17989
  const baseDir = process.cwd();
17748
17990
  const paths = RulesyncMcp.getSettablePaths();
17749
- const recommendedPath = (0, import_node_path118.join)(
17991
+ const recommendedPath = (0, import_node_path119.join)(
17750
17992
  baseDir,
17751
17993
  paths.recommended.relativeDirPath,
17752
17994
  paths.recommended.relativeFilePath
17753
17995
  );
17754
- const legacyPath = (0, import_node_path118.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
17996
+ const legacyPath = (0, import_node_path119.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
17755
17997
  await removeFile(recommendedPath);
17756
17998
  await removeFile(legacyPath);
17757
- const relativePathFromCwd = (0, import_node_path118.join)(
17999
+ const relativePathFromCwd = (0, import_node_path119.join)(
17758
18000
  paths.recommended.relativeDirPath,
17759
18001
  paths.recommended.relativeFilePath
17760
18002
  );
@@ -17771,11 +18013,11 @@ async function deleteMcpFile() {
17771
18013
  }
17772
18014
  }
17773
18015
  var mcpToolSchemas = {
17774
- getMcpFile: import_mini58.z.object({}),
17775
- putMcpFile: import_mini58.z.object({
17776
- content: import_mini58.z.string()
18016
+ getMcpFile: import_mini59.z.object({}),
18017
+ putMcpFile: import_mini59.z.object({
18018
+ content: import_mini59.z.string()
17777
18019
  }),
17778
- deleteMcpFile: import_mini58.z.object({})
18020
+ deleteMcpFile: import_mini59.z.object({})
17779
18021
  };
17780
18022
  var mcpTools = {
17781
18023
  getMcpFile: {
@@ -17808,12 +18050,12 @@ var mcpTools = {
17808
18050
  };
17809
18051
 
17810
18052
  // src/mcp/rules.ts
17811
- var import_node_path119 = require("path");
17812
- var import_mini59 = require("zod/mini");
18053
+ var import_node_path120 = require("path");
18054
+ var import_mini60 = require("zod/mini");
17813
18055
  var maxRuleSizeBytes = 1024 * 1024;
17814
18056
  var maxRulesCount = 1e3;
17815
18057
  async function listRules() {
17816
- const rulesDir = (0, import_node_path119.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
18058
+ const rulesDir = (0, import_node_path120.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
17817
18059
  try {
17818
18060
  const files = await listDirectoryFiles(rulesDir);
17819
18061
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -17826,7 +18068,7 @@ async function listRules() {
17826
18068
  });
17827
18069
  const frontmatter = rule.getFrontmatter();
17828
18070
  return {
17829
- relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
18071
+ relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
17830
18072
  frontmatter
17831
18073
  };
17832
18074
  } catch (error) {
@@ -17848,14 +18090,14 @@ async function getRule({ relativePathFromCwd }) {
17848
18090
  relativePath: relativePathFromCwd,
17849
18091
  intendedRootDir: process.cwd()
17850
18092
  });
17851
- const filename = (0, import_node_path119.basename)(relativePathFromCwd);
18093
+ const filename = (0, import_node_path120.basename)(relativePathFromCwd);
17852
18094
  try {
17853
18095
  const rule = await RulesyncRule.fromFile({
17854
18096
  relativeFilePath: filename,
17855
18097
  validate: true
17856
18098
  });
17857
18099
  return {
17858
- relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
18100
+ relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
17859
18101
  frontmatter: rule.getFrontmatter(),
17860
18102
  body: rule.getBody()
17861
18103
  };
@@ -17874,7 +18116,7 @@ async function putRule({
17874
18116
  relativePath: relativePathFromCwd,
17875
18117
  intendedRootDir: process.cwd()
17876
18118
  });
17877
- const filename = (0, import_node_path119.basename)(relativePathFromCwd);
18119
+ const filename = (0, import_node_path120.basename)(relativePathFromCwd);
17878
18120
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
17879
18121
  if (estimatedSize > maxRuleSizeBytes) {
17880
18122
  throw new Error(
@@ -17884,7 +18126,7 @@ async function putRule({
17884
18126
  try {
17885
18127
  const existingRules = await listRules();
17886
18128
  const isUpdate = existingRules.some(
17887
- (rule2) => rule2.relativePathFromCwd === (0, import_node_path119.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
18129
+ (rule2) => rule2.relativePathFromCwd === (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
17888
18130
  );
17889
18131
  if (!isUpdate && existingRules.length >= maxRulesCount) {
17890
18132
  throw new Error(
@@ -17899,11 +18141,11 @@ async function putRule({
17899
18141
  body,
17900
18142
  validate: true
17901
18143
  });
17902
- const rulesDir = (0, import_node_path119.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
18144
+ const rulesDir = (0, import_node_path120.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
17903
18145
  await ensureDir(rulesDir);
17904
18146
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
17905
18147
  return {
17906
- relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
18148
+ relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
17907
18149
  frontmatter: rule.getFrontmatter(),
17908
18150
  body: rule.getBody()
17909
18151
  };
@@ -17918,12 +18160,12 @@ async function deleteRule({ relativePathFromCwd }) {
17918
18160
  relativePath: relativePathFromCwd,
17919
18161
  intendedRootDir: process.cwd()
17920
18162
  });
17921
- const filename = (0, import_node_path119.basename)(relativePathFromCwd);
17922
- const fullPath = (0, import_node_path119.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
18163
+ const filename = (0, import_node_path120.basename)(relativePathFromCwd);
18164
+ const fullPath = (0, import_node_path120.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
17923
18165
  try {
17924
18166
  await removeFile(fullPath);
17925
18167
  return {
17926
- relativePathFromCwd: (0, import_node_path119.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
18168
+ relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
17927
18169
  };
17928
18170
  } catch (error) {
17929
18171
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -17932,23 +18174,23 @@ async function deleteRule({ relativePathFromCwd }) {
17932
18174
  }
17933
18175
  }
17934
18176
  var ruleToolSchemas = {
17935
- listRules: import_mini59.z.object({}),
17936
- getRule: import_mini59.z.object({
17937
- relativePathFromCwd: import_mini59.z.string()
18177
+ listRules: import_mini60.z.object({}),
18178
+ getRule: import_mini60.z.object({
18179
+ relativePathFromCwd: import_mini60.z.string()
17938
18180
  }),
17939
- putRule: import_mini59.z.object({
17940
- relativePathFromCwd: import_mini59.z.string(),
18181
+ putRule: import_mini60.z.object({
18182
+ relativePathFromCwd: import_mini60.z.string(),
17941
18183
  frontmatter: RulesyncRuleFrontmatterSchema,
17942
- body: import_mini59.z.string()
18184
+ body: import_mini60.z.string()
17943
18185
  }),
17944
- deleteRule: import_mini59.z.object({
17945
- relativePathFromCwd: import_mini59.z.string()
18186
+ deleteRule: import_mini60.z.object({
18187
+ relativePathFromCwd: import_mini60.z.string()
17946
18188
  })
17947
18189
  };
17948
18190
  var ruleTools = {
17949
18191
  listRules: {
17950
18192
  name: "listRules",
17951
- description: `List all rules from ${(0, import_node_path119.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
18193
+ description: `List all rules from ${(0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
17952
18194
  parameters: ruleToolSchemas.listRules,
17953
18195
  execute: async () => {
17954
18196
  const rules = await listRules();
@@ -17990,8 +18232,8 @@ var ruleTools = {
17990
18232
  };
17991
18233
 
17992
18234
  // src/mcp/skills.ts
17993
- var import_node_path120 = require("path");
17994
- var import_mini60 = require("zod/mini");
18235
+ var import_node_path121 = require("path");
18236
+ var import_mini61 = require("zod/mini");
17995
18237
  var maxSkillSizeBytes = 1024 * 1024;
17996
18238
  var maxSkillsCount = 1e3;
17997
18239
  function aiDirFileToMcpSkillFile(file) {
@@ -18007,19 +18249,19 @@ function mcpSkillFileToAiDirFile(file) {
18007
18249
  };
18008
18250
  }
18009
18251
  function extractDirName(relativeDirPathFromCwd) {
18010
- const dirName = (0, import_node_path120.basename)(relativeDirPathFromCwd);
18252
+ const dirName = (0, import_node_path121.basename)(relativeDirPathFromCwd);
18011
18253
  if (!dirName) {
18012
18254
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
18013
18255
  }
18014
18256
  return dirName;
18015
18257
  }
18016
18258
  async function listSkills() {
18017
- const skillsDir = (0, import_node_path120.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
18259
+ const skillsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
18018
18260
  try {
18019
- const skillDirPaths = await findFilesByGlobs((0, import_node_path120.join)(skillsDir, "*"), { type: "dir" });
18261
+ const skillDirPaths = await findFilesByGlobs((0, import_node_path121.join)(skillsDir, "*"), { type: "dir" });
18020
18262
  const skills = await Promise.all(
18021
18263
  skillDirPaths.map(async (dirPath) => {
18022
- const dirName = (0, import_node_path120.basename)(dirPath);
18264
+ const dirName = (0, import_node_path121.basename)(dirPath);
18023
18265
  if (!dirName) return null;
18024
18266
  try {
18025
18267
  const skill = await RulesyncSkill.fromDir({
@@ -18027,7 +18269,7 @@ async function listSkills() {
18027
18269
  });
18028
18270
  const frontmatter = skill.getFrontmatter();
18029
18271
  return {
18030
- relativeDirPathFromCwd: (0, import_node_path120.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
18272
+ relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
18031
18273
  frontmatter
18032
18274
  };
18033
18275
  } catch (error) {
@@ -18055,7 +18297,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
18055
18297
  dirName
18056
18298
  });
18057
18299
  return {
18058
- relativeDirPathFromCwd: (0, import_node_path120.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
18300
+ relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
18059
18301
  frontmatter: skill.getFrontmatter(),
18060
18302
  body: skill.getBody(),
18061
18303
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -18089,7 +18331,7 @@ async function putSkill({
18089
18331
  try {
18090
18332
  const existingSkills = await listSkills();
18091
18333
  const isUpdate = existingSkills.some(
18092
- (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path120.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
18334
+ (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
18093
18335
  );
18094
18336
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
18095
18337
  throw new Error(
@@ -18106,9 +18348,9 @@ async function putSkill({
18106
18348
  otherFiles: aiDirFiles,
18107
18349
  validate: true
18108
18350
  });
18109
- const skillDirPath = (0, import_node_path120.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
18351
+ const skillDirPath = (0, import_node_path121.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
18110
18352
  await ensureDir(skillDirPath);
18111
- const skillFilePath = (0, import_node_path120.join)(skillDirPath, SKILL_FILE_NAME);
18353
+ const skillFilePath = (0, import_node_path121.join)(skillDirPath, SKILL_FILE_NAME);
18112
18354
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
18113
18355
  await writeFileContent(skillFilePath, skillFileContent);
18114
18356
  for (const file of otherFiles) {
@@ -18116,15 +18358,15 @@ async function putSkill({
18116
18358
  relativePath: file.name,
18117
18359
  intendedRootDir: skillDirPath
18118
18360
  });
18119
- const filePath = (0, import_node_path120.join)(skillDirPath, file.name);
18120
- const fileDir = (0, import_node_path120.join)(skillDirPath, (0, import_node_path120.dirname)(file.name));
18361
+ const filePath = (0, import_node_path121.join)(skillDirPath, file.name);
18362
+ const fileDir = (0, import_node_path121.join)(skillDirPath, (0, import_node_path121.dirname)(file.name));
18121
18363
  if (fileDir !== skillDirPath) {
18122
18364
  await ensureDir(fileDir);
18123
18365
  }
18124
18366
  await writeFileContent(filePath, file.body);
18125
18367
  }
18126
18368
  return {
18127
- relativeDirPathFromCwd: (0, import_node_path120.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
18369
+ relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
18128
18370
  frontmatter: skill.getFrontmatter(),
18129
18371
  body: skill.getBody(),
18130
18372
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -18146,13 +18388,13 @@ async function deleteSkill({
18146
18388
  intendedRootDir: process.cwd()
18147
18389
  });
18148
18390
  const dirName = extractDirName(relativeDirPathFromCwd);
18149
- const skillDirPath = (0, import_node_path120.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
18391
+ const skillDirPath = (0, import_node_path121.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
18150
18392
  try {
18151
18393
  if (await directoryExists(skillDirPath)) {
18152
18394
  await removeDirectory(skillDirPath);
18153
18395
  }
18154
18396
  return {
18155
- relativeDirPathFromCwd: (0, import_node_path120.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
18397
+ relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
18156
18398
  };
18157
18399
  } catch (error) {
18158
18400
  throw new Error(
@@ -18163,29 +18405,29 @@ async function deleteSkill({
18163
18405
  );
18164
18406
  }
18165
18407
  }
18166
- var McpSkillFileSchema = import_mini60.z.object({
18167
- name: import_mini60.z.string(),
18168
- body: import_mini60.z.string()
18408
+ var McpSkillFileSchema = import_mini61.z.object({
18409
+ name: import_mini61.z.string(),
18410
+ body: import_mini61.z.string()
18169
18411
  });
18170
18412
  var skillToolSchemas = {
18171
- listSkills: import_mini60.z.object({}),
18172
- getSkill: import_mini60.z.object({
18173
- relativeDirPathFromCwd: import_mini60.z.string()
18413
+ listSkills: import_mini61.z.object({}),
18414
+ getSkill: import_mini61.z.object({
18415
+ relativeDirPathFromCwd: import_mini61.z.string()
18174
18416
  }),
18175
- putSkill: import_mini60.z.object({
18176
- relativeDirPathFromCwd: import_mini60.z.string(),
18417
+ putSkill: import_mini61.z.object({
18418
+ relativeDirPathFromCwd: import_mini61.z.string(),
18177
18419
  frontmatter: RulesyncSkillFrontmatterSchema,
18178
- body: import_mini60.z.string(),
18179
- otherFiles: import_mini60.z.optional(import_mini60.z.array(McpSkillFileSchema))
18420
+ body: import_mini61.z.string(),
18421
+ otherFiles: import_mini61.z.optional(import_mini61.z.array(McpSkillFileSchema))
18180
18422
  }),
18181
- deleteSkill: import_mini60.z.object({
18182
- relativeDirPathFromCwd: import_mini60.z.string()
18423
+ deleteSkill: import_mini61.z.object({
18424
+ relativeDirPathFromCwd: import_mini61.z.string()
18183
18425
  })
18184
18426
  };
18185
18427
  var skillTools = {
18186
18428
  listSkills: {
18187
18429
  name: "listSkills",
18188
- description: `List all skills from ${(0, import_node_path120.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
18430
+ description: `List all skills from ${(0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
18189
18431
  parameters: skillToolSchemas.listSkills,
18190
18432
  execute: async () => {
18191
18433
  const skills = await listSkills();
@@ -18228,12 +18470,12 @@ var skillTools = {
18228
18470
  };
18229
18471
 
18230
18472
  // src/mcp/subagents.ts
18231
- var import_node_path121 = require("path");
18232
- var import_mini61 = require("zod/mini");
18473
+ var import_node_path122 = require("path");
18474
+ var import_mini62 = require("zod/mini");
18233
18475
  var maxSubagentSizeBytes = 1024 * 1024;
18234
18476
  var maxSubagentsCount = 1e3;
18235
18477
  async function listSubagents() {
18236
- const subagentsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
18478
+ const subagentsDir = (0, import_node_path122.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
18237
18479
  try {
18238
18480
  const files = await listDirectoryFiles(subagentsDir);
18239
18481
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -18246,7 +18488,7 @@ async function listSubagents() {
18246
18488
  });
18247
18489
  const frontmatter = subagent.getFrontmatter();
18248
18490
  return {
18249
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
18491
+ relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
18250
18492
  frontmatter
18251
18493
  };
18252
18494
  } catch (error) {
@@ -18270,14 +18512,14 @@ async function getSubagent({ relativePathFromCwd }) {
18270
18512
  relativePath: relativePathFromCwd,
18271
18513
  intendedRootDir: process.cwd()
18272
18514
  });
18273
- const filename = (0, import_node_path121.basename)(relativePathFromCwd);
18515
+ const filename = (0, import_node_path122.basename)(relativePathFromCwd);
18274
18516
  try {
18275
18517
  const subagent = await RulesyncSubagent.fromFile({
18276
18518
  relativeFilePath: filename,
18277
18519
  validate: true
18278
18520
  });
18279
18521
  return {
18280
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
18522
+ relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
18281
18523
  frontmatter: subagent.getFrontmatter(),
18282
18524
  body: subagent.getBody()
18283
18525
  };
@@ -18296,7 +18538,7 @@ async function putSubagent({
18296
18538
  relativePath: relativePathFromCwd,
18297
18539
  intendedRootDir: process.cwd()
18298
18540
  });
18299
- const filename = (0, import_node_path121.basename)(relativePathFromCwd);
18541
+ const filename = (0, import_node_path122.basename)(relativePathFromCwd);
18300
18542
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
18301
18543
  if (estimatedSize > maxSubagentSizeBytes) {
18302
18544
  throw new Error(
@@ -18306,7 +18548,7 @@ async function putSubagent({
18306
18548
  try {
18307
18549
  const existingSubagents = await listSubagents();
18308
18550
  const isUpdate = existingSubagents.some(
18309
- (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path121.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
18551
+ (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
18310
18552
  );
18311
18553
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
18312
18554
  throw new Error(
@@ -18321,11 +18563,11 @@ async function putSubagent({
18321
18563
  body,
18322
18564
  validate: true
18323
18565
  });
18324
- const subagentsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
18566
+ const subagentsDir = (0, import_node_path122.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
18325
18567
  await ensureDir(subagentsDir);
18326
18568
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
18327
18569
  return {
18328
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
18570
+ relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
18329
18571
  frontmatter: subagent.getFrontmatter(),
18330
18572
  body: subagent.getBody()
18331
18573
  };
@@ -18340,12 +18582,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
18340
18582
  relativePath: relativePathFromCwd,
18341
18583
  intendedRootDir: process.cwd()
18342
18584
  });
18343
- const filename = (0, import_node_path121.basename)(relativePathFromCwd);
18344
- const fullPath = (0, import_node_path121.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
18585
+ const filename = (0, import_node_path122.basename)(relativePathFromCwd);
18586
+ const fullPath = (0, import_node_path122.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
18345
18587
  try {
18346
18588
  await removeFile(fullPath);
18347
18589
  return {
18348
- relativePathFromCwd: (0, import_node_path121.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
18590
+ relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
18349
18591
  };
18350
18592
  } catch (error) {
18351
18593
  throw new Error(
@@ -18357,23 +18599,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
18357
18599
  }
18358
18600
  }
18359
18601
  var subagentToolSchemas = {
18360
- listSubagents: import_mini61.z.object({}),
18361
- getSubagent: import_mini61.z.object({
18362
- relativePathFromCwd: import_mini61.z.string()
18602
+ listSubagents: import_mini62.z.object({}),
18603
+ getSubagent: import_mini62.z.object({
18604
+ relativePathFromCwd: import_mini62.z.string()
18363
18605
  }),
18364
- putSubagent: import_mini61.z.object({
18365
- relativePathFromCwd: import_mini61.z.string(),
18606
+ putSubagent: import_mini62.z.object({
18607
+ relativePathFromCwd: import_mini62.z.string(),
18366
18608
  frontmatter: RulesyncSubagentFrontmatterSchema,
18367
- body: import_mini61.z.string()
18609
+ body: import_mini62.z.string()
18368
18610
  }),
18369
- deleteSubagent: import_mini61.z.object({
18370
- relativePathFromCwd: import_mini61.z.string()
18611
+ deleteSubagent: import_mini62.z.object({
18612
+ relativePathFromCwd: import_mini62.z.string()
18371
18613
  })
18372
18614
  };
18373
18615
  var subagentTools = {
18374
18616
  listSubagents: {
18375
18617
  name: "listSubagents",
18376
- description: `List all subagents from ${(0, import_node_path121.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
18618
+ description: `List all subagents from ${(0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
18377
18619
  parameters: subagentToolSchemas.listSubagents,
18378
18620
  execute: async () => {
18379
18621
  const subagents = await listSubagents();
@@ -18415,7 +18657,7 @@ var subagentTools = {
18415
18657
  };
18416
18658
 
18417
18659
  // src/mcp/tools.ts
18418
- var rulesyncFeatureSchema = import_mini62.z.enum([
18660
+ var rulesyncFeatureSchema = import_mini63.z.enum([
18419
18661
  "rule",
18420
18662
  "command",
18421
18663
  "subagent",
@@ -18425,21 +18667,21 @@ var rulesyncFeatureSchema = import_mini62.z.enum([
18425
18667
  "generate",
18426
18668
  "import"
18427
18669
  ]);
18428
- var rulesyncOperationSchema = import_mini62.z.enum(["list", "get", "put", "delete", "run"]);
18429
- var skillFileSchema = import_mini62.z.object({
18430
- name: import_mini62.z.string(),
18431
- body: import_mini62.z.string()
18670
+ var rulesyncOperationSchema = import_mini63.z.enum(["list", "get", "put", "delete", "run"]);
18671
+ var skillFileSchema = import_mini63.z.object({
18672
+ name: import_mini63.z.string(),
18673
+ body: import_mini63.z.string()
18432
18674
  });
18433
- var rulesyncToolSchema = import_mini62.z.object({
18675
+ var rulesyncToolSchema = import_mini63.z.object({
18434
18676
  feature: rulesyncFeatureSchema,
18435
18677
  operation: rulesyncOperationSchema,
18436
- targetPathFromCwd: import_mini62.z.optional(import_mini62.z.string()),
18437
- frontmatter: import_mini62.z.optional(import_mini62.z.unknown()),
18438
- body: import_mini62.z.optional(import_mini62.z.string()),
18439
- otherFiles: import_mini62.z.optional(import_mini62.z.array(skillFileSchema)),
18440
- content: import_mini62.z.optional(import_mini62.z.string()),
18441
- generateOptions: import_mini62.z.optional(generateOptionsSchema),
18442
- importOptions: import_mini62.z.optional(importOptionsSchema)
18678
+ targetPathFromCwd: import_mini63.z.optional(import_mini63.z.string()),
18679
+ frontmatter: import_mini63.z.optional(import_mini63.z.unknown()),
18680
+ body: import_mini63.z.optional(import_mini63.z.string()),
18681
+ otherFiles: import_mini63.z.optional(import_mini63.z.array(skillFileSchema)),
18682
+ content: import_mini63.z.optional(import_mini63.z.string()),
18683
+ generateOptions: import_mini63.z.optional(generateOptionsSchema),
18684
+ importOptions: import_mini63.z.optional(importOptionsSchema)
18443
18685
  });
18444
18686
  var supportedOperationsByFeature = {
18445
18687
  rule: ["list", "get", "put", "delete"],
@@ -18998,7 +19240,7 @@ async function updateCommand(currentVersion, options) {
18998
19240
  }
18999
19241
 
19000
19242
  // src/cli/index.ts
19001
- var getVersion = () => "7.5.0";
19243
+ var getVersion = () => "7.6.1";
19002
19244
  var main = async () => {
19003
19245
  const program = new import_commander.Command();
19004
19246
  const version = getVersion();