rulesync 3.13.0 → 3.15.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.
Files changed (3) hide show
  1. package/dist/index.cjs +439 -432
  2. package/dist/index.js +258 -251
  3. package/package.json +16 -13
package/dist/index.js CHANGED
@@ -89,6 +89,15 @@ async function readOrInitializeFileContent(filePath, initialContent = "") {
89
89
  return initialContent;
90
90
  }
91
91
  }
92
+ function resolvePath(relativePath, baseDir) {
93
+ if (!baseDir) return relativePath;
94
+ const resolved = resolve(baseDir, relativePath);
95
+ const rel = relative(baseDir, resolved);
96
+ if (rel.startsWith("..") || resolve(resolved) !== resolved) {
97
+ throw new Error(`Path traversal detected: ${relativePath}`);
98
+ }
99
+ return resolved;
100
+ }
92
101
  async function directoryExists(dirPath) {
93
102
  try {
94
103
  const stats = await stat(dirPath);
@@ -153,14 +162,8 @@ function validateBaseDir(baseDir) {
153
162
  if (baseDir.includes("..")) {
154
163
  throw new Error(`baseDir cannot contain directory traversal (..): ${baseDir}`);
155
164
  }
156
- if (baseDir.startsWith("/")) {
157
- throw new Error(`baseDir must be a relative path. Absolute path not allowed: ${baseDir}`);
158
- }
159
- if (/^[a-zA-Z]:[/\\]/.test(baseDir)) {
160
- throw new Error(`baseDir must be a relative path. Absolute path not allowed: ${baseDir}`);
161
- }
162
- const normalized = resolve(".", baseDir);
163
- const rel = relative(".", normalized);
165
+ const normalized = resolve(baseDir);
166
+ const rel = relative(process.cwd(), normalized);
164
167
  if (rel.startsWith("..")) {
165
168
  throw new Error(`baseDir cannot contain directory traversal (..): ${baseDir}`);
166
169
  }
@@ -296,7 +299,7 @@ var AiFile = class {
296
299
  */
297
300
  global;
298
301
  constructor({
299
- baseDir = ".",
302
+ baseDir = process.cwd(),
300
303
  relativeDirPath,
301
304
  relativeFilePath,
302
305
  fileContent,
@@ -453,7 +456,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
453
456
  throw new Error("Not implemented because it is a SIMULATED file.");
454
457
  }
455
458
  static fromRulesyncCommandDefault({
456
- baseDir = ".",
459
+ baseDir = process.cwd(),
457
460
  rulesyncCommand,
458
461
  validate = true
459
462
  }) {
@@ -488,7 +491,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
488
491
  }
489
492
  }
490
493
  static async fromFileDefault({
491
- baseDir = ".",
494
+ baseDir = process.cwd(),
492
495
  relativeFilePath,
493
496
  validate = true
494
497
  }) {
@@ -522,7 +525,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
522
525
  };
523
526
  }
524
527
  static fromRulesyncCommand({
525
- baseDir = ".",
528
+ baseDir = process.cwd(),
526
529
  rulesyncCommand,
527
530
  validate = true
528
531
  }) {
@@ -531,7 +534,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
531
534
  );
532
535
  }
533
536
  static async fromFile({
534
- baseDir = ".",
537
+ baseDir = process.cwd(),
535
538
  relativeFilePath,
536
539
  validate = true
537
540
  }) {
@@ -620,7 +623,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
620
623
  const result = RulesyncCommandFrontmatterSchema.safeParse(frontmatter);
621
624
  if (!result.success) {
622
625
  throw new Error(
623
- `Invalid frontmatter in ${join4(rest.baseDir ?? ".", rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
626
+ `Invalid frontmatter in ${join4(rest.baseDir ?? process.cwd(), rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
624
627
  );
625
628
  }
626
629
  }
@@ -671,7 +674,7 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
671
674
  }
672
675
  const filename = basename4(relativeFilePath);
673
676
  return new _RulesyncCommand({
674
- baseDir: ".",
677
+ baseDir: process.cwd(),
675
678
  relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
676
679
  relativeFilePath: filename,
677
680
  frontmatter: result.data,
@@ -733,7 +736,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
733
736
  });
734
737
  }
735
738
  static fromRulesyncCommand({
736
- baseDir = ".",
739
+ baseDir = process.cwd(),
737
740
  rulesyncCommand,
738
741
  validate = true,
739
742
  global = false
@@ -776,7 +779,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
776
779
  });
777
780
  }
778
781
  static async fromFile({
779
- baseDir = ".",
782
+ baseDir = process.cwd(),
780
783
  relativeFilePath,
781
784
  validate = true,
782
785
  global = false
@@ -828,7 +831,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
828
831
  });
829
832
  }
830
833
  static fromRulesyncCommand({
831
- baseDir = ".",
834
+ baseDir = process.cwd(),
832
835
  rulesyncCommand,
833
836
  validate = true,
834
837
  global = false
@@ -855,7 +858,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
855
858
  });
856
859
  }
857
860
  static async fromFile({
858
- baseDir = ".",
861
+ baseDir = process.cwd(),
859
862
  relativeFilePath,
860
863
  validate = true,
861
864
  global = false
@@ -919,7 +922,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
919
922
  const originalFilePath = this.relativeFilePath;
920
923
  const relativeFilePath = originalFilePath.replace(/\.prompt\.md$/, ".md");
921
924
  return new RulesyncCommand({
922
- baseDir: ".",
925
+ baseDir: this.baseDir,
923
926
  frontmatter: rulesyncFrontmatter,
924
927
  body: this.body,
925
928
  relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
@@ -945,7 +948,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
945
948
  }
946
949
  }
947
950
  static fromRulesyncCommand({
948
- baseDir = ".",
951
+ baseDir = process.cwd(),
949
952
  rulesyncCommand,
950
953
  validate = true
951
954
  }) {
@@ -968,7 +971,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
968
971
  });
969
972
  }
970
973
  static async fromFile({
971
- baseDir = ".",
974
+ baseDir = process.cwd(),
972
975
  relativeFilePath,
973
976
  validate = true
974
977
  }) {
@@ -1011,7 +1014,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
1011
1014
  description: ""
1012
1015
  };
1013
1016
  return new RulesyncCommand({
1014
- baseDir: ".",
1017
+ baseDir: process.cwd(),
1015
1018
  // RulesyncCommand baseDir is always the project root directory
1016
1019
  frontmatter: rulesyncFrontmatter,
1017
1020
  body: this.getFileContent(),
@@ -1022,7 +1025,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
1022
1025
  });
1023
1026
  }
1024
1027
  static fromRulesyncCommand({
1025
- baseDir = ".",
1028
+ baseDir = process.cwd(),
1026
1029
  rulesyncCommand,
1027
1030
  validate = true,
1028
1031
  global = false
@@ -1049,7 +1052,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
1049
1052
  });
1050
1053
  }
1051
1054
  static async fromFile({
1052
- baseDir = ".",
1055
+ baseDir = process.cwd(),
1053
1056
  relativeFilePath,
1054
1057
  validate = true,
1055
1058
  global = false
@@ -1123,7 +1126,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
1123
1126
  };
1124
1127
  const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
1125
1128
  return new RulesyncCommand({
1126
- baseDir: ".",
1129
+ baseDir: process.cwd(),
1127
1130
  // RulesyncCommand baseDir is always the project root directory
1128
1131
  frontmatter: rulesyncFrontmatter,
1129
1132
  body: this.body,
@@ -1134,7 +1137,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
1134
1137
  });
1135
1138
  }
1136
1139
  static fromRulesyncCommand({
1137
- baseDir = ".",
1140
+ baseDir = process.cwd(),
1138
1141
  rulesyncCommand,
1139
1142
  validate = true,
1140
1143
  global = false
@@ -1158,7 +1161,7 @@ ${geminiFrontmatter.prompt}
1158
1161
  });
1159
1162
  }
