rulesync 4.1.1 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4727,9 +4727,9 @@ var McpProcessor = class extends FeatureProcessor {
4727
4727
  };
4728
4728
 
4729
4729
  // src/features/rules/rules-processor.ts
4730
- var import_node_path85 = require("path");
4730
+ var import_node_path86 = require("path");
4731
4731
  var import_toon = require("@toon-format/toon");
4732
- var import_mini37 = require("zod/mini");
4732
+ var import_mini38 = require("zod/mini");
4733
4733
 
4734
4734
  // src/constants/general.ts
4735
4735
  var SKILL_FILE_NAME = "SKILL.md";
@@ -6560,8 +6560,8 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
6560
6560
  };
6561
6561
 
6562
6562
  // src/features/subagents/subagents-processor.ts
6563
- var import_node_path63 = require("path");
6564
- var import_mini30 = require("zod/mini");
6563
+ var import_node_path64 = require("path");
6564
+ var import_mini31 = require("zod/mini");
6565
6565
 
6566
6566
  // src/features/subagents/claudecode-subagent.ts
6567
6567
  var import_node_path61 = require("path");
@@ -6964,6 +6964,154 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
6964
6964
  }
6965
6965
  };
6966
6966
 
6967
+ // src/features/subagents/opencode-subagent.ts
6968
+ var import_node_path63 = require("path");
6969
+ var import_mini30 = require("zod/mini");
6970
+ var OpenCodeSubagentFrontmatterSchema = import_mini30.z.looseObject({
6971
+ description: import_mini30.z.string(),
6972
+ mode: import_mini30.z.literal("subagent"),
6973
+ name: import_mini30.z.optional(import_mini30.z.string())
6974
+ });
6975
+ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
6976
+ frontmatter;
6977
+ body;
6978
+ constructor({ frontmatter, body, ...rest }) {
6979
+ if (rest.validate !== false) {
6980
+ const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
6981
+ if (!result.success) {
6982
+ throw new Error(
6983
+ `Invalid frontmatter in ${(0, import_node_path63.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
6984
+ );
6985
+ }
6986
+ }
6987
+ super({
6988
+ ...rest
6989
+ });
6990
+ this.frontmatter = frontmatter;
6991
+ this.body = body;
6992
+ }
6993
+ static getSettablePaths({
6994
+ global = false
6995
+ } = {}) {
6996
+ return {
6997
+ relativeDirPath: global ? (0, import_node_path63.join)(".config", "opencode", "agent") : (0, import_node_path63.join)(".opencode", "agent")
6998
+ };
6999
+ }
7000
+ getFrontmatter() {
7001
+ return this.frontmatter;
7002
+ }
7003
+ getBody() {
7004
+ return this.body;
7005
+ }
7006
+ toRulesyncSubagent() {
7007
+ const { description, mode, name, ...opencodeSection } = this.frontmatter;
7008
+ const rulesyncFrontmatter = {
7009
+ targets: ["opencode"],
7010
+ name: name ?? (0, import_node_path63.basename)(this.getRelativeFilePath(), ".md"),
7011
+ description,
7012
+ opencode: { mode, ...opencodeSection }
7013
+ };
7014
+ return new RulesyncSubagent({
7015
+ baseDir: ".",
7016
+ // RulesyncSubagent baseDir is always the project root directory
7017
+ frontmatter: rulesyncFrontmatter,
7018
+ body: this.body,
7019
+ relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
7020
+ relativeFilePath: this.getRelativeFilePath(),
7021
+ validate: true
7022
+ });
7023
+ }
7024
+ static fromRulesyncSubagent({
7025
+ baseDir = process.cwd(),
7026
+ rulesyncSubagent,
7027
+ validate = true,
7028
+ global = false
7029
+ }) {
7030
+ const rulesyncFrontmatter = rulesyncSubagent.getFrontmatter();
7031
+ const opencodeSection = rulesyncFrontmatter.opencode ?? {};
7032
+ const opencodeFrontmatter = {
7033
+ ...opencodeSection,
7034
+ description: rulesyncFrontmatter.description,
7035
+ mode: "subagent",
7036
+ ...rulesyncFrontmatter.name && { name: rulesyncFrontmatter.name }
7037
+ };
7038
+ const body = rulesyncSubagent.getBody();
7039
+ const fileContent = stringifyFrontmatter(body, opencodeFrontmatter);
7040
+ const paths = this.getSettablePaths({ global });
7041
+ return new _OpenCodeSubagent({
7042
+ baseDir,
7043
+ frontmatter: opencodeFrontmatter,
7044
+ body,
7045
+ relativeDirPath: paths.relativeDirPath,
7046
+ relativeFilePath: rulesyncSubagent.getRelativeFilePath(),
7047
+ fileContent,
7048
+ validate,
7049
+ global
7050
+ });
7051
+ }
7052
+ validate() {
7053
+ if (!this.frontmatter) {
7054
+ return { success: true, error: null };
7055
+ }
7056
+ const result = OpenCodeSubagentFrontmatterSchema.safeParse(this.frontmatter);
7057
+ if (result.success) {
7058
+ return { success: true, error: null };
7059
+ }
7060
+ return {
7061
+ success: false,
7062
+ error: new Error(
7063
+ `Invalid frontmatter in ${(0, import_node_path63.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7064
+ )
7065
+ };
7066
+ }
7067
+ static isTargetedByRulesyncSubagent(rulesyncSubagent) {
7068
+ return this.isTargetedByRulesyncSubagentDefault({
7069
+ rulesyncSubagent,
7070
+ toolTarget: "opencode"
7071
+ });
7072
+ }
7073
+ static async fromFile({
7074
+ baseDir = process.cwd(),
7075
+ relativeFilePath,
7076
+ validate = true,
7077
+ global = false
7078
+ }) {
7079
+ const paths = this.getSettablePaths({ global });
7080
+ const filePath = (0, import_node_path63.join)(baseDir, paths.relativeDirPath, relativeFilePath);
7081
+ const fileContent = await readFileContent(filePath);
7082
+ const { frontmatter, body: content } = parseFrontmatter(fileContent);
7083
+ const result = OpenCodeSubagentFrontmatterSchema.safeParse(frontmatter);
7084
+ if (!result.success) {
7085
+ throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
7086
+ }
7087
+ return new _OpenCodeSubagent({
7088
+ baseDir,
7089
+ relativeDirPath: paths.relativeDirPath,
7090
+ relativeFilePath,
7091
+ frontmatter: result.data,
7092
+ body: content.trim(),
7093
+ fileContent,
7094
+ validate,
7095
+ global
7096
+ });
7097
+ }
7098
+ static forDeletion({
7099
+ baseDir = process.cwd(),
7100
+ relativeDirPath,
7101
+ relativeFilePath
7102
+ }) {
7103
+ return new _OpenCodeSubagent({
7104
+ baseDir,
7105
+ relativeDirPath,
7106
+ relativeFilePath,
7107
+ frontmatter: { description: "", mode: "subagent" },
7108
+ body: "",
7109
+ fileContent: "",
7110
+ validate: false
7111
+ });
7112
+ }
7113
+ };
7114
+
6967
7115
  // src/features/subagents/subagents-processor.ts
6968
7116
  var subagentsProcessorToolTargetTuple = [
6969
7117
  "agentsmd",
@@ -6972,9 +7120,10 @@ var subagentsProcessorToolTargetTuple = [
6972
7120
  "copilot",
6973
7121
  "cursor",
6974
7122
  "geminicli",
7123
+ "opencode",
6975
7124
  "roo"
6976
7125
  ];
6977
- var SubagentsProcessorToolTargetSchema = import_mini30.z.enum(subagentsProcessorToolTargetTuple);
7126
+ var SubagentsProcessorToolTargetSchema = import_mini31.z.enum(subagentsProcessorToolTargetTuple);
6978
7127
  var toolSubagentFactories = /* @__PURE__ */ new Map([
6979
7128
  [
6980
7129
  "agentsmd",
@@ -6997,6 +7146,10 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
6997
7146
  "geminicli",
6998
7147
  { class: GeminiCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
6999
7148
  ],
7149
+ [
7150
+ "opencode",
7151
+ { class: OpenCodeSubagent, meta: { supportsSimulated: false, supportsGlobal: true } }
7152
+ ],
7000
7153
  ["roo", { class: RooSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }]
7001
7154
  ]);
7002
7155
  var defaultGetFactory5 = (target) => {
@@ -7080,7 +7233,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
7080
7233
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
7081
7234
  */
7082
7235
  async loadRulesyncFiles() {
7083
- const subagentsDir = (0, import_node_path63.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
7236
+ const subagentsDir = (0, import_node_path64.join)(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
7084
7237
  const dirExists = await directoryExists(subagentsDir);
7085
7238
  if (!dirExists) {
7086
7239
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -7095,7 +7248,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
7095
7248
  logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
7096
7249
  const rulesyncSubagents = [];
7097
7250
  for (const mdFile of mdFiles) {
7098
- const filepath = (0, import_node_path63.join)(subagentsDir, mdFile);
7251
+ const filepath = (0, import_node_path64.join)(subagentsDir, mdFile);
7099
7252
  try {
7100
7253
  const rulesyncSubagent = await RulesyncSubagent.fromFile({
7101
7254
  relativeFilePath: mdFile,
@@ -7125,14 +7278,14 @@ var SubagentsProcessor = class extends FeatureProcessor {
7125
7278
  const factory = this.getFactory(this.toolTarget);
7126
7279
  const paths = factory.class.getSettablePaths({ global: this.global });
7127
7280
  const subagentFilePaths = await findFilesByGlobs(
7128
- (0, import_node_path63.join)(this.baseDir, paths.relativeDirPath, "*.md")
7281
+ (0, import_node_path64.join)(this.baseDir, paths.relativeDirPath, "*.md")
7129
7282
  );
7130
7283
  if (forDeletion) {
7131
7284
  const toolSubagents2 = subagentFilePaths.map(
7132
7285
  (path3) => factory.class.forDeletion({
7133
7286
  baseDir: this.baseDir,
7134
7287
  relativeDirPath: paths.relativeDirPath,
7135
- relativeFilePath: (0, import_node_path63.basename)(path3),
7288
+ relativeFilePath: (0, import_node_path64.basename)(path3),
7136
7289
  global: this.global
7137
7290
  })
7138
7291
  ).filter((subagent) => subagent.isDeletable());
@@ -7143,7 +7296,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
7143
7296
  subagentFilePaths.map(
7144
7297
  (path3) => factory.class.fromFile({
7145
7298
  baseDir: this.baseDir,
7146
- relativeFilePath: (0, import_node_path63.basename)(path3),
7299
+ relativeFilePath: (0, import_node_path64.basename)(path3),
7147
7300
  global: this.global
7148
7301
  })
7149
7302
  )
@@ -7175,48 +7328,48 @@ var SubagentsProcessor = class extends FeatureProcessor {
7175
7328
  };
7176
7329
 
7177
7330
  // src/features/rules/agentsmd-rule.ts
7178
- var import_node_path66 = require("path");
7331
+ var import_node_path67 = require("path");
7179
7332
 
7180
7333
  // src/features/rules/tool-rule.ts
7181
- var import_node_path65 = require("path");
7334
+ var import_node_path66 = require("path");
7182
7335
 
7183
7336
  // src/features/rules/rulesync-rule.ts
7184
- var import_node_path64 = require("path");
7185
- var import_mini31 = require("zod/mini");
7186
- var RulesyncRuleFrontmatterSchema = import_mini31.z.object({
7187
- root: import_mini31.z.optional(import_mini31.z.optional(import_mini31.z.boolean())),
7188
- targets: import_mini31.z.optional(RulesyncTargetsSchema),
7189
- description: import_mini31.z.optional(import_mini31.z.string()),
7190
- globs: import_mini31.z.optional(import_mini31.z.array(import_mini31.z.string())),
7191
- agentsmd: import_mini31.z.optional(
7192
- import_mini31.z.object({
7337
+ var import_node_path65 = require("path");
7338
+ var import_mini32 = require("zod/mini");
7339
+ var RulesyncRuleFrontmatterSchema = import_mini32.z.object({
7340
+ root: import_mini32.z.optional(import_mini32.z.optional(import_mini32.z.boolean())),
7341
+ targets: import_mini32.z.optional(RulesyncTargetsSchema),
7342
+ description: import_mini32.z.optional(import_mini32.z.string()),
7343
+ globs: import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string())),
7344
+ agentsmd: import_mini32.z.optional(
7345
+ import_mini32.z.object({
7193
7346
  // @example "path/to/subproject"
7194
- subprojectPath: import_mini31.z.optional(import_mini31.z.string())
7347
+ subprojectPath: import_mini32.z.optional(import_mini32.z.string())
7195
7348
  })
7196
7349
  ),
7197
- claudecode: import_mini31.z.optional(
7198
- import_mini31.z.object({
7350
+ claudecode: import_mini32.z.optional(
7351
+ import_mini32.z.object({
7199
7352
  // Glob patterns for conditional rules (takes precedence over globs)
7200
7353
  // @example "src/**/*.ts, tests/**/*.test.ts"
7201
- paths: import_mini31.z.optional(import_mini31.z.string())
7354
+ paths: import_mini32.z.optional(import_mini32.z.string())
7202
7355
  })
7203
7356
  ),
7204
- cursor: import_mini31.z.optional(
7205
- import_mini31.z.object({
7206
- alwaysApply: import_mini31.z.optional(import_mini31.z.boolean()),
7207
- description: import_mini31.z.optional(import_mini31.z.string()),
7208
- globs: import_mini31.z.optional(import_mini31.z.array(import_mini31.z.string()))
7357
+ cursor: import_mini32.z.optional(
7358
+ import_mini32.z.object({
7359
+ alwaysApply: import_mini32.z.optional(import_mini32.z.boolean()),
7360
+ description: import_mini32.z.optional(import_mini32.z.string()),
7361
+ globs: import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
7209
7362
  })
7210
7363
  ),
7211
- copilot: import_mini31.z.optional(
7212
- import_mini31.z.object({
7213
- excludeAgent: import_mini31.z.optional(import_mini31.z.union([import_mini31.z.literal("code-review"), import_mini31.z.literal("coding-agent")]))
7364
+ copilot: import_mini32.z.optional(
7365
+ import_mini32.z.object({
7366
+ excludeAgent: import_mini32.z.optional(import_mini32.z.union([import_mini32.z.literal("code-review"), import_mini32.z.literal("coding-agent")]))
7214
7367
  })
7215
7368
  ),
7216
- antigravity: import_mini31.z.optional(
7217
- import_mini31.z.looseObject({
7218
- trigger: import_mini31.z.optional(import_mini31.z.string()),
7219
- globs: import_mini31.z.optional(import_mini31.z.array(import_mini31.z.string()))
7369
+ antigravity: import_mini32.z.optional(
7370
+ import_mini32.z.looseObject({
7371
+ trigger: import_mini32.z.optional(import_mini32.z.string()),
7372
+ globs: import_mini32.z.optional(import_mini32.z.array(import_mini32.z.string()))
7220
7373
  })
7221
7374
  )
7222
7375
  });
@@ -7228,7 +7381,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
7228
7381
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
7229
7382
  if (!result.success) {
7230
7383
  throw new Error(
7231
- `Invalid frontmatter in ${(0, import_node_path64.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7384
+ `Invalid frontmatter in ${(0, import_node_path65.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7232
7385
  );
7233
7386
  }
7234
7387
  }
@@ -7263,7 +7416,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
7263
7416
  return {
7264
7417
  success: false,
7265
7418
  error: new Error(
7266
- `Invalid frontmatter in ${(0, import_node_path64.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7419
+ `Invalid frontmatter in ${(0, import_node_path65.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
7267
7420
  )
7268
7421
  };
7269
7422
  }
@@ -7272,12 +7425,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
7272
7425
  relativeFilePath,
7273
7426
  validate = true
7274
7427
  }) {
7275
- const legacyPath = (0, import_node_path64.join)(
7428
+ const legacyPath = (0, import_node_path65.join)(
7276
7429
  process.cwd(),
7277
7430
  this.getSettablePaths().legacy.relativeDirPath,
7278
7431
  relativeFilePath
7279
7432
  );
7280
- const recommendedPath = (0, import_node_path64.join)(
7433
+ const recommendedPath = (0, import_node_path65.join)(
7281
7434
  this.getSettablePaths().recommended.relativeDirPath,
7282
7435
  relativeFilePath
7283
7436
  );
@@ -7296,7 +7449,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
7296
7449
  agentsmd: result.data.agentsmd,
7297
7450
  cursor: result.data.cursor
7298
7451
  };
7299
- const filename = (0, import_node_path64.basename)(legacyPath);
7452
+ const filename = (0, import_node_path65.basename)(legacyPath);
7300
7453
  return new _RulesyncRule({
7301
7454
  baseDir: process.cwd(),
7302
7455
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -7310,7 +7463,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
7310
7463
  relativeFilePath,
7311
7464
  validate = true
7312
7465
  }) {
7313
- const filePath = (0, import_node_path64.join)(
7466
+ const filePath = (0, import_node_path65.join)(
7314
7467
  process.cwd(),
7315
7468
  this.getSettablePaths().recommended.relativeDirPath,
7316
7469
  relativeFilePath
@@ -7329,7 +7482,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
7329
7482
  agentsmd: result.data.agentsmd,
7330
7483
  cursor: result.data.cursor
7331
7484
  };
7332
- const filename = (0, import_node_path64.basename)(filePath);
7485
+ const filename = (0, import_node_path65.basename)(filePath);
7333
7486
  return new _RulesyncRule({
7334
7487
  baseDir: process.cwd(),
7335
7488
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
@@ -7412,7 +7565,7 @@ var ToolRule = class extends ToolFile {
7412
7565
  rulesyncRule,
7413
7566
  validate = true,
7414
7567
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
7415
- nonRootPath = { relativeDirPath: (0, import_node_path65.join)(".agents", "memories") }
7568
+ nonRootPath = { relativeDirPath: (0, import_node_path66.join)(".agents", "memories") }
7416
7569
  }) {
7417
7570
  const params = this.buildToolRuleParamsDefault({
7418
7571
  baseDir,
@@ -7423,7 +7576,7 @@ var ToolRule = class extends ToolFile {
7423
7576
  });
7424
7577
  const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
7425
7578
  if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
7426
- params.relativeDirPath = (0, import_node_path65.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
7579
+ params.relativeDirPath = (0, import_node_path66.join)(rulesyncFrontmatter.agentsmd.subprojectPath);
7427
7580
  params.relativeFilePath = "AGENTS.md";
7428
7581
  }
7429
7582
  return params;
@@ -7488,7 +7641,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
7488
7641
  relativeFilePath: "AGENTS.md"
7489
7642
  },
7490
7643
  nonRoot: {
7491
- relativeDirPath: (0, import_node_path66.join)(".agents", "memories")
7644
+ relativeDirPath: (0, import_node_path67.join)(".agents", "memories")
7492
7645
  }
7493
7646
  };
7494
7647
  }
@@ -7498,8 +7651,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
7498
7651
  validate = true
7499
7652
  }) {
7500
7653
  const isRoot = relativeFilePath === "AGENTS.md";
7501
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path66.join)(".agents", "memories", relativeFilePath);
7502
- const fileContent = await readFileContent((0, import_node_path66.join)(baseDir, relativePath));
7654
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path67.join)(".agents", "memories", relativeFilePath);
7655
+ const fileContent = await readFileContent((0, import_node_path67.join)(baseDir, relativePath));
7503
7656
  return new _AgentsMdRule({
7504
7657
  baseDir,
7505
7658
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -7554,12 +7707,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
7554
7707
  };
7555
7708
 
7556
7709
  // src/features/rules/amazonqcli-rule.ts
7557
- var import_node_path67 = require("path");
7710
+ var import_node_path68 = require("path");
7558
7711
  var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
7559
7712
  static getSettablePaths() {
7560
7713
  return {
7561
7714
  nonRoot: {
7562
- relativeDirPath: (0, import_node_path67.join)(".amazonq", "rules")
7715
+ relativeDirPath: (0, import_node_path68.join)(".amazonq", "rules")
7563
7716
  }
7564
7717
  };
7565
7718
  }
@@ -7569,7 +7722,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
7569
7722
  validate = true
7570
7723
  }) {
7571
7724
  const fileContent = await readFileContent(
7572
- (0, import_node_path67.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7725
+ (0, import_node_path68.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
7573
7726
  );
7574
7727
  return new _AmazonQCliRule({
7575
7728
  baseDir,
@@ -7623,21 +7776,21 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
7623
7776
  };
7624
7777
 
7625
7778
  // src/features/rules/antigravity-rule.ts
7626
- var import_node_path68 = require("path");
7627
- var import_mini32 = require("zod/mini");
7628
- var AntigravityRuleFrontmatterSchema = import_mini32.z.looseObject({
7629
- trigger: import_mini32.z.optional(
7630
- import_mini32.z.union([
7631
- import_mini32.z.literal("always_on"),
7632
- import_mini32.z.literal("glob"),
7633
- import_mini32.z.literal("manual"),
7634
- import_mini32.z.literal("model_decision"),
7635
- import_mini32.z.string()
7779
+ var import_node_path69 = require("path");
7780
+ var import_mini33 = require("zod/mini");
7781
+ var AntigravityRuleFrontmatterSchema = import_mini33.z.looseObject({
7782
+ trigger: import_mini33.z.optional(
7783
+ import_mini33.z.union([
7784
+ import_mini33.z.literal("always_on"),
7785
+ import_mini33.z.literal("glob"),
7786
+ import_mini33.z.literal("manual"),
7787
+ import_mini33.z.literal("model_decision"),
7788
+ import_mini33.z.string()
7636
7789
  // accepts any string for forward compatibility
7637
7790
  ])
7638
7791
  ),
7639
- globs: import_mini32.z.optional(import_mini32.z.string()),
7640
- description: import_mini32.z.optional(import_mini32.z.string())
7792
+ globs: import_mini33.z.optional(import_mini33.z.string()),
7793
+ description: import_mini33.z.optional(import_mini33.z.string())
7641
7794
  });
7642
7795
  function parseGlobsString(globs) {
7643
7796
  if (!globs) {
@@ -7782,7 +7935,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
7782
7935
  const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
7783
7936
  if (!result.success) {
7784
7937
  throw new Error(
7785
- `Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7938
+ `Invalid frontmatter in ${(0, import_node_path69.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
7786
7939
  );
7787
7940
  }
7788
7941
  }
@@ -7797,7 +7950,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
7797
7950
  static getSettablePaths() {
7798
7951
  return {
7799
7952
  nonRoot: {
7800
- relativeDirPath: (0, import_node_path68.join)(".agent", "rules")
7953
+ relativeDirPath: (0, import_node_path69.join)(".agent", "rules")
7801
7954
  }
7802
7955
  };
7803
7956
  }
@@ -7806,7 +7959,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
7806
7959
  relativeFilePath,
7807
7960
  validate = true
7808
7961
  }) {
7809
- const filePath = (0, import_node_path68.join)(
7962
+ const filePath = (0, import_node_path69.join)(
7810
7963
  baseDir,
7811
7964
  this.getSettablePaths().nonRoot.relativeDirPath,
7812
7965
  relativeFilePath
@@ -7947,7 +8100,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
7947
8100
  };
7948
8101
 
7949
8102
  // src/features/rules/augmentcode-legacy-rule.ts
7950
- var import_node_path69 = require("path");
8103
+ var import_node_path70 = require("path");
7951
8104
  var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
7952
8105
  toRulesyncRule() {
7953
8106
  const rulesyncFrontmatter = {
@@ -7973,7 +8126,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
7973
8126
  relativeFilePath: ".augment-guidelines"
7974
8127
  },
7975
8128
  nonRoot: {
7976
- relativeDirPath: (0, import_node_path69.join)(".augment", "rules")
8129
+ relativeDirPath: (0, import_node_path70.join)(".augment", "rules")
7977
8130
  }
7978
8131
  };
7979
8132
  }
@@ -8008,8 +8161,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
8008
8161
  }) {
8009
8162
  const settablePaths = this.getSettablePaths();
8010
8163
  const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
8011
- const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path69.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
8012
- const fileContent = await readFileContent((0, import_node_path69.join)(baseDir, relativePath));
8164
+ const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path70.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
8165
+ const fileContent = await readFileContent((0, import_node_path70.join)(baseDir, relativePath));
8013
8166
  return new _AugmentcodeLegacyRule({
8014
8167
  baseDir,
8015
8168
  relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
@@ -8038,7 +8191,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
8038
8191
  };
8039
8192
 
8040
8193
  // src/features/rules/augmentcode-rule.ts
8041
- var import_node_path70 = require("path");
8194
+ var import_node_path71 = require("path");
8042
8195
  var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
8043
8196
  toRulesyncRule() {
8044
8197
  return this.toRulesyncRuleDefault();
@@ -8046,7 +8199,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
8046
8199
  static getSettablePaths() {
8047
8200
  return {
8048
8201
  nonRoot: {
8049
- relativeDirPath: (0, import_node_path70.join)(".augment", "rules")
8202
+ relativeDirPath: (0, import_node_path71.join)(".augment", "rules")
8050
8203
  }
8051
8204
  };
8052
8205
  }
@@ -8070,7 +8223,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
8070
8223
  validate = true
8071
8224
  }) {
8072
8225
  const fileContent = await readFileContent(
8073
- (0, import_node_path70.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8226
+ (0, import_node_path71.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8074
8227
  );
8075
8228
  const { body: content } = parseFrontmatter(fileContent);
8076
8229
  return new _AugmentcodeRule({
@@ -8106,7 +8259,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
8106
8259
  };
8107
8260
 
8108
8261
  // src/features/rules/claudecode-legacy-rule.ts
8109
- var import_node_path71 = require("path");
8262
+ var import_node_path72 = require("path");
8110
8263
  var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
8111
8264
  static getSettablePaths({
8112
8265
  global
@@ -8125,7 +8278,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
8125
8278
  relativeFilePath: "CLAUDE.md"
8126
8279
  },
8127
8280
  nonRoot: {
8128
- relativeDirPath: (0, import_node_path71.join)(".claude", "memories")
8281
+ relativeDirPath: (0, import_node_path72.join)(".claude", "memories")
8129
8282
  }
8130
8283
  };
8131
8284
  }
@@ -8140,7 +8293,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
8140
8293
  if (isRoot) {
8141
8294
  const relativePath2 = paths.root.relativeFilePath;
8142
8295
  const fileContent2 = await readFileContent(
8143
- (0, import_node_path71.join)(baseDir, paths.root.relativeDirPath, relativePath2)
8296
+ (0, import_node_path72.join)(baseDir, paths.root.relativeDirPath, relativePath2)
8144
8297
  );
8145
8298
  return new _ClaudecodeLegacyRule({
8146
8299
  baseDir,
@@ -8154,8 +8307,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
8154
8307
  if (!paths.nonRoot) {
8155
8308
  throw new Error("nonRoot path is not set");
8156
8309
  }
8157
- const relativePath = (0, import_node_path71.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8158
- const fileContent = await readFileContent((0, import_node_path71.join)(baseDir, relativePath));
8310
+ const relativePath = (0, import_node_path72.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8311
+ const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
8159
8312
  return new _ClaudecodeLegacyRule({
8160
8313
  baseDir,
8161
8314
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -8214,10 +8367,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
8214
8367
  };
8215
8368
 
8216
8369
  // src/features/rules/claudecode-rule.ts
8217
- var import_node_path72 = require("path");
8218
- var import_mini33 = require("zod/mini");
8219
- var ClaudecodeRuleFrontmatterSchema = import_mini33.z.object({
8220
- paths: import_mini33.z.optional(import_mini33.z.string())
8370
+ var import_node_path73 = require("path");
8371
+ var import_mini34 = require("zod/mini");
8372
+ var ClaudecodeRuleFrontmatterSchema = import_mini34.z.object({
8373
+ paths: import_mini34.z.optional(import_mini34.z.string())
8221
8374
  });
8222
8375
  var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8223
8376
  frontmatter;
@@ -8239,7 +8392,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8239
8392
  relativeFilePath: "CLAUDE.md"
8240
8393
  },
8241
8394
  nonRoot: {
8242
- relativeDirPath: (0, import_node_path72.join)(".claude", "rules")
8395
+ relativeDirPath: (0, import_node_path73.join)(".claude", "rules")
8243
8396
  }
8244
8397
  };
8245
8398
  }
@@ -8248,7 +8401,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8248
8401
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
8249
8402
  if (!result.success) {
8250
8403
  throw new Error(
8251
- `Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8404
+ `Invalid frontmatter in ${(0, import_node_path73.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8252
8405
  );
8253
8406
  }
8254
8407
  }
@@ -8276,7 +8429,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8276
8429
  const isRoot = relativeFilePath === paths.root.relativeFilePath;
8277
8430
  if (isRoot) {
8278
8431
  const fileContent2 = await readFileContent(
8279
- (0, import_node_path72.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
8432
+ (0, import_node_path73.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
8280
8433
  );
8281
8434
  return new _ClaudecodeRule({
8282
8435
  baseDir,
@@ -8291,13 +8444,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8291
8444
  if (!paths.nonRoot) {
8292
8445
  throw new Error("nonRoot path is not set");
8293
8446
  }
8294
- const relativePath = (0, import_node_path72.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8295
- const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
8447
+ const relativePath = (0, import_node_path73.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8448
+ const fileContent = await readFileContent((0, import_node_path73.join)(baseDir, relativePath));
8296
8449
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
8297
8450
  const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
8298
8451
  if (!result.success) {
8299
8452
  throw new Error(
8300
- `Invalid frontmatter in ${(0, import_node_path72.join)(baseDir, relativePath)}: ${formatError(result.error)}`
8453
+ `Invalid frontmatter in ${(0, import_node_path73.join)(baseDir, relativePath)}: ${formatError(result.error)}`
8301
8454
  );
8302
8455
  }
8303
8456
  return new _ClaudecodeRule({
@@ -8404,7 +8557,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8404
8557
  return {
8405
8558
  success: false,
8406
8559
  error: new Error(
8407
- `Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8560
+ `Invalid frontmatter in ${(0, import_node_path73.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8408
8561
  )
8409
8562
  };
8410
8563
  }
@@ -8424,10 +8577,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
8424
8577
  };
8425
8578
 
8426
8579
  // src/features/rules/cline-rule.ts
8427
- var import_node_path73 = require("path");
8428
- var import_mini34 = require("zod/mini");
8429
- var ClineRuleFrontmatterSchema = import_mini34.z.object({
8430
- description: import_mini34.z.string()
8580
+ var import_node_path74 = require("path");
8581
+ var import_mini35 = require("zod/mini");
8582
+ var ClineRuleFrontmatterSchema = import_mini35.z.object({
8583
+ description: import_mini35.z.string()
8431
8584
  });
8432
8585
  var ClineRule = class _ClineRule extends ToolRule {
8433
8586
  static getSettablePaths() {
@@ -8469,7 +8622,7 @@ var ClineRule = class _ClineRule extends ToolRule {
8469
8622
  validate = true
8470
8623
  }) {
8471
8624
  const fileContent = await readFileContent(
8472
- (0, import_node_path73.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8625
+ (0, import_node_path74.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8473
8626
  );
8474
8627
  return new _ClineRule({
8475
8628
  baseDir,
@@ -8495,7 +8648,7 @@ var ClineRule = class _ClineRule extends ToolRule {
8495
8648
  };
8496
8649
 
8497
8650
  // src/features/rules/codexcli-rule.ts
8498
- var import_node_path74 = require("path");
8651
+ var import_node_path75 = require("path");
8499
8652
  var CodexcliRule = class _CodexcliRule extends ToolRule {
8500
8653
  static getSettablePaths({
8501
8654
  global
@@ -8514,7 +8667,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
8514
8667
  relativeFilePath: "AGENTS.md"
8515
8668
  },
8516
8669
  nonRoot: {
8517
- relativeDirPath: (0, import_node_path74.join)(".codex", "memories")
8670
+ relativeDirPath: (0, import_node_path75.join)(".codex", "memories")
8518
8671
  }
8519
8672
  };
8520
8673
  }
@@ -8529,7 +8682,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
8529
8682
  if (isRoot) {
8530
8683
  const relativePath2 = paths.root.relativeFilePath;
8531
8684
  const fileContent2 = await readFileContent(
8532
- (0, import_node_path74.join)(baseDir, paths.root.relativeDirPath, relativePath2)
8685
+ (0, import_node_path75.join)(baseDir, paths.root.relativeDirPath, relativePath2)
8533
8686
  );
8534
8687
  return new _CodexcliRule({
8535
8688
  baseDir,
@@ -8543,8 +8696,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
8543
8696
  if (!paths.nonRoot) {
8544
8697
  throw new Error("nonRoot path is not set");
8545
8698
  }
8546
- const relativePath = (0, import_node_path74.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8547
- const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
8699
+ const relativePath = (0, import_node_path75.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
8700
+ const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
8548
8701
  return new _CodexcliRule({
8549
8702
  baseDir,
8550
8703
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -8603,12 +8756,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
8603
8756
  };
8604
8757
 
8605
8758
  // src/features/rules/copilot-rule.ts
8606
- var import_node_path75 = require("path");
8607
- var import_mini35 = require("zod/mini");
8608
- var CopilotRuleFrontmatterSchema = import_mini35.z.object({
8609
- description: import_mini35.z.optional(import_mini35.z.string()),
8610
- applyTo: import_mini35.z.optional(import_mini35.z.string()),
8611
- excludeAgent: import_mini35.z.optional(import_mini35.z.union([import_mini35.z.literal("code-review"), import_mini35.z.literal("coding-agent")]))
8759
+ var import_node_path76 = require("path");
8760
+ var import_mini36 = require("zod/mini");
8761
+ var CopilotRuleFrontmatterSchema = import_mini36.z.object({
8762
+ description: import_mini36.z.optional(import_mini36.z.string()),
8763
+ applyTo: import_mini36.z.optional(import_mini36.z.string()),
8764
+ excludeAgent: import_mini36.z.optional(import_mini36.z.union([import_mini36.z.literal("code-review"), import_mini36.z.literal("coding-agent")]))
8612
8765
  });
8613
8766
  var CopilotRule = class _CopilotRule extends ToolRule {
8614
8767
  frontmatter;
@@ -8620,7 +8773,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
8620
8773
  relativeFilePath: "copilot-instructions.md"
8621
8774
  },
8622
8775
  nonRoot: {
8623
- relativeDirPath: (0, import_node_path75.join)(".github", "instructions")
8776
+ relativeDirPath: (0, import_node_path76.join)(".github", "instructions")
8624
8777
  }
8625
8778
  };
8626
8779
  }
@@ -8629,7 +8782,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
8629
8782
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
8630
8783
  if (!result.success) {
8631
8784
  throw new Error(
8632
- `Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8785
+ `Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8633
8786
  );
8634
8787
  }
8635
8788
  }
@@ -8711,11 +8864,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
8711
8864
  validate = true
8712
8865
  }) {
8713
8866
  const isRoot = relativeFilePath === "copilot-instructions.md";
8714
- const relativePath = isRoot ? (0, import_node_path75.join)(
8867
+ const relativePath = isRoot ? (0, import_node_path76.join)(
8715
8868
  this.getSettablePaths().root.relativeDirPath,
8716
8869
  this.getSettablePaths().root.relativeFilePath
8717
- ) : (0, import_node_path75.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
8718
- const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
8870
+ ) : (0, import_node_path76.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
8871
+ const fileContent = await readFileContent((0, import_node_path76.join)(baseDir, relativePath));
8719
8872
  if (isRoot) {
8720
8873
  return new _CopilotRule({
8721
8874
  baseDir,
@@ -8731,7 +8884,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
8731
8884
  const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
8732
8885
  if (!result.success) {
8733
8886
  throw new Error(
8734
- `Invalid frontmatter in ${(0, import_node_path75.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
8887
+ `Invalid frontmatter in ${(0, import_node_path76.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
8735
8888
  );
8736
8889
  }
8737
8890
  return new _CopilotRule({
@@ -8771,7 +8924,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
8771
8924
  return {
8772
8925
  success: false,
8773
8926
  error: new Error(
8774
- `Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8927
+ `Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8775
8928
  )
8776
8929
  };
8777
8930
  }
@@ -8791,12 +8944,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
8791
8944
  };
8792
8945
 
8793
8946
  // src/features/rules/cursor-rule.ts
8794
- var import_node_path76 = require("path");
8795
- var import_mini36 = require("zod/mini");
8796
- var CursorRuleFrontmatterSchema = import_mini36.z.object({
8797
- description: import_mini36.z.optional(import_mini36.z.string()),
8798
- globs: import_mini36.z.optional(import_mini36.z.string()),
8799
- alwaysApply: import_mini36.z.optional(import_mini36.z.boolean())
8947
+ var import_node_path77 = require("path");
8948
+ var import_mini37 = require("zod/mini");
8949
+ var CursorRuleFrontmatterSchema = import_mini37.z.object({
8950
+ description: import_mini37.z.optional(import_mini37.z.string()),
8951
+ globs: import_mini37.z.optional(import_mini37.z.string()),
8952
+ alwaysApply: import_mini37.z.optional(import_mini37.z.boolean())
8800
8953
  });
8801
8954
  var CursorRule = class _CursorRule extends ToolRule {
8802
8955
  frontmatter;
@@ -8804,7 +8957,7 @@ var CursorRule = class _CursorRule extends ToolRule {
8804
8957
  static getSettablePaths() {
8805
8958
  return {
8806
8959
  nonRoot: {
8807
- relativeDirPath: (0, import_node_path76.join)(".cursor", "rules")
8960
+ relativeDirPath: (0, import_node_path77.join)(".cursor", "rules")
8808
8961
  }
8809
8962
  };
8810
8963
  }
@@ -8813,7 +8966,7 @@ var CursorRule = class _CursorRule extends ToolRule {
8813
8966
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
8814
8967
  if (!result.success) {
8815
8968
  throw new Error(
8816
- `Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8969
+ `Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
8817
8970
  );
8818
8971
  }
8819
8972
  }
@@ -8930,19 +9083,19 @@ var CursorRule = class _CursorRule extends ToolRule {
8930
9083
  validate = true
8931
9084
  }) {
8932
9085
  const fileContent = await readFileContent(
8933
- (0, import_node_path76.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9086
+ (0, import_node_path77.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
8934
9087
  );
8935
9088
  const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
8936
9089
  const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
8937
9090
  if (!result.success) {
8938
9091
  throw new Error(
8939
- `Invalid frontmatter in ${(0, import_node_path76.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
9092
+ `Invalid frontmatter in ${(0, import_node_path77.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
8940
9093
  );
8941
9094
  }
8942
9095
  return new _CursorRule({
8943
9096
  baseDir,
8944
9097
  relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
8945
- relativeFilePath: (0, import_node_path76.basename)(relativeFilePath),
9098
+ relativeFilePath: (0, import_node_path77.basename)(relativeFilePath),
8946
9099
  frontmatter: result.data,
8947
9100
  body: content.trim(),
8948
9101
  validate
@@ -8973,7 +9126,7 @@ var CursorRule = class _CursorRule extends ToolRule {
8973
9126
  return {
8974
9127
  success: false,
8975
9128
  error: new Error(
8976
- `Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
9129
+ `Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
8977
9130
  )
8978
9131
  };
8979
9132
  }
@@ -8993,7 +9146,7 @@ var CursorRule = class _CursorRule extends ToolRule {
8993
9146
  };
8994
9147
 
8995
9148
  // src/features/rules/geminicli-rule.ts
8996
- var import_node_path77 = require("path");
9149
+ var import_node_path78 = require("path");
8997
9150
  var GeminiCliRule = class _GeminiCliRule extends ToolRule {
8998
9151
  static getSettablePaths({
8999
9152
  global
@@ -9012,7 +9165,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
9012
9165
  relativeFilePath: "GEMINI.md"
9013
9166
  },
9014
9167
  nonRoot: {
9015
- relativeDirPath: (0, import_node_path77.join)(".gemini", "memories")
9168
+ relativeDirPath: (0, import_node_path78.join)(".gemini", "memories")
9016
9169
  }
9017
9170
  };
9018
9171
  }
@@ -9027,7 +9180,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
9027
9180
  if (isRoot) {
9028
9181
  const relativePath2 = paths.root.relativeFilePath;
9029
9182
  const fileContent2 = await readFileContent(
9030
- (0, import_node_path77.join)(baseDir, paths.root.relativeDirPath, relativePath2)
9183
+ (0, import_node_path78.join)(baseDir, paths.root.relativeDirPath, relativePath2)
9031
9184
  );
9032
9185
  return new _GeminiCliRule({
9033
9186
  baseDir,
@@ -9041,8 +9194,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
9041
9194
  if (!paths.nonRoot) {
9042
9195
  throw new Error("nonRoot path is not set");
9043
9196
  }
9044
- const relativePath = (0, import_node_path77.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
9045
- const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
9197
+ const relativePath = (0, import_node_path78.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
9198
+ const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
9046
9199
  return new _GeminiCliRule({
9047
9200
  baseDir,
9048
9201
  relativeDirPath: paths.nonRoot.relativeDirPath,
@@ -9101,7 +9254,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
9101
9254
  };
9102
9255
 
9103
9256
  // src/features/rules/junie-rule.ts
9104
- var import_node_path78 = require("path");
9257
+ var import_node_path79 = require("path");
9105
9258
  var JunieRule = class _JunieRule extends ToolRule {
9106
9259
  static getSettablePaths() {
9107
9260
  return {
@@ -9110,7 +9263,7 @@ var JunieRule = class _JunieRule extends ToolRule {
9110
9263
  relativeFilePath: "guidelines.md"
9111
9264
  },
9112
9265
  nonRoot: {
9113
- relativeDirPath: (0, import_node_path78.join)(".junie", "memories")
9266
+ relativeDirPath: (0, import_node_path79.join)(".junie", "memories")
9114
9267
  }
9115
9268
  };
9116
9269
  }
@@ -9120,8 +9273,8 @@ var JunieRule = class _JunieRule extends ToolRule {
9120
9273
  validate = true
9121
9274
  }) {
9122
9275
  const isRoot = relativeFilePath === "guidelines.md";
9123
- const relativePath = isRoot ? "guidelines.md" : (0, import_node_path78.join)(".junie", "memories", relativeFilePath);
9124
- const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
9276
+ const relativePath = isRoot ? "guidelines.md" : (0, import_node_path79.join)(".junie", "memories", relativeFilePath);
9277
+ const fileContent = await readFileContent((0, import_node_path79.join)(baseDir, relativePath));
9125
9278
  return new _JunieRule({
9126
9279
  baseDir,
9127
9280
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -9176,12 +9329,12 @@ var JunieRule = class _JunieRule extends ToolRule {
9176
9329
  };
9177
9330
 
9178
9331
  // src/features/rules/kiro-rule.ts
9179
- var import_node_path79 = require("path");
9332
+ var import_node_path80 = require("path");
9180
9333
  var KiroRule = class _KiroRule extends ToolRule {
9181
9334
  static getSettablePaths() {
9182
9335
  return {
9183
9336
  nonRoot: {
9184
- relativeDirPath: (0, import_node_path79.join)(".kiro", "steering")
9337
+ relativeDirPath: (0, import_node_path80.join)(".kiro", "steering")
9185
9338
  }
9186
9339
  };
9187
9340
  }
@@ -9191,7 +9344,7 @@ var KiroRule = class _KiroRule extends ToolRule {
9191
9344
  validate = true
9192
9345
  }) {
9193
9346
  const fileContent = await readFileContent(
9194
- (0, import_node_path79.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9347
+ (0, import_node_path80.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9195
9348
  );
9196
9349
  return new _KiroRule({
9197
9350
  baseDir,
@@ -9245,7 +9398,7 @@ var KiroRule = class _KiroRule extends ToolRule {
9245
9398
  };
9246
9399
 
9247
9400
  // src/features/rules/opencode-rule.ts
9248
- var import_node_path80 = require("path");
9401
+ var import_node_path81 = require("path");
9249
9402
  var OpenCodeRule = class _OpenCodeRule extends ToolRule {
9250
9403
  static getSettablePaths() {
9251
9404
  return {
@@ -9254,7 +9407,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
9254
9407
  relativeFilePath: "AGENTS.md"
9255
9408
  },
9256
9409
  nonRoot: {
9257
- relativeDirPath: (0, import_node_path80.join)(".opencode", "memories")
9410
+ relativeDirPath: (0, import_node_path81.join)(".opencode", "memories")
9258
9411
  }
9259
9412
  };
9260
9413
  }
@@ -9264,8 +9417,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
9264
9417
  validate = true
9265
9418
  }) {
9266
9419
  const isRoot = relativeFilePath === "AGENTS.md";
9267
- const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path80.join)(".opencode", "memories", relativeFilePath);
9268
- const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
9420
+ const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path81.join)(".opencode", "memories", relativeFilePath);
9421
+ const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
9269
9422
  return new _OpenCodeRule({
9270
9423
  baseDir,
9271
9424
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -9320,7 +9473,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
9320
9473
  };
9321
9474
 
9322
9475
  // src/features/rules/qwencode-rule.ts
9323
- var import_node_path81 = require("path");
9476
+ var import_node_path82 = require("path");
9324
9477
  var QwencodeRule = class _QwencodeRule extends ToolRule {
9325
9478
  static getSettablePaths() {
9326
9479
  return {
@@ -9329,7 +9482,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
9329
9482
  relativeFilePath: "QWEN.md"
9330
9483
  },
9331
9484
  nonRoot: {
9332
- relativeDirPath: (0, import_node_path81.join)(".qwen", "memories")
9485
+ relativeDirPath: (0, import_node_path82.join)(".qwen", "memories")
9333
9486
  }
9334
9487
  };
9335
9488
  }
@@ -9339,8 +9492,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
9339
9492
  validate = true
9340
9493
  }) {
9341
9494
  const isRoot = relativeFilePath === "QWEN.md";
9342
- const relativePath = isRoot ? "QWEN.md" : (0, import_node_path81.join)(".qwen", "memories", relativeFilePath);
9343
- const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
9495
+ const relativePath = isRoot ? "QWEN.md" : (0, import_node_path82.join)(".qwen", "memories", relativeFilePath);
9496
+ const fileContent = await readFileContent((0, import_node_path82.join)(baseDir, relativePath));
9344
9497
  return new _QwencodeRule({
9345
9498
  baseDir,
9346
9499
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
@@ -9392,12 +9545,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
9392
9545
  };
9393
9546
 
9394
9547
  // src/features/rules/roo-rule.ts
9395
- var import_node_path82 = require("path");
9548
+ var import_node_path83 = require("path");
9396
9549
  var RooRule = class _RooRule extends ToolRule {
9397
9550
  static getSettablePaths() {
9398
9551
  return {
9399
9552
  nonRoot: {
9400
- relativeDirPath: (0, import_node_path82.join)(".roo", "rules")
9553
+ relativeDirPath: (0, import_node_path83.join)(".roo", "rules")
9401
9554
  }
9402
9555
  };
9403
9556
  }
@@ -9407,7 +9560,7 @@ var RooRule = class _RooRule extends ToolRule {
9407
9560
  validate = true
9408
9561
  }) {
9409
9562
  const fileContent = await readFileContent(
9410
- (0, import_node_path82.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9563
+ (0, import_node_path83.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9411
9564
  );
9412
9565
  return new _RooRule({
9413
9566
  baseDir,
@@ -9476,7 +9629,7 @@ var RooRule = class _RooRule extends ToolRule {
9476
9629
  };
9477
9630
 
9478
9631
  // src/features/rules/warp-rule.ts
9479
- var import_node_path83 = require("path");
9632
+ var import_node_path84 = require("path");
9480
9633
  var WarpRule = class _WarpRule extends ToolRule {
9481
9634
  constructor({ fileContent, root, ...rest }) {
9482
9635
  super({
@@ -9492,7 +9645,7 @@ var WarpRule = class _WarpRule extends ToolRule {
9492
9645
  relativeFilePath: "WARP.md"
9493
9646
  },
9494
9647
  nonRoot: {
9495
- relativeDirPath: (0, import_node_path83.join)(".warp", "memories")
9648
+ relativeDirPath: (0, import_node_path84.join)(".warp", "memories")
9496
9649
  }
9497
9650
  };
9498
9651
  }
@@ -9502,8 +9655,8 @@ var WarpRule = class _WarpRule extends ToolRule {
9502
9655
  validate = true
9503
9656
  }) {
9504
9657
  const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
9505
- const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path83.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
9506
- const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
9658
+ const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path84.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
9659
+ const fileContent = await readFileContent((0, import_node_path84.join)(baseDir, relativePath));
9507
9660
  return new _WarpRule({
9508
9661
  baseDir,
9509
9662
  relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
@@ -9558,12 +9711,12 @@ var WarpRule = class _WarpRule extends ToolRule {
9558
9711
  };
9559
9712
 
9560
9713
  // src/features/rules/windsurf-rule.ts
9561
- var import_node_path84 = require("path");
9714
+ var import_node_path85 = require("path");
9562
9715
  var WindsurfRule = class _WindsurfRule extends ToolRule {
9563
9716
  static getSettablePaths() {
9564
9717
  return {
9565
9718
  nonRoot: {
9566
- relativeDirPath: (0, import_node_path84.join)(".windsurf", "rules")
9719
+ relativeDirPath: (0, import_node_path85.join)(".windsurf", "rules")
9567
9720
  }
9568
9721
  };
9569
9722
  }
@@ -9573,7 +9726,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
9573
9726
  validate = true
9574
9727
  }) {
9575
9728
  const fileContent = await readFileContent(
9576
- (0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9729
+ (0, import_node_path85.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
9577
9730
  );
9578
9731
  return new _WindsurfRule({
9579
9732
  baseDir,
@@ -9646,7 +9799,7 @@ var rulesProcessorToolTargets = [
9646
9799
  "warp",
9647
9800
  "windsurf"
9648
9801
  ];
9649
- var RulesProcessorToolTargetSchema = import_mini37.z.enum(rulesProcessorToolTargets);
9802
+ var RulesProcessorToolTargetSchema = import_mini38.z.enum(rulesProcessorToolTargets);
9650
9803
  var toolRuleFactories = /* @__PURE__ */ new Map([
9651
9804
  [
9652
9805
  "agentsmd",
@@ -9931,7 +10084,7 @@ var RulesProcessor = class extends FeatureProcessor {
9931
10084
  }).relativeDirPath;
9932
10085
  return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
9933
10086
  const frontmatter = skill.getFrontmatter();
9934
- const relativePath = (0, import_node_path85.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
10087
+ const relativePath = (0, import_node_path86.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
9935
10088
  return {
9936
10089
  name: frontmatter.name,
9937
10090
  description: frontmatter.description,
@@ -9998,10 +10151,10 @@ var RulesProcessor = class extends FeatureProcessor {
9998
10151
  * Load and parse rulesync rule files from .rulesync/rules/ directory
9999
10152
  */
10000
10153
  async loadRulesyncFiles() {
10001
- const files = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
10154
+ const files = await findFilesByGlobs((0, import_node_path86.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
10002
10155
  logger.debug(`Found ${files.length} rulesync files`);
10003
10156
  const rulesyncRules = await Promise.all(
10004
- files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path85.basename)(file) }))
10157
+ files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path86.basename)(file) }))
10005
10158
  );
10006
10159
  const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
10007
10160
  if (rootRules.length > 1) {
@@ -10019,10 +10172,10 @@ var RulesProcessor = class extends FeatureProcessor {
10019
10172
  return rulesyncRules;
10020
10173
  }
10021
10174
  async loadRulesyncFilesLegacy() {
10022
- const legacyFiles = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
10175
+ const legacyFiles = await findFilesByGlobs((0, import_node_path86.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
10023
10176
  logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
10024
10177
  return Promise.all(
10025
- legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path85.basename)(file) }))
10178
+ legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path86.basename)(file) }))
10026
10179
  );
10027
10180
  }
10028
10181
  /**
@@ -10040,7 +10193,7 @@ var RulesProcessor = class extends FeatureProcessor {
10040
10193
  return [];
10041
10194
  }
10042
10195
  const rootFilePaths = await findFilesByGlobs(
10043
- (0, import_node_path85.join)(
10196
+ (0, import_node_path86.join)(
10044
10197
  this.baseDir,
10045
10198
  settablePaths.root.relativeDirPath ?? ".",
10046
10199
  settablePaths.root.relativeFilePath
@@ -10051,7 +10204,7 @@ var RulesProcessor = class extends FeatureProcessor {
10051
10204
  (filePath) => factory.class.forDeletion({
10052
10205
  baseDir: this.baseDir,
10053
10206
  relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
10054
- relativeFilePath: (0, import_node_path85.basename)(filePath),
10207
+ relativeFilePath: (0, import_node_path86.basename)(filePath),
10055
10208
  global: this.global
10056
10209
  })
10057
10210
  ).filter((rule) => rule.isDeletable());
@@ -10060,7 +10213,7 @@ var RulesProcessor = class extends FeatureProcessor {
10060
10213
  rootFilePaths.map(
10061
10214
  (filePath) => factory.class.fromFile({
10062
10215
  baseDir: this.baseDir,
10063
- relativeFilePath: (0, import_node_path85.basename)(filePath),
10216
+ relativeFilePath: (0, import_node_path86.basename)(filePath),
10064
10217
  global: this.global
10065
10218
  })
10066
10219
  )
@@ -10072,14 +10225,14 @@ var RulesProcessor = class extends FeatureProcessor {
10072
10225
  return [];
10073
10226
  }
10074
10227
  const nonRootFilePaths = await findFilesByGlobs(
10075
- (0, import_node_path85.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
10228
+ (0, import_node_path86.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
10076
10229
  );
10077
10230
  if (forDeletion) {
10078
10231
  return nonRootFilePaths.map(
10079
10232
  (filePath) => factory.class.forDeletion({
10080
10233
  baseDir: this.baseDir,
10081
10234
  relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
10082
- relativeFilePath: (0, import_node_path85.basename)(filePath),
10235
+ relativeFilePath: (0, import_node_path86.basename)(filePath),
10083
10236
  global: this.global
10084
10237
  })
10085
10238
  ).filter((rule) => rule.isDeletable());
@@ -10088,7 +10241,7 @@ var RulesProcessor = class extends FeatureProcessor {
10088
10241
  nonRootFilePaths.map(
10089
10242
  (filePath) => factory.class.fromFile({
10090
10243
  baseDir: this.baseDir,
10091
- relativeFilePath: (0, import_node_path85.basename)(filePath),
10244
+ relativeFilePath: (0, import_node_path86.basename)(filePath),
10092
10245
  global: this.global
10093
10246
  })
10094
10247
  )
@@ -10181,14 +10334,14 @@ s/<command> [arguments]
10181
10334
  This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
10182
10335
  The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
10183
10336
 
10184
- When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
10337
+ When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path86.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
10185
10338
  const subagentsSection = subagents ? `## Simulated Subagents
10186
10339
 
10187
10340
  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.
10188
10341
 
10189
- When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
10342
+ When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path86.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
10190
10343
 
10191
- For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
10344
+ For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path86.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
10192
10345
  const skillsSection = skills ? this.generateSkillsSection(skills) : "";
10193
10346
  const result = [
10194
10347
  overview,
@@ -10470,7 +10623,7 @@ async function generateSkills(config) {
10470
10623
  }
10471
10624
 
10472
10625
  // src/cli/commands/gitignore.ts
10473
- var import_node_path86 = require("path");
10626
+ var import_node_path87 = require("path");
10474
10627
  var RULESYNC_HEADER = "# Generated by Rulesync";
10475
10628
  var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
10476
10629
  var RULESYNC_IGNORE_ENTRIES = [
@@ -10527,6 +10680,7 @@ var RULESYNC_IGNORE_ENTRIES = [
10527
10680
  // OpenCode
10528
10681
  "**/.opencode/memories/",
10529
10682
  "**/.opencode/command/",
10683
+ "**/.opencode/agent/",
10530
10684
  "**/.opencode/skills/",
10531
10685
  "**/opencode.json",
10532
10686
  // Qwen
@@ -10594,7 +10748,7 @@ var removeExistingRulesyncEntries = (content) => {
10594
10748
  return result;
10595
10749
  };
10596
10750
  var gitignoreCommand = async () => {
10597
- const gitignorePath = (0, import_node_path86.join)(process.cwd(), ".gitignore");
10751
+ const gitignorePath = (0, import_node_path87.join)(process.cwd(), ".gitignore");
10598
10752
  let gitignoreContent = "";
10599
10753
  if (await fileExists(gitignorePath)) {
10600
10754
  gitignoreContent = await readFileContent(gitignorePath);
@@ -10793,7 +10947,7 @@ async function importSkills(config, tool) {
10793
10947
  }
10794
10948
 
10795
10949
  // src/cli/commands/init.ts
10796
- var import_node_path87 = require("path");
10950
+ var import_node_path88 = require("path");
10797
10951
  async function initCommand() {
10798
10952
  logger.info("Initializing rulesync...");
10799
10953
  await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
@@ -10956,14 +11110,14 @@ Attention, again, you are just the planner, so though you can read any files and
10956
11110
  await ensureDir(commandPaths.relativeDirPath);
10957
11111
  await ensureDir(subagentPaths.relativeDirPath);
10958
11112
  await ensureDir(ignorePaths.recommended.relativeDirPath);
10959
- const ruleFilepath = (0, import_node_path87.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
11113
+ const ruleFilepath = (0, import_node_path88.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
10960
11114
  if (!await fileExists(ruleFilepath)) {
10961
11115
  await writeFileContent(ruleFilepath, sampleRuleFile.content);
10962
11116
  logger.success(`Created ${ruleFilepath}`);
10963
11117
  } else {
10964
11118
  logger.info(`Skipped ${ruleFilepath} (already exists)`);
10965
11119
  }
10966
- const mcpFilepath = (0, import_node_path87.join)(
11120
+ const mcpFilepath = (0, import_node_path88.join)(
10967
11121
  mcpPaths.recommended.relativeDirPath,
10968
11122
  mcpPaths.recommended.relativeFilePath
10969
11123
  );
@@ -10973,21 +11127,21 @@ Attention, again, you are just the planner, so though you can read any files and
10973
11127
  } else {
10974
11128
  logger.info(`Skipped ${mcpFilepath} (already exists)`);
10975
11129
  }
10976
- const commandFilepath = (0, import_node_path87.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
11130
+ const commandFilepath = (0, import_node_path88.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
10977
11131
  if (!await fileExists(commandFilepath)) {
10978
11132
  await writeFileContent(commandFilepath, sampleCommandFile.content);
10979
11133
  logger.success(`Created ${commandFilepath}`);
10980
11134
  } else {
10981
11135
  logger.info(`Skipped ${commandFilepath} (already exists)`);
10982
11136
  }
10983
- const subagentFilepath = (0, import_node_path87.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
11137
+ const subagentFilepath = (0, import_node_path88.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
10984
11138
  if (!await fileExists(subagentFilepath)) {
10985
11139
  await writeFileContent(subagentFilepath, sampleSubagentFile.content);
10986
11140
  logger.success(`Created ${subagentFilepath}`);
10987
11141
  } else {
10988
11142
  logger.info(`Skipped ${subagentFilepath} (already exists)`);
10989
11143
  }
10990
- const ignoreFilepath = (0, import_node_path87.join)(
11144
+ const ignoreFilepath = (0, import_node_path88.join)(
10991
11145
  ignorePaths.recommended.relativeDirPath,
10992
11146
  ignorePaths.recommended.relativeFilePath
10993
11147
  );
@@ -11003,12 +11157,12 @@ Attention, again, you are just the planner, so though you can read any files and
11003
11157
  var import_fastmcp = require("fastmcp");
11004
11158
 
11005
11159
  // src/mcp/commands.ts
11006
- var import_node_path88 = require("path");
11007
- var import_mini38 = require("zod/mini");
11160
+ var import_node_path89 = require("path");
11161
+ var import_mini39 = require("zod/mini");
11008
11162
  var maxCommandSizeBytes = 1024 * 1024;
11009
11163
  var maxCommandsCount = 1e3;
11010
11164
  async function listCommands() {
11011
- const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
11165
+ const commandsDir = (0, import_node_path89.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
11012
11166
  try {
11013
11167
  const files = await listDirectoryFiles(commandsDir);
11014
11168
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -11020,7 +11174,7 @@ async function listCommands() {
11020
11174
  });
11021
11175
  const frontmatter = command.getFrontmatter();
11022
11176
  return {
11023
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
11177
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
11024
11178
  frontmatter
11025
11179
  };
11026
11180
  } catch (error) {
@@ -11040,13 +11194,13 @@ async function getCommand({ relativePathFromCwd }) {
11040
11194
  relativePath: relativePathFromCwd,
11041
11195
  intendedRootDir: process.cwd()
11042
11196
  });
11043
- const filename = (0, import_node_path88.basename)(relativePathFromCwd);
11197
+ const filename = (0, import_node_path89.basename)(relativePathFromCwd);
11044
11198
  try {
11045
11199
  const command = await RulesyncCommand.fromFile({
11046
11200
  relativeFilePath: filename
11047
11201
  });
11048
11202
  return {
11049
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11203
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11050
11204
  frontmatter: command.getFrontmatter(),
11051
11205
  body: command.getBody()
11052
11206
  };
@@ -11065,7 +11219,7 @@ async function putCommand({
11065
11219
  relativePath: relativePathFromCwd,
11066
11220
  intendedRootDir: process.cwd()
11067
11221
  });
11068
- const filename = (0, import_node_path88.basename)(relativePathFromCwd);
11222
+ const filename = (0, import_node_path89.basename)(relativePathFromCwd);
11069
11223
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
11070
11224
  if (estimatedSize > maxCommandSizeBytes) {
11071
11225
  throw new Error(
@@ -11075,7 +11229,7 @@ async function putCommand({
11075
11229
  try {
11076
11230
  const existingCommands = await listCommands();
11077
11231
  const isUpdate = existingCommands.some(
11078
- (command2) => command2.relativePathFromCwd === (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11232
+ (command2) => command2.relativePathFromCwd === (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11079
11233
  );
11080
11234
  if (!isUpdate && existingCommands.length >= maxCommandsCount) {
11081
11235
  throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
@@ -11090,11 +11244,11 @@ async function putCommand({
11090
11244
  fileContent,
11091
11245
  validate: true
11092
11246
  });
11093
- const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
11247
+ const commandsDir = (0, import_node_path89.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
11094
11248
  await ensureDir(commandsDir);
11095
11249
  await writeFileContent(command.getFilePath(), command.getFileContent());
11096
11250
  return {
11097
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11251
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
11098
11252
  frontmatter: command.getFrontmatter(),
11099
11253
  body: command.getBody()
11100
11254
  };
@@ -11109,12 +11263,12 @@ async function deleteCommand({ relativePathFromCwd }) {
11109
11263
  relativePath: relativePathFromCwd,
11110
11264
  intendedRootDir: process.cwd()
11111
11265
  });
11112
- const filename = (0, import_node_path88.basename)(relativePathFromCwd);
11113
- const fullPath = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
11266
+ const filename = (0, import_node_path89.basename)(relativePathFromCwd);
11267
+ const fullPath = (0, import_node_path89.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
11114
11268
  try {
11115
11269
  await removeFile(fullPath);
11116
11270
  return {
11117
- relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11271
+ relativePathFromCwd: (0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
11118
11272
  };
11119
11273
  } catch (error) {
11120
11274
  throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -11123,23 +11277,23 @@ async function deleteCommand({ relativePathFromCwd }) {
11123
11277
  }
11124
11278
  }
11125
11279
  var commandToolSchemas = {
11126
- listCommands: import_mini38.z.object({}),
11127
- getCommand: import_mini38.z.object({
11128
- relativePathFromCwd: import_mini38.z.string()
11280
+ listCommands: import_mini39.z.object({}),
11281
+ getCommand: import_mini39.z.object({
11282
+ relativePathFromCwd: import_mini39.z.string()
11129
11283
  }),
11130
- putCommand: import_mini38.z.object({
11131
- relativePathFromCwd: import_mini38.z.string(),
11284
+ putCommand: import_mini39.z.object({
11285
+ relativePathFromCwd: import_mini39.z.string(),
11132
11286
  frontmatter: RulesyncCommandFrontmatterSchema,
11133
- body: import_mini38.z.string()
11287
+ body: import_mini39.z.string()
11134
11288
  }),
11135
- deleteCommand: import_mini38.z.object({
11136
- relativePathFromCwd: import_mini38.z.string()
11289
+ deleteCommand: import_mini39.z.object({
11290
+ relativePathFromCwd: import_mini39.z.string()
11137
11291
  })
11138
11292
  };
11139
11293
  var commandTools = {
11140
11294
  listCommands: {
11141
11295
  name: "listCommands",
11142
- description: `List all commands from ${(0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11296
+ description: `List all commands from ${(0, import_node_path89.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11143
11297
  parameters: commandToolSchemas.listCommands,
11144
11298
  execute: async () => {
11145
11299
  const commands = await listCommands();
@@ -11181,11 +11335,11 @@ var commandTools = {
11181
11335
  };
11182
11336
 
11183
11337
  // src/mcp/ignore.ts
11184
- var import_node_path89 = require("path");
11185
- var import_mini39 = require("zod/mini");
11338
+ var import_node_path90 = require("path");
11339
+ var import_mini40 = require("zod/mini");
11186
11340
  var maxIgnoreFileSizeBytes = 100 * 1024;
11187
11341
  async function getIgnoreFile() {
11188
- const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11342
+ const ignoreFilePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11189
11343
  try {
11190
11344
  const content = await readFileContent(ignoreFilePath);
11191
11345
  return {
@@ -11199,7 +11353,7 @@ async function getIgnoreFile() {
11199
11353
  }
11200
11354
  }
11201
11355
  async function putIgnoreFile({ content }) {
11202
- const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11356
+ const ignoreFilePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11203
11357
  const contentSizeBytes = Buffer.byteLength(content, "utf8");
11204
11358
  if (contentSizeBytes > maxIgnoreFileSizeBytes) {
11205
11359
  throw new Error(
@@ -11220,8 +11374,8 @@ async function putIgnoreFile({ content }) {
11220
11374
  }
11221
11375
  }
11222
11376
  async function deleteIgnoreFile() {
11223
- const aiignorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11224
- const legacyIgnorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
11377
+ const aiignorePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
11378
+ const legacyIgnorePath = (0, import_node_path90.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
11225
11379
  try {
11226
11380
  await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
11227
11381
  return {
@@ -11239,11 +11393,11 @@ async function deleteIgnoreFile() {
11239
11393
  }
11240
11394
  }
11241
11395
  var ignoreToolSchemas = {
11242
- getIgnoreFile: import_mini39.z.object({}),
11243
- putIgnoreFile: import_mini39.z.object({
11244
- content: import_mini39.z.string()
11396
+ getIgnoreFile: import_mini40.z.object({}),
11397
+ putIgnoreFile: import_mini40.z.object({
11398
+ content: import_mini40.z.string()
11245
11399
  }),
11246
- deleteIgnoreFile: import_mini39.z.object({})
11400
+ deleteIgnoreFile: import_mini40.z.object({})
11247
11401
  };
11248
11402
  var ignoreTools = {
11249
11403
  getIgnoreFile: {
@@ -11276,8 +11430,8 @@ var ignoreTools = {
11276
11430
  };
11277
11431
 
11278
11432
  // src/mcp/mcp.ts
11279
- var import_node_path90 = require("path");
11280
- var import_mini40 = require("zod/mini");
11433
+ var import_node_path91 = require("path");
11434
+ var import_mini41 = require("zod/mini");
11281
11435
  var maxMcpSizeBytes = 1024 * 1024;
11282
11436
  async function getMcpFile() {
11283
11437
  const config = await ConfigResolver.resolve({});
@@ -11286,7 +11440,7 @@ async function getMcpFile() {
11286
11440
  validate: true,
11287
11441
  modularMcp: config.getModularMcp()
11288
11442
  });
11289
- const relativePathFromCwd = (0, import_node_path90.join)(
11443
+ const relativePathFromCwd = (0, import_node_path91.join)(
11290
11444
  rulesyncMcp.getRelativeDirPath(),
11291
11445
  rulesyncMcp.getRelativeFilePath()
11292
11446
  );
@@ -11319,7 +11473,7 @@ async function putMcpFile({ content }) {
11319
11473
  const paths = RulesyncMcp.getSettablePaths();
11320
11474
  const relativeDirPath = paths.recommended.relativeDirPath;
11321
11475
  const relativeFilePath = paths.recommended.relativeFilePath;
11322
- const fullPath = (0, import_node_path90.join)(baseDir, relativeDirPath, relativeFilePath);
11476
+ const fullPath = (0, import_node_path91.join)(baseDir, relativeDirPath, relativeFilePath);
11323
11477
  const rulesyncMcp = new RulesyncMcp({
11324
11478
  baseDir,
11325
11479
  relativeDirPath,
@@ -11328,9 +11482,9 @@ async function putMcpFile({ content }) {
11328
11482
  validate: true,
11329
11483
  modularMcp: config.getModularMcp()
11330
11484
  });
11331
- await ensureDir((0, import_node_path90.join)(baseDir, relativeDirPath));
11485
+ await ensureDir((0, import_node_path91.join)(baseDir, relativeDirPath));
11332
11486
  await writeFileContent(fullPath, content);
11333
- const relativePathFromCwd = (0, import_node_path90.join)(relativeDirPath, relativeFilePath);
11487
+ const relativePathFromCwd = (0, import_node_path91.join)(relativeDirPath, relativeFilePath);
11334
11488
  return {
11335
11489
  relativePathFromCwd,
11336
11490
  content: rulesyncMcp.getFileContent()
@@ -11345,15 +11499,15 @@ async function deleteMcpFile() {
11345
11499
  try {
11346
11500
  const baseDir = process.cwd();
11347
11501
  const paths = RulesyncMcp.getSettablePaths();
11348
- const recommendedPath = (0, import_node_path90.join)(
11502
+ const recommendedPath = (0, import_node_path91.join)(
11349
11503
  baseDir,
11350
11504
  paths.recommended.relativeDirPath,
11351
11505
  paths.recommended.relativeFilePath
11352
11506
  );
11353
- const legacyPath = (0, import_node_path90.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
11507
+ const legacyPath = (0, import_node_path91.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
11354
11508
  await removeFile(recommendedPath);
11355
11509
  await removeFile(legacyPath);
11356
- const relativePathFromCwd = (0, import_node_path90.join)(
11510
+ const relativePathFromCwd = (0, import_node_path91.join)(
11357
11511
  paths.recommended.relativeDirPath,
11358
11512
  paths.recommended.relativeFilePath
11359
11513
  );
@@ -11367,11 +11521,11 @@ async function deleteMcpFile() {
11367
11521
  }
11368
11522
  }
11369
11523
  var mcpToolSchemas = {
11370
- getMcpFile: import_mini40.z.object({}),
11371
- putMcpFile: import_mini40.z.object({
11372
- content: import_mini40.z.string()
11524
+ getMcpFile: import_mini41.z.object({}),
11525
+ putMcpFile: import_mini41.z.object({
11526
+ content: import_mini41.z.string()
11373
11527
  }),
11374
- deleteMcpFile: import_mini40.z.object({})
11528
+ deleteMcpFile: import_mini41.z.object({})
11375
11529
  };
11376
11530
  var mcpTools = {
11377
11531
  getMcpFile: {
@@ -11404,12 +11558,12 @@ var mcpTools = {
11404
11558
  };
11405
11559
 
11406
11560
  // src/mcp/rules.ts
11407
- var import_node_path91 = require("path");
11408
- var import_mini41 = require("zod/mini");
11561
+ var import_node_path92 = require("path");
11562
+ var import_mini42 = require("zod/mini");
11409
11563
  var maxRuleSizeBytes = 1024 * 1024;
11410
11564
  var maxRulesCount = 1e3;
11411
11565
  async function listRules() {
11412
- const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11566
+ const rulesDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11413
11567
  try {
11414
11568
  const files = await listDirectoryFiles(rulesDir);
11415
11569
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -11422,7 +11576,7 @@ async function listRules() {
11422
11576
  });
11423
11577
  const frontmatter = rule.getFrontmatter();
11424
11578
  return {
11425
- relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
11579
+ relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
11426
11580
  frontmatter
11427
11581
  };
11428
11582
  } catch (error) {
@@ -11442,14 +11596,14 @@ async function getRule({ relativePathFromCwd }) {
11442
11596
  relativePath: relativePathFromCwd,
11443
11597
  intendedRootDir: process.cwd()
11444
11598
  });
11445
- const filename = (0, import_node_path91.basename)(relativePathFromCwd);
11599
+ const filename = (0, import_node_path92.basename)(relativePathFromCwd);
11446
11600
  try {
11447
11601
  const rule = await RulesyncRule.fromFile({
11448
11602
  relativeFilePath: filename,
11449
11603
  validate: true
11450
11604
  });
11451
11605
  return {
11452
- relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11606
+ relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11453
11607
  frontmatter: rule.getFrontmatter(),
11454
11608
  body: rule.getBody()
11455
11609
  };
@@ -11468,7 +11622,7 @@ async function putRule({
11468
11622
  relativePath: relativePathFromCwd,
11469
11623
  intendedRootDir: process.cwd()
11470
11624
  });
11471
- const filename = (0, import_node_path91.basename)(relativePathFromCwd);
11625
+ const filename = (0, import_node_path92.basename)(relativePathFromCwd);
11472
11626
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
11473
11627
  if (estimatedSize > maxRuleSizeBytes) {
11474
11628
  throw new Error(
@@ -11478,7 +11632,7 @@ async function putRule({
11478
11632
  try {
11479
11633
  const existingRules = await listRules();
11480
11634
  const isUpdate = existingRules.some(
11481
- (rule2) => rule2.relativePathFromCwd === (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11635
+ (rule2) => rule2.relativePathFromCwd === (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11482
11636
  );
11483
11637
  if (!isUpdate && existingRules.length >= maxRulesCount) {
11484
11638
  throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
@@ -11491,11 +11645,11 @@ async function putRule({
11491
11645
  body,
11492
11646
  validate: true
11493
11647
  });
11494
- const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11648
+ const rulesDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
11495
11649
  await ensureDir(rulesDir);
11496
11650
  await writeFileContent(rule.getFilePath(), rule.getFileContent());
11497
11651
  return {
11498
- relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11652
+ relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
11499
11653
  frontmatter: rule.getFrontmatter(),
11500
11654
  body: rule.getBody()
11501
11655
  };
@@ -11510,12 +11664,12 @@ async function deleteRule({ relativePathFromCwd }) {
11510
11664
  relativePath: relativePathFromCwd,
11511
11665
  intendedRootDir: process.cwd()
11512
11666
  });
11513
- const filename = (0, import_node_path91.basename)(relativePathFromCwd);
11514
- const fullPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
11667
+ const filename = (0, import_node_path92.basename)(relativePathFromCwd);
11668
+ const fullPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
11515
11669
  try {
11516
11670
  await removeFile(fullPath);
11517
11671
  return {
11518
- relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11672
+ relativePathFromCwd: (0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
11519
11673
  };
11520
11674
  } catch (error) {
11521
11675
  throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
@@ -11524,23 +11678,23 @@ async function deleteRule({ relativePathFromCwd }) {
11524
11678
  }
11525
11679
  }
11526
11680
  var ruleToolSchemas = {
11527
- listRules: import_mini41.z.object({}),
11528
- getRule: import_mini41.z.object({
11529
- relativePathFromCwd: import_mini41.z.string()
11681
+ listRules: import_mini42.z.object({}),
11682
+ getRule: import_mini42.z.object({
11683
+ relativePathFromCwd: import_mini42.z.string()
11530
11684
  }),
11531
- putRule: import_mini41.z.object({
11532
- relativePathFromCwd: import_mini41.z.string(),
11685
+ putRule: import_mini42.z.object({
11686
+ relativePathFromCwd: import_mini42.z.string(),
11533
11687
  frontmatter: RulesyncRuleFrontmatterSchema,
11534
- body: import_mini41.z.string()
11688
+ body: import_mini42.z.string()
11535
11689
  }),
11536
- deleteRule: import_mini41.z.object({
11537
- relativePathFromCwd: import_mini41.z.string()
11690
+ deleteRule: import_mini42.z.object({
11691
+ relativePathFromCwd: import_mini42.z.string()
11538
11692
  })
11539
11693
  };
11540
11694
  var ruleTools = {
11541
11695
  listRules: {
11542
11696
  name: "listRules",
11543
- description: `List all rules from ${(0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11697
+ description: `List all rules from ${(0, import_node_path92.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11544
11698
  parameters: ruleToolSchemas.listRules,
11545
11699
  execute: async () => {
11546
11700
  const rules = await listRules();
@@ -11582,8 +11736,8 @@ var ruleTools = {
11582
11736
  };
11583
11737
 
11584
11738
  // src/mcp/skills.ts
11585
- var import_node_path92 = require("path");
11586
- var import_mini42 = require("zod/mini");
11739
+ var import_node_path93 = require("path");
11740
+ var import_mini43 = require("zod/mini");
11587
11741
  var maxSkillSizeBytes = 1024 * 1024;
11588
11742
  var maxSkillsCount = 1e3;
11589
11743
  function aiDirFileToMcpSkillFile(file) {
@@ -11599,19 +11753,19 @@ function mcpSkillFileToAiDirFile(file) {
11599
11753
  };
11600
11754
  }
11601
11755
  function extractDirName(relativeDirPathFromCwd) {
11602
- const dirName = (0, import_node_path92.basename)(relativeDirPathFromCwd);
11756
+ const dirName = (0, import_node_path93.basename)(relativeDirPathFromCwd);
11603
11757
  if (!dirName) {
11604
11758
  throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
11605
11759
  }
11606
11760
  return dirName;
11607
11761
  }
11608
11762
  async function listSkills() {
11609
- const skillsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
11763
+ const skillsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
11610
11764
  try {
11611
- const skillDirPaths = await findFilesByGlobs((0, import_node_path92.join)(skillsDir, "*"), { type: "dir" });
11765
+ const skillDirPaths = await findFilesByGlobs((0, import_node_path93.join)(skillsDir, "*"), { type: "dir" });
11612
11766
  const skills = await Promise.all(
11613
11767
  skillDirPaths.map(async (dirPath) => {
11614
- const dirName = (0, import_node_path92.basename)(dirPath);
11768
+ const dirName = (0, import_node_path93.basename)(dirPath);
11615
11769
  if (!dirName) return null;
11616
11770
  try {
11617
11771
  const skill = await RulesyncSkill.fromDir({
@@ -11619,7 +11773,7 @@ async function listSkills() {
11619
11773
  });
11620
11774
  const frontmatter = skill.getFrontmatter();
11621
11775
  return {
11622
- relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11776
+ relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11623
11777
  frontmatter
11624
11778
  };
11625
11779
  } catch (error) {
@@ -11645,7 +11799,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
11645
11799
  dirName
11646
11800
  });
11647
11801
  return {
11648
- relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11802
+ relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11649
11803
  frontmatter: skill.getFrontmatter(),
11650
11804
  body: skill.getBody(),
11651
11805
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -11679,7 +11833,7 @@ async function putSkill({
11679
11833
  try {
11680
11834
  const existingSkills = await listSkills();
11681
11835
  const isUpdate = existingSkills.some(
11682
- (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11836
+ (skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11683
11837
  );
11684
11838
  if (!isUpdate && existingSkills.length >= maxSkillsCount) {
11685
11839
  throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
@@ -11694,9 +11848,9 @@ async function putSkill({
11694
11848
  otherFiles: aiDirFiles,
11695
11849
  validate: true
11696
11850
  });
11697
- const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11851
+ const skillDirPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11698
11852
  await ensureDir(skillDirPath);
11699
- const skillFilePath = (0, import_node_path92.join)(skillDirPath, SKILL_FILE_NAME);
11853
+ const skillFilePath = (0, import_node_path93.join)(skillDirPath, SKILL_FILE_NAME);
11700
11854
  const skillFileContent = stringifyFrontmatter(body, frontmatter);
11701
11855
  await writeFileContent(skillFilePath, skillFileContent);
11702
11856
  for (const file of otherFiles) {
@@ -11704,15 +11858,15 @@ async function putSkill({
11704
11858
  relativePath: file.name,
11705
11859
  intendedRootDir: skillDirPath
11706
11860
  });
11707
- const filePath = (0, import_node_path92.join)(skillDirPath, file.name);
11708
- const fileDir = (0, import_node_path92.join)(skillDirPath, (0, import_node_path92.dirname)(file.name));
11861
+ const filePath = (0, import_node_path93.join)(skillDirPath, file.name);
11862
+ const fileDir = (0, import_node_path93.join)(skillDirPath, (0, import_node_path93.dirname)(file.name));
11709
11863
  if (fileDir !== skillDirPath) {
11710
11864
  await ensureDir(fileDir);
11711
11865
  }
11712
11866
  await writeFileContent(filePath, file.body);
11713
11867
  }
11714
11868
  return {
11715
- relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11869
+ relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
11716
11870
  frontmatter: skill.getFrontmatter(),
11717
11871
  body: skill.getBody(),
11718
11872
  otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
@@ -11734,13 +11888,13 @@ async function deleteSkill({
11734
11888
  intendedRootDir: process.cwd()
11735
11889
  });
11736
11890
  const dirName = extractDirName(relativeDirPathFromCwd);
11737
- const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11891
+ const skillDirPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
11738
11892
  try {
11739
11893
  if (await directoryExists(skillDirPath)) {
11740
11894
  await removeDirectory(skillDirPath);
11741
11895
  }
11742
11896
  return {
11743
- relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11897
+ relativeDirPathFromCwd: (0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
11744
11898
  };
11745
11899
  } catch (error) {
11746
11900
  throw new Error(
@@ -11751,29 +11905,29 @@ async function deleteSkill({
11751
11905
  );
11752
11906
  }
11753
11907
  }
11754
- var McpSkillFileSchema = import_mini42.z.object({
11755
- name: import_mini42.z.string(),
11756
- body: import_mini42.z.string()
11908
+ var McpSkillFileSchema = import_mini43.z.object({
11909
+ name: import_mini43.z.string(),
11910
+ body: import_mini43.z.string()
11757
11911
  });
11758
11912
  var skillToolSchemas = {
11759
- listSkills: import_mini42.z.object({}),
11760
- getSkill: import_mini42.z.object({
11761
- relativeDirPathFromCwd: import_mini42.z.string()
11913
+ listSkills: import_mini43.z.object({}),
11914
+ getSkill: import_mini43.z.object({
11915
+ relativeDirPathFromCwd: import_mini43.z.string()
11762
11916
  }),
11763
- putSkill: import_mini42.z.object({
11764
- relativeDirPathFromCwd: import_mini42.z.string(),
11917
+ putSkill: import_mini43.z.object({
11918
+ relativeDirPathFromCwd: import_mini43.z.string(),
11765
11919
  frontmatter: RulesyncSkillFrontmatterSchema,
11766
- body: import_mini42.z.string(),
11767
- otherFiles: import_mini42.z.optional(import_mini42.z.array(McpSkillFileSchema))
11920
+ body: import_mini43.z.string(),
11921
+ otherFiles: import_mini43.z.optional(import_mini43.z.array(McpSkillFileSchema))
11768
11922
  }),
11769
- deleteSkill: import_mini42.z.object({
11770
- relativeDirPathFromCwd: import_mini42.z.string()
11923
+ deleteSkill: import_mini43.z.object({
11924
+ relativeDirPathFromCwd: import_mini43.z.string()
11771
11925
  })
11772
11926
  };
11773
11927
  var skillTools = {
11774
11928
  listSkills: {
11775
11929
  name: "listSkills",
11776
- description: `List all skills from ${(0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
11930
+ description: `List all skills from ${(0, import_node_path93.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
11777
11931
  parameters: skillToolSchemas.listSkills,
11778
11932
  execute: async () => {
11779
11933
  const skills = await listSkills();
@@ -11816,12 +11970,12 @@ var skillTools = {
11816
11970
  };
11817
11971
 
11818
11972
  // src/mcp/subagents.ts
11819
- var import_node_path93 = require("path");
11820
- var import_mini43 = require("zod/mini");
11973
+ var import_node_path94 = require("path");
11974
+ var import_mini44 = require("zod/mini");
11821
11975
  var maxSubagentSizeBytes = 1024 * 1024;
11822
11976
  var maxSubagentsCount = 1e3;
11823
11977
  async function listSubagents() {
11824
- const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
11978
+ const subagentsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
11825
11979
  try {
11826
11980
  const files = await listDirectoryFiles(subagentsDir);
11827
11981
  const mdFiles = files.filter((file) => file.endsWith(".md"));
@@ -11834,7 +11988,7 @@ async function listSubagents() {
11834
11988
  });
11835
11989
  const frontmatter = subagent.getFrontmatter();
11836
11990
  return {
11837
- relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
11991
+ relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
11838
11992
  frontmatter
11839
11993
  };
11840
11994
  } catch (error) {
@@ -11856,14 +12010,14 @@ async function getSubagent({ relativePathFromCwd }) {
11856
12010
  relativePath: relativePathFromCwd,
11857
12011
  intendedRootDir: process.cwd()
11858
12012
  });
11859
- const filename = (0, import_node_path93.basename)(relativePathFromCwd);
12013
+ const filename = (0, import_node_path94.basename)(relativePathFromCwd);
11860
12014
  try {
11861
12015
  const subagent = await RulesyncSubagent.fromFile({
11862
12016
  relativeFilePath: filename,
11863
12017
  validate: true
11864
12018
  });
11865
12019
  return {
11866
- relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
12020
+ relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
11867
12021
  frontmatter: subagent.getFrontmatter(),
11868
12022
  body: subagent.getBody()
11869
12023
  };
@@ -11882,7 +12036,7 @@ async function putSubagent({
11882
12036
  relativePath: relativePathFromCwd,
11883
12037
  intendedRootDir: process.cwd()
11884
12038
  });
11885
- const filename = (0, import_node_path93.basename)(relativePathFromCwd);
12039
+ const filename = (0, import_node_path94.basename)(relativePathFromCwd);
11886
12040
  const estimatedSize = JSON.stringify(frontmatter).length + body.length;
11887
12041
  if (estimatedSize > maxSubagentSizeBytes) {
11888
12042
  throw new Error(
@@ -11892,7 +12046,7 @@ async function putSubagent({
11892
12046
  try {
11893
12047
  const existingSubagents = await listSubagents();
11894
12048
  const isUpdate = existingSubagents.some(
11895
- (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
12049
+ (subagent2) => subagent2.relativePathFromCwd === (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
11896
12050
  );
11897
12051
  if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
11898
12052
  throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
@@ -11905,11 +12059,11 @@ async function putSubagent({
11905
12059
  body,
11906
12060
  validate: true
11907
12061
  });
11908
- const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
12062
+ const subagentsDir = (0, import_node_path94.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
11909
12063
  await ensureDir(subagentsDir);
11910
12064
  await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
11911
12065
  return {
11912
- relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
12066
+ relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
11913
12067
  frontmatter: subagent.getFrontmatter(),
11914
12068
  body: subagent.getBody()
11915
12069
  };
@@ -11924,12 +12078,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
11924
12078
  relativePath: relativePathFromCwd,
11925
12079
  intendedRootDir: process.cwd()
11926
12080
  });
11927
- const filename = (0, import_node_path93.basename)(relativePathFromCwd);
11928
- const fullPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
12081
+ const filename = (0, import_node_path94.basename)(relativePathFromCwd);
12082
+ const fullPath = (0, import_node_path94.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
11929
12083
  try {
11930
12084
  await removeFile(fullPath);
11931
12085
  return {
11932
- relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
12086
+ relativePathFromCwd: (0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
11933
12087
  };
11934
12088
  } catch (error) {
11935
12089
  throw new Error(
@@ -11941,23 +12095,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
11941
12095
  }
11942
12096
  }
11943
12097
  var subagentToolSchemas = {
11944
- listSubagents: import_mini43.z.object({}),
11945
- getSubagent: import_mini43.z.object({
11946
- relativePathFromCwd: import_mini43.z.string()
12098
+ listSubagents: import_mini44.z.object({}),
12099
+ getSubagent: import_mini44.z.object({
12100
+ relativePathFromCwd: import_mini44.z.string()
11947
12101
  }),
11948
- putSubagent: import_mini43.z.object({
11949
- relativePathFromCwd: import_mini43.z.string(),
12102
+ putSubagent: import_mini44.z.object({
12103
+ relativePathFromCwd: import_mini44.z.string(),
11950
12104
  frontmatter: RulesyncSubagentFrontmatterSchema,
11951
- body: import_mini43.z.string()
12105
+ body: import_mini44.z.string()
11952
12106
  }),
11953
- deleteSubagent: import_mini43.z.object({
11954
- relativePathFromCwd: import_mini43.z.string()
12107
+ deleteSubagent: import_mini44.z.object({
12108
+ relativePathFromCwd: import_mini44.z.string()
11955
12109
  })
11956
12110
  };
11957
12111
  var subagentTools = {
11958
12112
  listSubagents: {
11959
12113
  name: "listSubagents",
11960
- description: `List all subagents from ${(0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
12114
+ description: `List all subagents from ${(0, import_node_path94.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
11961
12115
  parameters: subagentToolSchemas.listSubagents,
11962
12116
  execute: async () => {
11963
12117
  const subagents = await listSubagents();
@@ -12035,7 +12189,7 @@ async function mcpCommand({ version }) {
12035
12189
  }
12036
12190
 
12037
12191
  // src/cli/index.ts
12038
- var getVersion = () => "4.1.1";
12192
+ var getVersion = () => "4.2.0";
12039
12193
  var main = async () => {
12040
12194
  const program = new import_commander.Command();
12041
12195
  const version = getVersion();