rulesync 7.4.0 → 7.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -23
- package/dist/{chunk-UCC3WPDL.js → chunk-M7XFNAZA.js} +608 -260
- package/dist/cli/index.cjs +838 -485
- package/dist/cli/index.js +8 -3
- package/dist/index.cjs +573 -225
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -129,7 +129,7 @@ var logger = new Logger();
|
|
|
129
129
|
|
|
130
130
|
// src/lib/fetch.ts
|
|
131
131
|
var import_promise = require("es-toolkit/promise");
|
|
132
|
-
var
|
|
132
|
+
var import_node_path110 = require("path");
|
|
133
133
|
|
|
134
134
|
// src/constants/rulesync-paths.ts
|
|
135
135
|
var import_node_path = require("path");
|
|
@@ -675,7 +675,7 @@ var SimulatedCommand = class _SimulatedCommand extends ToolCommand {
|
|
|
675
675
|
return {
|
|
676
676
|
baseDir,
|
|
677
677
|
relativeDirPath: _SimulatedCommand.getSettablePaths().relativeDirPath,
|
|
678
|
-
relativeFilePath
|
|
678
|
+
relativeFilePath,
|
|
679
679
|
frontmatter: result.data,
|
|
680
680
|
body: content.trim(),
|
|
681
681
|
validate
|
|
@@ -732,7 +732,7 @@ var AgentsmdCommand = class _AgentsmdCommand extends SimulatedCommand {
|
|
|
732
732
|
return new _AgentsmdCommand({
|
|
733
733
|
baseDir,
|
|
734
734
|
relativeDirPath: _AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
735
|
-
relativeFilePath
|
|
735
|
+
relativeFilePath,
|
|
736
736
|
frontmatter: result.data,
|
|
737
737
|
body: content.trim(),
|
|
738
738
|
validate
|
|
@@ -791,6 +791,7 @@ var ALL_TOOL_TARGETS = [
|
|
|
791
791
|
"cursor",
|
|
792
792
|
"factorydroid",
|
|
793
793
|
"geminicli",
|
|
794
|
+
"goose",
|
|
794
795
|
"junie",
|
|
795
796
|
"kilo",
|
|
796
797
|
"kiro",
|
|
@@ -841,6 +842,16 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
841
842
|
getBody() {
|
|
842
843
|
return this.body;
|
|
843
844
|
}
|
|
845
|
+
withRelativeFilePath(newRelativeFilePath) {
|
|
846
|
+
return new _RulesyncCommand({
|
|
847
|
+
baseDir: this.getBaseDir(),
|
|
848
|
+
relativeDirPath: this.getRelativeDirPath(),
|
|
849
|
+
relativeFilePath: newRelativeFilePath,
|
|
850
|
+
frontmatter: this.getFrontmatter(),
|
|
851
|
+
body: this.getBody(),
|
|
852
|
+
fileContent: this.getFileContent()
|
|
853
|
+
});
|
|
854
|
+
}
|
|
844
855
|
validate() {
|
|
845
856
|
if (!this.frontmatter) {
|
|
846
857
|
return { success: true, error: null };
|
|
@@ -871,11 +882,10 @@ var RulesyncCommand = class _RulesyncCommand extends RulesyncFile {
|
|
|
871
882
|
if (!result.success) {
|
|
872
883
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
873
884
|
}
|
|
874
|
-
const filename = (0, import_node_path6.basename)(relativeFilePath);
|
|
875
885
|
return new _RulesyncCommand({
|
|
876
886
|
baseDir: process.cwd(),
|
|
877
887
|
relativeDirPath: _RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
878
|
-
relativeFilePath
|
|
888
|
+
relativeFilePath,
|
|
879
889
|
frontmatter: result.data,
|
|
880
890
|
body: content.trim(),
|
|
881
891
|
fileContent
|
|
@@ -1034,7 +1044,7 @@ ${body}${turboDirective}`;
|
|
|
1034
1044
|
return new _AntigravityCommand({
|
|
1035
1045
|
baseDir,
|
|
1036
1046
|
relativeDirPath: _AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1037
|
-
relativeFilePath
|
|
1047
|
+
relativeFilePath,
|
|
1038
1048
|
frontmatter: result.data,
|
|
1039
1049
|
body: content.trim(),
|
|
1040
1050
|
fileContent,
|
|
@@ -1180,7 +1190,7 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1180
1190
|
return new _ClaudecodeCommand({
|
|
1181
1191
|
baseDir,
|
|
1182
1192
|
relativeDirPath: paths.relativeDirPath,
|
|
1183
|
-
relativeFilePath
|
|
1193
|
+
relativeFilePath,
|
|
1184
1194
|
frontmatter: result.data,
|
|
1185
1195
|
body: content.trim(),
|
|
1186
1196
|
validate
|
|
@@ -1270,7 +1280,7 @@ var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
|
1270
1280
|
return new _ClineCommand({
|
|
1271
1281
|
baseDir,
|
|
1272
1282
|
relativeDirPath: paths.relativeDirPath,
|
|
1273
|
-
relativeFilePath
|
|
1283
|
+
relativeFilePath,
|
|
1274
1284
|
fileContent: content.trim(),
|
|
1275
1285
|
validate
|
|
1276
1286
|
});
|
|
@@ -1357,7 +1367,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1357
1367
|
return new _CodexcliCommand({
|
|
1358
1368
|
baseDir,
|
|
1359
1369
|
relativeDirPath: paths.relativeDirPath,
|
|
1360
|
-
relativeFilePath
|
|
1370
|
+
relativeFilePath,
|
|
1361
1371
|
fileContent: content.trim(),
|
|
1362
1372
|
validate
|
|
1363
1373
|
});
|
|
@@ -1490,7 +1500,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1490
1500
|
return new _CopilotCommand({
|
|
1491
1501
|
baseDir,
|
|
1492
1502
|
relativeDirPath: paths.relativeDirPath,
|
|
1493
|
-
relativeFilePath
|
|
1503
|
+
relativeFilePath,
|
|
1494
1504
|
frontmatter: result.data,
|
|
1495
1505
|
body: content.trim(),
|
|
1496
1506
|
validate
|
|
@@ -1582,7 +1592,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1582
1592
|
return new _CursorCommand({
|
|
1583
1593
|
baseDir,
|
|
1584
1594
|
relativeDirPath: paths.relativeDirPath,
|
|
1585
|
-
relativeFilePath
|
|
1595
|
+
relativeFilePath,
|
|
1586
1596
|
fileContent: content.trim(),
|
|
1587
1597
|
validate
|
|
1588
1598
|
});
|
|
@@ -1637,7 +1647,7 @@ var FactorydroidCommand = class _FactorydroidCommand extends SimulatedCommand {
|
|
|
1637
1647
|
return new _FactorydroidCommand({
|
|
1638
1648
|
baseDir,
|
|
1639
1649
|
relativeDirPath: paths.relativeDirPath,
|
|
1640
|
-
relativeFilePath
|
|
1650
|
+
relativeFilePath,
|
|
1641
1651
|
frontmatter: result.data,
|
|
1642
1652
|
body: content.trim(),
|
|
1643
1653
|
validate
|
|
@@ -1769,7 +1779,7 @@ ${geminiFrontmatter.prompt}
|
|
|
1769
1779
|
return new _GeminiCliCommand({
|
|
1770
1780
|
baseDir,
|
|
1771
1781
|
relativeDirPath: paths.relativeDirPath,
|
|
1772
|
-
relativeFilePath
|
|
1782
|
+
relativeFilePath,
|
|
1773
1783
|
fileContent,
|
|
1774
1784
|
validate
|
|
1775
1785
|
});
|
|
@@ -1866,7 +1876,7 @@ var KiloCommand = class _KiloCommand extends ToolCommand {
|
|
|
1866
1876
|
return new _KiloCommand({
|
|
1867
1877
|
baseDir,
|
|
1868
1878
|
relativeDirPath: paths.relativeDirPath,
|
|
1869
|
-
relativeFilePath
|
|
1879
|
+
relativeFilePath,
|
|
1870
1880
|
fileContent: content.trim(),
|
|
1871
1881
|
validate
|
|
1872
1882
|
});
|
|
@@ -1947,7 +1957,7 @@ var KiroCommand = class _KiroCommand extends ToolCommand {
|
|
|
1947
1957
|
return new _KiroCommand({
|
|
1948
1958
|
baseDir,
|
|
1949
1959
|
relativeDirPath: paths.relativeDirPath,
|
|
1950
|
-
relativeFilePath
|
|
1960
|
+
relativeFilePath,
|
|
1951
1961
|
fileContent: content.trim(),
|
|
1952
1962
|
validate
|
|
1953
1963
|
});
|
|
@@ -2079,7 +2089,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
2079
2089
|
return new _OpenCodeCommand({
|
|
2080
2090
|
baseDir,
|
|
2081
2091
|
relativeDirPath: paths.relativeDirPath,
|
|
2082
|
-
relativeFilePath
|
|
2092
|
+
relativeFilePath,
|
|
2083
2093
|
frontmatter: result.data,
|
|
2084
2094
|
body: content.trim(),
|
|
2085
2095
|
validate
|
|
@@ -2224,7 +2234,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
2224
2234
|
return new _RooCommand({
|
|
2225
2235
|
baseDir,
|
|
2226
2236
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
2227
|
-
relativeFilePath
|
|
2237
|
+
relativeFilePath,
|
|
2228
2238
|
frontmatter: result.data,
|
|
2229
2239
|
body: content.trim(),
|
|
2230
2240
|
fileContent,
|
|
@@ -2271,42 +2281,78 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2271
2281
|
"agentsmd",
|
|
2272
2282
|
{
|
|
2273
2283
|
class: AgentsmdCommand,
|
|
2274
|
-
meta: {
|
|
2284
|
+
meta: {
|
|
2285
|
+
extension: "md",
|
|
2286
|
+
supportsProject: true,
|
|
2287
|
+
supportsGlobal: false,
|
|
2288
|
+
isSimulated: true,
|
|
2289
|
+
supportsSubdirectory: false
|
|
2290
|
+
}
|
|
2275
2291
|
}
|
|
2276
2292
|
],
|
|
2277
2293
|
[
|
|
2278
2294
|
"antigravity",
|
|
2279
2295
|
{
|
|
2280
2296
|
class: AntigravityCommand,
|
|
2281
|
-
meta: {
|
|
2297
|
+
meta: {
|
|
2298
|
+
extension: "md",
|
|
2299
|
+
supportsProject: true,
|
|
2300
|
+
supportsGlobal: false,
|
|
2301
|
+
isSimulated: false,
|
|
2302
|
+
supportsSubdirectory: false
|
|
2303
|
+
}
|
|
2282
2304
|
}
|
|
2283
2305
|
],
|
|
2284
2306
|
[
|
|
2285
2307
|
"claudecode",
|
|
2286
2308
|
{
|
|
2287
2309
|
class: ClaudecodeCommand,
|
|
2288
|
-
meta: {
|
|
2310
|
+
meta: {
|
|
2311
|
+
extension: "md",
|
|
2312
|
+
supportsProject: true,
|
|
2313
|
+
supportsGlobal: true,
|
|
2314
|
+
isSimulated: false,
|
|
2315
|
+
supportsSubdirectory: true
|
|
2316
|
+
}
|
|
2289
2317
|
}
|
|
2290
2318
|
],
|
|
2291
2319
|
[
|
|
2292
2320
|
"claudecode-legacy",
|
|
2293
2321
|
{
|
|
2294
2322
|
class: ClaudecodeCommand,
|
|
2295
|
-
meta: {
|
|
2323
|
+
meta: {
|
|
2324
|
+
extension: "md",
|
|
2325
|
+
supportsProject: true,
|
|
2326
|
+
supportsGlobal: true,
|
|
2327
|
+
isSimulated: false,
|
|
2328
|
+
supportsSubdirectory: true
|
|
2329
|
+
}
|
|
2296
2330
|
}
|
|
2297
2331
|
],
|
|
2298
2332
|
[
|
|
2299
2333
|
"cline",
|
|
2300
2334
|
{
|
|
2301
2335
|
class: ClineCommand,
|
|
2302
|
-
meta: {
|
|
2336
|
+
meta: {
|
|
2337
|
+
extension: "md",
|
|
2338
|
+
supportsProject: true,
|
|
2339
|
+
supportsGlobal: true,
|
|
2340
|
+
isSimulated: false,
|
|
2341
|
+
supportsSubdirectory: false
|
|
2342
|
+
}
|
|
2303
2343
|
}
|
|
2304
2344
|
],
|
|
2305
2345
|
[
|
|
2306
2346
|
"codexcli",
|
|
2307
2347
|
{
|
|
2308
2348
|
class: CodexcliCommand,
|
|
2309
|
-
meta: {
|
|
2349
|
+
meta: {
|
|
2350
|
+
extension: "md",
|
|
2351
|
+
supportsProject: false,
|
|
2352
|
+
supportsGlobal: true,
|
|
2353
|
+
isSimulated: false,
|
|
2354
|
+
supportsSubdirectory: false
|
|
2355
|
+
}
|
|
2310
2356
|
}
|
|
2311
2357
|
],
|
|
2312
2358
|
[
|
|
@@ -2317,7 +2363,8 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2317
2363
|
extension: "prompt.md",
|
|
2318
2364
|
supportsProject: true,
|
|
2319
2365
|
supportsGlobal: false,
|
|
2320
|
-
isSimulated: false
|
|
2366
|
+
isSimulated: false,
|
|
2367
|
+
supportsSubdirectory: false
|
|
2321
2368
|
}
|
|
2322
2369
|
}
|
|
2323
2370
|
],
|
|
@@ -2325,49 +2372,91 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2325
2372
|
"cursor",
|
|
2326
2373
|
{
|
|
2327
2374
|
class: CursorCommand,
|
|
2328
|
-
meta: {
|
|
2375
|
+
meta: {
|
|
2376
|
+
extension: "md",
|
|
2377
|
+
supportsProject: true,
|
|
2378
|
+
supportsGlobal: true,
|
|
2379
|
+
isSimulated: false,
|
|
2380
|
+
supportsSubdirectory: false
|
|
2381
|
+
}
|
|
2329
2382
|
}
|
|
2330
2383
|
],
|
|
2331
2384
|
[
|
|
2332
2385
|
"factorydroid",
|
|
2333
2386
|
{
|
|
2334
2387
|
class: FactorydroidCommand,
|
|
2335
|
-
meta: {
|
|
2388
|
+
meta: {
|
|
2389
|
+
extension: "md",
|
|
2390
|
+
supportsProject: true,
|
|
2391
|
+
supportsGlobal: true,
|
|
2392
|
+
isSimulated: true,
|
|
2393
|
+
supportsSubdirectory: false
|
|
2394
|
+
}
|
|
2336
2395
|
}
|
|
2337
2396
|
],
|
|
2338
2397
|
[
|
|
2339
2398
|
"geminicli",
|
|
2340
2399
|
{
|
|
2341
2400
|
class: GeminiCliCommand,
|
|
2342
|
-
meta: {
|
|
2401
|
+
meta: {
|
|
2402
|
+
extension: "toml",
|
|
2403
|
+
supportsProject: true,
|
|
2404
|
+
supportsGlobal: true,
|
|
2405
|
+
isSimulated: false,
|
|
2406
|
+
supportsSubdirectory: true
|
|
2407
|
+
}
|
|
2343
2408
|
}
|
|
2344
2409
|
],
|
|
2345
2410
|
[
|
|
2346
2411
|
"kilo",
|
|
2347
2412
|
{
|
|
2348
2413
|
class: KiloCommand,
|
|
2349
|
-
meta: {
|
|
2414
|
+
meta: {
|
|
2415
|
+
extension: "md",
|
|
2416
|
+
supportsProject: true,
|
|
2417
|
+
supportsGlobal: true,
|
|
2418
|
+
isSimulated: false,
|
|
2419
|
+
supportsSubdirectory: false
|
|
2420
|
+
}
|
|
2350
2421
|
}
|
|
2351
2422
|
],
|
|
2352
2423
|
[
|
|
2353
2424
|
"kiro",
|
|
2354
2425
|
{
|
|
2355
2426
|
class: KiroCommand,
|
|
2356
|
-
meta: {
|
|
2427
|
+
meta: {
|
|
2428
|
+
extension: "md",
|
|
2429
|
+
supportsProject: true,
|
|
2430
|
+
supportsGlobal: false,
|
|
2431
|
+
isSimulated: false,
|
|
2432
|
+
supportsSubdirectory: false
|
|
2433
|
+
}
|
|
2357
2434
|
}
|
|
2358
2435
|
],
|
|
2359
2436
|
[
|
|
2360
2437
|
"opencode",
|
|
2361
2438
|
{
|
|
2362
2439
|
class: OpenCodeCommand,
|
|
2363
|
-
meta: {
|
|
2440
|
+
meta: {
|
|
2441
|
+
extension: "md",
|
|
2442
|
+
supportsProject: true,
|
|
2443
|
+
supportsGlobal: true,
|
|
2444
|
+
isSimulated: false,
|
|
2445
|
+
supportsSubdirectory: true
|
|
2446
|
+
}
|
|
2364
2447
|
}
|
|
2365
2448
|
],
|
|
2366
2449
|
[
|
|
2367
2450
|
"roo",
|
|
2368
2451
|
{
|
|
2369
2452
|
class: RooCommand,
|
|
2370
|
-
meta: {
|
|
2453
|
+
meta: {
|
|
2454
|
+
extension: "md",
|
|
2455
|
+
supportsProject: true,
|
|
2456
|
+
supportsGlobal: false,
|
|
2457
|
+
isSimulated: false,
|
|
2458
|
+
supportsSubdirectory: true
|
|
2459
|
+
}
|
|
2371
2460
|
}
|
|
2372
2461
|
]
|
|
2373
2462
|
]);
|
|
@@ -2420,13 +2509,27 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2420
2509
|
(file) => file instanceof RulesyncCommand
|
|
2421
2510
|
);
|
|
2422
2511
|
const factory = this.getFactory(this.toolTarget);
|
|
2512
|
+
const flattenedPathOrigins = /* @__PURE__ */ new Map();
|
|
2423
2513
|
const toolCommands = rulesyncCommands.map((rulesyncCommand) => {
|
|
2424
2514
|
if (!factory.class.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
2425
2515
|
return null;
|
|
2426
2516
|
}
|
|
2517
|
+
const originalRelativePath = rulesyncCommand.getRelativeFilePath();
|
|
2518
|
+
const commandToConvert = factory.meta.supportsSubdirectory ? rulesyncCommand : this.flattenRelativeFilePath(rulesyncCommand);
|
|
2519
|
+
if (!factory.meta.supportsSubdirectory) {
|
|
2520
|
+
const flattenedPath = commandToConvert.getRelativeFilePath();
|
|
2521
|
+
const firstOrigin = flattenedPathOrigins.get(flattenedPath);
|
|
2522
|
+
if (firstOrigin && firstOrigin !== originalRelativePath) {
|
|
2523
|
+
logger.warn(
|
|
2524
|
+
`Command path collision detected while flattening for ${this.toolTarget}: "${firstOrigin}" and "${originalRelativePath}" both map to "${flattenedPath}". The later command will overwrite the earlier one.`
|
|
2525
|
+
);
|
|
2526
|
+
} else if (!firstOrigin) {
|
|
2527
|
+
flattenedPathOrigins.set(flattenedPath, originalRelativePath);
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2427
2530
|
return factory.class.fromRulesyncCommand({
|
|
2428
2531
|
baseDir: this.baseDir,
|
|
2429
|
-
rulesyncCommand,
|
|
2532
|
+
rulesyncCommand: commandToConvert,
|
|
2430
2533
|
global: this.global
|
|
2431
2534
|
});
|
|
2432
2535
|
}).filter((command) => command !== null);
|
|
@@ -2441,17 +2544,26 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2441
2544
|
});
|
|
2442
2545
|
return rulesyncCommands;
|
|
2443
2546
|
}
|
|
2547
|
+
flattenRelativeFilePath(rulesyncCommand) {
|
|
2548
|
+
const flatPath = (0, import_node_path19.basename)(rulesyncCommand.getRelativeFilePath());
|
|
2549
|
+
if (flatPath === rulesyncCommand.getRelativeFilePath()) return rulesyncCommand;
|
|
2550
|
+
return rulesyncCommand.withRelativeFilePath(flatPath);
|
|
2551
|
+
}
|
|
2552
|
+
safeRelativePath(basePath, fullPath) {
|
|
2553
|
+
const rel = (0, import_node_path19.relative)(basePath, fullPath);
|
|
2554
|
+
checkPathTraversal({ relativePath: rel, intendedRootDir: basePath });
|
|
2555
|
+
return rel;
|
|
2556
|
+
}
|
|
2444
2557
|
/**
|
|
2445
2558
|
* Implementation of abstract method from FeatureProcessor
|
|
2446
2559
|
* Load and parse rulesync command files from .rulesync/commands/ directory
|
|
2447
2560
|
*/
|
|
2448
2561
|
async loadRulesyncFiles() {
|
|
2449
|
-
const
|
|
2450
|
-
|
|
2451
|
-
);
|
|
2562
|
+
const basePath = RulesyncCommand.getSettablePaths().relativeDirPath;
|
|
2563
|
+
const rulesyncCommandPaths = await findFilesByGlobs((0, import_node_path19.join)(basePath, "**", "*.md"));
|
|
2452
2564
|
const rulesyncCommands = await Promise.all(
|
|
2453
2565
|
rulesyncCommandPaths.map(
|
|
2454
|
-
(path4) => RulesyncCommand.fromFile({ relativeFilePath: (
|
|
2566
|
+
(path4) => RulesyncCommand.fromFile({ relativeFilePath: this.safeRelativePath(basePath, path4) })
|
|
2455
2567
|
)
|
|
2456
2568
|
);
|
|
2457
2569
|
logger.debug(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2466,15 +2578,15 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2466
2578
|
} = {}) {
|
|
2467
2579
|
const factory = this.getFactory(this.toolTarget);
|
|
2468
2580
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2471
|
-
);
|
|
2581
|
+
const baseDirFull = (0, import_node_path19.join)(this.baseDir, paths.relativeDirPath);
|
|
2582
|
+
const globPattern = factory.meta.supportsSubdirectory ? (0, import_node_path19.join)(baseDirFull, "**", `*.${factory.meta.extension}`) : (0, import_node_path19.join)(baseDirFull, `*.${factory.meta.extension}`);
|
|
2583
|
+
const commandFilePaths = await findFilesByGlobs(globPattern);
|
|
2472
2584
|
if (forDeletion) {
|
|
2473
2585
|
const toolCommands2 = commandFilePaths.map(
|
|
2474
2586
|
(path4) => factory.class.forDeletion({
|
|
2475
2587
|
baseDir: this.baseDir,
|
|
2476
2588
|
relativeDirPath: paths.relativeDirPath,
|
|
2477
|
-
relativeFilePath: (
|
|
2589
|
+
relativeFilePath: this.safeRelativePath(baseDirFull, path4),
|
|
2478
2590
|
global: this.global
|
|
2479
2591
|
})
|
|
2480
2592
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2485,7 +2597,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2485
2597
|
commandFilePaths.map(
|
|
2486
2598
|
(path4) => factory.class.fromFile({
|
|
2487
2599
|
baseDir: this.baseDir,
|
|
2488
|
-
relativeFilePath: (
|
|
2600
|
+
relativeFilePath: this.safeRelativePath(baseDirFull, path4),
|
|
2489
2601
|
global: this.global
|
|
2490
2602
|
})
|
|
2491
2603
|
)
|
|
@@ -5072,24 +5184,25 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
5072
5184
|
getToml() {
|
|
5073
5185
|
return this.toml;
|
|
5074
5186
|
}
|
|
5075
|
-
static getSettablePaths(
|
|
5076
|
-
if (!global) {
|
|
5077
|
-
throw new Error("CodexcliMcp only supports global mode. Please pass { global: true }.");
|
|
5078
|
-
}
|
|
5187
|
+
static getSettablePaths(_options = {}) {
|
|
5079
5188
|
return {
|
|
5080
5189
|
relativeDirPath: ".codex",
|
|
5081
5190
|
relativeFilePath: "config.toml"
|
|
5082
5191
|
};
|
|
5083
5192
|
}
|
|
5193
|
+
/**
|
|
5194
|
+
* config.toml may contain other Codex settings, so it should not be deleted.
|
|
5195
|
+
*/
|
|
5196
|
+
isDeletable() {
|
|
5197
|
+
return false;
|
|
5198
|
+
}
|
|
5084
5199
|
static async fromFile({
|
|
5085
5200
|
baseDir = process.cwd(),
|
|
5086
5201
|
validate = true,
|
|
5087
5202
|
global = false
|
|
5088
5203
|
}) {
|
|
5089
5204
|
const paths = this.getSettablePaths({ global });
|
|
5090
|
-
const fileContent = await
|
|
5091
|
-
(0, import_node_path41.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
5092
|
-
);
|
|
5205
|
+
const fileContent = await readFileContentOrNull((0, import_node_path41.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)) ?? smolToml.stringify({});
|
|
5093
5206
|
return new _CodexcliMcp({
|
|
5094
5207
|
baseDir,
|
|
5095
5208
|
relativeDirPath: paths.relativeDirPath,
|
|
@@ -6145,7 +6258,7 @@ var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
|
6145
6258
|
{
|
|
6146
6259
|
class: CodexcliMcp,
|
|
6147
6260
|
meta: {
|
|
6148
|
-
supportsProject:
|
|
6261
|
+
supportsProject: true,
|
|
6149
6262
|
supportsGlobal: true,
|
|
6150
6263
|
supportsEnabledTools: true,
|
|
6151
6264
|
supportsDisabledTools: true
|
|
@@ -6405,8 +6518,8 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
6405
6518
|
|
|
6406
6519
|
// src/features/rules/rules-processor.ts
|
|
6407
6520
|
var import_toon = require("@toon-format/toon");
|
|
6408
|
-
var
|
|
6409
|
-
var
|
|
6521
|
+
var import_node_path109 = require("path");
|
|
6522
|
+
var import_mini49 = require("zod/mini");
|
|
6410
6523
|
|
|
6411
6524
|
// src/constants/general.ts
|
|
6412
6525
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
@@ -9605,39 +9718,12 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
9605
9718
|
}
|
|
9606
9719
|
};
|
|
9607
9720
|
|
|
9608
|
-
// src/features/subagents/codexcli-subagent.ts
|
|
9609
|
-
var import_node_path74 = require("path");
|
|
9610
|
-
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
9611
|
-
static getSettablePaths() {
|
|
9612
|
-
return {
|
|
9613
|
-
relativeDirPath: (0, import_node_path74.join)(".codex", "subagents")
|
|
9614
|
-
};
|
|
9615
|
-
}
|
|
9616
|
-
static async fromFile(params) {
|
|
9617
|
-
const baseParams = await this.fromFileDefault(params);
|
|
9618
|
-
return new _CodexCliSubagent(baseParams);
|
|
9619
|
-
}
|
|
9620
|
-
static fromRulesyncSubagent(params) {
|
|
9621
|
-
const baseParams = this.fromRulesyncSubagentDefault(params);
|
|
9622
|
-
return new _CodexCliSubagent(baseParams);
|
|
9623
|
-
}
|
|
9624
|
-
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
9625
|
-
return this.isTargetedByRulesyncSubagentDefault({
|
|
9626
|
-
rulesyncSubagent,
|
|
9627
|
-
toolTarget: "codexcli"
|
|
9628
|
-
});
|
|
9629
|
-
}
|
|
9630
|
-
static forDeletion(params) {
|
|
9631
|
-
return new _CodexCliSubagent(this.forDeletionDefault(params));
|
|
9632
|
-
}
|
|
9633
|
-
};
|
|
9634
|
-
|
|
9635
9721
|
// src/features/subagents/factorydroid-subagent.ts
|
|
9636
|
-
var
|
|
9722
|
+
var import_node_path74 = require("path");
|
|
9637
9723
|
var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent {
|
|
9638
9724
|
static getSettablePaths(_options) {
|
|
9639
9725
|
return {
|
|
9640
|
-
relativeDirPath: (0,
|
|
9726
|
+
relativeDirPath: (0, import_node_path74.join)(".factory", "droids")
|
|
9641
9727
|
};
|
|
9642
9728
|
}
|
|
9643
9729
|
static async fromFile(params) {
|
|
@@ -9660,11 +9746,11 @@ var FactorydroidSubagent = class _FactorydroidSubagent extends SimulatedSubagent
|
|
|
9660
9746
|
};
|
|
9661
9747
|
|
|
9662
9748
|
// src/features/subagents/geminicli-subagent.ts
|
|
9663
|
-
var
|
|
9749
|
+
var import_node_path75 = require("path");
|
|
9664
9750
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
9665
9751
|
static getSettablePaths() {
|
|
9666
9752
|
return {
|
|
9667
|
-
relativeDirPath: (0,
|
|
9753
|
+
relativeDirPath: (0, import_node_path75.join)(".gemini", "subagents")
|
|
9668
9754
|
};
|
|
9669
9755
|
}
|
|
9670
9756
|
static async fromFile(params) {
|
|
@@ -9687,11 +9773,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
9687
9773
|
};
|
|
9688
9774
|
|
|
9689
9775
|
// src/features/subagents/roo-subagent.ts
|
|
9690
|
-
var
|
|
9776
|
+
var import_node_path76 = require("path");
|
|
9691
9777
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
9692
9778
|
static getSettablePaths() {
|
|
9693
9779
|
return {
|
|
9694
|
-
relativeDirPath: (0,
|
|
9780
|
+
relativeDirPath: (0, import_node_path76.join)(".roo", "subagents")
|
|
9695
9781
|
};
|
|
9696
9782
|
}
|
|
9697
9783
|
static async fromFile(params) {
|
|
@@ -9715,14 +9801,14 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
9715
9801
|
|
|
9716
9802
|
// src/features/subagents/subagents-processor.ts
|
|
9717
9803
|
var import_node_path84 = require("path");
|
|
9718
|
-
var
|
|
9804
|
+
var import_mini42 = require("zod/mini");
|
|
9719
9805
|
|
|
9720
9806
|
// src/features/subagents/claudecode-subagent.ts
|
|
9721
|
-
var
|
|
9807
|
+
var import_node_path78 = require("path");
|
|
9722
9808
|
var import_mini36 = require("zod/mini");
|
|
9723
9809
|
|
|
9724
9810
|
// src/features/subagents/rulesync-subagent.ts
|
|
9725
|
-
var
|
|
9811
|
+
var import_node_path77 = require("path");
|
|
9726
9812
|
var import_mini35 = require("zod/mini");
|
|
9727
9813
|
var RulesyncSubagentFrontmatterSchema = import_mini35.z.looseObject({
|
|
9728
9814
|
targets: import_mini35.z._default(RulesyncTargetsSchema, ["*"]),
|
|
@@ -9736,7 +9822,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
9736
9822
|
const parseResult = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9737
9823
|
if (!parseResult.success && rest.validate !== false) {
|
|
9738
9824
|
throw new Error(
|
|
9739
|
-
`Invalid frontmatter in ${(0,
|
|
9825
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(parseResult.error)}`
|
|
9740
9826
|
);
|
|
9741
9827
|
}
|
|
9742
9828
|
const parsedFrontmatter = parseResult.success ? { ...frontmatter, ...parseResult.data } : { ...frontmatter, targets: frontmatter?.targets ?? ["*"] };
|
|
@@ -9769,7 +9855,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
9769
9855
|
return {
|
|
9770
9856
|
success: false,
|
|
9771
9857
|
error: new Error(
|
|
9772
|
-
`Invalid frontmatter in ${(0,
|
|
9858
|
+
`Invalid frontmatter in ${(0, import_node_path77.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9773
9859
|
)
|
|
9774
9860
|
};
|
|
9775
9861
|
}
|
|
@@ -9778,14 +9864,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
9778
9864
|
relativeFilePath
|
|
9779
9865
|
}) {
|
|
9780
9866
|
const fileContent = await readFileContent(
|
|
9781
|
-
(0,
|
|
9867
|
+
(0, import_node_path77.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
9782
9868
|
);
|
|
9783
9869
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9784
9870
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9785
9871
|
if (!result.success) {
|
|
9786
9872
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
9787
9873
|
}
|
|
9788
|
-
const filename = (0,
|
|
9874
|
+
const filename = (0, import_node_path77.basename)(relativeFilePath);
|
|
9789
9875
|
return new _RulesyncSubagent({
|
|
9790
9876
|
baseDir: process.cwd(),
|
|
9791
9877
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -9813,7 +9899,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9813
9899
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
9814
9900
|
if (!result.success) {
|
|
9815
9901
|
throw new Error(
|
|
9816
|
-
`Invalid frontmatter in ${(0,
|
|
9902
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9817
9903
|
);
|
|
9818
9904
|
}
|
|
9819
9905
|
}
|
|
@@ -9825,7 +9911,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9825
9911
|
}
|
|
9826
9912
|
static getSettablePaths(_options = {}) {
|
|
9827
9913
|
return {
|
|
9828
|
-
relativeDirPath: (0,
|
|
9914
|
+
relativeDirPath: (0, import_node_path78.join)(".claude", "agents")
|
|
9829
9915
|
};
|
|
9830
9916
|
}
|
|
9831
9917
|
getFrontmatter() {
|
|
@@ -9901,7 +9987,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9901
9987
|
return {
|
|
9902
9988
|
success: false,
|
|
9903
9989
|
error: new Error(
|
|
9904
|
-
`Invalid frontmatter in ${(0,
|
|
9990
|
+
`Invalid frontmatter in ${(0, import_node_path78.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9905
9991
|
)
|
|
9906
9992
|
};
|
|
9907
9993
|
}
|
|
@@ -9919,7 +10005,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9919
10005
|
global = false
|
|
9920
10006
|
}) {
|
|
9921
10007
|
const paths = this.getSettablePaths({ global });
|
|
9922
|
-
const filePath = (0,
|
|
10008
|
+
const filePath = (0, import_node_path78.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
9923
10009
|
const fileContent = await readFileContent(filePath);
|
|
9924
10010
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
9925
10011
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -9953,14 +10039,158 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
9953
10039
|
}
|
|
9954
10040
|
};
|
|
9955
10041
|
|
|
10042
|
+
// src/features/subagents/codexcli-subagent.ts
|
|
10043
|
+
var import_node_path79 = require("path");
|
|
10044
|
+
var smolToml2 = __toESM(require("smol-toml"), 1);
|
|
10045
|
+
var import_mini37 = require("zod/mini");
|
|
10046
|
+
var CodexCliSubagentTomlSchema = import_mini37.z.looseObject({
|
|
10047
|
+
name: import_mini37.z.string(),
|
|
10048
|
+
description: import_mini37.z.optional(import_mini37.z.string()),
|
|
10049
|
+
developer_instructions: import_mini37.z.optional(import_mini37.z.string()),
|
|
10050
|
+
model: import_mini37.z.optional(import_mini37.z.string()),
|
|
10051
|
+
model_reasoning_effort: import_mini37.z.optional(import_mini37.z.string()),
|
|
10052
|
+
sandbox_mode: import_mini37.z.optional(import_mini37.z.string())
|
|
10053
|
+
});
|
|
10054
|
+
var CodexCliSubagent = class _CodexCliSubagent extends ToolSubagent {
|
|
10055
|
+
body;
|
|
10056
|
+
constructor({ body, ...rest }) {
|
|
10057
|
+
super({
|
|
10058
|
+
...rest
|
|
10059
|
+
});
|
|
10060
|
+
this.body = body;
|
|
10061
|
+
}
|
|
10062
|
+
static getSettablePaths(_options = {}) {
|
|
10063
|
+
return {
|
|
10064
|
+
relativeDirPath: (0, import_node_path79.join)(".codex", "agents")
|
|
10065
|
+
};
|
|
10066
|
+
}
|
|
10067
|
+
getBody() {
|
|
10068
|
+
return this.body;
|
|
10069
|
+
}
|
|
10070
|
+
toRulesyncSubagent() {
|
|
10071
|
+
let parsed;
|
|
10072
|
+
try {
|
|
10073
|
+
parsed = CodexCliSubagentTomlSchema.parse(smolToml2.parse(this.body));
|
|
10074
|
+
} catch (error) {
|
|
10075
|
+
throw new Error(
|
|
10076
|
+
`Failed to parse TOML in ${(0, import_node_path79.join)(this.getRelativeDirPath(), this.getRelativeFilePath())}: ${error instanceof Error ? error.message : String(error)}`,
|
|
10077
|
+
{ cause: error }
|
|
10078
|
+
);
|
|
10079
|
+
}
|
|
10080
|
+
const { name, description, developer_instructions, ...restFields } = parsed;
|
|
10081
|
+
const codexcliSection = {
|
|
10082
|
+
...restFields
|
|
10083
|
+
};
|
|
10084
|
+
const rulesyncFrontmatter = {
|
|
10085
|
+
targets: ["codexcli"],
|
|
10086
|
+
name,
|
|
10087
|
+
description: description ?? "",
|
|
10088
|
+
// Only include codexcli section if there are fields
|
|
10089
|
+
...Object.keys(codexcliSection).length > 0 && { codexcli: codexcliSection }
|
|
10090
|
+
};
|
|
10091
|
+
return new RulesyncSubagent({
|
|
10092
|
+
baseDir: ".",
|
|
10093
|
+
frontmatter: rulesyncFrontmatter,
|
|
10094
|
+
body: developer_instructions ?? "",
|
|
10095
|
+
relativeDirPath: RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH,
|
|
10096
|
+
relativeFilePath: this.getRelativeFilePath().replace(/\.toml$/, ".md"),
|
|
10097
|
+
validate: true
|
|
10098
|
+
});
|
|
10099
|
+
}
|
|
10100
|
+
static fromRulesyncSubagent({
|
|
10101
|
+
baseDir = process.cwd(),
|
|
10102
|
+
rulesyncSubagent,
|
|
10103
|
+
validate = true,
|
|
10104
|
+
global = false
|
|
10105
|
+
}) {
|
|
10106
|
+
const frontmatter = rulesyncSubagent.getFrontmatter();
|
|
10107
|
+
const rawSection = frontmatter.codexcli ?? {};
|
|
10108
|
+
const {
|
|
10109
|
+
name: _n,
|
|
10110
|
+
description: _d,
|
|
10111
|
+
developer_instructions: _di,
|
|
10112
|
+
...codexcliSection
|
|
10113
|
+
} = rawSection;
|
|
10114
|
+
const tomlObj = {
|
|
10115
|
+
name: frontmatter.name,
|
|
10116
|
+
...frontmatter.description ? { description: frontmatter.description } : {},
|
|
10117
|
+
...rulesyncSubagent.getBody() ? { developer_instructions: rulesyncSubagent.getBody() } : {},
|
|
10118
|
+
...codexcliSection
|
|
10119
|
+
};
|
|
10120
|
+
const body = smolToml2.stringify(tomlObj);
|
|
10121
|
+
const paths = this.getSettablePaths({ global });
|
|
10122
|
+
const relativeFilePath = rulesyncSubagent.getRelativeFilePath().replace(/\.md$/, ".toml");
|
|
10123
|
+
return new _CodexCliSubagent({
|
|
10124
|
+
baseDir,
|
|
10125
|
+
body,
|
|
10126
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10127
|
+
relativeFilePath,
|
|
10128
|
+
fileContent: body,
|
|
10129
|
+
validate,
|
|
10130
|
+
global
|
|
10131
|
+
});
|
|
10132
|
+
}
|
|
10133
|
+
validate() {
|
|
10134
|
+
try {
|
|
10135
|
+
const parsed = smolToml2.parse(this.body);
|
|
10136
|
+
CodexCliSubagentTomlSchema.parse(parsed);
|
|
10137
|
+
return { success: true, error: null };
|
|
10138
|
+
} catch (error) {
|
|
10139
|
+
return {
|
|
10140
|
+
success: false,
|
|
10141
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
10142
|
+
};
|
|
10143
|
+
}
|
|
10144
|
+
}
|
|
10145
|
+
static isTargetedByRulesyncSubagent(rulesyncSubagent) {
|
|
10146
|
+
return this.isTargetedByRulesyncSubagentDefault({
|
|
10147
|
+
rulesyncSubagent,
|
|
10148
|
+
toolTarget: "codexcli"
|
|
10149
|
+
});
|
|
10150
|
+
}
|
|
10151
|
+
static async fromFile({
|
|
10152
|
+
baseDir = process.cwd(),
|
|
10153
|
+
relativeFilePath,
|
|
10154
|
+
validate = true,
|
|
10155
|
+
global = false
|
|
10156
|
+
}) {
|
|
10157
|
+
const paths = this.getSettablePaths({ global });
|
|
10158
|
+
const filePath = (0, import_node_path79.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
10159
|
+
const fileContent = await readFileContent(filePath);
|
|
10160
|
+
return new _CodexCliSubagent({
|
|
10161
|
+
baseDir,
|
|
10162
|
+
relativeDirPath: paths.relativeDirPath,
|
|
10163
|
+
relativeFilePath,
|
|
10164
|
+
body: fileContent.trim(),
|
|
10165
|
+
fileContent,
|
|
10166
|
+
validate,
|
|
10167
|
+
global
|
|
10168
|
+
});
|
|
10169
|
+
}
|
|
10170
|
+
static forDeletion({
|
|
10171
|
+
baseDir = process.cwd(),
|
|
10172
|
+
relativeDirPath,
|
|
10173
|
+
relativeFilePath
|
|
10174
|
+
}) {
|
|
10175
|
+
return new _CodexCliSubagent({
|
|
10176
|
+
baseDir,
|
|
10177
|
+
relativeDirPath,
|
|
10178
|
+
relativeFilePath,
|
|
10179
|
+
body: "",
|
|
10180
|
+
fileContent: "",
|
|
10181
|
+
validate: false
|
|
10182
|
+
});
|
|
10183
|
+
}
|
|
10184
|
+
};
|
|
10185
|
+
|
|
9956
10186
|
// src/features/subagents/copilot-subagent.ts
|
|
9957
10187
|
var import_node_path80 = require("path");
|
|
9958
|
-
var
|
|
10188
|
+
var import_mini38 = require("zod/mini");
|
|
9959
10189
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
9960
|
-
var CopilotSubagentFrontmatterSchema =
|
|
9961
|
-
name:
|
|
9962
|
-
description:
|
|
9963
|
-
tools:
|
|
10190
|
+
var CopilotSubagentFrontmatterSchema = import_mini38.z.looseObject({
|
|
10191
|
+
name: import_mini38.z.string(),
|
|
10192
|
+
description: import_mini38.z.string(),
|
|
10193
|
+
tools: import_mini38.z.optional(import_mini38.z.union([import_mini38.z.string(), import_mini38.z.array(import_mini38.z.string())]))
|
|
9964
10194
|
});
|
|
9965
10195
|
var normalizeTools = (tools) => {
|
|
9966
10196
|
if (!tools) {
|
|
@@ -10121,10 +10351,10 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
10121
10351
|
|
|
10122
10352
|
// src/features/subagents/cursor-subagent.ts
|
|
10123
10353
|
var import_node_path81 = require("path");
|
|
10124
|
-
var
|
|
10125
|
-
var CursorSubagentFrontmatterSchema =
|
|
10126
|
-
name:
|
|
10127
|
-
description:
|
|
10354
|
+
var import_mini39 = require("zod/mini");
|
|
10355
|
+
var CursorSubagentFrontmatterSchema = import_mini39.z.looseObject({
|
|
10356
|
+
name: import_mini39.z.string(),
|
|
10357
|
+
description: import_mini39.z.string()
|
|
10128
10358
|
});
|
|
10129
10359
|
var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
10130
10360
|
frontmatter;
|
|
@@ -10268,22 +10498,22 @@ var CursorSubagent = class _CursorSubagent extends ToolSubagent {
|
|
|
10268
10498
|
|
|
10269
10499
|
// src/features/subagents/kiro-subagent.ts
|
|
10270
10500
|
var import_node_path82 = require("path");
|
|
10271
|
-
var
|
|
10272
|
-
var KiroCliSubagentJsonSchema =
|
|
10273
|
-
name:
|
|
10274
|
-
description:
|
|
10275
|
-
prompt:
|
|
10276
|
-
tools:
|
|
10277
|
-
toolAliases:
|
|
10278
|
-
toolSettings:
|
|
10279
|
-
toolSchema:
|
|
10280
|
-
hooks:
|
|
10281
|
-
model:
|
|
10282
|
-
mcpServers:
|
|
10283
|
-
useLegacyMcpJson:
|
|
10284
|
-
resources:
|
|
10285
|
-
allowedTools:
|
|
10286
|
-
includeMcpJson:
|
|
10501
|
+
var import_mini40 = require("zod/mini");
|
|
10502
|
+
var KiroCliSubagentJsonSchema = import_mini40.z.looseObject({
|
|
10503
|
+
name: import_mini40.z.string(),
|
|
10504
|
+
description: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.string())),
|
|
10505
|
+
prompt: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.string())),
|
|
10506
|
+
tools: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.array(import_mini40.z.string()))),
|
|
10507
|
+
toolAliases: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.record(import_mini40.z.string(), import_mini40.z.string()))),
|
|
10508
|
+
toolSettings: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.unknown())),
|
|
10509
|
+
toolSchema: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.unknown())),
|
|
10510
|
+
hooks: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.record(import_mini40.z.string(), import_mini40.z.array(import_mini40.z.unknown())))),
|
|
10511
|
+
model: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.string())),
|
|
10512
|
+
mcpServers: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.record(import_mini40.z.string(), import_mini40.z.unknown()))),
|
|
10513
|
+
useLegacyMcpJson: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.boolean())),
|
|
10514
|
+
resources: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.array(import_mini40.z.string()))),
|
|
10515
|
+
allowedTools: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.array(import_mini40.z.string()))),
|
|
10516
|
+
includeMcpJson: import_mini40.z.optional(import_mini40.z.nullable(import_mini40.z.boolean()))
|
|
10287
10517
|
});
|
|
10288
10518
|
var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
10289
10519
|
body;
|
|
@@ -10405,11 +10635,11 @@ var KiroSubagent = class _KiroSubagent extends ToolSubagent {
|
|
|
10405
10635
|
|
|
10406
10636
|
// src/features/subagents/opencode-subagent.ts
|
|
10407
10637
|
var import_node_path83 = require("path");
|
|
10408
|
-
var
|
|
10409
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
10410
|
-
description:
|
|
10411
|
-
mode:
|
|
10412
|
-
name:
|
|
10638
|
+
var import_mini41 = require("zod/mini");
|
|
10639
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini41.z.looseObject({
|
|
10640
|
+
description: import_mini41.z.string(),
|
|
10641
|
+
mode: import_mini41.z._default(import_mini41.z.string(), "subagent"),
|
|
10642
|
+
name: import_mini41.z.optional(import_mini41.z.string())
|
|
10413
10643
|
});
|
|
10414
10644
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
10415
10645
|
frontmatter;
|
|
@@ -10565,7 +10795,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
10565
10795
|
"opencode",
|
|
10566
10796
|
"roo"
|
|
10567
10797
|
];
|
|
10568
|
-
var SubagentsProcessorToolTargetSchema =
|
|
10798
|
+
var SubagentsProcessorToolTargetSchema = import_mini42.z.enum(subagentsProcessorToolTargetTuple);
|
|
10569
10799
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
10570
10800
|
[
|
|
10571
10801
|
"agentsmd",
|
|
@@ -10592,7 +10822,7 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
10592
10822
|
"codexcli",
|
|
10593
10823
|
{
|
|
10594
10824
|
class: CodexCliSubagent,
|
|
10595
|
-
meta: { supportsSimulated:
|
|
10825
|
+
meta: { supportsSimulated: false, supportsGlobal: false, filePattern: "*.toml" }
|
|
10596
10826
|
}
|
|
10597
10827
|
],
|
|
10598
10828
|
[
|
|
@@ -10844,42 +11074,42 @@ var import_node_path86 = require("path");
|
|
|
10844
11074
|
|
|
10845
11075
|
// src/features/rules/rulesync-rule.ts
|
|
10846
11076
|
var import_node_path85 = require("path");
|
|
10847
|
-
var
|
|
10848
|
-
var RulesyncRuleFrontmatterSchema =
|
|
10849
|
-
root:
|
|
10850
|
-
localRoot:
|
|
10851
|
-
targets:
|
|
10852
|
-
description:
|
|
10853
|
-
globs:
|
|
10854
|
-
agentsmd:
|
|
10855
|
-
|
|
11077
|
+
var import_mini43 = require("zod/mini");
|
|
11078
|
+
var RulesyncRuleFrontmatterSchema = import_mini43.z.object({
|
|
11079
|
+
root: import_mini43.z.optional(import_mini43.z.boolean()),
|
|
11080
|
+
localRoot: import_mini43.z.optional(import_mini43.z.boolean()),
|
|
11081
|
+
targets: import_mini43.z._default(RulesyncTargetsSchema, ["*"]),
|
|
11082
|
+
description: import_mini43.z.optional(import_mini43.z.string()),
|
|
11083
|
+
globs: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string())),
|
|
11084
|
+
agentsmd: import_mini43.z.optional(
|
|
11085
|
+
import_mini43.z.object({
|
|
10856
11086
|
// @example "path/to/subproject"
|
|
10857
|
-
subprojectPath:
|
|
11087
|
+
subprojectPath: import_mini43.z.optional(import_mini43.z.string())
|
|
10858
11088
|
})
|
|
10859
11089
|
),
|
|
10860
|
-
claudecode:
|
|
10861
|
-
|
|
11090
|
+
claudecode: import_mini43.z.optional(
|
|
11091
|
+
import_mini43.z.object({
|
|
10862
11092
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
10863
11093
|
// @example ["src/**/*.ts", "tests/**/*.test.ts"]
|
|
10864
|
-
paths:
|
|
11094
|
+
paths: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string()))
|
|
10865
11095
|
})
|
|
10866
11096
|
),
|
|
10867
|
-
cursor:
|
|
10868
|
-
|
|
10869
|
-
alwaysApply:
|
|
10870
|
-
description:
|
|
10871
|
-
globs:
|
|
11097
|
+
cursor: import_mini43.z.optional(
|
|
11098
|
+
import_mini43.z.object({
|
|
11099
|
+
alwaysApply: import_mini43.z.optional(import_mini43.z.boolean()),
|
|
11100
|
+
description: import_mini43.z.optional(import_mini43.z.string()),
|
|
11101
|
+
globs: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string()))
|
|
10872
11102
|
})
|
|
10873
11103
|
),
|
|
10874
|
-
copilot:
|
|
10875
|
-
|
|
10876
|
-
excludeAgent:
|
|
11104
|
+
copilot: import_mini43.z.optional(
|
|
11105
|
+
import_mini43.z.object({
|
|
11106
|
+
excludeAgent: import_mini43.z.optional(import_mini43.z.union([import_mini43.z.literal("code-review"), import_mini43.z.literal("coding-agent")]))
|
|
10877
11107
|
})
|
|
10878
11108
|
),
|
|
10879
|
-
antigravity:
|
|
10880
|
-
|
|
10881
|
-
trigger:
|
|
10882
|
-
globs:
|
|
11109
|
+
antigravity: import_mini43.z.optional(
|
|
11110
|
+
import_mini43.z.looseObject({
|
|
11111
|
+
trigger: import_mini43.z.optional(import_mini43.z.string()),
|
|
11112
|
+
globs: import_mini43.z.optional(import_mini43.z.array(import_mini43.z.string()))
|
|
10883
11113
|
})
|
|
10884
11114
|
)
|
|
10885
11115
|
});
|
|
@@ -11182,20 +11412,20 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
11182
11412
|
|
|
11183
11413
|
// src/features/rules/antigravity-rule.ts
|
|
11184
11414
|
var import_node_path88 = require("path");
|
|
11185
|
-
var
|
|
11186
|
-
var AntigravityRuleFrontmatterSchema =
|
|
11187
|
-
trigger:
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11415
|
+
var import_mini44 = require("zod/mini");
|
|
11416
|
+
var AntigravityRuleFrontmatterSchema = import_mini44.z.looseObject({
|
|
11417
|
+
trigger: import_mini44.z.optional(
|
|
11418
|
+
import_mini44.z.union([
|
|
11419
|
+
import_mini44.z.literal("always_on"),
|
|
11420
|
+
import_mini44.z.literal("glob"),
|
|
11421
|
+
import_mini44.z.literal("manual"),
|
|
11422
|
+
import_mini44.z.literal("model_decision"),
|
|
11423
|
+
import_mini44.z.string()
|
|
11194
11424
|
// accepts any string for forward compatibility
|
|
11195
11425
|
])
|
|
11196
11426
|
),
|
|
11197
|
-
globs:
|
|
11198
|
-
description:
|
|
11427
|
+
globs: import_mini44.z.optional(import_mini44.z.string()),
|
|
11428
|
+
description: import_mini44.z.optional(import_mini44.z.string())
|
|
11199
11429
|
});
|
|
11200
11430
|
function parseGlobsString(globs) {
|
|
11201
11431
|
if (!globs) {
|
|
@@ -11774,9 +12004,9 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
11774
12004
|
|
|
11775
12005
|
// src/features/rules/claudecode-rule.ts
|
|
11776
12006
|
var import_node_path92 = require("path");
|
|
11777
|
-
var
|
|
11778
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
11779
|
-
paths:
|
|
12007
|
+
var import_mini45 = require("zod/mini");
|
|
12008
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini45.z.object({
|
|
12009
|
+
paths: import_mini45.z.optional(import_mini45.z.array(import_mini45.z.string()))
|
|
11780
12010
|
});
|
|
11781
12011
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
11782
12012
|
frontmatter;
|
|
@@ -11985,9 +12215,9 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
11985
12215
|
|
|
11986
12216
|
// src/features/rules/cline-rule.ts
|
|
11987
12217
|
var import_node_path93 = require("path");
|
|
11988
|
-
var
|
|
11989
|
-
var ClineRuleFrontmatterSchema =
|
|
11990
|
-
description:
|
|
12218
|
+
var import_mini46 = require("zod/mini");
|
|
12219
|
+
var ClineRuleFrontmatterSchema = import_mini46.z.object({
|
|
12220
|
+
description: import_mini46.z.string()
|
|
11991
12221
|
});
|
|
11992
12222
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
11993
12223
|
static getSettablePaths(_options = {}) {
|
|
@@ -12166,11 +12396,11 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
12166
12396
|
|
|
12167
12397
|
// src/features/rules/copilot-rule.ts
|
|
12168
12398
|
var import_node_path95 = require("path");
|
|
12169
|
-
var
|
|
12170
|
-
var CopilotRuleFrontmatterSchema =
|
|
12171
|
-
description:
|
|
12172
|
-
applyTo:
|
|
12173
|
-
excludeAgent:
|
|
12399
|
+
var import_mini47 = require("zod/mini");
|
|
12400
|
+
var CopilotRuleFrontmatterSchema = import_mini47.z.object({
|
|
12401
|
+
description: import_mini47.z.optional(import_mini47.z.string()),
|
|
12402
|
+
applyTo: import_mini47.z.optional(import_mini47.z.string()),
|
|
12403
|
+
excludeAgent: import_mini47.z.optional(import_mini47.z.union([import_mini47.z.literal("code-review"), import_mini47.z.literal("coding-agent")]))
|
|
12174
12404
|
});
|
|
12175
12405
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
12176
12406
|
frontmatter;
|
|
@@ -12373,11 +12603,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
12373
12603
|
|
|
12374
12604
|
// src/features/rules/cursor-rule.ts
|
|
12375
12605
|
var import_node_path96 = require("path");
|
|
12376
|
-
var
|
|
12377
|
-
var CursorRuleFrontmatterSchema =
|
|
12378
|
-
description:
|
|
12379
|
-
globs:
|
|
12380
|
-
alwaysApply:
|
|
12606
|
+
var import_mini48 = require("zod/mini");
|
|
12607
|
+
var CursorRuleFrontmatterSchema = import_mini48.z.object({
|
|
12608
|
+
description: import_mini48.z.optional(import_mini48.z.string()),
|
|
12609
|
+
globs: import_mini48.z.optional(import_mini48.z.string()),
|
|
12610
|
+
alwaysApply: import_mini48.z.optional(import_mini48.z.boolean())
|
|
12381
12611
|
});
|
|
12382
12612
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
12383
12613
|
frontmatter;
|
|
@@ -12796,8 +13026,117 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
12796
13026
|
}
|
|
12797
13027
|
};
|
|
12798
13028
|
|
|
12799
|
-
// src/features/rules/
|
|
13029
|
+
// src/features/rules/goose-rule.ts
|
|
12800
13030
|
var import_node_path99 = require("path");
|
|
13031
|
+
var GooseRule = class _GooseRule extends ToolRule {
|
|
13032
|
+
static getSettablePaths({
|
|
13033
|
+
global,
|
|
13034
|
+
excludeToolDir
|
|
13035
|
+
} = {}) {
|
|
13036
|
+
if (global) {
|
|
13037
|
+
return {
|
|
13038
|
+
root: {
|
|
13039
|
+
relativeDirPath: ".",
|
|
13040
|
+
relativeFilePath: ".goosehints"
|
|
13041
|
+
}
|
|
13042
|
+
};
|
|
13043
|
+
}
|
|
13044
|
+
return {
|
|
13045
|
+
root: {
|
|
13046
|
+
relativeDirPath: ".",
|
|
13047
|
+
relativeFilePath: ".goosehints"
|
|
13048
|
+
},
|
|
13049
|
+
nonRoot: {
|
|
13050
|
+
relativeDirPath: buildToolPath(".goose", "memories", excludeToolDir)
|
|
13051
|
+
}
|
|
13052
|
+
};
|
|
13053
|
+
}
|
|
13054
|
+
static async fromFile({
|
|
13055
|
+
baseDir = process.cwd(),
|
|
13056
|
+
relativeFilePath,
|
|
13057
|
+
validate = true,
|
|
13058
|
+
global = false
|
|
13059
|
+
}) {
|
|
13060
|
+
const paths = this.getSettablePaths({ global });
|
|
13061
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13062
|
+
if (isRoot) {
|
|
13063
|
+
const relativePath2 = paths.root.relativeFilePath;
|
|
13064
|
+
const fileContent2 = await readFileContent(
|
|
13065
|
+
(0, import_node_path99.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13066
|
+
);
|
|
13067
|
+
return new _GooseRule({
|
|
13068
|
+
baseDir,
|
|
13069
|
+
relativeDirPath: paths.root.relativeDirPath,
|
|
13070
|
+
relativeFilePath: paths.root.relativeFilePath,
|
|
13071
|
+
fileContent: fileContent2,
|
|
13072
|
+
validate,
|
|
13073
|
+
root: true
|
|
13074
|
+
});
|
|
13075
|
+
}
|
|
13076
|
+
if (!paths.nonRoot) {
|
|
13077
|
+
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13078
|
+
}
|
|
13079
|
+
const relativePath = (0, import_node_path99.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13080
|
+
const fileContent = await readFileContent((0, import_node_path99.join)(baseDir, relativePath));
|
|
13081
|
+
return new _GooseRule({
|
|
13082
|
+
baseDir,
|
|
13083
|
+
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
13084
|
+
relativeFilePath,
|
|
13085
|
+
fileContent,
|
|
13086
|
+
validate,
|
|
13087
|
+
root: false
|
|
13088
|
+
});
|
|
13089
|
+
}
|
|
13090
|
+
static fromRulesyncRule({
|
|
13091
|
+
baseDir = process.cwd(),
|
|
13092
|
+
rulesyncRule,
|
|
13093
|
+
validate = true,
|
|
13094
|
+
global = false
|
|
13095
|
+
}) {
|
|
13096
|
+
const paths = this.getSettablePaths({ global });
|
|
13097
|
+
return new _GooseRule(
|
|
13098
|
+
this.buildToolRuleParamsDefault({
|
|
13099
|
+
baseDir,
|
|
13100
|
+
rulesyncRule,
|
|
13101
|
+
validate,
|
|
13102
|
+
rootPath: paths.root,
|
|
13103
|
+
nonRootPath: paths.nonRoot
|
|
13104
|
+
})
|
|
13105
|
+
);
|
|
13106
|
+
}
|
|
13107
|
+
toRulesyncRule() {
|
|
13108
|
+
return this.toRulesyncRuleDefault();
|
|
13109
|
+
}
|
|
13110
|
+
validate() {
|
|
13111
|
+
return { success: true, error: null };
|
|
13112
|
+
}
|
|
13113
|
+
static forDeletion({
|
|
13114
|
+
baseDir = process.cwd(),
|
|
13115
|
+
relativeDirPath,
|
|
13116
|
+
relativeFilePath,
|
|
13117
|
+
global = false
|
|
13118
|
+
}) {
|
|
13119
|
+
const paths = this.getSettablePaths({ global });
|
|
13120
|
+
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
13121
|
+
return new _GooseRule({
|
|
13122
|
+
baseDir,
|
|
13123
|
+
relativeDirPath,
|
|
13124
|
+
relativeFilePath,
|
|
13125
|
+
fileContent: "",
|
|
13126
|
+
validate: false,
|
|
13127
|
+
root: isRoot
|
|
13128
|
+
});
|
|
13129
|
+
}
|
|
13130
|
+
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
13131
|
+
return this.isTargetedByRulesyncRuleDefault({
|
|
13132
|
+
rulesyncRule,
|
|
13133
|
+
toolTarget: "goose"
|
|
13134
|
+
});
|
|
13135
|
+
}
|
|
13136
|
+
};
|
|
13137
|
+
|
|
13138
|
+
// src/features/rules/junie-rule.ts
|
|
13139
|
+
var import_node_path100 = require("path");
|
|
12801
13140
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
12802
13141
|
static getSettablePaths(_options = {}) {
|
|
12803
13142
|
return {
|
|
@@ -12816,8 +13155,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
12816
13155
|
validate = true
|
|
12817
13156
|
}) {
|
|
12818
13157
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
12819
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
12820
|
-
const fileContent = await readFileContent((0,
|
|
13158
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path100.join)(".junie", "memories", relativeFilePath);
|
|
13159
|
+
const fileContent = await readFileContent((0, import_node_path100.join)(baseDir, relativePath));
|
|
12821
13160
|
return new _JunieRule({
|
|
12822
13161
|
baseDir,
|
|
12823
13162
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -12872,7 +13211,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
12872
13211
|
};
|
|
12873
13212
|
|
|
12874
13213
|
// src/features/rules/kilo-rule.ts
|
|
12875
|
-
var
|
|
13214
|
+
var import_node_path101 = require("path");
|
|
12876
13215
|
var KiloRule = class _KiloRule extends ToolRule {
|
|
12877
13216
|
static getSettablePaths(_options = {}) {
|
|
12878
13217
|
return {
|
|
@@ -12887,7 +13226,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
12887
13226
|
validate = true
|
|
12888
13227
|
}) {
|
|
12889
13228
|
const fileContent = await readFileContent(
|
|
12890
|
-
(0,
|
|
13229
|
+
(0, import_node_path101.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
12891
13230
|
);
|
|
12892
13231
|
return new _KiloRule({
|
|
12893
13232
|
baseDir,
|
|
@@ -12939,7 +13278,7 @@ var KiloRule = class _KiloRule extends ToolRule {
|
|
|
12939
13278
|
};
|
|
12940
13279
|
|
|
12941
13280
|
// src/features/rules/kiro-rule.ts
|
|
12942
|
-
var
|
|
13281
|
+
var import_node_path102 = require("path");
|
|
12943
13282
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
12944
13283
|
static getSettablePaths(_options = {}) {
|
|
12945
13284
|
return {
|
|
@@ -12954,7 +13293,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
12954
13293
|
validate = true
|
|
12955
13294
|
}) {
|
|
12956
13295
|
const fileContent = await readFileContent(
|
|
12957
|
-
(0,
|
|
13296
|
+
(0, import_node_path102.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
12958
13297
|
);
|
|
12959
13298
|
return new _KiroRule({
|
|
12960
13299
|
baseDir,
|
|
@@ -13008,7 +13347,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
13008
13347
|
};
|
|
13009
13348
|
|
|
13010
13349
|
// src/features/rules/opencode-rule.ts
|
|
13011
|
-
var
|
|
13350
|
+
var import_node_path103 = require("path");
|
|
13012
13351
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
13013
13352
|
static getSettablePaths({
|
|
13014
13353
|
global,
|
|
@@ -13043,7 +13382,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13043
13382
|
if (isRoot) {
|
|
13044
13383
|
const relativePath2 = paths.root.relativeFilePath;
|
|
13045
13384
|
const fileContent2 = await readFileContent(
|
|
13046
|
-
(0,
|
|
13385
|
+
(0, import_node_path103.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
13047
13386
|
);
|
|
13048
13387
|
return new _OpenCodeRule({
|
|
13049
13388
|
baseDir,
|
|
@@ -13057,8 +13396,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13057
13396
|
if (!paths.nonRoot) {
|
|
13058
13397
|
throw new Error(`nonRoot path is not set for ${relativeFilePath}`);
|
|
13059
13398
|
}
|
|
13060
|
-
const relativePath = (0,
|
|
13061
|
-
const fileContent = await readFileContent((0,
|
|
13399
|
+
const relativePath = (0, import_node_path103.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
13400
|
+
const fileContent = await readFileContent((0, import_node_path103.join)(baseDir, relativePath));
|
|
13062
13401
|
return new _OpenCodeRule({
|
|
13063
13402
|
baseDir,
|
|
13064
13403
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -13117,7 +13456,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
13117
13456
|
};
|
|
13118
13457
|
|
|
13119
13458
|
// src/features/rules/qwencode-rule.ts
|
|
13120
|
-
var
|
|
13459
|
+
var import_node_path104 = require("path");
|
|
13121
13460
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
13122
13461
|
static getSettablePaths(_options = {}) {
|
|
13123
13462
|
return {
|
|
@@ -13136,8 +13475,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13136
13475
|
validate = true
|
|
13137
13476
|
}) {
|
|
13138
13477
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
13139
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
13140
|
-
const fileContent = await readFileContent((0,
|
|
13478
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path104.join)(".qwen", "memories", relativeFilePath);
|
|
13479
|
+
const fileContent = await readFileContent((0, import_node_path104.join)(baseDir, relativePath));
|
|
13141
13480
|
return new _QwencodeRule({
|
|
13142
13481
|
baseDir,
|
|
13143
13482
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -13189,7 +13528,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
13189
13528
|
};
|
|
13190
13529
|
|
|
13191
13530
|
// src/features/rules/replit-rule.ts
|
|
13192
|
-
var
|
|
13531
|
+
var import_node_path105 = require("path");
|
|
13193
13532
|
var ReplitRule = class _ReplitRule extends ToolRule {
|
|
13194
13533
|
static getSettablePaths(_options = {}) {
|
|
13195
13534
|
return {
|
|
@@ -13211,7 +13550,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
13211
13550
|
}
|
|
13212
13551
|
const relativePath = paths.root.relativeFilePath;
|
|
13213
13552
|
const fileContent = await readFileContent(
|
|
13214
|
-
(0,
|
|
13553
|
+
(0, import_node_path105.join)(baseDir, paths.root.relativeDirPath, relativePath)
|
|
13215
13554
|
);
|
|
13216
13555
|
return new _ReplitRule({
|
|
13217
13556
|
baseDir,
|
|
@@ -13277,7 +13616,7 @@ var ReplitRule = class _ReplitRule extends ToolRule {
|
|
|
13277
13616
|
};
|
|
13278
13617
|
|
|
13279
13618
|
// src/features/rules/roo-rule.ts
|
|
13280
|
-
var
|
|
13619
|
+
var import_node_path106 = require("path");
|
|
13281
13620
|
var RooRule = class _RooRule extends ToolRule {
|
|
13282
13621
|
static getSettablePaths(_options = {}) {
|
|
13283
13622
|
return {
|
|
@@ -13292,7 +13631,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
13292
13631
|
validate = true
|
|
13293
13632
|
}) {
|
|
13294
13633
|
const fileContent = await readFileContent(
|
|
13295
|
-
(0,
|
|
13634
|
+
(0, import_node_path106.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13296
13635
|
);
|
|
13297
13636
|
return new _RooRule({
|
|
13298
13637
|
baseDir,
|
|
@@ -13361,7 +13700,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
13361
13700
|
};
|
|
13362
13701
|
|
|
13363
13702
|
// src/features/rules/warp-rule.ts
|
|
13364
|
-
var
|
|
13703
|
+
var import_node_path107 = require("path");
|
|
13365
13704
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
13366
13705
|
constructor({ fileContent, root, ...rest }) {
|
|
13367
13706
|
super({
|
|
@@ -13387,8 +13726,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
13387
13726
|
validate = true
|
|
13388
13727
|
}) {
|
|
13389
13728
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
13390
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
13391
|
-
const fileContent = await readFileContent((0,
|
|
13729
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path107.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
13730
|
+
const fileContent = await readFileContent((0, import_node_path107.join)(baseDir, relativePath));
|
|
13392
13731
|
return new _WarpRule({
|
|
13393
13732
|
baseDir,
|
|
13394
13733
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -13443,7 +13782,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
13443
13782
|
};
|
|
13444
13783
|
|
|
13445
13784
|
// src/features/rules/windsurf-rule.ts
|
|
13446
|
-
var
|
|
13785
|
+
var import_node_path108 = require("path");
|
|
13447
13786
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
13448
13787
|
static getSettablePaths(_options = {}) {
|
|
13449
13788
|
return {
|
|
@@ -13458,7 +13797,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
13458
13797
|
validate = true
|
|
13459
13798
|
}) {
|
|
13460
13799
|
const fileContent = await readFileContent(
|
|
13461
|
-
(0,
|
|
13800
|
+
(0, import_node_path108.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
13462
13801
|
);
|
|
13463
13802
|
return new _WindsurfRule({
|
|
13464
13803
|
baseDir,
|
|
@@ -13523,6 +13862,7 @@ var rulesProcessorToolTargets = [
|
|
|
13523
13862
|
"cursor",
|
|
13524
13863
|
"factorydroid",
|
|
13525
13864
|
"geminicli",
|
|
13865
|
+
"goose",
|
|
13526
13866
|
"junie",
|
|
13527
13867
|
"kilo",
|
|
13528
13868
|
"kiro",
|
|
@@ -13533,8 +13873,8 @@ var rulesProcessorToolTargets = [
|
|
|
13533
13873
|
"warp",
|
|
13534
13874
|
"windsurf"
|
|
13535
13875
|
];
|
|
13536
|
-
var RulesProcessorToolTargetSchema =
|
|
13537
|
-
var formatRulePaths = (rules) => rules.map((r) => (0,
|
|
13876
|
+
var RulesProcessorToolTargetSchema = import_mini49.z.enum(rulesProcessorToolTargets);
|
|
13877
|
+
var formatRulePaths = (rules) => rules.map((r) => (0, import_node_path109.join)(r.getRelativeDirPath(), r.getRelativeFilePath())).join(", ");
|
|
13538
13878
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
13539
13879
|
[
|
|
13540
13880
|
"agentsmd",
|
|
@@ -13625,10 +13965,7 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
13625
13965
|
meta: {
|
|
13626
13966
|
extension: "md",
|
|
13627
13967
|
supportsGlobal: true,
|
|
13628
|
-
ruleDiscoveryMode: "toon"
|
|
13629
|
-
additionalConventions: {
|
|
13630
|
-
subagents: { subagentClass: CodexCliSubagent }
|
|
13631
|
-
}
|
|
13968
|
+
ruleDiscoveryMode: "toon"
|
|
13632
13969
|
}
|
|
13633
13970
|
}
|
|
13634
13971
|
],
|
|
@@ -13684,6 +14021,17 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
13684
14021
|
}
|
|
13685
14022
|
}
|
|
13686
14023
|
],
|
|
14024
|
+
[
|
|
14025
|
+
"goose",
|
|
14026
|
+
{
|
|
14027
|
+
class: GooseRule,
|
|
14028
|
+
meta: {
|
|
14029
|
+
extension: "md",
|
|
14030
|
+
supportsGlobal: true,
|
|
14031
|
+
ruleDiscoveryMode: "toon"
|
|
14032
|
+
}
|
|
14033
|
+
}
|
|
14034
|
+
],
|
|
13687
14035
|
[
|
|
13688
14036
|
"junie",
|
|
13689
14037
|
{
|
|
@@ -13901,7 +14249,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
13901
14249
|
}).relativeDirPath;
|
|
13902
14250
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
13903
14251
|
const frontmatter = skill.getFrontmatter();
|
|
13904
|
-
const relativePath = (0,
|
|
14252
|
+
const relativePath = (0, import_node_path109.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
13905
14253
|
return {
|
|
13906
14254
|
name: frontmatter.name,
|
|
13907
14255
|
description: frontmatter.description,
|
|
@@ -14014,12 +14362,12 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14014
14362
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
14015
14363
|
*/
|
|
14016
14364
|
async loadRulesyncFiles() {
|
|
14017
|
-
const rulesyncBaseDir = (0,
|
|
14018
|
-
const files = await findFilesByGlobs((0,
|
|
14365
|
+
const rulesyncBaseDir = (0, import_node_path109.join)(this.baseDir, RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
14366
|
+
const files = await findFilesByGlobs((0, import_node_path109.join)(rulesyncBaseDir, "**", "*.md"));
|
|
14019
14367
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
14020
14368
|
const rulesyncRules = await Promise.all(
|
|
14021
14369
|
files.map((file) => {
|
|
14022
|
-
const relativeFilePath = (0,
|
|
14370
|
+
const relativeFilePath = (0, import_node_path109.relative)(rulesyncBaseDir, file);
|
|
14023
14371
|
checkPathTraversal({
|
|
14024
14372
|
relativePath: relativeFilePath,
|
|
14025
14373
|
intendedRootDir: rulesyncBaseDir
|
|
@@ -14082,7 +14430,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14082
14430
|
return [];
|
|
14083
14431
|
}
|
|
14084
14432
|
const rootFilePaths = await findFilesByGlobs(
|
|
14085
|
-
(0,
|
|
14433
|
+
(0, import_node_path109.join)(
|
|
14086
14434
|
this.baseDir,
|
|
14087
14435
|
settablePaths.root.relativeDirPath ?? ".",
|
|
14088
14436
|
settablePaths.root.relativeFilePath
|
|
@@ -14093,7 +14441,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14093
14441
|
(filePath) => factory.class.forDeletion({
|
|
14094
14442
|
baseDir: this.baseDir,
|
|
14095
14443
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14096
|
-
relativeFilePath: (0,
|
|
14444
|
+
relativeFilePath: (0, import_node_path109.basename)(filePath),
|
|
14097
14445
|
global: this.global
|
|
14098
14446
|
})
|
|
14099
14447
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14102,7 +14450,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14102
14450
|
rootFilePaths.map(
|
|
14103
14451
|
(filePath) => factory.class.fromFile({
|
|
14104
14452
|
baseDir: this.baseDir,
|
|
14105
|
-
relativeFilePath: (0,
|
|
14453
|
+
relativeFilePath: (0, import_node_path109.basename)(filePath),
|
|
14106
14454
|
global: this.global
|
|
14107
14455
|
})
|
|
14108
14456
|
)
|
|
@@ -14120,13 +14468,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14120
14468
|
return [];
|
|
14121
14469
|
}
|
|
14122
14470
|
const localRootFilePaths = await findFilesByGlobs(
|
|
14123
|
-
(0,
|
|
14471
|
+
(0, import_node_path109.join)(this.baseDir, settablePaths.root.relativeDirPath ?? ".", "CLAUDE.local.md")
|
|
14124
14472
|
);
|
|
14125
14473
|
return localRootFilePaths.map(
|
|
14126
14474
|
(filePath) => factory.class.forDeletion({
|
|
14127
14475
|
baseDir: this.baseDir,
|
|
14128
14476
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
14129
|
-
relativeFilePath: (0,
|
|
14477
|
+
relativeFilePath: (0, import_node_path109.basename)(filePath),
|
|
14130
14478
|
global: this.global
|
|
14131
14479
|
})
|
|
14132
14480
|
).filter((rule) => rule.isDeletable());
|
|
@@ -14136,13 +14484,13 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14136
14484
|
if (!settablePaths.nonRoot) {
|
|
14137
14485
|
return [];
|
|
14138
14486
|
}
|
|
14139
|
-
const nonRootBaseDir = (0,
|
|
14487
|
+
const nonRootBaseDir = (0, import_node_path109.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath);
|
|
14140
14488
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
14141
|
-
(0,
|
|
14489
|
+
(0, import_node_path109.join)(nonRootBaseDir, "**", `*.${factory.meta.extension}`)
|
|
14142
14490
|
);
|
|
14143
14491
|
if (forDeletion) {
|
|
14144
14492
|
return nonRootFilePaths.map((filePath) => {
|
|
14145
|
-
const relativeFilePath = (0,
|
|
14493
|
+
const relativeFilePath = (0, import_node_path109.relative)(nonRootBaseDir, filePath);
|
|
14146
14494
|
checkPathTraversal({
|
|
14147
14495
|
relativePath: relativeFilePath,
|
|
14148
14496
|
intendedRootDir: nonRootBaseDir
|
|
@@ -14157,7 +14505,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
14157
14505
|
}
|
|
14158
14506
|
return await Promise.all(
|
|
14159
14507
|
nonRootFilePaths.map((filePath) => {
|
|
14160
|
-
const relativeFilePath = (0,
|
|
14508
|
+
const relativeFilePath = (0, import_node_path109.relative)(nonRootBaseDir, filePath);
|
|
14161
14509
|
checkPathTraversal({
|
|
14162
14510
|
relativePath: relativeFilePath,
|
|
14163
14511
|
intendedRootDir: nonRootBaseDir
|
|
@@ -14270,14 +14618,14 @@ s/<command> [arguments]
|
|
|
14270
14618
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
14271
14619
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
14272
14620
|
|
|
14273
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
14621
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path109.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
14274
14622
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
14275
14623
|
|
|
14276
14624
|
Simulated subagents are specialized AI assistants that can be invoked to handle specific types of tasks. In this case, it can be appear something like custom slash commands simply. Simulated subagents can be called by custom slash commands.
|
|
14277
14625
|
|
|
14278
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
14626
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path109.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
14279
14627
|
|
|
14280
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
14628
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path109.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
14281
14629
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
14282
14630
|
const result = [
|
|
14283
14631
|
overview,
|
|
@@ -14309,51 +14657,51 @@ var import_request_error = require("@octokit/request-error");
|
|
|
14309
14657
|
var import_rest = require("@octokit/rest");
|
|
14310
14658
|
|
|
14311
14659
|
// src/types/fetch.ts
|
|
14312
|
-
var
|
|
14660
|
+
var import_mini51 = require("zod/mini");
|
|
14313
14661
|
|
|
14314
14662
|
// src/types/fetch-targets.ts
|
|
14315
|
-
var
|
|
14663
|
+
var import_mini50 = require("zod/mini");
|
|
14316
14664
|
var ALL_FETCH_TARGETS = ["rulesync", ...ALL_TOOL_TARGETS];
|
|
14317
|
-
var FetchTargetSchema =
|
|
14665
|
+
var FetchTargetSchema = import_mini50.z.enum(ALL_FETCH_TARGETS);
|
|
14318
14666
|
|
|
14319
14667
|
// src/types/fetch.ts
|
|
14320
|
-
var ConflictStrategySchema =
|
|
14321
|
-
var GitHubFileTypeSchema =
|
|
14322
|
-
var GitHubFileEntrySchema =
|
|
14323
|
-
name:
|
|
14324
|
-
path:
|
|
14325
|
-
sha:
|
|
14326
|
-
size:
|
|
14668
|
+
var ConflictStrategySchema = import_mini51.z.enum(["skip", "overwrite"]);
|
|
14669
|
+
var GitHubFileTypeSchema = import_mini51.z.enum(["file", "dir", "symlink", "submodule"]);
|
|
14670
|
+
var GitHubFileEntrySchema = import_mini51.z.looseObject({
|
|
14671
|
+
name: import_mini51.z.string(),
|
|
14672
|
+
path: import_mini51.z.string(),
|
|
14673
|
+
sha: import_mini51.z.string(),
|
|
14674
|
+
size: import_mini51.z.number(),
|
|
14327
14675
|
type: GitHubFileTypeSchema,
|
|
14328
|
-
download_url:
|
|
14676
|
+
download_url: import_mini51.z.nullable(import_mini51.z.string())
|
|
14329
14677
|
});
|
|
14330
|
-
var FetchOptionsSchema =
|
|
14331
|
-
target:
|
|
14332
|
-
features:
|
|
14333
|
-
ref:
|
|
14334
|
-
path:
|
|
14335
|
-
output:
|
|
14336
|
-
conflict:
|
|
14337
|
-
token:
|
|
14338
|
-
verbose:
|
|
14339
|
-
silent:
|
|
14678
|
+
var FetchOptionsSchema = import_mini51.z.looseObject({
|
|
14679
|
+
target: import_mini51.z.optional(FetchTargetSchema),
|
|
14680
|
+
features: import_mini51.z.optional(import_mini51.z.array(import_mini51.z.enum(ALL_FEATURES_WITH_WILDCARD))),
|
|
14681
|
+
ref: import_mini51.z.optional(import_mini51.z.string()),
|
|
14682
|
+
path: import_mini51.z.optional(import_mini51.z.string()),
|
|
14683
|
+
output: import_mini51.z.optional(import_mini51.z.string()),
|
|
14684
|
+
conflict: import_mini51.z.optional(ConflictStrategySchema),
|
|
14685
|
+
token: import_mini51.z.optional(import_mini51.z.string()),
|
|
14686
|
+
verbose: import_mini51.z.optional(import_mini51.z.boolean()),
|
|
14687
|
+
silent: import_mini51.z.optional(import_mini51.z.boolean())
|
|
14340
14688
|
});
|
|
14341
|
-
var FetchFileStatusSchema =
|
|
14342
|
-
var GitHubRepoInfoSchema =
|
|
14343
|
-
default_branch:
|
|
14344
|
-
private:
|
|
14689
|
+
var FetchFileStatusSchema = import_mini51.z.enum(["created", "overwritten", "skipped"]);
|
|
14690
|
+
var GitHubRepoInfoSchema = import_mini51.z.looseObject({
|
|
14691
|
+
default_branch: import_mini51.z.string(),
|
|
14692
|
+
private: import_mini51.z.boolean()
|
|
14345
14693
|
});
|
|
14346
|
-
var GitHubReleaseAssetSchema =
|
|
14347
|
-
name:
|
|
14348
|
-
browser_download_url:
|
|
14349
|
-
size:
|
|
14694
|
+
var GitHubReleaseAssetSchema = import_mini51.z.looseObject({
|
|
14695
|
+
name: import_mini51.z.string(),
|
|
14696
|
+
browser_download_url: import_mini51.z.string(),
|
|
14697
|
+
size: import_mini51.z.number()
|
|
14350
14698
|
});
|
|
14351
|
-
var GitHubReleaseSchema =
|
|
14352
|
-
tag_name:
|
|
14353
|
-
name:
|
|
14354
|
-
prerelease:
|
|
14355
|
-
draft:
|
|
14356
|
-
assets:
|
|
14699
|
+
var GitHubReleaseSchema = import_mini51.z.looseObject({
|
|
14700
|
+
tag_name: import_mini51.z.string(),
|
|
14701
|
+
name: import_mini51.z.nullable(import_mini51.z.string()),
|
|
14702
|
+
prerelease: import_mini51.z.boolean(),
|
|
14703
|
+
draft: import_mini51.z.boolean(),
|
|
14704
|
+
assets: import_mini51.z.array(GitHubReleaseAssetSchema)
|
|
14357
14705
|
});
|
|
14358
14706
|
|
|
14359
14707
|
// src/lib/github-client.ts
|
|
@@ -14653,9 +15001,9 @@ async function listDirectoryRecursive(params) {
|
|
|
14653
15001
|
}
|
|
14654
15002
|
|
|
14655
15003
|
// src/types/git-provider.ts
|
|
14656
|
-
var
|
|
15004
|
+
var import_mini52 = require("zod/mini");
|
|
14657
15005
|
var ALL_GIT_PROVIDERS = ["github", "gitlab"];
|
|
14658
|
-
var GitProviderSchema =
|
|
15006
|
+
var GitProviderSchema = import_mini52.z.enum(ALL_GIT_PROVIDERS);
|
|
14659
15007
|
|
|
14660
15008
|
// src/lib/source-parser.ts
|
|
14661
15009
|
var GITHUB_HOSTS = /* @__PURE__ */ new Set(["github.com", "www.github.com"]);
|
|
@@ -14780,8 +15128,8 @@ async function processFeatureConversion(params) {
|
|
|
14780
15128
|
}
|
|
14781
15129
|
const rulesyncFiles = await processor.convertToolFilesToRulesyncFiles(toolFiles);
|
|
14782
15130
|
for (const file of rulesyncFiles) {
|
|
14783
|
-
const relativePath = (0,
|
|
14784
|
-
const outputPath = (0,
|
|
15131
|
+
const relativePath = (0, import_node_path110.join)(file.getRelativeDirPath(), file.getRelativeFilePath());
|
|
15132
|
+
const outputPath = (0, import_node_path110.join)(outputDir, relativePath);
|
|
14785
15133
|
await writeFileContent(outputPath, file.getFileContent());
|
|
14786
15134
|
paths.push(relativePath);
|
|
14787
15135
|
}
|
|
@@ -14927,7 +15275,7 @@ async function fetchFiles(params) {
|
|
|
14927
15275
|
skipped: 0
|
|
14928
15276
|
};
|
|
14929
15277
|
}
|
|
14930
|
-
const outputBasePath = (0,
|
|
15278
|
+
const outputBasePath = (0, import_node_path110.join)(baseDir, outputDir);
|
|
14931
15279
|
for (const { relativePath, size } of filesToFetch) {
|
|
14932
15280
|
checkPathTraversal({
|
|
14933
15281
|
relativePath,
|
|
@@ -14937,7 +15285,7 @@ async function fetchFiles(params) {
|
|
|
14937
15285
|
}
|
|
14938
15286
|
const results = await Promise.all(
|
|
14939
15287
|
filesToFetch.map(async ({ remotePath, relativePath }) => {
|
|
14940
|
-
const localPath = (0,
|
|
15288
|
+
const localPath = (0, import_node_path110.join)(outputBasePath, relativePath);
|
|
14941
15289
|
const exists = await fileExists(localPath);
|
|
14942
15290
|
if (exists && conflictStrategy === "skip") {
|
|
14943
15291
|
logger.debug(`Skipping existing file: ${relativePath}`);
|
|
@@ -14979,7 +15327,7 @@ async function collectFeatureFiles(params) {
|
|
|
14979
15327
|
);
|
|
14980
15328
|
const results = await Promise.all(
|
|
14981
15329
|
tasks.map(async ({ featurePath }) => {
|
|
14982
|
-
const fullPath = basePath === "." || basePath === "" ? featurePath : (0,
|
|
15330
|
+
const fullPath = basePath === "." || basePath === "" ? featurePath : (0, import_node_path110.join)(basePath, featurePath);
|
|
14983
15331
|
const collected = [];
|
|
14984
15332
|
try {
|
|
14985
15333
|
if (featurePath.includes(".")) {
|
|
@@ -15079,7 +15427,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
15079
15427
|
relativePath: toolRelativePath,
|
|
15080
15428
|
intendedRootDir: tempDir
|
|
15081
15429
|
});
|
|
15082
|
-
const localPath = (0,
|
|
15430
|
+
const localPath = (0, import_node_path110.join)(tempDir, toolRelativePath);
|
|
15083
15431
|
const content = await withSemaphore(
|
|
15084
15432
|
semaphore,
|
|
15085
15433
|
() => client.getFileContent(parsed.owner, parsed.repo, remotePath, ref)
|
|
@@ -15088,7 +15436,7 @@ async function fetchAndConvertToolFiles(params) {
|
|
|
15088
15436
|
logger.debug(`Fetched to temp: ${toolRelativePath}`);
|
|
15089
15437
|
})
|
|
15090
15438
|
);
|
|
15091
|
-
const outputBasePath = (0,
|
|
15439
|
+
const outputBasePath = (0, import_node_path110.join)(baseDir, outputDir);
|
|
15092
15440
|
const { converted, convertedPaths } = await convertFetchedFilesToRulesync({
|
|
15093
15441
|
tempDir,
|
|
15094
15442
|
outputDir: outputBasePath,
|
|
@@ -15161,7 +15509,7 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
15161
15509
|
if (relativePath.startsWith("rules/")) {
|
|
15162
15510
|
const restPath = relativePath.substring("rules/".length);
|
|
15163
15511
|
if (toolPaths.rules?.nonRoot) {
|
|
15164
|
-
return (0,
|
|
15512
|
+
return (0, import_node_path110.join)(toolPaths.rules.nonRoot, restPath);
|
|
15165
15513
|
}
|
|
15166
15514
|
}
|
|
15167
15515
|
if (toolPaths.rules?.root && relativePath === toolPaths.rules.root) {
|
|
@@ -15170,19 +15518,19 @@ function mapToToolPath(relativePath, toolPaths) {
|
|
|
15170
15518
|
if (relativePath.startsWith("commands/")) {
|
|
15171
15519
|
const restPath = relativePath.substring("commands/".length);
|
|
15172
15520
|
if (toolPaths.commands) {
|
|
15173
|
-
return (0,
|
|
15521
|
+
return (0, import_node_path110.join)(toolPaths.commands, restPath);
|
|
15174
15522
|
}
|
|
15175
15523
|
}
|
|
15176
15524
|
if (relativePath.startsWith("subagents/")) {
|
|
15177
15525
|
const restPath = relativePath.substring("subagents/".length);
|
|
15178
15526
|
if (toolPaths.subagents) {
|
|
15179
|
-
return (0,
|
|
15527
|
+
return (0, import_node_path110.join)(toolPaths.subagents, restPath);
|
|
15180
15528
|
}
|
|
15181
15529
|
}
|
|
15182
15530
|
if (relativePath.startsWith("skills/")) {
|
|
15183
15531
|
const restPath = relativePath.substring("skills/".length);
|
|
15184
15532
|
if (toolPaths.skills) {
|
|
15185
|
-
return (0,
|
|
15533
|
+
return (0, import_node_path110.join)(toolPaths.skills, restPath);
|
|
15186
15534
|
}
|
|
15187
15535
|
}
|
|
15188
15536
|
return relativePath;
|
|
@@ -15235,37 +15583,37 @@ async function fetchCommand(options) {
|
|
|
15235
15583
|
|
|
15236
15584
|
// src/config/config-resolver.ts
|
|
15237
15585
|
var import_jsonc_parser = require("jsonc-parser");
|
|
15238
|
-
var
|
|
15586
|
+
var import_node_path111 = require("path");
|
|
15239
15587
|
|
|
15240
15588
|
// src/config/config.ts
|
|
15241
|
-
var
|
|
15242
|
-
var SourceEntrySchema =
|
|
15243
|
-
source:
|
|
15244
|
-
skills: (0,
|
|
15589
|
+
var import_mini53 = require("zod/mini");
|
|
15590
|
+
var SourceEntrySchema = import_mini53.z.object({
|
|
15591
|
+
source: import_mini53.z.string().check((0, import_mini53.minLength)(1, "source must be a non-empty string")),
|
|
15592
|
+
skills: (0, import_mini53.optional)(import_mini53.z.array(import_mini53.z.string()))
|
|
15245
15593
|
});
|
|
15246
|
-
var ConfigParamsSchema =
|
|
15247
|
-
baseDirs:
|
|
15594
|
+
var ConfigParamsSchema = import_mini53.z.object({
|
|
15595
|
+
baseDirs: import_mini53.z.array(import_mini53.z.string()),
|
|
15248
15596
|
targets: RulesyncTargetsSchema,
|
|
15249
15597
|
features: RulesyncFeaturesSchema,
|
|
15250
|
-
verbose:
|
|
15251
|
-
delete:
|
|
15598
|
+
verbose: import_mini53.z.boolean(),
|
|
15599
|
+
delete: import_mini53.z.boolean(),
|
|
15252
15600
|
// New non-experimental options
|
|
15253
|
-
global: (0,
|
|
15254
|
-
silent: (0,
|
|
15255
|
-
simulateCommands: (0,
|
|
15256
|
-
simulateSubagents: (0,
|
|
15257
|
-
simulateSkills: (0,
|
|
15258
|
-
dryRun: (0,
|
|
15259
|
-
check: (0,
|
|
15601
|
+
global: (0, import_mini53.optional)(import_mini53.z.boolean()),
|
|
15602
|
+
silent: (0, import_mini53.optional)(import_mini53.z.boolean()),
|
|
15603
|
+
simulateCommands: (0, import_mini53.optional)(import_mini53.z.boolean()),
|
|
15604
|
+
simulateSubagents: (0, import_mini53.optional)(import_mini53.z.boolean()),
|
|
15605
|
+
simulateSkills: (0, import_mini53.optional)(import_mini53.z.boolean()),
|
|
15606
|
+
dryRun: (0, import_mini53.optional)(import_mini53.z.boolean()),
|
|
15607
|
+
check: (0, import_mini53.optional)(import_mini53.z.boolean()),
|
|
15260
15608
|
// Declarative skill sources
|
|
15261
|
-
sources: (0,
|
|
15609
|
+
sources: (0, import_mini53.optional)(import_mini53.z.array(SourceEntrySchema))
|
|
15262
15610
|
});
|
|
15263
|
-
var PartialConfigParamsSchema =
|
|
15264
|
-
var ConfigFileSchema =
|
|
15265
|
-
$schema: (0,
|
|
15266
|
-
...
|
|
15611
|
+
var PartialConfigParamsSchema = import_mini53.z.partial(ConfigParamsSchema);
|
|
15612
|
+
var ConfigFileSchema = import_mini53.z.object({
|
|
15613
|
+
$schema: (0, import_mini53.optional)(import_mini53.z.string()),
|
|
15614
|
+
...import_mini53.z.partial(ConfigParamsSchema).shape
|
|
15267
15615
|
});
|
|
15268
|
-
var RequiredConfigParamsSchema =
|
|
15616
|
+
var RequiredConfigParamsSchema = import_mini53.z.required(ConfigParamsSchema);
|
|
15269
15617
|
var CONFLICTING_TARGET_PAIRS = [
|
|
15270
15618
|
["augmentcode", "augmentcode-legacy"],
|
|
15271
15619
|
["claudecode", "claudecode-legacy"]
|
|
@@ -15486,8 +15834,8 @@ var ConfigResolver = class {
|
|
|
15486
15834
|
}) {
|
|
15487
15835
|
const validatedConfigPath = resolvePath(configPath, process.cwd());
|
|
15488
15836
|
const baseConfig = await loadConfigFromFile(validatedConfigPath);
|
|
15489
|
-
const configDir = (0,
|
|
15490
|
-
const localConfigPath = (0,
|
|
15837
|
+
const configDir = (0, import_node_path111.dirname)(validatedConfigPath);
|
|
15838
|
+
const localConfigPath = (0, import_node_path111.join)(configDir, RULESYNC_LOCAL_CONFIG_RELATIVE_FILE_PATH);
|
|
15491
15839
|
const localConfig = await loadConfigFromFile(localConfigPath);
|
|
15492
15840
|
const configByFile = mergeConfigs(baseConfig, localConfig);
|
|
15493
15841
|
const resolvedGlobal = global ?? configByFile.global ?? getDefaults().global;
|
|
@@ -15522,7 +15870,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
15522
15870
|
if (global) {
|
|
15523
15871
|
return [getHomeDirectory()];
|
|
15524
15872
|
}
|
|
15525
|
-
const resolvedBaseDirs = baseDirs.map((baseDir) => (0,
|
|
15873
|
+
const resolvedBaseDirs = baseDirs.map((baseDir) => (0, import_node_path111.resolve)(baseDir));
|
|
15526
15874
|
resolvedBaseDirs.forEach((baseDir) => {
|
|
15527
15875
|
validateBaseDir(baseDir);
|
|
15528
15876
|
});
|
|
@@ -15531,7 +15879,7 @@ function getBaseDirsInLightOfGlobal({
|
|
|
15531
15879
|
|
|
15532
15880
|
// src/lib/generate.ts
|
|
15533
15881
|
var import_es_toolkit4 = require("es-toolkit");
|
|
15534
|
-
var
|
|
15882
|
+
var import_node_path112 = require("path");
|
|
15535
15883
|
async function processFeatureGeneration(params) {
|
|
15536
15884
|
const { config, processor, toolFiles } = params;
|
|
15537
15885
|
let totalCount = 0;
|
|
@@ -15576,7 +15924,7 @@ async function processEmptyFeatureGeneration(params) {
|
|
|
15576
15924
|
return { count: totalCount, paths: [], hasDiff };
|
|
15577
15925
|
}
|
|
15578
15926
|
async function checkRulesyncDirExists(params) {
|
|
15579
|
-
return fileExists((0,
|
|
15927
|
+
return fileExists((0, import_node_path112.join)(params.baseDir, RULESYNC_RELATIVE_DIR_PATH));
|
|
15580
15928
|
}
|
|
15581
15929
|
async function generate(params) {
|
|
15582
15930
|
const { config } = params;
|
|
@@ -16022,7 +16370,7 @@ async function generateCommand(options) {
|
|
|
16022
16370
|
}
|
|
16023
16371
|
|
|
16024
16372
|
// src/cli/commands/gitignore.ts
|
|
16025
|
-
var
|
|
16373
|
+
var import_node_path113 = require("path");
|
|
16026
16374
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
16027
16375
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
16028
16376
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
@@ -16056,7 +16404,8 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
16056
16404
|
"**/.codexignore",
|
|
16057
16405
|
"**/.codex/memories/",
|
|
16058
16406
|
"**/.codex/skills/",
|
|
16059
|
-
"**/.codex/
|
|
16407
|
+
"**/.codex/agents/",
|
|
16408
|
+
"**/.codex/config.toml",
|
|
16060
16409
|
// Cursor
|
|
16061
16410
|
"**/.cursor/",
|
|
16062
16411
|
"**/.cursorignore",
|
|
@@ -16074,6 +16423,10 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
16074
16423
|
"**/.gemini/subagents/",
|
|
16075
16424
|
"**/.gemini/skills/",
|
|
16076
16425
|
"**/.geminiignore",
|
|
16426
|
+
// Goose
|
|
16427
|
+
"**/.goosehints",
|
|
16428
|
+
"**/.goose/",
|
|
16429
|
+
"**/.gooseignore",
|
|
16077
16430
|
// GitHub Copilot
|
|
16078
16431
|
"**/.github/copilot-instructions.md",
|
|
16079
16432
|
"**/.github/instructions/",
|
|
@@ -16172,7 +16525,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
16172
16525
|
return result;
|
|
16173
16526
|
};
|
|
16174
16527
|
var gitignoreCommand = async () => {
|
|
16175
|
-
const gitignorePath = (0,
|
|
16528
|
+
const gitignorePath = (0, import_node_path113.join)(process.cwd(), ".gitignore");
|
|
16176
16529
|
let gitignoreContent = "";
|
|
16177
16530
|
if (await fileExists(gitignorePath)) {
|
|
16178
16531
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -16452,7 +16805,7 @@ async function importCommand(options) {
|
|
|
16452
16805
|
}
|
|
16453
16806
|
|
|
16454
16807
|
// src/lib/init.ts
|
|
16455
|
-
var
|
|
16808
|
+
var import_node_path114 = require("path");
|
|
16456
16809
|
async function init() {
|
|
16457
16810
|
const sampleFiles = await createSampleFiles();
|
|
16458
16811
|
const configFile = await createConfigFile();
|
|
@@ -16642,27 +16995,27 @@ Keep the summary concise and ready to reuse in future tasks.`
|
|
|
16642
16995
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
16643
16996
|
await ensureDir(skillPaths.relativeDirPath);
|
|
16644
16997
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
16645
|
-
const ruleFilepath = (0,
|
|
16998
|
+
const ruleFilepath = (0, import_node_path114.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
16646
16999
|
results.push(await writeIfNotExists(ruleFilepath, sampleRuleFile.content));
|
|
16647
|
-
const mcpFilepath = (0,
|
|
17000
|
+
const mcpFilepath = (0, import_node_path114.join)(
|
|
16648
17001
|
mcpPaths.recommended.relativeDirPath,
|
|
16649
17002
|
mcpPaths.recommended.relativeFilePath
|
|
16650
17003
|
);
|
|
16651
17004
|
results.push(await writeIfNotExists(mcpFilepath, sampleMcpFile.content));
|
|
16652
|
-
const commandFilepath = (0,
|
|
17005
|
+
const commandFilepath = (0, import_node_path114.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
16653
17006
|
results.push(await writeIfNotExists(commandFilepath, sampleCommandFile.content));
|
|
16654
|
-
const subagentFilepath = (0,
|
|
17007
|
+
const subagentFilepath = (0, import_node_path114.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
16655
17008
|
results.push(await writeIfNotExists(subagentFilepath, sampleSubagentFile.content));
|
|
16656
|
-
const skillDirPath = (0,
|
|
17009
|
+
const skillDirPath = (0, import_node_path114.join)(skillPaths.relativeDirPath, sampleSkillFile.dirName);
|
|
16657
17010
|
await ensureDir(skillDirPath);
|
|
16658
|
-
const skillFilepath = (0,
|
|
17011
|
+
const skillFilepath = (0, import_node_path114.join)(skillDirPath, SKILL_FILE_NAME);
|
|
16659
17012
|
results.push(await writeIfNotExists(skillFilepath, sampleSkillFile.content));
|
|
16660
|
-
const ignoreFilepath = (0,
|
|
17013
|
+
const ignoreFilepath = (0, import_node_path114.join)(
|
|
16661
17014
|
ignorePaths.recommended.relativeDirPath,
|
|
16662
17015
|
ignorePaths.recommended.relativeFilePath
|
|
16663
17016
|
);
|
|
16664
17017
|
results.push(await writeIfNotExists(ignoreFilepath, sampleIgnoreFile.content));
|
|
16665
|
-
const hooksFilepath = (0,
|
|
17018
|
+
const hooksFilepath = (0, import_node_path114.join)(hooksPaths.relativeDirPath, hooksPaths.relativeFilePath);
|
|
16666
17019
|
results.push(await writeIfNotExists(hooksFilepath, sampleHooksFile.content));
|
|
16667
17020
|
return results;
|
|
16668
17021
|
}
|
|
@@ -16701,32 +17054,32 @@ async function initCommand() {
|
|
|
16701
17054
|
|
|
16702
17055
|
// src/lib/sources.ts
|
|
16703
17056
|
var import_promise2 = require("es-toolkit/promise");
|
|
16704
|
-
var
|
|
17057
|
+
var import_node_path116 = require("path");
|
|
16705
17058
|
|
|
16706
17059
|
// src/lib/sources-lock.ts
|
|
16707
17060
|
var import_node_crypto = require("crypto");
|
|
16708
|
-
var
|
|
16709
|
-
var
|
|
17061
|
+
var import_node_path115 = require("path");
|
|
17062
|
+
var import_mini54 = require("zod/mini");
|
|
16710
17063
|
var LOCKFILE_VERSION = 1;
|
|
16711
|
-
var LockedSkillSchema =
|
|
16712
|
-
integrity:
|
|
17064
|
+
var LockedSkillSchema = import_mini54.z.object({
|
|
17065
|
+
integrity: import_mini54.z.string()
|
|
16713
17066
|
});
|
|
16714
|
-
var LockedSourceSchema =
|
|
16715
|
-
requestedRef: (0,
|
|
16716
|
-
resolvedRef:
|
|
16717
|
-
resolvedAt: (0,
|
|
16718
|
-
skills:
|
|
17067
|
+
var LockedSourceSchema = import_mini54.z.object({
|
|
17068
|
+
requestedRef: (0, import_mini54.optional)(import_mini54.z.string()),
|
|
17069
|
+
resolvedRef: import_mini54.z.string(),
|
|
17070
|
+
resolvedAt: (0, import_mini54.optional)(import_mini54.z.string()),
|
|
17071
|
+
skills: import_mini54.z.record(import_mini54.z.string(), LockedSkillSchema)
|
|
16719
17072
|
});
|
|
16720
|
-
var SourcesLockSchema =
|
|
16721
|
-
lockfileVersion:
|
|
16722
|
-
sources:
|
|
17073
|
+
var SourcesLockSchema = import_mini54.z.object({
|
|
17074
|
+
lockfileVersion: import_mini54.z.number(),
|
|
17075
|
+
sources: import_mini54.z.record(import_mini54.z.string(), LockedSourceSchema)
|
|
16723
17076
|
});
|
|
16724
|
-
var LegacyLockedSourceSchema =
|
|
16725
|
-
resolvedRef:
|
|
16726
|
-
skills:
|
|
17077
|
+
var LegacyLockedSourceSchema = import_mini54.z.object({
|
|
17078
|
+
resolvedRef: import_mini54.z.string(),
|
|
17079
|
+
skills: import_mini54.z.array(import_mini54.z.string())
|
|
16727
17080
|
});
|
|
16728
|
-
var LegacySourcesLockSchema =
|
|
16729
|
-
sources:
|
|
17081
|
+
var LegacySourcesLockSchema = import_mini54.z.object({
|
|
17082
|
+
sources: import_mini54.z.record(import_mini54.z.string(), LegacyLockedSourceSchema)
|
|
16730
17083
|
});
|
|
16731
17084
|
function migrateLegacyLock(legacy) {
|
|
16732
17085
|
const sources = {};
|
|
@@ -16749,7 +17102,7 @@ function createEmptyLock() {
|
|
|
16749
17102
|
return { lockfileVersion: LOCKFILE_VERSION, sources: {} };
|
|
16750
17103
|
}
|
|
16751
17104
|
async function readLockFile(params) {
|
|
16752
|
-
const lockPath = (0,
|
|
17105
|
+
const lockPath = (0, import_node_path115.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
16753
17106
|
if (!await fileExists(lockPath)) {
|
|
16754
17107
|
logger.debug("No sources lockfile found, starting fresh.");
|
|
16755
17108
|
return createEmptyLock();
|
|
@@ -16777,7 +17130,7 @@ async function readLockFile(params) {
|
|
|
16777
17130
|
}
|
|
16778
17131
|
}
|
|
16779
17132
|
async function writeLockFile(params) {
|
|
16780
|
-
const lockPath = (0,
|
|
17133
|
+
const lockPath = (0, import_node_path115.join)(params.baseDir, RULESYNC_SOURCES_LOCK_RELATIVE_FILE_PATH);
|
|
16781
17134
|
const content = JSON.stringify(params.lock, null, 2) + "\n";
|
|
16782
17135
|
await writeFileContent(lockPath, content);
|
|
16783
17136
|
logger.debug(`Wrote sources lockfile to ${lockPath}`);
|
|
@@ -16918,7 +17271,7 @@ async function resolveAndFetchSources(params) {
|
|
|
16918
17271
|
async function checkLockedSkillsExist(curatedDir, skillNames) {
|
|
16919
17272
|
if (skillNames.length === 0) return true;
|
|
16920
17273
|
for (const name of skillNames) {
|
|
16921
|
-
if (!await directoryExists((0,
|
|
17274
|
+
if (!await directoryExists((0, import_node_path116.join)(curatedDir, name))) {
|
|
16922
17275
|
return false;
|
|
16923
17276
|
}
|
|
16924
17277
|
}
|
|
@@ -16948,7 +17301,7 @@ async function fetchSource(params) {
|
|
|
16948
17301
|
ref = resolvedSha;
|
|
16949
17302
|
logger.debug(`Resolved ${sourceKey} ref "${requestedRef}" to SHA: ${resolvedSha}`);
|
|
16950
17303
|
}
|
|
16951
|
-
const curatedDir = (0,
|
|
17304
|
+
const curatedDir = (0, import_node_path116.join)(baseDir, RULESYNC_CURATED_SKILLS_RELATIVE_DIR_PATH);
|
|
16952
17305
|
if (locked && resolvedSha === locked.resolvedRef && !updateSources) {
|
|
16953
17306
|
const allExist = await checkLockedSkillsExist(curatedDir, lockedSkillNames);
|
|
16954
17307
|
if (allExist) {
|
|
@@ -16978,10 +17331,10 @@ async function fetchSource(params) {
|
|
|
16978
17331
|
const semaphore = new import_promise2.Semaphore(FETCH_CONCURRENCY_LIMIT);
|
|
16979
17332
|
const fetchedSkills = {};
|
|
16980
17333
|
if (locked) {
|
|
16981
|
-
const resolvedCuratedDir = (0,
|
|
17334
|
+
const resolvedCuratedDir = (0, import_node_path116.resolve)(curatedDir);
|
|
16982
17335
|
for (const prevSkill of lockedSkillNames) {
|
|
16983
|
-
const prevDir = (0,
|
|
16984
|
-
if (!(0,
|
|
17336
|
+
const prevDir = (0, import_node_path116.join)(curatedDir, prevSkill);
|
|
17337
|
+
if (!(0, import_node_path116.resolve)(prevDir).startsWith(resolvedCuratedDir + import_node_path116.sep)) {
|
|
16985
17338
|
logger.warn(
|
|
16986
17339
|
`Skipping removal of "${prevSkill}": resolved path is outside the curated directory.`
|
|
16987
17340
|
);
|
|
@@ -17031,10 +17384,10 @@ async function fetchSource(params) {
|
|
|
17031
17384
|
const skillFiles = [];
|
|
17032
17385
|
for (const file of files) {
|
|
17033
17386
|
const relativeToSkill = file.path.substring(skillDir.path.length + 1);
|
|
17034
|
-
const localFilePath = (0,
|
|
17387
|
+
const localFilePath = (0, import_node_path116.join)(curatedDir, skillDir.name, relativeToSkill);
|
|
17035
17388
|
checkPathTraversal({
|
|
17036
17389
|
relativePath: relativeToSkill,
|
|
17037
|
-
intendedRootDir: (0,
|
|
17390
|
+
intendedRootDir: (0, import_node_path116.join)(curatedDir, skillDir.name)
|
|
17038
17391
|
});
|
|
17039
17392
|
const content = await withSemaphore(
|
|
17040
17393
|
semaphore,
|
|
@@ -17117,15 +17470,15 @@ async function installCommand(options) {
|
|
|
17117
17470
|
var import_fastmcp = require("fastmcp");
|
|
17118
17471
|
|
|
17119
17472
|
// src/mcp/tools.ts
|
|
17120
|
-
var
|
|
17473
|
+
var import_mini63 = require("zod/mini");
|
|
17121
17474
|
|
|
17122
17475
|
// src/mcp/commands.ts
|
|
17123
|
-
var
|
|
17124
|
-
var
|
|
17476
|
+
var import_node_path117 = require("path");
|
|
17477
|
+
var import_mini55 = require("zod/mini");
|
|
17125
17478
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
17126
17479
|
var maxCommandsCount = 1e3;
|
|
17127
17480
|
async function listCommands() {
|
|
17128
|
-
const commandsDir = (0,
|
|
17481
|
+
const commandsDir = (0, import_node_path117.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
17129
17482
|
try {
|
|
17130
17483
|
const files = await listDirectoryFiles(commandsDir);
|
|
17131
17484
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -17137,7 +17490,7 @@ async function listCommands() {
|
|
|
17137
17490
|
});
|
|
17138
17491
|
const frontmatter = command.getFrontmatter();
|
|
17139
17492
|
return {
|
|
17140
|
-
relativePathFromCwd: (0,
|
|
17493
|
+
relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
17141
17494
|
frontmatter
|
|
17142
17495
|
};
|
|
17143
17496
|
} catch (error) {
|
|
@@ -17159,13 +17512,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
17159
17512
|
relativePath: relativePathFromCwd,
|
|
17160
17513
|
intendedRootDir: process.cwd()
|
|
17161
17514
|
});
|
|
17162
|
-
const filename = (0,
|
|
17515
|
+
const filename = (0, import_node_path117.basename)(relativePathFromCwd);
|
|
17163
17516
|
try {
|
|
17164
17517
|
const command = await RulesyncCommand.fromFile({
|
|
17165
17518
|
relativeFilePath: filename
|
|
17166
17519
|
});
|
|
17167
17520
|
return {
|
|
17168
|
-
relativePathFromCwd: (0,
|
|
17521
|
+
relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
17169
17522
|
frontmatter: command.getFrontmatter(),
|
|
17170
17523
|
body: command.getBody()
|
|
17171
17524
|
};
|
|
@@ -17184,7 +17537,7 @@ async function putCommand({
|
|
|
17184
17537
|
relativePath: relativePathFromCwd,
|
|
17185
17538
|
intendedRootDir: process.cwd()
|
|
17186
17539
|
});
|
|
17187
|
-
const filename = (0,
|
|
17540
|
+
const filename = (0, import_node_path117.basename)(relativePathFromCwd);
|
|
17188
17541
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
17189
17542
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
17190
17543
|
throw new Error(
|
|
@@ -17194,7 +17547,7 @@ async function putCommand({
|
|
|
17194
17547
|
try {
|
|
17195
17548
|
const existingCommands = await listCommands();
|
|
17196
17549
|
const isUpdate = existingCommands.some(
|
|
17197
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
17550
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
17198
17551
|
);
|
|
17199
17552
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
17200
17553
|
throw new Error(
|
|
@@ -17211,11 +17564,11 @@ async function putCommand({
|
|
|
17211
17564
|
fileContent,
|
|
17212
17565
|
validate: true
|
|
17213
17566
|
});
|
|
17214
|
-
const commandsDir = (0,
|
|
17567
|
+
const commandsDir = (0, import_node_path117.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
17215
17568
|
await ensureDir(commandsDir);
|
|
17216
17569
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
17217
17570
|
return {
|
|
17218
|
-
relativePathFromCwd: (0,
|
|
17571
|
+
relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
17219
17572
|
frontmatter: command.getFrontmatter(),
|
|
17220
17573
|
body: command.getBody()
|
|
17221
17574
|
};
|
|
@@ -17230,12 +17583,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
17230
17583
|
relativePath: relativePathFromCwd,
|
|
17231
17584
|
intendedRootDir: process.cwd()
|
|
17232
17585
|
});
|
|
17233
|
-
const filename = (0,
|
|
17234
|
-
const fullPath = (0,
|
|
17586
|
+
const filename = (0, import_node_path117.basename)(relativePathFromCwd);
|
|
17587
|
+
const fullPath = (0, import_node_path117.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
17235
17588
|
try {
|
|
17236
17589
|
await removeFile(fullPath);
|
|
17237
17590
|
return {
|
|
17238
|
-
relativePathFromCwd: (0,
|
|
17591
|
+
relativePathFromCwd: (0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
17239
17592
|
};
|
|
17240
17593
|
} catch (error) {
|
|
17241
17594
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -17244,23 +17597,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
17244
17597
|
}
|
|
17245
17598
|
}
|
|
17246
17599
|
var commandToolSchemas = {
|
|
17247
|
-
listCommands:
|
|
17248
|
-
getCommand:
|
|
17249
|
-
relativePathFromCwd:
|
|
17600
|
+
listCommands: import_mini55.z.object({}),
|
|
17601
|
+
getCommand: import_mini55.z.object({
|
|
17602
|
+
relativePathFromCwd: import_mini55.z.string()
|
|
17250
17603
|
}),
|
|
17251
|
-
putCommand:
|
|
17252
|
-
relativePathFromCwd:
|
|
17604
|
+
putCommand: import_mini55.z.object({
|
|
17605
|
+
relativePathFromCwd: import_mini55.z.string(),
|
|
17253
17606
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
17254
|
-
body:
|
|
17607
|
+
body: import_mini55.z.string()
|
|
17255
17608
|
}),
|
|
17256
|
-
deleteCommand:
|
|
17257
|
-
relativePathFromCwd:
|
|
17609
|
+
deleteCommand: import_mini55.z.object({
|
|
17610
|
+
relativePathFromCwd: import_mini55.z.string()
|
|
17258
17611
|
})
|
|
17259
17612
|
};
|
|
17260
17613
|
var commandTools = {
|
|
17261
17614
|
listCommands: {
|
|
17262
17615
|
name: "listCommands",
|
|
17263
|
-
description: `List all commands from ${(0,
|
|
17616
|
+
description: `List all commands from ${(0, import_node_path117.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
17264
17617
|
parameters: commandToolSchemas.listCommands,
|
|
17265
17618
|
execute: async () => {
|
|
17266
17619
|
const commands = await listCommands();
|
|
@@ -17302,15 +17655,15 @@ var commandTools = {
|
|
|
17302
17655
|
};
|
|
17303
17656
|
|
|
17304
17657
|
// src/mcp/generate.ts
|
|
17305
|
-
var
|
|
17306
|
-
var generateOptionsSchema =
|
|
17307
|
-
targets:
|
|
17308
|
-
features:
|
|
17309
|
-
delete:
|
|
17310
|
-
global:
|
|
17311
|
-
simulateCommands:
|
|
17312
|
-
simulateSubagents:
|
|
17313
|
-
simulateSkills:
|
|
17658
|
+
var import_mini56 = require("zod/mini");
|
|
17659
|
+
var generateOptionsSchema = import_mini56.z.object({
|
|
17660
|
+
targets: import_mini56.z.optional(import_mini56.z.array(import_mini56.z.string())),
|
|
17661
|
+
features: import_mini56.z.optional(import_mini56.z.array(import_mini56.z.string())),
|
|
17662
|
+
delete: import_mini56.z.optional(import_mini56.z.boolean()),
|
|
17663
|
+
global: import_mini56.z.optional(import_mini56.z.boolean()),
|
|
17664
|
+
simulateCommands: import_mini56.z.optional(import_mini56.z.boolean()),
|
|
17665
|
+
simulateSubagents: import_mini56.z.optional(import_mini56.z.boolean()),
|
|
17666
|
+
simulateSkills: import_mini56.z.optional(import_mini56.z.boolean())
|
|
17314
17667
|
});
|
|
17315
17668
|
async function executeGenerate(options = {}) {
|
|
17316
17669
|
try {
|
|
@@ -17387,11 +17740,11 @@ var generateTools = {
|
|
|
17387
17740
|
};
|
|
17388
17741
|
|
|
17389
17742
|
// src/mcp/ignore.ts
|
|
17390
|
-
var
|
|
17391
|
-
var
|
|
17743
|
+
var import_node_path118 = require("path");
|
|
17744
|
+
var import_mini57 = require("zod/mini");
|
|
17392
17745
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
17393
17746
|
async function getIgnoreFile() {
|
|
17394
|
-
const ignoreFilePath = (0,
|
|
17747
|
+
const ignoreFilePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
17395
17748
|
try {
|
|
17396
17749
|
const content = await readFileContent(ignoreFilePath);
|
|
17397
17750
|
return {
|
|
@@ -17408,7 +17761,7 @@ async function getIgnoreFile() {
|
|
|
17408
17761
|
}
|
|
17409
17762
|
}
|
|
17410
17763
|
async function putIgnoreFile({ content }) {
|
|
17411
|
-
const ignoreFilePath = (0,
|
|
17764
|
+
const ignoreFilePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
17412
17765
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
17413
17766
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
17414
17767
|
throw new Error(
|
|
@@ -17432,8 +17785,8 @@ async function putIgnoreFile({ content }) {
|
|
|
17432
17785
|
}
|
|
17433
17786
|
}
|
|
17434
17787
|
async function deleteIgnoreFile() {
|
|
17435
|
-
const aiignorePath = (0,
|
|
17436
|
-
const legacyIgnorePath = (0,
|
|
17788
|
+
const aiignorePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
17789
|
+
const legacyIgnorePath = (0, import_node_path118.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
17437
17790
|
try {
|
|
17438
17791
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
17439
17792
|
return {
|
|
@@ -17451,11 +17804,11 @@ async function deleteIgnoreFile() {
|
|
|
17451
17804
|
}
|
|
17452
17805
|
}
|
|
17453
17806
|
var ignoreToolSchemas = {
|
|
17454
|
-
getIgnoreFile:
|
|
17455
|
-
putIgnoreFile:
|
|
17456
|
-
content:
|
|
17807
|
+
getIgnoreFile: import_mini57.z.object({}),
|
|
17808
|
+
putIgnoreFile: import_mini57.z.object({
|
|
17809
|
+
content: import_mini57.z.string()
|
|
17457
17810
|
}),
|
|
17458
|
-
deleteIgnoreFile:
|
|
17811
|
+
deleteIgnoreFile: import_mini57.z.object({})
|
|
17459
17812
|
};
|
|
17460
17813
|
var ignoreTools = {
|
|
17461
17814
|
getIgnoreFile: {
|
|
@@ -17488,11 +17841,11 @@ var ignoreTools = {
|
|
|
17488
17841
|
};
|
|
17489
17842
|
|
|
17490
17843
|
// src/mcp/import.ts
|
|
17491
|
-
var
|
|
17492
|
-
var importOptionsSchema =
|
|
17493
|
-
target:
|
|
17494
|
-
features:
|
|
17495
|
-
global:
|
|
17844
|
+
var import_mini58 = require("zod/mini");
|
|
17845
|
+
var importOptionsSchema = import_mini58.z.object({
|
|
17846
|
+
target: import_mini58.z.string(),
|
|
17847
|
+
features: import_mini58.z.optional(import_mini58.z.array(import_mini58.z.string())),
|
|
17848
|
+
global: import_mini58.z.optional(import_mini58.z.boolean())
|
|
17496
17849
|
});
|
|
17497
17850
|
async function executeImport(options) {
|
|
17498
17851
|
try {
|
|
@@ -17561,15 +17914,15 @@ var importTools = {
|
|
|
17561
17914
|
};
|
|
17562
17915
|
|
|
17563
17916
|
// src/mcp/mcp.ts
|
|
17564
|
-
var
|
|
17565
|
-
var
|
|
17917
|
+
var import_node_path119 = require("path");
|
|
17918
|
+
var import_mini59 = require("zod/mini");
|
|
17566
17919
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
17567
17920
|
async function getMcpFile() {
|
|
17568
17921
|
try {
|
|
17569
17922
|
const rulesyncMcp = await RulesyncMcp.fromFile({
|
|
17570
17923
|
validate: true
|
|
17571
17924
|
});
|
|
17572
|
-
const relativePathFromCwd = (0,
|
|
17925
|
+
const relativePathFromCwd = (0, import_node_path119.join)(
|
|
17573
17926
|
rulesyncMcp.getRelativeDirPath(),
|
|
17574
17927
|
rulesyncMcp.getRelativeFilePath()
|
|
17575
17928
|
);
|
|
@@ -17607,7 +17960,7 @@ async function putMcpFile({ content }) {
|
|
|
17607
17960
|
const paths = RulesyncMcp.getSettablePaths();
|
|
17608
17961
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
17609
17962
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
17610
|
-
const fullPath = (0,
|
|
17963
|
+
const fullPath = (0, import_node_path119.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
17611
17964
|
const rulesyncMcp = new RulesyncMcp({
|
|
17612
17965
|
baseDir,
|
|
17613
17966
|
relativeDirPath,
|
|
@@ -17615,9 +17968,9 @@ async function putMcpFile({ content }) {
|
|
|
17615
17968
|
fileContent: content,
|
|
17616
17969
|
validate: true
|
|
17617
17970
|
});
|
|
17618
|
-
await ensureDir((0,
|
|
17971
|
+
await ensureDir((0, import_node_path119.join)(baseDir, relativeDirPath));
|
|
17619
17972
|
await writeFileContent(fullPath, content);
|
|
17620
|
-
const relativePathFromCwd = (0,
|
|
17973
|
+
const relativePathFromCwd = (0, import_node_path119.join)(relativeDirPath, relativeFilePath);
|
|
17621
17974
|
return {
|
|
17622
17975
|
relativePathFromCwd,
|
|
17623
17976
|
content: rulesyncMcp.getFileContent()
|
|
@@ -17635,15 +17988,15 @@ async function deleteMcpFile() {
|
|
|
17635
17988
|
try {
|
|
17636
17989
|
const baseDir = process.cwd();
|
|
17637
17990
|
const paths = RulesyncMcp.getSettablePaths();
|
|
17638
|
-
const recommendedPath = (0,
|
|
17991
|
+
const recommendedPath = (0, import_node_path119.join)(
|
|
17639
17992
|
baseDir,
|
|
17640
17993
|
paths.recommended.relativeDirPath,
|
|
17641
17994
|
paths.recommended.relativeFilePath
|
|
17642
17995
|
);
|
|
17643
|
-
const legacyPath = (0,
|
|
17996
|
+
const legacyPath = (0, import_node_path119.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
17644
17997
|
await removeFile(recommendedPath);
|
|
17645
17998
|
await removeFile(legacyPath);
|
|
17646
|
-
const relativePathFromCwd = (0,
|
|
17999
|
+
const relativePathFromCwd = (0, import_node_path119.join)(
|
|
17647
18000
|
paths.recommended.relativeDirPath,
|
|
17648
18001
|
paths.recommended.relativeFilePath
|
|
17649
18002
|
);
|
|
@@ -17660,11 +18013,11 @@ async function deleteMcpFile() {
|
|
|
17660
18013
|
}
|
|
17661
18014
|
}
|
|
17662
18015
|
var mcpToolSchemas = {
|
|
17663
|
-
getMcpFile:
|
|
17664
|
-
putMcpFile:
|
|
17665
|
-
content:
|
|
18016
|
+
getMcpFile: import_mini59.z.object({}),
|
|
18017
|
+
putMcpFile: import_mini59.z.object({
|
|
18018
|
+
content: import_mini59.z.string()
|
|
17666
18019
|
}),
|
|
17667
|
-
deleteMcpFile:
|
|
18020
|
+
deleteMcpFile: import_mini59.z.object({})
|
|
17668
18021
|
};
|
|
17669
18022
|
var mcpTools = {
|
|
17670
18023
|
getMcpFile: {
|
|
@@ -17697,12 +18050,12 @@ var mcpTools = {
|
|
|
17697
18050
|
};
|
|
17698
18051
|
|
|
17699
18052
|
// src/mcp/rules.ts
|
|
17700
|
-
var
|
|
17701
|
-
var
|
|
18053
|
+
var import_node_path120 = require("path");
|
|
18054
|
+
var import_mini60 = require("zod/mini");
|
|
17702
18055
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
17703
18056
|
var maxRulesCount = 1e3;
|
|
17704
18057
|
async function listRules() {
|
|
17705
|
-
const rulesDir = (0,
|
|
18058
|
+
const rulesDir = (0, import_node_path120.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
17706
18059
|
try {
|
|
17707
18060
|
const files = await listDirectoryFiles(rulesDir);
|
|
17708
18061
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -17715,7 +18068,7 @@ async function listRules() {
|
|
|
17715
18068
|
});
|
|
17716
18069
|
const frontmatter = rule.getFrontmatter();
|
|
17717
18070
|
return {
|
|
17718
|
-
relativePathFromCwd: (0,
|
|
18071
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
17719
18072
|
frontmatter
|
|
17720
18073
|
};
|
|
17721
18074
|
} catch (error) {
|
|
@@ -17737,14 +18090,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
17737
18090
|
relativePath: relativePathFromCwd,
|
|
17738
18091
|
intendedRootDir: process.cwd()
|
|
17739
18092
|
});
|
|
17740
|
-
const filename = (0,
|
|
18093
|
+
const filename = (0, import_node_path120.basename)(relativePathFromCwd);
|
|
17741
18094
|
try {
|
|
17742
18095
|
const rule = await RulesyncRule.fromFile({
|
|
17743
18096
|
relativeFilePath: filename,
|
|
17744
18097
|
validate: true
|
|
17745
18098
|
});
|
|
17746
18099
|
return {
|
|
17747
|
-
relativePathFromCwd: (0,
|
|
18100
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
17748
18101
|
frontmatter: rule.getFrontmatter(),
|
|
17749
18102
|
body: rule.getBody()
|
|
17750
18103
|
};
|
|
@@ -17763,7 +18116,7 @@ async function putRule({
|
|
|
17763
18116
|
relativePath: relativePathFromCwd,
|
|
17764
18117
|
intendedRootDir: process.cwd()
|
|
17765
18118
|
});
|
|
17766
|
-
const filename = (0,
|
|
18119
|
+
const filename = (0, import_node_path120.basename)(relativePathFromCwd);
|
|
17767
18120
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
17768
18121
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
17769
18122
|
throw new Error(
|
|
@@ -17773,7 +18126,7 @@ async function putRule({
|
|
|
17773
18126
|
try {
|
|
17774
18127
|
const existingRules = await listRules();
|
|
17775
18128
|
const isUpdate = existingRules.some(
|
|
17776
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
18129
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
17777
18130
|
);
|
|
17778
18131
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
17779
18132
|
throw new Error(
|
|
@@ -17788,11 +18141,11 @@ async function putRule({
|
|
|
17788
18141
|
body,
|
|
17789
18142
|
validate: true
|
|
17790
18143
|
});
|
|
17791
|
-
const rulesDir = (0,
|
|
18144
|
+
const rulesDir = (0, import_node_path120.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
17792
18145
|
await ensureDir(rulesDir);
|
|
17793
18146
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
17794
18147
|
return {
|
|
17795
|
-
relativePathFromCwd: (0,
|
|
18148
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
17796
18149
|
frontmatter: rule.getFrontmatter(),
|
|
17797
18150
|
body: rule.getBody()
|
|
17798
18151
|
};
|
|
@@ -17807,12 +18160,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
17807
18160
|
relativePath: relativePathFromCwd,
|
|
17808
18161
|
intendedRootDir: process.cwd()
|
|
17809
18162
|
});
|
|
17810
|
-
const filename = (0,
|
|
17811
|
-
const fullPath = (0,
|
|
18163
|
+
const filename = (0, import_node_path120.basename)(relativePathFromCwd);
|
|
18164
|
+
const fullPath = (0, import_node_path120.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
17812
18165
|
try {
|
|
17813
18166
|
await removeFile(fullPath);
|
|
17814
18167
|
return {
|
|
17815
|
-
relativePathFromCwd: (0,
|
|
18168
|
+
relativePathFromCwd: (0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
17816
18169
|
};
|
|
17817
18170
|
} catch (error) {
|
|
17818
18171
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -17821,23 +18174,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
17821
18174
|
}
|
|
17822
18175
|
}
|
|
17823
18176
|
var ruleToolSchemas = {
|
|
17824
|
-
listRules:
|
|
17825
|
-
getRule:
|
|
17826
|
-
relativePathFromCwd:
|
|
18177
|
+
listRules: import_mini60.z.object({}),
|
|
18178
|
+
getRule: import_mini60.z.object({
|
|
18179
|
+
relativePathFromCwd: import_mini60.z.string()
|
|
17827
18180
|
}),
|
|
17828
|
-
putRule:
|
|
17829
|
-
relativePathFromCwd:
|
|
18181
|
+
putRule: import_mini60.z.object({
|
|
18182
|
+
relativePathFromCwd: import_mini60.z.string(),
|
|
17830
18183
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
17831
|
-
body:
|
|
18184
|
+
body: import_mini60.z.string()
|
|
17832
18185
|
}),
|
|
17833
|
-
deleteRule:
|
|
17834
|
-
relativePathFromCwd:
|
|
18186
|
+
deleteRule: import_mini60.z.object({
|
|
18187
|
+
relativePathFromCwd: import_mini60.z.string()
|
|
17835
18188
|
})
|
|
17836
18189
|
};
|
|
17837
18190
|
var ruleTools = {
|
|
17838
18191
|
listRules: {
|
|
17839
18192
|
name: "listRules",
|
|
17840
|
-
description: `List all rules from ${(0,
|
|
18193
|
+
description: `List all rules from ${(0, import_node_path120.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
17841
18194
|
parameters: ruleToolSchemas.listRules,
|
|
17842
18195
|
execute: async () => {
|
|
17843
18196
|
const rules = await listRules();
|
|
@@ -17879,8 +18232,8 @@ var ruleTools = {
|
|
|
17879
18232
|
};
|
|
17880
18233
|
|
|
17881
18234
|
// src/mcp/skills.ts
|
|
17882
|
-
var
|
|
17883
|
-
var
|
|
18235
|
+
var import_node_path121 = require("path");
|
|
18236
|
+
var import_mini61 = require("zod/mini");
|
|
17884
18237
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
17885
18238
|
var maxSkillsCount = 1e3;
|
|
17886
18239
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -17896,19 +18249,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
17896
18249
|
};
|
|
17897
18250
|
}
|
|
17898
18251
|
function extractDirName(relativeDirPathFromCwd) {
|
|
17899
|
-
const dirName = (0,
|
|
18252
|
+
const dirName = (0, import_node_path121.basename)(relativeDirPathFromCwd);
|
|
17900
18253
|
if (!dirName) {
|
|
17901
18254
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
17902
18255
|
}
|
|
17903
18256
|
return dirName;
|
|
17904
18257
|
}
|
|
17905
18258
|
async function listSkills() {
|
|
17906
|
-
const skillsDir = (0,
|
|
18259
|
+
const skillsDir = (0, import_node_path121.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
17907
18260
|
try {
|
|
17908
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
18261
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path121.join)(skillsDir, "*"), { type: "dir" });
|
|
17909
18262
|
const skills = await Promise.all(
|
|
17910
18263
|
skillDirPaths.map(async (dirPath) => {
|
|
17911
|
-
const dirName = (0,
|
|
18264
|
+
const dirName = (0, import_node_path121.basename)(dirPath);
|
|
17912
18265
|
if (!dirName) return null;
|
|
17913
18266
|
try {
|
|
17914
18267
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -17916,7 +18269,7 @@ async function listSkills() {
|
|
|
17916
18269
|
});
|
|
17917
18270
|
const frontmatter = skill.getFrontmatter();
|
|
17918
18271
|
return {
|
|
17919
|
-
relativeDirPathFromCwd: (0,
|
|
18272
|
+
relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
17920
18273
|
frontmatter
|
|
17921
18274
|
};
|
|
17922
18275
|
} catch (error) {
|
|
@@ -17944,7 +18297,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
17944
18297
|
dirName
|
|
17945
18298
|
});
|
|
17946
18299
|
return {
|
|
17947
|
-
relativeDirPathFromCwd: (0,
|
|
18300
|
+
relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
17948
18301
|
frontmatter: skill.getFrontmatter(),
|
|
17949
18302
|
body: skill.getBody(),
|
|
17950
18303
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -17978,7 +18331,7 @@ async function putSkill({
|
|
|
17978
18331
|
try {
|
|
17979
18332
|
const existingSkills = await listSkills();
|
|
17980
18333
|
const isUpdate = existingSkills.some(
|
|
17981
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
18334
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
17982
18335
|
);
|
|
17983
18336
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
17984
18337
|
throw new Error(
|
|
@@ -17995,9 +18348,9 @@ async function putSkill({
|
|
|
17995
18348
|
otherFiles: aiDirFiles,
|
|
17996
18349
|
validate: true
|
|
17997
18350
|
});
|
|
17998
|
-
const skillDirPath = (0,
|
|
18351
|
+
const skillDirPath = (0, import_node_path121.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
17999
18352
|
await ensureDir(skillDirPath);
|
|
18000
|
-
const skillFilePath = (0,
|
|
18353
|
+
const skillFilePath = (0, import_node_path121.join)(skillDirPath, SKILL_FILE_NAME);
|
|
18001
18354
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
18002
18355
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
18003
18356
|
for (const file of otherFiles) {
|
|
@@ -18005,15 +18358,15 @@ async function putSkill({
|
|
|
18005
18358
|
relativePath: file.name,
|
|
18006
18359
|
intendedRootDir: skillDirPath
|
|
18007
18360
|
});
|
|
18008
|
-
const filePath = (0,
|
|
18009
|
-
const fileDir = (0,
|
|
18361
|
+
const filePath = (0, import_node_path121.join)(skillDirPath, file.name);
|
|
18362
|
+
const fileDir = (0, import_node_path121.join)(skillDirPath, (0, import_node_path121.dirname)(file.name));
|
|
18010
18363
|
if (fileDir !== skillDirPath) {
|
|
18011
18364
|
await ensureDir(fileDir);
|
|
18012
18365
|
}
|
|
18013
18366
|
await writeFileContent(filePath, file.body);
|
|
18014
18367
|
}
|
|
18015
18368
|
return {
|
|
18016
|
-
relativeDirPathFromCwd: (0,
|
|
18369
|
+
relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
18017
18370
|
frontmatter: skill.getFrontmatter(),
|
|
18018
18371
|
body: skill.getBody(),
|
|
18019
18372
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -18035,13 +18388,13 @@ async function deleteSkill({
|
|
|
18035
18388
|
intendedRootDir: process.cwd()
|
|
18036
18389
|
});
|
|
18037
18390
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
18038
|
-
const skillDirPath = (0,
|
|
18391
|
+
const skillDirPath = (0, import_node_path121.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
18039
18392
|
try {
|
|
18040
18393
|
if (await directoryExists(skillDirPath)) {
|
|
18041
18394
|
await removeDirectory(skillDirPath);
|
|
18042
18395
|
}
|
|
18043
18396
|
return {
|
|
18044
|
-
relativeDirPathFromCwd: (0,
|
|
18397
|
+
relativeDirPathFromCwd: (0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
18045
18398
|
};
|
|
18046
18399
|
} catch (error) {
|
|
18047
18400
|
throw new Error(
|
|
@@ -18052,29 +18405,29 @@ async function deleteSkill({
|
|
|
18052
18405
|
);
|
|
18053
18406
|
}
|
|
18054
18407
|
}
|
|
18055
|
-
var McpSkillFileSchema =
|
|
18056
|
-
name:
|
|
18057
|
-
body:
|
|
18408
|
+
var McpSkillFileSchema = import_mini61.z.object({
|
|
18409
|
+
name: import_mini61.z.string(),
|
|
18410
|
+
body: import_mini61.z.string()
|
|
18058
18411
|
});
|
|
18059
18412
|
var skillToolSchemas = {
|
|
18060
|
-
listSkills:
|
|
18061
|
-
getSkill:
|
|
18062
|
-
relativeDirPathFromCwd:
|
|
18413
|
+
listSkills: import_mini61.z.object({}),
|
|
18414
|
+
getSkill: import_mini61.z.object({
|
|
18415
|
+
relativeDirPathFromCwd: import_mini61.z.string()
|
|
18063
18416
|
}),
|
|
18064
|
-
putSkill:
|
|
18065
|
-
relativeDirPathFromCwd:
|
|
18417
|
+
putSkill: import_mini61.z.object({
|
|
18418
|
+
relativeDirPathFromCwd: import_mini61.z.string(),
|
|
18066
18419
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
18067
|
-
body:
|
|
18068
|
-
otherFiles:
|
|
18420
|
+
body: import_mini61.z.string(),
|
|
18421
|
+
otherFiles: import_mini61.z.optional(import_mini61.z.array(McpSkillFileSchema))
|
|
18069
18422
|
}),
|
|
18070
|
-
deleteSkill:
|
|
18071
|
-
relativeDirPathFromCwd:
|
|
18423
|
+
deleteSkill: import_mini61.z.object({
|
|
18424
|
+
relativeDirPathFromCwd: import_mini61.z.string()
|
|
18072
18425
|
})
|
|
18073
18426
|
};
|
|
18074
18427
|
var skillTools = {
|
|
18075
18428
|
listSkills: {
|
|
18076
18429
|
name: "listSkills",
|
|
18077
|
-
description: `List all skills from ${(0,
|
|
18430
|
+
description: `List all skills from ${(0, import_node_path121.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
18078
18431
|
parameters: skillToolSchemas.listSkills,
|
|
18079
18432
|
execute: async () => {
|
|
18080
18433
|
const skills = await listSkills();
|
|
@@ -18117,12 +18470,12 @@ var skillTools = {
|
|
|
18117
18470
|
};
|
|
18118
18471
|
|
|
18119
18472
|
// src/mcp/subagents.ts
|
|
18120
|
-
var
|
|
18121
|
-
var
|
|
18473
|
+
var import_node_path122 = require("path");
|
|
18474
|
+
var import_mini62 = require("zod/mini");
|
|
18122
18475
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
18123
18476
|
var maxSubagentsCount = 1e3;
|
|
18124
18477
|
async function listSubagents() {
|
|
18125
|
-
const subagentsDir = (0,
|
|
18478
|
+
const subagentsDir = (0, import_node_path122.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
18126
18479
|
try {
|
|
18127
18480
|
const files = await listDirectoryFiles(subagentsDir);
|
|
18128
18481
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -18135,7 +18488,7 @@ async function listSubagents() {
|
|
|
18135
18488
|
});
|
|
18136
18489
|
const frontmatter = subagent.getFrontmatter();
|
|
18137
18490
|
return {
|
|
18138
|
-
relativePathFromCwd: (0,
|
|
18491
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
18139
18492
|
frontmatter
|
|
18140
18493
|
};
|
|
18141
18494
|
} catch (error) {
|
|
@@ -18159,14 +18512,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
18159
18512
|
relativePath: relativePathFromCwd,
|
|
18160
18513
|
intendedRootDir: process.cwd()
|
|
18161
18514
|
});
|
|
18162
|
-
const filename = (0,
|
|
18515
|
+
const filename = (0, import_node_path122.basename)(relativePathFromCwd);
|
|
18163
18516
|
try {
|
|
18164
18517
|
const subagent = await RulesyncSubagent.fromFile({
|
|
18165
18518
|
relativeFilePath: filename,
|
|
18166
18519
|
validate: true
|
|
18167
18520
|
});
|
|
18168
18521
|
return {
|
|
18169
|
-
relativePathFromCwd: (0,
|
|
18522
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
18170
18523
|
frontmatter: subagent.getFrontmatter(),
|
|
18171
18524
|
body: subagent.getBody()
|
|
18172
18525
|
};
|
|
@@ -18185,7 +18538,7 @@ async function putSubagent({
|
|
|
18185
18538
|
relativePath: relativePathFromCwd,
|
|
18186
18539
|
intendedRootDir: process.cwd()
|
|
18187
18540
|
});
|
|
18188
|
-
const filename = (0,
|
|
18541
|
+
const filename = (0, import_node_path122.basename)(relativePathFromCwd);
|
|
18189
18542
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
18190
18543
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
18191
18544
|
throw new Error(
|
|
@@ -18195,7 +18548,7 @@ async function putSubagent({
|
|
|
18195
18548
|
try {
|
|
18196
18549
|
const existingSubagents = await listSubagents();
|
|
18197
18550
|
const isUpdate = existingSubagents.some(
|
|
18198
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
18551
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
18199
18552
|
);
|
|
18200
18553
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
18201
18554
|
throw new Error(
|
|
@@ -18210,11 +18563,11 @@ async function putSubagent({
|
|
|
18210
18563
|
body,
|
|
18211
18564
|
validate: true
|
|
18212
18565
|
});
|
|
18213
|
-
const subagentsDir = (0,
|
|
18566
|
+
const subagentsDir = (0, import_node_path122.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
18214
18567
|
await ensureDir(subagentsDir);
|
|
18215
18568
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
18216
18569
|
return {
|
|
18217
|
-
relativePathFromCwd: (0,
|
|
18570
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
18218
18571
|
frontmatter: subagent.getFrontmatter(),
|
|
18219
18572
|
body: subagent.getBody()
|
|
18220
18573
|
};
|
|
@@ -18229,12 +18582,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
18229
18582
|
relativePath: relativePathFromCwd,
|
|
18230
18583
|
intendedRootDir: process.cwd()
|
|
18231
18584
|
});
|
|
18232
|
-
const filename = (0,
|
|
18233
|
-
const fullPath = (0,
|
|
18585
|
+
const filename = (0, import_node_path122.basename)(relativePathFromCwd);
|
|
18586
|
+
const fullPath = (0, import_node_path122.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
18234
18587
|
try {
|
|
18235
18588
|
await removeFile(fullPath);
|
|
18236
18589
|
return {
|
|
18237
|
-
relativePathFromCwd: (0,
|
|
18590
|
+
relativePathFromCwd: (0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
18238
18591
|
};
|
|
18239
18592
|
} catch (error) {
|
|
18240
18593
|
throw new Error(
|
|
@@ -18246,23 +18599,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
18246
18599
|
}
|
|
18247
18600
|
}
|
|
18248
18601
|
var subagentToolSchemas = {
|
|
18249
|
-
listSubagents:
|
|
18250
|
-
getSubagent:
|
|
18251
|
-
relativePathFromCwd:
|
|
18602
|
+
listSubagents: import_mini62.z.object({}),
|
|
18603
|
+
getSubagent: import_mini62.z.object({
|
|
18604
|
+
relativePathFromCwd: import_mini62.z.string()
|
|
18252
18605
|
}),
|
|
18253
|
-
putSubagent:
|
|
18254
|
-
relativePathFromCwd:
|
|
18606
|
+
putSubagent: import_mini62.z.object({
|
|
18607
|
+
relativePathFromCwd: import_mini62.z.string(),
|
|
18255
18608
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
18256
|
-
body:
|
|
18609
|
+
body: import_mini62.z.string()
|
|
18257
18610
|
}),
|
|
18258
|
-
deleteSubagent:
|
|
18259
|
-
relativePathFromCwd:
|
|
18611
|
+
deleteSubagent: import_mini62.z.object({
|
|
18612
|
+
relativePathFromCwd: import_mini62.z.string()
|
|
18260
18613
|
})
|
|
18261
18614
|
};
|
|
18262
18615
|
var subagentTools = {
|
|
18263
18616
|
listSubagents: {
|
|
18264
18617
|
name: "listSubagents",
|
|
18265
|
-
description: `List all subagents from ${(0,
|
|
18618
|
+
description: `List all subagents from ${(0, import_node_path122.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
18266
18619
|
parameters: subagentToolSchemas.listSubagents,
|
|
18267
18620
|
execute: async () => {
|
|
18268
18621
|
const subagents = await listSubagents();
|
|
@@ -18304,7 +18657,7 @@ var subagentTools = {
|
|
|
18304
18657
|
};
|
|
18305
18658
|
|
|
18306
18659
|
// src/mcp/tools.ts
|
|
18307
|
-
var rulesyncFeatureSchema =
|
|
18660
|
+
var rulesyncFeatureSchema = import_mini63.z.enum([
|
|
18308
18661
|
"rule",
|
|
18309
18662
|
"command",
|
|
18310
18663
|
"subagent",
|
|
@@ -18314,21 +18667,21 @@ var rulesyncFeatureSchema = import_mini62.z.enum([
|
|
|
18314
18667
|
"generate",
|
|
18315
18668
|
"import"
|
|
18316
18669
|
]);
|
|
18317
|
-
var rulesyncOperationSchema =
|
|
18318
|
-
var skillFileSchema =
|
|
18319
|
-
name:
|
|
18320
|
-
body:
|
|
18670
|
+
var rulesyncOperationSchema = import_mini63.z.enum(["list", "get", "put", "delete", "run"]);
|
|
18671
|
+
var skillFileSchema = import_mini63.z.object({
|
|
18672
|
+
name: import_mini63.z.string(),
|
|
18673
|
+
body: import_mini63.z.string()
|
|
18321
18674
|
});
|
|
18322
|
-
var rulesyncToolSchema =
|
|
18675
|
+
var rulesyncToolSchema = import_mini63.z.object({
|
|
18323
18676
|
feature: rulesyncFeatureSchema,
|
|
18324
18677
|
operation: rulesyncOperationSchema,
|
|
18325
|
-
targetPathFromCwd:
|
|
18326
|
-
frontmatter:
|
|
18327
|
-
body:
|
|
18328
|
-
otherFiles:
|
|
18329
|
-
content:
|
|
18330
|
-
generateOptions:
|
|
18331
|
-
importOptions:
|
|
18678
|
+
targetPathFromCwd: import_mini63.z.optional(import_mini63.z.string()),
|
|
18679
|
+
frontmatter: import_mini63.z.optional(import_mini63.z.unknown()),
|
|
18680
|
+
body: import_mini63.z.optional(import_mini63.z.string()),
|
|
18681
|
+
otherFiles: import_mini63.z.optional(import_mini63.z.array(skillFileSchema)),
|
|
18682
|
+
content: import_mini63.z.optional(import_mini63.z.string()),
|
|
18683
|
+
generateOptions: import_mini63.z.optional(generateOptionsSchema),
|
|
18684
|
+
importOptions: import_mini63.z.optional(importOptionsSchema)
|
|
18332
18685
|
});
|
|
18333
18686
|
var supportedOperationsByFeature = {
|
|
18334
18687
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -18887,7 +19240,7 @@ async function updateCommand(currentVersion, options) {
|
|
|
18887
19240
|
}
|
|
18888
19241
|
|
|
18889
19242
|
// src/cli/index.ts
|
|
18890
|
-
var getVersion = () => "7.
|
|
19243
|
+
var getVersion = () => "7.6.0";
|
|
18891
19244
|
var main = async () => {
|
|
18892
19245
|
const program = new import_commander.Command();
|
|
18893
19246
|
const version = getVersion();
|