1160
1163
  static async fromFile({
1161
- baseDir = ".",
1164
+ baseDir = process.cwd(),
1162
1165
  relativeFilePath,
1163
1166
  validate = true,
1164
1167
  global = false
@@ -1245,7 +1248,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1245
1248
  });
1246
1249
  }
1247
1250
  static fromRulesyncCommand({
1248
- baseDir = ".",
1251
+ baseDir = process.cwd(),
1249
1252
  rulesyncCommand,
1250
1253
  validate = true
1251
1254
  }) {
@@ -1288,7 +1291,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
1288
1291
  });
1289
1292
  }
1290
1293
  static async fromFile({
1291
- baseDir = ".",
1294
+ baseDir = process.cwd(),
1292
1295
  relativeFilePath,
1293
1296
  validate = true
1294
1297
  }) {
@@ -1630,10 +1633,29 @@ var CommandsProcessor = class extends FeatureProcessor {
1630
1633
  };
1631
1634
 
1632
1635
  // src/config/config-resolver.ts
1633
- import { join as join12 } from "path";
1634
- import { loadConfig } from "c12";
1636
+ import { resolve as resolve3 } from "path";
1637
+ import { parse as parseJsonc } from "jsonc-parser";
1635
1638
 
1636
1639
  // src/config/config.ts
1640
+ import { optional as optional2, z as z10 } from "zod/mini";
1641
+ var ConfigParamsSchema = z10.object({
1642
+ baseDirs: z10.array(z10.string()),
1643
+ targets: RulesyncTargetsSchema,
1644
+ features: RulesyncFeaturesSchema,
1645
+ verbose: z10.boolean(),
1646
+ delete: z10.boolean(),
1647
+ // New non-experimental options
1648
+ global: optional2(z10.boolean()),
1649
+ simulatedCommands: optional2(z10.boolean()),
1650
+ simulatedSubagents: optional2(z10.boolean()),
1651
+ modularMcp: optional2(z10.boolean()),
1652
+ // Deprecated experimental options (for backward compatibility)
1653
+ experimentalGlobal: optional2(z10.boolean()),
1654
+ experimentalSimulateCommands: optional2(z10.boolean()),
1655
+ experimentalSimulateSubagents: optional2(z10.boolean())
1656
+ });
1657
+ var PartialConfigParamsSchema = z10.partial(ConfigParamsSchema);
1658
+ var RequiredConfigParamsSchema = z10.required(ConfigParamsSchema);
1637
1659
  var Config = class {
1638
1660
  baseDirs;
1639
1661
  targets;
@@ -1722,7 +1744,7 @@ var defaults = {
1722
1744
  features: ["rules"],
1723
1745
  verbose: false,
1724
1746
  delete: false,
1725
- baseDirs: ["."],
1747
+ baseDirs: [process.cwd()],
1726
1748
  configPath: "rulesync.jsonc",
1727
1749
  global: false,
1728
1750
  simulatedCommands: false,
@@ -1748,46 +1770,18 @@ var ConfigResolver = class {
1748
1770
  experimentalSimulateCommands,
1749
1771
  experimentalSimulateSubagents
1750
1772
  }) {
1751
- if (!await fileExists(configPath)) {
1752
- if (experimentalGlobal !== void 0) {
1753
- warnDeprecatedOptions({ experimentalGlobal });
1754
- }
1755
- if (experimentalSimulateCommands !== void 0) {
1756
- warnDeprecatedOptions({ experimentalSimulateCommands });
1757
- }
1758
- if (experimentalSimulateSubagents !== void 0) {
1759
- warnDeprecatedOptions({ experimentalSimulateSubagents });
1773
+ const validatedConfigPath = resolvePath(configPath, process.cwd());
1774
+ let configByFile = {};
1775
+ if (await fileExists(validatedConfigPath)) {
1776
+ try {
1777
+ const fileContent = await readFileContent(validatedConfigPath);
1778
+ const jsonData = parseJsonc(fileContent);
1779
+ configByFile = PartialConfigParamsSchema.parse(jsonData);
1780
+ } catch (error) {
1781
+ logger.error(`Failed to load config file: ${formatError(error)}`);
1782
+ throw error;
1760
1783
  }
1761
- const resolvedGlobal2 = global ?? experimentalGlobal ?? defaults.global;
1762
- const resolvedSimulatedCommands2 = simulatedCommands ?? experimentalSimulateCommands ?? defaults.simulatedCommands;
1763
- const resolvedSimulatedSubagents2 = simulatedSubagents ?? experimentalSimulateSubagents ?? defaults.simulatedSubagents;
1764
- return new Config({
1765
- targets: targets ?? defaults.targets,
1766
- features: features ?? defaults.features,
1767
- verbose: verbose ?? defaults.verbose,
1768
- delete: isDelete ?? defaults.delete,
1769
- baseDirs: getBaseDirsInLightOfGlobal({
1770
- baseDirs: baseDirs ?? defaults.baseDirs,
1771
- global: resolvedGlobal2
1772
- }),
1773
- global: resolvedGlobal2,
1774
- simulatedCommands: resolvedSimulatedCommands2,
1775
- simulatedSubagents: resolvedSimulatedSubagents2,
1776
- modularMcp: modularMcp ?? defaults.modularMcp
1777
- });
1778
- }
1779
- const loadOptions = {
1780
- name: "rulesync",
1781
- cwd: process.cwd(),
1782
- rcFile: false,
1783
- // Disable rc file lookup
1784
- configFile: "rulesync"
1785
- // Will look for rulesync.jsonc, rulesync.ts, etc.
1786
- };
1787
- if (configPath) {
1788
- loadOptions.configFile = configPath;
1789
1784
  }
1790
- const { config: configByFile } = await loadConfig(loadOptions);
1791
1785
  const deprecatedGlobal = experimentalGlobal ?? configByFile.experimentalGlobal;
1792
1786
  const deprecatedCommands = experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands;
1793
1787
  const deprecatedSubagents = experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents;
@@ -1843,20 +1837,18 @@ function getBaseDirsInLightOfGlobal({
1843
1837
  baseDirs,
1844
1838
  global
1845
1839
  }) {
1846
- if (isEnvTest) {
1847
- return baseDirs.map((baseDir) => join12(".", baseDir));
1848
- }
1849
1840
  if (global) {
1850
1841
  return [getHomeDirectory()];
1851
1842
  }
1852
- baseDirs.forEach((baseDir) => {
1843
+ const resolvedBaseDirs = baseDirs.map((baseDir) => resolve3(baseDir));
1844
+ resolvedBaseDirs.forEach((baseDir) => {
1853
1845
  validateBaseDir(baseDir);
1854
1846
  });
1855
- return baseDirs;
1847
+ return resolvedBaseDirs;
1856
1848
  }
1857
1849
 
1858
1850
  // src/ignore/ignore-processor.ts
1859
- import { z as z10 } from "zod/mini";
1851
+ import { z as z11 } from "zod/mini";
1860
1852
 
1861
1853
  // src/ignore/amazonqcli-ignore.ts
1862
1854
  import { join as join13 } from "path";
@@ -1866,6 +1858,7 @@ var ToolFile = class extends AiFile {
1866
1858
  };
1867
1859
 
1868
1860
  // src/ignore/rulesync-ignore.ts
1861
+ import { join as join12 } from "path";
1869
1862
  var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
1870
1863
  validate() {
1871
1864
  return { success: true, error: null };
@@ -1877,9 +1870,11 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
1877
1870
  };
1878
1871
  }
1879
1872
  static async fromFile() {
1880
- const fileContent = await readFileContent(this.getSettablePaths().relativeFilePath);
1873
+ const baseDir = process.cwd();
1874
+ const filePath = join12(baseDir, this.getSettablePaths().relativeFilePath);
1875
+ const fileContent = await readFileContent(filePath);
1881
1876
  return new _RulesyncIgnore({
1882
- baseDir: ".",
1877
+ baseDir,
1883
1878
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1884
1879
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1885
1880
  fileContent
@@ -1947,7 +1942,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1947
1942
  * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1948
1943
  */
1949
1944
  static fromRulesyncIgnore({
1950
- baseDir = ".",
1945
+ baseDir = process.cwd(),
1951
1946
  rulesyncIgnore
1952
1947
  }) {
1953
1948
  const body = rulesyncIgnore.getFileContent();
@@ -1963,7 +1958,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1963
1958
  * Supports both proposed .q-ignore and .amazonqignore formats
1964
1959
  */
1965
1960
  static async fromFile({
1966
- baseDir = ".",
1961
+ baseDir = process.cwd(),
1967
1962
  validate = true
1968
1963
  }) {
1969
1964
  const fileContent = await readFileContent(
@@ -2003,7 +1998,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
2003
1998
  * Supports conversion from unified rulesync format to AugmentCode specific format
2004
1999
  */
2005
2000
  static fromRulesyncIgnore({
2006
- baseDir = ".",
2001
+ baseDir = process.cwd(),
2007
2002
  rulesyncIgnore
2008
2003
  }) {
2009
2004
  return new _AugmentcodeIgnore({
@@ -2018,7 +2013,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
2018
2013
  * Reads and parses .augmentignore file
2019
2014
  */
2020
2015
  static async fromFile({
2021
- baseDir = ".",
2016
+ baseDir = process.cwd(),
2022
2017
  validate = true
2023
2018
  }) {
2024
2019
  const fileContent = await readFileContent(
@@ -2069,7 +2064,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
2069
2064
  });
2070
2065
  }
2071
2066
  static async fromRulesyncIgnore({
2072
- baseDir = ".",
2067
+ baseDir = process.cwd(),
2073
2068
  rulesyncIgnore
2074
2069
  }) {
2075
2070
  const fileContent = rulesyncIgnore.getFileContent();
@@ -2099,7 +2094,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
2099
2094
  });
2100
2095
  }
2101
2096
  static async fromFile({
2102
- baseDir = ".",
2097
+ baseDir = process.cwd(),
2103
2098
  validate = true
2104
2099
  }) {
2105
2100
  const fileContent = await readFileContent(
@@ -2138,7 +2133,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
2138
2133
  * Create ClineIgnore from RulesyncIgnore
2139
2134
  */
2140
2135
  static fromRulesyncIgnore({
2141
- baseDir = ".",
2136
+ baseDir = process.cwd(),
2142
2137
  rulesyncIgnore
2143
2138
  }) {
2144
2139
  const body = rulesyncIgnore.getFileContent();
@@ -2153,7 +2148,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
2153
2148
  * Load ClineIgnore from .clineignore file
2154
2149
  */
2155
2150
  static async fromFile({
2156
- baseDir = ".",
2151
+ baseDir = process.cwd(),
2157
2152
  validate = true
2158
2153
  }) {
2159
2154
  const fileContent = await readFileContent(
@@ -2191,7 +2186,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
2191
2186
  });
2192
2187
  }
2193
2188
  static fromRulesyncIgnore({
2194
- baseDir = ".",
2189
+ baseDir = process.cwd(),
2195
2190
  rulesyncIgnore
2196
2191
  }) {
2197
2192
  const body = rulesyncIgnore.getFileContent();
@@ -2203,7 +2198,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
2203
2198
  });
2204
2199
  }
2205
2200
  static async fromFile({
2206
- baseDir = ".",
2201
+ baseDir = process.cwd(),
2207
2202
  validate = true
2208
2203
  }) {
2209
2204
  const fileContent = await readFileContent(
@@ -2236,7 +2231,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
2236
2231
  return this.toRulesyncIgnoreDefault();
2237
2232
  }
2238
2233
  static fromRulesyncIgnore({
2239
- baseDir = ".",
2234
+ baseDir = process.cwd(),
2240
2235
  rulesyncIgnore
2241
2236
  }) {
2242
2237
  return new _GeminiCliIgnore({
@@ -2247,7 +2242,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
2247
2242
  });
2248
2243
  }
2249
2244
  static async fromFile({
2250
- baseDir = ".",
2245
+ baseDir = process.cwd(),
2251
2246
  validate = true
2252
2247
  }) {
2253
2248
  const fileContent = await readFileContent(
@@ -2280,7 +2275,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
2280
2275
  return this.toRulesyncIgnoreDefault();
2281
2276
  }
2282
2277
  static fromRulesyncIgnore({
2283
- baseDir = ".",
2278
+ baseDir = process.cwd(),
2284
2279
  rulesyncIgnore
2285
2280
  }) {
2286
2281
  return new _JunieIgnore({
@@ -2291,7 +2286,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
2291
2286
  });
2292
2287
  }
2293
2288
  static async fromFile({
2294
- baseDir = ".",
2289
+ baseDir = process.cwd(),
2295
2290
  validate = true
2296
2291
  }) {
2297
2292
  const fileContent = await readFileContent(
@@ -2324,7 +2319,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
2324
2319
  return this.toRulesyncIgnoreDefault();
2325
2320
  }
2326
2321
  static fromRulesyncIgnore({
2327
- baseDir = ".",
2322
+ baseDir = process.cwd(),
2328
2323
  rulesyncIgnore
2329
2324
  }) {
2330
2325
  return new _KiroIgnore({
@@ -2335,7 +2330,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
2335
2330
  });
2336
2331
  }
2337
2332
  static async fromFile({
2338
- baseDir = ".",
2333
+ baseDir = process.cwd(),
2339
2334
  validate = true
2340
2335
  }) {
2341
2336
  const fileContent = await readFileContent(
@@ -2368,7 +2363,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
2368
2363
  return this.toRulesyncIgnoreDefault();
2369
2364
  }
2370
2365
  static fromRulesyncIgnore({
2371
- baseDir = ".",
2366
+ baseDir = process.cwd(),
2372
2367
  rulesyncIgnore
2373
2368
  }) {
2374
2369
  return new _QwencodeIgnore({
@@ -2379,7 +2374,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
2379
2374
  });
2380
2375
  }
2381
2376
  static async fromFile({
2382
- baseDir = ".",
2377
+ baseDir = process.cwd(),
2383
2378
  validate = true
2384
2379
  }) {
2385
2380
  const fileContent = await readFileContent(
@@ -2412,7 +2407,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
2412
2407
  return this.toRulesyncIgnoreDefault();
2413
2408
  }
2414
2409
  static fromRulesyncIgnore({
2415
- baseDir = ".",
2410
+ baseDir = process.cwd(),
2416
2411
  rulesyncIgnore
2417
2412
  }) {
2418
2413
  return new _RooIgnore({
@@ -2423,7 +2418,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
2423
2418
  });
2424
2419
  }
2425
2420
  static async fromFile({
2426
- baseDir = ".",
2421
+ baseDir = process.cwd(),
2427
2422
  validate = true
2428
2423
  }) {
2429
2424
  const fileContent = await readFileContent(
@@ -2456,7 +2451,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
2456
2451
  return this.toRulesyncIgnoreDefault();
2457
2452
  }
2458
2453
  static fromRulesyncIgnore({
2459
- baseDir = ".",
2454
+ baseDir = process.cwd(),
2460
2455
  rulesyncIgnore
2461
2456
  }) {
2462
2457
  return new _WindsurfIgnore({
@@ -2467,7 +2462,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
2467
2462
  });
2468
2463
  }
2469
2464
  static async fromFile({
2470
- baseDir = ".",
2465
+ baseDir = process.cwd(),
2471
2466
  validate = true
2472
2467
  }) {
2473
2468
  const fileContent = await readFileContent(
@@ -2501,7 +2496,7 @@ var ignoreProcessorToolTargets = [
2501
2496
  "roo",
2502
2497
  "windsurf"
2503
2498
  ];
2504
- var IgnoreProcessorToolTargetSchema = z10.enum(ignoreProcessorToolTargets);
2499
+ var IgnoreProcessorToolTargetSchema = z11.enum(ignoreProcessorToolTargets);
2505
2500
  var IgnoreProcessor = class extends FeatureProcessor {
2506
2501
  toolTarget;
2507
2502
  constructor({
@@ -2676,7 +2671,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
2676
2671
  };
2677
2672
 
2678
2673
  // src/mcp/mcp-processor.ts
2679
- import { z as z12 } from "zod/mini";
2674
+ import { z as z13 } from "zod/mini";
2680
2675
 
2681
2676
  // src/mcp/amazonqcli-mcp.ts
2682
2677
  import { join as join25 } from "path";
@@ -2684,37 +2679,37 @@ import { join as join25 } from "path";
2684
2679
  // src/mcp/rulesync-mcp.ts
2685
2680
  import { join as join24 } from "path";
2686
2681
  import { omit } from "es-toolkit/object";
2687
- import { z as z11 } from "zod/mini";
2688
- var McpTransportTypeSchema = z11.enum(["stdio", "sse", "http"]);
2689
- var McpServerBaseSchema = z11.object({
2690
- type: z11.optional(z11.enum(["stdio", "sse", "http"])),
2691
- command: z11.optional(z11.union([z11.string(), z11.array(z11.string())])),
2692
- args: z11.optional(z11.array(z11.string())),
2693
- url: z11.optional(z11.string()),
2694
- httpUrl: z11.optional(z11.string()),
2695
- env: z11.optional(z11.record(z11.string(), z11.string())),
2696
- disabled: z11.optional(z11.boolean()),
2697
- networkTimeout: z11.optional(z11.number()),
2698
- timeout: z11.optional(z11.number()),
2699
- trust: z11.optional(z11.boolean()),
2700
- cwd: z11.optional(z11.string()),
2701
- transport: z11.optional(McpTransportTypeSchema),
2702
- alwaysAllow: z11.optional(z11.array(z11.string())),
2703
- tools: z11.optional(z11.array(z11.string())),
2704
- kiroAutoApprove: z11.optional(z11.array(z11.string())),
2705
- kiroAutoBlock: z11.optional(z11.array(z11.string())),
2706
- headers: z11.optional(z11.record(z11.string(), z11.string()))
2682
+ import { z as z12 } from "zod/mini";
2683
+ var McpTransportTypeSchema = z12.enum(["stdio", "sse", "http"]);
2684
+ var McpServerBaseSchema = z12.object({
2685
+ type: z12.optional(z12.enum(["stdio", "sse", "http"])),
2686
+ command: z12.optional(z12.union([z12.string(), z12.array(z12.string())])),
2687
+ args: z12.optional(z12.array(z12.string())),
2688
+ url: z12.optional(z12.string()),
2689
+ httpUrl: z12.optional(z12.string()),
2690
+ env: z12.optional(z12.record(z12.string(), z12.string())),
2691
+ disabled: z12.optional(z12.boolean()),
2692
+ networkTimeout: z12.optional(z12.number()),
2693
+ timeout: z12.optional(z12.number()),
2694
+ trust: z12.optional(z12.boolean()),
2695
+ cwd: z12.optional(z12.string()),
2696
+ transport: z12.optional(McpTransportTypeSchema),
2697
+ alwaysAllow: z12.optional(z12.array(z12.string())),
2698
+ tools: z12.optional(z12.array(z12.string())),
2699
+ kiroAutoApprove: z12.optional(z12.array(z12.string())),
2700
+ kiroAutoBlock: z12.optional(z12.array(z12.string())),
2701
+ headers: z12.optional(z12.record(z12.string(), z12.string()))
2707
2702
  });
2708
- var ModularMcpServerSchema = z11.extend(McpServerBaseSchema, {
2709
- description: z11.string().check(z11.minLength(1))
2703
+ var ModularMcpServerSchema = z12.extend(McpServerBaseSchema, {
2704
+ description: z12.string().check(z12.minLength(1))
2710
2705
  });
2711
- var ModularMcpServersSchema = z11.record(z11.string(), ModularMcpServerSchema);
2712
- var RulesyncMcpServersSchema = z11.extend(McpServerBaseSchema, {
2713
- description: z11.optional(z11.string()),
2714
- targets: z11.optional(RulesyncTargetsSchema)
2706
+ var ModularMcpServersSchema = z12.record(z12.string(), ModularMcpServerSchema);
2707
+ var RulesyncMcpServersSchema = z12.extend(McpServerBaseSchema, {
2708
+ description: z12.optional(z12.string()),
2709
+ targets: z12.optional(RulesyncTargetsSchema)
2715
2710
  });
2716
- var RulesyncMcpConfigSchema = z11.object({
2717
- mcpServers: z11.record(z11.string(), RulesyncMcpServersSchema)
2711
+ var RulesyncMcpConfigSchema = z12.object({
2712
+ mcpServers: z12.record(z12.string(), RulesyncMcpServersSchema)
2718
2713
  });
2719
2714
  var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2720
2715
  json;
@@ -2760,16 +2755,18 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2760
2755
  validate = true,
2761
2756
  modularMcp = false
2762
2757
  }) {
2758
+ const baseDir = process.cwd();
2763
2759
  const paths = this.getSettablePaths();
2764
2760
  const recommendedPath = join24(
2761
+ baseDir,
2765
2762
  paths.recommended.relativeDirPath,
2766
2763
  paths.recommended.relativeFilePath
2767
2764
  );
2768
- const legacyPath = join24(paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
2765
+ const legacyPath = join24(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
2769
2766
  if (await fileExists(recommendedPath)) {
2770
2767
  const fileContent2 = await readFileContent(recommendedPath);
2771
2768
  return new _RulesyncMcp({
2772
- baseDir: ".",
2769
+ baseDir,
2773
2770
  relativeDirPath: paths.recommended.relativeDirPath,
2774
2771
  relativeFilePath: paths.recommended.relativeFilePath,
2775
2772
  fileContent: fileContent2,
@@ -2783,7 +2780,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2783
2780
  );
2784
2781
  const fileContent2 = await readFileContent(legacyPath);
2785
2782
  return new _RulesyncMcp({
2786
- baseDir: ".",
2783
+ baseDir,
2787
2784
  relativeDirPath: paths.legacy.relativeDirPath,
2788
2785
  relativeFilePath: paths.legacy.relativeFilePath,
2789
2786
  fileContent: fileContent2,
@@ -2793,7 +2790,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
2793
2790
  }
2794
2791
  const fileContent = await readFileContent(recommendedPath);
2795
2792
  return new _RulesyncMcp({
2796
- baseDir: ".",
2793
+ baseDir,
2797
2794
  relativeDirPath: paths.recommended.relativeDirPath,
2798
2795
  relativeFilePath: paths.recommended.relativeFilePath,
2799
2796
  fileContent,
@@ -2880,7 +2877,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
2880
2877
  };
2881
2878
  }
2882
2879
  static async fromFile({
2883
- baseDir = ".",
2880
+ baseDir = process.cwd(),
2884
2881
  validate = true
2885
2882
  }) {
2886
2883
  const fileContent = await readFileContent(
@@ -2899,7 +2896,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
2899
2896
  });
2900
2897
  }
2901
2898
  static fromRulesyncMcp({
2902
- baseDir = ".",
2899
+ baseDir = process.cwd(),
2903
2900
  rulesyncMcp,
2904
2901
  validate = true
2905
2902
  }) {
@@ -2954,7 +2951,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
2954
2951
  global,
2955
2952
  relativeDirPath
2956
2953
  } = {
2957
- baseDir: ".",
2954
+ baseDir: process.cwd(),
2958
2955
  global: false,
2959
2956
  relativeDirPath: void 0
2960
2957
  }) {
@@ -2985,7 +2982,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
2985
2982
  };
2986
2983
  }
2987
2984
  static fromRulesyncMcp({
2988
- baseDir = ".",
2985
+ baseDir = process.cwd(),
2989
2986
  rulesyncMcp,
2990
2987
  validate = true,
2991
2988
  global = false,
@@ -3033,7 +3030,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
3033
3030
  };
3034
3031
  }
3035
3032
  static async fromFile({
3036
- baseDir = ".",
3033
+ baseDir = process.cwd(),
3037
3034
  validate = true,
3038
3035
  global = false
3039
3036
  }) {
@@ -3053,7 +3050,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
3053
3050
  });
3054
3051
  }
3055
3052
  static async fromRulesyncMcp({
3056
- baseDir = ".",
3053
+ baseDir = process.cwd(),
3057
3054
  rulesyncMcp,
3058
3055
  validate = true,
3059
3056
  global = false,
@@ -3109,7 +3106,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
3109
3106
  };
3110
3107
  }
3111
3108
  static async fromFile({
3112
- baseDir = ".",
3109
+ baseDir = process.cwd(),
3113
3110
  validate = true
3114
3111
  }) {
3115
3112
  const fileContent = await readFileContent(
@@ -3128,7 +3125,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
3128
3125
  });
3129
3126
  }
3130
3127
  static fromRulesyncMcp({
3131
- baseDir = ".",
3128
+ baseDir = process.cwd(),
3132
3129
  rulesyncMcp,
3133
3130
  validate = true
3134
3131
  }) {
@@ -3179,7 +3176,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
3179
3176
  };
3180
3177
  }
3181
3178
  static async fromFile({
3182
- baseDir = ".",
3179
+ baseDir = process.cwd(),
3183
3180
  validate = true,
3184
3181
  global = false
3185
3182
  }) {
@@ -3196,7 +3193,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
3196
3193
  });
3197
3194
  }
3198
3195
  static async fromRulesyncMcp({
3199
- baseDir = ".",
3196
+ baseDir = process.cwd(),
3200
3197
  rulesyncMcp,
3201
3198
  validate = true,
3202
3199
  global = false
@@ -3260,7 +3257,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
3260
3257
  };
3261
3258
  }
3262
3259
  static async fromFile({
3263
- baseDir = ".",
3260
+ baseDir = process.cwd(),
3264
3261
  validate = true
3265
3262
  }) {
3266
3263
  const fileContent = await readFileContent(
@@ -3279,7 +3276,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
3279
3276
  });
3280
3277
  }
3281
3278
  static fromRulesyncMcp({
3282
- baseDir = ".",
3279
+ baseDir = process.cwd(),
3283
3280
  rulesyncMcp,
3284
3281
  validate = true
3285
3282
  }) {
@@ -3317,7 +3314,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
3317
3314
  };
3318
3315
  }
3319
3316
  static async fromFile({
3320
- baseDir = ".",
3317
+ baseDir = process.cwd(),
3321
3318
  validate = true
3322
3319
  }) {
3323
3320
  const fileContent = await readFileContent(
@@ -3336,7 +3333,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
3336
3333
  });
3337
3334
  }
3338
3335
  static fromRulesyncMcp({
3339
- baseDir = ".",
3336
+ baseDir = process.cwd(),
3340
3337
  rulesyncMcp,
3341
3338
  validate = true
3342
3339
  }) {
@@ -3391,7 +3388,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
3391
3388
  };
3392
3389
  }
3393
3390
  static async fromFile({
3394
- baseDir = ".",
3391
+ baseDir = process.cwd(),
3395
3392
  validate = true,
3396
3393
  global = false
3397
3394
  }) {
@@ -3411,7 +3408,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
3411
3408
  });
3412
3409
  }
3413
3410
  static async fromRulesyncMcp({
3414
- baseDir = ".",
3411
+ baseDir = process.cwd(),
3415
3412
  rulesyncMcp,
3416
3413
  validate = true,
3417
3414
  global = false
@@ -3459,7 +3456,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
3459
3456
  };
3460
3457
  }
3461
3458
  static async fromFile({
3462
- baseDir = ".",
3459
+ baseDir = process.cwd(),
3463
3460
  validate = true
3464
3461
  }) {
3465
3462
  const fileContent = await readFileContent(
@@ -3478,7 +3475,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
3478
3475
  });
3479
3476
  }
3480
3477
  static fromRulesyncMcp({
3481
- baseDir = ".",
3478
+ baseDir = process.cwd(),
3482
3479
  rulesyncMcp,
3483
3480
  validate = true
3484
3481
  }) {
@@ -3509,7 +3506,7 @@ var mcpProcessorToolTargets = [
3509
3506
  "geminicli",
3510
3507
  "roo"
3511
3508
  ];
3512
- var McpProcessorToolTargetSchema = z12.enum(
3509
+ var McpProcessorToolTargetSchema = z13.enum(
3513
3510
  // codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
3514
3511
  mcpProcessorToolTargets.concat("codexcli")
3515
3512
  );
@@ -3520,7 +3517,7 @@ var McpProcessor = class extends FeatureProcessor {
3520
3517
  global;
3521
3518
  modularMcp;
3522
3519
  constructor({
3523
- baseDir = ".",
3520
+ baseDir = process.cwd(),
3524
3521
  toolTarget,
3525
3522
  global = false,
3526
3523
  modularMcp = false
@@ -3748,14 +3745,14 @@ var McpProcessor = class extends FeatureProcessor {
3748
3745
  // src/rules/rules-processor.ts
3749
3746
  import { basename as basename17, join as join63 } from "path";
3750
3747
  import { XMLBuilder } from "fast-xml-parser";
3751
- import { z as z21 } from "zod/mini";
3748
+ import { z as z22 } from "zod/mini";
3752
3749
 
3753
3750
  // src/subagents/agentsmd-subagent.ts
3754
3751
  import { join as join35 } from "path";
3755
3752
 
3756
3753
  // src/subagents/simulated-subagent.ts
3757
3754
  import { basename as basename12, join as join34 } from "path";
3758
- import { z as z13 } from "zod/mini";
3755
+ import { z as z14 } from "zod/mini";
3759
3756
 
3760
3757
  // src/subagents/tool-subagent.ts
3761
3758
  var ToolSubagent = class extends ToolFile {
@@ -3790,9 +3787,9 @@ var ToolSubagent = class extends ToolFile {
3790
3787
  };
3791
3788
 
3792
3789
  // src/subagents/simulated-subagent.ts
3793
- var SimulatedSubagentFrontmatterSchema = z13.object({
3794
- name: z13.string(),
3795
- description: z13.string()
3790
+ var SimulatedSubagentFrontmatterSchema = z14.object({
3791
+ name: z14.string(),
3792
+ description: z14.string()
3796
3793
  });
3797
3794
  var SimulatedSubagent = class extends ToolSubagent {
3798
3795
  frontmatter;
@@ -3823,7 +3820,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3823
3820
  throw new Error("Not implemented because it is a SIMULATED file.");
3824
3821
  }
3825
3822
  static fromRulesyncSubagentDefault({
3826
- baseDir = ".",
3823
+ baseDir = process.cwd(),
3827
3824
  rulesyncSubagent,
3828
3825
  validate = true
3829
3826
  }) {
@@ -3859,7 +3856,7 @@ var SimulatedSubagent = class extends ToolSubagent {
3859
3856
  }
3860
3857
  }
3861
3858
  static async fromFileDefault({
3862
- baseDir = ".",
3859
+ baseDir = process.cwd(),
3863
3860
  relativeFilePath,
3864
3861
  validate = true
3865
3862
  }) {
@@ -4026,22 +4023,22 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
4026
4023
 
4027
4024
  // src/subagents/subagents-processor.ts
4028
4025
  import { basename as basename14, join as join43 } from "path";
4029
- import { z as z16 } from "zod/mini";
4026
+ import { z as z17 } from "zod/mini";
4030
4027
 
4031
4028
  // src/subagents/claudecode-subagent.ts
4032
4029
  import { join as join42 } from "path";
4033
- import { z as z15 } from "zod/mini";
4030
+ import { z as z16 } from "zod/mini";
4034
4031
 
4035
4032
  // src/subagents/rulesync-subagent.ts
4036
4033
  import { basename as basename13, join as join41 } from "path";
4037
- import { z as z14 } from "zod/mini";
4038
- var RulesyncSubagentModelSchema = z14.enum(["opus", "sonnet", "haiku", "inherit"]);
4039
- var RulesyncSubagentFrontmatterSchema = z14.object({
4034
+ import { z as z15 } from "zod/mini";
4035
+ var RulesyncSubagentModelSchema = z15.enum(["opus", "sonnet", "haiku", "inherit"]);
4036
+ var RulesyncSubagentFrontmatterSchema = z15.object({
4040
4037
  targets: RulesyncTargetsSchema,
4041
- name: z14.string(),
4042
- description: z14.string(),
4043
- claudecode: z14.optional(
4044
- z14.object({
4038
+ name: z15.string(),
4039
+ description: z15.string(),
4040
+ claudecode: z15.optional(
4041
+ z15.object({
4045
4042
  model: RulesyncSubagentModelSchema
4046
4043
  })
4047
4044
  )
@@ -4094,7 +4091,9 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4094
4091
  static async fromFile({
4095
4092
  relativeFilePath
4096
4093
  }) {
4097
- const fileContent = await readFileContent(join41(".rulesync", "subagents", relativeFilePath));
4094
+ const fileContent = await readFileContent(
4095
+ join41(process.cwd(), ".rulesync", "subagents", relativeFilePath)
4096
+ );
4098
4097
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4099
4098
  const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
4100
4099
  if (!result.success) {
@@ -4102,7 +4101,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4102
4101
  }
4103
4102
  const filename = basename13(relativeFilePath);
4104
4103
  return new _RulesyncSubagent({
4105
- baseDir: ".",
4104
+ baseDir: process.cwd(),
4106
4105
  relativeDirPath: this.getSettablePaths().relativeDirPath,
4107
4106
  relativeFilePath: filename,
4108
4107
  frontmatter: result.data,
@@ -4113,10 +4112,10 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
4113
4112
  };
4114
4113
 
4115
4114
  // src/subagents/claudecode-subagent.ts
4116
- var ClaudecodeSubagentFrontmatterSchema = z15.object({
4117
- name: z15.string(),
4118
- description: z15.string(),
4119
- model: z15.optional(z15.enum(["opus", "sonnet", "haiku", "inherit"]))
4115
+ var ClaudecodeSubagentFrontmatterSchema = z16.object({
4116
+ name: z16.string(),
4117
+ description: z16.string(),
4118
+ model: z16.optional(z16.enum(["opus", "sonnet", "haiku", "inherit"]))
4120
4119
  });
4121
4120
  var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4122
4121
  frontmatter;
@@ -4171,7 +4170,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4171
4170
  });
4172
4171
  }
4173
4172
  static fromRulesyncSubagent({
4174
- baseDir = ".",
4173
+ baseDir = process.cwd(),
4175
4174
  rulesyncSubagent,
4176
4175
  validate = true,
4177
4176
  global = false
@@ -4218,7 +4217,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
4218
4217
  });
4219
4218
  }
4220
4219
  static async fromFile({
4221
- baseDir = ".",
4220
+ baseDir = process.cwd(),
4222
4221
  relativeFilePath,
4223
4222
  validate = true,
4224
4223
  global = false
@@ -4262,12 +4261,12 @@ var subagentsProcessorToolTargetsSimulated = [
4262
4261
  "roo"
4263
4262
  ];
4264
4263
  var subagentsProcessorToolTargetsGlobal = ["claudecode"];
4265
- var SubagentsProcessorToolTargetSchema = z16.enum(subagentsProcessorToolTargets);
4264
+ var SubagentsProcessorToolTargetSchema = z17.enum(subagentsProcessorToolTargets);
4266
4265
  var SubagentsProcessor = class extends FeatureProcessor {
4267
4266
  toolTarget;
4268
4267
  global;
4269
4268
  constructor({
4270
- baseDir = ".",
4269
+ baseDir = process.cwd(),
4271
4270
  toolTarget,
4272
4271
  global = false
4273
4272
  }) {
@@ -4378,7 +4377,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
4378
4377
  * Load and parse rulesync subagent files from .rulesync/subagents/ directory
4379
4378
  */
4380
4379
  async loadRulesyncFiles() {
4381
- const subagentsDir = join43(RulesyncSubagent.getSettablePaths().relativeDirPath);
4380
+ const subagentsDir = join43(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
4382
4381
  const dirExists = await directoryExists(subagentsDir);
4383
4382
  if (!dirExists) {
4384
4383
  logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
@@ -4547,23 +4546,23 @@ import { join as join45 } from "path";
4547
4546
 
4548
4547
  // src/rules/rulesync-rule.ts
4549
4548
  import { basename as basename15, join as join44 } from "path";
4550
- import { z as z17 } from "zod/mini";
4551
- var RulesyncRuleFrontmatterSchema = z17.object({
4552
- root: z17.optional(z17.optional(z17.boolean())),
4553
- targets: z17.optional(RulesyncTargetsSchema),
4554
- description: z17.optional(z17.string()),
4555
- globs: z17.optional(z17.array(z17.string())),
4556
- agentsmd: z17.optional(
4557
- z17.object({
4549
+ import { z as z18 } from "zod/mini";
4550
+ var RulesyncRuleFrontmatterSchema = z18.object({
4551
+ root: z18.optional(z18.optional(z18.boolean())),
4552
+ targets: z18.optional(RulesyncTargetsSchema),
4553
+ description: z18.optional(z18.string()),
4554
+ globs: z18.optional(z18.array(z18.string())),
4555
+ agentsmd: z18.optional(
4556
+ z18.object({
4558
4557
  // @example "path/to/subproject"
4559
- subprojectPath: z17.optional(z17.string())
4558
+ subprojectPath: z18.optional(z18.string())
4560
4559
  })
4561
4560
  ),
4562
- cursor: z17.optional(
4563
- z17.object({
4564
- alwaysApply: z17.optional(z17.boolean()),
4565
- description: z17.optional(z17.string()),
4566
- globs: z17.optional(z17.array(z17.string()))
4561
+ cursor: z18.optional(
4562
+ z18.object({
4563
+ alwaysApply: z18.optional(z18.boolean()),
4564
+ description: z18.optional(z18.string()),
4565
+ globs: z18.optional(z18.array(z18.string()))
4567
4566
  })
4568
4567
  )
4569
4568
  });
@@ -4619,7 +4618,11 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4619
4618
  relativeFilePath,
4620
4619
  validate = true
4621
4620
  }) {
4622
- const legacyPath = join44(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
4621
+ const legacyPath = join44(
4622
+ process.cwd(),
4623
+ this.getSettablePaths().legacy.relativeDirPath,
4624
+ relativeFilePath
4625
+ );
4623
4626
  const recommendedPath = join44(
4624
4627
  this.getSettablePaths().recommended.relativeDirPath,
4625
4628
  relativeFilePath
@@ -4641,7 +4644,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4641
4644
  };
4642
4645
  const filename = basename15(legacyPath);
4643
4646
  return new _RulesyncRule({
4644
- baseDir: ".",
4647
+ baseDir: process.cwd(),
4645
4648
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
4646
4649
  relativeFilePath: filename,
4647
4650
  frontmatter: validatedFrontmatter,
@@ -4653,7 +4656,11 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4653
4656
  relativeFilePath,
4654
4657
  validate = true
4655
4658
  }) {
4656
- const filePath = join44(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
4659
+ const filePath = join44(
4660
+ process.cwd(),
4661
+ this.getSettablePaths().recommended.relativeDirPath,
4662
+ relativeFilePath
4663
+ );
4657
4664
  const fileContent = await readFileContent(filePath);
4658
4665
  const { frontmatter, body: content } = parseFrontmatter(fileContent);
4659
4666
  const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
@@ -4670,7 +4677,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
4670
4677
  };
4671
4678
  const filename = basename15(filePath);
4672
4679
  return new _RulesyncRule({
4673
- baseDir: ".",
4680
+ baseDir: process.cwd(),
4674
4681
  relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
4675
4682
  relativeFilePath: filename,
4676
4683
  frontmatter: validatedFrontmatter,
@@ -4704,7 +4711,7 @@ var ToolRule = class extends ToolFile {
4704
4711
  throw new Error("Please implement this method in the subclass.");
4705
4712
  }
4706
4713
  static buildToolRuleParamsDefault({
4707
- baseDir = ".",
4714
+ baseDir = process.cwd(),
4708
4715
  rulesyncRule,
4709
4716
  validate = true,
4710
4717
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
@@ -4739,7 +4746,7 @@ var ToolRule = class extends ToolFile {
4739
4746
  };
4740
4747
  }
4741
4748
  static buildToolRuleParamsAgentsmd({
4742
- baseDir = ".",
4749
+ baseDir = process.cwd(),
4743
4750
  rulesyncRule,
4744
4751
  validate = true,
4745
4752
  rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
@@ -4825,7 +4832,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4825
4832
  };
4826
4833
  }
4827
4834
  static async fromFile({
4828
- baseDir = ".",
4835
+ baseDir = process.cwd(),
4829
4836
  relativeFilePath,
4830
4837
  validate = true
4831
4838
  }) {
@@ -4842,7 +4849,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
4842
4849
  });
4843
4850
  }
4844
4851
  static fromRulesyncRule({
4845
- baseDir = ".",
4852
+ baseDir = process.cwd(),
4846
4853
  rulesyncRule,
4847
4854
  validate = true
4848
4855
  }) {
@@ -4881,7 +4888,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4881
4888
  };
4882
4889
  }
4883
4890
  static async fromFile({
4884
- baseDir = ".",
4891
+ baseDir = process.cwd(),
4885
4892
  relativeFilePath,
4886
4893
  validate = true
4887
4894
  }) {
@@ -4898,7 +4905,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
4898
4905
  });
4899
4906
  }
4900
4907
  static fromRulesyncRule({
4901
- baseDir = ".",
4908
+ baseDir = process.cwd(),
4902
4909
  rulesyncRule,
4903
4910
  validate = true
4904
4911
  }) {
@@ -4957,7 +4964,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4957
4964
  };
4958
4965
  }
4959
4966
  static fromRulesyncRule({
4960
- baseDir = ".",
4967
+ baseDir = process.cwd(),
4961
4968
  rulesyncRule,
4962
4969
  validate = true
4963
4970
  }) {
@@ -4981,7 +4988,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
4981
4988
  });
4982
4989
  }
4983
4990
  static async fromFile({
4984
- baseDir = ".",
4991
+ baseDir = process.cwd(),
4985
4992
  relativeFilePath,
4986
4993
  validate = true
4987
4994
  }) {
@@ -5014,7 +5021,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
5014
5021
  };
5015
5022
  }
5016
5023
  static fromRulesyncRule({
5017
- baseDir = ".",
5024
+ baseDir = process.cwd(),
5018
5025
  rulesyncRule,
5019
5026
  validate = true
5020
5027
  }) {
@@ -5028,7 +5035,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
5028
5035
  );
5029
5036
  }
5030
5037
  static async fromFile({
5031
- baseDir = ".",
5038
+ baseDir = process.cwd(),
5032
5039
  relativeFilePath,
5033
5040
  validate = true
5034
5041
  }) {
@@ -5080,7 +5087,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
5080
5087
  };
5081
5088
  }
5082
5089
  static async fromFile({
5083
- baseDir = ".",
5090
+ baseDir = process.cwd(),
5084
5091
  relativeFilePath,
5085
5092
  validate = true,
5086
5093
  global = false
@@ -5116,7 +5123,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
5116
5123
  });
5117
5124
  }
5118
5125
  static fromRulesyncRule({
5119
- baseDir = ".",
5126
+ baseDir = process.cwd(),
5120
5127
  rulesyncRule,
5121
5128
  validate = true,
5122
5129
  global = false
@@ -5148,9 +5155,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
5148
5155
 
5149
5156
  // src/rules/cline-rule.ts
5150
5157
  import { join as join51 } from "path";
5151
- import { z as z18 } from "zod/mini";
5152
- var ClineRuleFrontmatterSchema = z18.object({
5153
- description: z18.string()
5158
+ import { z as z19 } from "zod/mini";
5159
+ var ClineRuleFrontmatterSchema = z19.object({
5160
+ description: z19.string()
5154
5161
  });
5155
5162
  var ClineRule = class _ClineRule extends ToolRule {
5156
5163
  static getSettablePaths() {
@@ -5164,7 +5171,7 @@ var ClineRule = class _ClineRule extends ToolRule {
5164
5171
  return this.toRulesyncRuleDefault();
5165
5172
  }
5166
5173
  static fromRulesyncRule({
5167
- baseDir = ".",
5174
+ baseDir = process.cwd(),
5168
5175
  rulesyncRule,
5169
5176
  validate = true
5170
5177
  }) {
@@ -5187,7 +5194,7 @@ var ClineRule = class _ClineRule extends ToolRule {
5187
5194
  });
5188
5195
  }
5189
5196
  static async fromFile({
5190
- baseDir = ".",
5197
+ baseDir = process.cwd(),
5191
5198
  relativeFilePath,
5192
5199
  validate = true
5193
5200
  }) {
@@ -5229,7 +5236,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
5229
5236
  };
5230
5237
  }
5231
5238
  static async fromFile({
5232
- baseDir = ".",
5239
+ baseDir = process.cwd(),
5233
5240
  relativeFilePath,
5234
5241
  validate = true,
5235
5242
  global = false
@@ -5265,7 +5272,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
5265
5272
  });
5266
5273
  }
5267
5274
  static fromRulesyncRule({
5268
- baseDir = ".",
5275
+ baseDir = process.cwd(),
5269
5276
  rulesyncRule,
5270
5277
  validate = true,
5271
5278
  global = false
@@ -5297,10 +5304,10 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
5297
5304
 
5298
5305
  // src/rules/copilot-rule.ts
5299
5306
  import { join as join53 } from "path";
5300
- import { z as z19 } from "zod/mini";
5301
- var CopilotRuleFrontmatterSchema = z19.object({
5302
- description: z19.optional(z19.string()),
5303
- applyTo: z19.optional(z19.string())
5307
+ import { z as z20 } from "zod/mini";
5308
+ var CopilotRuleFrontmatterSchema = z20.object({
5309
+ description: z20.optional(z20.string()),
5310
+ applyTo: z20.optional(z20.string())
5304
5311
  });
5305
5312
  var CopilotRule = class _CopilotRule extends ToolRule {
5306
5313
  frontmatter;
@@ -5358,7 +5365,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5358
5365
  });
5359
5366
  }
5360
5367
  static fromRulesyncRule({
5361
- baseDir = ".",
5368
+ baseDir = process.cwd(),
5362
5369
  rulesyncRule,
5363
5370
  validate = true
5364
5371
  }) {
@@ -5394,7 +5401,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5394
5401
  });
5395
5402
  }
5396
5403
  static async fromFile({
5397
- baseDir = ".",
5404
+ baseDir = process.cwd(),
5398
5405
  relativeFilePath,
5399
5406
  validate = true
5400
5407
  }) {
@@ -5467,11 +5474,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
5467
5474
 
5468
5475
  // src/rules/cursor-rule.ts
5469
5476
  import { basename as basename16, join as join54 } from "path";
5470
- import { z as z20 } from "zod/mini";
5471
- var CursorRuleFrontmatterSchema = z20.object({
5472
- description: z20.optional(z20.string()),
5473
- globs: z20.optional(z20.string()),
5474
- alwaysApply: z20.optional(z20.boolean())
5477
+ import { z as z21 } from "zod/mini";
5478
+ var CursorRuleFrontmatterSchema = z21.object({
5479
+ description: z21.optional(z21.string()),
5480
+ globs: z21.optional(z21.string()),
5481
+ alwaysApply: z21.optional(z21.boolean())
5475
5482
  });
5476
5483
  var CursorRule = class _CursorRule extends ToolRule {
5477
5484
  frontmatter;
@@ -5576,7 +5583,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5576
5583
  return targetGlobs && targetGlobs.length > 0 ? targetGlobs.join(",") : void 0;
5577
5584
  }
5578
5585
  static fromRulesyncRule({
5579
- baseDir = ".",
5586
+ baseDir = process.cwd(),
5580
5587
  rulesyncRule,
5581
5588
  validate = true
5582
5589
  }) {
@@ -5600,7 +5607,7 @@ var CursorRule = class _CursorRule extends ToolRule {
5600
5607
  });
5601
5608
  }
5602
5609
  static async fromFile({
5603
- baseDir = ".",
5610
+ baseDir = process.cwd(),
5604
5611
  relativeFilePath,
5605
5612
  validate = true
5606
5613
  }) {
@@ -5678,7 +5685,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
5678
5685
  };
5679
5686
  }
5680
5687
  static async fromFile({
5681
- baseDir = ".",
5688
+ baseDir = process.cwd(),
5682
5689
  relativeFilePath,
5683
5690
  validate = true,
5684
5691
  global = false
@@ -5714,7 +5721,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
5714
5721
  });
5715
5722
  }
5716
5723
  static fromRulesyncRule({
5717
- baseDir = ".",
5724
+ baseDir = process.cwd(),
5718
5725
  rulesyncRule,
5719
5726
  validate = true,
5720
5727
  global = false
@@ -5759,7 +5766,7 @@ var JunieRule = class _JunieRule extends ToolRule {
5759
5766
  };
5760
5767
  }
5761
5768
  static async fromFile({
5762
- baseDir = ".",
5769
+ baseDir = process.cwd(),
5763
5770
  relativeFilePath,
5764
5771
  validate = true
5765
5772
  }) {
@@ -5776,7 +5783,7 @@ var JunieRule = class _JunieRule extends ToolRule {
5776
5783
  });
5777
5784
  }
5778
5785
  static fromRulesyncRule({
5779
- baseDir = ".",
5786
+ baseDir = process.cwd(),
5780
5787
  rulesyncRule,
5781
5788
  validate = true
5782
5789
  }) {
@@ -5815,7 +5822,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5815
5822
  };
5816
5823
  }
5817
5824
  static async fromFile({
5818
- baseDir = ".",
5825
+ baseDir = process.cwd(),
5819
5826
  relativeFilePath,
5820
5827
  validate = true
5821
5828
  }) {
@@ -5832,7 +5839,7 @@ var KiroRule = class _KiroRule extends ToolRule {
5832
5839
  });
5833
5840
  }
5834
5841
  static fromRulesyncRule({
5835
- baseDir = ".",
5842
+ baseDir = process.cwd(),
5836
5843
  rulesyncRule,
5837
5844
  validate = true
5838
5845
  }) {
@@ -5874,7 +5881,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5874
5881
  };
5875
5882
  }
5876
5883
  static async fromFile({
5877
- baseDir = ".",
5884
+ baseDir = process.cwd(),
5878
5885
  relativeFilePath,
5879
5886
  validate = true
5880
5887
  }) {
@@ -5891,7 +5898,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
5891
5898
  });
5892
5899
  }
5893
5900
  static fromRulesyncRule({
5894
- baseDir = ".",
5901
+ baseDir = process.cwd(),
5895
5902
  rulesyncRule,
5896
5903
  validate = true
5897
5904
  }) {
@@ -5934,7 +5941,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5934
5941
  };
5935
5942
  }
5936
5943
  static async fromFile({
5937
- baseDir = ".",
5944
+ baseDir = process.cwd(),
5938
5945
  relativeFilePath,
5939
5946
  validate = true
5940
5947
  }) {
@@ -5951,7 +5958,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
5951
5958
  });
5952
5959
  }
5953
5960
  static fromRulesyncRule(params) {
5954
- const { baseDir = ".", rulesyncRule, validate = true } = params;
5961
+ const { baseDir = process.cwd(), rulesyncRule, validate = true } = params;
5955
5962
  return new _QwencodeRule(
5956
5963
  this.buildToolRuleParamsDefault({
5957
5964
  baseDir,
@@ -5987,7 +5994,7 @@ var RooRule = class _RooRule extends ToolRule {
5987
5994
  };
5988
5995
  }
5989
5996
  static async fromFile({
5990
- baseDir = ".",
5997
+ baseDir = process.cwd(),
5991
5998
  relativeFilePath,
5992
5999
  validate = true
5993
6000
  }) {
@@ -6004,7 +6011,7 @@ var RooRule = class _RooRule extends ToolRule {
6004
6011
  });
6005
6012
  }
6006
6013
  static fromRulesyncRule({
6007
- baseDir = ".",
6014
+ baseDir = process.cwd(),
6008
6015
  rulesyncRule,
6009
6016
  validate = true
6010
6017
  }) {
@@ -6068,7 +6075,7 @@ var WarpRule = class _WarpRule extends ToolRule {
6068
6075
  };
6069
6076
  }
6070
6077
  static async fromFile({
6071
- baseDir = ".",
6078
+ baseDir = process.cwd(),
6072
6079
  relativeFilePath,
6073
6080
  validate = true
6074
6081
  }) {
@@ -6085,7 +6092,7 @@ var WarpRule = class _WarpRule extends ToolRule {
6085
6092
  });
6086
6093
  }
6087
6094
  static fromRulesyncRule({
6088
- baseDir = ".",
6095
+ baseDir = process.cwd(),
6089
6096
  rulesyncRule,
6090
6097
  validate = true
6091
6098
  }) {
@@ -6124,7 +6131,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
6124
6131
  };
6125
6132
  }
6126
6133
  static async fromFile({
6127
- baseDir = ".",
6134
+ baseDir = process.cwd(),
6128
6135
  relativeFilePath,
6129
6136
  validate = true
6130
6137
  }) {
@@ -6140,7 +6147,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
6140
6147
  });
6141
6148
  }
6142
6149
  static fromRulesyncRule({
6143
- baseDir = ".",
6150
+ baseDir = process.cwd(),
6144
6151
  rulesyncRule,
6145
6152
  validate = true
6146
6153
  }) {
@@ -6187,7 +6194,7 @@ var rulesProcessorToolTargets = [
6187
6194
  "warp",
6188
6195
  "windsurf"
6189
6196
  ];
6190
- var RulesProcessorToolTargetSchema = z21.enum(rulesProcessorToolTargets);
6197
+ var RulesProcessorToolTargetSchema = z22.enum(rulesProcessorToolTargets);
6191
6198
  var rulesProcessorToolTargetsGlobal = [
6192
6199
  "claudecode",
6193
6200
  "codexcli",
@@ -6199,7 +6206,7 @@ var RulesProcessor = class extends FeatureProcessor {
6199
6206
  simulateSubagents;
6200
6207
  global;
6201
6208
  constructor({
6202
- baseDir = ".",
6209
+ baseDir = process.cwd(),
6203
6210
  toolTarget,
6204
6211
  simulateCommands = false,
6205
6212
  simulateSubagents = false,
@@ -7677,7 +7684,7 @@ Attention, again, you are just the planner, so though you can read any files and
7677
7684
  }
7678
7685
 
7679
7686
  // src/cli/index.ts
7680
- var getVersion = () => "3.13.0";
7687
+ var getVersion = () => "3.15.0";
7681
7688
  var main = async () => {
7682
7689
  const program = new Command();
7683
7690
  const version = getVersion();