rulesync 4.3.2 → 5.0.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 +2 -3
- package/dist/index.cjs +919 -835
- package/dist/index.js +933 -849
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -233,7 +233,6 @@ import { optional, z as z3 } from "zod/mini";
|
|
|
233
233
|
import { z as z2 } from "zod/mini";
|
|
234
234
|
var ALL_TOOL_TARGETS = [
|
|
235
235
|
"agentsmd",
|
|
236
|
-
"amazonqcli",
|
|
237
236
|
"antigravity",
|
|
238
237
|
"augmentcode",
|
|
239
238
|
"augmentcode-legacy",
|
|
@@ -462,7 +461,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
462
461
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
463
462
|
|
|
464
463
|
// src/features/commands/commands-processor.ts
|
|
465
|
-
import { basename as
|
|
464
|
+
import { basename as basename13, join as join15 } from "path";
|
|
466
465
|
import { z as z12 } from "zod/mini";
|
|
467
466
|
|
|
468
467
|
// src/types/feature-processor.ts
|
|
@@ -1252,15 +1251,103 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1252
1251
|
}
|
|
1253
1252
|
};
|
|
1254
1253
|
|
|
1255
|
-
// src/features/commands/
|
|
1254
|
+
// src/features/commands/cline-command.ts
|
|
1256
1255
|
import { basename as basename6, join as join8 } from "path";
|
|
1256
|
+
var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
1257
|
+
static getSettablePaths({ global } = {}) {
|
|
1258
|
+
if (global) {
|
|
1259
|
+
return {
|
|
1260
|
+
relativeDirPath: join8("Documents", "Cline", "Workflows")
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
return {
|
|
1264
|
+
relativeDirPath: join8(".clinerules", "workflows")
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
toRulesyncCommand() {
|
|
1268
|
+
const rulesyncFrontmatter = {
|
|
1269
|
+
targets: ["*"],
|
|
1270
|
+
description: ""
|
|
1271
|
+
};
|
|
1272
|
+
return new RulesyncCommand({
|
|
1273
|
+
baseDir: process.cwd(),
|
|
1274
|
+
frontmatter: rulesyncFrontmatter,
|
|
1275
|
+
body: this.getFileContent(),
|
|
1276
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1277
|
+
relativeFilePath: this.relativeFilePath,
|
|
1278
|
+
fileContent: this.getFileContent(),
|
|
1279
|
+
validate: true
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
static fromRulesyncCommand({
|
|
1283
|
+
baseDir = process.cwd(),
|
|
1284
|
+
rulesyncCommand,
|
|
1285
|
+
validate = true,
|
|
1286
|
+
global = false
|
|
1287
|
+
}) {
|
|
1288
|
+
const paths = this.getSettablePaths({ global });
|
|
1289
|
+
return new _ClineCommand({
|
|
1290
|
+
baseDir,
|
|
1291
|
+
fileContent: rulesyncCommand.getBody(),
|
|
1292
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1293
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1294
|
+
validate
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
validate() {
|
|
1298
|
+
return { success: true, error: null };
|
|
1299
|
+
}
|
|
1300
|
+
getBody() {
|
|
1301
|
+
return this.getFileContent();
|
|
1302
|
+
}
|
|
1303
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1304
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1305
|
+
rulesyncCommand,
|
|
1306
|
+
toolTarget: "cline"
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
static async fromFile({
|
|
1310
|
+
baseDir = process.cwd(),
|
|
1311
|
+
relativeFilePath,
|
|
1312
|
+
validate = true,
|
|
1313
|
+
global = false
|
|
1314
|
+
}) {
|
|
1315
|
+
const paths = this.getSettablePaths({ global });
|
|
1316
|
+
const filePath = join8(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1317
|
+
const fileContent = await readFileContent(filePath);
|
|
1318
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
1319
|
+
return new _ClineCommand({
|
|
1320
|
+
baseDir,
|
|
1321
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1322
|
+
relativeFilePath: basename6(relativeFilePath),
|
|
1323
|
+
fileContent: content.trim(),
|
|
1324
|
+
validate
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
static forDeletion({
|
|
1328
|
+
baseDir = process.cwd(),
|
|
1329
|
+
relativeDirPath,
|
|
1330
|
+
relativeFilePath
|
|
1331
|
+
}) {
|
|
1332
|
+
return new _ClineCommand({
|
|
1333
|
+
baseDir,
|
|
1334
|
+
relativeDirPath,
|
|
1335
|
+
relativeFilePath,
|
|
1336
|
+
fileContent: "",
|
|
1337
|
+
validate: false
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
|
|
1342
|
+
// src/features/commands/codexcli-command.ts
|
|
1343
|
+
import { basename as basename7, join as join9 } from "path";
|
|
1257
1344
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1258
1345
|
static getSettablePaths({ global } = {}) {
|
|
1259
1346
|
if (!global) {
|
|
1260
1347
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1261
1348
|
}
|
|
1262
1349
|
return {
|
|
1263
|
-
relativeDirPath:
|
|
1350
|
+
relativeDirPath: join9(".codex", "prompts")
|
|
1264
1351
|
};
|
|
1265
1352
|
}
|
|
1266
1353
|
toRulesyncCommand() {
|
|
@@ -1313,13 +1400,13 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1313
1400
|
global = false
|
|
1314
1401
|
}) {
|
|
1315
1402
|
const paths = this.getSettablePaths({ global });
|
|
1316
|
-
const filePath =
|
|
1403
|
+
const filePath = join9(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1317
1404
|
const fileContent = await readFileContent(filePath);
|
|
1318
1405
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1319
1406
|
return new _CodexcliCommand({
|
|
1320
1407
|
baseDir,
|
|
1321
1408
|
relativeDirPath: paths.relativeDirPath,
|
|
1322
|
-
relativeFilePath:
|
|
1409
|
+
relativeFilePath: basename7(relativeFilePath),
|
|
1323
1410
|
fileContent: content.trim(),
|
|
1324
1411
|
validate
|
|
1325
1412
|
});
|
|
@@ -1340,7 +1427,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1340
1427
|
};
|
|
1341
1428
|
|
|
1342
1429
|
// src/features/commands/copilot-command.ts
|
|
1343
|
-
import { basename as
|
|
1430
|
+
import { basename as basename8, join as join10 } from "path";
|
|
1344
1431
|
import { z as z8 } from "zod/mini";
|
|
1345
1432
|
var CopilotCommandFrontmatterSchema = z8.looseObject({
|
|
1346
1433
|
mode: z8.optional(z8.string()),
|
|
@@ -1354,7 +1441,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1354
1441
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1355
1442
|
if (!result.success) {
|
|
1356
1443
|
throw new Error(
|
|
1357
|
-
`Invalid frontmatter in ${
|
|
1444
|
+
`Invalid frontmatter in ${join10(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1358
1445
|
);
|
|
1359
1446
|
}
|
|
1360
1447
|
}
|
|
@@ -1367,7 +1454,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1367
1454
|
}
|
|
1368
1455
|
static getSettablePaths() {
|
|
1369
1456
|
return {
|
|
1370
|
-
relativeDirPath:
|
|
1457
|
+
relativeDirPath: join10(".github", "prompts")
|
|
1371
1458
|
};
|
|
1372
1459
|
}
|
|
1373
1460
|
getBody() {
|
|
@@ -1407,7 +1494,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1407
1494
|
return {
|
|
1408
1495
|
success: false,
|
|
1409
1496
|
error: new Error(
|
|
1410
|
-
`Invalid frontmatter in ${
|
|
1497
|
+
`Invalid frontmatter in ${join10(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1411
1498
|
)
|
|
1412
1499
|
};
|
|
1413
1500
|
}
|
|
@@ -1442,7 +1529,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1442
1529
|
validate = true
|
|
1443
1530
|
}) {
|
|
1444
1531
|
const paths = this.getSettablePaths();
|
|
1445
|
-
const filePath =
|
|
1532
|
+
const filePath = join10(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1446
1533
|
const fileContent = await readFileContent(filePath);
|
|
1447
1534
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1448
1535
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1452,7 +1539,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1452
1539
|
return new _CopilotCommand({
|
|
1453
1540
|
baseDir,
|
|
1454
1541
|
relativeDirPath: paths.relativeDirPath,
|
|
1455
|
-
relativeFilePath:
|
|
1542
|
+
relativeFilePath: basename8(relativeFilePath),
|
|
1456
1543
|
frontmatter: result.data,
|
|
1457
1544
|
body: content.trim(),
|
|
1458
1545
|
validate
|
|
@@ -1481,11 +1568,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1481
1568
|
};
|
|
1482
1569
|
|
|
1483
1570
|
// src/features/commands/cursor-command.ts
|
|
1484
|
-
import { basename as
|
|
1571
|
+
import { basename as basename9, join as join11 } from "path";
|
|
1485
1572
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1486
1573
|
static getSettablePaths(_options = {}) {
|
|
1487
1574
|
return {
|
|
1488
|
-
relativeDirPath:
|
|
1575
|
+
relativeDirPath: join11(".cursor", "commands")
|
|
1489
1576
|
};
|
|
1490
1577
|
}
|
|
1491
1578
|
toRulesyncCommand() {
|
|
@@ -1538,13 +1625,13 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1538
1625
|
global = false
|
|
1539
1626
|
}) {
|
|
1540
1627
|
const paths = this.getSettablePaths({ global });
|
|
1541
|
-
const filePath =
|
|
1628
|
+
const filePath = join11(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1542
1629
|
const fileContent = await readFileContent(filePath);
|
|
1543
1630
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1544
1631
|
return new _CursorCommand({
|
|
1545
1632
|
baseDir,
|
|
1546
1633
|
relativeDirPath: paths.relativeDirPath,
|
|
1547
|
-
relativeFilePath:
|
|
1634
|
+
relativeFilePath: basename9(relativeFilePath),
|
|
1548
1635
|
fileContent: content.trim(),
|
|
1549
1636
|
validate
|
|
1550
1637
|
});
|
|
@@ -1565,7 +1652,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1565
1652
|
};
|
|
1566
1653
|
|
|
1567
1654
|
// src/features/commands/geminicli-command.ts
|
|
1568
|
-
import { basename as
|
|
1655
|
+
import { basename as basename10, join as join12 } from "path";
|
|
1569
1656
|
import { parse as parseToml } from "smol-toml";
|
|
1570
1657
|
import { z as z9 } from "zod/mini";
|
|
1571
1658
|
var GeminiCliCommandFrontmatterSchema = z9.looseObject({
|
|
@@ -1583,7 +1670,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1583
1670
|
}
|
|
1584
1671
|
static getSettablePaths(_options = {}) {
|
|
1585
1672
|
return {
|
|
1586
|
-
relativeDirPath:
|
|
1673
|
+
relativeDirPath: join12(".gemini", "commands")
|
|
1587
1674
|
};
|
|
1588
1675
|
}
|
|
1589
1676
|
parseTomlContent(content) {
|
|
@@ -1665,12 +1752,12 @@ ${geminiFrontmatter.prompt}
|
|
|
1665
1752
|
global = false
|
|
1666
1753
|
}) {
|
|
1667
1754
|
const paths = this.getSettablePaths({ global });
|
|
1668
|
-
const filePath =
|
|
1755
|
+
const filePath = join12(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1669
1756
|
const fileContent = await readFileContent(filePath);
|
|
1670
1757
|
return new _GeminiCliCommand({
|
|
1671
1758
|
baseDir,
|
|
1672
1759
|
relativeDirPath: paths.relativeDirPath,
|
|
1673
|
-
relativeFilePath:
|
|
1760
|
+
relativeFilePath: basename10(relativeFilePath),
|
|
1674
1761
|
fileContent,
|
|
1675
1762
|
validate
|
|
1676
1763
|
});
|
|
@@ -1707,7 +1794,7 @@ prompt = ""`;
|
|
|
1707
1794
|
};
|
|
1708
1795
|
|
|
1709
1796
|
// src/features/commands/opencode-command.ts
|
|
1710
|
-
import { basename as
|
|
1797
|
+
import { basename as basename11, join as join13 } from "path";
|
|
1711
1798
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
1712
1799
|
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
1713
1800
|
description: z10.string(),
|
|
@@ -1723,7 +1810,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1723
1810
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1724
1811
|
if (!result.success) {
|
|
1725
1812
|
throw new Error(
|
|
1726
|
-
`Invalid frontmatter in ${
|
|
1813
|
+
`Invalid frontmatter in ${join13(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1727
1814
|
);
|
|
1728
1815
|
}
|
|
1729
1816
|
}
|
|
@@ -1736,7 +1823,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1736
1823
|
}
|
|
1737
1824
|
static getSettablePaths({ global } = {}) {
|
|
1738
1825
|
return {
|
|
1739
|
-
relativeDirPath: global ?
|
|
1826
|
+
relativeDirPath: global ? join13(".config", "opencode", "command") : join13(".opencode", "command")
|
|
1740
1827
|
};
|
|
1741
1828
|
}
|
|
1742
1829
|
getBody() {
|
|
@@ -1797,7 +1884,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1797
1884
|
return {
|
|
1798
1885
|
success: false,
|
|
1799
1886
|
error: new Error(
|
|
1800
|
-
`Invalid frontmatter in ${
|
|
1887
|
+
`Invalid frontmatter in ${join13(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1801
1888
|
)
|
|
1802
1889
|
};
|
|
1803
1890
|
}
|
|
@@ -1808,7 +1895,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1808
1895
|
global = false
|
|
1809
1896
|
}) {
|
|
1810
1897
|
const paths = this.getSettablePaths({ global });
|
|
1811
|
-
const filePath =
|
|
1898
|
+
const filePath = join13(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1812
1899
|
const fileContent = await readFileContent(filePath);
|
|
1813
1900
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1814
1901
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1818,7 +1905,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1818
1905
|
return new _OpenCodeCommand({
|
|
1819
1906
|
baseDir,
|
|
1820
1907
|
relativeDirPath: paths.relativeDirPath,
|
|
1821
|
-
relativeFilePath:
|
|
1908
|
+
relativeFilePath: basename11(relativeFilePath),
|
|
1822
1909
|
frontmatter: result.data,
|
|
1823
1910
|
body: content.trim(),
|
|
1824
1911
|
validate
|
|
@@ -1847,7 +1934,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1847
1934
|
};
|
|
1848
1935
|
|
|
1849
1936
|
// src/features/commands/roo-command.ts
|
|
1850
|
-
import { basename as
|
|
1937
|
+
import { basename as basename12, join as join14 } from "path";
|
|
1851
1938
|
import { optional as optional3, z as z11 } from "zod/mini";
|
|
1852
1939
|
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
1853
1940
|
description: z11.string(),
|
|
@@ -1858,7 +1945,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1858
1945
|
body;
|
|
1859
1946
|
static getSettablePaths() {
|
|
1860
1947
|
return {
|
|
1861
|
-
relativeDirPath:
|
|
1948
|
+
relativeDirPath: join14(".roo", "commands")
|
|
1862
1949
|
};
|
|
1863
1950
|
}
|
|
1864
1951
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1866,7 +1953,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1866
1953
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1867
1954
|
if (!result.success) {
|
|
1868
1955
|
throw new Error(
|
|
1869
|
-
`Invalid frontmatter in ${
|
|
1956
|
+
`Invalid frontmatter in ${join14(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1870
1957
|
);
|
|
1871
1958
|
}
|
|
1872
1959
|
}
|
|
@@ -1937,7 +2024,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1937
2024
|
return {
|
|
1938
2025
|
success: false,
|
|
1939
2026
|
error: new Error(
|
|
1940
|
-
`Invalid frontmatter in ${
|
|
2027
|
+
`Invalid frontmatter in ${join14(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1941
2028
|
)
|
|
1942
2029
|
};
|
|
1943
2030
|
}
|
|
@@ -1953,7 +2040,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1953
2040
|
relativeFilePath,
|
|
1954
2041
|
validate = true
|
|
1955
2042
|
}) {
|
|
1956
|
-
const filePath =
|
|
2043
|
+
const filePath = join14(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
1957
2044
|
const fileContent = await readFileContent(filePath);
|
|
1958
2045
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1959
2046
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1963,7 +2050,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1963
2050
|
return new _RooCommand({
|
|
1964
2051
|
baseDir,
|
|
1965
2052
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1966
|
-
relativeFilePath:
|
|
2053
|
+
relativeFilePath: basename12(relativeFilePath),
|
|
1967
2054
|
frontmatter: result.data,
|
|
1968
2055
|
body: content.trim(),
|
|
1969
2056
|
fileContent,
|
|
@@ -1992,6 +2079,8 @@ var commandsProcessorToolTargetTuple = [
|
|
|
1992
2079
|
"agentsmd",
|
|
1993
2080
|
"antigravity",
|
|
1994
2081
|
"claudecode",
|
|
2082
|
+
"claudecode-legacy",
|
|
2083
|
+
"cline",
|
|
1995
2084
|
"codexcli",
|
|
1996
2085
|
"copilot",
|
|
1997
2086
|
"cursor",
|
|
@@ -2022,6 +2111,20 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2022
2111
|
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2023
2112
|
}
|
|
2024
2113
|
],
|
|
2114
|
+
[
|
|
2115
|
+
"claudecode-legacy",
|
|
2116
|
+
{
|
|
2117
|
+
class: ClaudecodeCommand,
|
|
2118
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2119
|
+
}
|
|
2120
|
+
],
|
|
2121
|
+
[
|
|
2122
|
+
"cline",
|
|
2123
|
+
{
|
|
2124
|
+
class: ClineCommand,
|
|
2125
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2126
|
+
}
|
|
2127
|
+
],
|
|
2025
2128
|
[
|
|
2026
2129
|
"codexcli",
|
|
2027
2130
|
{
|
|
@@ -2145,11 +2248,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2145
2248
|
*/
|
|
2146
2249
|
async loadRulesyncFiles() {
|
|
2147
2250
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2148
|
-
|
|
2251
|
+
join15(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2149
2252
|
);
|
|
2150
2253
|
const rulesyncCommands = await Promise.all(
|
|
2151
2254
|
rulesyncCommandPaths.map(
|
|
2152
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
2255
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: basename13(path3) })
|
|
2153
2256
|
)
|
|
2154
2257
|
);
|
|
2155
2258
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2165,14 +2268,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2165
2268
|
const factory = this.getFactory(this.toolTarget);
|
|
2166
2269
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2167
2270
|
const commandFilePaths = await findFilesByGlobs(
|
|
2168
|
-
|
|
2271
|
+
join15(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2169
2272
|
);
|
|
2170
2273
|
if (forDeletion) {
|
|
2171
2274
|
const toolCommands2 = commandFilePaths.map(
|
|
2172
2275
|
(path3) => factory.class.forDeletion({
|
|
2173
2276
|
baseDir: this.baseDir,
|
|
2174
2277
|
relativeDirPath: paths.relativeDirPath,
|
|
2175
|
-
relativeFilePath:
|
|
2278
|
+
relativeFilePath: basename13(path3),
|
|
2176
2279
|
global: this.global
|
|
2177
2280
|
})
|
|
2178
2281
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2183,7 +2286,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2183
2286
|
commandFilePaths.map(
|
|
2184
2287
|
(path3) => factory.class.fromFile({
|
|
2185
2288
|
baseDir: this.baseDir,
|
|
2186
|
-
relativeFilePath:
|
|
2289
|
+
relativeFilePath: basename13(path3),
|
|
2187
2290
|
global: this.global
|
|
2188
2291
|
})
|
|
2189
2292
|
)
|
|
@@ -2217,15 +2320,15 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2217
2320
|
// src/features/ignore/ignore-processor.ts
|
|
2218
2321
|
import { z as z13 } from "zod/mini";
|
|
2219
2322
|
|
|
2220
|
-
// src/features/ignore/
|
|
2221
|
-
import { join as
|
|
2323
|
+
// src/features/ignore/augmentcode-ignore.ts
|
|
2324
|
+
import { join as join17 } from "path";
|
|
2222
2325
|
|
|
2223
2326
|
// src/types/tool-file.ts
|
|
2224
2327
|
var ToolFile = class extends AiFile {
|
|
2225
2328
|
};
|
|
2226
2329
|
|
|
2227
2330
|
// src/features/ignore/rulesync-ignore.ts
|
|
2228
|
-
import { join as
|
|
2331
|
+
import { join as join16 } from "path";
|
|
2229
2332
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2230
2333
|
validate() {
|
|
2231
2334
|
return { success: true, error: null };
|
|
@@ -2245,12 +2348,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2245
2348
|
static async fromFile() {
|
|
2246
2349
|
const baseDir = process.cwd();
|
|
2247
2350
|
const paths = this.getSettablePaths();
|
|
2248
|
-
const recommendedPath =
|
|
2351
|
+
const recommendedPath = join16(
|
|
2249
2352
|
baseDir,
|
|
2250
2353
|
paths.recommended.relativeDirPath,
|
|
2251
2354
|
paths.recommended.relativeFilePath
|
|
2252
2355
|
);
|
|
2253
|
-
const legacyPath =
|
|
2356
|
+
const legacyPath = join16(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2254
2357
|
if (await fileExists(recommendedPath)) {
|
|
2255
2358
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2256
2359
|
return new _RulesyncIgnore({
|
|
@@ -2328,76 +2431,7 @@ var ToolIgnore = class extends ToolFile {
|
|
|
2328
2431
|
}
|
|
2329
2432
|
};
|
|
2330
2433
|
|
|
2331
|
-
// src/features/ignore/amazonqcli-ignore.ts
|
|
2332
|
-
var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
2333
|
-
static getSettablePaths() {
|
|
2334
|
-
return {
|
|
2335
|
-
relativeDirPath: ".",
|
|
2336
|
-
relativeFilePath: ".amazonqignore"
|
|
2337
|
-
};
|
|
2338
|
-
}
|
|
2339
|
-
/**
|
|
2340
|
-
* Convert to RulesyncIgnore format
|
|
2341
|
-
*/
|
|
2342
|
-
toRulesyncIgnore() {
|
|
2343
|
-
return this.toRulesyncIgnoreDefault();
|
|
2344
|
-
}
|
|
2345
|
-
/**
|
|
2346
|
-
* Create AmazonqcliIgnore from RulesyncIgnore
|
|
2347
|
-
* Supports conversion from unified rulesync format to Amazon Q CLI specific format
|
|
2348
|
-
*/
|
|
2349
|
-
static fromRulesyncIgnore({
|
|
2350
|
-
baseDir = process.cwd(),
|
|
2351
|
-
rulesyncIgnore
|
|
2352
|
-
}) {
|
|
2353
|
-
const body = rulesyncIgnore.getFileContent();
|
|
2354
|
-
return new _AmazonqcliIgnore({
|
|
2355
|
-
baseDir,
|
|
2356
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2357
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
2358
|
-
fileContent: body
|
|
2359
|
-
});
|
|
2360
|
-
}
|
|
2361
|
-
/**
|
|
2362
|
-
* Create AmazonqcliIgnore from file path
|
|
2363
|
-
* Supports both proposed .q-ignore and .amazonqignore formats
|
|
2364
|
-
*/
|
|
2365
|
-
static async fromFile({
|
|
2366
|
-
baseDir = process.cwd(),
|
|
2367
|
-
validate = true
|
|
2368
|
-
}) {
|
|
2369
|
-
const fileContent = await readFileContent(
|
|
2370
|
-
join16(
|
|
2371
|
-
baseDir,
|
|
2372
|
-
this.getSettablePaths().relativeDirPath,
|
|
2373
|
-
this.getSettablePaths().relativeFilePath
|
|
2374
|
-
)
|
|
2375
|
-
);
|
|
2376
|
-
return new _AmazonqcliIgnore({
|
|
2377
|
-
baseDir,
|
|
2378
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2379
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
2380
|
-
fileContent,
|
|
2381
|
-
validate
|
|
2382
|
-
});
|
|
2383
|
-
}
|
|
2384
|
-
static forDeletion({
|
|
2385
|
-
baseDir = process.cwd(),
|
|
2386
|
-
relativeDirPath,
|
|
2387
|
-
relativeFilePath
|
|
2388
|
-
}) {
|
|
2389
|
-
return new _AmazonqcliIgnore({
|
|
2390
|
-
baseDir,
|
|
2391
|
-
relativeDirPath,
|
|
2392
|
-
relativeFilePath,
|
|
2393
|
-
fileContent: "",
|
|
2394
|
-
validate: false
|
|
2395
|
-
});
|
|
2396
|
-
}
|
|
2397
|
-
};
|
|
2398
|
-
|
|
2399
2434
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2400
|
-
import { join as join17 } from "path";
|
|
2401
2435
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
2402
2436
|
static getSettablePaths() {
|
|
2403
2437
|
return {
|
|
@@ -3047,9 +3081,9 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3047
3081
|
|
|
3048
3082
|
// src/features/ignore/ignore-processor.ts
|
|
3049
3083
|
var ignoreProcessorToolTargets = [
|
|
3050
|
-
"amazonqcli",
|
|
3051
3084
|
"augmentcode",
|
|
3052
3085
|
"claudecode",
|
|
3086
|
+
"claudecode-legacy",
|
|
3053
3087
|
"cline",
|
|
3054
3088
|
"cursor",
|
|
3055
3089
|
"geminicli",
|
|
@@ -3061,9 +3095,9 @@ var ignoreProcessorToolTargets = [
|
|
|
3061
3095
|
];
|
|
3062
3096
|
var IgnoreProcessorToolTargetSchema = z13.enum(ignoreProcessorToolTargets);
|
|
3063
3097
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
3064
|
-
["amazonqcli", { class: AmazonqcliIgnore }],
|
|
3065
3098
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
3066
3099
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
3100
|
+
["claudecode-legacy", { class: ClaudecodeIgnore }],
|
|
3067
3101
|
["cline", { class: ClineIgnore }],
|
|
3068
3102
|
["cursor", { class: CursorIgnore }],
|
|
3069
3103
|
["geminicli", { class: GeminiCliIgnore }],
|
|
@@ -3193,12 +3227,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3193
3227
|
// src/features/mcp/mcp-processor.ts
|
|
3194
3228
|
import { z as z18 } from "zod/mini";
|
|
3195
3229
|
|
|
3196
|
-
// src/features/mcp/
|
|
3197
|
-
import { join as
|
|
3230
|
+
// src/features/mcp/claudecode-mcp.ts
|
|
3231
|
+
import { join as join29 } from "path";
|
|
3198
3232
|
|
|
3199
|
-
// src/features/mcp/
|
|
3233
|
+
// src/features/mcp/modular-mcp.ts
|
|
3200
3234
|
import { join as join27 } from "path";
|
|
3201
|
-
import { omit } from "es-toolkit/object";
|
|
3202
3235
|
import { z as z15 } from "zod/mini";
|
|
3203
3236
|
|
|
3204
3237
|
// src/types/mcp.ts
|
|
@@ -3224,67 +3257,168 @@ var McpServerSchema = z14.object({
|
|
|
3224
3257
|
});
|
|
3225
3258
|
var McpServersSchema = z14.record(z14.string(), McpServerSchema);
|
|
3226
3259
|
|
|
3227
|
-
// src/features/mcp/
|
|
3228
|
-
var
|
|
3229
|
-
z15.
|
|
3230
|
-
|
|
3231
|
-
description: z15.optional(z15.string()),
|
|
3232
|
-
exposed: z15.optional(z15.literal(false))
|
|
3233
|
-
}),
|
|
3234
|
-
z15.extend(McpServerSchema, {
|
|
3235
|
-
targets: z15.optional(RulesyncTargetsSchema),
|
|
3236
|
-
description: z15.undefined(),
|
|
3237
|
-
exposed: z15.literal(true)
|
|
3238
|
-
})
|
|
3239
|
-
]);
|
|
3240
|
-
var RulesyncMcpConfigSchema = z15.object({
|
|
3241
|
-
mcpServers: z15.record(z15.string(), RulesyncMcpServerSchema)
|
|
3260
|
+
// src/features/mcp/modular-mcp.ts
|
|
3261
|
+
var ModularMcpServerSchema = z15.extend(McpServerSchema, {
|
|
3262
|
+
description: z15.string()
|
|
3263
|
+
// Required for modular-mcp
|
|
3242
3264
|
});
|
|
3243
|
-
var
|
|
3265
|
+
var ModularMcpConfigSchema = z15.object({
|
|
3266
|
+
mcpServers: z15.record(z15.string(), ModularMcpServerSchema)
|
|
3267
|
+
});
|
|
3268
|
+
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3244
3269
|
json;
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
this.json = JSON.parse(this.fileContent);
|
|
3249
|
-
this.modularMcp = modularMcp;
|
|
3250
|
-
if (rest.validate) {
|
|
3251
|
-
const result = this.validate();
|
|
3252
|
-
if (!result.success) {
|
|
3253
|
-
throw result.error;
|
|
3254
|
-
}
|
|
3255
|
-
}
|
|
3270
|
+
constructor(params) {
|
|
3271
|
+
super(params);
|
|
3272
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
3256
3273
|
}
|
|
3257
|
-
|
|
3258
|
-
return
|
|
3259
|
-
recommended: {
|
|
3260
|
-
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3261
|
-
relativeFilePath: "mcp.json"
|
|
3262
|
-
},
|
|
3263
|
-
legacy: {
|
|
3264
|
-
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3265
|
-
relativeFilePath: ".mcp.json"
|
|
3266
|
-
}
|
|
3267
|
-
};
|
|
3274
|
+
getJson() {
|
|
3275
|
+
return this.json;
|
|
3268
3276
|
}
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3277
|
+
static getSettablePaths(params = {
|
|
3278
|
+
global: false,
|
|
3279
|
+
relativeDirPath: void 0
|
|
3280
|
+
}) {
|
|
3281
|
+
const relativeFilePath = "modular-mcp.json";
|
|
3282
|
+
if (!params.global) {
|
|
3283
|
+
return {
|
|
3284
|
+
relativeDirPath: ".",
|
|
3285
|
+
relativeFilePath
|
|
3286
|
+
};
|
|
3273
3287
|
}
|
|
3274
|
-
return {
|
|
3288
|
+
return {
|
|
3289
|
+
relativeDirPath: params.relativeDirPath,
|
|
3290
|
+
relativeFilePath
|
|
3291
|
+
};
|
|
3275
3292
|
}
|
|
3276
|
-
static
|
|
3293
|
+
static getMcpServers({
|
|
3294
|
+
baseDir,
|
|
3295
|
+
global,
|
|
3296
|
+
relativeDirPath
|
|
3297
|
+
} = {
|
|
3298
|
+
baseDir: process.cwd(),
|
|
3299
|
+
global: false,
|
|
3300
|
+
relativeDirPath: void 0
|
|
3301
|
+
}) {
|
|
3302
|
+
const paths = this.getSettablePaths(
|
|
3303
|
+
global ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3304
|
+
);
|
|
3305
|
+
if (!global) {
|
|
3306
|
+
return {
|
|
3307
|
+
"modular-mcp": {
|
|
3308
|
+
type: "stdio",
|
|
3309
|
+
command: "npx",
|
|
3310
|
+
args: ["-y", "@kimuson/modular-mcp", paths.relativeFilePath],
|
|
3311
|
+
env: {}
|
|
3312
|
+
}
|
|
3313
|
+
};
|
|
3314
|
+
}
|
|
3315
|
+
return {
|
|
3316
|
+
"modular-mcp": {
|
|
3317
|
+
type: "stdio",
|
|
3318
|
+
command: "npx",
|
|
3319
|
+
args: [
|
|
3320
|
+
"-y",
|
|
3321
|
+
"@kimuson/modular-mcp",
|
|
3322
|
+
join27(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3323
|
+
],
|
|
3324
|
+
env: {}
|
|
3325
|
+
}
|
|
3326
|
+
};
|
|
3327
|
+
}
|
|
3328
|
+
static fromRulesyncMcp({
|
|
3329
|
+
baseDir = process.cwd(),
|
|
3330
|
+
rulesyncMcp,
|
|
3331
|
+
validate = true,
|
|
3332
|
+
global = false,
|
|
3333
|
+
relativeDirPath
|
|
3334
|
+
}) {
|
|
3335
|
+
const paths = this.getSettablePaths(
|
|
3336
|
+
global && relativeDirPath ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3337
|
+
);
|
|
3338
|
+
const modularMcpJson = {
|
|
3339
|
+
mcpServers: rulesyncMcp.getMcpServers({ type: "modularized" })
|
|
3340
|
+
};
|
|
3341
|
+
return new _ModularMcp({
|
|
3342
|
+
baseDir,
|
|
3343
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3344
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3345
|
+
fileContent: JSON.stringify(modularMcpJson, null, 2),
|
|
3346
|
+
validate
|
|
3347
|
+
});
|
|
3348
|
+
}
|
|
3349
|
+
validate() {
|
|
3350
|
+
const result = ModularMcpConfigSchema.safeParse(this.json);
|
|
3351
|
+
if (!result.success) {
|
|
3352
|
+
return { success: false, error: result.error };
|
|
3353
|
+
}
|
|
3354
|
+
return { success: true, error: null };
|
|
3355
|
+
}
|
|
3356
|
+
};
|
|
3357
|
+
|
|
3358
|
+
// src/features/mcp/rulesync-mcp.ts
|
|
3359
|
+
import { join as join28 } from "path";
|
|
3360
|
+
import { omit } from "es-toolkit/object";
|
|
3361
|
+
import { z as z16 } from "zod/mini";
|
|
3362
|
+
var RulesyncMcpServerSchema = z16.union([
|
|
3363
|
+
z16.extend(McpServerSchema, {
|
|
3364
|
+
targets: z16.optional(RulesyncTargetsSchema),
|
|
3365
|
+
description: z16.optional(z16.string()),
|
|
3366
|
+
exposed: z16.optional(z16.literal(false))
|
|
3367
|
+
}),
|
|
3368
|
+
z16.extend(McpServerSchema, {
|
|
3369
|
+
targets: z16.optional(RulesyncTargetsSchema),
|
|
3370
|
+
description: z16.undefined(),
|
|
3371
|
+
exposed: z16.literal(true)
|
|
3372
|
+
})
|
|
3373
|
+
]);
|
|
3374
|
+
var RulesyncMcpConfigSchema = z16.object({
|
|
3375
|
+
mcpServers: z16.record(z16.string(), RulesyncMcpServerSchema)
|
|
3376
|
+
});
|
|
3377
|
+
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
3378
|
+
json;
|
|
3379
|
+
modularMcp;
|
|
3380
|
+
constructor({ modularMcp = false, ...rest }) {
|
|
3381
|
+
super({ ...rest });
|
|
3382
|
+
this.json = JSON.parse(this.fileContent);
|
|
3383
|
+
this.modularMcp = modularMcp;
|
|
3384
|
+
if (rest.validate) {
|
|
3385
|
+
const result = this.validate();
|
|
3386
|
+
if (!result.success) {
|
|
3387
|
+
throw result.error;
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
static getSettablePaths() {
|
|
3392
|
+
return {
|
|
3393
|
+
recommended: {
|
|
3394
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3395
|
+
relativeFilePath: "mcp.json"
|
|
3396
|
+
},
|
|
3397
|
+
legacy: {
|
|
3398
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3399
|
+
relativeFilePath: ".mcp.json"
|
|
3400
|
+
}
|
|
3401
|
+
};
|
|
3402
|
+
}
|
|
3403
|
+
validate() {
|
|
3404
|
+
const result = RulesyncMcpConfigSchema.safeParse(this.json);
|
|
3405
|
+
if (!result.success) {
|
|
3406
|
+
return { success: false, error: result.error };
|
|
3407
|
+
}
|
|
3408
|
+
return { success: true, error: null };
|
|
3409
|
+
}
|
|
3410
|
+
static async fromFile({
|
|
3277
3411
|
validate = true,
|
|
3278
3412
|
modularMcp = false
|
|
3279
3413
|
}) {
|
|
3280
3414
|
const baseDir = process.cwd();
|
|
3281
3415
|
const paths = this.getSettablePaths();
|
|
3282
|
-
const recommendedPath =
|
|
3416
|
+
const recommendedPath = join28(
|
|
3283
3417
|
baseDir,
|
|
3284
3418
|
paths.recommended.relativeDirPath,
|
|
3285
3419
|
paths.recommended.relativeFilePath
|
|
3286
3420
|
);
|
|
3287
|
-
const legacyPath =
|
|
3421
|
+
const legacyPath = join28(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3288
3422
|
if (await fileExists(recommendedPath)) {
|
|
3289
3423
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3290
3424
|
return new _RulesyncMcp({
|
|
@@ -3391,178 +3525,6 @@ var ToolMcp = class extends ToolFile {
|
|
|
3391
3525
|
}
|
|
3392
3526
|
};
|
|
3393
3527
|
|
|
3394
|
-
// src/features/mcp/amazonqcli-mcp.ts
|
|
3395
|
-
var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
3396
|
-
json;
|
|
3397
|
-
constructor(params) {
|
|
3398
|
-
super(params);
|
|
3399
|
-
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
3400
|
-
}
|
|
3401
|
-
getJson() {
|
|
3402
|
-
return this.json;
|
|
3403
|
-
}
|
|
3404
|
-
static getSettablePaths() {
|
|
3405
|
-
return {
|
|
3406
|
-
relativeDirPath: ".amazonq",
|
|
3407
|
-
relativeFilePath: "mcp.json"
|
|
3408
|
-
};
|
|
3409
|
-
}
|
|
3410
|
-
static async fromFile({
|
|
3411
|
-
baseDir = process.cwd(),
|
|
3412
|
-
validate = true
|
|
3413
|
-
}) {
|
|
3414
|
-
const fileContent = await readFileContent(
|
|
3415
|
-
join28(
|
|
3416
|
-
baseDir,
|
|
3417
|
-
this.getSettablePaths().relativeDirPath,
|
|
3418
|
-
this.getSettablePaths().relativeFilePath
|
|
3419
|
-
)
|
|
3420
|
-
);
|
|
3421
|
-
return new _AmazonqcliMcp({
|
|
3422
|
-
baseDir,
|
|
3423
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3424
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3425
|
-
fileContent,
|
|
3426
|
-
validate
|
|
3427
|
-
});
|
|
3428
|
-
}
|
|
3429
|
-
static fromRulesyncMcp({
|
|
3430
|
-
baseDir = process.cwd(),
|
|
3431
|
-
rulesyncMcp,
|
|
3432
|
-
validate = true
|
|
3433
|
-
}) {
|
|
3434
|
-
return new _AmazonqcliMcp({
|
|
3435
|
-
baseDir,
|
|
3436
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3437
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3438
|
-
fileContent: rulesyncMcp.getFileContent(),
|
|
3439
|
-
validate
|
|
3440
|
-
});
|
|
3441
|
-
}
|
|
3442
|
-
toRulesyncMcp() {
|
|
3443
|
-
return this.toRulesyncMcpDefault();
|
|
3444
|
-
}
|
|
3445
|
-
validate() {
|
|
3446
|
-
return { success: true, error: null };
|
|
3447
|
-
}
|
|
3448
|
-
static forDeletion({
|
|
3449
|
-
baseDir = process.cwd(),
|
|
3450
|
-
relativeDirPath,
|
|
3451
|
-
relativeFilePath
|
|
3452
|
-
}) {
|
|
3453
|
-
return new _AmazonqcliMcp({
|
|
3454
|
-
baseDir,
|
|
3455
|
-
relativeDirPath,
|
|
3456
|
-
relativeFilePath,
|
|
3457
|
-
fileContent: "{}",
|
|
3458
|
-
validate: false
|
|
3459
|
-
});
|
|
3460
|
-
}
|
|
3461
|
-
};
|
|
3462
|
-
|
|
3463
|
-
// src/features/mcp/claudecode-mcp.ts
|
|
3464
|
-
import { join as join30 } from "path";
|
|
3465
|
-
|
|
3466
|
-
// src/features/mcp/modular-mcp.ts
|
|
3467
|
-
import { join as join29 } from "path";
|
|
3468
|
-
import { z as z16 } from "zod/mini";
|
|
3469
|
-
var ModularMcpServerSchema = z16.extend(McpServerSchema, {
|
|
3470
|
-
description: z16.string()
|
|
3471
|
-
// Required for modular-mcp
|
|
3472
|
-
});
|
|
3473
|
-
var ModularMcpConfigSchema = z16.object({
|
|
3474
|
-
mcpServers: z16.record(z16.string(), ModularMcpServerSchema)
|
|
3475
|
-
});
|
|
3476
|
-
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3477
|
-
json;
|
|
3478
|
-
constructor(params) {
|
|
3479
|
-
super(params);
|
|
3480
|
-
this.json = JSON.parse(this.fileContent || "{}");
|
|
3481
|
-
}
|
|
3482
|
-
getJson() {
|
|
3483
|
-
return this.json;
|
|
3484
|
-
}
|
|
3485
|
-
static getSettablePaths(params = {
|
|
3486
|
-
global: false,
|
|
3487
|
-
relativeDirPath: void 0
|
|
3488
|
-
}) {
|
|
3489
|
-
const relativeFilePath = "modular-mcp.json";
|
|
3490
|
-
if (!params.global) {
|
|
3491
|
-
return {
|
|
3492
|
-
relativeDirPath: ".",
|
|
3493
|
-
relativeFilePath
|
|
3494
|
-
};
|
|
3495
|
-
}
|
|
3496
|
-
return {
|
|
3497
|
-
relativeDirPath: params.relativeDirPath,
|
|
3498
|
-
relativeFilePath
|
|
3499
|
-
};
|
|
3500
|
-
}
|
|
3501
|
-
static getMcpServers({
|
|
3502
|
-
baseDir,
|
|
3503
|
-
global,
|
|
3504
|
-
relativeDirPath
|
|
3505
|
-
} = {
|
|
3506
|
-
baseDir: process.cwd(),
|
|
3507
|
-
global: false,
|
|
3508
|
-
relativeDirPath: void 0
|
|
3509
|
-
}) {
|
|
3510
|
-
const paths = this.getSettablePaths(
|
|
3511
|
-
global ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3512
|
-
);
|
|
3513
|
-
if (!global) {
|
|
3514
|
-
return {
|
|
3515
|
-
"modular-mcp": {
|
|
3516
|
-
type: "stdio",
|
|
3517
|
-
command: "npx",
|
|
3518
|
-
args: ["-y", "@kimuson/modular-mcp", paths.relativeFilePath],
|
|
3519
|
-
env: {}
|
|
3520
|
-
}
|
|
3521
|
-
};
|
|
3522
|
-
}
|
|
3523
|
-
return {
|
|
3524
|
-
"modular-mcp": {
|
|
3525
|
-
type: "stdio",
|
|
3526
|
-
command: "npx",
|
|
3527
|
-
args: [
|
|
3528
|
-
"-y",
|
|
3529
|
-
"@kimuson/modular-mcp",
|
|
3530
|
-
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3531
|
-
],
|
|
3532
|
-
env: {}
|
|
3533
|
-
}
|
|
3534
|
-
};
|
|
3535
|
-
}
|
|
3536
|
-
static fromRulesyncMcp({
|
|
3537
|
-
baseDir = process.cwd(),
|
|
3538
|
-
rulesyncMcp,
|
|
3539
|
-
validate = true,
|
|
3540
|
-
global = false,
|
|
3541
|
-
relativeDirPath
|
|
3542
|
-
}) {
|
|
3543
|
-
const paths = this.getSettablePaths(
|
|
3544
|
-
global && relativeDirPath ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3545
|
-
);
|
|
3546
|
-
const modularMcpJson = {
|
|
3547
|
-
mcpServers: rulesyncMcp.getMcpServers({ type: "modularized" })
|
|
3548
|
-
};
|
|
3549
|
-
return new _ModularMcp({
|
|
3550
|
-
baseDir,
|
|
3551
|
-
relativeDirPath: paths.relativeDirPath,
|
|
3552
|
-
relativeFilePath: paths.relativeFilePath,
|
|
3553
|
-
fileContent: JSON.stringify(modularMcpJson, null, 2),
|
|
3554
|
-
validate
|
|
3555
|
-
});
|
|
3556
|
-
}
|
|
3557
|
-
validate() {
|
|
3558
|
-
const result = ModularMcpConfigSchema.safeParse(this.json);
|
|
3559
|
-
if (!result.success) {
|
|
3560
|
-
return { success: false, error: result.error };
|
|
3561
|
-
}
|
|
3562
|
-
return { success: true, error: null };
|
|
3563
|
-
}
|
|
3564
|
-
};
|
|
3565
|
-
|
|
3566
3528
|
// src/features/mcp/claudecode-mcp.ts
|
|
3567
3529
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
3568
3530
|
json;
|
|
@@ -3600,7 +3562,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3600
3562
|
}) {
|
|
3601
3563
|
const paths = this.getSettablePaths({ global });
|
|
3602
3564
|
const fileContent = await readOrInitializeFileContent(
|
|
3603
|
-
|
|
3565
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3604
3566
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3605
3567
|
);
|
|
3606
3568
|
const json = JSON.parse(fileContent);
|
|
@@ -3622,7 +3584,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3622
3584
|
}) {
|
|
3623
3585
|
const paths = this.getSettablePaths({ global });
|
|
3624
3586
|
const fileContent = await readOrInitializeFileContent(
|
|
3625
|
-
|
|
3587
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3626
3588
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3627
3589
|
);
|
|
3628
3590
|
const json = JSON.parse(fileContent);
|
|
@@ -3670,7 +3632,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3670
3632
|
};
|
|
3671
3633
|
|
|
3672
3634
|
// src/features/mcp/cline-mcp.ts
|
|
3673
|
-
import { join as
|
|
3635
|
+
import { join as join30 } from "path";
|
|
3674
3636
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3675
3637
|
json;
|
|
3676
3638
|
constructor(params) {
|
|
@@ -3691,7 +3653,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3691
3653
|
validate = true
|
|
3692
3654
|
}) {
|
|
3693
3655
|
const fileContent = await readFileContent(
|
|
3694
|
-
|
|
3656
|
+
join30(
|
|
3695
3657
|
baseDir,
|
|
3696
3658
|
this.getSettablePaths().relativeDirPath,
|
|
3697
3659
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3740,7 +3702,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3740
3702
|
};
|
|
3741
3703
|
|
|
3742
3704
|
// src/features/mcp/codexcli-mcp.ts
|
|
3743
|
-
import { join as
|
|
3705
|
+
import { join as join31 } from "path";
|
|
3744
3706
|
import * as smolToml from "smol-toml";
|
|
3745
3707
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3746
3708
|
toml;
|
|
@@ -3776,7 +3738,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3776
3738
|
}) {
|
|
3777
3739
|
const paths = this.getSettablePaths({ global });
|
|
3778
3740
|
const fileContent = await readFileContent(
|
|
3779
|
-
|
|
3741
|
+
join31(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3780
3742
|
);
|
|
3781
3743
|
return new _CodexcliMcp({
|
|
3782
3744
|
baseDir,
|
|
@@ -3793,7 +3755,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3793
3755
|
global = false
|
|
3794
3756
|
}) {
|
|
3795
3757
|
const paths = this.getSettablePaths({ global });
|
|
3796
|
-
const configTomlFilePath =
|
|
3758
|
+
const configTomlFilePath = join31(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3797
3759
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3798
3760
|
configTomlFilePath,
|
|
3799
3761
|
smolToml.stringify({})
|
|
@@ -3847,7 +3809,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3847
3809
|
};
|
|
3848
3810
|
|
|
3849
3811
|
// src/features/mcp/copilot-mcp.ts
|
|
3850
|
-
import { join as
|
|
3812
|
+
import { join as join32 } from "path";
|
|
3851
3813
|
function convertToCopilotFormat(mcpServers) {
|
|
3852
3814
|
return { servers: mcpServers };
|
|
3853
3815
|
}
|
|
@@ -3874,7 +3836,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3874
3836
|
validate = true
|
|
3875
3837
|
}) {
|
|
3876
3838
|
const fileContent = await readFileContent(
|
|
3877
|
-
|
|
3839
|
+
join32(
|
|
3878
3840
|
baseDir,
|
|
3879
3841
|
this.getSettablePaths().relativeDirPath,
|
|
3880
3842
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3927,7 +3889,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3927
3889
|
};
|
|
3928
3890
|
|
|
3929
3891
|
// src/features/mcp/cursor-mcp.ts
|
|
3930
|
-
import { join as
|
|
3892
|
+
import { join as join33 } from "path";
|
|
3931
3893
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3932
3894
|
json;
|
|
3933
3895
|
constructor(params) {
|
|
@@ -3948,7 +3910,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3948
3910
|
validate = true
|
|
3949
3911
|
}) {
|
|
3950
3912
|
const fileContent = await readFileContent(
|
|
3951
|
-
|
|
3913
|
+
join33(
|
|
3952
3914
|
baseDir,
|
|
3953
3915
|
this.getSettablePaths().relativeDirPath,
|
|
3954
3916
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4008,7 +3970,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4008
3970
|
};
|
|
4009
3971
|
|
|
4010
3972
|
// src/features/mcp/geminicli-mcp.ts
|
|
4011
|
-
import { join as
|
|
3973
|
+
import { join as join34 } from "path";
|
|
4012
3974
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4013
3975
|
json;
|
|
4014
3976
|
constructor(params) {
|
|
@@ -4037,7 +3999,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4037
3999
|
}) {
|
|
4038
4000
|
const paths = this.getSettablePaths({ global });
|
|
4039
4001
|
const fileContent = await readOrInitializeFileContent(
|
|
4040
|
-
|
|
4002
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4041
4003
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4042
4004
|
);
|
|
4043
4005
|
const json = JSON.parse(fileContent);
|
|
@@ -4058,7 +4020,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4058
4020
|
}) {
|
|
4059
4021
|
const paths = this.getSettablePaths({ global });
|
|
4060
4022
|
const fileContent = await readOrInitializeFileContent(
|
|
4061
|
-
|
|
4023
|
+
join34(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4062
4024
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4063
4025
|
);
|
|
4064
4026
|
const json = JSON.parse(fileContent);
|
|
@@ -4095,7 +4057,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4095
4057
|
};
|
|
4096
4058
|
|
|
4097
4059
|
// src/features/mcp/junie-mcp.ts
|
|
4098
|
-
import { join as
|
|
4060
|
+
import { join as join35 } from "path";
|
|
4099
4061
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4100
4062
|
json;
|
|
4101
4063
|
constructor(params) {
|
|
@@ -4107,7 +4069,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4107
4069
|
}
|
|
4108
4070
|
static getSettablePaths() {
|
|
4109
4071
|
return {
|
|
4110
|
-
relativeDirPath:
|
|
4072
|
+
relativeDirPath: join35(".junie", "mcp"),
|
|
4111
4073
|
relativeFilePath: "mcp.json"
|
|
4112
4074
|
};
|
|
4113
4075
|
}
|
|
@@ -4116,7 +4078,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4116
4078
|
validate = true
|
|
4117
4079
|
}) {
|
|
4118
4080
|
const fileContent = await readFileContent(
|
|
4119
|
-
|
|
4081
|
+
join35(
|
|
4120
4082
|
baseDir,
|
|
4121
4083
|
this.getSettablePaths().relativeDirPath,
|
|
4122
4084
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4165,7 +4127,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4165
4127
|
};
|
|
4166
4128
|
|
|
4167
4129
|
// src/features/mcp/opencode-mcp.ts
|
|
4168
|
-
import { join as
|
|
4130
|
+
import { join as join36 } from "path";
|
|
4169
4131
|
import { z as z17 } from "zod/mini";
|
|
4170
4132
|
var OpencodeMcpLocalServerSchema = z17.object({
|
|
4171
4133
|
type: z17.literal("local"),
|
|
@@ -4289,7 +4251,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4289
4251
|
}) {
|
|
4290
4252
|
const paths = this.getSettablePaths({ global });
|
|
4291
4253
|
const fileContent = await readOrInitializeFileContent(
|
|
4292
|
-
|
|
4254
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4293
4255
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4294
4256
|
);
|
|
4295
4257
|
const json = JSON.parse(fileContent);
|
|
@@ -4310,7 +4272,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4310
4272
|
}) {
|
|
4311
4273
|
const paths = this.getSettablePaths({ global });
|
|
4312
4274
|
const fileContent = await readOrInitializeFileContent(
|
|
4313
|
-
|
|
4275
|
+
join36(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4314
4276
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4315
4277
|
);
|
|
4316
4278
|
const json = JSON.parse(fileContent);
|
|
@@ -4354,7 +4316,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4354
4316
|
};
|
|
4355
4317
|
|
|
4356
4318
|
// src/features/mcp/roo-mcp.ts
|
|
4357
|
-
import { join as
|
|
4319
|
+
import { join as join37 } from "path";
|
|
4358
4320
|
function isRooMcpServers(value) {
|
|
4359
4321
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4360
4322
|
}
|
|
@@ -4406,7 +4368,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4406
4368
|
validate = true
|
|
4407
4369
|
}) {
|
|
4408
4370
|
const fileContent = await readFileContent(
|
|
4409
|
-
|
|
4371
|
+
join37(
|
|
4410
4372
|
baseDir,
|
|
4411
4373
|
this.getSettablePaths().relativeDirPath,
|
|
4412
4374
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4463,8 +4425,8 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4463
4425
|
|
|
4464
4426
|
// src/features/mcp/mcp-processor.ts
|
|
4465
4427
|
var mcpProcessorToolTargetTuple = [
|
|
4466
|
-
"amazonqcli",
|
|
4467
4428
|
"claudecode",
|
|
4429
|
+
"claudecode-legacy",
|
|
4468
4430
|
"cline",
|
|
4469
4431
|
"codexcli",
|
|
4470
4432
|
"copilot",
|
|
@@ -4477,14 +4439,14 @@ var mcpProcessorToolTargetTuple = [
|
|
|
4477
4439
|
var McpProcessorToolTargetSchema = z18.enum(mcpProcessorToolTargetTuple);
|
|
4478
4440
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
4479
4441
|
[
|
|
4480
|
-
"
|
|
4442
|
+
"claudecode",
|
|
4481
4443
|
{
|
|
4482
|
-
class:
|
|
4483
|
-
meta: { supportsProject: true, supportsGlobal:
|
|
4444
|
+
class: ClaudecodeMcp,
|
|
4445
|
+
meta: { supportsProject: true, supportsGlobal: true, supportsModular: true }
|
|
4484
4446
|
}
|
|
4485
4447
|
],
|
|
4486
4448
|
[
|
|
4487
|
-
"claudecode",
|
|
4449
|
+
"claudecode-legacy",
|
|
4488
4450
|
{
|
|
4489
4451
|
class: ClaudecodeMcp,
|
|
4490
4452
|
meta: { supportsProject: true, supportsGlobal: true, supportsModular: true }
|
|
@@ -4704,25 +4666,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4704
4666
|
};
|
|
4705
4667
|
|
|
4706
4668
|
// src/features/rules/rules-processor.ts
|
|
4707
|
-
import { basename as
|
|
4669
|
+
import { basename as basename22, join as join83 } from "path";
|
|
4708
4670
|
import { encode } from "@toon-format/toon";
|
|
4709
|
-
import { z as
|
|
4671
|
+
import { z as z40 } from "zod/mini";
|
|
4710
4672
|
|
|
4711
4673
|
// src/constants/general.ts
|
|
4712
4674
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4713
4675
|
|
|
4714
4676
|
// src/features/skills/agentsmd-skill.ts
|
|
4715
|
-
import { join as
|
|
4677
|
+
import { join as join41 } from "path";
|
|
4716
4678
|
|
|
4717
4679
|
// src/features/skills/simulated-skill.ts
|
|
4718
|
-
import { join as
|
|
4680
|
+
import { join as join40 } from "path";
|
|
4719
4681
|
import { z as z19 } from "zod/mini";
|
|
4720
4682
|
|
|
4721
4683
|
// src/features/skills/tool-skill.ts
|
|
4722
|
-
import { join as
|
|
4684
|
+
import { join as join39 } from "path";
|
|
4723
4685
|
|
|
4724
4686
|
// src/types/ai-dir.ts
|
|
4725
|
-
import path2, { basename as
|
|
4687
|
+
import path2, { basename as basename14, join as join38, relative as relative3, resolve as resolve4 } from "path";
|
|
4726
4688
|
var AiDir = class {
|
|
4727
4689
|
/**
|
|
4728
4690
|
* @example "."
|
|
@@ -4816,10 +4778,10 @@ var AiDir = class {
|
|
|
4816
4778
|
* @returns Array of files with their relative paths and buffers
|
|
4817
4779
|
*/
|
|
4818
4780
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
4819
|
-
const dirPath =
|
|
4820
|
-
const glob =
|
|
4781
|
+
const dirPath = join38(baseDir, relativeDirPath, dirName);
|
|
4782
|
+
const glob = join38(dirPath, "**", "*");
|
|
4821
4783
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
4822
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
4784
|
+
const filteredPaths = filePaths.filter((filePath) => basename14(filePath) !== excludeFileName);
|
|
4823
4785
|
const files = await Promise.all(
|
|
4824
4786
|
filteredPaths.map(async (filePath) => {
|
|
4825
4787
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -4915,8 +4877,8 @@ var ToolSkill = class extends AiDir {
|
|
|
4915
4877
|
}) {
|
|
4916
4878
|
const settablePaths = getSettablePaths({ global });
|
|
4917
4879
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4918
|
-
const skillDirPath =
|
|
4919
|
-
const skillFilePath =
|
|
4880
|
+
const skillDirPath = join39(baseDir, actualRelativeDirPath, dirName);
|
|
4881
|
+
const skillFilePath = join39(skillDirPath, SKILL_FILE_NAME);
|
|
4920
4882
|
if (!await fileExists(skillFilePath)) {
|
|
4921
4883
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4922
4884
|
}
|
|
@@ -4974,7 +4936,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4974
4936
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4975
4937
|
if (!result.success) {
|
|
4976
4938
|
throw new Error(
|
|
4977
|
-
`Invalid frontmatter in ${
|
|
4939
|
+
`Invalid frontmatter in ${join40(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
4978
4940
|
);
|
|
4979
4941
|
}
|
|
4980
4942
|
}
|
|
@@ -5032,8 +4994,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5032
4994
|
}) {
|
|
5033
4995
|
const settablePaths = this.getSettablePaths();
|
|
5034
4996
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5035
|
-
const skillDirPath =
|
|
5036
|
-
const skillFilePath =
|
|
4997
|
+
const skillDirPath = join40(baseDir, actualRelativeDirPath, dirName);
|
|
4998
|
+
const skillFilePath = join40(skillDirPath, SKILL_FILE_NAME);
|
|
5037
4999
|
if (!await fileExists(skillFilePath)) {
|
|
5038
5000
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5039
5001
|
}
|
|
@@ -5110,7 +5072,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5110
5072
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5111
5073
|
}
|
|
5112
5074
|
return {
|
|
5113
|
-
relativeDirPath:
|
|
5075
|
+
relativeDirPath: join41(".agents", "skills")
|
|
5114
5076
|
};
|
|
5115
5077
|
}
|
|
5116
5078
|
static async fromDir(params) {
|
|
@@ -5137,14 +5099,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5137
5099
|
};
|
|
5138
5100
|
|
|
5139
5101
|
// src/features/skills/geminicli-skill.ts
|
|
5140
|
-
import { join as
|
|
5102
|
+
import { join as join42 } from "path";
|
|
5141
5103
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5142
5104
|
static getSettablePaths(options) {
|
|
5143
5105
|
if (options?.global) {
|
|
5144
5106
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5145
5107
|
}
|
|
5146
5108
|
return {
|
|
5147
|
-
relativeDirPath:
|
|
5109
|
+
relativeDirPath: join42(".gemini", "skills")
|
|
5148
5110
|
};
|
|
5149
5111
|
}
|
|
5150
5112
|
static async fromDir(params) {
|
|
@@ -5171,11 +5133,11 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5171
5133
|
};
|
|
5172
5134
|
|
|
5173
5135
|
// src/features/skills/skills-processor.ts
|
|
5174
|
-
import { basename as
|
|
5175
|
-
import { z as
|
|
5136
|
+
import { basename as basename15, join as join51 } from "path";
|
|
5137
|
+
import { z as z27 } from "zod/mini";
|
|
5176
5138
|
|
|
5177
5139
|
// src/types/dir-feature-processor.ts
|
|
5178
|
-
import { join as
|
|
5140
|
+
import { join as join43 } from "path";
|
|
5179
5141
|
var DirFeatureProcessor = class {
|
|
5180
5142
|
baseDir;
|
|
5181
5143
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5197,14 +5159,14 @@ var DirFeatureProcessor = class {
|
|
|
5197
5159
|
await ensureDir(dirPath);
|
|
5198
5160
|
const mainFile = aiDir.getMainFile();
|
|
5199
5161
|
if (mainFile) {
|
|
5200
|
-
const mainFilePath =
|
|
5162
|
+
const mainFilePath = join43(dirPath, mainFile.name);
|
|
5201
5163
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5202
5164
|
const contentWithNewline = addTrailingNewline(content);
|
|
5203
5165
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5204
5166
|
}
|
|
5205
5167
|
const otherFiles = aiDir.getOtherFiles();
|
|
5206
5168
|
for (const file of otherFiles) {
|
|
5207
|
-
const filePath =
|
|
5169
|
+
const filePath = join43(dirPath, file.relativeFilePathToDirPath);
|
|
5208
5170
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5209
5171
|
await writeFileContent(filePath, contentWithNewline);
|
|
5210
5172
|
}
|
|
@@ -5219,11 +5181,11 @@ var DirFeatureProcessor = class {
|
|
|
5219
5181
|
};
|
|
5220
5182
|
|
|
5221
5183
|
// src/features/skills/claudecode-skill.ts
|
|
5222
|
-
import { join as
|
|
5184
|
+
import { join as join45 } from "path";
|
|
5223
5185
|
import { z as z21 } from "zod/mini";
|
|
5224
5186
|
|
|
5225
5187
|
// src/features/skills/rulesync-skill.ts
|
|
5226
|
-
import { join as
|
|
5188
|
+
import { join as join44 } from "path";
|
|
5227
5189
|
import { z as z20 } from "zod/mini";
|
|
5228
5190
|
var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
5229
5191
|
name: z20.string(),
|
|
@@ -5243,7 +5205,8 @@ var RulesyncSkillFrontmatterSchemaInternal = z20.looseObject({
|
|
|
5243
5205
|
z20.looseObject({
|
|
5244
5206
|
license: z20.optional(z20.string())
|
|
5245
5207
|
})
|
|
5246
|
-
)
|
|
5208
|
+
),
|
|
5209
|
+
roo: z20.optional(z20.looseObject({}))
|
|
5247
5210
|
});
|
|
5248
5211
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
5249
5212
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -5309,8 +5272,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5309
5272
|
dirName,
|
|
5310
5273
|
global = false
|
|
5311
5274
|
}) {
|
|
5312
|
-
const skillDirPath =
|
|
5313
|
-
const skillFilePath =
|
|
5275
|
+
const skillDirPath = join44(baseDir, relativeDirPath, dirName);
|
|
5276
|
+
const skillFilePath = join44(skillDirPath, SKILL_FILE_NAME);
|
|
5314
5277
|
if (!await fileExists(skillFilePath)) {
|
|
5315
5278
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5316
5279
|
}
|
|
@@ -5348,7 +5311,7 @@ var ClaudecodeSkillFrontmatterSchema = z21.looseObject({
|
|
|
5348
5311
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5349
5312
|
constructor({
|
|
5350
5313
|
baseDir = process.cwd(),
|
|
5351
|
-
relativeDirPath =
|
|
5314
|
+
relativeDirPath = join45(".claude", "skills"),
|
|
5352
5315
|
dirName,
|
|
5353
5316
|
frontmatter,
|
|
5354
5317
|
body,
|
|
@@ -5379,7 +5342,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5379
5342
|
global: _global = false
|
|
5380
5343
|
} = {}) {
|
|
5381
5344
|
return {
|
|
5382
|
-
relativeDirPath:
|
|
5345
|
+
relativeDirPath: join45(".claude", "skills")
|
|
5383
5346
|
};
|
|
5384
5347
|
}
|
|
5385
5348
|
getFrontmatter() {
|
|
@@ -5467,9 +5430,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5467
5430
|
});
|
|
5468
5431
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5469
5432
|
if (!result.success) {
|
|
5470
|
-
const skillDirPath =
|
|
5433
|
+
const skillDirPath = join45(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5471
5434
|
throw new Error(
|
|
5472
|
-
`Invalid frontmatter in ${
|
|
5435
|
+
`Invalid frontmatter in ${join45(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5473
5436
|
);
|
|
5474
5437
|
}
|
|
5475
5438
|
return new _ClaudecodeSkill({
|
|
@@ -5503,7 +5466,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5503
5466
|
};
|
|
5504
5467
|
|
|
5505
5468
|
// src/features/skills/codexcli-skill.ts
|
|
5506
|
-
import { join as
|
|
5469
|
+
import { join as join46 } from "path";
|
|
5507
5470
|
import { z as z22 } from "zod/mini";
|
|
5508
5471
|
var CodexCliSkillFrontmatterSchema = z22.looseObject({
|
|
5509
5472
|
name: z22.string(),
|
|
@@ -5512,7 +5475,7 @@ var CodexCliSkillFrontmatterSchema = z22.looseObject({
|
|
|
5512
5475
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5513
5476
|
constructor({
|
|
5514
5477
|
baseDir = process.cwd(),
|
|
5515
|
-
relativeDirPath =
|
|
5478
|
+
relativeDirPath = join46(".codex", "skills"),
|
|
5516
5479
|
dirName,
|
|
5517
5480
|
frontmatter,
|
|
5518
5481
|
body,
|
|
@@ -5544,7 +5507,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5544
5507
|
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
5545
5508
|
}
|
|
5546
5509
|
return {
|
|
5547
|
-
relativeDirPath:
|
|
5510
|
+
relativeDirPath: join46(".codex", "skills")
|
|
5548
5511
|
};
|
|
5549
5512
|
}
|
|
5550
5513
|
getFrontmatter() {
|
|
@@ -5626,9 +5589,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5626
5589
|
});
|
|
5627
5590
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5628
5591
|
if (!result.success) {
|
|
5629
|
-
const skillDirPath =
|
|
5592
|
+
const skillDirPath = join46(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5630
5593
|
throw new Error(
|
|
5631
|
-
`Invalid frontmatter in ${
|
|
5594
|
+
`Invalid frontmatter in ${join46(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5632
5595
|
);
|
|
5633
5596
|
}
|
|
5634
5597
|
return new _CodexCliSkill({
|
|
@@ -5662,7 +5625,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5662
5625
|
};
|
|
5663
5626
|
|
|
5664
5627
|
// src/features/skills/copilot-skill.ts
|
|
5665
|
-
import { join as
|
|
5628
|
+
import { join as join47 } from "path";
|
|
5666
5629
|
import { z as z23 } from "zod/mini";
|
|
5667
5630
|
var CopilotSkillFrontmatterSchema = z23.looseObject({
|
|
5668
5631
|
name: z23.string(),
|
|
@@ -5672,7 +5635,7 @@ var CopilotSkillFrontmatterSchema = z23.looseObject({
|
|
|
5672
5635
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5673
5636
|
constructor({
|
|
5674
5637
|
baseDir = process.cwd(),
|
|
5675
|
-
relativeDirPath =
|
|
5638
|
+
relativeDirPath = join47(".github", "skills"),
|
|
5676
5639
|
dirName,
|
|
5677
5640
|
frontmatter,
|
|
5678
5641
|
body,
|
|
@@ -5704,7 +5667,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5704
5667
|
throw new Error("CopilotSkill does not support global mode.");
|
|
5705
5668
|
}
|
|
5706
5669
|
return {
|
|
5707
|
-
relativeDirPath:
|
|
5670
|
+
relativeDirPath: join47(".github", "skills")
|
|
5708
5671
|
};
|
|
5709
5672
|
}
|
|
5710
5673
|
getFrontmatter() {
|
|
@@ -5792,9 +5755,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5792
5755
|
});
|
|
5793
5756
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5794
5757
|
if (!result.success) {
|
|
5795
|
-
const skillDirPath =
|
|
5758
|
+
const skillDirPath = join47(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5796
5759
|
throw new Error(
|
|
5797
|
-
`Invalid frontmatter in ${
|
|
5760
|
+
`Invalid frontmatter in ${join47(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5798
5761
|
);
|
|
5799
5762
|
}
|
|
5800
5763
|
return new _CopilotSkill({
|
|
@@ -5829,7 +5792,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5829
5792
|
};
|
|
5830
5793
|
|
|
5831
5794
|
// src/features/skills/cursor-skill.ts
|
|
5832
|
-
import { join as
|
|
5795
|
+
import { join as join48 } from "path";
|
|
5833
5796
|
import { z as z24 } from "zod/mini";
|
|
5834
5797
|
var CursorSkillFrontmatterSchema = z24.looseObject({
|
|
5835
5798
|
name: z24.string(),
|
|
@@ -5838,7 +5801,7 @@ var CursorSkillFrontmatterSchema = z24.looseObject({
|
|
|
5838
5801
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
5839
5802
|
constructor({
|
|
5840
5803
|
baseDir = process.cwd(),
|
|
5841
|
-
relativeDirPath =
|
|
5804
|
+
relativeDirPath = join48(".cursor", "skills"),
|
|
5842
5805
|
dirName,
|
|
5843
5806
|
frontmatter,
|
|
5844
5807
|
body,
|
|
@@ -5870,7 +5833,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5870
5833
|
throw new Error("CursorSkill does not support global mode.");
|
|
5871
5834
|
}
|
|
5872
5835
|
return {
|
|
5873
|
-
relativeDirPath:
|
|
5836
|
+
relativeDirPath: join48(".cursor", "skills")
|
|
5874
5837
|
};
|
|
5875
5838
|
}
|
|
5876
5839
|
getFrontmatter() {
|
|
@@ -5948,16 +5911,180 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5948
5911
|
static async fromDir(params) {
|
|
5949
5912
|
const loaded = await this.loadSkillDirContent({
|
|
5950
5913
|
...params,
|
|
5951
|
-
getSettablePaths: _CursorSkill.getSettablePaths
|
|
5914
|
+
getSettablePaths: _CursorSkill.getSettablePaths
|
|
5915
|
+
});
|
|
5916
|
+
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5917
|
+
if (!result.success) {
|
|
5918
|
+
const skillDirPath = join48(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5919
|
+
throw new Error(
|
|
5920
|
+
`Invalid frontmatter in ${join48(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5921
|
+
);
|
|
5922
|
+
}
|
|
5923
|
+
return new _CursorSkill({
|
|
5924
|
+
baseDir: loaded.baseDir,
|
|
5925
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
5926
|
+
dirName: loaded.dirName,
|
|
5927
|
+
frontmatter: result.data,
|
|
5928
|
+
body: loaded.body,
|
|
5929
|
+
otherFiles: loaded.otherFiles,
|
|
5930
|
+
validate: true,
|
|
5931
|
+
global: loaded.global
|
|
5932
|
+
});
|
|
5933
|
+
}
|
|
5934
|
+
static forDeletion({
|
|
5935
|
+
baseDir = process.cwd(),
|
|
5936
|
+
relativeDirPath,
|
|
5937
|
+
dirName,
|
|
5938
|
+
global = false
|
|
5939
|
+
}) {
|
|
5940
|
+
const settablePaths = _CursorSkill.getSettablePaths({ global });
|
|
5941
|
+
return new _CursorSkill({
|
|
5942
|
+
baseDir,
|
|
5943
|
+
relativeDirPath: relativeDirPath ?? settablePaths.relativeDirPath,
|
|
5944
|
+
dirName,
|
|
5945
|
+
frontmatter: { name: "", description: "" },
|
|
5946
|
+
body: "",
|
|
5947
|
+
otherFiles: [],
|
|
5948
|
+
validate: false,
|
|
5949
|
+
global
|
|
5950
|
+
});
|
|
5951
|
+
}
|
|
5952
|
+
};
|
|
5953
|
+
|
|
5954
|
+
// src/features/skills/opencode-skill.ts
|
|
5955
|
+
import { join as join49 } from "path";
|
|
5956
|
+
import { z as z25 } from "zod/mini";
|
|
5957
|
+
var OpenCodeSkillFrontmatterSchema = z25.looseObject({
|
|
5958
|
+
name: z25.string(),
|
|
5959
|
+
description: z25.string(),
|
|
5960
|
+
"allowed-tools": z25.optional(z25.array(z25.string()))
|
|
5961
|
+
});
|
|
5962
|
+
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
5963
|
+
constructor({
|
|
5964
|
+
baseDir = process.cwd(),
|
|
5965
|
+
relativeDirPath = join49(".opencode", "skill"),
|
|
5966
|
+
dirName,
|
|
5967
|
+
frontmatter,
|
|
5968
|
+
body,
|
|
5969
|
+
otherFiles = [],
|
|
5970
|
+
validate = true,
|
|
5971
|
+
global = false
|
|
5972
|
+
}) {
|
|
5973
|
+
super({
|
|
5974
|
+
baseDir,
|
|
5975
|
+
relativeDirPath,
|
|
5976
|
+
dirName,
|
|
5977
|
+
mainFile: {
|
|
5978
|
+
name: SKILL_FILE_NAME,
|
|
5979
|
+
body,
|
|
5980
|
+
frontmatter: { ...frontmatter }
|
|
5981
|
+
},
|
|
5982
|
+
otherFiles,
|
|
5983
|
+
global
|
|
5984
|
+
});
|
|
5985
|
+
if (validate) {
|
|
5986
|
+
const result = this.validate();
|
|
5987
|
+
if (!result.success) {
|
|
5988
|
+
throw result.error;
|
|
5989
|
+
}
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
5992
|
+
static getSettablePaths({ global = false } = {}) {
|
|
5993
|
+
return {
|
|
5994
|
+
relativeDirPath: global ? join49(".config", "opencode", "skill") : join49(".opencode", "skill")
|
|
5995
|
+
};
|
|
5996
|
+
}
|
|
5997
|
+
getFrontmatter() {
|
|
5998
|
+
if (!this.mainFile?.frontmatter) {
|
|
5999
|
+
throw new Error("Frontmatter is not defined");
|
|
6000
|
+
}
|
|
6001
|
+
const result = OpenCodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
6002
|
+
return result;
|
|
6003
|
+
}
|
|
6004
|
+
getBody() {
|
|
6005
|
+
return this.mainFile?.body ?? "";
|
|
6006
|
+
}
|
|
6007
|
+
validate() {
|
|
6008
|
+
if (this.mainFile === void 0) {
|
|
6009
|
+
return {
|
|
6010
|
+
success: false,
|
|
6011
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
6012
|
+
};
|
|
6013
|
+
}
|
|
6014
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
6015
|
+
if (!result.success) {
|
|
6016
|
+
return {
|
|
6017
|
+
success: false,
|
|
6018
|
+
error: new Error(
|
|
6019
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
6020
|
+
)
|
|
6021
|
+
};
|
|
6022
|
+
}
|
|
6023
|
+
return { success: true, error: null };
|
|
6024
|
+
}
|
|
6025
|
+
toRulesyncSkill() {
|
|
6026
|
+
const frontmatter = this.getFrontmatter();
|
|
6027
|
+
const rulesyncFrontmatter = {
|
|
6028
|
+
name: frontmatter.name,
|
|
6029
|
+
description: frontmatter.description,
|
|
6030
|
+
targets: ["*"],
|
|
6031
|
+
...frontmatter["allowed-tools"] && {
|
|
6032
|
+
opencode: {
|
|
6033
|
+
"allowed-tools": frontmatter["allowed-tools"]
|
|
6034
|
+
}
|
|
6035
|
+
}
|
|
6036
|
+
};
|
|
6037
|
+
return new RulesyncSkill({
|
|
6038
|
+
baseDir: this.baseDir,
|
|
6039
|
+
relativeDirPath: this.relativeDirPath,
|
|
6040
|
+
dirName: this.getDirName(),
|
|
6041
|
+
frontmatter: rulesyncFrontmatter,
|
|
6042
|
+
body: this.getBody(),
|
|
6043
|
+
otherFiles: this.getOtherFiles(),
|
|
6044
|
+
validate: true,
|
|
6045
|
+
global: this.global
|
|
6046
|
+
});
|
|
6047
|
+
}
|
|
6048
|
+
static fromRulesyncSkill({
|
|
6049
|
+
rulesyncSkill,
|
|
6050
|
+
validate = true,
|
|
6051
|
+
global = false
|
|
6052
|
+
}) {
|
|
6053
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
6054
|
+
const opencodeFrontmatter = {
|
|
6055
|
+
name: rulesyncFrontmatter.name,
|
|
6056
|
+
description: rulesyncFrontmatter.description,
|
|
6057
|
+
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
6058
|
+
};
|
|
6059
|
+
const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
|
|
6060
|
+
return new _OpenCodeSkill({
|
|
6061
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
6062
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
6063
|
+
dirName: rulesyncSkill.getDirName(),
|
|
6064
|
+
frontmatter: opencodeFrontmatter,
|
|
6065
|
+
body: rulesyncSkill.getBody(),
|
|
6066
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
6067
|
+
validate,
|
|
6068
|
+
global
|
|
6069
|
+
});
|
|
6070
|
+
}
|
|
6071
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
6072
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
6073
|
+
return targets.includes("*") || targets.includes("opencode");
|
|
6074
|
+
}
|
|
6075
|
+
static async fromDir(params) {
|
|
6076
|
+
const loaded = await this.loadSkillDirContent({
|
|
6077
|
+
...params,
|
|
6078
|
+
getSettablePaths: _OpenCodeSkill.getSettablePaths
|
|
5952
6079
|
});
|
|
5953
|
-
const result =
|
|
6080
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5954
6081
|
if (!result.success) {
|
|
5955
6082
|
const skillDirPath = join49(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5956
6083
|
throw new Error(
|
|
5957
6084
|
`Invalid frontmatter in ${join49(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5958
6085
|
);
|
|
5959
6086
|
}
|
|
5960
|
-
return new
|
|
6087
|
+
return new _OpenCodeSkill({
|
|
5961
6088
|
baseDir: loaded.baseDir,
|
|
5962
6089
|
relativeDirPath: loaded.relativeDirPath,
|
|
5963
6090
|
dirName: loaded.dirName,
|
|
@@ -5974,10 +6101,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5974
6101
|
dirName,
|
|
5975
6102
|
global = false
|
|
5976
6103
|
}) {
|
|
5977
|
-
|
|
5978
|
-
return new _CursorSkill({
|
|
6104
|
+
return new _OpenCodeSkill({
|
|
5979
6105
|
baseDir,
|
|
5980
|
-
relativeDirPath
|
|
6106
|
+
relativeDirPath,
|
|
5981
6107
|
dirName,
|
|
5982
6108
|
frontmatter: { name: "", description: "" },
|
|
5983
6109
|
body: "",
|
|
@@ -5988,18 +6114,17 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5988
6114
|
}
|
|
5989
6115
|
};
|
|
5990
6116
|
|
|
5991
|
-
// src/features/skills/
|
|
6117
|
+
// src/features/skills/roo-skill.ts
|
|
5992
6118
|
import { join as join50 } from "path";
|
|
5993
|
-
import { z as
|
|
5994
|
-
var
|
|
5995
|
-
name:
|
|
5996
|
-
description:
|
|
5997
|
-
"allowed-tools": z25.optional(z25.array(z25.string()))
|
|
6119
|
+
import { z as z26 } from "zod/mini";
|
|
6120
|
+
var RooSkillFrontmatterSchema = z26.looseObject({
|
|
6121
|
+
name: z26.string(),
|
|
6122
|
+
description: z26.string()
|
|
5998
6123
|
});
|
|
5999
|
-
var
|
|
6124
|
+
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6000
6125
|
constructor({
|
|
6001
6126
|
baseDir = process.cwd(),
|
|
6002
|
-
relativeDirPath = join50(".
|
|
6127
|
+
relativeDirPath = join50(".roo", "skills"),
|
|
6003
6128
|
dirName,
|
|
6004
6129
|
frontmatter,
|
|
6005
6130
|
body,
|
|
@@ -6026,29 +6151,31 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6026
6151
|
}
|
|
6027
6152
|
}
|
|
6028
6153
|
}
|
|
6029
|
-
static getSettablePaths({
|
|
6154
|
+
static getSettablePaths({
|
|
6155
|
+
global: _global = false
|
|
6156
|
+
} = {}) {
|
|
6030
6157
|
return {
|
|
6031
|
-
relativeDirPath:
|
|
6158
|
+
relativeDirPath: join50(".roo", "skills")
|
|
6032
6159
|
};
|
|
6033
6160
|
}
|
|
6034
6161
|
getFrontmatter() {
|
|
6035
6162
|
if (!this.mainFile?.frontmatter) {
|
|
6036
6163
|
throw new Error("Frontmatter is not defined");
|
|
6037
6164
|
}
|
|
6038
|
-
const result =
|
|
6165
|
+
const result = RooSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
6039
6166
|
return result;
|
|
6040
6167
|
}
|
|
6041
6168
|
getBody() {
|
|
6042
6169
|
return this.mainFile?.body ?? "";
|
|
6043
6170
|
}
|
|
6044
6171
|
validate() {
|
|
6045
|
-
if (this.mainFile
|
|
6172
|
+
if (!this.mainFile) {
|
|
6046
6173
|
return {
|
|
6047
6174
|
success: false,
|
|
6048
6175
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
6049
6176
|
};
|
|
6050
6177
|
}
|
|
6051
|
-
const result =
|
|
6178
|
+
const result = RooSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
6052
6179
|
if (!result.success) {
|
|
6053
6180
|
return {
|
|
6054
6181
|
success: false,
|
|
@@ -6057,6 +6184,14 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6057
6184
|
)
|
|
6058
6185
|
};
|
|
6059
6186
|
}
|
|
6187
|
+
if (result.data.name !== this.getDirName()) {
|
|
6188
|
+
return {
|
|
6189
|
+
success: false,
|
|
6190
|
+
error: new Error(
|
|
6191
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
6192
|
+
)
|
|
6193
|
+
};
|
|
6194
|
+
}
|
|
6060
6195
|
return { success: true, error: null };
|
|
6061
6196
|
}
|
|
6062
6197
|
toRulesyncSkill() {
|
|
@@ -6064,12 +6199,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6064
6199
|
const rulesyncFrontmatter = {
|
|
6065
6200
|
name: frontmatter.name,
|
|
6066
6201
|
description: frontmatter.description,
|
|
6067
|
-
targets: ["*"]
|
|
6068
|
-
...frontmatter["allowed-tools"] && {
|
|
6069
|
-
opencode: {
|
|
6070
|
-
"allowed-tools": frontmatter["allowed-tools"]
|
|
6071
|
-
}
|
|
6072
|
-
}
|
|
6202
|
+
targets: ["*"]
|
|
6073
6203
|
};
|
|
6074
6204
|
return new RulesyncSkill({
|
|
6075
6205
|
baseDir: this.baseDir,
|
|
@@ -6087,18 +6217,17 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6087
6217
|
validate = true,
|
|
6088
6218
|
global = false
|
|
6089
6219
|
}) {
|
|
6220
|
+
const settablePaths = _RooSkill.getSettablePaths({ global });
|
|
6090
6221
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
6091
|
-
const
|
|
6222
|
+
const rooFrontmatter = {
|
|
6092
6223
|
name: rulesyncFrontmatter.name,
|
|
6093
|
-
description: rulesyncFrontmatter.description
|
|
6094
|
-
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
6224
|
+
description: rulesyncFrontmatter.description
|
|
6095
6225
|
};
|
|
6096
|
-
|
|
6097
|
-
return new _OpenCodeSkill({
|
|
6226
|
+
return new _RooSkill({
|
|
6098
6227
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
6099
6228
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
6100
|
-
dirName:
|
|
6101
|
-
frontmatter:
|
|
6229
|
+
dirName: rooFrontmatter.name,
|
|
6230
|
+
frontmatter: rooFrontmatter,
|
|
6102
6231
|
body: rulesyncSkill.getBody(),
|
|
6103
6232
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
6104
6233
|
validate,
|
|
@@ -6107,21 +6236,32 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6107
6236
|
}
|
|
6108
6237
|
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
6109
6238
|
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
6110
|
-
return targets.includes("*") || targets.includes("
|
|
6239
|
+
return targets.includes("*") || targets.includes("roo");
|
|
6111
6240
|
}
|
|
6112
6241
|
static async fromDir(params) {
|
|
6113
6242
|
const loaded = await this.loadSkillDirContent({
|
|
6114
6243
|
...params,
|
|
6115
|
-
getSettablePaths:
|
|
6244
|
+
getSettablePaths: _RooSkill.getSettablePaths
|
|
6116
6245
|
});
|
|
6117
|
-
const result =
|
|
6246
|
+
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6118
6247
|
if (!result.success) {
|
|
6119
6248
|
const skillDirPath = join50(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6120
6249
|
throw new Error(
|
|
6121
6250
|
`Invalid frontmatter in ${join50(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6122
6251
|
);
|
|
6123
6252
|
}
|
|
6124
|
-
|
|
6253
|
+
if (result.data.name !== loaded.dirName) {
|
|
6254
|
+
const skillFilePath = join50(
|
|
6255
|
+
loaded.baseDir,
|
|
6256
|
+
loaded.relativeDirPath,
|
|
6257
|
+
loaded.dirName,
|
|
6258
|
+
SKILL_FILE_NAME
|
|
6259
|
+
);
|
|
6260
|
+
throw new Error(
|
|
6261
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
6262
|
+
);
|
|
6263
|
+
}
|
|
6264
|
+
return new _RooSkill({
|
|
6125
6265
|
baseDir: loaded.baseDir,
|
|
6126
6266
|
relativeDirPath: loaded.relativeDirPath,
|
|
6127
6267
|
dirName: loaded.dirName,
|
|
@@ -6138,7 +6278,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6138
6278
|
dirName,
|
|
6139
6279
|
global = false
|
|
6140
6280
|
}) {
|
|
6141
|
-
return new
|
|
6281
|
+
return new _RooSkill({
|
|
6142
6282
|
baseDir,
|
|
6143
6283
|
relativeDirPath,
|
|
6144
6284
|
dirName,
|
|
@@ -6155,13 +6295,15 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6155
6295
|
var skillsProcessorToolTargetTuple = [
|
|
6156
6296
|
"agentsmd",
|
|
6157
6297
|
"claudecode",
|
|
6298
|
+
"claudecode-legacy",
|
|
6158
6299
|
"codexcli",
|
|
6159
6300
|
"copilot",
|
|
6160
6301
|
"cursor",
|
|
6161
6302
|
"geminicli",
|
|
6162
|
-
"opencode"
|
|
6303
|
+
"opencode",
|
|
6304
|
+
"roo"
|
|
6163
6305
|
];
|
|
6164
|
-
var SkillsProcessorToolTargetSchema =
|
|
6306
|
+
var SkillsProcessorToolTargetSchema = z27.enum(skillsProcessorToolTargetTuple);
|
|
6165
6307
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6166
6308
|
[
|
|
6167
6309
|
"agentsmd",
|
|
@@ -6177,6 +6319,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6177
6319
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6178
6320
|
}
|
|
6179
6321
|
],
|
|
6322
|
+
[
|
|
6323
|
+
"claudecode-legacy",
|
|
6324
|
+
{
|
|
6325
|
+
class: ClaudecodeSkill,
|
|
6326
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6327
|
+
}
|
|
6328
|
+
],
|
|
6180
6329
|
[
|
|
6181
6330
|
"codexcli",
|
|
6182
6331
|
{
|
|
@@ -6211,6 +6360,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6211
6360
|
class: OpenCodeSkill,
|
|
6212
6361
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6213
6362
|
}
|
|
6363
|
+
],
|
|
6364
|
+
[
|
|
6365
|
+
"roo",
|
|
6366
|
+
{
|
|
6367
|
+
class: RooSkill,
|
|
6368
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6369
|
+
}
|
|
6214
6370
|
]
|
|
6215
6371
|
]);
|
|
6216
6372
|
var defaultGetFactory4 = (target) => {
|
|
@@ -6292,7 +6448,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6292
6448
|
const paths = RulesyncSkill.getSettablePaths();
|
|
6293
6449
|
const rulesyncSkillsDirPath = join51(this.baseDir, paths.relativeDirPath);
|
|
6294
6450
|
const dirPaths = await findFilesByGlobs(join51(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
6295
|
-
const dirNames = dirPaths.map((path3) =>
|
|
6451
|
+
const dirNames = dirPaths.map((path3) => basename15(path3));
|
|
6296
6452
|
const rulesyncSkills = await Promise.all(
|
|
6297
6453
|
dirNames.map(
|
|
6298
6454
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -6310,7 +6466,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6310
6466
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6311
6467
|
const skillsDirPath = join51(this.baseDir, paths.relativeDirPath);
|
|
6312
6468
|
const dirPaths = await findFilesByGlobs(join51(skillsDirPath, "*"), { type: "dir" });
|
|
6313
|
-
const dirNames = dirPaths.map((path3) =>
|
|
6469
|
+
const dirNames = dirPaths.map((path3) => basename15(path3));
|
|
6314
6470
|
const toolSkills = await Promise.all(
|
|
6315
6471
|
dirNames.map(
|
|
6316
6472
|
(dirName) => factory.class.fromDir({
|
|
@@ -6328,7 +6484,7 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6328
6484
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
6329
6485
|
const skillsDirPath = join51(this.baseDir, paths.relativeDirPath);
|
|
6330
6486
|
const dirPaths = await findFilesByGlobs(join51(skillsDirPath, "*"), { type: "dir" });
|
|
6331
|
-
const dirNames = dirPaths.map((path3) =>
|
|
6487
|
+
const dirNames = dirPaths.map((path3) => basename15(path3));
|
|
6332
6488
|
const toolSkills = dirNames.map(
|
|
6333
6489
|
(dirName) => factory.class.forDeletion({
|
|
6334
6490
|
baseDir: this.baseDir,
|
|
@@ -6379,8 +6535,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
6379
6535
|
import { join as join53 } from "path";
|
|
6380
6536
|
|
|
6381
6537
|
// src/features/subagents/simulated-subagent.ts
|
|
6382
|
-
import { basename as
|
|
6383
|
-
import { z as
|
|
6538
|
+
import { basename as basename16, join as join52 } from "path";
|
|
6539
|
+
import { z as z28 } from "zod/mini";
|
|
6384
6540
|
|
|
6385
6541
|
// src/features/subagents/tool-subagent.ts
|
|
6386
6542
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -6423,9 +6579,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
6423
6579
|
};
|
|
6424
6580
|
|
|
6425
6581
|
// src/features/subagents/simulated-subagent.ts
|
|
6426
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
6427
|
-
name:
|
|
6428
|
-
description:
|
|
6582
|
+
var SimulatedSubagentFrontmatterSchema = z28.object({
|
|
6583
|
+
name: z28.string(),
|
|
6584
|
+
description: z28.string()
|
|
6429
6585
|
});
|
|
6430
6586
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
6431
6587
|
frontmatter;
|
|
@@ -6506,7 +6662,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
6506
6662
|
return {
|
|
6507
6663
|
baseDir,
|
|
6508
6664
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
6509
|
-
relativeFilePath:
|
|
6665
|
+
relativeFilePath: basename16(relativeFilePath),
|
|
6510
6666
|
frontmatter: result.data,
|
|
6511
6667
|
body: content.trim(),
|
|
6512
6668
|
validate
|
|
@@ -6663,20 +6819,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
6663
6819
|
};
|
|
6664
6820
|
|
|
6665
6821
|
// src/features/subagents/subagents-processor.ts
|
|
6666
|
-
import { basename as
|
|
6667
|
-
import { z as
|
|
6822
|
+
import { basename as basename19, join as join62 } from "path";
|
|
6823
|
+
import { z as z33 } from "zod/mini";
|
|
6668
6824
|
|
|
6669
6825
|
// src/features/subagents/claudecode-subagent.ts
|
|
6670
6826
|
import { join as join59 } from "path";
|
|
6671
|
-
import { z as
|
|
6827
|
+
import { z as z30 } from "zod/mini";
|
|
6672
6828
|
|
|
6673
6829
|
// src/features/subagents/rulesync-subagent.ts
|
|
6674
|
-
import { basename as
|
|
6675
|
-
import { z as
|
|
6676
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
6830
|
+
import { basename as basename17, join as join58 } from "path";
|
|
6831
|
+
import { z as z29 } from "zod/mini";
|
|
6832
|
+
var RulesyncSubagentFrontmatterSchema = z29.looseObject({
|
|
6677
6833
|
targets: RulesyncTargetsSchema,
|
|
6678
|
-
name:
|
|
6679
|
-
description:
|
|
6834
|
+
name: z29.string(),
|
|
6835
|
+
description: z29.string()
|
|
6680
6836
|
});
|
|
6681
6837
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
6682
6838
|
frontmatter;
|
|
@@ -6735,7 +6891,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6735
6891
|
if (!result.success) {
|
|
6736
6892
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
6737
6893
|
}
|
|
6738
|
-
const filename =
|
|
6894
|
+
const filename = basename17(relativeFilePath);
|
|
6739
6895
|
return new _RulesyncSubagent({
|
|
6740
6896
|
baseDir: process.cwd(),
|
|
6741
6897
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -6747,13 +6903,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6747
6903
|
};
|
|
6748
6904
|
|
|
6749
6905
|
// src/features/subagents/claudecode-subagent.ts
|
|
6750
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
6751
|
-
name:
|
|
6752
|
-
description:
|
|
6753
|
-
model:
|
|
6754
|
-
tools:
|
|
6755
|
-
permissionMode:
|
|
6756
|
-
skills:
|
|
6906
|
+
var ClaudecodeSubagentFrontmatterSchema = z30.looseObject({
|
|
6907
|
+
name: z30.string(),
|
|
6908
|
+
description: z30.string(),
|
|
6909
|
+
model: z30.optional(z30.string()),
|
|
6910
|
+
tools: z30.optional(z30.union([z30.string(), z30.array(z30.string())])),
|
|
6911
|
+
permissionMode: z30.optional(z30.string()),
|
|
6912
|
+
skills: z30.optional(z30.union([z30.string(), z30.array(z30.string())]))
|
|
6757
6913
|
});
|
|
6758
6914
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
6759
6915
|
frontmatter;
|
|
@@ -6903,12 +7059,12 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6903
7059
|
|
|
6904
7060
|
// src/features/subagents/copilot-subagent.ts
|
|
6905
7061
|
import { join as join60 } from "path";
|
|
6906
|
-
import { z as
|
|
7062
|
+
import { z as z31 } from "zod/mini";
|
|
6907
7063
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
6908
|
-
var CopilotSubagentFrontmatterSchema =
|
|
6909
|
-
name:
|
|
6910
|
-
description:
|
|
6911
|
-
tools:
|
|
7064
|
+
var CopilotSubagentFrontmatterSchema = z31.looseObject({
|
|
7065
|
+
name: z31.string(),
|
|
7066
|
+
description: z31.string(),
|
|
7067
|
+
tools: z31.optional(z31.union([z31.string(), z31.array(z31.string())]))
|
|
6912
7068
|
});
|
|
6913
7069
|
var normalizeTools = (tools) => {
|
|
6914
7070
|
if (!tools) {
|
|
@@ -7068,12 +7224,12 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7068
7224
|
};
|
|
7069
7225
|
|
|
7070
7226
|
// src/features/subagents/opencode-subagent.ts
|
|
7071
|
-
import { basename as
|
|
7072
|
-
import { z as
|
|
7073
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7074
|
-
description:
|
|
7075
|
-
mode:
|
|
7076
|
-
name:
|
|
7227
|
+
import { basename as basename18, join as join61 } from "path";
|
|
7228
|
+
import { z as z32 } from "zod/mini";
|
|
7229
|
+
var OpenCodeSubagentFrontmatterSchema = z32.looseObject({
|
|
7230
|
+
description: z32.string(),
|
|
7231
|
+
mode: z32.literal("subagent"),
|
|
7232
|
+
name: z32.optional(z32.string())
|
|
7077
7233
|
});
|
|
7078
7234
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7079
7235
|
frontmatter;
|
|
@@ -7110,7 +7266,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7110
7266
|
const { description, mode, name, ...opencodeSection } = this.frontmatter;
|
|
7111
7267
|
const rulesyncFrontmatter = {
|
|
7112
7268
|
targets: ["opencode"],
|
|
7113
|
-
name: name ??
|
|
7269
|
+
name: name ?? basename18(this.getRelativeFilePath(), ".md"),
|
|
7114
7270
|
description,
|
|
7115
7271
|
opencode: { mode, ...opencodeSection }
|
|
7116
7272
|
};
|
|
@@ -7219,6 +7375,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7219
7375
|
var subagentsProcessorToolTargetTuple = [
|
|
7220
7376
|
"agentsmd",
|
|
7221
7377
|
"claudecode",
|
|
7378
|
+
"claudecode-legacy",
|
|
7222
7379
|
"codexcli",
|
|
7223
7380
|
"copilot",
|
|
7224
7381
|
"cursor",
|
|
@@ -7226,7 +7383,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7226
7383
|
"opencode",
|
|
7227
7384
|
"roo"
|
|
7228
7385
|
];
|
|
7229
|
-
var SubagentsProcessorToolTargetSchema =
|
|
7386
|
+
var SubagentsProcessorToolTargetSchema = z33.enum(subagentsProcessorToolTargetTuple);
|
|
7230
7387
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7231
7388
|
[
|
|
7232
7389
|
"agentsmd",
|
|
@@ -7236,6 +7393,10 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
7236
7393
|
"claudecode",
|
|
7237
7394
|
{ class: ClaudecodeSubagent, meta: { supportsSimulated: false, supportsGlobal: true } }
|
|
7238
7395
|
],
|
|
7396
|
+
[
|
|
7397
|
+
"claudecode-legacy",
|
|
7398
|
+
{ class: ClaudecodeSubagent, meta: { supportsSimulated: false, supportsGlobal: true } }
|
|
7399
|
+
],
|
|
7239
7400
|
[
|
|
7240
7401
|
"codexcli",
|
|
7241
7402
|
{ class: CodexCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
@@ -7388,7 +7549,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7388
7549
|
(path3) => factory.class.forDeletion({
|
|
7389
7550
|
baseDir: this.baseDir,
|
|
7390
7551
|
relativeDirPath: paths.relativeDirPath,
|
|
7391
|
-
relativeFilePath:
|
|
7552
|
+
relativeFilePath: basename19(path3),
|
|
7392
7553
|
global: this.global
|
|
7393
7554
|
})
|
|
7394
7555
|
).filter((subagent) => subagent.isDeletable());
|
|
@@ -7399,7 +7560,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
7399
7560
|
subagentFilePaths.map(
|
|
7400
7561
|
(path3) => factory.class.fromFile({
|
|
7401
7562
|
baseDir: this.baseDir,
|
|
7402
|
-
relativeFilePath:
|
|
7563
|
+
relativeFilePath: basename19(path3),
|
|
7403
7564
|
global: this.global
|
|
7404
7565
|
})
|
|
7405
7566
|
)
|
|
@@ -7437,42 +7598,42 @@ import { join as join65 } from "path";
|
|
|
7437
7598
|
import { join as join64 } from "path";
|
|
7438
7599
|
|
|
7439
7600
|
// src/features/rules/rulesync-rule.ts
|
|
7440
|
-
import { basename as
|
|
7441
|
-
import { z as
|
|
7442
|
-
var RulesyncRuleFrontmatterSchema =
|
|
7443
|
-
root:
|
|
7444
|
-
targets:
|
|
7445
|
-
description:
|
|
7446
|
-
globs:
|
|
7447
|
-
agentsmd:
|
|
7448
|
-
|
|
7601
|
+
import { basename as basename20, join as join63 } from "path";
|
|
7602
|
+
import { z as z34 } from "zod/mini";
|
|
7603
|
+
var RulesyncRuleFrontmatterSchema = z34.object({
|
|
7604
|
+
root: z34.optional(z34.optional(z34.boolean())),
|
|
7605
|
+
targets: z34.optional(RulesyncTargetsSchema),
|
|
7606
|
+
description: z34.optional(z34.string()),
|
|
7607
|
+
globs: z34.optional(z34.array(z34.string())),
|
|
7608
|
+
agentsmd: z34.optional(
|
|
7609
|
+
z34.object({
|
|
7449
7610
|
// @example "path/to/subproject"
|
|
7450
|
-
subprojectPath:
|
|
7611
|
+
subprojectPath: z34.optional(z34.string())
|
|
7451
7612
|
})
|
|
7452
7613
|
),
|
|
7453
|
-
claudecode:
|
|
7454
|
-
|
|
7614
|
+
claudecode: z34.optional(
|
|
7615
|
+
z34.object({
|
|
7455
7616
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
7456
7617
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
7457
|
-
paths:
|
|
7618
|
+
paths: z34.optional(z34.string())
|
|
7458
7619
|
})
|
|
7459
7620
|
),
|
|
7460
|
-
cursor:
|
|
7461
|
-
|
|
7462
|
-
alwaysApply:
|
|
7463
|
-
description:
|
|
7464
|
-
globs:
|
|
7621
|
+
cursor: z34.optional(
|
|
7622
|
+
z34.object({
|
|
7623
|
+
alwaysApply: z34.optional(z34.boolean()),
|
|
7624
|
+
description: z34.optional(z34.string()),
|
|
7625
|
+
globs: z34.optional(z34.array(z34.string()))
|
|
7465
7626
|
})
|
|
7466
7627
|
),
|
|
7467
|
-
copilot:
|
|
7468
|
-
|
|
7469
|
-
excludeAgent:
|
|
7628
|
+
copilot: z34.optional(
|
|
7629
|
+
z34.object({
|
|
7630
|
+
excludeAgent: z34.optional(z34.union([z34.literal("code-review"), z34.literal("coding-agent")]))
|
|
7470
7631
|
})
|
|
7471
7632
|
),
|
|
7472
|
-
antigravity:
|
|
7473
|
-
|
|
7474
|
-
trigger:
|
|
7475
|
-
globs:
|
|
7633
|
+
antigravity: z34.optional(
|
|
7634
|
+
z34.looseObject({
|
|
7635
|
+
trigger: z34.optional(z34.string()),
|
|
7636
|
+
globs: z34.optional(z34.array(z34.string()))
|
|
7476
7637
|
})
|
|
7477
7638
|
)
|
|
7478
7639
|
});
|
|
@@ -7552,7 +7713,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7552
7713
|
agentsmd: result.data.agentsmd,
|
|
7553
7714
|
cursor: result.data.cursor
|
|
7554
7715
|
};
|
|
7555
|
-
const filename =
|
|
7716
|
+
const filename = basename20(legacyPath);
|
|
7556
7717
|
return new _RulesyncRule({
|
|
7557
7718
|
baseDir: process.cwd(),
|
|
7558
7719
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -7585,7 +7746,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
7585
7746
|
agentsmd: result.data.agentsmd,
|
|
7586
7747
|
cursor: result.data.cursor
|
|
7587
7748
|
};
|
|
7588
|
-
const filename =
|
|
7749
|
+
const filename = basename20(filePath);
|
|
7589
7750
|
return new _RulesyncRule({
|
|
7590
7751
|
baseDir: process.cwd(),
|
|
7591
7752
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -7809,91 +7970,22 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7809
7970
|
}
|
|
7810
7971
|
};
|
|
7811
7972
|
|
|
7812
|
-
// src/features/rules/amazonqcli-rule.ts
|
|
7813
|
-
import { join as join66 } from "path";
|
|
7814
|
-
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
7815
|
-
static getSettablePaths() {
|
|
7816
|
-
return {
|
|
7817
|
-
nonRoot: {
|
|
7818
|
-
relativeDirPath: join66(".amazonq", "rules")
|
|
7819
|
-
}
|
|
7820
|
-
};
|
|
7821
|
-
}
|
|
7822
|
-
static async fromFile({
|
|
7823
|
-
baseDir = process.cwd(),
|
|
7824
|
-
relativeFilePath,
|
|
7825
|
-
validate = true
|
|
7826
|
-
}) {
|
|
7827
|
-
const fileContent = await readFileContent(
|
|
7828
|
-
join66(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7829
|
-
);
|
|
7830
|
-
return new _AmazonQCliRule({
|
|
7831
|
-
baseDir,
|
|
7832
|
-
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7833
|
-
relativeFilePath,
|
|
7834
|
-
fileContent,
|
|
7835
|
-
validate,
|
|
7836
|
-
root: false
|
|
7837
|
-
});
|
|
7838
|
-
}
|
|
7839
|
-
static fromRulesyncRule({
|
|
7840
|
-
baseDir = process.cwd(),
|
|
7841
|
-
rulesyncRule,
|
|
7842
|
-
validate = true
|
|
7843
|
-
}) {
|
|
7844
|
-
return new _AmazonQCliRule(
|
|
7845
|
-
this.buildToolRuleParamsDefault({
|
|
7846
|
-
baseDir,
|
|
7847
|
-
rulesyncRule,
|
|
7848
|
-
validate,
|
|
7849
|
-
nonRootPath: this.getSettablePaths().nonRoot
|
|
7850
|
-
})
|
|
7851
|
-
);
|
|
7852
|
-
}
|
|
7853
|
-
toRulesyncRule() {
|
|
7854
|
-
return this.toRulesyncRuleDefault();
|
|
7855
|
-
}
|
|
7856
|
-
validate() {
|
|
7857
|
-
return { success: true, error: null };
|
|
7858
|
-
}
|
|
7859
|
-
static forDeletion({
|
|
7860
|
-
baseDir = process.cwd(),
|
|
7861
|
-
relativeDirPath,
|
|
7862
|
-
relativeFilePath
|
|
7863
|
-
}) {
|
|
7864
|
-
return new _AmazonQCliRule({
|
|
7865
|
-
baseDir,
|
|
7866
|
-
relativeDirPath,
|
|
7867
|
-
relativeFilePath,
|
|
7868
|
-
fileContent: "",
|
|
7869
|
-
validate: false,
|
|
7870
|
-
root: false
|
|
7871
|
-
});
|
|
7872
|
-
}
|
|
7873
|
-
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7874
|
-
return this.isTargetedByRulesyncRuleDefault({
|
|
7875
|
-
rulesyncRule,
|
|
7876
|
-
toolTarget: "amazonqcli"
|
|
7877
|
-
});
|
|
7878
|
-
}
|
|
7879
|
-
};
|
|
7880
|
-
|
|
7881
7973
|
// src/features/rules/antigravity-rule.ts
|
|
7882
|
-
import { join as
|
|
7883
|
-
import { z as
|
|
7884
|
-
var AntigravityRuleFrontmatterSchema =
|
|
7885
|
-
trigger:
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7974
|
+
import { join as join66 } from "path";
|
|
7975
|
+
import { z as z35 } from "zod/mini";
|
|
7976
|
+
var AntigravityRuleFrontmatterSchema = z35.looseObject({
|
|
7977
|
+
trigger: z35.optional(
|
|
7978
|
+
z35.union([
|
|
7979
|
+
z35.literal("always_on"),
|
|
7980
|
+
z35.literal("glob"),
|
|
7981
|
+
z35.literal("manual"),
|
|
7982
|
+
z35.literal("model_decision"),
|
|
7983
|
+
z35.string()
|
|
7892
7984
|
// accepts any string for forward compatibility
|
|
7893
7985
|
])
|
|
7894
7986
|
),
|
|
7895
|
-
globs:
|
|
7896
|
-
description:
|
|
7987
|
+
globs: z35.optional(z35.string()),
|
|
7988
|
+
description: z35.optional(z35.string())
|
|
7897
7989
|
});
|
|
7898
7990
|
function parseGlobsString(globs) {
|
|
7899
7991
|
if (!globs) {
|
|
@@ -8038,7 +8130,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8038
8130
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8039
8131
|
if (!result.success) {
|
|
8040
8132
|
throw new Error(
|
|
8041
|
-
`Invalid frontmatter in ${
|
|
8133
|
+
`Invalid frontmatter in ${join66(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8042
8134
|
);
|
|
8043
8135
|
}
|
|
8044
8136
|
}
|
|
@@ -8053,7 +8145,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8053
8145
|
static getSettablePaths() {
|
|
8054
8146
|
return {
|
|
8055
8147
|
nonRoot: {
|
|
8056
|
-
relativeDirPath:
|
|
8148
|
+
relativeDirPath: join66(".agent", "rules")
|
|
8057
8149
|
}
|
|
8058
8150
|
};
|
|
8059
8151
|
}
|
|
@@ -8062,7 +8154,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8062
8154
|
relativeFilePath,
|
|
8063
8155
|
validate = true
|
|
8064
8156
|
}) {
|
|
8065
|
-
const filePath =
|
|
8157
|
+
const filePath = join66(
|
|
8066
8158
|
baseDir,
|
|
8067
8159
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8068
8160
|
relativeFilePath
|
|
@@ -8203,7 +8295,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8203
8295
|
};
|
|
8204
8296
|
|
|
8205
8297
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8206
|
-
import { join as
|
|
8298
|
+
import { join as join67 } from "path";
|
|
8207
8299
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8208
8300
|
toRulesyncRule() {
|
|
8209
8301
|
const rulesyncFrontmatter = {
|
|
@@ -8229,7 +8321,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8229
8321
|
relativeFilePath: ".augment-guidelines"
|
|
8230
8322
|
},
|
|
8231
8323
|
nonRoot: {
|
|
8232
|
-
relativeDirPath:
|
|
8324
|
+
relativeDirPath: join67(".augment", "rules")
|
|
8233
8325
|
}
|
|
8234
8326
|
};
|
|
8235
8327
|
}
|
|
@@ -8264,8 +8356,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8264
8356
|
}) {
|
|
8265
8357
|
const settablePaths = this.getSettablePaths();
|
|
8266
8358
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8267
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
8268
|
-
const fileContent = await readFileContent(
|
|
8359
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join67(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8360
|
+
const fileContent = await readFileContent(join67(baseDir, relativePath));
|
|
8269
8361
|
return new _AugmentcodeLegacyRule({
|
|
8270
8362
|
baseDir,
|
|
8271
8363
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8294,7 +8386,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8294
8386
|
};
|
|
8295
8387
|
|
|
8296
8388
|
// src/features/rules/augmentcode-rule.ts
|
|
8297
|
-
import { join as
|
|
8389
|
+
import { join as join68 } from "path";
|
|
8298
8390
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8299
8391
|
toRulesyncRule() {
|
|
8300
8392
|
return this.toRulesyncRuleDefault();
|
|
@@ -8302,7 +8394,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8302
8394
|
static getSettablePaths() {
|
|
8303
8395
|
return {
|
|
8304
8396
|
nonRoot: {
|
|
8305
|
-
relativeDirPath:
|
|
8397
|
+
relativeDirPath: join68(".augment", "rules")
|
|
8306
8398
|
}
|
|
8307
8399
|
};
|
|
8308
8400
|
}
|
|
@@ -8326,7 +8418,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8326
8418
|
validate = true
|
|
8327
8419
|
}) {
|
|
8328
8420
|
const fileContent = await readFileContent(
|
|
8329
|
-
|
|
8421
|
+
join68(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8330
8422
|
);
|
|
8331
8423
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8332
8424
|
return new _AugmentcodeRule({
|
|
@@ -8362,7 +8454,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8362
8454
|
};
|
|
8363
8455
|
|
|
8364
8456
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8365
|
-
import { join as
|
|
8457
|
+
import { join as join69 } from "path";
|
|
8366
8458
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8367
8459
|
static getSettablePaths({
|
|
8368
8460
|
global
|
|
@@ -8381,7 +8473,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8381
8473
|
relativeFilePath: "CLAUDE.md"
|
|
8382
8474
|
},
|
|
8383
8475
|
nonRoot: {
|
|
8384
|
-
relativeDirPath:
|
|
8476
|
+
relativeDirPath: join69(".claude", "memories")
|
|
8385
8477
|
}
|
|
8386
8478
|
};
|
|
8387
8479
|
}
|
|
@@ -8396,7 +8488,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8396
8488
|
if (isRoot) {
|
|
8397
8489
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8398
8490
|
const fileContent2 = await readFileContent(
|
|
8399
|
-
|
|
8491
|
+
join69(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8400
8492
|
);
|
|
8401
8493
|
return new _ClaudecodeLegacyRule({
|
|
8402
8494
|
baseDir,
|
|
@@ -8410,8 +8502,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8410
8502
|
if (!paths.nonRoot) {
|
|
8411
8503
|
throw new Error("nonRoot path is not set");
|
|
8412
8504
|
}
|
|
8413
|
-
const relativePath =
|
|
8414
|
-
const fileContent = await readFileContent(
|
|
8505
|
+
const relativePath = join69(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8506
|
+
const fileContent = await readFileContent(join69(baseDir, relativePath));
|
|
8415
8507
|
return new _ClaudecodeLegacyRule({
|
|
8416
8508
|
baseDir,
|
|
8417
8509
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8470,10 +8562,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8470
8562
|
};
|
|
8471
8563
|
|
|
8472
8564
|
// src/features/rules/claudecode-rule.ts
|
|
8473
|
-
import { join as
|
|
8474
|
-
import { z as
|
|
8475
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
8476
|
-
paths:
|
|
8565
|
+
import { join as join70 } from "path";
|
|
8566
|
+
import { z as z36 } from "zod/mini";
|
|
8567
|
+
var ClaudecodeRuleFrontmatterSchema = z36.object({
|
|
8568
|
+
paths: z36.optional(z36.string())
|
|
8477
8569
|
});
|
|
8478
8570
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
8479
8571
|
frontmatter;
|
|
@@ -8495,7 +8587,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8495
8587
|
relativeFilePath: "CLAUDE.md"
|
|
8496
8588
|
},
|
|
8497
8589
|
nonRoot: {
|
|
8498
|
-
relativeDirPath:
|
|
8590
|
+
relativeDirPath: join70(".claude", "rules")
|
|
8499
8591
|
}
|
|
8500
8592
|
};
|
|
8501
8593
|
}
|
|
@@ -8504,7 +8596,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8504
8596
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8505
8597
|
if (!result.success) {
|
|
8506
8598
|
throw new Error(
|
|
8507
|
-
`Invalid frontmatter in ${
|
|
8599
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8508
8600
|
);
|
|
8509
8601
|
}
|
|
8510
8602
|
}
|
|
@@ -8532,7 +8624,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8532
8624
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8533
8625
|
if (isRoot) {
|
|
8534
8626
|
const fileContent2 = await readFileContent(
|
|
8535
|
-
|
|
8627
|
+
join70(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
8536
8628
|
);
|
|
8537
8629
|
return new _ClaudecodeRule({
|
|
8538
8630
|
baseDir,
|
|
@@ -8547,13 +8639,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8547
8639
|
if (!paths.nonRoot) {
|
|
8548
8640
|
throw new Error("nonRoot path is not set");
|
|
8549
8641
|
}
|
|
8550
|
-
const relativePath =
|
|
8551
|
-
const fileContent = await readFileContent(
|
|
8642
|
+
const relativePath = join70(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8643
|
+
const fileContent = await readFileContent(join70(baseDir, relativePath));
|
|
8552
8644
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8553
8645
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8554
8646
|
if (!result.success) {
|
|
8555
8647
|
throw new Error(
|
|
8556
|
-
`Invalid frontmatter in ${
|
|
8648
|
+
`Invalid frontmatter in ${join70(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
8557
8649
|
);
|
|
8558
8650
|
}
|
|
8559
8651
|
return new _ClaudecodeRule({
|
|
@@ -8660,7 +8752,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8660
8752
|
return {
|
|
8661
8753
|
success: false,
|
|
8662
8754
|
error: new Error(
|
|
8663
|
-
`Invalid frontmatter in ${
|
|
8755
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8664
8756
|
)
|
|
8665
8757
|
};
|
|
8666
8758
|
}
|
|
@@ -8680,10 +8772,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8680
8772
|
};
|
|
8681
8773
|
|
|
8682
8774
|
// src/features/rules/cline-rule.ts
|
|
8683
|
-
import { join as
|
|
8684
|
-
import { z as
|
|
8685
|
-
var ClineRuleFrontmatterSchema =
|
|
8686
|
-
description:
|
|
8775
|
+
import { join as join71 } from "path";
|
|
8776
|
+
import { z as z37 } from "zod/mini";
|
|
8777
|
+
var ClineRuleFrontmatterSchema = z37.object({
|
|
8778
|
+
description: z37.string()
|
|
8687
8779
|
});
|
|
8688
8780
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
8689
8781
|
static getSettablePaths() {
|
|
@@ -8725,7 +8817,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8725
8817
|
validate = true
|
|
8726
8818
|
}) {
|
|
8727
8819
|
const fileContent = await readFileContent(
|
|
8728
|
-
|
|
8820
|
+
join71(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8729
8821
|
);
|
|
8730
8822
|
return new _ClineRule({
|
|
8731
8823
|
baseDir,
|
|
@@ -8751,7 +8843,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8751
8843
|
};
|
|
8752
8844
|
|
|
8753
8845
|
// src/features/rules/codexcli-rule.ts
|
|
8754
|
-
import { join as
|
|
8846
|
+
import { join as join72 } from "path";
|
|
8755
8847
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
8756
8848
|
static getSettablePaths({
|
|
8757
8849
|
global
|
|
@@ -8770,7 +8862,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8770
8862
|
relativeFilePath: "AGENTS.md"
|
|
8771
8863
|
},
|
|
8772
8864
|
nonRoot: {
|
|
8773
|
-
relativeDirPath:
|
|
8865
|
+
relativeDirPath: join72(".codex", "memories")
|
|
8774
8866
|
}
|
|
8775
8867
|
};
|
|
8776
8868
|
}
|
|
@@ -8785,7 +8877,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8785
8877
|
if (isRoot) {
|
|
8786
8878
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8787
8879
|
const fileContent2 = await readFileContent(
|
|
8788
|
-
|
|
8880
|
+
join72(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8789
8881
|
);
|
|
8790
8882
|
return new _CodexcliRule({
|
|
8791
8883
|
baseDir,
|
|
@@ -8799,8 +8891,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8799
8891
|
if (!paths.nonRoot) {
|
|
8800
8892
|
throw new Error("nonRoot path is not set");
|
|
8801
8893
|
}
|
|
8802
|
-
const relativePath =
|
|
8803
|
-
const fileContent = await readFileContent(
|
|
8894
|
+
const relativePath = join72(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8895
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
8804
8896
|
return new _CodexcliRule({
|
|
8805
8897
|
baseDir,
|
|
8806
8898
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8859,12 +8951,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8859
8951
|
};
|
|
8860
8952
|
|
|
8861
8953
|
// src/features/rules/copilot-rule.ts
|
|
8862
|
-
import { join as
|
|
8863
|
-
import { z as
|
|
8864
|
-
var CopilotRuleFrontmatterSchema =
|
|
8865
|
-
description:
|
|
8866
|
-
applyTo:
|
|
8867
|
-
excludeAgent:
|
|
8954
|
+
import { join as join73 } from "path";
|
|
8955
|
+
import { z as z38 } from "zod/mini";
|
|
8956
|
+
var CopilotRuleFrontmatterSchema = z38.object({
|
|
8957
|
+
description: z38.optional(z38.string()),
|
|
8958
|
+
applyTo: z38.optional(z38.string()),
|
|
8959
|
+
excludeAgent: z38.optional(z38.union([z38.literal("code-review"), z38.literal("coding-agent")]))
|
|
8868
8960
|
});
|
|
8869
8961
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
8870
8962
|
frontmatter;
|
|
@@ -8876,7 +8968,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8876
8968
|
relativeFilePath: "copilot-instructions.md"
|
|
8877
8969
|
},
|
|
8878
8970
|
nonRoot: {
|
|
8879
|
-
relativeDirPath:
|
|
8971
|
+
relativeDirPath: join73(".github", "instructions")
|
|
8880
8972
|
}
|
|
8881
8973
|
};
|
|
8882
8974
|
}
|
|
@@ -8885,7 +8977,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8885
8977
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8886
8978
|
if (!result.success) {
|
|
8887
8979
|
throw new Error(
|
|
8888
|
-
`Invalid frontmatter in ${
|
|
8980
|
+
`Invalid frontmatter in ${join73(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8889
8981
|
);
|
|
8890
8982
|
}
|
|
8891
8983
|
}
|
|
@@ -8967,11 +9059,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8967
9059
|
validate = true
|
|
8968
9060
|
}) {
|
|
8969
9061
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
8970
|
-
const relativePath = isRoot ?
|
|
9062
|
+
const relativePath = isRoot ? join73(
|
|
8971
9063
|
this.getSettablePaths().root.relativeDirPath,
|
|
8972
9064
|
this.getSettablePaths().root.relativeFilePath
|
|
8973
|
-
) :
|
|
8974
|
-
const fileContent = await readFileContent(
|
|
9065
|
+
) : join73(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9066
|
+
const fileContent = await readFileContent(join73(baseDir, relativePath));
|
|
8975
9067
|
if (isRoot) {
|
|
8976
9068
|
return new _CopilotRule({
|
|
8977
9069
|
baseDir,
|
|
@@ -8987,7 +9079,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8987
9079
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8988
9080
|
if (!result.success) {
|
|
8989
9081
|
throw new Error(
|
|
8990
|
-
`Invalid frontmatter in ${
|
|
9082
|
+
`Invalid frontmatter in ${join73(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
8991
9083
|
);
|
|
8992
9084
|
}
|
|
8993
9085
|
return new _CopilotRule({
|
|
@@ -9027,7 +9119,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9027
9119
|
return {
|
|
9028
9120
|
success: false,
|
|
9029
9121
|
error: new Error(
|
|
9030
|
-
`Invalid frontmatter in ${
|
|
9122
|
+
`Invalid frontmatter in ${join73(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9031
9123
|
)
|
|
9032
9124
|
};
|
|
9033
9125
|
}
|
|
@@ -9047,12 +9139,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9047
9139
|
};
|
|
9048
9140
|
|
|
9049
9141
|
// src/features/rules/cursor-rule.ts
|
|
9050
|
-
import { basename as
|
|
9051
|
-
import { z as
|
|
9052
|
-
var CursorRuleFrontmatterSchema =
|
|
9053
|
-
description:
|
|
9054
|
-
globs:
|
|
9055
|
-
alwaysApply:
|
|
9142
|
+
import { basename as basename21, join as join74 } from "path";
|
|
9143
|
+
import { z as z39 } from "zod/mini";
|
|
9144
|
+
var CursorRuleFrontmatterSchema = z39.object({
|
|
9145
|
+
description: z39.optional(z39.string()),
|
|
9146
|
+
globs: z39.optional(z39.string()),
|
|
9147
|
+
alwaysApply: z39.optional(z39.boolean())
|
|
9056
9148
|
});
|
|
9057
9149
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9058
9150
|
frontmatter;
|
|
@@ -9060,7 +9152,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9060
9152
|
static getSettablePaths() {
|
|
9061
9153
|
return {
|
|
9062
9154
|
nonRoot: {
|
|
9063
|
-
relativeDirPath:
|
|
9155
|
+
relativeDirPath: join74(".cursor", "rules")
|
|
9064
9156
|
}
|
|
9065
9157
|
};
|
|
9066
9158
|
}
|
|
@@ -9069,7 +9161,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9069
9161
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9070
9162
|
if (!result.success) {
|
|
9071
9163
|
throw new Error(
|
|
9072
|
-
`Invalid frontmatter in ${
|
|
9164
|
+
`Invalid frontmatter in ${join74(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9073
9165
|
);
|
|
9074
9166
|
}
|
|
9075
9167
|
}
|
|
@@ -9186,19 +9278,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9186
9278
|
validate = true
|
|
9187
9279
|
}) {
|
|
9188
9280
|
const fileContent = await readFileContent(
|
|
9189
|
-
|
|
9281
|
+
join74(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9190
9282
|
);
|
|
9191
9283
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9192
9284
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9193
9285
|
if (!result.success) {
|
|
9194
9286
|
throw new Error(
|
|
9195
|
-
`Invalid frontmatter in ${
|
|
9287
|
+
`Invalid frontmatter in ${join74(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9196
9288
|
);
|
|
9197
9289
|
}
|
|
9198
9290
|
return new _CursorRule({
|
|
9199
9291
|
baseDir,
|
|
9200
9292
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9201
|
-
relativeFilePath:
|
|
9293
|
+
relativeFilePath: basename21(relativeFilePath),
|
|
9202
9294
|
frontmatter: result.data,
|
|
9203
9295
|
body: content.trim(),
|
|
9204
9296
|
validate
|
|
@@ -9229,7 +9321,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9229
9321
|
return {
|
|
9230
9322
|
success: false,
|
|
9231
9323
|
error: new Error(
|
|
9232
|
-
`Invalid frontmatter in ${
|
|
9324
|
+
`Invalid frontmatter in ${join74(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9233
9325
|
)
|
|
9234
9326
|
};
|
|
9235
9327
|
}
|
|
@@ -9249,7 +9341,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9249
9341
|
};
|
|
9250
9342
|
|
|
9251
9343
|
// src/features/rules/geminicli-rule.ts
|
|
9252
|
-
import { join as
|
|
9344
|
+
import { join as join75 } from "path";
|
|
9253
9345
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9254
9346
|
static getSettablePaths({
|
|
9255
9347
|
global
|
|
@@ -9268,7 +9360,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9268
9360
|
relativeFilePath: "GEMINI.md"
|
|
9269
9361
|
},
|
|
9270
9362
|
nonRoot: {
|
|
9271
|
-
relativeDirPath:
|
|
9363
|
+
relativeDirPath: join75(".gemini", "memories")
|
|
9272
9364
|
}
|
|
9273
9365
|
};
|
|
9274
9366
|
}
|
|
@@ -9283,7 +9375,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9283
9375
|
if (isRoot) {
|
|
9284
9376
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9285
9377
|
const fileContent2 = await readFileContent(
|
|
9286
|
-
|
|
9378
|
+
join75(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9287
9379
|
);
|
|
9288
9380
|
return new _GeminiCliRule({
|
|
9289
9381
|
baseDir,
|
|
@@ -9297,8 +9389,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9297
9389
|
if (!paths.nonRoot) {
|
|
9298
9390
|
throw new Error("nonRoot path is not set");
|
|
9299
9391
|
}
|
|
9300
|
-
const relativePath =
|
|
9301
|
-
const fileContent = await readFileContent(
|
|
9392
|
+
const relativePath = join75(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9393
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
9302
9394
|
return new _GeminiCliRule({
|
|
9303
9395
|
baseDir,
|
|
9304
9396
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9357,7 +9449,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9357
9449
|
};
|
|
9358
9450
|
|
|
9359
9451
|
// src/features/rules/junie-rule.ts
|
|
9360
|
-
import { join as
|
|
9452
|
+
import { join as join76 } from "path";
|
|
9361
9453
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9362
9454
|
static getSettablePaths() {
|
|
9363
9455
|
return {
|
|
@@ -9366,7 +9458,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9366
9458
|
relativeFilePath: "guidelines.md"
|
|
9367
9459
|
},
|
|
9368
9460
|
nonRoot: {
|
|
9369
|
-
relativeDirPath:
|
|
9461
|
+
relativeDirPath: join76(".junie", "memories")
|
|
9370
9462
|
}
|
|
9371
9463
|
};
|
|
9372
9464
|
}
|
|
@@ -9376,8 +9468,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9376
9468
|
validate = true
|
|
9377
9469
|
}) {
|
|
9378
9470
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9379
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
9380
|
-
const fileContent = await readFileContent(
|
|
9471
|
+
const relativePath = isRoot ? "guidelines.md" : join76(".junie", "memories", relativeFilePath);
|
|
9472
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
9381
9473
|
return new _JunieRule({
|
|
9382
9474
|
baseDir,
|
|
9383
9475
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9432,12 +9524,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9432
9524
|
};
|
|
9433
9525
|
|
|
9434
9526
|
// src/features/rules/kiro-rule.ts
|
|
9435
|
-
import { join as
|
|
9527
|
+
import { join as join77 } from "path";
|
|
9436
9528
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
9437
9529
|
static getSettablePaths() {
|
|
9438
9530
|
return {
|
|
9439
9531
|
nonRoot: {
|
|
9440
|
-
relativeDirPath:
|
|
9532
|
+
relativeDirPath: join77(".kiro", "steering")
|
|
9441
9533
|
}
|
|
9442
9534
|
};
|
|
9443
9535
|
}
|
|
@@ -9447,7 +9539,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9447
9539
|
validate = true
|
|
9448
9540
|
}) {
|
|
9449
9541
|
const fileContent = await readFileContent(
|
|
9450
|
-
|
|
9542
|
+
join77(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9451
9543
|
);
|
|
9452
9544
|
return new _KiroRule({
|
|
9453
9545
|
baseDir,
|
|
@@ -9501,7 +9593,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9501
9593
|
};
|
|
9502
9594
|
|
|
9503
9595
|
// src/features/rules/opencode-rule.ts
|
|
9504
|
-
import { join as
|
|
9596
|
+
import { join as join78 } from "path";
|
|
9505
9597
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
9506
9598
|
static getSettablePaths() {
|
|
9507
9599
|
return {
|
|
@@ -9510,7 +9602,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9510
9602
|
relativeFilePath: "AGENTS.md"
|
|
9511
9603
|
},
|
|
9512
9604
|
nonRoot: {
|
|
9513
|
-
relativeDirPath:
|
|
9605
|
+
relativeDirPath: join78(".opencode", "memories")
|
|
9514
9606
|
}
|
|
9515
9607
|
};
|
|
9516
9608
|
}
|
|
@@ -9520,8 +9612,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9520
9612
|
validate = true
|
|
9521
9613
|
}) {
|
|
9522
9614
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9523
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
9524
|
-
const fileContent = await readFileContent(
|
|
9615
|
+
const relativePath = isRoot ? "AGENTS.md" : join78(".opencode", "memories", relativeFilePath);
|
|
9616
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
9525
9617
|
return new _OpenCodeRule({
|
|
9526
9618
|
baseDir,
|
|
9527
9619
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9576,7 +9668,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9576
9668
|
};
|
|
9577
9669
|
|
|
9578
9670
|
// src/features/rules/qwencode-rule.ts
|
|
9579
|
-
import { join as
|
|
9671
|
+
import { join as join79 } from "path";
|
|
9580
9672
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
9581
9673
|
static getSettablePaths() {
|
|
9582
9674
|
return {
|
|
@@ -9585,7 +9677,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9585
9677
|
relativeFilePath: "QWEN.md"
|
|
9586
9678
|
},
|
|
9587
9679
|
nonRoot: {
|
|
9588
|
-
relativeDirPath:
|
|
9680
|
+
relativeDirPath: join79(".qwen", "memories")
|
|
9589
9681
|
}
|
|
9590
9682
|
};
|
|
9591
9683
|
}
|
|
@@ -9595,8 +9687,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9595
9687
|
validate = true
|
|
9596
9688
|
}) {
|
|
9597
9689
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
9598
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
9599
|
-
const fileContent = await readFileContent(
|
|
9690
|
+
const relativePath = isRoot ? "QWEN.md" : join79(".qwen", "memories", relativeFilePath);
|
|
9691
|
+
const fileContent = await readFileContent(join79(baseDir, relativePath));
|
|
9600
9692
|
return new _QwencodeRule({
|
|
9601
9693
|
baseDir,
|
|
9602
9694
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9648,12 +9740,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9648
9740
|
};
|
|
9649
9741
|
|
|
9650
9742
|
// src/features/rules/roo-rule.ts
|
|
9651
|
-
import { join as
|
|
9743
|
+
import { join as join80 } from "path";
|
|
9652
9744
|
var RooRule = class _RooRule extends ToolRule {
|
|
9653
9745
|
static getSettablePaths() {
|
|
9654
9746
|
return {
|
|
9655
9747
|
nonRoot: {
|
|
9656
|
-
relativeDirPath:
|
|
9748
|
+
relativeDirPath: join80(".roo", "rules")
|
|
9657
9749
|
}
|
|
9658
9750
|
};
|
|
9659
9751
|
}
|
|
@@ -9663,7 +9755,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9663
9755
|
validate = true
|
|
9664
9756
|
}) {
|
|
9665
9757
|
const fileContent = await readFileContent(
|
|
9666
|
-
|
|
9758
|
+
join80(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9667
9759
|
);
|
|
9668
9760
|
return new _RooRule({
|
|
9669
9761
|
baseDir,
|
|
@@ -9732,7 +9824,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9732
9824
|
};
|
|
9733
9825
|
|
|
9734
9826
|
// src/features/rules/warp-rule.ts
|
|
9735
|
-
import { join as
|
|
9827
|
+
import { join as join81 } from "path";
|
|
9736
9828
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
9737
9829
|
constructor({ fileContent, root, ...rest }) {
|
|
9738
9830
|
super({
|
|
@@ -9748,7 +9840,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9748
9840
|
relativeFilePath: "WARP.md"
|
|
9749
9841
|
},
|
|
9750
9842
|
nonRoot: {
|
|
9751
|
-
relativeDirPath:
|
|
9843
|
+
relativeDirPath: join81(".warp", "memories")
|
|
9752
9844
|
}
|
|
9753
9845
|
};
|
|
9754
9846
|
}
|
|
@@ -9758,8 +9850,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9758
9850
|
validate = true
|
|
9759
9851
|
}) {
|
|
9760
9852
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
9761
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
9762
|
-
const fileContent = await readFileContent(
|
|
9853
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join81(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9854
|
+
const fileContent = await readFileContent(join81(baseDir, relativePath));
|
|
9763
9855
|
return new _WarpRule({
|
|
9764
9856
|
baseDir,
|
|
9765
9857
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -9814,12 +9906,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9814
9906
|
};
|
|
9815
9907
|
|
|
9816
9908
|
// src/features/rules/windsurf-rule.ts
|
|
9817
|
-
import { join as
|
|
9909
|
+
import { join as join82 } from "path";
|
|
9818
9910
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
9819
9911
|
static getSettablePaths() {
|
|
9820
9912
|
return {
|
|
9821
9913
|
nonRoot: {
|
|
9822
|
-
relativeDirPath:
|
|
9914
|
+
relativeDirPath: join82(".windsurf", "rules")
|
|
9823
9915
|
}
|
|
9824
9916
|
};
|
|
9825
9917
|
}
|
|
@@ -9829,7 +9921,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
9829
9921
|
validate = true
|
|
9830
9922
|
}) {
|
|
9831
9923
|
const fileContent = await readFileContent(
|
|
9832
|
-
|
|
9924
|
+
join82(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9833
9925
|
);
|
|
9834
9926
|
return new _WindsurfRule({
|
|
9835
9927
|
baseDir,
|
|
@@ -9883,7 +9975,6 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
9883
9975
|
// src/features/rules/rules-processor.ts
|
|
9884
9976
|
var rulesProcessorToolTargets = [
|
|
9885
9977
|
"agentsmd",
|
|
9886
|
-
"amazonqcli",
|
|
9887
9978
|
"antigravity",
|
|
9888
9979
|
"augmentcode",
|
|
9889
9980
|
"augmentcode-legacy",
|
|
@@ -9902,7 +9993,7 @@ var rulesProcessorToolTargets = [
|
|
|
9902
9993
|
"warp",
|
|
9903
9994
|
"windsurf"
|
|
9904
9995
|
];
|
|
9905
|
-
var RulesProcessorToolTargetSchema =
|
|
9996
|
+
var RulesProcessorToolTargetSchema = z40.enum(rulesProcessorToolTargets);
|
|
9906
9997
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
9907
9998
|
[
|
|
9908
9999
|
"agentsmd",
|
|
@@ -9920,13 +10011,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
9920
10011
|
}
|
|
9921
10012
|
}
|
|
9922
10013
|
],
|
|
9923
|
-
[
|
|
9924
|
-
"amazonqcli",
|
|
9925
|
-
{
|
|
9926
|
-
class: AmazonQCliRule,
|
|
9927
|
-
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "auto" }
|
|
9928
|
-
}
|
|
9929
|
-
],
|
|
9930
10014
|
[
|
|
9931
10015
|
"antigravity",
|
|
9932
10016
|
{
|
|
@@ -10186,7 +10270,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10186
10270
|
}).relativeDirPath;
|
|
10187
10271
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10188
10272
|
const frontmatter = skill.getFrontmatter();
|
|
10189
|
-
const relativePath =
|
|
10273
|
+
const relativePath = join83(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10190
10274
|
return {
|
|
10191
10275
|
name: frontmatter.name,
|
|
10192
10276
|
description: frontmatter.description,
|
|
@@ -10253,10 +10337,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10253
10337
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10254
10338
|
*/
|
|
10255
10339
|
async loadRulesyncFiles() {
|
|
10256
|
-
const files = await findFilesByGlobs(
|
|
10340
|
+
const files = await findFilesByGlobs(join83(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10257
10341
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10258
10342
|
const rulesyncRules = await Promise.all(
|
|
10259
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
10343
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename22(file) }))
|
|
10260
10344
|
);
|
|
10261
10345
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10262
10346
|
if (rootRules.length > 1) {
|
|
@@ -10274,10 +10358,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10274
10358
|
return rulesyncRules;
|
|
10275
10359
|
}
|
|
10276
10360
|
async loadRulesyncFilesLegacy() {
|
|
10277
|
-
const legacyFiles = await findFilesByGlobs(
|
|
10361
|
+
const legacyFiles = await findFilesByGlobs(join83(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10278
10362
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10279
10363
|
return Promise.all(
|
|
10280
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
10364
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename22(file) }))
|
|
10281
10365
|
);
|
|
10282
10366
|
}
|
|
10283
10367
|
/**
|
|
@@ -10295,7 +10379,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10295
10379
|
return [];
|
|
10296
10380
|
}
|
|
10297
10381
|
const rootFilePaths = await findFilesByGlobs(
|
|
10298
|
-
|
|
10382
|
+
join83(
|
|
10299
10383
|
this.baseDir,
|
|
10300
10384
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10301
10385
|
settablePaths.root.relativeFilePath
|
|
@@ -10306,7 +10390,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10306
10390
|
(filePath) => factory.class.forDeletion({
|
|
10307
10391
|
baseDir: this.baseDir,
|
|
10308
10392
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
10309
|
-
relativeFilePath:
|
|
10393
|
+
relativeFilePath: basename22(filePath),
|
|
10310
10394
|
global: this.global
|
|
10311
10395
|
})
|
|
10312
10396
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10315,7 +10399,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10315
10399
|
rootFilePaths.map(
|
|
10316
10400
|
(filePath) => factory.class.fromFile({
|
|
10317
10401
|
baseDir: this.baseDir,
|
|
10318
|
-
relativeFilePath:
|
|
10402
|
+
relativeFilePath: basename22(filePath),
|
|
10319
10403
|
global: this.global
|
|
10320
10404
|
})
|
|
10321
10405
|
)
|
|
@@ -10327,14 +10411,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10327
10411
|
return [];
|
|
10328
10412
|
}
|
|
10329
10413
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
10330
|
-
|
|
10414
|
+
join83(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
10331
10415
|
);
|
|
10332
10416
|
if (forDeletion) {
|
|
10333
10417
|
return nonRootFilePaths.map(
|
|
10334
10418
|
(filePath) => factory.class.forDeletion({
|
|
10335
10419
|
baseDir: this.baseDir,
|
|
10336
10420
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
10337
|
-
relativeFilePath:
|
|
10421
|
+
relativeFilePath: basename22(filePath),
|
|
10338
10422
|
global: this.global
|
|
10339
10423
|
})
|
|
10340
10424
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10343,7 +10427,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10343
10427
|
nonRootFilePaths.map(
|
|
10344
10428
|
(filePath) => factory.class.fromFile({
|
|
10345
10429
|
baseDir: this.baseDir,
|
|
10346
|
-
relativeFilePath:
|
|
10430
|
+
relativeFilePath: basename22(filePath),
|
|
10347
10431
|
global: this.global
|
|
10348
10432
|
})
|
|
10349
10433
|
)
|
|
@@ -10436,14 +10520,14 @@ s/<command> [arguments]
|
|
|
10436
10520
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
10437
10521
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
10438
10522
|
|
|
10439
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
10523
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
10440
10524
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
10441
10525
|
|
|
10442
10526
|
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.
|
|
10443
10527
|
|
|
10444
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
10528
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join83(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
10445
10529
|
|
|
10446
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
10530
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join83(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
10447
10531
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
10448
10532
|
const result = [
|
|
10449
10533
|
overview,
|
|
@@ -10725,15 +10809,13 @@ async function generateSkills(config) {
|
|
|
10725
10809
|
}
|
|
10726
10810
|
|
|
10727
10811
|
// src/cli/commands/gitignore.ts
|
|
10728
|
-
import { join as
|
|
10812
|
+
import { join as join84 } from "path";
|
|
10729
10813
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
10730
10814
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
10731
10815
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
10732
10816
|
// AGENTS.md
|
|
10733
10817
|
"**/AGENTS.md",
|
|
10734
10818
|
"**/.agents/",
|
|
10735
|
-
// Amazon Q
|
|
10736
|
-
"**/.amazonq/",
|
|
10737
10819
|
// Augment
|
|
10738
10820
|
"**/.augmentignore",
|
|
10739
10821
|
"**/.augment/rules/",
|
|
@@ -10750,6 +10832,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
10750
10832
|
"**/.mcp.json",
|
|
10751
10833
|
// Cline
|
|
10752
10834
|
"**/.clinerules/",
|
|
10835
|
+
"**/.clinerules/workflows/",
|
|
10753
10836
|
"**/.clineignore",
|
|
10754
10837
|
"**/.cline/mcp.json",
|
|
10755
10838
|
// Codex
|
|
@@ -10783,13 +10866,14 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
10783
10866
|
"**/.opencode/memories/",
|
|
10784
10867
|
"**/.opencode/command/",
|
|
10785
10868
|
"**/.opencode/agent/",
|
|
10786
|
-
"**/.opencode/
|
|
10869
|
+
"**/.opencode/skill/",
|
|
10787
10870
|
"**/opencode.json",
|
|
10788
10871
|
// Qwen
|
|
10789
10872
|
"**/QWEN.md",
|
|
10790
10873
|
"**/.qwen/memories/",
|
|
10791
10874
|
// Roo
|
|
10792
10875
|
"**/.roo/rules/",
|
|
10876
|
+
"**/.roo/skills/",
|
|
10793
10877
|
"**/.rooignore",
|
|
10794
10878
|
"**/.roo/mcp.json",
|
|
10795
10879
|
"**/.roo/subagents/",
|
|
@@ -10850,7 +10934,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
10850
10934
|
return result;
|
|
10851
10935
|
};
|
|
10852
10936
|
var gitignoreCommand = async () => {
|
|
10853
|
-
const gitignorePath =
|
|
10937
|
+
const gitignorePath = join84(process.cwd(), ".gitignore");
|
|
10854
10938
|
let gitignoreContent = "";
|
|
10855
10939
|
if (await fileExists(gitignorePath)) {
|
|
10856
10940
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11049,7 +11133,7 @@ async function importSkills(config, tool) {
|
|
|
11049
11133
|
}
|
|
11050
11134
|
|
|
11051
11135
|
// src/cli/commands/init.ts
|
|
11052
|
-
import { join as
|
|
11136
|
+
import { join as join85 } from "path";
|
|
11053
11137
|
async function initCommand() {
|
|
11054
11138
|
logger.info("Initializing rulesync...");
|
|
11055
11139
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11212,14 +11296,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11212
11296
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11213
11297
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
11214
11298
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11215
|
-
const ruleFilepath =
|
|
11299
|
+
const ruleFilepath = join85(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11216
11300
|
if (!await fileExists(ruleFilepath)) {
|
|
11217
11301
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11218
11302
|
logger.success(`Created ${ruleFilepath}`);
|
|
11219
11303
|
} else {
|
|
11220
11304
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11221
11305
|
}
|
|
11222
|
-
const mcpFilepath =
|
|
11306
|
+
const mcpFilepath = join85(
|
|
11223
11307
|
mcpPaths.recommended.relativeDirPath,
|
|
11224
11308
|
mcpPaths.recommended.relativeFilePath
|
|
11225
11309
|
);
|
|
@@ -11229,21 +11313,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11229
11313
|
} else {
|
|
11230
11314
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11231
11315
|
}
|
|
11232
|
-
const commandFilepath =
|
|
11316
|
+
const commandFilepath = join85(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11233
11317
|
if (!await fileExists(commandFilepath)) {
|
|
11234
11318
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11235
11319
|
logger.success(`Created ${commandFilepath}`);
|
|
11236
11320
|
} else {
|
|
11237
11321
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11238
11322
|
}
|
|
11239
|
-
const subagentFilepath =
|
|
11323
|
+
const subagentFilepath = join85(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11240
11324
|
if (!await fileExists(subagentFilepath)) {
|
|
11241
11325
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11242
11326
|
logger.success(`Created ${subagentFilepath}`);
|
|
11243
11327
|
} else {
|
|
11244
11328
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11245
11329
|
}
|
|
11246
|
-
const ignoreFilepath =
|
|
11330
|
+
const ignoreFilepath = join85(
|
|
11247
11331
|
ignorePaths.recommended.relativeDirPath,
|
|
11248
11332
|
ignorePaths.recommended.relativeFilePath
|
|
11249
11333
|
);
|
|
@@ -11259,15 +11343,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11259
11343
|
import { FastMCP } from "fastmcp";
|
|
11260
11344
|
|
|
11261
11345
|
// src/mcp/tools.ts
|
|
11262
|
-
import { z as
|
|
11346
|
+
import { z as z47 } from "zod/mini";
|
|
11263
11347
|
|
|
11264
11348
|
// src/mcp/commands.ts
|
|
11265
|
-
import { basename as
|
|
11266
|
-
import { z as
|
|
11349
|
+
import { basename as basename23, join as join86 } from "path";
|
|
11350
|
+
import { z as z41 } from "zod/mini";
|
|
11267
11351
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11268
11352
|
var maxCommandsCount = 1e3;
|
|
11269
11353
|
async function listCommands() {
|
|
11270
|
-
const commandsDir =
|
|
11354
|
+
const commandsDir = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11271
11355
|
try {
|
|
11272
11356
|
const files = await listDirectoryFiles(commandsDir);
|
|
11273
11357
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11279,7 +11363,7 @@ async function listCommands() {
|
|
|
11279
11363
|
});
|
|
11280
11364
|
const frontmatter = command.getFrontmatter();
|
|
11281
11365
|
return {
|
|
11282
|
-
relativePathFromCwd:
|
|
11366
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11283
11367
|
frontmatter
|
|
11284
11368
|
};
|
|
11285
11369
|
} catch (error) {
|
|
@@ -11299,13 +11383,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11299
11383
|
relativePath: relativePathFromCwd,
|
|
11300
11384
|
intendedRootDir: process.cwd()
|
|
11301
11385
|
});
|
|
11302
|
-
const filename =
|
|
11386
|
+
const filename = basename23(relativePathFromCwd);
|
|
11303
11387
|
try {
|
|
11304
11388
|
const command = await RulesyncCommand.fromFile({
|
|
11305
11389
|
relativeFilePath: filename
|
|
11306
11390
|
});
|
|
11307
11391
|
return {
|
|
11308
|
-
relativePathFromCwd:
|
|
11392
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11309
11393
|
frontmatter: command.getFrontmatter(),
|
|
11310
11394
|
body: command.getBody()
|
|
11311
11395
|
};
|
|
@@ -11324,7 +11408,7 @@ async function putCommand({
|
|
|
11324
11408
|
relativePath: relativePathFromCwd,
|
|
11325
11409
|
intendedRootDir: process.cwd()
|
|
11326
11410
|
});
|
|
11327
|
-
const filename =
|
|
11411
|
+
const filename = basename23(relativePathFromCwd);
|
|
11328
11412
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11329
11413
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
11330
11414
|
throw new Error(
|
|
@@ -11334,7 +11418,7 @@ async function putCommand({
|
|
|
11334
11418
|
try {
|
|
11335
11419
|
const existingCommands = await listCommands();
|
|
11336
11420
|
const isUpdate = existingCommands.some(
|
|
11337
|
-
(command2) => command2.relativePathFromCwd ===
|
|
11421
|
+
(command2) => command2.relativePathFromCwd === join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11338
11422
|
);
|
|
11339
11423
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
11340
11424
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -11349,11 +11433,11 @@ async function putCommand({
|
|
|
11349
11433
|
fileContent,
|
|
11350
11434
|
validate: true
|
|
11351
11435
|
});
|
|
11352
|
-
const commandsDir =
|
|
11436
|
+
const commandsDir = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11353
11437
|
await ensureDir(commandsDir);
|
|
11354
11438
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
11355
11439
|
return {
|
|
11356
|
-
relativePathFromCwd:
|
|
11440
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11357
11441
|
frontmatter: command.getFrontmatter(),
|
|
11358
11442
|
body: command.getBody()
|
|
11359
11443
|
};
|
|
@@ -11368,12 +11452,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11368
11452
|
relativePath: relativePathFromCwd,
|
|
11369
11453
|
intendedRootDir: process.cwd()
|
|
11370
11454
|
});
|
|
11371
|
-
const filename =
|
|
11372
|
-
const fullPath =
|
|
11455
|
+
const filename = basename23(relativePathFromCwd);
|
|
11456
|
+
const fullPath = join86(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
11373
11457
|
try {
|
|
11374
11458
|
await removeFile(fullPath);
|
|
11375
11459
|
return {
|
|
11376
|
-
relativePathFromCwd:
|
|
11460
|
+
relativePathFromCwd: join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11377
11461
|
};
|
|
11378
11462
|
} catch (error) {
|
|
11379
11463
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11382,23 +11466,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11382
11466
|
}
|
|
11383
11467
|
}
|
|
11384
11468
|
var commandToolSchemas = {
|
|
11385
|
-
listCommands:
|
|
11386
|
-
getCommand:
|
|
11387
|
-
relativePathFromCwd:
|
|
11469
|
+
listCommands: z41.object({}),
|
|
11470
|
+
getCommand: z41.object({
|
|
11471
|
+
relativePathFromCwd: z41.string()
|
|
11388
11472
|
}),
|
|
11389
|
-
putCommand:
|
|
11390
|
-
relativePathFromCwd:
|
|
11473
|
+
putCommand: z41.object({
|
|
11474
|
+
relativePathFromCwd: z41.string(),
|
|
11391
11475
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
11392
|
-
body:
|
|
11476
|
+
body: z41.string()
|
|
11393
11477
|
}),
|
|
11394
|
-
deleteCommand:
|
|
11395
|
-
relativePathFromCwd:
|
|
11478
|
+
deleteCommand: z41.object({
|
|
11479
|
+
relativePathFromCwd: z41.string()
|
|
11396
11480
|
})
|
|
11397
11481
|
};
|
|
11398
11482
|
var commandTools = {
|
|
11399
11483
|
listCommands: {
|
|
11400
11484
|
name: "listCommands",
|
|
11401
|
-
description: `List all commands from ${
|
|
11485
|
+
description: `List all commands from ${join86(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11402
11486
|
parameters: commandToolSchemas.listCommands,
|
|
11403
11487
|
execute: async () => {
|
|
11404
11488
|
const commands = await listCommands();
|
|
@@ -11440,11 +11524,11 @@ var commandTools = {
|
|
|
11440
11524
|
};
|
|
11441
11525
|
|
|
11442
11526
|
// src/mcp/ignore.ts
|
|
11443
|
-
import { join as
|
|
11444
|
-
import { z as
|
|
11527
|
+
import { join as join87 } from "path";
|
|
11528
|
+
import { z as z42 } from "zod/mini";
|
|
11445
11529
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
11446
11530
|
async function getIgnoreFile() {
|
|
11447
|
-
const ignoreFilePath =
|
|
11531
|
+
const ignoreFilePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11448
11532
|
try {
|
|
11449
11533
|
const content = await readFileContent(ignoreFilePath);
|
|
11450
11534
|
return {
|
|
@@ -11458,7 +11542,7 @@ async function getIgnoreFile() {
|
|
|
11458
11542
|
}
|
|
11459
11543
|
}
|
|
11460
11544
|
async function putIgnoreFile({ content }) {
|
|
11461
|
-
const ignoreFilePath =
|
|
11545
|
+
const ignoreFilePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11462
11546
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
11463
11547
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
11464
11548
|
throw new Error(
|
|
@@ -11479,8 +11563,8 @@ async function putIgnoreFile({ content }) {
|
|
|
11479
11563
|
}
|
|
11480
11564
|
}
|
|
11481
11565
|
async function deleteIgnoreFile() {
|
|
11482
|
-
const aiignorePath =
|
|
11483
|
-
const legacyIgnorePath =
|
|
11566
|
+
const aiignorePath = join87(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11567
|
+
const legacyIgnorePath = join87(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
11484
11568
|
try {
|
|
11485
11569
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
11486
11570
|
return {
|
|
@@ -11498,11 +11582,11 @@ async function deleteIgnoreFile() {
|
|
|
11498
11582
|
}
|
|
11499
11583
|
}
|
|
11500
11584
|
var ignoreToolSchemas = {
|
|
11501
|
-
getIgnoreFile:
|
|
11502
|
-
putIgnoreFile:
|
|
11503
|
-
content:
|
|
11585
|
+
getIgnoreFile: z42.object({}),
|
|
11586
|
+
putIgnoreFile: z42.object({
|
|
11587
|
+
content: z42.string()
|
|
11504
11588
|
}),
|
|
11505
|
-
deleteIgnoreFile:
|
|
11589
|
+
deleteIgnoreFile: z42.object({})
|
|
11506
11590
|
};
|
|
11507
11591
|
var ignoreTools = {
|
|
11508
11592
|
getIgnoreFile: {
|
|
@@ -11535,8 +11619,8 @@ var ignoreTools = {
|
|
|
11535
11619
|
};
|
|
11536
11620
|
|
|
11537
11621
|
// src/mcp/mcp.ts
|
|
11538
|
-
import { join as
|
|
11539
|
-
import { z as
|
|
11622
|
+
import { join as join88 } from "path";
|
|
11623
|
+
import { z as z43 } from "zod/mini";
|
|
11540
11624
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
11541
11625
|
async function getMcpFile() {
|
|
11542
11626
|
const config = await ConfigResolver.resolve({});
|
|
@@ -11545,7 +11629,7 @@ async function getMcpFile() {
|
|
|
11545
11629
|
validate: true,
|
|
11546
11630
|
modularMcp: config.getModularMcp()
|
|
11547
11631
|
});
|
|
11548
|
-
const relativePathFromCwd =
|
|
11632
|
+
const relativePathFromCwd = join88(
|
|
11549
11633
|
rulesyncMcp.getRelativeDirPath(),
|
|
11550
11634
|
rulesyncMcp.getRelativeFilePath()
|
|
11551
11635
|
);
|
|
@@ -11578,7 +11662,7 @@ async function putMcpFile({ content }) {
|
|
|
11578
11662
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11579
11663
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
11580
11664
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
11581
|
-
const fullPath =
|
|
11665
|
+
const fullPath = join88(baseDir, relativeDirPath, relativeFilePath);
|
|
11582
11666
|
const rulesyncMcp = new RulesyncMcp({
|
|
11583
11667
|
baseDir,
|
|
11584
11668
|
relativeDirPath,
|
|
@@ -11587,9 +11671,9 @@ async function putMcpFile({ content }) {
|
|
|
11587
11671
|
validate: true,
|
|
11588
11672
|
modularMcp: config.getModularMcp()
|
|
11589
11673
|
});
|
|
11590
|
-
await ensureDir(
|
|
11674
|
+
await ensureDir(join88(baseDir, relativeDirPath));
|
|
11591
11675
|
await writeFileContent(fullPath, content);
|
|
11592
|
-
const relativePathFromCwd =
|
|
11676
|
+
const relativePathFromCwd = join88(relativeDirPath, relativeFilePath);
|
|
11593
11677
|
return {
|
|
11594
11678
|
relativePathFromCwd,
|
|
11595
11679
|
content: rulesyncMcp.getFileContent()
|
|
@@ -11604,15 +11688,15 @@ async function deleteMcpFile() {
|
|
|
11604
11688
|
try {
|
|
11605
11689
|
const baseDir = process.cwd();
|
|
11606
11690
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11607
|
-
const recommendedPath =
|
|
11691
|
+
const recommendedPath = join88(
|
|
11608
11692
|
baseDir,
|
|
11609
11693
|
paths.recommended.relativeDirPath,
|
|
11610
11694
|
paths.recommended.relativeFilePath
|
|
11611
11695
|
);
|
|
11612
|
-
const legacyPath =
|
|
11696
|
+
const legacyPath = join88(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
11613
11697
|
await removeFile(recommendedPath);
|
|
11614
11698
|
await removeFile(legacyPath);
|
|
11615
|
-
const relativePathFromCwd =
|
|
11699
|
+
const relativePathFromCwd = join88(
|
|
11616
11700
|
paths.recommended.relativeDirPath,
|
|
11617
11701
|
paths.recommended.relativeFilePath
|
|
11618
11702
|
);
|
|
@@ -11626,11 +11710,11 @@ async function deleteMcpFile() {
|
|
|
11626
11710
|
}
|
|
11627
11711
|
}
|
|
11628
11712
|
var mcpToolSchemas = {
|
|
11629
|
-
getMcpFile:
|
|
11630
|
-
putMcpFile:
|
|
11631
|
-
content:
|
|
11713
|
+
getMcpFile: z43.object({}),
|
|
11714
|
+
putMcpFile: z43.object({
|
|
11715
|
+
content: z43.string()
|
|
11632
11716
|
}),
|
|
11633
|
-
deleteMcpFile:
|
|
11717
|
+
deleteMcpFile: z43.object({})
|
|
11634
11718
|
};
|
|
11635
11719
|
var mcpTools = {
|
|
11636
11720
|
getMcpFile: {
|
|
@@ -11663,12 +11747,12 @@ var mcpTools = {
|
|
|
11663
11747
|
};
|
|
11664
11748
|
|
|
11665
11749
|
// src/mcp/rules.ts
|
|
11666
|
-
import { basename as
|
|
11667
|
-
import { z as
|
|
11750
|
+
import { basename as basename24, join as join89 } from "path";
|
|
11751
|
+
import { z as z44 } from "zod/mini";
|
|
11668
11752
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
11669
11753
|
var maxRulesCount = 1e3;
|
|
11670
11754
|
async function listRules() {
|
|
11671
|
-
const rulesDir =
|
|
11755
|
+
const rulesDir = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11672
11756
|
try {
|
|
11673
11757
|
const files = await listDirectoryFiles(rulesDir);
|
|
11674
11758
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11681,7 +11765,7 @@ async function listRules() {
|
|
|
11681
11765
|
});
|
|
11682
11766
|
const frontmatter = rule.getFrontmatter();
|
|
11683
11767
|
return {
|
|
11684
|
-
relativePathFromCwd:
|
|
11768
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
11685
11769
|
frontmatter
|
|
11686
11770
|
};
|
|
11687
11771
|
} catch (error) {
|
|
@@ -11701,14 +11785,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
11701
11785
|
relativePath: relativePathFromCwd,
|
|
11702
11786
|
intendedRootDir: process.cwd()
|
|
11703
11787
|
});
|
|
11704
|
-
const filename =
|
|
11788
|
+
const filename = basename24(relativePathFromCwd);
|
|
11705
11789
|
try {
|
|
11706
11790
|
const rule = await RulesyncRule.fromFile({
|
|
11707
11791
|
relativeFilePath: filename,
|
|
11708
11792
|
validate: true
|
|
11709
11793
|
});
|
|
11710
11794
|
return {
|
|
11711
|
-
relativePathFromCwd:
|
|
11795
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11712
11796
|
frontmatter: rule.getFrontmatter(),
|
|
11713
11797
|
body: rule.getBody()
|
|
11714
11798
|
};
|
|
@@ -11727,7 +11811,7 @@ async function putRule({
|
|
|
11727
11811
|
relativePath: relativePathFromCwd,
|
|
11728
11812
|
intendedRootDir: process.cwd()
|
|
11729
11813
|
});
|
|
11730
|
-
const filename =
|
|
11814
|
+
const filename = basename24(relativePathFromCwd);
|
|
11731
11815
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11732
11816
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
11733
11817
|
throw new Error(
|
|
@@ -11737,7 +11821,7 @@ async function putRule({
|
|
|
11737
11821
|
try {
|
|
11738
11822
|
const existingRules = await listRules();
|
|
11739
11823
|
const isUpdate = existingRules.some(
|
|
11740
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
11824
|
+
(rule2) => rule2.relativePathFromCwd === join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11741
11825
|
);
|
|
11742
11826
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
11743
11827
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -11750,11 +11834,11 @@ async function putRule({
|
|
|
11750
11834
|
body,
|
|
11751
11835
|
validate: true
|
|
11752
11836
|
});
|
|
11753
|
-
const rulesDir =
|
|
11837
|
+
const rulesDir = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11754
11838
|
await ensureDir(rulesDir);
|
|
11755
11839
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
11756
11840
|
return {
|
|
11757
|
-
relativePathFromCwd:
|
|
11841
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11758
11842
|
frontmatter: rule.getFrontmatter(),
|
|
11759
11843
|
body: rule.getBody()
|
|
11760
11844
|
};
|
|
@@ -11769,12 +11853,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11769
11853
|
relativePath: relativePathFromCwd,
|
|
11770
11854
|
intendedRootDir: process.cwd()
|
|
11771
11855
|
});
|
|
11772
|
-
const filename =
|
|
11773
|
-
const fullPath =
|
|
11856
|
+
const filename = basename24(relativePathFromCwd);
|
|
11857
|
+
const fullPath = join89(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
11774
11858
|
try {
|
|
11775
11859
|
await removeFile(fullPath);
|
|
11776
11860
|
return {
|
|
11777
|
-
relativePathFromCwd:
|
|
11861
|
+
relativePathFromCwd: join89(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11778
11862
|
};
|
|
11779
11863
|
} catch (error) {
|
|
11780
11864
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11783,23 +11867,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11783
11867
|
}
|
|
11784
11868
|
}
|
|
11785
11869
|
var ruleToolSchemas = {
|
|
11786
|
-
listRules:
|
|
11787
|
-
getRule:
|
|
11788
|
-
relativePathFromCwd:
|
|
11870
|
+
listRules: z44.object({}),
|
|
11871
|
+
getRule: z44.object({
|
|
11872
|
+
relativePathFromCwd: z44.string()
|
|
11789
11873
|
}),
|
|
11790
|
-
putRule:
|
|
11791
|
-
relativePathFromCwd:
|
|
11874
|
+
putRule: z44.object({
|
|
11875
|
+
relativePathFromCwd: z44.string(),
|
|
11792
11876
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
11793
|
-
body:
|
|
11877
|
+
body: z44.string()
|
|
11794
11878
|
}),
|
|
11795
|
-
deleteRule:
|
|
11796
|
-
relativePathFromCwd:
|
|
11879
|
+
deleteRule: z44.object({
|
|
11880
|
+
relativePathFromCwd: z44.string()
|
|
11797
11881
|
})
|
|
11798
11882
|
};
|
|
11799
11883
|
var ruleTools = {
|
|
11800
11884
|
listRules: {
|
|
11801
11885
|
name: "listRules",
|
|
11802
|
-
description: `List all rules from ${
|
|
11886
|
+
description: `List all rules from ${join89(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11803
11887
|
parameters: ruleToolSchemas.listRules,
|
|
11804
11888
|
execute: async () => {
|
|
11805
11889
|
const rules = await listRules();
|
|
@@ -11841,8 +11925,8 @@ var ruleTools = {
|
|
|
11841
11925
|
};
|
|
11842
11926
|
|
|
11843
11927
|
// src/mcp/skills.ts
|
|
11844
|
-
import { basename as
|
|
11845
|
-
import { z as
|
|
11928
|
+
import { basename as basename25, dirname as dirname2, join as join90 } from "path";
|
|
11929
|
+
import { z as z45 } from "zod/mini";
|
|
11846
11930
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
11847
11931
|
var maxSkillsCount = 1e3;
|
|
11848
11932
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -11858,19 +11942,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
11858
11942
|
};
|
|
11859
11943
|
}
|
|
11860
11944
|
function extractDirName(relativeDirPathFromCwd) {
|
|
11861
|
-
const dirName =
|
|
11945
|
+
const dirName = basename25(relativeDirPathFromCwd);
|
|
11862
11946
|
if (!dirName) {
|
|
11863
11947
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
11864
11948
|
}
|
|
11865
11949
|
return dirName;
|
|
11866
11950
|
}
|
|
11867
11951
|
async function listSkills() {
|
|
11868
|
-
const skillsDir =
|
|
11952
|
+
const skillsDir = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
11869
11953
|
try {
|
|
11870
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
11954
|
+
const skillDirPaths = await findFilesByGlobs(join90(skillsDir, "*"), { type: "dir" });
|
|
11871
11955
|
const skills = await Promise.all(
|
|
11872
11956
|
skillDirPaths.map(async (dirPath) => {
|
|
11873
|
-
const dirName =
|
|
11957
|
+
const dirName = basename25(dirPath);
|
|
11874
11958
|
if (!dirName) return null;
|
|
11875
11959
|
try {
|
|
11876
11960
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -11878,7 +11962,7 @@ async function listSkills() {
|
|
|
11878
11962
|
});
|
|
11879
11963
|
const frontmatter = skill.getFrontmatter();
|
|
11880
11964
|
return {
|
|
11881
|
-
relativeDirPathFromCwd:
|
|
11965
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11882
11966
|
frontmatter
|
|
11883
11967
|
};
|
|
11884
11968
|
} catch (error) {
|
|
@@ -11904,7 +11988,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
11904
11988
|
dirName
|
|
11905
11989
|
});
|
|
11906
11990
|
return {
|
|
11907
|
-
relativeDirPathFromCwd:
|
|
11991
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11908
11992
|
frontmatter: skill.getFrontmatter(),
|
|
11909
11993
|
body: skill.getBody(),
|
|
11910
11994
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -11938,7 +12022,7 @@ async function putSkill({
|
|
|
11938
12022
|
try {
|
|
11939
12023
|
const existingSkills = await listSkills();
|
|
11940
12024
|
const isUpdate = existingSkills.some(
|
|
11941
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
12025
|
+
(skill2) => skill2.relativeDirPathFromCwd === join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
11942
12026
|
);
|
|
11943
12027
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
11944
12028
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -11953,9 +12037,9 @@ async function putSkill({
|
|
|
11953
12037
|
otherFiles: aiDirFiles,
|
|
11954
12038
|
validate: true
|
|
11955
12039
|
});
|
|
11956
|
-
const skillDirPath =
|
|
12040
|
+
const skillDirPath = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
11957
12041
|
await ensureDir(skillDirPath);
|
|
11958
|
-
const skillFilePath =
|
|
12042
|
+
const skillFilePath = join90(skillDirPath, SKILL_FILE_NAME);
|
|
11959
12043
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
11960
12044
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
11961
12045
|
for (const file of otherFiles) {
|
|
@@ -11963,15 +12047,15 @@ async function putSkill({
|
|
|
11963
12047
|
relativePath: file.name,
|
|
11964
12048
|
intendedRootDir: skillDirPath
|
|
11965
12049
|
});
|
|
11966
|
-
const filePath =
|
|
11967
|
-
const fileDir =
|
|
12050
|
+
const filePath = join90(skillDirPath, file.name);
|
|
12051
|
+
const fileDir = join90(skillDirPath, dirname2(file.name));
|
|
11968
12052
|
if (fileDir !== skillDirPath) {
|
|
11969
12053
|
await ensureDir(fileDir);
|
|
11970
12054
|
}
|
|
11971
12055
|
await writeFileContent(filePath, file.body);
|
|
11972
12056
|
}
|
|
11973
12057
|
return {
|
|
11974
|
-
relativeDirPathFromCwd:
|
|
12058
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11975
12059
|
frontmatter: skill.getFrontmatter(),
|
|
11976
12060
|
body: skill.getBody(),
|
|
11977
12061
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -11993,13 +12077,13 @@ async function deleteSkill({
|
|
|
11993
12077
|
intendedRootDir: process.cwd()
|
|
11994
12078
|
});
|
|
11995
12079
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
11996
|
-
const skillDirPath =
|
|
12080
|
+
const skillDirPath = join90(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
11997
12081
|
try {
|
|
11998
12082
|
if (await directoryExists(skillDirPath)) {
|
|
11999
12083
|
await removeDirectory(skillDirPath);
|
|
12000
12084
|
}
|
|
12001
12085
|
return {
|
|
12002
|
-
relativeDirPathFromCwd:
|
|
12086
|
+
relativeDirPathFromCwd: join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12003
12087
|
};
|
|
12004
12088
|
} catch (error) {
|
|
12005
12089
|
throw new Error(
|
|
@@ -12010,29 +12094,29 @@ async function deleteSkill({
|
|
|
12010
12094
|
);
|
|
12011
12095
|
}
|
|
12012
12096
|
}
|
|
12013
|
-
var McpSkillFileSchema =
|
|
12014
|
-
name:
|
|
12015
|
-
body:
|
|
12097
|
+
var McpSkillFileSchema = z45.object({
|
|
12098
|
+
name: z45.string(),
|
|
12099
|
+
body: z45.string()
|
|
12016
12100
|
});
|
|
12017
12101
|
var skillToolSchemas = {
|
|
12018
|
-
listSkills:
|
|
12019
|
-
getSkill:
|
|
12020
|
-
relativeDirPathFromCwd:
|
|
12102
|
+
listSkills: z45.object({}),
|
|
12103
|
+
getSkill: z45.object({
|
|
12104
|
+
relativeDirPathFromCwd: z45.string()
|
|
12021
12105
|
}),
|
|
12022
|
-
putSkill:
|
|
12023
|
-
relativeDirPathFromCwd:
|
|
12106
|
+
putSkill: z45.object({
|
|
12107
|
+
relativeDirPathFromCwd: z45.string(),
|
|
12024
12108
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12025
|
-
body:
|
|
12026
|
-
otherFiles:
|
|
12109
|
+
body: z45.string(),
|
|
12110
|
+
otherFiles: z45.optional(z45.array(McpSkillFileSchema))
|
|
12027
12111
|
}),
|
|
12028
|
-
deleteSkill:
|
|
12029
|
-
relativeDirPathFromCwd:
|
|
12112
|
+
deleteSkill: z45.object({
|
|
12113
|
+
relativeDirPathFromCwd: z45.string()
|
|
12030
12114
|
})
|
|
12031
12115
|
};
|
|
12032
12116
|
var skillTools = {
|
|
12033
12117
|
listSkills: {
|
|
12034
12118
|
name: "listSkills",
|
|
12035
|
-
description: `List all skills from ${
|
|
12119
|
+
description: `List all skills from ${join90(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12036
12120
|
parameters: skillToolSchemas.listSkills,
|
|
12037
12121
|
execute: async () => {
|
|
12038
12122
|
const skills = await listSkills();
|
|
@@ -12075,12 +12159,12 @@ var skillTools = {
|
|
|
12075
12159
|
};
|
|
12076
12160
|
|
|
12077
12161
|
// src/mcp/subagents.ts
|
|
12078
|
-
import { basename as
|
|
12079
|
-
import { z as
|
|
12162
|
+
import { basename as basename26, join as join91 } from "path";
|
|
12163
|
+
import { z as z46 } from "zod/mini";
|
|
12080
12164
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12081
12165
|
var maxSubagentsCount = 1e3;
|
|
12082
12166
|
async function listSubagents() {
|
|
12083
|
-
const subagentsDir =
|
|
12167
|
+
const subagentsDir = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12084
12168
|
try {
|
|
12085
12169
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12086
12170
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12093,7 +12177,7 @@ async function listSubagents() {
|
|
|
12093
12177
|
});
|
|
12094
12178
|
const frontmatter = subagent.getFrontmatter();
|
|
12095
12179
|
return {
|
|
12096
|
-
relativePathFromCwd:
|
|
12180
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12097
12181
|
frontmatter
|
|
12098
12182
|
};
|
|
12099
12183
|
} catch (error) {
|
|
@@ -12115,14 +12199,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12115
12199
|
relativePath: relativePathFromCwd,
|
|
12116
12200
|
intendedRootDir: process.cwd()
|
|
12117
12201
|
});
|
|
12118
|
-
const filename =
|
|
12202
|
+
const filename = basename26(relativePathFromCwd);
|
|
12119
12203
|
try {
|
|
12120
12204
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12121
12205
|
relativeFilePath: filename,
|
|
12122
12206
|
validate: true
|
|
12123
12207
|
});
|
|
12124
12208
|
return {
|
|
12125
|
-
relativePathFromCwd:
|
|
12209
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12126
12210
|
frontmatter: subagent.getFrontmatter(),
|
|
12127
12211
|
body: subagent.getBody()
|
|
12128
12212
|
};
|
|
@@ -12141,7 +12225,7 @@ async function putSubagent({
|
|
|
12141
12225
|
relativePath: relativePathFromCwd,
|
|
12142
12226
|
intendedRootDir: process.cwd()
|
|
12143
12227
|
});
|
|
12144
|
-
const filename =
|
|
12228
|
+
const filename = basename26(relativePathFromCwd);
|
|
12145
12229
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12146
12230
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12147
12231
|
throw new Error(
|
|
@@ -12151,7 +12235,7 @@ async function putSubagent({
|
|
|
12151
12235
|
try {
|
|
12152
12236
|
const existingSubagents = await listSubagents();
|
|
12153
12237
|
const isUpdate = existingSubagents.some(
|
|
12154
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
12238
|
+
(subagent2) => subagent2.relativePathFromCwd === join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12155
12239
|
);
|
|
12156
12240
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12157
12241
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12164,11 +12248,11 @@ async function putSubagent({
|
|
|
12164
12248
|
body,
|
|
12165
12249
|
validate: true
|
|
12166
12250
|
});
|
|
12167
|
-
const subagentsDir =
|
|
12251
|
+
const subagentsDir = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12168
12252
|
await ensureDir(subagentsDir);
|
|
12169
12253
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12170
12254
|
return {
|
|
12171
|
-
relativePathFromCwd:
|
|
12255
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12172
12256
|
frontmatter: subagent.getFrontmatter(),
|
|
12173
12257
|
body: subagent.getBody()
|
|
12174
12258
|
};
|
|
@@ -12183,12 +12267,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12183
12267
|
relativePath: relativePathFromCwd,
|
|
12184
12268
|
intendedRootDir: process.cwd()
|
|
12185
12269
|
});
|
|
12186
|
-
const filename =
|
|
12187
|
-
const fullPath =
|
|
12270
|
+
const filename = basename26(relativePathFromCwd);
|
|
12271
|
+
const fullPath = join91(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12188
12272
|
try {
|
|
12189
12273
|
await removeFile(fullPath);
|
|
12190
12274
|
return {
|
|
12191
|
-
relativePathFromCwd:
|
|
12275
|
+
relativePathFromCwd: join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12192
12276
|
};
|
|
12193
12277
|
} catch (error) {
|
|
12194
12278
|
throw new Error(
|
|
@@ -12200,23 +12284,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12200
12284
|
}
|
|
12201
12285
|
}
|
|
12202
12286
|
var subagentToolSchemas = {
|
|
12203
|
-
listSubagents:
|
|
12204
|
-
getSubagent:
|
|
12205
|
-
relativePathFromCwd:
|
|
12287
|
+
listSubagents: z46.object({}),
|
|
12288
|
+
getSubagent: z46.object({
|
|
12289
|
+
relativePathFromCwd: z46.string()
|
|
12206
12290
|
}),
|
|
12207
|
-
putSubagent:
|
|
12208
|
-
relativePathFromCwd:
|
|
12291
|
+
putSubagent: z46.object({
|
|
12292
|
+
relativePathFromCwd: z46.string(),
|
|
12209
12293
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12210
|
-
body:
|
|
12294
|
+
body: z46.string()
|
|
12211
12295
|
}),
|
|
12212
|
-
deleteSubagent:
|
|
12213
|
-
relativePathFromCwd:
|
|
12296
|
+
deleteSubagent: z46.object({
|
|
12297
|
+
relativePathFromCwd: z46.string()
|
|
12214
12298
|
})
|
|
12215
12299
|
};
|
|
12216
12300
|
var subagentTools = {
|
|
12217
12301
|
listSubagents: {
|
|
12218
12302
|
name: "listSubagents",
|
|
12219
|
-
description: `List all subagents from ${
|
|
12303
|
+
description: `List all subagents from ${join91(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12220
12304
|
parameters: subagentToolSchemas.listSubagents,
|
|
12221
12305
|
execute: async () => {
|
|
12222
12306
|
const subagents = await listSubagents();
|
|
@@ -12258,20 +12342,20 @@ var subagentTools = {
|
|
|
12258
12342
|
};
|
|
12259
12343
|
|
|
12260
12344
|
// src/mcp/tools.ts
|
|
12261
|
-
var rulesyncFeatureSchema =
|
|
12262
|
-
var rulesyncOperationSchema =
|
|
12263
|
-
var skillFileSchema =
|
|
12264
|
-
name:
|
|
12265
|
-
body:
|
|
12345
|
+
var rulesyncFeatureSchema = z47.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
12346
|
+
var rulesyncOperationSchema = z47.enum(["list", "get", "put", "delete"]);
|
|
12347
|
+
var skillFileSchema = z47.object({
|
|
12348
|
+
name: z47.string(),
|
|
12349
|
+
body: z47.string()
|
|
12266
12350
|
});
|
|
12267
|
-
var rulesyncToolSchema =
|
|
12351
|
+
var rulesyncToolSchema = z47.object({
|
|
12268
12352
|
feature: rulesyncFeatureSchema,
|
|
12269
12353
|
operation: rulesyncOperationSchema,
|
|
12270
|
-
targetPathFromCwd:
|
|
12271
|
-
frontmatter:
|
|
12272
|
-
body:
|
|
12273
|
-
otherFiles:
|
|
12274
|
-
content:
|
|
12354
|
+
targetPathFromCwd: z47.optional(z47.string()),
|
|
12355
|
+
frontmatter: z47.optional(z47.unknown()),
|
|
12356
|
+
body: z47.optional(z47.string()),
|
|
12357
|
+
otherFiles: z47.optional(z47.array(skillFileSchema)),
|
|
12358
|
+
content: z47.optional(z47.string())
|
|
12275
12359
|
});
|
|
12276
12360
|
var supportedOperationsByFeature = {
|
|
12277
12361
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -12467,7 +12551,7 @@ async function mcpCommand({ version }) {
|
|
|
12467
12551
|
}
|
|
12468
12552
|
|
|
12469
12553
|
// src/cli/index.ts
|
|
12470
|
-
var getVersion = () => "
|
|
12554
|
+
var getVersion = () => "5.0.0";
|
|
12471
12555
|
var main = async () => {
|
|
12472
12556
|
const program = new Command();
|
|
12473
12557
|
const version = getVersion();
|