rulesync 3.14.0 → 3.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -7
- package/dist/index.cjs +123 -131
- package/dist/index.js +304 -312
- package/package.json +15 -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
|
-
|
|
157
|
-
|
|
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
|
}
|
|
@@ -1630,10 +1633,29 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1630
1633
|
};
|
|
1631
1634
|
|
|
1632
1635
|
// src/config/config-resolver.ts
|
|
1633
|
-
import {
|
|
1634
|
-
import {
|
|
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;
|
|
@@ -1748,46 +1770,18 @@ var ConfigResolver = class {
|
|
|
1748
1770
|
experimentalSimulateCommands,
|
|
1749
1771
|
experimentalSimulateSubagents
|
|
1750
1772
|
}) {
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
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
1784
|
}
|
|
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
|
-
}
|
|
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,30 +1837,28 @@ 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.
|
|
1843
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => resolve3(baseDir));
|
|
1844
|
+
resolvedBaseDirs.forEach((baseDir) => {
|
|
1853
1845
|
validateBaseDir(baseDir);
|
|
1854
1846
|
});
|
|
1855
|
-
return
|
|
1847
|
+
return resolvedBaseDirs;
|
|
1856
1848
|
}
|
|
1857
1849
|
|
|
1858
1850
|
// src/ignore/ignore-processor.ts
|
|
1859
|
-
import { z as
|
|
1851
|
+
import { z as z11 } from "zod/mini";
|
|
1860
1852
|
|
|
1861
1853
|
// src/ignore/amazonqcli-ignore.ts
|
|
1862
|
-
import { join as
|
|
1854
|
+
import { join as join13 } from "path";
|
|
1863
1855
|
|
|
1864
1856
|
// src/types/tool-file.ts
|
|
1865
1857
|
var ToolFile = class extends AiFile {
|
|
1866
1858
|
};
|
|
1867
1859
|
|
|
1868
1860
|
// src/ignore/rulesync-ignore.ts
|
|
1869
|
-
import { join as
|
|
1861
|
+
import { join as join12 } from "path";
|
|
1870
1862
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
1871
1863
|
validate() {
|
|
1872
1864
|
return { success: true, error: null };
|
|
@@ -1879,7 +1871,7 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1879
1871
|
}
|
|
1880
1872
|
static async fromFile() {
|
|
1881
1873
|
const baseDir = process.cwd();
|
|
1882
|
-
const filePath =
|
|
1874
|
+
const filePath = join12(baseDir, this.getSettablePaths().relativeFilePath);
|
|
1883
1875
|
const fileContent = await readFileContent(filePath);
|
|
1884
1876
|
return new _RulesyncIgnore({
|
|
1885
1877
|
baseDir,
|
|
@@ -1970,7 +1962,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1970
1962
|
validate = true
|
|
1971
1963
|
}) {
|
|
1972
1964
|
const fileContent = await readFileContent(
|
|
1973
|
-
|
|
1965
|
+
join13(
|
|
1974
1966
|
baseDir,
|
|
1975
1967
|
this.getSettablePaths().relativeDirPath,
|
|
1976
1968
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1987,7 +1979,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1987
1979
|
};
|
|
1988
1980
|
|
|
1989
1981
|
// src/ignore/augmentcode-ignore.ts
|
|
1990
|
-
import { join as
|
|
1982
|
+
import { join as join14 } from "path";
|
|
1991
1983
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1992
1984
|
static getSettablePaths() {
|
|
1993
1985
|
return {
|
|
@@ -2025,7 +2017,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2025
2017
|
validate = true
|
|
2026
2018
|
}) {
|
|
2027
2019
|
const fileContent = await readFileContent(
|
|
2028
|
-
|
|
2020
|
+
join14(
|
|
2029
2021
|
baseDir,
|
|
2030
2022
|
this.getSettablePaths().relativeDirPath,
|
|
2031
2023
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2042,7 +2034,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2042
2034
|
};
|
|
2043
2035
|
|
|
2044
2036
|
// src/ignore/claudecode-ignore.ts
|
|
2045
|
-
import { join as
|
|
2037
|
+
import { join as join15 } from "path";
|
|
2046
2038
|
import { uniq } from "es-toolkit";
|
|
2047
2039
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2048
2040
|
constructor(params) {
|
|
@@ -2078,7 +2070,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2078
2070
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2079
2071
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2080
2072
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2081
|
-
const filePath =
|
|
2073
|
+
const filePath = join15(
|
|
2082
2074
|
baseDir,
|
|
2083
2075
|
this.getSettablePaths().relativeDirPath,
|
|
2084
2076
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2106,7 +2098,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2106
2098
|
validate = true
|
|
2107
2099
|
}) {
|
|
2108
2100
|
const fileContent = await readFileContent(
|
|
2109
|
-
|
|
2101
|
+
join15(
|
|
2110
2102
|
baseDir,
|
|
2111
2103
|
this.getSettablePaths().relativeDirPath,
|
|
2112
2104
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2123,7 +2115,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2123
2115
|
};
|
|
2124
2116
|
|
|
2125
2117
|
// src/ignore/cline-ignore.ts
|
|
2126
|
-
import { join as
|
|
2118
|
+
import { join as join16 } from "path";
|
|
2127
2119
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2128
2120
|
static getSettablePaths() {
|
|
2129
2121
|
return {
|
|
@@ -2160,7 +2152,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2160
2152
|
validate = true
|
|
2161
2153
|
}) {
|
|
2162
2154
|
const fileContent = await readFileContent(
|
|
2163
|
-
|
|
2155
|
+
join16(
|
|
2164
2156
|
baseDir,
|
|
2165
2157
|
this.getSettablePaths().relativeDirPath,
|
|
2166
2158
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2177,7 +2169,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2177
2169
|
};
|
|
2178
2170
|
|
|
2179
2171
|
// src/ignore/cursor-ignore.ts
|
|
2180
|
-
import { join as
|
|
2172
|
+
import { join as join17 } from "path";
|
|
2181
2173
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2182
2174
|
static getSettablePaths() {
|
|
2183
2175
|
return {
|
|
@@ -2210,7 +2202,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2210
2202
|
validate = true
|
|
2211
2203
|
}) {
|
|
2212
2204
|
const fileContent = await readFileContent(
|
|
2213
|
-
|
|
2205
|
+
join17(
|
|
2214
2206
|
baseDir,
|
|
2215
2207
|
this.getSettablePaths().relativeDirPath,
|
|
2216
2208
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2227,7 +2219,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2227
2219
|
};
|
|
2228
2220
|
|
|
2229
2221
|
// src/ignore/geminicli-ignore.ts
|
|
2230
|
-
import { join as
|
|
2222
|
+
import { join as join18 } from "path";
|
|
2231
2223
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2232
2224
|
static getSettablePaths() {
|
|
2233
2225
|
return {
|
|
@@ -2254,7 +2246,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2254
2246
|
validate = true
|
|
2255
2247
|
}) {
|
|
2256
2248
|
const fileContent = await readFileContent(
|
|
2257
|
-
|
|
2249
|
+
join18(
|
|
2258
2250
|
baseDir,
|
|
2259
2251
|
this.getSettablePaths().relativeDirPath,
|
|
2260
2252
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2271,7 +2263,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2271
2263
|
};
|
|
2272
2264
|
|
|
2273
2265
|
// src/ignore/junie-ignore.ts
|
|
2274
|
-
import { join as
|
|
2266
|
+
import { join as join19 } from "path";
|
|
2275
2267
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2276
2268
|
static getSettablePaths() {
|
|
2277
2269
|
return {
|
|
@@ -2298,7 +2290,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2298
2290
|
validate = true
|
|
2299
2291
|
}) {
|
|
2300
2292
|
const fileContent = await readFileContent(
|
|
2301
|
-
|
|
2293
|
+
join19(
|
|
2302
2294
|
baseDir,
|
|
2303
2295
|
this.getSettablePaths().relativeDirPath,
|
|
2304
2296
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2315,7 +2307,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2315
2307
|
};
|
|
2316
2308
|
|
|
2317
2309
|
// src/ignore/kiro-ignore.ts
|
|
2318
|
-
import { join as
|
|
2310
|
+
import { join as join20 } from "path";
|
|
2319
2311
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2320
2312
|
static getSettablePaths() {
|
|
2321
2313
|
return {
|
|
@@ -2342,7 +2334,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2342
2334
|
validate = true
|
|
2343
2335
|
}) {
|
|
2344
2336
|
const fileContent = await readFileContent(
|
|
2345
|
-
|
|
2337
|
+
join20(
|
|
2346
2338
|
baseDir,
|
|
2347
2339
|
this.getSettablePaths().relativeDirPath,
|
|
2348
2340
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2359,7 +2351,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2359
2351
|
};
|
|
2360
2352
|
|
|
2361
2353
|
// src/ignore/qwencode-ignore.ts
|
|
2362
|
-
import { join as
|
|
2354
|
+
import { join as join21 } from "path";
|
|
2363
2355
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2364
2356
|
static getSettablePaths() {
|
|
2365
2357
|
return {
|
|
@@ -2386,7 +2378,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2386
2378
|
validate = true
|
|
2387
2379
|
}) {
|
|
2388
2380
|
const fileContent = await readFileContent(
|
|
2389
|
-
|
|
2381
|
+
join21(
|
|
2390
2382
|
baseDir,
|
|
2391
2383
|
this.getSettablePaths().relativeDirPath,
|
|
2392
2384
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2403,7 +2395,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2403
2395
|
};
|
|
2404
2396
|
|
|
2405
2397
|
// src/ignore/roo-ignore.ts
|
|
2406
|
-
import { join as
|
|
2398
|
+
import { join as join22 } from "path";
|
|
2407
2399
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2408
2400
|
static getSettablePaths() {
|
|
2409
2401
|
return {
|
|
@@ -2430,7 +2422,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2430
2422
|
validate = true
|
|
2431
2423
|
}) {
|
|
2432
2424
|
const fileContent = await readFileContent(
|
|
2433
|
-
|
|
2425
|
+
join22(
|
|
2434
2426
|
baseDir,
|
|
2435
2427
|
this.getSettablePaths().relativeDirPath,
|
|
2436
2428
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2447,7 +2439,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2447
2439
|
};
|
|
2448
2440
|
|
|
2449
2441
|
// src/ignore/windsurf-ignore.ts
|
|
2450
|
-
import { join as
|
|
2442
|
+
import { join as join23 } from "path";
|
|
2451
2443
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
2452
2444
|
static getSettablePaths() {
|
|
2453
2445
|
return {
|
|
@@ -2474,7 +2466,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2474
2466
|
validate = true
|
|
2475
2467
|
}) {
|
|
2476
2468
|
const fileContent = await readFileContent(
|
|
2477
|
-
|
|
2469
|
+
join23(
|
|
2478
2470
|
baseDir,
|
|
2479
2471
|
this.getSettablePaths().relativeDirPath,
|
|
2480
2472
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2504,7 +2496,7 @@ var ignoreProcessorToolTargets = [
|
|
|
2504
2496
|
"roo",
|
|
2505
2497
|
"windsurf"
|
|
2506
2498
|
];
|
|
2507
|
-
var IgnoreProcessorToolTargetSchema =
|
|
2499
|
+
var IgnoreProcessorToolTargetSchema = z11.enum(ignoreProcessorToolTargets);
|
|
2508
2500
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
2509
2501
|
toolTarget;
|
|
2510
2502
|
constructor({
|
|
@@ -2679,45 +2671,45 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2679
2671
|
};
|
|
2680
2672
|
|
|
2681
2673
|
// src/mcp/mcp-processor.ts
|
|
2682
|
-
import { z as
|
|
2674
|
+
import { z as z13 } from "zod/mini";
|
|
2683
2675
|
|
|
2684
2676
|
// src/mcp/amazonqcli-mcp.ts
|
|
2685
|
-
import { join as
|
|
2677
|
+
import { join as join25 } from "path";
|
|
2686
2678
|
|
|
2687
2679
|
// src/mcp/rulesync-mcp.ts
|
|
2688
|
-
import { join as
|
|
2680
|
+
import { join as join24 } from "path";
|
|
2689
2681
|
import { omit } from "es-toolkit/object";
|
|
2690
|
-
import { z as
|
|
2691
|
-
var McpTransportTypeSchema =
|
|
2692
|
-
var McpServerBaseSchema =
|
|
2693
|
-
type:
|
|
2694
|
-
command:
|
|
2695
|
-
args:
|
|
2696
|
-
url:
|
|
2697
|
-
httpUrl:
|
|
2698
|
-
env:
|
|
2699
|
-
disabled:
|
|
2700
|
-
networkTimeout:
|
|
2701
|
-
timeout:
|
|
2702
|
-
trust:
|
|
2703
|
-
cwd:
|
|
2704
|
-
transport:
|
|
2705
|
-
alwaysAllow:
|
|
2706
|
-
tools:
|
|
2707
|
-
kiroAutoApprove:
|
|
2708
|
-
kiroAutoBlock:
|
|
2709
|
-
headers:
|
|
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()))
|
|
2710
2702
|
});
|
|
2711
|
-
var ModularMcpServerSchema =
|
|
2712
|
-
description:
|
|
2703
|
+
var ModularMcpServerSchema = z12.extend(McpServerBaseSchema, {
|
|
2704
|
+
description: z12.string().check(z12.minLength(1))
|
|
2713
2705
|
});
|
|
2714
|
-
var ModularMcpServersSchema =
|
|
2715
|
-
var RulesyncMcpServersSchema =
|
|
2716
|
-
description:
|
|
2717
|
-
targets:
|
|
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)
|
|
2718
2710
|
});
|
|
2719
|
-
var RulesyncMcpConfigSchema =
|
|
2720
|
-
mcpServers:
|
|
2711
|
+
var RulesyncMcpConfigSchema = z12.object({
|
|
2712
|
+
mcpServers: z12.record(z12.string(), RulesyncMcpServersSchema)
|
|
2721
2713
|
});
|
|
2722
2714
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
2723
2715
|
json;
|
|
@@ -2765,12 +2757,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2765
2757
|
}) {
|
|
2766
2758
|
const baseDir = process.cwd();
|
|
2767
2759
|
const paths = this.getSettablePaths();
|
|
2768
|
-
const recommendedPath =
|
|
2760
|
+
const recommendedPath = join24(
|
|
2769
2761
|
baseDir,
|
|
2770
2762
|
paths.recommended.relativeDirPath,
|
|
2771
2763
|
paths.recommended.relativeFilePath
|
|
2772
2764
|
);
|
|
2773
|
-
const legacyPath =
|
|
2765
|
+
const legacyPath = join24(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2774
2766
|
if (await fileExists(recommendedPath)) {
|
|
2775
2767
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2776
2768
|
return new _RulesyncMcp({
|
|
@@ -2889,7 +2881,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2889
2881
|
validate = true
|
|
2890
2882
|
}) {
|
|
2891
2883
|
const fileContent = await readFileContent(
|
|
2892
|
-
|
|
2884
|
+
join25(
|
|
2893
2885
|
baseDir,
|
|
2894
2886
|
this.getSettablePaths().relativeDirPath,
|
|
2895
2887
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2925,10 +2917,10 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2925
2917
|
};
|
|
2926
2918
|
|
|
2927
2919
|
// src/mcp/claudecode-mcp.ts
|
|
2928
|
-
import { join as
|
|
2920
|
+
import { join as join27 } from "path";
|
|
2929
2921
|
|
|
2930
2922
|
// src/mcp/modular-mcp.ts
|
|
2931
|
-
import { join as
|
|
2923
|
+
import { join as join26 } from "path";
|
|
2932
2924
|
var ModularMcp = class _ModularMcp extends AiFile {
|
|
2933
2925
|
json;
|
|
2934
2926
|
constructor(params) {
|
|
@@ -2983,7 +2975,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
2983
2975
|
args: [
|
|
2984
2976
|
"-y",
|
|
2985
2977
|
"@kimuson/modular-mcp",
|
|
2986
|
-
|
|
2978
|
+
join26(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
2987
2979
|
],
|
|
2988
2980
|
env: {}
|
|
2989
2981
|
}
|
|
@@ -3044,7 +3036,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3044
3036
|
}) {
|
|
3045
3037
|
const paths = this.getSettablePaths({ global });
|
|
3046
3038
|
const fileContent = await readOrInitializeFileContent(
|
|
3047
|
-
|
|
3039
|
+
join27(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3048
3040
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3049
3041
|
);
|
|
3050
3042
|
const json = JSON.parse(fileContent);
|
|
@@ -3066,7 +3058,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3066
3058
|
}) {
|
|
3067
3059
|
const paths = this.getSettablePaths({ global });
|
|
3068
3060
|
const fileContent = await readOrInitializeFileContent(
|
|
3069
|
-
|
|
3061
|
+
join27(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3070
3062
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3071
3063
|
);
|
|
3072
3064
|
const json = JSON.parse(fileContent);
|
|
@@ -3097,7 +3089,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3097
3089
|
};
|
|
3098
3090
|
|
|
3099
3091
|
// src/mcp/cline-mcp.ts
|
|
3100
|
-
import { join as
|
|
3092
|
+
import { join as join28 } from "path";
|
|
3101
3093
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3102
3094
|
json;
|
|
3103
3095
|
constructor(params) {
|
|
@@ -3118,7 +3110,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3118
3110
|
validate = true
|
|
3119
3111
|
}) {
|
|
3120
3112
|
const fileContent = await readFileContent(
|
|
3121
|
-
|
|
3113
|
+
join28(
|
|
3122
3114
|
baseDir,
|
|
3123
3115
|
this.getSettablePaths().relativeDirPath,
|
|
3124
3116
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3154,7 +3146,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3154
3146
|
};
|
|
3155
3147
|
|
|
3156
3148
|
// src/mcp/codexcli-mcp.ts
|
|
3157
|
-
import { join as
|
|
3149
|
+
import { join as join29 } from "path";
|
|
3158
3150
|
import * as smolToml from "smol-toml";
|
|
3159
3151
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3160
3152
|
toml;
|
|
@@ -3190,7 +3182,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3190
3182
|
}) {
|
|
3191
3183
|
const paths = this.getSettablePaths({ global });
|
|
3192
3184
|
const fileContent = await readFileContent(
|
|
3193
|
-
|
|
3185
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3194
3186
|
);
|
|
3195
3187
|
return new _CodexcliMcp({
|
|
3196
3188
|
baseDir,
|
|
@@ -3207,7 +3199,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3207
3199
|
global = false
|
|
3208
3200
|
}) {
|
|
3209
3201
|
const paths = this.getSettablePaths({ global });
|
|
3210
|
-
const configTomlFilePath =
|
|
3202
|
+
const configTomlFilePath = join29(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3211
3203
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3212
3204
|
configTomlFilePath,
|
|
3213
3205
|
smolToml.stringify({})
|
|
@@ -3248,7 +3240,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3248
3240
|
};
|
|
3249
3241
|
|
|
3250
3242
|
// src/mcp/copilot-mcp.ts
|
|
3251
|
-
import { join as
|
|
3243
|
+
import { join as join30 } from "path";
|
|
3252
3244
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
3253
3245
|
json;
|
|
3254
3246
|
constructor(params) {
|
|
@@ -3269,7 +3261,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3269
3261
|
validate = true
|
|
3270
3262
|
}) {
|
|
3271
3263
|
const fileContent = await readFileContent(
|
|
3272
|
-
|
|
3264
|
+
join30(
|
|
3273
3265
|
baseDir,
|
|
3274
3266
|
this.getSettablePaths().relativeDirPath,
|
|
3275
3267
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3305,7 +3297,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3305
3297
|
};
|
|
3306
3298
|
|
|
3307
3299
|
// src/mcp/cursor-mcp.ts
|
|
3308
|
-
import { join as
|
|
3300
|
+
import { join as join31 } from "path";
|
|
3309
3301
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3310
3302
|
json;
|
|
3311
3303
|
constructor(params) {
|
|
@@ -3326,7 +3318,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3326
3318
|
validate = true
|
|
3327
3319
|
}) {
|
|
3328
3320
|
const fileContent = await readFileContent(
|
|
3329
|
-
|
|
3321
|
+
join31(
|
|
3330
3322
|
baseDir,
|
|
3331
3323
|
this.getSettablePaths().relativeDirPath,
|
|
3332
3324
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3373,7 +3365,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3373
3365
|
};
|
|
3374
3366
|
|
|
3375
3367
|
// src/mcp/geminicli-mcp.ts
|
|
3376
|
-
import { join as
|
|
3368
|
+
import { join as join32 } from "path";
|
|
3377
3369
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
3378
3370
|
json;
|
|
3379
3371
|
constructor(params) {
|
|
@@ -3402,7 +3394,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3402
3394
|
}) {
|
|
3403
3395
|
const paths = this.getSettablePaths({ global });
|
|
3404
3396
|
const fileContent = await readOrInitializeFileContent(
|
|
3405
|
-
|
|
3397
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3406
3398
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3407
3399
|
);
|
|
3408
3400
|
const json = JSON.parse(fileContent);
|
|
@@ -3423,7 +3415,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3423
3415
|
}) {
|
|
3424
3416
|
const paths = this.getSettablePaths({ global });
|
|
3425
3417
|
const fileContent = await readOrInitializeFileContent(
|
|
3426
|
-
|
|
3418
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3427
3419
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3428
3420
|
);
|
|
3429
3421
|
const json = JSON.parse(fileContent);
|
|
@@ -3447,7 +3439,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3447
3439
|
};
|
|
3448
3440
|
|
|
3449
3441
|
// src/mcp/roo-mcp.ts
|
|
3450
|
-
import { join as
|
|
3442
|
+
import { join as join33 } from "path";
|
|
3451
3443
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
3452
3444
|
json;
|
|
3453
3445
|
constructor(params) {
|
|
@@ -3468,7 +3460,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
3468
3460
|
validate = true
|
|
3469
3461
|
}) {
|
|
3470
3462
|
const fileContent = await readFileContent(
|
|
3471
|
-
|
|
3463
|
+
join33(
|
|
3472
3464
|
baseDir,
|
|
3473
3465
|
this.getSettablePaths().relativeDirPath,
|
|
3474
3466
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3514,7 +3506,7 @@ var mcpProcessorToolTargets = [
|
|
|
3514
3506
|
"geminicli",
|
|
3515
3507
|
"roo"
|
|
3516
3508
|
];
|
|
3517
|
-
var McpProcessorToolTargetSchema =
|
|
3509
|
+
var McpProcessorToolTargetSchema = z13.enum(
|
|
3518
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
|
|
3519
3511
|
mcpProcessorToolTargets.concat("codexcli")
|
|
3520
3512
|
);
|
|
@@ -3751,16 +3743,16 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
3751
3743
|
};
|
|
3752
3744
|
|
|
3753
3745
|
// src/rules/rules-processor.ts
|
|
3754
|
-
import { basename as basename17, join as
|
|
3746
|
+
import { basename as basename17, join as join63 } from "path";
|
|
3755
3747
|
import { XMLBuilder } from "fast-xml-parser";
|
|
3756
|
-
import { z as
|
|
3748
|
+
import { z as z22 } from "zod/mini";
|
|
3757
3749
|
|
|
3758
3750
|
// src/subagents/agentsmd-subagent.ts
|
|
3759
|
-
import { join as
|
|
3751
|
+
import { join as join35 } from "path";
|
|
3760
3752
|
|
|
3761
3753
|
// src/subagents/simulated-subagent.ts
|
|
3762
|
-
import { basename as basename12, join as
|
|
3763
|
-
import { z as
|
|
3754
|
+
import { basename as basename12, join as join34 } from "path";
|
|
3755
|
+
import { z as z14 } from "zod/mini";
|
|
3764
3756
|
|
|
3765
3757
|
// src/subagents/tool-subagent.ts
|
|
3766
3758
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -3795,9 +3787,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
3795
3787
|
};
|
|
3796
3788
|
|
|
3797
3789
|
// src/subagents/simulated-subagent.ts
|
|
3798
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
3799
|
-
name:
|
|
3800
|
-
description:
|
|
3790
|
+
var SimulatedSubagentFrontmatterSchema = z14.object({
|
|
3791
|
+
name: z14.string(),
|
|
3792
|
+
description: z14.string()
|
|
3801
3793
|
});
|
|
3802
3794
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
3803
3795
|
frontmatter;
|
|
@@ -3807,7 +3799,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3807
3799
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3808
3800
|
if (!result.success) {
|
|
3809
3801
|
throw new Error(
|
|
3810
|
-
`Invalid frontmatter in ${
|
|
3802
|
+
`Invalid frontmatter in ${join34(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
3811
3803
|
);
|
|
3812
3804
|
}
|
|
3813
3805
|
}
|
|
@@ -3858,7 +3850,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3858
3850
|
return {
|
|
3859
3851
|
success: false,
|
|
3860
3852
|
error: new Error(
|
|
3861
|
-
`Invalid frontmatter in ${
|
|
3853
|
+
`Invalid frontmatter in ${join34(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
3862
3854
|
)
|
|
3863
3855
|
};
|
|
3864
3856
|
}
|
|
@@ -3868,7 +3860,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3868
3860
|
relativeFilePath,
|
|
3869
3861
|
validate = true
|
|
3870
3862
|
}) {
|
|
3871
|
-
const filePath =
|
|
3863
|
+
const filePath = join34(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
3872
3864
|
const fileContent = await readFileContent(filePath);
|
|
3873
3865
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3874
3866
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3890,7 +3882,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
3890
3882
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
3891
3883
|
static getSettablePaths() {
|
|
3892
3884
|
return {
|
|
3893
|
-
relativeDirPath:
|
|
3885
|
+
relativeDirPath: join35(".agents", "subagents")
|
|
3894
3886
|
};
|
|
3895
3887
|
}
|
|
3896
3888
|
static async fromFile(params) {
|
|
@@ -3910,11 +3902,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
3910
3902
|
};
|
|
3911
3903
|
|
|
3912
3904
|
// src/subagents/codexcli-subagent.ts
|
|
3913
|
-
import { join as
|
|
3905
|
+
import { join as join36 } from "path";
|
|
3914
3906
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
3915
3907
|
static getSettablePaths() {
|
|
3916
3908
|
return {
|
|
3917
|
-
relativeDirPath:
|
|
3909
|
+
relativeDirPath: join36(".codex", "subagents")
|
|
3918
3910
|
};
|
|
3919
3911
|
}
|
|
3920
3912
|
static async fromFile(params) {
|
|
@@ -3934,11 +3926,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
3934
3926
|
};
|
|
3935
3927
|
|
|
3936
3928
|
// src/subagents/copilot-subagent.ts
|
|
3937
|
-
import { join as
|
|
3929
|
+
import { join as join37 } from "path";
|
|
3938
3930
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
3939
3931
|
static getSettablePaths() {
|
|
3940
3932
|
return {
|
|
3941
|
-
relativeDirPath:
|
|
3933
|
+
relativeDirPath: join37(".github", "subagents")
|
|
3942
3934
|
};
|
|
3943
3935
|
}
|
|
3944
3936
|
static async fromFile(params) {
|
|
@@ -3958,11 +3950,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
3958
3950
|
};
|
|
3959
3951
|
|
|
3960
3952
|
// src/subagents/cursor-subagent.ts
|
|
3961
|
-
import { join as
|
|
3953
|
+
import { join as join38 } from "path";
|
|
3962
3954
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
3963
3955
|
static getSettablePaths() {
|
|
3964
3956
|
return {
|
|
3965
|
-
relativeDirPath:
|
|
3957
|
+
relativeDirPath: join38(".cursor", "subagents")
|
|
3966
3958
|
};
|
|
3967
3959
|
}
|
|
3968
3960
|
static async fromFile(params) {
|
|
@@ -3982,11 +3974,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
3982
3974
|
};
|
|
3983
3975
|
|
|
3984
3976
|
// src/subagents/geminicli-subagent.ts
|
|
3985
|
-
import { join as
|
|
3977
|
+
import { join as join39 } from "path";
|
|
3986
3978
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
3987
3979
|
static getSettablePaths() {
|
|
3988
3980
|
return {
|
|
3989
|
-
relativeDirPath:
|
|
3981
|
+
relativeDirPath: join39(".gemini", "subagents")
|
|
3990
3982
|
};
|
|
3991
3983
|
}
|
|
3992
3984
|
static async fromFile(params) {
|
|
@@ -4006,11 +3998,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
4006
3998
|
};
|
|
4007
3999
|
|
|
4008
4000
|
// src/subagents/roo-subagent.ts
|
|
4009
|
-
import { join as
|
|
4001
|
+
import { join as join40 } from "path";
|
|
4010
4002
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
4011
4003
|
static getSettablePaths() {
|
|
4012
4004
|
return {
|
|
4013
|
-
relativeDirPath:
|
|
4005
|
+
relativeDirPath: join40(".roo", "subagents")
|
|
4014
4006
|
};
|
|
4015
4007
|
}
|
|
4016
4008
|
static async fromFile(params) {
|
|
@@ -4030,23 +4022,23 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
4030
4022
|
};
|
|
4031
4023
|
|
|
4032
4024
|
// src/subagents/subagents-processor.ts
|
|
4033
|
-
import { basename as basename14, join as
|
|
4034
|
-
import { z as
|
|
4025
|
+
import { basename as basename14, join as join43 } from "path";
|
|
4026
|
+
import { z as z17 } from "zod/mini";
|
|
4035
4027
|
|
|
4036
4028
|
// src/subagents/claudecode-subagent.ts
|
|
4037
|
-
import { join as
|
|
4038
|
-
import { z as
|
|
4029
|
+
import { join as join42 } from "path";
|
|
4030
|
+
import { z as z16 } from "zod/mini";
|
|
4039
4031
|
|
|
4040
4032
|
// src/subagents/rulesync-subagent.ts
|
|
4041
|
-
import { basename as basename13, join as
|
|
4042
|
-
import { z as
|
|
4043
|
-
var RulesyncSubagentModelSchema =
|
|
4044
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
4033
|
+
import { basename as basename13, join as join41 } from "path";
|
|
4034
|
+
import { z as z15 } from "zod/mini";
|
|
4035
|
+
var RulesyncSubagentModelSchema = z15.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
4036
|
+
var RulesyncSubagentFrontmatterSchema = z15.object({
|
|
4045
4037
|
targets: RulesyncTargetsSchema,
|
|
4046
|
-
name:
|
|
4047
|
-
description:
|
|
4048
|
-
claudecode:
|
|
4049
|
-
|
|
4038
|
+
name: z15.string(),
|
|
4039
|
+
description: z15.string(),
|
|
4040
|
+
claudecode: z15.optional(
|
|
4041
|
+
z15.object({
|
|
4050
4042
|
model: RulesyncSubagentModelSchema
|
|
4051
4043
|
})
|
|
4052
4044
|
)
|
|
@@ -4059,7 +4051,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4059
4051
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
4060
4052
|
if (!result.success) {
|
|
4061
4053
|
throw new Error(
|
|
4062
|
-
`Invalid frontmatter in ${
|
|
4054
|
+
`Invalid frontmatter in ${join41(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
4063
4055
|
);
|
|
4064
4056
|
}
|
|
4065
4057
|
}
|
|
@@ -4071,7 +4063,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4071
4063
|
}
|
|
4072
4064
|
static getSettablePaths() {
|
|
4073
4065
|
return {
|
|
4074
|
-
relativeDirPath:
|
|
4066
|
+
relativeDirPath: join41(".rulesync", "subagents")
|
|
4075
4067
|
};
|
|
4076
4068
|
}
|
|
4077
4069
|
getFrontmatter() {
|
|
@@ -4091,7 +4083,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4091
4083
|
return {
|
|
4092
4084
|
success: false,
|
|
4093
4085
|
error: new Error(
|
|
4094
|
-
`Invalid frontmatter in ${
|
|
4086
|
+
`Invalid frontmatter in ${join41(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
4095
4087
|
)
|
|
4096
4088
|
};
|
|
4097
4089
|
}
|
|
@@ -4100,7 +4092,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4100
4092
|
relativeFilePath
|
|
4101
4093
|
}) {
|
|
4102
4094
|
const fileContent = await readFileContent(
|
|
4103
|
-
|
|
4095
|
+
join41(process.cwd(), ".rulesync", "subagents", relativeFilePath)
|
|
4104
4096
|
);
|
|
4105
4097
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4106
4098
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -4120,10 +4112,10 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
4120
4112
|
};
|
|
4121
4113
|
|
|
4122
4114
|
// src/subagents/claudecode-subagent.ts
|
|
4123
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
4124
|
-
name:
|
|
4125
|
-
description:
|
|
4126
|
-
model:
|
|
4115
|
+
var ClaudecodeSubagentFrontmatterSchema = z16.object({
|
|
4116
|
+
name: z16.string(),
|
|
4117
|
+
description: z16.string(),
|
|
4118
|
+
model: z16.optional(z16.enum(["opus", "sonnet", "haiku", "inherit"]))
|
|
4127
4119
|
});
|
|
4128
4120
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
4129
4121
|
frontmatter;
|
|
@@ -4133,7 +4125,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4133
4125
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
4134
4126
|
if (!result.success) {
|
|
4135
4127
|
throw new Error(
|
|
4136
|
-
`Invalid frontmatter in ${
|
|
4128
|
+
`Invalid frontmatter in ${join42(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
4137
4129
|
);
|
|
4138
4130
|
}
|
|
4139
4131
|
}
|
|
@@ -4145,7 +4137,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4145
4137
|
}
|
|
4146
4138
|
static getSettablePaths(_options = {}) {
|
|
4147
4139
|
return {
|
|
4148
|
-
relativeDirPath:
|
|
4140
|
+
relativeDirPath: join42(".claude", "agents")
|
|
4149
4141
|
};
|
|
4150
4142
|
}
|
|
4151
4143
|
getFrontmatter() {
|
|
@@ -4171,7 +4163,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4171
4163
|
// RulesyncCommand baseDir is always the project root directory
|
|
4172
4164
|
frontmatter: rulesyncFrontmatter,
|
|
4173
4165
|
body: this.body,
|
|
4174
|
-
relativeDirPath:
|
|
4166
|
+
relativeDirPath: join42(".rulesync", "subagents"),
|
|
4175
4167
|
relativeFilePath: this.getRelativeFilePath(),
|
|
4176
4168
|
fileContent,
|
|
4177
4169
|
validate: true
|
|
@@ -4213,7 +4205,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4213
4205
|
return {
|
|
4214
4206
|
success: false,
|
|
4215
4207
|
error: new Error(
|
|
4216
|
-
`Invalid frontmatter in ${
|
|
4208
|
+
`Invalid frontmatter in ${join42(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
4217
4209
|
)
|
|
4218
4210
|
};
|
|
4219
4211
|
}
|
|
@@ -4231,7 +4223,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
4231
4223
|
global = false
|
|
4232
4224
|
}) {
|
|
4233
4225
|
const paths = this.getSettablePaths({ global });
|
|
4234
|
-
const filePath =
|
|
4226
|
+
const filePath = join42(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
4235
4227
|
const fileContent = await readFileContent(filePath);
|
|
4236
4228
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
4237
4229
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -4269,7 +4261,7 @@ var subagentsProcessorToolTargetsSimulated = [
|
|
|
4269
4261
|
"roo"
|
|
4270
4262
|
];
|
|
4271
4263
|
var subagentsProcessorToolTargetsGlobal = ["claudecode"];
|
|
4272
|
-
var SubagentsProcessorToolTargetSchema =
|
|
4264
|
+
var SubagentsProcessorToolTargetSchema = z17.enum(subagentsProcessorToolTargets);
|
|
4273
4265
|
var SubagentsProcessor = class extends FeatureProcessor {
|
|
4274
4266
|
toolTarget;
|
|
4275
4267
|
global;
|
|
@@ -4385,7 +4377,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4385
4377
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
4386
4378
|
*/
|
|
4387
4379
|
async loadRulesyncFiles() {
|
|
4388
|
-
const subagentsDir =
|
|
4380
|
+
const subagentsDir = join43(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
4389
4381
|
const dirExists = await directoryExists(subagentsDir);
|
|
4390
4382
|
if (!dirExists) {
|
|
4391
4383
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -4400,7 +4392,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4400
4392
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
4401
4393
|
const rulesyncSubagents = [];
|
|
4402
4394
|
for (const mdFile of mdFiles) {
|
|
4403
|
-
const filepath =
|
|
4395
|
+
const filepath = join43(subagentsDir, mdFile);
|
|
4404
4396
|
try {
|
|
4405
4397
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
4406
4398
|
relativeFilePath: mdFile,
|
|
@@ -4519,7 +4511,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4519
4511
|
relativeDirPath,
|
|
4520
4512
|
fromFile
|
|
4521
4513
|
}) {
|
|
4522
|
-
const paths = await findFilesByGlobs(
|
|
4514
|
+
const paths = await findFilesByGlobs(join43(this.baseDir, relativeDirPath, "*.md"));
|
|
4523
4515
|
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename14(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
4524
4516
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
4525
4517
|
return subagents;
|
|
@@ -4547,30 +4539,30 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
4547
4539
|
};
|
|
4548
4540
|
|
|
4549
4541
|
// src/rules/agentsmd-rule.ts
|
|
4550
|
-
import { join as
|
|
4542
|
+
import { join as join46 } from "path";
|
|
4551
4543
|
|
|
4552
4544
|
// src/rules/tool-rule.ts
|
|
4553
|
-
import { join as
|
|
4545
|
+
import { join as join45 } from "path";
|
|
4554
4546
|
|
|
4555
4547
|
// src/rules/rulesync-rule.ts
|
|
4556
|
-
import { basename as basename15, join as
|
|
4557
|
-
import { z as
|
|
4558
|
-
var RulesyncRuleFrontmatterSchema =
|
|
4559
|
-
root:
|
|
4560
|
-
targets:
|
|
4561
|
-
description:
|
|
4562
|
-
globs:
|
|
4563
|
-
agentsmd:
|
|
4564
|
-
|
|
4548
|
+
import { basename as basename15, join as join44 } from "path";
|
|
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({
|
|
4565
4557
|
// @example "path/to/subproject"
|
|
4566
|
-
subprojectPath:
|
|
4558
|
+
subprojectPath: z18.optional(z18.string())
|
|
4567
4559
|
})
|
|
4568
4560
|
),
|
|
4569
|
-
cursor:
|
|
4570
|
-
|
|
4571
|
-
alwaysApply:
|
|
4572
|
-
description:
|
|
4573
|
-
globs:
|
|
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()))
|
|
4574
4566
|
})
|
|
4575
4567
|
)
|
|
4576
4568
|
});
|
|
@@ -4582,7 +4574,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4582
4574
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4583
4575
|
if (!result.success) {
|
|
4584
4576
|
throw new Error(
|
|
4585
|
-
`Invalid frontmatter in ${
|
|
4577
|
+
`Invalid frontmatter in ${join44(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
4586
4578
|
);
|
|
4587
4579
|
}
|
|
4588
4580
|
}
|
|
@@ -4596,7 +4588,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4596
4588
|
static getSettablePaths() {
|
|
4597
4589
|
return {
|
|
4598
4590
|
recommended: {
|
|
4599
|
-
relativeDirPath:
|
|
4591
|
+
relativeDirPath: join44(".rulesync", "rules")
|
|
4600
4592
|
},
|
|
4601
4593
|
legacy: {
|
|
4602
4594
|
relativeDirPath: ".rulesync"
|
|
@@ -4617,7 +4609,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4617
4609
|
return {
|
|
4618
4610
|
success: false,
|
|
4619
4611
|
error: new Error(
|
|
4620
|
-
`Invalid frontmatter in ${
|
|
4612
|
+
`Invalid frontmatter in ${join44(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
4621
4613
|
)
|
|
4622
4614
|
};
|
|
4623
4615
|
}
|
|
@@ -4626,12 +4618,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4626
4618
|
relativeFilePath,
|
|
4627
4619
|
validate = true
|
|
4628
4620
|
}) {
|
|
4629
|
-
const legacyPath =
|
|
4621
|
+
const legacyPath = join44(
|
|
4630
4622
|
process.cwd(),
|
|
4631
4623
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
4632
4624
|
relativeFilePath
|
|
4633
4625
|
);
|
|
4634
|
-
const recommendedPath =
|
|
4626
|
+
const recommendedPath = join44(
|
|
4635
4627
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
4636
4628
|
relativeFilePath
|
|
4637
4629
|
);
|
|
@@ -4664,7 +4656,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
4664
4656
|
relativeFilePath,
|
|
4665
4657
|
validate = true
|
|
4666
4658
|
}) {
|
|
4667
|
-
const filePath =
|
|
4659
|
+
const filePath = join44(
|
|
4668
4660
|
process.cwd(),
|
|
4669
4661
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
4670
4662
|
relativeFilePath
|
|
@@ -4758,7 +4750,7 @@ var ToolRule = class extends ToolFile {
|
|
|
4758
4750
|
rulesyncRule,
|
|
4759
4751
|
validate = true,
|
|
4760
4752
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
4761
|
-
nonRootPath = { relativeDirPath:
|
|
4753
|
+
nonRootPath = { relativeDirPath: join45(".agents", "memories") }
|
|
4762
4754
|
}) {
|
|
4763
4755
|
const params = this.buildToolRuleParamsDefault({
|
|
4764
4756
|
baseDir,
|
|
@@ -4769,7 +4761,7 @@ var ToolRule = class extends ToolFile {
|
|
|
4769
4761
|
});
|
|
4770
4762
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
4771
4763
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
4772
|
-
params.relativeDirPath =
|
|
4764
|
+
params.relativeDirPath = join45(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
4773
4765
|
params.relativeFilePath = "AGENTS.md";
|
|
4774
4766
|
}
|
|
4775
4767
|
return params;
|
|
@@ -4778,7 +4770,7 @@ var ToolRule = class extends ToolFile {
|
|
|
4778
4770
|
return new RulesyncRule({
|
|
4779
4771
|
baseDir: ".",
|
|
4780
4772
|
// RulesyncRule baseDir is always the project root directory
|
|
4781
|
-
relativeDirPath:
|
|
4773
|
+
relativeDirPath: join45(".rulesync", "rules"),
|
|
4782
4774
|
relativeFilePath: this.getRelativeFilePath(),
|
|
4783
4775
|
frontmatter: {
|
|
4784
4776
|
root: this.isRoot(),
|
|
@@ -4835,7 +4827,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4835
4827
|
relativeFilePath: "AGENTS.md"
|
|
4836
4828
|
},
|
|
4837
4829
|
nonRoot: {
|
|
4838
|
-
relativeDirPath:
|
|
4830
|
+
relativeDirPath: join46(".agents", "memories")
|
|
4839
4831
|
}
|
|
4840
4832
|
};
|
|
4841
4833
|
}
|
|
@@ -4845,8 +4837,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4845
4837
|
validate = true
|
|
4846
4838
|
}) {
|
|
4847
4839
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4848
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4849
|
-
const fileContent = await readFileContent(
|
|
4840
|
+
const relativePath = isRoot ? "AGENTS.md" : join46(".agents", "memories", relativeFilePath);
|
|
4841
|
+
const fileContent = await readFileContent(join46(baseDir, relativePath));
|
|
4850
4842
|
return new _AgentsMdRule({
|
|
4851
4843
|
baseDir,
|
|
4852
4844
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4886,12 +4878,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
4886
4878
|
};
|
|
4887
4879
|
|
|
4888
4880
|
// src/rules/amazonqcli-rule.ts
|
|
4889
|
-
import { join as
|
|
4881
|
+
import { join as join47 } from "path";
|
|
4890
4882
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
4891
4883
|
static getSettablePaths() {
|
|
4892
4884
|
return {
|
|
4893
4885
|
nonRoot: {
|
|
4894
|
-
relativeDirPath:
|
|
4886
|
+
relativeDirPath: join47(".amazonq", "rules")
|
|
4895
4887
|
}
|
|
4896
4888
|
};
|
|
4897
4889
|
}
|
|
@@ -4901,7 +4893,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4901
4893
|
validate = true
|
|
4902
4894
|
}) {
|
|
4903
4895
|
const fileContent = await readFileContent(
|
|
4904
|
-
|
|
4896
|
+
join47(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4905
4897
|
);
|
|
4906
4898
|
return new _AmazonQCliRule({
|
|
4907
4899
|
baseDir,
|
|
@@ -4941,7 +4933,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
4941
4933
|
};
|
|
4942
4934
|
|
|
4943
4935
|
// src/rules/augmentcode-legacy-rule.ts
|
|
4944
|
-
import { join as
|
|
4936
|
+
import { join as join48 } from "path";
|
|
4945
4937
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
4946
4938
|
toRulesyncRule() {
|
|
4947
4939
|
const rulesyncFrontmatter = {
|
|
@@ -4955,7 +4947,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4955
4947
|
// RulesyncRule baseDir is always the project root directory
|
|
4956
4948
|
frontmatter: rulesyncFrontmatter,
|
|
4957
4949
|
body: this.getFileContent(),
|
|
4958
|
-
relativeDirPath:
|
|
4950
|
+
relativeDirPath: join48(".rulesync", "rules"),
|
|
4959
4951
|
relativeFilePath: this.getRelativeFilePath(),
|
|
4960
4952
|
validate: true
|
|
4961
4953
|
});
|
|
@@ -4967,7 +4959,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
4967
4959
|
relativeFilePath: ".augment-guidelines"
|
|
4968
4960
|
},
|
|
4969
4961
|
nonRoot: {
|
|
4970
|
-
relativeDirPath:
|
|
4962
|
+
relativeDirPath: join48(".augment", "rules")
|
|
4971
4963
|
}
|
|
4972
4964
|
};
|
|
4973
4965
|
}
|
|
@@ -5002,8 +4994,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
5002
4994
|
}) {
|
|
5003
4995
|
const settablePaths = this.getSettablePaths();
|
|
5004
4996
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
5005
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
5006
|
-
const fileContent = await readFileContent(
|
|
4997
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join48(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4998
|
+
const fileContent = await readFileContent(join48(baseDir, relativePath));
|
|
5007
4999
|
return new _AugmentcodeLegacyRule({
|
|
5008
5000
|
baseDir,
|
|
5009
5001
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -5016,7 +5008,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
5016
5008
|
};
|
|
5017
5009
|
|
|
5018
5010
|
// src/rules/augmentcode-rule.ts
|
|
5019
|
-
import { join as
|
|
5011
|
+
import { join as join49 } from "path";
|
|
5020
5012
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
5021
5013
|
toRulesyncRule() {
|
|
5022
5014
|
return this.toRulesyncRuleDefault();
|
|
@@ -5024,7 +5016,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
5024
5016
|
static getSettablePaths() {
|
|
5025
5017
|
return {
|
|
5026
5018
|
nonRoot: {
|
|
5027
|
-
relativeDirPath:
|
|
5019
|
+
relativeDirPath: join49(".augment", "rules")
|
|
5028
5020
|
}
|
|
5029
5021
|
};
|
|
5030
5022
|
}
|
|
@@ -5048,7 +5040,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
5048
5040
|
validate = true
|
|
5049
5041
|
}) {
|
|
5050
5042
|
const fileContent = await readFileContent(
|
|
5051
|
-
|
|
5043
|
+
join49(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5052
5044
|
);
|
|
5053
5045
|
const { body: content } = parseFrontmatter(fileContent);
|
|
5054
5046
|
return new _AugmentcodeRule({
|
|
@@ -5071,7 +5063,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
5071
5063
|
};
|
|
5072
5064
|
|
|
5073
5065
|
// src/rules/claudecode-rule.ts
|
|
5074
|
-
import { join as
|
|
5066
|
+
import { join as join50 } from "path";
|
|
5075
5067
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
5076
5068
|
static getSettablePaths({
|
|
5077
5069
|
global
|
|
@@ -5090,7 +5082,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5090
5082
|
relativeFilePath: "CLAUDE.md"
|
|
5091
5083
|
},
|
|
5092
5084
|
nonRoot: {
|
|
5093
|
-
relativeDirPath:
|
|
5085
|
+
relativeDirPath: join50(".claude", "memories")
|
|
5094
5086
|
}
|
|
5095
5087
|
};
|
|
5096
5088
|
}
|
|
@@ -5105,7 +5097,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5105
5097
|
if (isRoot) {
|
|
5106
5098
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5107
5099
|
const fileContent2 = await readFileContent(
|
|
5108
|
-
|
|
5100
|
+
join50(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5109
5101
|
);
|
|
5110
5102
|
return new _ClaudecodeRule({
|
|
5111
5103
|
baseDir,
|
|
@@ -5119,8 +5111,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5119
5111
|
if (!paths.nonRoot) {
|
|
5120
5112
|
throw new Error("nonRoot path is not set");
|
|
5121
5113
|
}
|
|
5122
|
-
const relativePath =
|
|
5123
|
-
const fileContent = await readFileContent(
|
|
5114
|
+
const relativePath = join50(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5115
|
+
const fileContent = await readFileContent(join50(baseDir, relativePath));
|
|
5124
5116
|
return new _ClaudecodeRule({
|
|
5125
5117
|
baseDir,
|
|
5126
5118
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5162,10 +5154,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
5162
5154
|
};
|
|
5163
5155
|
|
|
5164
5156
|
// src/rules/cline-rule.ts
|
|
5165
|
-
import { join as
|
|
5166
|
-
import { z as
|
|
5167
|
-
var ClineRuleFrontmatterSchema =
|
|
5168
|
-
description:
|
|
5157
|
+
import { join as join51 } from "path";
|
|
5158
|
+
import { z as z19 } from "zod/mini";
|
|
5159
|
+
var ClineRuleFrontmatterSchema = z19.object({
|
|
5160
|
+
description: z19.string()
|
|
5169
5161
|
});
|
|
5170
5162
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
5171
5163
|
static getSettablePaths() {
|
|
@@ -5207,7 +5199,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
5207
5199
|
validate = true
|
|
5208
5200
|
}) {
|
|
5209
5201
|
const fileContent = await readFileContent(
|
|
5210
|
-
|
|
5202
|
+
join51(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5211
5203
|
);
|
|
5212
5204
|
return new _ClineRule({
|
|
5213
5205
|
baseDir,
|
|
@@ -5220,7 +5212,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
5220
5212
|
};
|
|
5221
5213
|
|
|
5222
5214
|
// src/rules/codexcli-rule.ts
|
|
5223
|
-
import { join as
|
|
5215
|
+
import { join as join52 } from "path";
|
|
5224
5216
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
5225
5217
|
static getSettablePaths({
|
|
5226
5218
|
global
|
|
@@ -5239,7 +5231,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5239
5231
|
relativeFilePath: "AGENTS.md"
|
|
5240
5232
|
},
|
|
5241
5233
|
nonRoot: {
|
|
5242
|
-
relativeDirPath:
|
|
5234
|
+
relativeDirPath: join52(".codex", "memories")
|
|
5243
5235
|
}
|
|
5244
5236
|
};
|
|
5245
5237
|
}
|
|
@@ -5254,7 +5246,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5254
5246
|
if (isRoot) {
|
|
5255
5247
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5256
5248
|
const fileContent2 = await readFileContent(
|
|
5257
|
-
|
|
5249
|
+
join52(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5258
5250
|
);
|
|
5259
5251
|
return new _CodexcliRule({
|
|
5260
5252
|
baseDir,
|
|
@@ -5268,8 +5260,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5268
5260
|
if (!paths.nonRoot) {
|
|
5269
5261
|
throw new Error("nonRoot path is not set");
|
|
5270
5262
|
}
|
|
5271
|
-
const relativePath =
|
|
5272
|
-
const fileContent = await readFileContent(
|
|
5263
|
+
const relativePath = join52(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5264
|
+
const fileContent = await readFileContent(join52(baseDir, relativePath));
|
|
5273
5265
|
return new _CodexcliRule({
|
|
5274
5266
|
baseDir,
|
|
5275
5267
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5311,11 +5303,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
5311
5303
|
};
|
|
5312
5304
|
|
|
5313
5305
|
// src/rules/copilot-rule.ts
|
|
5314
|
-
import { join as
|
|
5315
|
-
import { z as
|
|
5316
|
-
var CopilotRuleFrontmatterSchema =
|
|
5317
|
-
description:
|
|
5318
|
-
applyTo:
|
|
5306
|
+
import { join as join53 } from "path";
|
|
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())
|
|
5319
5311
|
});
|
|
5320
5312
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
5321
5313
|
frontmatter;
|
|
@@ -5327,7 +5319,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5327
5319
|
relativeFilePath: "copilot-instructions.md"
|
|
5328
5320
|
},
|
|
5329
5321
|
nonRoot: {
|
|
5330
|
-
relativeDirPath:
|
|
5322
|
+
relativeDirPath: join53(".github", "instructions")
|
|
5331
5323
|
}
|
|
5332
5324
|
};
|
|
5333
5325
|
}
|
|
@@ -5336,7 +5328,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5336
5328
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5337
5329
|
if (!result.success) {
|
|
5338
5330
|
throw new Error(
|
|
5339
|
-
`Invalid frontmatter in ${
|
|
5331
|
+
`Invalid frontmatter in ${join53(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5340
5332
|
);
|
|
5341
5333
|
}
|
|
5342
5334
|
}
|
|
@@ -5367,7 +5359,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5367
5359
|
baseDir: this.getBaseDir(),
|
|
5368
5360
|
frontmatter: rulesyncFrontmatter,
|
|
5369
5361
|
body: this.body,
|
|
5370
|
-
relativeDirPath:
|
|
5362
|
+
relativeDirPath: join53(".rulesync", "rules"),
|
|
5371
5363
|
relativeFilePath,
|
|
5372
5364
|
validate: true
|
|
5373
5365
|
});
|
|
@@ -5414,11 +5406,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5414
5406
|
validate = true
|
|
5415
5407
|
}) {
|
|
5416
5408
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
5417
|
-
const relativePath = isRoot ?
|
|
5409
|
+
const relativePath = isRoot ? join53(
|
|
5418
5410
|
this.getSettablePaths().root.relativeDirPath,
|
|
5419
5411
|
this.getSettablePaths().root.relativeFilePath
|
|
5420
|
-
) :
|
|
5421
|
-
const fileContent = await readFileContent(
|
|
5412
|
+
) : join53(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
5413
|
+
const fileContent = await readFileContent(join53(baseDir, relativePath));
|
|
5422
5414
|
if (isRoot) {
|
|
5423
5415
|
return new _CopilotRule({
|
|
5424
5416
|
baseDir,
|
|
@@ -5437,7 +5429,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5437
5429
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5438
5430
|
if (!result.success) {
|
|
5439
5431
|
throw new Error(
|
|
5440
|
-
`Invalid frontmatter in ${
|
|
5432
|
+
`Invalid frontmatter in ${join53(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
5441
5433
|
);
|
|
5442
5434
|
}
|
|
5443
5435
|
return new _CopilotRule({
|
|
@@ -5461,7 +5453,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5461
5453
|
return {
|
|
5462
5454
|
success: false,
|
|
5463
5455
|
error: new Error(
|
|
5464
|
-
`Invalid frontmatter in ${
|
|
5456
|
+
`Invalid frontmatter in ${join53(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5465
5457
|
)
|
|
5466
5458
|
};
|
|
5467
5459
|
}
|
|
@@ -5481,12 +5473,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
5481
5473
|
};
|
|
5482
5474
|
|
|
5483
5475
|
// src/rules/cursor-rule.ts
|
|
5484
|
-
import { basename as basename16, join as
|
|
5485
|
-
import { z as
|
|
5486
|
-
var CursorRuleFrontmatterSchema =
|
|
5487
|
-
description:
|
|
5488
|
-
globs:
|
|
5489
|
-
alwaysApply:
|
|
5476
|
+
import { basename as basename16, join as join54 } from "path";
|
|
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())
|
|
5490
5482
|
});
|
|
5491
5483
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
5492
5484
|
frontmatter;
|
|
@@ -5494,7 +5486,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5494
5486
|
static getSettablePaths() {
|
|
5495
5487
|
return {
|
|
5496
5488
|
nonRoot: {
|
|
5497
|
-
relativeDirPath:
|
|
5489
|
+
relativeDirPath: join54(".cursor", "rules")
|
|
5498
5490
|
}
|
|
5499
5491
|
};
|
|
5500
5492
|
}
|
|
@@ -5503,7 +5495,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5503
5495
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5504
5496
|
if (!result.success) {
|
|
5505
5497
|
throw new Error(
|
|
5506
|
-
`Invalid frontmatter in ${
|
|
5498
|
+
`Invalid frontmatter in ${join54(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5507
5499
|
);
|
|
5508
5500
|
}
|
|
5509
5501
|
}
|
|
@@ -5575,7 +5567,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5575
5567
|
return new RulesyncRule({
|
|
5576
5568
|
frontmatter: rulesyncFrontmatter,
|
|
5577
5569
|
body: this.body,
|
|
5578
|
-
relativeDirPath:
|
|
5570
|
+
relativeDirPath: join54(".rulesync", "rules"),
|
|
5579
5571
|
relativeFilePath: this.relativeFilePath.replace(/\.mdc$/, ".md"),
|
|
5580
5572
|
validate: true
|
|
5581
5573
|
});
|
|
@@ -5620,13 +5612,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5620
5612
|
validate = true
|
|
5621
5613
|
}) {
|
|
5622
5614
|
const fileContent = await readFileContent(
|
|
5623
|
-
|
|
5615
|
+
join54(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5624
5616
|
);
|
|
5625
5617
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
5626
5618
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
5627
5619
|
if (!result.success) {
|
|
5628
5620
|
throw new Error(
|
|
5629
|
-
`Invalid frontmatter in ${
|
|
5621
|
+
`Invalid frontmatter in ${join54(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
5630
5622
|
);
|
|
5631
5623
|
}
|
|
5632
5624
|
return new _CursorRule({
|
|
@@ -5649,7 +5641,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5649
5641
|
return {
|
|
5650
5642
|
success: false,
|
|
5651
5643
|
error: new Error(
|
|
5652
|
-
`Invalid frontmatter in ${
|
|
5644
|
+
`Invalid frontmatter in ${join54(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5653
5645
|
)
|
|
5654
5646
|
};
|
|
5655
5647
|
}
|
|
@@ -5669,7 +5661,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5669
5661
|
};
|
|
5670
5662
|
|
|
5671
5663
|
// src/rules/geminicli-rule.ts
|
|
5672
|
-
import { join as
|
|
5664
|
+
import { join as join55 } from "path";
|
|
5673
5665
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
5674
5666
|
static getSettablePaths({
|
|
5675
5667
|
global
|
|
@@ -5688,7 +5680,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5688
5680
|
relativeFilePath: "GEMINI.md"
|
|
5689
5681
|
},
|
|
5690
5682
|
nonRoot: {
|
|
5691
|
-
relativeDirPath:
|
|
5683
|
+
relativeDirPath: join55(".gemini", "memories")
|
|
5692
5684
|
}
|
|
5693
5685
|
};
|
|
5694
5686
|
}
|
|
@@ -5703,7 +5695,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5703
5695
|
if (isRoot) {
|
|
5704
5696
|
const relativePath2 = paths.root.relativeFilePath;
|
|
5705
5697
|
const fileContent2 = await readFileContent(
|
|
5706
|
-
|
|
5698
|
+
join55(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
5707
5699
|
);
|
|
5708
5700
|
return new _GeminiCliRule({
|
|
5709
5701
|
baseDir,
|
|
@@ -5717,8 +5709,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5717
5709
|
if (!paths.nonRoot) {
|
|
5718
5710
|
throw new Error("nonRoot path is not set");
|
|
5719
5711
|
}
|
|
5720
|
-
const relativePath =
|
|
5721
|
-
const fileContent = await readFileContent(
|
|
5712
|
+
const relativePath = join55(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
5713
|
+
const fileContent = await readFileContent(join55(baseDir, relativePath));
|
|
5722
5714
|
return new _GeminiCliRule({
|
|
5723
5715
|
baseDir,
|
|
5724
5716
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -5760,7 +5752,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
5760
5752
|
};
|
|
5761
5753
|
|
|
5762
5754
|
// src/rules/junie-rule.ts
|
|
5763
|
-
import { join as
|
|
5755
|
+
import { join as join56 } from "path";
|
|
5764
5756
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
5765
5757
|
static getSettablePaths() {
|
|
5766
5758
|
return {
|
|
@@ -5769,7 +5761,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5769
5761
|
relativeFilePath: "guidelines.md"
|
|
5770
5762
|
},
|
|
5771
5763
|
nonRoot: {
|
|
5772
|
-
relativeDirPath:
|
|
5764
|
+
relativeDirPath: join56(".junie", "memories")
|
|
5773
5765
|
}
|
|
5774
5766
|
};
|
|
5775
5767
|
}
|
|
@@ -5779,8 +5771,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5779
5771
|
validate = true
|
|
5780
5772
|
}) {
|
|
5781
5773
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
5782
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
5783
|
-
const fileContent = await readFileContent(
|
|
5774
|
+
const relativePath = isRoot ? "guidelines.md" : join56(".junie", "memories", relativeFilePath);
|
|
5775
|
+
const fileContent = await readFileContent(join56(baseDir, relativePath));
|
|
5784
5776
|
return new _JunieRule({
|
|
5785
5777
|
baseDir,
|
|
5786
5778
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5820,12 +5812,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
5820
5812
|
};
|
|
5821
5813
|
|
|
5822
5814
|
// src/rules/kiro-rule.ts
|
|
5823
|
-
import { join as
|
|
5815
|
+
import { join as join57 } from "path";
|
|
5824
5816
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
5825
5817
|
static getSettablePaths() {
|
|
5826
5818
|
return {
|
|
5827
5819
|
nonRoot: {
|
|
5828
|
-
relativeDirPath:
|
|
5820
|
+
relativeDirPath: join57(".kiro", "steering")
|
|
5829
5821
|
}
|
|
5830
5822
|
};
|
|
5831
5823
|
}
|
|
@@ -5835,7 +5827,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5835
5827
|
validate = true
|
|
5836
5828
|
}) {
|
|
5837
5829
|
const fileContent = await readFileContent(
|
|
5838
|
-
|
|
5830
|
+
join57(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
5839
5831
|
);
|
|
5840
5832
|
return new _KiroRule({
|
|
5841
5833
|
baseDir,
|
|
@@ -5875,7 +5867,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
5875
5867
|
};
|
|
5876
5868
|
|
|
5877
5869
|
// src/rules/opencode-rule.ts
|
|
5878
|
-
import { join as
|
|
5870
|
+
import { join as join58 } from "path";
|
|
5879
5871
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
5880
5872
|
static getSettablePaths() {
|
|
5881
5873
|
return {
|
|
@@ -5884,7 +5876,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5884
5876
|
relativeFilePath: "AGENTS.md"
|
|
5885
5877
|
},
|
|
5886
5878
|
nonRoot: {
|
|
5887
|
-
relativeDirPath:
|
|
5879
|
+
relativeDirPath: join58(".opencode", "memories")
|
|
5888
5880
|
}
|
|
5889
5881
|
};
|
|
5890
5882
|
}
|
|
@@ -5894,8 +5886,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5894
5886
|
validate = true
|
|
5895
5887
|
}) {
|
|
5896
5888
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
5897
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
5898
|
-
const fileContent = await readFileContent(
|
|
5889
|
+
const relativePath = isRoot ? "AGENTS.md" : join58(".opencode", "memories", relativeFilePath);
|
|
5890
|
+
const fileContent = await readFileContent(join58(baseDir, relativePath));
|
|
5899
5891
|
return new _OpenCodeRule({
|
|
5900
5892
|
baseDir,
|
|
5901
5893
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5935,7 +5927,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
5935
5927
|
};
|
|
5936
5928
|
|
|
5937
5929
|
// src/rules/qwencode-rule.ts
|
|
5938
|
-
import { join as
|
|
5930
|
+
import { join as join59 } from "path";
|
|
5939
5931
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
5940
5932
|
static getSettablePaths() {
|
|
5941
5933
|
return {
|
|
@@ -5944,7 +5936,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5944
5936
|
relativeFilePath: "QWEN.md"
|
|
5945
5937
|
},
|
|
5946
5938
|
nonRoot: {
|
|
5947
|
-
relativeDirPath:
|
|
5939
|
+
relativeDirPath: join59(".qwen", "memories")
|
|
5948
5940
|
}
|
|
5949
5941
|
};
|
|
5950
5942
|
}
|
|
@@ -5954,8 +5946,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5954
5946
|
validate = true
|
|
5955
5947
|
}) {
|
|
5956
5948
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
5957
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
5958
|
-
const fileContent = await readFileContent(
|
|
5949
|
+
const relativePath = isRoot ? "QWEN.md" : join59(".qwen", "memories", relativeFilePath);
|
|
5950
|
+
const fileContent = await readFileContent(join59(baseDir, relativePath));
|
|
5959
5951
|
return new _QwencodeRule({
|
|
5960
5952
|
baseDir,
|
|
5961
5953
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -5992,12 +5984,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
5992
5984
|
};
|
|
5993
5985
|
|
|
5994
5986
|
// src/rules/roo-rule.ts
|
|
5995
|
-
import { join as
|
|
5987
|
+
import { join as join60 } from "path";
|
|
5996
5988
|
var RooRule = class _RooRule extends ToolRule {
|
|
5997
5989
|
static getSettablePaths() {
|
|
5998
5990
|
return {
|
|
5999
5991
|
nonRoot: {
|
|
6000
|
-
relativeDirPath:
|
|
5992
|
+
relativeDirPath: join60(".roo", "rules")
|
|
6001
5993
|
}
|
|
6002
5994
|
};
|
|
6003
5995
|
}
|
|
@@ -6007,7 +5999,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
6007
5999
|
validate = true
|
|
6008
6000
|
}) {
|
|
6009
6001
|
const fileContent = await readFileContent(
|
|
6010
|
-
|
|
6002
|
+
join60(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6011
6003
|
);
|
|
6012
6004
|
return new _RooRule({
|
|
6013
6005
|
baseDir,
|
|
@@ -6062,7 +6054,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
6062
6054
|
};
|
|
6063
6055
|
|
|
6064
6056
|
// src/rules/warp-rule.ts
|
|
6065
|
-
import { join as
|
|
6057
|
+
import { join as join61 } from "path";
|
|
6066
6058
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
6067
6059
|
constructor({ fileContent, root, ...rest }) {
|
|
6068
6060
|
super({
|
|
@@ -6078,7 +6070,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
6078
6070
|
relativeFilePath: "WARP.md"
|
|
6079
6071
|
},
|
|
6080
6072
|
nonRoot: {
|
|
6081
|
-
relativeDirPath:
|
|
6073
|
+
relativeDirPath: join61(".warp", "memories")
|
|
6082
6074
|
}
|
|
6083
6075
|
};
|
|
6084
6076
|
}
|
|
@@ -6088,8 +6080,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
6088
6080
|
validate = true
|
|
6089
6081
|
}) {
|
|
6090
6082
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
6091
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
6092
|
-
const fileContent = await readFileContent(
|
|
6083
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join61(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
6084
|
+
const fileContent = await readFileContent(join61(baseDir, relativePath));
|
|
6093
6085
|
return new _WarpRule({
|
|
6094
6086
|
baseDir,
|
|
6095
6087
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -6129,12 +6121,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
6129
6121
|
};
|
|
6130
6122
|
|
|
6131
6123
|
// src/rules/windsurf-rule.ts
|
|
6132
|
-
import { join as
|
|
6124
|
+
import { join as join62 } from "path";
|
|
6133
6125
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
6134
6126
|
static getSettablePaths() {
|
|
6135
6127
|
return {
|
|
6136
6128
|
nonRoot: {
|
|
6137
|
-
relativeDirPath:
|
|
6129
|
+
relativeDirPath: join62(".windsurf", "rules")
|
|
6138
6130
|
}
|
|
6139
6131
|
};
|
|
6140
6132
|
}
|
|
@@ -6144,7 +6136,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
6144
6136
|
validate = true
|
|
6145
6137
|
}) {
|
|
6146
6138
|
const fileContent = await readFileContent(
|
|
6147
|
-
|
|
6139
|
+
join62(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6148
6140
|
);
|
|
6149
6141
|
return new _WindsurfRule({
|
|
6150
6142
|
baseDir,
|
|
@@ -6202,7 +6194,7 @@ var rulesProcessorToolTargets = [
|
|
|
6202
6194
|
"warp",
|
|
6203
6195
|
"windsurf"
|
|
6204
6196
|
];
|
|
6205
|
-
var RulesProcessorToolTargetSchema =
|
|
6197
|
+
var RulesProcessorToolTargetSchema = z22.enum(rulesProcessorToolTargets);
|
|
6206
6198
|
var rulesProcessorToolTargetsGlobal = [
|
|
6207
6199
|
"claudecode",
|
|
6208
6200
|
"codexcli",
|
|
@@ -6544,7 +6536,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6544
6536
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
6545
6537
|
*/
|
|
6546
6538
|
async loadRulesyncFiles() {
|
|
6547
|
-
const files = await findFilesByGlobs(
|
|
6539
|
+
const files = await findFilesByGlobs(join63(".rulesync", "rules", "*.md"));
|
|
6548
6540
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
6549
6541
|
const rulesyncRules = await Promise.all(
|
|
6550
6542
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename17(file) }))
|
|
@@ -6565,7 +6557,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6565
6557
|
return rulesyncRules;
|
|
6566
6558
|
}
|
|
6567
6559
|
async loadRulesyncFilesLegacy() {
|
|
6568
|
-
const legacyFiles = await findFilesByGlobs(
|
|
6560
|
+
const legacyFiles = await findFilesByGlobs(join63(".rulesync", "*.md"));
|
|
6569
6561
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
6570
6562
|
return Promise.all(
|
|
6571
6563
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename17(file) }))
|
|
@@ -6632,7 +6624,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6632
6624
|
return [];
|
|
6633
6625
|
}
|
|
6634
6626
|
const rootFilePaths = await findFilesByGlobs(
|
|
6635
|
-
|
|
6627
|
+
join63(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
6636
6628
|
);
|
|
6637
6629
|
return await Promise.all(
|
|
6638
6630
|
rootFilePaths.map(
|
|
@@ -6650,7 +6642,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
6650
6642
|
return [];
|
|
6651
6643
|
}
|
|
6652
6644
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
6653
|
-
|
|
6645
|
+
join63(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
6654
6646
|
);
|
|
6655
6647
|
return await Promise.all(
|
|
6656
6648
|
nonRootFilePaths.map(
|
|
@@ -7026,14 +7018,14 @@ s/<command> [arguments]
|
|
|
7026
7018
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
7027
7019
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
7028
7020
|
|
|
7029
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
7021
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join63(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
7030
7022
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
7031
7023
|
|
|
7032
7024
|
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.
|
|
7033
7025
|
|
|
7034
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
7026
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join63(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
7035
7027
|
|
|
7036
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
7028
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join63(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
7037
7029
|
const result = [
|
|
7038
7030
|
overview,
|
|
7039
7031
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -7247,9 +7239,9 @@ async function generateSubagents(config) {
|
|
|
7247
7239
|
}
|
|
7248
7240
|
|
|
7249
7241
|
// src/cli/commands/gitignore.ts
|
|
7250
|
-
import { join as
|
|
7242
|
+
import { join as join64 } from "path";
|
|
7251
7243
|
var gitignoreCommand = async () => {
|
|
7252
|
-
const gitignorePath =
|
|
7244
|
+
const gitignorePath = join64(process.cwd(), ".gitignore");
|
|
7253
7245
|
const rulesFilesToIgnore = [
|
|
7254
7246
|
"# Generated by rulesync - AI tool configuration files",
|
|
7255
7247
|
// AGENTS.md
|
|
@@ -7490,7 +7482,7 @@ async function importSubagents(config, tool) {
|
|
|
7490
7482
|
}
|
|
7491
7483
|
|
|
7492
7484
|
// src/cli/commands/init.ts
|
|
7493
|
-
import { join as
|
|
7485
|
+
import { join as join65 } from "path";
|
|
7494
7486
|
async function initCommand() {
|
|
7495
7487
|
logger.info("Initializing rulesync...");
|
|
7496
7488
|
await ensureDir(".rulesync");
|
|
@@ -7651,14 +7643,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7651
7643
|
await ensureDir(commandPaths.relativeDirPath);
|
|
7652
7644
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
7653
7645
|
await ensureDir(ignorePaths.relativeDirPath);
|
|
7654
|
-
const ruleFilepath =
|
|
7646
|
+
const ruleFilepath = join65(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
7655
7647
|
if (!await fileExists(ruleFilepath)) {
|
|
7656
7648
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
7657
7649
|
logger.success(`Created ${ruleFilepath}`);
|
|
7658
7650
|
} else {
|
|
7659
7651
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
7660
7652
|
}
|
|
7661
|
-
const mcpFilepath =
|
|
7653
|
+
const mcpFilepath = join65(
|
|
7662
7654
|
mcpPaths.recommended.relativeDirPath,
|
|
7663
7655
|
mcpPaths.recommended.relativeFilePath
|
|
7664
7656
|
);
|
|
@@ -7668,21 +7660,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7668
7660
|
} else {
|
|
7669
7661
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
7670
7662
|
}
|
|
7671
|
-
const commandFilepath =
|
|
7663
|
+
const commandFilepath = join65(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
7672
7664
|
if (!await fileExists(commandFilepath)) {
|
|
7673
7665
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
7674
7666
|
logger.success(`Created ${commandFilepath}`);
|
|
7675
7667
|
} else {
|
|
7676
7668
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
7677
7669
|
}
|
|
7678
|
-
const subagentFilepath =
|
|
7670
|
+
const subagentFilepath = join65(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
7679
7671
|
if (!await fileExists(subagentFilepath)) {
|
|
7680
7672
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
7681
7673
|
logger.success(`Created ${subagentFilepath}`);
|
|
7682
7674
|
} else {
|
|
7683
7675
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
7684
7676
|
}
|
|
7685
|
-
const ignoreFilepath =
|
|
7677
|
+
const ignoreFilepath = join65(ignorePaths.relativeDirPath, ignorePaths.relativeFilePath);
|
|
7686
7678
|
if (!await fileExists(ignoreFilepath)) {
|
|
7687
7679
|
await writeFileContent(ignoreFilepath, sampleIgnoreFile.content);
|
|
7688
7680
|
logger.success(`Created ${ignoreFilepath}`);
|
|
@@ -7692,7 +7684,7 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
7692
7684
|
}
|
|
7693
7685
|
|
|
7694
7686
|
// src/cli/index.ts
|
|
7695
|
-
var getVersion = () => "3.
|
|
7687
|
+
var getVersion = () => "3.16.0";
|
|
7696
7688
|
var main = async () => {
|
|
7697
7689
|
const program = new Command();
|
|
7698
7690
|
const version = getVersion();
|