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.cjs
CHANGED
|
@@ -256,7 +256,6 @@ var import_mini3 = require("zod/mini");
|
|
|
256
256
|
var import_mini2 = require("zod/mini");
|
|
257
257
|
var ALL_TOOL_TARGETS = [
|
|
258
258
|
"agentsmd",
|
|
259
|
-
"amazonqcli",
|
|
260
259
|
"antigravity",
|
|
261
260
|
"augmentcode",
|
|
262
261
|
"augmentcode-legacy",
|
|
@@ -485,7 +484,7 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
485
484
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = (0, import_node_path3.join)(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
486
485
|
|
|
487
486
|
// src/features/commands/commands-processor.ts
|
|
488
|
-
var
|
|
487
|
+
var import_node_path17 = require("path");
|
|
489
488
|
var import_mini12 = require("zod/mini");
|
|
490
489
|
|
|
491
490
|
// src/types/feature-processor.ts
|
|
@@ -1275,15 +1274,103 @@ var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
|
1275
1274
|
}
|
|
1276
1275
|
};
|
|
1277
1276
|
|
|
1278
|
-
// src/features/commands/
|
|
1277
|
+
// src/features/commands/cline-command.ts
|
|
1279
1278
|
var import_node_path10 = require("path");
|
|
1279
|
+
var ClineCommand = class _ClineCommand extends ToolCommand {
|
|
1280
|
+
static getSettablePaths({ global } = {}) {
|
|
1281
|
+
if (global) {
|
|
1282
|
+
return {
|
|
1283
|
+
relativeDirPath: (0, import_node_path10.join)("Documents", "Cline", "Workflows")
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
return {
|
|
1287
|
+
relativeDirPath: (0, import_node_path10.join)(".clinerules", "workflows")
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
toRulesyncCommand() {
|
|
1291
|
+
const rulesyncFrontmatter = {
|
|
1292
|
+
targets: ["*"],
|
|
1293
|
+
description: ""
|
|
1294
|
+
};
|
|
1295
|
+
return new RulesyncCommand({
|
|
1296
|
+
baseDir: process.cwd(),
|
|
1297
|
+
frontmatter: rulesyncFrontmatter,
|
|
1298
|
+
body: this.getFileContent(),
|
|
1299
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1300
|
+
relativeFilePath: this.relativeFilePath,
|
|
1301
|
+
fileContent: this.getFileContent(),
|
|
1302
|
+
validate: true
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
static fromRulesyncCommand({
|
|
1306
|
+
baseDir = process.cwd(),
|
|
1307
|
+
rulesyncCommand,
|
|
1308
|
+
validate = true,
|
|
1309
|
+
global = false
|
|
1310
|
+
}) {
|
|
1311
|
+
const paths = this.getSettablePaths({ global });
|
|
1312
|
+
return new _ClineCommand({
|
|
1313
|
+
baseDir,
|
|
1314
|
+
fileContent: rulesyncCommand.getBody(),
|
|
1315
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1316
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1317
|
+
validate
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
validate() {
|
|
1321
|
+
return { success: true, error: null };
|
|
1322
|
+
}
|
|
1323
|
+
getBody() {
|
|
1324
|
+
return this.getFileContent();
|
|
1325
|
+
}
|
|
1326
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1327
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1328
|
+
rulesyncCommand,
|
|
1329
|
+
toolTarget: "cline"
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
static async fromFile({
|
|
1333
|
+
baseDir = process.cwd(),
|
|
1334
|
+
relativeFilePath,
|
|
1335
|
+
validate = true,
|
|
1336
|
+
global = false
|
|
1337
|
+
}) {
|
|
1338
|
+
const paths = this.getSettablePaths({ global });
|
|
1339
|
+
const filePath = (0, import_node_path10.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1340
|
+
const fileContent = await readFileContent(filePath);
|
|
1341
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
1342
|
+
return new _ClineCommand({
|
|
1343
|
+
baseDir,
|
|
1344
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1345
|
+
relativeFilePath: (0, import_node_path10.basename)(relativeFilePath),
|
|
1346
|
+
fileContent: content.trim(),
|
|
1347
|
+
validate
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
static forDeletion({
|
|
1351
|
+
baseDir = process.cwd(),
|
|
1352
|
+
relativeDirPath,
|
|
1353
|
+
relativeFilePath
|
|
1354
|
+
}) {
|
|
1355
|
+
return new _ClineCommand({
|
|
1356
|
+
baseDir,
|
|
1357
|
+
relativeDirPath,
|
|
1358
|
+
relativeFilePath,
|
|
1359
|
+
fileContent: "",
|
|
1360
|
+
validate: false
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
// src/features/commands/codexcli-command.ts
|
|
1366
|
+
var import_node_path11 = require("path");
|
|
1280
1367
|
var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
1281
1368
|
static getSettablePaths({ global } = {}) {
|
|
1282
1369
|
if (!global) {
|
|
1283
1370
|
throw new Error("CodexcliCommand only supports global mode. Please pass { global: true }.");
|
|
1284
1371
|
}
|
|
1285
1372
|
return {
|
|
1286
|
-
relativeDirPath: (0,
|
|
1373
|
+
relativeDirPath: (0, import_node_path11.join)(".codex", "prompts")
|
|
1287
1374
|
};
|
|
1288
1375
|
}
|
|
1289
1376
|
toRulesyncCommand() {
|
|
@@ -1336,13 +1423,13 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1336
1423
|
global = false
|
|
1337
1424
|
}) {
|
|
1338
1425
|
const paths = this.getSettablePaths({ global });
|
|
1339
|
-
const filePath = (0,
|
|
1426
|
+
const filePath = (0, import_node_path11.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1340
1427
|
const fileContent = await readFileContent(filePath);
|
|
1341
1428
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1342
1429
|
return new _CodexcliCommand({
|
|
1343
1430
|
baseDir,
|
|
1344
1431
|
relativeDirPath: paths.relativeDirPath,
|
|
1345
|
-
relativeFilePath: (0,
|
|
1432
|
+
relativeFilePath: (0, import_node_path11.basename)(relativeFilePath),
|
|
1346
1433
|
fileContent: content.trim(),
|
|
1347
1434
|
validate
|
|
1348
1435
|
});
|
|
@@ -1363,7 +1450,7 @@ var CodexcliCommand = class _CodexcliCommand extends ToolCommand {
|
|
|
1363
1450
|
};
|
|
1364
1451
|
|
|
1365
1452
|
// src/features/commands/copilot-command.ts
|
|
1366
|
-
var
|
|
1453
|
+
var import_node_path12 = require("path");
|
|
1367
1454
|
var import_mini8 = require("zod/mini");
|
|
1368
1455
|
var CopilotCommandFrontmatterSchema = import_mini8.z.looseObject({
|
|
1369
1456
|
mode: import_mini8.z.optional(import_mini8.z.string()),
|
|
@@ -1377,7 +1464,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1377
1464
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1378
1465
|
if (!result.success) {
|
|
1379
1466
|
throw new Error(
|
|
1380
|
-
`Invalid frontmatter in ${(0,
|
|
1467
|
+
`Invalid frontmatter in ${(0, import_node_path12.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1381
1468
|
);
|
|
1382
1469
|
}
|
|
1383
1470
|
}
|
|
@@ -1390,7 +1477,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1390
1477
|
}
|
|
1391
1478
|
static getSettablePaths() {
|
|
1392
1479
|
return {
|
|
1393
|
-
relativeDirPath: (0,
|
|
1480
|
+
relativeDirPath: (0, import_node_path12.join)(".github", "prompts")
|
|
1394
1481
|
};
|
|
1395
1482
|
}
|
|
1396
1483
|
getBody() {
|
|
@@ -1430,7 +1517,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1430
1517
|
return {
|
|
1431
1518
|
success: false,
|
|
1432
1519
|
error: new Error(
|
|
1433
|
-
`Invalid frontmatter in ${(0,
|
|
1520
|
+
`Invalid frontmatter in ${(0, import_node_path12.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1434
1521
|
)
|
|
1435
1522
|
};
|
|
1436
1523
|
}
|
|
@@ -1465,7 +1552,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1465
1552
|
validate = true
|
|
1466
1553
|
}) {
|
|
1467
1554
|
const paths = this.getSettablePaths();
|
|
1468
|
-
const filePath = (0,
|
|
1555
|
+
const filePath = (0, import_node_path12.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1469
1556
|
const fileContent = await readFileContent(filePath);
|
|
1470
1557
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1471
1558
|
const result = CopilotCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1475,7 +1562,7 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1475
1562
|
return new _CopilotCommand({
|
|
1476
1563
|
baseDir,
|
|
1477
1564
|
relativeDirPath: paths.relativeDirPath,
|
|
1478
|
-
relativeFilePath: (0,
|
|
1565
|
+
relativeFilePath: (0, import_node_path12.basename)(relativeFilePath),
|
|
1479
1566
|
frontmatter: result.data,
|
|
1480
1567
|
body: content.trim(),
|
|
1481
1568
|
validate
|
|
@@ -1504,11 +1591,11 @@ var CopilotCommand = class _CopilotCommand extends ToolCommand {
|
|
|
1504
1591
|
};
|
|
1505
1592
|
|
|
1506
1593
|
// src/features/commands/cursor-command.ts
|
|
1507
|
-
var
|
|
1594
|
+
var import_node_path13 = require("path");
|
|
1508
1595
|
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
1509
1596
|
static getSettablePaths(_options = {}) {
|
|
1510
1597
|
return {
|
|
1511
|
-
relativeDirPath: (0,
|
|
1598
|
+
relativeDirPath: (0, import_node_path13.join)(".cursor", "commands")
|
|
1512
1599
|
};
|
|
1513
1600
|
}
|
|
1514
1601
|
toRulesyncCommand() {
|
|
@@ -1561,13 +1648,13 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1561
1648
|
global = false
|
|
1562
1649
|
}) {
|
|
1563
1650
|
const paths = this.getSettablePaths({ global });
|
|
1564
|
-
const filePath = (0,
|
|
1651
|
+
const filePath = (0, import_node_path13.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1565
1652
|
const fileContent = await readFileContent(filePath);
|
|
1566
1653
|
const { body: content } = parseFrontmatter(fileContent);
|
|
1567
1654
|
return new _CursorCommand({
|
|
1568
1655
|
baseDir,
|
|
1569
1656
|
relativeDirPath: paths.relativeDirPath,
|
|
1570
|
-
relativeFilePath: (0,
|
|
1657
|
+
relativeFilePath: (0, import_node_path13.basename)(relativeFilePath),
|
|
1571
1658
|
fileContent: content.trim(),
|
|
1572
1659
|
validate
|
|
1573
1660
|
});
|
|
@@ -1588,7 +1675,7 @@ var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
|
1588
1675
|
};
|
|
1589
1676
|
|
|
1590
1677
|
// src/features/commands/geminicli-command.ts
|
|
1591
|
-
var
|
|
1678
|
+
var import_node_path14 = require("path");
|
|
1592
1679
|
var import_smol_toml = require("smol-toml");
|
|
1593
1680
|
var import_mini9 = require("zod/mini");
|
|
1594
1681
|
var GeminiCliCommandFrontmatterSchema = import_mini9.z.looseObject({
|
|
@@ -1606,7 +1693,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
1606
1693
|
}
|
|
1607
1694
|
static getSettablePaths(_options = {}) {
|
|
1608
1695
|
return {
|
|
1609
|
-
relativeDirPath: (0,
|
|
1696
|
+
relativeDirPath: (0, import_node_path14.join)(".gemini", "commands")
|
|
1610
1697
|
};
|
|
1611
1698
|
}
|
|
1612
1699
|
parseTomlContent(content) {
|
|
@@ -1688,12 +1775,12 @@ ${geminiFrontmatter.prompt}
|
|
|
1688
1775
|
global = false
|
|
1689
1776
|
}) {
|
|
1690
1777
|
const paths = this.getSettablePaths({ global });
|
|
1691
|
-
const filePath = (0,
|
|
1778
|
+
const filePath = (0, import_node_path14.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1692
1779
|
const fileContent = await readFileContent(filePath);
|
|
1693
1780
|
return new _GeminiCliCommand({
|
|
1694
1781
|
baseDir,
|
|
1695
1782
|
relativeDirPath: paths.relativeDirPath,
|
|
1696
|
-
relativeFilePath: (0,
|
|
1783
|
+
relativeFilePath: (0, import_node_path14.basename)(relativeFilePath),
|
|
1697
1784
|
fileContent,
|
|
1698
1785
|
validate
|
|
1699
1786
|
});
|
|
@@ -1730,7 +1817,7 @@ prompt = ""`;
|
|
|
1730
1817
|
};
|
|
1731
1818
|
|
|
1732
1819
|
// src/features/commands/opencode-command.ts
|
|
1733
|
-
var
|
|
1820
|
+
var import_node_path15 = require("path");
|
|
1734
1821
|
var import_mini10 = require("zod/mini");
|
|
1735
1822
|
var OpenCodeCommandFrontmatterSchema = import_mini10.z.looseObject({
|
|
1736
1823
|
description: import_mini10.z.string(),
|
|
@@ -1746,7 +1833,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1746
1833
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1747
1834
|
if (!result.success) {
|
|
1748
1835
|
throw new Error(
|
|
1749
|
-
`Invalid frontmatter in ${(0,
|
|
1836
|
+
`Invalid frontmatter in ${(0, import_node_path15.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1750
1837
|
);
|
|
1751
1838
|
}
|
|
1752
1839
|
}
|
|
@@ -1759,7 +1846,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1759
1846
|
}
|
|
1760
1847
|
static getSettablePaths({ global } = {}) {
|
|
1761
1848
|
return {
|
|
1762
|
-
relativeDirPath: global ? (0,
|
|
1849
|
+
relativeDirPath: global ? (0, import_node_path15.join)(".config", "opencode", "command") : (0, import_node_path15.join)(".opencode", "command")
|
|
1763
1850
|
};
|
|
1764
1851
|
}
|
|
1765
1852
|
getBody() {
|
|
@@ -1820,7 +1907,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1820
1907
|
return {
|
|
1821
1908
|
success: false,
|
|
1822
1909
|
error: new Error(
|
|
1823
|
-
`Invalid frontmatter in ${(0,
|
|
1910
|
+
`Invalid frontmatter in ${(0, import_node_path15.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1824
1911
|
)
|
|
1825
1912
|
};
|
|
1826
1913
|
}
|
|
@@ -1831,7 +1918,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1831
1918
|
global = false
|
|
1832
1919
|
}) {
|
|
1833
1920
|
const paths = this.getSettablePaths({ global });
|
|
1834
|
-
const filePath = (0,
|
|
1921
|
+
const filePath = (0, import_node_path15.join)(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1835
1922
|
const fileContent = await readFileContent(filePath);
|
|
1836
1923
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1837
1924
|
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1841,7 +1928,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1841
1928
|
return new _OpenCodeCommand({
|
|
1842
1929
|
baseDir,
|
|
1843
1930
|
relativeDirPath: paths.relativeDirPath,
|
|
1844
|
-
relativeFilePath: (0,
|
|
1931
|
+
relativeFilePath: (0, import_node_path15.basename)(relativeFilePath),
|
|
1845
1932
|
frontmatter: result.data,
|
|
1846
1933
|
body: content.trim(),
|
|
1847
1934
|
validate
|
|
@@ -1870,7 +1957,7 @@ var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
|
1870
1957
|
};
|
|
1871
1958
|
|
|
1872
1959
|
// src/features/commands/roo-command.ts
|
|
1873
|
-
var
|
|
1960
|
+
var import_node_path16 = require("path");
|
|
1874
1961
|
var import_mini11 = require("zod/mini");
|
|
1875
1962
|
var RooCommandFrontmatterSchema = import_mini11.z.looseObject({
|
|
1876
1963
|
description: import_mini11.z.string(),
|
|
@@ -1881,7 +1968,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1881
1968
|
body;
|
|
1882
1969
|
static getSettablePaths() {
|
|
1883
1970
|
return {
|
|
1884
|
-
relativeDirPath: (0,
|
|
1971
|
+
relativeDirPath: (0, import_node_path16.join)(".roo", "commands")
|
|
1885
1972
|
};
|
|
1886
1973
|
}
|
|
1887
1974
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1889,7 +1976,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1889
1976
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1890
1977
|
if (!result.success) {
|
|
1891
1978
|
throw new Error(
|
|
1892
|
-
`Invalid frontmatter in ${(0,
|
|
1979
|
+
`Invalid frontmatter in ${(0, import_node_path16.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1893
1980
|
);
|
|
1894
1981
|
}
|
|
1895
1982
|
}
|
|
@@ -1960,7 +2047,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1960
2047
|
return {
|
|
1961
2048
|
success: false,
|
|
1962
2049
|
error: new Error(
|
|
1963
|
-
`Invalid frontmatter in ${(0,
|
|
2050
|
+
`Invalid frontmatter in ${(0, import_node_path16.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1964
2051
|
)
|
|
1965
2052
|
};
|
|
1966
2053
|
}
|
|
@@ -1976,7 +2063,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1976
2063
|
relativeFilePath,
|
|
1977
2064
|
validate = true
|
|
1978
2065
|
}) {
|
|
1979
|
-
const filePath = (0,
|
|
2066
|
+
const filePath = (0, import_node_path16.join)(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
1980
2067
|
const fileContent = await readFileContent(filePath);
|
|
1981
2068
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1982
2069
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1986,7 +2073,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1986
2073
|
return new _RooCommand({
|
|
1987
2074
|
baseDir,
|
|
1988
2075
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1989
|
-
relativeFilePath: (0,
|
|
2076
|
+
relativeFilePath: (0, import_node_path16.basename)(relativeFilePath),
|
|
1990
2077
|
frontmatter: result.data,
|
|
1991
2078
|
body: content.trim(),
|
|
1992
2079
|
fileContent,
|
|
@@ -2015,6 +2102,8 @@ var commandsProcessorToolTargetTuple = [
|
|
|
2015
2102
|
"agentsmd",
|
|
2016
2103
|
"antigravity",
|
|
2017
2104
|
"claudecode",
|
|
2105
|
+
"claudecode-legacy",
|
|
2106
|
+
"cline",
|
|
2018
2107
|
"codexcli",
|
|
2019
2108
|
"copilot",
|
|
2020
2109
|
"cursor",
|
|
@@ -2045,6 +2134,20 @@ var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
|
2045
2134
|
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2046
2135
|
}
|
|
2047
2136
|
],
|
|
2137
|
+
[
|
|
2138
|
+
"claudecode-legacy",
|
|
2139
|
+
{
|
|
2140
|
+
class: ClaudecodeCommand,
|
|
2141
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2142
|
+
}
|
|
2143
|
+
],
|
|
2144
|
+
[
|
|
2145
|
+
"cline",
|
|
2146
|
+
{
|
|
2147
|
+
class: ClineCommand,
|
|
2148
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
2149
|
+
}
|
|
2150
|
+
],
|
|
2048
2151
|
[
|
|
2049
2152
|
"codexcli",
|
|
2050
2153
|
{
|
|
@@ -2168,11 +2271,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2168
2271
|
*/
|
|
2169
2272
|
async loadRulesyncFiles() {
|
|
2170
2273
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
2171
|
-
(0,
|
|
2274
|
+
(0, import_node_path17.join)(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
2172
2275
|
);
|
|
2173
2276
|
const rulesyncCommands = await Promise.all(
|
|
2174
2277
|
rulesyncCommandPaths.map(
|
|
2175
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath: (0,
|
|
2278
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: (0, import_node_path17.basename)(path3) })
|
|
2176
2279
|
)
|
|
2177
2280
|
);
|
|
2178
2281
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -2188,14 +2291,14 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2188
2291
|
const factory = this.getFactory(this.toolTarget);
|
|
2189
2292
|
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
2190
2293
|
const commandFilePaths = await findFilesByGlobs(
|
|
2191
|
-
(0,
|
|
2294
|
+
(0, import_node_path17.join)(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
2192
2295
|
);
|
|
2193
2296
|
if (forDeletion) {
|
|
2194
2297
|
const toolCommands2 = commandFilePaths.map(
|
|
2195
2298
|
(path3) => factory.class.forDeletion({
|
|
2196
2299
|
baseDir: this.baseDir,
|
|
2197
2300
|
relativeDirPath: paths.relativeDirPath,
|
|
2198
|
-
relativeFilePath: (0,
|
|
2301
|
+
relativeFilePath: (0, import_node_path17.basename)(path3),
|
|
2199
2302
|
global: this.global
|
|
2200
2303
|
})
|
|
2201
2304
|
).filter((cmd) => cmd.isDeletable());
|
|
@@ -2206,7 +2309,7 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2206
2309
|
commandFilePaths.map(
|
|
2207
2310
|
(path3) => factory.class.fromFile({
|
|
2208
2311
|
baseDir: this.baseDir,
|
|
2209
|
-
relativeFilePath: (0,
|
|
2312
|
+
relativeFilePath: (0, import_node_path17.basename)(path3),
|
|
2210
2313
|
global: this.global
|
|
2211
2314
|
})
|
|
2212
2315
|
)
|
|
@@ -2240,15 +2343,15 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2240
2343
|
// src/features/ignore/ignore-processor.ts
|
|
2241
2344
|
var import_mini13 = require("zod/mini");
|
|
2242
2345
|
|
|
2243
|
-
// src/features/ignore/
|
|
2244
|
-
var
|
|
2346
|
+
// src/features/ignore/augmentcode-ignore.ts
|
|
2347
|
+
var import_node_path19 = require("path");
|
|
2245
2348
|
|
|
2246
2349
|
// src/types/tool-file.ts
|
|
2247
2350
|
var ToolFile = class extends AiFile {
|
|
2248
2351
|
};
|
|
2249
2352
|
|
|
2250
2353
|
// src/features/ignore/rulesync-ignore.ts
|
|
2251
|
-
var
|
|
2354
|
+
var import_node_path18 = require("path");
|
|
2252
2355
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2253
2356
|
validate() {
|
|
2254
2357
|
return { success: true, error: null };
|
|
@@ -2268,12 +2371,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2268
2371
|
static async fromFile() {
|
|
2269
2372
|
const baseDir = process.cwd();
|
|
2270
2373
|
const paths = this.getSettablePaths();
|
|
2271
|
-
const recommendedPath = (0,
|
|
2374
|
+
const recommendedPath = (0, import_node_path18.join)(
|
|
2272
2375
|
baseDir,
|
|
2273
2376
|
paths.recommended.relativeDirPath,
|
|
2274
2377
|
paths.recommended.relativeFilePath
|
|
2275
2378
|
);
|
|
2276
|
-
const legacyPath = (0,
|
|
2379
|
+
const legacyPath = (0, import_node_path18.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2277
2380
|
if (await fileExists(recommendedPath)) {
|
|
2278
2381
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2279
2382
|
return new _RulesyncIgnore({
|
|
@@ -2351,76 +2454,7 @@ var ToolIgnore = class extends ToolFile {
|
|
|
2351
2454
|
}
|
|
2352
2455
|
};
|
|
2353
2456
|
|
|
2354
|
-
// src/features/ignore/amazonqcli-ignore.ts
|
|
2355
|
-
var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
2356
|
-
static getSettablePaths() {
|
|
2357
|
-
return {
|
|
2358
|
-
relativeDirPath: ".",
|
|
2359
|
-
relativeFilePath: ".amazonqignore"
|
|
2360
|
-
};
|
|
2361
|
-
}
|
|
2362
|
-
/**
|
|
2363
|
-
* Convert to RulesyncIgnore format
|
|
2364
|
-
*/
|
|
2365
|
-
toRulesyncIgnore() {
|
|
2366
|
-
return this.toRulesyncIgnoreDefault();
|
|
2367
|
-
}
|
|
2368
|
-
/**
|
|
2369
|
-
* Create AmazonqcliIgnore from RulesyncIgnore
|
|
2370
|
-
* Supports conversion from unified rulesync format to Amazon Q CLI specific format
|
|
2371
|
-
*/
|
|
2372
|
-
static fromRulesyncIgnore({
|
|
2373
|
-
baseDir = process.cwd(),
|
|
2374
|
-
rulesyncIgnore
|
|
2375
|
-
}) {
|
|
2376
|
-
const body = rulesyncIgnore.getFileContent();
|
|
2377
|
-
return new _AmazonqcliIgnore({
|
|
2378
|
-
baseDir,
|
|
2379
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2380
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
2381
|
-
fileContent: body
|
|
2382
|
-
});
|
|
2383
|
-
}
|
|
2384
|
-
/**
|
|
2385
|
-
* Create AmazonqcliIgnore from file path
|
|
2386
|
-
* Supports both proposed .q-ignore and .amazonqignore formats
|
|
2387
|
-
*/
|
|
2388
|
-
static async fromFile({
|
|
2389
|
-
baseDir = process.cwd(),
|
|
2390
|
-
validate = true
|
|
2391
|
-
}) {
|
|
2392
|
-
const fileContent = await readFileContent(
|
|
2393
|
-
(0, import_node_path18.join)(
|
|
2394
|
-
baseDir,
|
|
2395
|
-
this.getSettablePaths().relativeDirPath,
|
|
2396
|
-
this.getSettablePaths().relativeFilePath
|
|
2397
|
-
)
|
|
2398
|
-
);
|
|
2399
|
-
return new _AmazonqcliIgnore({
|
|
2400
|
-
baseDir,
|
|
2401
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
2402
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
2403
|
-
fileContent,
|
|
2404
|
-
validate
|
|
2405
|
-
});
|
|
2406
|
-
}
|
|
2407
|
-
static forDeletion({
|
|
2408
|
-
baseDir = process.cwd(),
|
|
2409
|
-
relativeDirPath,
|
|
2410
|
-
relativeFilePath
|
|
2411
|
-
}) {
|
|
2412
|
-
return new _AmazonqcliIgnore({
|
|
2413
|
-
baseDir,
|
|
2414
|
-
relativeDirPath,
|
|
2415
|
-
relativeFilePath,
|
|
2416
|
-
fileContent: "",
|
|
2417
|
-
validate: false
|
|
2418
|
-
});
|
|
2419
|
-
}
|
|
2420
|
-
};
|
|
2421
|
-
|
|
2422
2457
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2423
|
-
var import_node_path19 = require("path");
|
|
2424
2458
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
2425
2459
|
static getSettablePaths() {
|
|
2426
2460
|
return {
|
|
@@ -3070,9 +3104,9 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
3070
3104
|
|
|
3071
3105
|
// src/features/ignore/ignore-processor.ts
|
|
3072
3106
|
var ignoreProcessorToolTargets = [
|
|
3073
|
-
"amazonqcli",
|
|
3074
3107
|
"augmentcode",
|
|
3075
3108
|
"claudecode",
|
|
3109
|
+
"claudecode-legacy",
|
|
3076
3110
|
"cline",
|
|
3077
3111
|
"cursor",
|
|
3078
3112
|
"geminicli",
|
|
@@ -3084,9 +3118,9 @@ var ignoreProcessorToolTargets = [
|
|
|
3084
3118
|
];
|
|
3085
3119
|
var IgnoreProcessorToolTargetSchema = import_mini13.z.enum(ignoreProcessorToolTargets);
|
|
3086
3120
|
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
3087
|
-
["amazonqcli", { class: AmazonqcliIgnore }],
|
|
3088
3121
|
["augmentcode", { class: AugmentcodeIgnore }],
|
|
3089
3122
|
["claudecode", { class: ClaudecodeIgnore }],
|
|
3123
|
+
["claudecode-legacy", { class: ClaudecodeIgnore }],
|
|
3090
3124
|
["cline", { class: ClineIgnore }],
|
|
3091
3125
|
["cursor", { class: CursorIgnore }],
|
|
3092
3126
|
["geminicli", { class: GeminiCliIgnore }],
|
|
@@ -3216,12 +3250,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
3216
3250
|
// src/features/mcp/mcp-processor.ts
|
|
3217
3251
|
var import_mini18 = require("zod/mini");
|
|
3218
3252
|
|
|
3219
|
-
// src/features/mcp/
|
|
3220
|
-
var
|
|
3253
|
+
// src/features/mcp/claudecode-mcp.ts
|
|
3254
|
+
var import_node_path31 = require("path");
|
|
3221
3255
|
|
|
3222
|
-
// src/features/mcp/
|
|
3256
|
+
// src/features/mcp/modular-mcp.ts
|
|
3223
3257
|
var import_node_path29 = require("path");
|
|
3224
|
-
var import_object = require("es-toolkit/object");
|
|
3225
3258
|
var import_mini15 = require("zod/mini");
|
|
3226
3259
|
|
|
3227
3260
|
// src/types/mcp.ts
|
|
@@ -3247,54 +3280,155 @@ var McpServerSchema = import_mini14.z.object({
|
|
|
3247
3280
|
});
|
|
3248
3281
|
var McpServersSchema = import_mini14.z.record(import_mini14.z.string(), McpServerSchema);
|
|
3249
3282
|
|
|
3250
|
-
// src/features/mcp/
|
|
3251
|
-
var
|
|
3252
|
-
import_mini15.z.
|
|
3253
|
-
|
|
3254
|
-
description: import_mini15.z.optional(import_mini15.z.string()),
|
|
3255
|
-
exposed: import_mini15.z.optional(import_mini15.z.literal(false))
|
|
3256
|
-
}),
|
|
3257
|
-
import_mini15.z.extend(McpServerSchema, {
|
|
3258
|
-
targets: import_mini15.z.optional(RulesyncTargetsSchema),
|
|
3259
|
-
description: import_mini15.z.undefined(),
|
|
3260
|
-
exposed: import_mini15.z.literal(true)
|
|
3261
|
-
})
|
|
3262
|
-
]);
|
|
3263
|
-
var RulesyncMcpConfigSchema = import_mini15.z.object({
|
|
3264
|
-
mcpServers: import_mini15.z.record(import_mini15.z.string(), RulesyncMcpServerSchema)
|
|
3283
|
+
// src/features/mcp/modular-mcp.ts
|
|
3284
|
+
var ModularMcpServerSchema = import_mini15.z.extend(McpServerSchema, {
|
|
3285
|
+
description: import_mini15.z.string()
|
|
3286
|
+
// Required for modular-mcp
|
|
3265
3287
|
});
|
|
3266
|
-
var
|
|
3288
|
+
var ModularMcpConfigSchema = import_mini15.z.object({
|
|
3289
|
+
mcpServers: import_mini15.z.record(import_mini15.z.string(), ModularMcpServerSchema)
|
|
3290
|
+
});
|
|
3291
|
+
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3267
3292
|
json;
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
this.json = JSON.parse(this.fileContent);
|
|
3272
|
-
this.modularMcp = modularMcp;
|
|
3273
|
-
if (rest.validate) {
|
|
3274
|
-
const result = this.validate();
|
|
3275
|
-
if (!result.success) {
|
|
3276
|
-
throw result.error;
|
|
3277
|
-
}
|
|
3278
|
-
}
|
|
3293
|
+
constructor(params) {
|
|
3294
|
+
super(params);
|
|
3295
|
+
this.json = JSON.parse(this.fileContent || "{}");
|
|
3279
3296
|
}
|
|
3280
|
-
|
|
3297
|
+
getJson() {
|
|
3298
|
+
return this.json;
|
|
3299
|
+
}
|
|
3300
|
+
static getSettablePaths(params = {
|
|
3301
|
+
global: false,
|
|
3302
|
+
relativeDirPath: void 0
|
|
3303
|
+
}) {
|
|
3304
|
+
const relativeFilePath = "modular-mcp.json";
|
|
3305
|
+
if (!params.global) {
|
|
3306
|
+
return {
|
|
3307
|
+
relativeDirPath: ".",
|
|
3308
|
+
relativeFilePath
|
|
3309
|
+
};
|
|
3310
|
+
}
|
|
3281
3311
|
return {
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
relativeFilePath: "mcp.json"
|
|
3285
|
-
},
|
|
3286
|
-
legacy: {
|
|
3287
|
-
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3288
|
-
relativeFilePath: ".mcp.json"
|
|
3289
|
-
}
|
|
3312
|
+
relativeDirPath: params.relativeDirPath,
|
|
3313
|
+
relativeFilePath
|
|
3290
3314
|
};
|
|
3291
3315
|
}
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3316
|
+
static getMcpServers({
|
|
3317
|
+
baseDir,
|
|
3318
|
+
global,
|
|
3319
|
+
relativeDirPath
|
|
3320
|
+
} = {
|
|
3321
|
+
baseDir: process.cwd(),
|
|
3322
|
+
global: false,
|
|
3323
|
+
relativeDirPath: void 0
|
|
3324
|
+
}) {
|
|
3325
|
+
const paths = this.getSettablePaths(
|
|
3326
|
+
global ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3327
|
+
);
|
|
3328
|
+
if (!global) {
|
|
3329
|
+
return {
|
|
3330
|
+
"modular-mcp": {
|
|
3331
|
+
type: "stdio",
|
|
3332
|
+
command: "npx",
|
|
3333
|
+
args: ["-y", "@kimuson/modular-mcp", paths.relativeFilePath],
|
|
3334
|
+
env: {}
|
|
3335
|
+
}
|
|
3336
|
+
};
|
|
3337
|
+
}
|
|
3338
|
+
return {
|
|
3339
|
+
"modular-mcp": {
|
|
3340
|
+
type: "stdio",
|
|
3341
|
+
command: "npx",
|
|
3342
|
+
args: [
|
|
3343
|
+
"-y",
|
|
3344
|
+
"@kimuson/modular-mcp",
|
|
3345
|
+
(0, import_node_path29.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3346
|
+
],
|
|
3347
|
+
env: {}
|
|
3348
|
+
}
|
|
3349
|
+
};
|
|
3350
|
+
}
|
|
3351
|
+
static fromRulesyncMcp({
|
|
3352
|
+
baseDir = process.cwd(),
|
|
3353
|
+
rulesyncMcp,
|
|
3354
|
+
validate = true,
|
|
3355
|
+
global = false,
|
|
3356
|
+
relativeDirPath
|
|
3357
|
+
}) {
|
|
3358
|
+
const paths = this.getSettablePaths(
|
|
3359
|
+
global && relativeDirPath ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3360
|
+
);
|
|
3361
|
+
const modularMcpJson = {
|
|
3362
|
+
mcpServers: rulesyncMcp.getMcpServers({ type: "modularized" })
|
|
3363
|
+
};
|
|
3364
|
+
return new _ModularMcp({
|
|
3365
|
+
baseDir,
|
|
3366
|
+
relativeDirPath: paths.relativeDirPath,
|
|
3367
|
+
relativeFilePath: paths.relativeFilePath,
|
|
3368
|
+
fileContent: JSON.stringify(modularMcpJson, null, 2),
|
|
3369
|
+
validate
|
|
3370
|
+
});
|
|
3371
|
+
}
|
|
3372
|
+
validate() {
|
|
3373
|
+
const result = ModularMcpConfigSchema.safeParse(this.json);
|
|
3374
|
+
if (!result.success) {
|
|
3375
|
+
return { success: false, error: result.error };
|
|
3376
|
+
}
|
|
3377
|
+
return { success: true, error: null };
|
|
3378
|
+
}
|
|
3379
|
+
};
|
|
3380
|
+
|
|
3381
|
+
// src/features/mcp/rulesync-mcp.ts
|
|
3382
|
+
var import_node_path30 = require("path");
|
|
3383
|
+
var import_object = require("es-toolkit/object");
|
|
3384
|
+
var import_mini16 = require("zod/mini");
|
|
3385
|
+
var RulesyncMcpServerSchema = import_mini16.z.union([
|
|
3386
|
+
import_mini16.z.extend(McpServerSchema, {
|
|
3387
|
+
targets: import_mini16.z.optional(RulesyncTargetsSchema),
|
|
3388
|
+
description: import_mini16.z.optional(import_mini16.z.string()),
|
|
3389
|
+
exposed: import_mini16.z.optional(import_mini16.z.literal(false))
|
|
3390
|
+
}),
|
|
3391
|
+
import_mini16.z.extend(McpServerSchema, {
|
|
3392
|
+
targets: import_mini16.z.optional(RulesyncTargetsSchema),
|
|
3393
|
+
description: import_mini16.z.undefined(),
|
|
3394
|
+
exposed: import_mini16.z.literal(true)
|
|
3395
|
+
})
|
|
3396
|
+
]);
|
|
3397
|
+
var RulesyncMcpConfigSchema = import_mini16.z.object({
|
|
3398
|
+
mcpServers: import_mini16.z.record(import_mini16.z.string(), RulesyncMcpServerSchema)
|
|
3399
|
+
});
|
|
3400
|
+
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
3401
|
+
json;
|
|
3402
|
+
modularMcp;
|
|
3403
|
+
constructor({ modularMcp = false, ...rest }) {
|
|
3404
|
+
super({ ...rest });
|
|
3405
|
+
this.json = JSON.parse(this.fileContent);
|
|
3406
|
+
this.modularMcp = modularMcp;
|
|
3407
|
+
if (rest.validate) {
|
|
3408
|
+
const result = this.validate();
|
|
3409
|
+
if (!result.success) {
|
|
3410
|
+
throw result.error;
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
static getSettablePaths() {
|
|
3415
|
+
return {
|
|
3416
|
+
recommended: {
|
|
3417
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3418
|
+
relativeFilePath: "mcp.json"
|
|
3419
|
+
},
|
|
3420
|
+
legacy: {
|
|
3421
|
+
relativeDirPath: RULESYNC_RELATIVE_DIR_PATH,
|
|
3422
|
+
relativeFilePath: ".mcp.json"
|
|
3423
|
+
}
|
|
3424
|
+
};
|
|
3425
|
+
}
|
|
3426
|
+
validate() {
|
|
3427
|
+
const result = RulesyncMcpConfigSchema.safeParse(this.json);
|
|
3428
|
+
if (!result.success) {
|
|
3429
|
+
return { success: false, error: result.error };
|
|
3430
|
+
}
|
|
3431
|
+
return { success: true, error: null };
|
|
3298
3432
|
}
|
|
3299
3433
|
static async fromFile({
|
|
3300
3434
|
validate = true,
|
|
@@ -3302,12 +3436,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3302
3436
|
}) {
|
|
3303
3437
|
const baseDir = process.cwd();
|
|
3304
3438
|
const paths = this.getSettablePaths();
|
|
3305
|
-
const recommendedPath = (0,
|
|
3439
|
+
const recommendedPath = (0, import_node_path30.join)(
|
|
3306
3440
|
baseDir,
|
|
3307
3441
|
paths.recommended.relativeDirPath,
|
|
3308
3442
|
paths.recommended.relativeFilePath
|
|
3309
3443
|
);
|
|
3310
|
-
const legacyPath = (0,
|
|
3444
|
+
const legacyPath = (0, import_node_path30.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3311
3445
|
if (await fileExists(recommendedPath)) {
|
|
3312
3446
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3313
3447
|
return new _RulesyncMcp({
|
|
@@ -3414,178 +3548,6 @@ var ToolMcp = class extends ToolFile {
|
|
|
3414
3548
|
}
|
|
3415
3549
|
};
|
|
3416
3550
|
|
|
3417
|
-
// src/features/mcp/amazonqcli-mcp.ts
|
|
3418
|
-
var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
3419
|
-
json;
|
|
3420
|
-
constructor(params) {
|
|
3421
|
-
super(params);
|
|
3422
|
-
this.json = this.fileContent !== void 0 ? JSON.parse(this.fileContent) : {};
|
|
3423
|
-
}
|
|
3424
|
-
getJson() {
|
|
3425
|
-
return this.json;
|
|
3426
|
-
}
|
|
3427
|
-
static getSettablePaths() {
|
|
3428
|
-
return {
|
|
3429
|
-
relativeDirPath: ".amazonq",
|
|
3430
|
-
relativeFilePath: "mcp.json"
|
|
3431
|
-
};
|
|
3432
|
-
}
|
|
3433
|
-
static async fromFile({
|
|
3434
|
-
baseDir = process.cwd(),
|
|
3435
|
-
validate = true
|
|
3436
|
-
}) {
|
|
3437
|
-
const fileContent = await readFileContent(
|
|
3438
|
-
(0, import_node_path30.join)(
|
|
3439
|
-
baseDir,
|
|
3440
|
-
this.getSettablePaths().relativeDirPath,
|
|
3441
|
-
this.getSettablePaths().relativeFilePath
|
|
3442
|
-
)
|
|
3443
|
-
);
|
|
3444
|
-
return new _AmazonqcliMcp({
|
|
3445
|
-
baseDir,
|
|
3446
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3447
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3448
|
-
fileContent,
|
|
3449
|
-
validate
|
|
3450
|
-
});
|
|
3451
|
-
}
|
|
3452
|
-
static fromRulesyncMcp({
|
|
3453
|
-
baseDir = process.cwd(),
|
|
3454
|
-
rulesyncMcp,
|
|
3455
|
-
validate = true
|
|
3456
|
-
}) {
|
|
3457
|
-
return new _AmazonqcliMcp({
|
|
3458
|
-
baseDir,
|
|
3459
|
-
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
3460
|
-
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
3461
|
-
fileContent: rulesyncMcp.getFileContent(),
|
|
3462
|
-
validate
|
|
3463
|
-
});
|
|
3464
|
-
}
|
|
3465
|
-
toRulesyncMcp() {
|
|
3466
|
-
return this.toRulesyncMcpDefault();
|
|
3467
|
-
}
|
|
3468
|
-
validate() {
|
|
3469
|
-
return { success: true, error: null };
|
|
3470
|
-
}
|
|
3471
|
-
static forDeletion({
|
|
3472
|
-
baseDir = process.cwd(),
|
|
3473
|
-
relativeDirPath,
|
|
3474
|
-
relativeFilePath
|
|
3475
|
-
}) {
|
|
3476
|
-
return new _AmazonqcliMcp({
|
|
3477
|
-
baseDir,
|
|
3478
|
-
relativeDirPath,
|
|
3479
|
-
relativeFilePath,
|
|
3480
|
-
fileContent: "{}",
|
|
3481
|
-
validate: false
|
|
3482
|
-
});
|
|
3483
|
-
}
|
|
3484
|
-
};
|
|
3485
|
-
|
|
3486
|
-
// src/features/mcp/claudecode-mcp.ts
|
|
3487
|
-
var import_node_path32 = require("path");
|
|
3488
|
-
|
|
3489
|
-
// src/features/mcp/modular-mcp.ts
|
|
3490
|
-
var import_node_path31 = require("path");
|
|
3491
|
-
var import_mini16 = require("zod/mini");
|
|
3492
|
-
var ModularMcpServerSchema = import_mini16.z.extend(McpServerSchema, {
|
|
3493
|
-
description: import_mini16.z.string()
|
|
3494
|
-
// Required for modular-mcp
|
|
3495
|
-
});
|
|
3496
|
-
var ModularMcpConfigSchema = import_mini16.z.object({
|
|
3497
|
-
mcpServers: import_mini16.z.record(import_mini16.z.string(), ModularMcpServerSchema)
|
|
3498
|
-
});
|
|
3499
|
-
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3500
|
-
json;
|
|
3501
|
-
constructor(params) {
|
|
3502
|
-
super(params);
|
|
3503
|
-
this.json = JSON.parse(this.fileContent || "{}");
|
|
3504
|
-
}
|
|
3505
|
-
getJson() {
|
|
3506
|
-
return this.json;
|
|
3507
|
-
}
|
|
3508
|
-
static getSettablePaths(params = {
|
|
3509
|
-
global: false,
|
|
3510
|
-
relativeDirPath: void 0
|
|
3511
|
-
}) {
|
|
3512
|
-
const relativeFilePath = "modular-mcp.json";
|
|
3513
|
-
if (!params.global) {
|
|
3514
|
-
return {
|
|
3515
|
-
relativeDirPath: ".",
|
|
3516
|
-
relativeFilePath
|
|
3517
|
-
};
|
|
3518
|
-
}
|
|
3519
|
-
return {
|
|
3520
|
-
relativeDirPath: params.relativeDirPath,
|
|
3521
|
-
relativeFilePath
|
|
3522
|
-
};
|
|
3523
|
-
}
|
|
3524
|
-
static getMcpServers({
|
|
3525
|
-
baseDir,
|
|
3526
|
-
global,
|
|
3527
|
-
relativeDirPath
|
|
3528
|
-
} = {
|
|
3529
|
-
baseDir: process.cwd(),
|
|
3530
|
-
global: false,
|
|
3531
|
-
relativeDirPath: void 0
|
|
3532
|
-
}) {
|
|
3533
|
-
const paths = this.getSettablePaths(
|
|
3534
|
-
global ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3535
|
-
);
|
|
3536
|
-
if (!global) {
|
|
3537
|
-
return {
|
|
3538
|
-
"modular-mcp": {
|
|
3539
|
-
type: "stdio",
|
|
3540
|
-
command: "npx",
|
|
3541
|
-
args: ["-y", "@kimuson/modular-mcp", paths.relativeFilePath],
|
|
3542
|
-
env: {}
|
|
3543
|
-
}
|
|
3544
|
-
};
|
|
3545
|
-
}
|
|
3546
|
-
return {
|
|
3547
|
-
"modular-mcp": {
|
|
3548
|
-
type: "stdio",
|
|
3549
|
-
command: "npx",
|
|
3550
|
-
args: [
|
|
3551
|
-
"-y",
|
|
3552
|
-
"@kimuson/modular-mcp",
|
|
3553
|
-
(0, import_node_path31.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3554
|
-
],
|
|
3555
|
-
env: {}
|
|
3556
|
-
}
|
|
3557
|
-
};
|
|
3558
|
-
}
|
|
3559
|
-
static fromRulesyncMcp({
|
|
3560
|
-
baseDir = process.cwd(),
|
|
3561
|
-
rulesyncMcp,
|
|
3562
|
-
validate = true,
|
|
3563
|
-
global = false,
|
|
3564
|
-
relativeDirPath
|
|
3565
|
-
}) {
|
|
3566
|
-
const paths = this.getSettablePaths(
|
|
3567
|
-
global && relativeDirPath ? { global: true, relativeDirPath } : { global: false, relativeDirPath: void 0 }
|
|
3568
|
-
);
|
|
3569
|
-
const modularMcpJson = {
|
|
3570
|
-
mcpServers: rulesyncMcp.getMcpServers({ type: "modularized" })
|
|
3571
|
-
};
|
|
3572
|
-
return new _ModularMcp({
|
|
3573
|
-
baseDir,
|
|
3574
|
-
relativeDirPath: paths.relativeDirPath,
|
|
3575
|
-
relativeFilePath: paths.relativeFilePath,
|
|
3576
|
-
fileContent: JSON.stringify(modularMcpJson, null, 2),
|
|
3577
|
-
validate
|
|
3578
|
-
});
|
|
3579
|
-
}
|
|
3580
|
-
validate() {
|
|
3581
|
-
const result = ModularMcpConfigSchema.safeParse(this.json);
|
|
3582
|
-
if (!result.success) {
|
|
3583
|
-
return { success: false, error: result.error };
|
|
3584
|
-
}
|
|
3585
|
-
return { success: true, error: null };
|
|
3586
|
-
}
|
|
3587
|
-
};
|
|
3588
|
-
|
|
3589
3551
|
// src/features/mcp/claudecode-mcp.ts
|
|
3590
3552
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
3591
3553
|
json;
|
|
@@ -3623,7 +3585,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3623
3585
|
}) {
|
|
3624
3586
|
const paths = this.getSettablePaths({ global });
|
|
3625
3587
|
const fileContent = await readOrInitializeFileContent(
|
|
3626
|
-
(0,
|
|
3588
|
+
(0, import_node_path31.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3627
3589
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3628
3590
|
);
|
|
3629
3591
|
const json = JSON.parse(fileContent);
|
|
@@ -3645,7 +3607,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3645
3607
|
}) {
|
|
3646
3608
|
const paths = this.getSettablePaths({ global });
|
|
3647
3609
|
const fileContent = await readOrInitializeFileContent(
|
|
3648
|
-
(0,
|
|
3610
|
+
(0, import_node_path31.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3649
3611
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3650
3612
|
);
|
|
3651
3613
|
const json = JSON.parse(fileContent);
|
|
@@ -3693,7 +3655,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3693
3655
|
};
|
|
3694
3656
|
|
|
3695
3657
|
// src/features/mcp/cline-mcp.ts
|
|
3696
|
-
var
|
|
3658
|
+
var import_node_path32 = require("path");
|
|
3697
3659
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3698
3660
|
json;
|
|
3699
3661
|
constructor(params) {
|
|
@@ -3714,7 +3676,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3714
3676
|
validate = true
|
|
3715
3677
|
}) {
|
|
3716
3678
|
const fileContent = await readFileContent(
|
|
3717
|
-
(0,
|
|
3679
|
+
(0, import_node_path32.join)(
|
|
3718
3680
|
baseDir,
|
|
3719
3681
|
this.getSettablePaths().relativeDirPath,
|
|
3720
3682
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3763,7 +3725,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3763
3725
|
};
|
|
3764
3726
|
|
|
3765
3727
|
// src/features/mcp/codexcli-mcp.ts
|
|
3766
|
-
var
|
|
3728
|
+
var import_node_path33 = require("path");
|
|
3767
3729
|
var smolToml = __toESM(require("smol-toml"), 1);
|
|
3768
3730
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3769
3731
|
toml;
|
|
@@ -3799,7 +3761,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3799
3761
|
}) {
|
|
3800
3762
|
const paths = this.getSettablePaths({ global });
|
|
3801
3763
|
const fileContent = await readFileContent(
|
|
3802
|
-
(0,
|
|
3764
|
+
(0, import_node_path33.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3803
3765
|
);
|
|
3804
3766
|
return new _CodexcliMcp({
|
|
3805
3767
|
baseDir,
|
|
@@ -3816,7 +3778,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3816
3778
|
global = false
|
|
3817
3779
|
}) {
|
|
3818
3780
|
const paths = this.getSettablePaths({ global });
|
|
3819
|
-
const configTomlFilePath = (0,
|
|
3781
|
+
const configTomlFilePath = (0, import_node_path33.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3820
3782
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3821
3783
|
configTomlFilePath,
|
|
3822
3784
|
smolToml.stringify({})
|
|
@@ -3870,7 +3832,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3870
3832
|
};
|
|
3871
3833
|
|
|
3872
3834
|
// src/features/mcp/copilot-mcp.ts
|
|
3873
|
-
var
|
|
3835
|
+
var import_node_path34 = require("path");
|
|
3874
3836
|
function convertToCopilotFormat(mcpServers) {
|
|
3875
3837
|
return { servers: mcpServers };
|
|
3876
3838
|
}
|
|
@@ -3897,7 +3859,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3897
3859
|
validate = true
|
|
3898
3860
|
}) {
|
|
3899
3861
|
const fileContent = await readFileContent(
|
|
3900
|
-
(0,
|
|
3862
|
+
(0, import_node_path34.join)(
|
|
3901
3863
|
baseDir,
|
|
3902
3864
|
this.getSettablePaths().relativeDirPath,
|
|
3903
3865
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3950,7 +3912,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3950
3912
|
};
|
|
3951
3913
|
|
|
3952
3914
|
// src/features/mcp/cursor-mcp.ts
|
|
3953
|
-
var
|
|
3915
|
+
var import_node_path35 = require("path");
|
|
3954
3916
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3955
3917
|
json;
|
|
3956
3918
|
constructor(params) {
|
|
@@ -3971,7 +3933,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3971
3933
|
validate = true
|
|
3972
3934
|
}) {
|
|
3973
3935
|
const fileContent = await readFileContent(
|
|
3974
|
-
(0,
|
|
3936
|
+
(0, import_node_path35.join)(
|
|
3975
3937
|
baseDir,
|
|
3976
3938
|
this.getSettablePaths().relativeDirPath,
|
|
3977
3939
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4031,7 +3993,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
4031
3993
|
};
|
|
4032
3994
|
|
|
4033
3995
|
// src/features/mcp/geminicli-mcp.ts
|
|
4034
|
-
var
|
|
3996
|
+
var import_node_path36 = require("path");
|
|
4035
3997
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
4036
3998
|
json;
|
|
4037
3999
|
constructor(params) {
|
|
@@ -4060,7 +4022,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4060
4022
|
}) {
|
|
4061
4023
|
const paths = this.getSettablePaths({ global });
|
|
4062
4024
|
const fileContent = await readOrInitializeFileContent(
|
|
4063
|
-
(0,
|
|
4025
|
+
(0, import_node_path36.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4064
4026
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4065
4027
|
);
|
|
4066
4028
|
const json = JSON.parse(fileContent);
|
|
@@ -4081,7 +4043,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4081
4043
|
}) {
|
|
4082
4044
|
const paths = this.getSettablePaths({ global });
|
|
4083
4045
|
const fileContent = await readOrInitializeFileContent(
|
|
4084
|
-
(0,
|
|
4046
|
+
(0, import_node_path36.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4085
4047
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
4086
4048
|
);
|
|
4087
4049
|
const json = JSON.parse(fileContent);
|
|
@@ -4118,7 +4080,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
4118
4080
|
};
|
|
4119
4081
|
|
|
4120
4082
|
// src/features/mcp/junie-mcp.ts
|
|
4121
|
-
var
|
|
4083
|
+
var import_node_path37 = require("path");
|
|
4122
4084
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
4123
4085
|
json;
|
|
4124
4086
|
constructor(params) {
|
|
@@ -4130,7 +4092,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4130
4092
|
}
|
|
4131
4093
|
static getSettablePaths() {
|
|
4132
4094
|
return {
|
|
4133
|
-
relativeDirPath: (0,
|
|
4095
|
+
relativeDirPath: (0, import_node_path37.join)(".junie", "mcp"),
|
|
4134
4096
|
relativeFilePath: "mcp.json"
|
|
4135
4097
|
};
|
|
4136
4098
|
}
|
|
@@ -4139,7 +4101,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4139
4101
|
validate = true
|
|
4140
4102
|
}) {
|
|
4141
4103
|
const fileContent = await readFileContent(
|
|
4142
|
-
(0,
|
|
4104
|
+
(0, import_node_path37.join)(
|
|
4143
4105
|
baseDir,
|
|
4144
4106
|
this.getSettablePaths().relativeDirPath,
|
|
4145
4107
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4188,7 +4150,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
4188
4150
|
};
|
|
4189
4151
|
|
|
4190
4152
|
// src/features/mcp/opencode-mcp.ts
|
|
4191
|
-
var
|
|
4153
|
+
var import_node_path38 = require("path");
|
|
4192
4154
|
var import_mini17 = require("zod/mini");
|
|
4193
4155
|
var OpencodeMcpLocalServerSchema = import_mini17.z.object({
|
|
4194
4156
|
type: import_mini17.z.literal("local"),
|
|
@@ -4312,7 +4274,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4312
4274
|
}) {
|
|
4313
4275
|
const paths = this.getSettablePaths({ global });
|
|
4314
4276
|
const fileContent = await readOrInitializeFileContent(
|
|
4315
|
-
(0,
|
|
4277
|
+
(0, import_node_path38.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4316
4278
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4317
4279
|
);
|
|
4318
4280
|
const json = JSON.parse(fileContent);
|
|
@@ -4333,7 +4295,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4333
4295
|
}) {
|
|
4334
4296
|
const paths = this.getSettablePaths({ global });
|
|
4335
4297
|
const fileContent = await readOrInitializeFileContent(
|
|
4336
|
-
(0,
|
|
4298
|
+
(0, import_node_path38.join)(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
4337
4299
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
4338
4300
|
);
|
|
4339
4301
|
const json = JSON.parse(fileContent);
|
|
@@ -4377,7 +4339,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
4377
4339
|
};
|
|
4378
4340
|
|
|
4379
4341
|
// src/features/mcp/roo-mcp.ts
|
|
4380
|
-
var
|
|
4342
|
+
var import_node_path39 = require("path");
|
|
4381
4343
|
function isRooMcpServers(value) {
|
|
4382
4344
|
return value !== void 0 && value !== null && typeof value === "object";
|
|
4383
4345
|
}
|
|
@@ -4429,7 +4391,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4429
4391
|
validate = true
|
|
4430
4392
|
}) {
|
|
4431
4393
|
const fileContent = await readFileContent(
|
|
4432
|
-
(0,
|
|
4394
|
+
(0, import_node_path39.join)(
|
|
4433
4395
|
baseDir,
|
|
4434
4396
|
this.getSettablePaths().relativeDirPath,
|
|
4435
4397
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4486,8 +4448,8 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4486
4448
|
|
|
4487
4449
|
// src/features/mcp/mcp-processor.ts
|
|
4488
4450
|
var mcpProcessorToolTargetTuple = [
|
|
4489
|
-
"amazonqcli",
|
|
4490
4451
|
"claudecode",
|
|
4452
|
+
"claudecode-legacy",
|
|
4491
4453
|
"cline",
|
|
4492
4454
|
"codexcli",
|
|
4493
4455
|
"copilot",
|
|
@@ -4500,14 +4462,14 @@ var mcpProcessorToolTargetTuple = [
|
|
|
4500
4462
|
var McpProcessorToolTargetSchema = import_mini18.z.enum(mcpProcessorToolTargetTuple);
|
|
4501
4463
|
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
4502
4464
|
[
|
|
4503
|
-
"
|
|
4465
|
+
"claudecode",
|
|
4504
4466
|
{
|
|
4505
|
-
class:
|
|
4506
|
-
meta: { supportsProject: true, supportsGlobal:
|
|
4467
|
+
class: ClaudecodeMcp,
|
|
4468
|
+
meta: { supportsProject: true, supportsGlobal: true, supportsModular: true }
|
|
4507
4469
|
}
|
|
4508
4470
|
],
|
|
4509
4471
|
[
|
|
4510
|
-
"claudecode",
|
|
4472
|
+
"claudecode-legacy",
|
|
4511
4473
|
{
|
|
4512
4474
|
class: ClaudecodeMcp,
|
|
4513
4475
|
meta: { supportsProject: true, supportsGlobal: true, supportsModular: true }
|
|
@@ -4727,25 +4689,25 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4727
4689
|
};
|
|
4728
4690
|
|
|
4729
4691
|
// src/features/rules/rules-processor.ts
|
|
4730
|
-
var
|
|
4692
|
+
var import_node_path85 = require("path");
|
|
4731
4693
|
var import_toon = require("@toon-format/toon");
|
|
4732
|
-
var
|
|
4694
|
+
var import_mini40 = require("zod/mini");
|
|
4733
4695
|
|
|
4734
4696
|
// src/constants/general.ts
|
|
4735
4697
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4736
4698
|
|
|
4737
4699
|
// src/features/skills/agentsmd-skill.ts
|
|
4738
|
-
var
|
|
4700
|
+
var import_node_path43 = require("path");
|
|
4739
4701
|
|
|
4740
4702
|
// src/features/skills/simulated-skill.ts
|
|
4741
|
-
var
|
|
4703
|
+
var import_node_path42 = require("path");
|
|
4742
4704
|
var import_mini19 = require("zod/mini");
|
|
4743
4705
|
|
|
4744
4706
|
// src/features/skills/tool-skill.ts
|
|
4745
|
-
var
|
|
4707
|
+
var import_node_path41 = require("path");
|
|
4746
4708
|
|
|
4747
4709
|
// src/types/ai-dir.ts
|
|
4748
|
-
var
|
|
4710
|
+
var import_node_path40 = __toESM(require("path"), 1);
|
|
4749
4711
|
var AiDir = class {
|
|
4750
4712
|
/**
|
|
4751
4713
|
* @example "."
|
|
@@ -4779,7 +4741,7 @@ var AiDir = class {
|
|
|
4779
4741
|
otherFiles = [],
|
|
4780
4742
|
global = false
|
|
4781
4743
|
}) {
|
|
4782
|
-
if (dirName.includes(
|
|
4744
|
+
if (dirName.includes(import_node_path40.default.sep) || dirName.includes("/") || dirName.includes("\\")) {
|
|
4783
4745
|
throw new Error(`Directory name cannot contain path separators: dirName="${dirName}"`);
|
|
4784
4746
|
}
|
|
4785
4747
|
this.baseDir = baseDir;
|
|
@@ -4802,11 +4764,11 @@ var AiDir = class {
|
|
|
4802
4764
|
return this.dirName;
|
|
4803
4765
|
}
|
|
4804
4766
|
getDirPath() {
|
|
4805
|
-
const fullPath =
|
|
4806
|
-
const resolvedFull = (0,
|
|
4807
|
-
const resolvedBase = (0,
|
|
4808
|
-
const rel = (0,
|
|
4809
|
-
if (rel.startsWith("..") ||
|
|
4767
|
+
const fullPath = import_node_path40.default.join(this.baseDir, this.relativeDirPath, this.dirName);
|
|
4768
|
+
const resolvedFull = (0, import_node_path40.resolve)(fullPath);
|
|
4769
|
+
const resolvedBase = (0, import_node_path40.resolve)(this.baseDir);
|
|
4770
|
+
const rel = (0, import_node_path40.relative)(resolvedBase, resolvedFull);
|
|
4771
|
+
if (rel.startsWith("..") || import_node_path40.default.isAbsolute(rel)) {
|
|
4810
4772
|
throw new Error(
|
|
4811
4773
|
`Path traversal detected: Final path escapes baseDir. baseDir="${this.baseDir}", relativeDirPath="${this.relativeDirPath}", dirName="${this.dirName}"`
|
|
4812
4774
|
);
|
|
@@ -4820,7 +4782,7 @@ var AiDir = class {
|
|
|
4820
4782
|
return this.otherFiles;
|
|
4821
4783
|
}
|
|
4822
4784
|
getRelativePathFromCwd() {
|
|
4823
|
-
return
|
|
4785
|
+
return import_node_path40.default.join(this.relativeDirPath, this.dirName);
|
|
4824
4786
|
}
|
|
4825
4787
|
getGlobal() {
|
|
4826
4788
|
return this.global;
|
|
@@ -4839,15 +4801,15 @@ var AiDir = class {
|
|
|
4839
4801
|
* @returns Array of files with their relative paths and buffers
|
|
4840
4802
|
*/
|
|
4841
4803
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
4842
|
-
const dirPath = (0,
|
|
4843
|
-
const glob = (0,
|
|
4804
|
+
const dirPath = (0, import_node_path40.join)(baseDir, relativeDirPath, dirName);
|
|
4805
|
+
const glob = (0, import_node_path40.join)(dirPath, "**", "*");
|
|
4844
4806
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
4845
|
-
const filteredPaths = filePaths.filter((filePath) => (0,
|
|
4807
|
+
const filteredPaths = filePaths.filter((filePath) => (0, import_node_path40.basename)(filePath) !== excludeFileName);
|
|
4846
4808
|
const files = await Promise.all(
|
|
4847
4809
|
filteredPaths.map(async (filePath) => {
|
|
4848
4810
|
const fileBuffer = await readFileBuffer(filePath);
|
|
4849
4811
|
return {
|
|
4850
|
-
relativeFilePathToDirPath: (0,
|
|
4812
|
+
relativeFilePathToDirPath: (0, import_node_path40.relative)(dirPath, filePath),
|
|
4851
4813
|
fileBuffer
|
|
4852
4814
|
};
|
|
4853
4815
|
})
|
|
@@ -4938,8 +4900,8 @@ var ToolSkill = class extends AiDir {
|
|
|
4938
4900
|
}) {
|
|
4939
4901
|
const settablePaths = getSettablePaths({ global });
|
|
4940
4902
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4941
|
-
const skillDirPath = (0,
|
|
4942
|
-
const skillFilePath = (0,
|
|
4903
|
+
const skillDirPath = (0, import_node_path41.join)(baseDir, actualRelativeDirPath, dirName);
|
|
4904
|
+
const skillFilePath = (0, import_node_path41.join)(skillDirPath, SKILL_FILE_NAME);
|
|
4943
4905
|
if (!await fileExists(skillFilePath)) {
|
|
4944
4906
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4945
4907
|
}
|
|
@@ -4997,7 +4959,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4997
4959
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4998
4960
|
if (!result.success) {
|
|
4999
4961
|
throw new Error(
|
|
5000
|
-
`Invalid frontmatter in ${(0,
|
|
4962
|
+
`Invalid frontmatter in ${(0, import_node_path42.join)(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
5001
4963
|
);
|
|
5002
4964
|
}
|
|
5003
4965
|
}
|
|
@@ -5055,8 +5017,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
5055
5017
|
}) {
|
|
5056
5018
|
const settablePaths = this.getSettablePaths();
|
|
5057
5019
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5058
|
-
const skillDirPath = (0,
|
|
5059
|
-
const skillFilePath = (0,
|
|
5020
|
+
const skillDirPath = (0, import_node_path42.join)(baseDir, actualRelativeDirPath, dirName);
|
|
5021
|
+
const skillFilePath = (0, import_node_path42.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5060
5022
|
if (!await fileExists(skillFilePath)) {
|
|
5061
5023
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5062
5024
|
}
|
|
@@ -5133,7 +5095,7 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5133
5095
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
5134
5096
|
}
|
|
5135
5097
|
return {
|
|
5136
|
-
relativeDirPath: (0,
|
|
5098
|
+
relativeDirPath: (0, import_node_path43.join)(".agents", "skills")
|
|
5137
5099
|
};
|
|
5138
5100
|
}
|
|
5139
5101
|
static async fromDir(params) {
|
|
@@ -5160,14 +5122,14 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
5160
5122
|
};
|
|
5161
5123
|
|
|
5162
5124
|
// src/features/skills/geminicli-skill.ts
|
|
5163
|
-
var
|
|
5125
|
+
var import_node_path44 = require("path");
|
|
5164
5126
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5165
5127
|
static getSettablePaths(options) {
|
|
5166
5128
|
if (options?.global) {
|
|
5167
5129
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5168
5130
|
}
|
|
5169
5131
|
return {
|
|
5170
|
-
relativeDirPath: (0,
|
|
5132
|
+
relativeDirPath: (0, import_node_path44.join)(".gemini", "skills")
|
|
5171
5133
|
};
|
|
5172
5134
|
}
|
|
5173
5135
|
static async fromDir(params) {
|
|
@@ -5195,10 +5157,10 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5195
5157
|
|
|
5196
5158
|
// src/features/skills/skills-processor.ts
|
|
5197
5159
|
var import_node_path53 = require("path");
|
|
5198
|
-
var
|
|
5160
|
+
var import_mini27 = require("zod/mini");
|
|
5199
5161
|
|
|
5200
5162
|
// src/types/dir-feature-processor.ts
|
|
5201
|
-
var
|
|
5163
|
+
var import_node_path45 = require("path");
|
|
5202
5164
|
var DirFeatureProcessor = class {
|
|
5203
5165
|
baseDir;
|
|
5204
5166
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -5220,14 +5182,14 @@ var DirFeatureProcessor = class {
|
|
|
5220
5182
|
await ensureDir(dirPath);
|
|
5221
5183
|
const mainFile = aiDir.getMainFile();
|
|
5222
5184
|
if (mainFile) {
|
|
5223
|
-
const mainFilePath = (0,
|
|
5185
|
+
const mainFilePath = (0, import_node_path45.join)(dirPath, mainFile.name);
|
|
5224
5186
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
5225
5187
|
const contentWithNewline = addTrailingNewline(content);
|
|
5226
5188
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
5227
5189
|
}
|
|
5228
5190
|
const otherFiles = aiDir.getOtherFiles();
|
|
5229
5191
|
for (const file of otherFiles) {
|
|
5230
|
-
const filePath = (0,
|
|
5192
|
+
const filePath = (0, import_node_path45.join)(dirPath, file.relativeFilePathToDirPath);
|
|
5231
5193
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
5232
5194
|
await writeFileContent(filePath, contentWithNewline);
|
|
5233
5195
|
}
|
|
@@ -5242,11 +5204,11 @@ var DirFeatureProcessor = class {
|
|
|
5242
5204
|
};
|
|
5243
5205
|
|
|
5244
5206
|
// src/features/skills/claudecode-skill.ts
|
|
5245
|
-
var
|
|
5207
|
+
var import_node_path47 = require("path");
|
|
5246
5208
|
var import_mini21 = require("zod/mini");
|
|
5247
5209
|
|
|
5248
5210
|
// src/features/skills/rulesync-skill.ts
|
|
5249
|
-
var
|
|
5211
|
+
var import_node_path46 = require("path");
|
|
5250
5212
|
var import_mini20 = require("zod/mini");
|
|
5251
5213
|
var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
5252
5214
|
name: import_mini20.z.string(),
|
|
@@ -5266,7 +5228,8 @@ var RulesyncSkillFrontmatterSchemaInternal = import_mini20.z.looseObject({
|
|
|
5266
5228
|
import_mini20.z.looseObject({
|
|
5267
5229
|
license: import_mini20.z.optional(import_mini20.z.string())
|
|
5268
5230
|
})
|
|
5269
|
-
)
|
|
5231
|
+
),
|
|
5232
|
+
roo: import_mini20.z.optional(import_mini20.z.looseObject({}))
|
|
5270
5233
|
});
|
|
5271
5234
|
var RulesyncSkillFrontmatterSchema = RulesyncSkillFrontmatterSchemaInternal;
|
|
5272
5235
|
var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
@@ -5332,8 +5295,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
5332
5295
|
dirName,
|
|
5333
5296
|
global = false
|
|
5334
5297
|
}) {
|
|
5335
|
-
const skillDirPath = (0,
|
|
5336
|
-
const skillFilePath = (0,
|
|
5298
|
+
const skillDirPath = (0, import_node_path46.join)(baseDir, relativeDirPath, dirName);
|
|
5299
|
+
const skillFilePath = (0, import_node_path46.join)(skillDirPath, SKILL_FILE_NAME);
|
|
5337
5300
|
if (!await fileExists(skillFilePath)) {
|
|
5338
5301
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5339
5302
|
}
|
|
@@ -5371,7 +5334,7 @@ var ClaudecodeSkillFrontmatterSchema = import_mini21.z.looseObject({
|
|
|
5371
5334
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
5372
5335
|
constructor({
|
|
5373
5336
|
baseDir = process.cwd(),
|
|
5374
|
-
relativeDirPath = (0,
|
|
5337
|
+
relativeDirPath = (0, import_node_path47.join)(".claude", "skills"),
|
|
5375
5338
|
dirName,
|
|
5376
5339
|
frontmatter,
|
|
5377
5340
|
body,
|
|
@@ -5402,7 +5365,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5402
5365
|
global: _global = false
|
|
5403
5366
|
} = {}) {
|
|
5404
5367
|
return {
|
|
5405
|
-
relativeDirPath: (0,
|
|
5368
|
+
relativeDirPath: (0, import_node_path47.join)(".claude", "skills")
|
|
5406
5369
|
};
|
|
5407
5370
|
}
|
|
5408
5371
|
getFrontmatter() {
|
|
@@ -5490,9 +5453,9 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5490
5453
|
});
|
|
5491
5454
|
const result = ClaudecodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5492
5455
|
if (!result.success) {
|
|
5493
|
-
const skillDirPath = (0,
|
|
5456
|
+
const skillDirPath = (0, import_node_path47.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5494
5457
|
throw new Error(
|
|
5495
|
-
`Invalid frontmatter in ${(0,
|
|
5458
|
+
`Invalid frontmatter in ${(0, import_node_path47.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5496
5459
|
);
|
|
5497
5460
|
}
|
|
5498
5461
|
return new _ClaudecodeSkill({
|
|
@@ -5526,7 +5489,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5526
5489
|
};
|
|
5527
5490
|
|
|
5528
5491
|
// src/features/skills/codexcli-skill.ts
|
|
5529
|
-
var
|
|
5492
|
+
var import_node_path48 = require("path");
|
|
5530
5493
|
var import_mini22 = require("zod/mini");
|
|
5531
5494
|
var CodexCliSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
5532
5495
|
name: import_mini22.z.string(),
|
|
@@ -5535,7 +5498,7 @@ var CodexCliSkillFrontmatterSchema = import_mini22.z.looseObject({
|
|
|
5535
5498
|
var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
5536
5499
|
constructor({
|
|
5537
5500
|
baseDir = process.cwd(),
|
|
5538
|
-
relativeDirPath = (0,
|
|
5501
|
+
relativeDirPath = (0, import_node_path48.join)(".codex", "skills"),
|
|
5539
5502
|
dirName,
|
|
5540
5503
|
frontmatter,
|
|
5541
5504
|
body,
|
|
@@ -5567,7 +5530,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5567
5530
|
throw new Error("CodexCliSkill only supports global mode. Please pass { global: true }.");
|
|
5568
5531
|
}
|
|
5569
5532
|
return {
|
|
5570
|
-
relativeDirPath: (0,
|
|
5533
|
+
relativeDirPath: (0, import_node_path48.join)(".codex", "skills")
|
|
5571
5534
|
};
|
|
5572
5535
|
}
|
|
5573
5536
|
getFrontmatter() {
|
|
@@ -5649,9 +5612,9 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5649
5612
|
});
|
|
5650
5613
|
const result = CodexCliSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5651
5614
|
if (!result.success) {
|
|
5652
|
-
const skillDirPath = (0,
|
|
5615
|
+
const skillDirPath = (0, import_node_path48.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5653
5616
|
throw new Error(
|
|
5654
|
-
`Invalid frontmatter in ${(0,
|
|
5617
|
+
`Invalid frontmatter in ${(0, import_node_path48.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5655
5618
|
);
|
|
5656
5619
|
}
|
|
5657
5620
|
return new _CodexCliSkill({
|
|
@@ -5685,7 +5648,7 @@ var CodexCliSkill = class _CodexCliSkill extends ToolSkill {
|
|
|
5685
5648
|
};
|
|
5686
5649
|
|
|
5687
5650
|
// src/features/skills/copilot-skill.ts
|
|
5688
|
-
var
|
|
5651
|
+
var import_node_path49 = require("path");
|
|
5689
5652
|
var import_mini23 = require("zod/mini");
|
|
5690
5653
|
var CopilotSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
5691
5654
|
name: import_mini23.z.string(),
|
|
@@ -5695,7 +5658,7 @@ var CopilotSkillFrontmatterSchema = import_mini23.z.looseObject({
|
|
|
5695
5658
|
var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
5696
5659
|
constructor({
|
|
5697
5660
|
baseDir = process.cwd(),
|
|
5698
|
-
relativeDirPath = (0,
|
|
5661
|
+
relativeDirPath = (0, import_node_path49.join)(".github", "skills"),
|
|
5699
5662
|
dirName,
|
|
5700
5663
|
frontmatter,
|
|
5701
5664
|
body,
|
|
@@ -5727,7 +5690,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5727
5690
|
throw new Error("CopilotSkill does not support global mode.");
|
|
5728
5691
|
}
|
|
5729
5692
|
return {
|
|
5730
|
-
relativeDirPath: (0,
|
|
5693
|
+
relativeDirPath: (0, import_node_path49.join)(".github", "skills")
|
|
5731
5694
|
};
|
|
5732
5695
|
}
|
|
5733
5696
|
getFrontmatter() {
|
|
@@ -5815,9 +5778,9 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5815
5778
|
});
|
|
5816
5779
|
const result = CopilotSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5817
5780
|
if (!result.success) {
|
|
5818
|
-
const skillDirPath = (0,
|
|
5781
|
+
const skillDirPath = (0, import_node_path49.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5819
5782
|
throw new Error(
|
|
5820
|
-
`Invalid frontmatter in ${(0,
|
|
5783
|
+
`Invalid frontmatter in ${(0, import_node_path49.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5821
5784
|
);
|
|
5822
5785
|
}
|
|
5823
5786
|
return new _CopilotSkill({
|
|
@@ -5852,7 +5815,7 @@ var CopilotSkill = class _CopilotSkill extends ToolSkill {
|
|
|
5852
5815
|
};
|
|
5853
5816
|
|
|
5854
5817
|
// src/features/skills/cursor-skill.ts
|
|
5855
|
-
var
|
|
5818
|
+
var import_node_path50 = require("path");
|
|
5856
5819
|
var import_mini24 = require("zod/mini");
|
|
5857
5820
|
var CursorSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
5858
5821
|
name: import_mini24.z.string(),
|
|
@@ -5861,7 +5824,7 @@ var CursorSkillFrontmatterSchema = import_mini24.z.looseObject({
|
|
|
5861
5824
|
var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
5862
5825
|
constructor({
|
|
5863
5826
|
baseDir = process.cwd(),
|
|
5864
|
-
relativeDirPath = (0,
|
|
5827
|
+
relativeDirPath = (0, import_node_path50.join)(".cursor", "skills"),
|
|
5865
5828
|
dirName,
|
|
5866
5829
|
frontmatter,
|
|
5867
5830
|
body,
|
|
@@ -5893,7 +5856,7 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5893
5856
|
throw new Error("CursorSkill does not support global mode.");
|
|
5894
5857
|
}
|
|
5895
5858
|
return {
|
|
5896
|
-
relativeDirPath: (0,
|
|
5859
|
+
relativeDirPath: (0, import_node_path50.join)(".cursor", "skills")
|
|
5897
5860
|
};
|
|
5898
5861
|
}
|
|
5899
5862
|
getFrontmatter() {
|
|
@@ -5975,9 +5938,9 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
5975
5938
|
});
|
|
5976
5939
|
const result = CursorSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
5977
5940
|
if (!result.success) {
|
|
5978
|
-
const skillDirPath = (0,
|
|
5941
|
+
const skillDirPath = (0, import_node_path50.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
5979
5942
|
throw new Error(
|
|
5980
|
-
`Invalid frontmatter in ${(0,
|
|
5943
|
+
`Invalid frontmatter in ${(0, import_node_path50.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
5981
5944
|
);
|
|
5982
5945
|
}
|
|
5983
5946
|
return new _CursorSkill({
|
|
@@ -6011,18 +5974,180 @@ var CursorSkill = class _CursorSkill extends ToolSkill {
|
|
|
6011
5974
|
}
|
|
6012
5975
|
};
|
|
6013
5976
|
|
|
6014
|
-
// src/features/skills/opencode-skill.ts
|
|
5977
|
+
// src/features/skills/opencode-skill.ts
|
|
5978
|
+
var import_node_path51 = require("path");
|
|
5979
|
+
var import_mini25 = require("zod/mini");
|
|
5980
|
+
var OpenCodeSkillFrontmatterSchema = import_mini25.z.looseObject({
|
|
5981
|
+
name: import_mini25.z.string(),
|
|
5982
|
+
description: import_mini25.z.string(),
|
|
5983
|
+
"allowed-tools": import_mini25.z.optional(import_mini25.z.array(import_mini25.z.string()))
|
|
5984
|
+
});
|
|
5985
|
+
var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
5986
|
+
constructor({
|
|
5987
|
+
baseDir = process.cwd(),
|
|
5988
|
+
relativeDirPath = (0, import_node_path51.join)(".opencode", "skill"),
|
|
5989
|
+
dirName,
|
|
5990
|
+
frontmatter,
|
|
5991
|
+
body,
|
|
5992
|
+
otherFiles = [],
|
|
5993
|
+
validate = true,
|
|
5994
|
+
global = false
|
|
5995
|
+
}) {
|
|
5996
|
+
super({
|
|
5997
|
+
baseDir,
|
|
5998
|
+
relativeDirPath,
|
|
5999
|
+
dirName,
|
|
6000
|
+
mainFile: {
|
|
6001
|
+
name: SKILL_FILE_NAME,
|
|
6002
|
+
body,
|
|
6003
|
+
frontmatter: { ...frontmatter }
|
|
6004
|
+
},
|
|
6005
|
+
otherFiles,
|
|
6006
|
+
global
|
|
6007
|
+
});
|
|
6008
|
+
if (validate) {
|
|
6009
|
+
const result = this.validate();
|
|
6010
|
+
if (!result.success) {
|
|
6011
|
+
throw result.error;
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
}
|
|
6015
|
+
static getSettablePaths({ global = false } = {}) {
|
|
6016
|
+
return {
|
|
6017
|
+
relativeDirPath: global ? (0, import_node_path51.join)(".config", "opencode", "skill") : (0, import_node_path51.join)(".opencode", "skill")
|
|
6018
|
+
};
|
|
6019
|
+
}
|
|
6020
|
+
getFrontmatter() {
|
|
6021
|
+
if (!this.mainFile?.frontmatter) {
|
|
6022
|
+
throw new Error("Frontmatter is not defined");
|
|
6023
|
+
}
|
|
6024
|
+
const result = OpenCodeSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
6025
|
+
return result;
|
|
6026
|
+
}
|
|
6027
|
+
getBody() {
|
|
6028
|
+
return this.mainFile?.body ?? "";
|
|
6029
|
+
}
|
|
6030
|
+
validate() {
|
|
6031
|
+
if (this.mainFile === void 0) {
|
|
6032
|
+
return {
|
|
6033
|
+
success: false,
|
|
6034
|
+
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
6035
|
+
};
|
|
6036
|
+
}
|
|
6037
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
6038
|
+
if (!result.success) {
|
|
6039
|
+
return {
|
|
6040
|
+
success: false,
|
|
6041
|
+
error: new Error(
|
|
6042
|
+
`Invalid frontmatter in ${this.getDirPath()}: ${formatError(result.error)}`
|
|
6043
|
+
)
|
|
6044
|
+
};
|
|
6045
|
+
}
|
|
6046
|
+
return { success: true, error: null };
|
|
6047
|
+
}
|
|
6048
|
+
toRulesyncSkill() {
|
|
6049
|
+
const frontmatter = this.getFrontmatter();
|
|
6050
|
+
const rulesyncFrontmatter = {
|
|
6051
|
+
name: frontmatter.name,
|
|
6052
|
+
description: frontmatter.description,
|
|
6053
|
+
targets: ["*"],
|
|
6054
|
+
...frontmatter["allowed-tools"] && {
|
|
6055
|
+
opencode: {
|
|
6056
|
+
"allowed-tools": frontmatter["allowed-tools"]
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
};
|
|
6060
|
+
return new RulesyncSkill({
|
|
6061
|
+
baseDir: this.baseDir,
|
|
6062
|
+
relativeDirPath: this.relativeDirPath,
|
|
6063
|
+
dirName: this.getDirName(),
|
|
6064
|
+
frontmatter: rulesyncFrontmatter,
|
|
6065
|
+
body: this.getBody(),
|
|
6066
|
+
otherFiles: this.getOtherFiles(),
|
|
6067
|
+
validate: true,
|
|
6068
|
+
global: this.global
|
|
6069
|
+
});
|
|
6070
|
+
}
|
|
6071
|
+
static fromRulesyncSkill({
|
|
6072
|
+
rulesyncSkill,
|
|
6073
|
+
validate = true,
|
|
6074
|
+
global = false
|
|
6075
|
+
}) {
|
|
6076
|
+
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
6077
|
+
const opencodeFrontmatter = {
|
|
6078
|
+
name: rulesyncFrontmatter.name,
|
|
6079
|
+
description: rulesyncFrontmatter.description,
|
|
6080
|
+
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
6081
|
+
};
|
|
6082
|
+
const settablePaths = _OpenCodeSkill.getSettablePaths({ global });
|
|
6083
|
+
return new _OpenCodeSkill({
|
|
6084
|
+
baseDir: rulesyncSkill.getBaseDir(),
|
|
6085
|
+
relativeDirPath: settablePaths.relativeDirPath,
|
|
6086
|
+
dirName: rulesyncSkill.getDirName(),
|
|
6087
|
+
frontmatter: opencodeFrontmatter,
|
|
6088
|
+
body: rulesyncSkill.getBody(),
|
|
6089
|
+
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
6090
|
+
validate,
|
|
6091
|
+
global
|
|
6092
|
+
});
|
|
6093
|
+
}
|
|
6094
|
+
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
6095
|
+
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
6096
|
+
return targets.includes("*") || targets.includes("opencode");
|
|
6097
|
+
}
|
|
6098
|
+
static async fromDir(params) {
|
|
6099
|
+
const loaded = await this.loadSkillDirContent({
|
|
6100
|
+
...params,
|
|
6101
|
+
getSettablePaths: _OpenCodeSkill.getSettablePaths
|
|
6102
|
+
});
|
|
6103
|
+
const result = OpenCodeSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6104
|
+
if (!result.success) {
|
|
6105
|
+
const skillDirPath = (0, import_node_path51.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6106
|
+
throw new Error(
|
|
6107
|
+
`Invalid frontmatter in ${(0, import_node_path51.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6108
|
+
);
|
|
6109
|
+
}
|
|
6110
|
+
return new _OpenCodeSkill({
|
|
6111
|
+
baseDir: loaded.baseDir,
|
|
6112
|
+
relativeDirPath: loaded.relativeDirPath,
|
|
6113
|
+
dirName: loaded.dirName,
|
|
6114
|
+
frontmatter: result.data,
|
|
6115
|
+
body: loaded.body,
|
|
6116
|
+
otherFiles: loaded.otherFiles,
|
|
6117
|
+
validate: true,
|
|
6118
|
+
global: loaded.global
|
|
6119
|
+
});
|
|
6120
|
+
}
|
|
6121
|
+
static forDeletion({
|
|
6122
|
+
baseDir = process.cwd(),
|
|
6123
|
+
relativeDirPath,
|
|
6124
|
+
dirName,
|
|
6125
|
+
global = false
|
|
6126
|
+
}) {
|
|
6127
|
+
return new _OpenCodeSkill({
|
|
6128
|
+
baseDir,
|
|
6129
|
+
relativeDirPath,
|
|
6130
|
+
dirName,
|
|
6131
|
+
frontmatter: { name: "", description: "" },
|
|
6132
|
+
body: "",
|
|
6133
|
+
otherFiles: [],
|
|
6134
|
+
validate: false,
|
|
6135
|
+
global
|
|
6136
|
+
});
|
|
6137
|
+
}
|
|
6138
|
+
};
|
|
6139
|
+
|
|
6140
|
+
// src/features/skills/roo-skill.ts
|
|
6015
6141
|
var import_node_path52 = require("path");
|
|
6016
|
-
var
|
|
6017
|
-
var
|
|
6018
|
-
name:
|
|
6019
|
-
description:
|
|
6020
|
-
"allowed-tools": import_mini25.z.optional(import_mini25.z.array(import_mini25.z.string()))
|
|
6142
|
+
var import_mini26 = require("zod/mini");
|
|
6143
|
+
var RooSkillFrontmatterSchema = import_mini26.z.looseObject({
|
|
6144
|
+
name: import_mini26.z.string(),
|
|
6145
|
+
description: import_mini26.z.string()
|
|
6021
6146
|
});
|
|
6022
|
-
var
|
|
6147
|
+
var RooSkill = class _RooSkill extends ToolSkill {
|
|
6023
6148
|
constructor({
|
|
6024
6149
|
baseDir = process.cwd(),
|
|
6025
|
-
relativeDirPath = (0, import_node_path52.join)(".
|
|
6150
|
+
relativeDirPath = (0, import_node_path52.join)(".roo", "skills"),
|
|
6026
6151
|
dirName,
|
|
6027
6152
|
frontmatter,
|
|
6028
6153
|
body,
|
|
@@ -6049,29 +6174,31 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6049
6174
|
}
|
|
6050
6175
|
}
|
|
6051
6176
|
}
|
|
6052
|
-
static getSettablePaths({
|
|
6177
|
+
static getSettablePaths({
|
|
6178
|
+
global: _global = false
|
|
6179
|
+
} = {}) {
|
|
6053
6180
|
return {
|
|
6054
|
-
relativeDirPath:
|
|
6181
|
+
relativeDirPath: (0, import_node_path52.join)(".roo", "skills")
|
|
6055
6182
|
};
|
|
6056
6183
|
}
|
|
6057
6184
|
getFrontmatter() {
|
|
6058
6185
|
if (!this.mainFile?.frontmatter) {
|
|
6059
6186
|
throw new Error("Frontmatter is not defined");
|
|
6060
6187
|
}
|
|
6061
|
-
const result =
|
|
6188
|
+
const result = RooSkillFrontmatterSchema.parse(this.mainFile.frontmatter);
|
|
6062
6189
|
return result;
|
|
6063
6190
|
}
|
|
6064
6191
|
getBody() {
|
|
6065
6192
|
return this.mainFile?.body ?? "";
|
|
6066
6193
|
}
|
|
6067
6194
|
validate() {
|
|
6068
|
-
if (this.mainFile
|
|
6195
|
+
if (!this.mainFile) {
|
|
6069
6196
|
return {
|
|
6070
6197
|
success: false,
|
|
6071
6198
|
error: new Error(`${this.getDirPath()}: ${SKILL_FILE_NAME} file does not exist`)
|
|
6072
6199
|
};
|
|
6073
6200
|
}
|
|
6074
|
-
const result =
|
|
6201
|
+
const result = RooSkillFrontmatterSchema.safeParse(this.mainFile.frontmatter);
|
|
6075
6202
|
if (!result.success) {
|
|
6076
6203
|
return {
|
|
6077
6204
|
success: false,
|
|
@@ -6080,6 +6207,14 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6080
6207
|
)
|
|
6081
6208
|
};
|
|
6082
6209
|
}
|
|
6210
|
+
if (result.data.name !== this.getDirName()) {
|
|
6211
|
+
return {
|
|
6212
|
+
success: false,
|
|
6213
|
+
error: new Error(
|
|
6214
|
+
`${this.getDirPath()}: frontmatter name (${result.data.name}) must match directory name (${this.getDirName()})`
|
|
6215
|
+
)
|
|
6216
|
+
};
|
|
6217
|
+
}
|
|
6083
6218
|
return { success: true, error: null };
|
|
6084
6219
|
}
|
|
6085
6220
|
toRulesyncSkill() {
|
|
@@ -6087,12 +6222,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6087
6222
|
const rulesyncFrontmatter = {
|
|
6088
6223
|
name: frontmatter.name,
|
|
6089
6224
|
description: frontmatter.description,
|
|
6090
|
-
targets: ["*"]
|
|
6091
|
-
...frontmatter["allowed-tools"] && {
|
|
6092
|
-
opencode: {
|
|
6093
|
-
"allowed-tools": frontmatter["allowed-tools"]
|
|
6094
|
-
}
|
|
6095
|
-
}
|
|
6225
|
+
targets: ["*"]
|
|
6096
6226
|
};
|
|
6097
6227
|
return new RulesyncSkill({
|
|
6098
6228
|
baseDir: this.baseDir,
|
|
@@ -6110,18 +6240,17 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6110
6240
|
validate = true,
|
|
6111
6241
|
global = false
|
|
6112
6242
|
}) {
|
|
6243
|
+
const settablePaths = _RooSkill.getSettablePaths({ global });
|
|
6113
6244
|
const rulesyncFrontmatter = rulesyncSkill.getFrontmatter();
|
|
6114
|
-
const
|
|
6245
|
+
const rooFrontmatter = {
|
|
6115
6246
|
name: rulesyncFrontmatter.name,
|
|
6116
|
-
description: rulesyncFrontmatter.description
|
|
6117
|
-
"allowed-tools": rulesyncFrontmatter.opencode?.["allowed-tools"]
|
|
6247
|
+
description: rulesyncFrontmatter.description
|
|
6118
6248
|
};
|
|
6119
|
-
|
|
6120
|
-
return new _OpenCodeSkill({
|
|
6249
|
+
return new _RooSkill({
|
|
6121
6250
|
baseDir: rulesyncSkill.getBaseDir(),
|
|
6122
6251
|
relativeDirPath: settablePaths.relativeDirPath,
|
|
6123
|
-
dirName:
|
|
6124
|
-
frontmatter:
|
|
6252
|
+
dirName: rooFrontmatter.name,
|
|
6253
|
+
frontmatter: rooFrontmatter,
|
|
6125
6254
|
body: rulesyncSkill.getBody(),
|
|
6126
6255
|
otherFiles: rulesyncSkill.getOtherFiles(),
|
|
6127
6256
|
validate,
|
|
@@ -6130,21 +6259,32 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6130
6259
|
}
|
|
6131
6260
|
static isTargetedByRulesyncSkill(rulesyncSkill) {
|
|
6132
6261
|
const targets = rulesyncSkill.getFrontmatter().targets;
|
|
6133
|
-
return targets.includes("*") || targets.includes("
|
|
6262
|
+
return targets.includes("*") || targets.includes("roo");
|
|
6134
6263
|
}
|
|
6135
6264
|
static async fromDir(params) {
|
|
6136
6265
|
const loaded = await this.loadSkillDirContent({
|
|
6137
6266
|
...params,
|
|
6138
|
-
getSettablePaths:
|
|
6267
|
+
getSettablePaths: _RooSkill.getSettablePaths
|
|
6139
6268
|
});
|
|
6140
|
-
const result =
|
|
6269
|
+
const result = RooSkillFrontmatterSchema.safeParse(loaded.frontmatter);
|
|
6141
6270
|
if (!result.success) {
|
|
6142
6271
|
const skillDirPath = (0, import_node_path52.join)(loaded.baseDir, loaded.relativeDirPath, loaded.dirName);
|
|
6143
6272
|
throw new Error(
|
|
6144
6273
|
`Invalid frontmatter in ${(0, import_node_path52.join)(skillDirPath, SKILL_FILE_NAME)}: ${formatError(result.error)}`
|
|
6145
6274
|
);
|
|
6146
6275
|
}
|
|
6147
|
-
|
|
6276
|
+
if (result.data.name !== loaded.dirName) {
|
|
6277
|
+
const skillFilePath = (0, import_node_path52.join)(
|
|
6278
|
+
loaded.baseDir,
|
|
6279
|
+
loaded.relativeDirPath,
|
|
6280
|
+
loaded.dirName,
|
|
6281
|
+
SKILL_FILE_NAME
|
|
6282
|
+
);
|
|
6283
|
+
throw new Error(
|
|
6284
|
+
`Frontmatter name (${result.data.name}) must match directory name (${loaded.dirName}) in ${skillFilePath}`
|
|
6285
|
+
);
|
|
6286
|
+
}
|
|
6287
|
+
return new _RooSkill({
|
|
6148
6288
|
baseDir: loaded.baseDir,
|
|
6149
6289
|
relativeDirPath: loaded.relativeDirPath,
|
|
6150
6290
|
dirName: loaded.dirName,
|
|
@@ -6161,7 +6301,7 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6161
6301
|
dirName,
|
|
6162
6302
|
global = false
|
|
6163
6303
|
}) {
|
|
6164
|
-
return new
|
|
6304
|
+
return new _RooSkill({
|
|
6165
6305
|
baseDir,
|
|
6166
6306
|
relativeDirPath,
|
|
6167
6307
|
dirName,
|
|
@@ -6178,13 +6318,15 @@ var OpenCodeSkill = class _OpenCodeSkill extends ToolSkill {
|
|
|
6178
6318
|
var skillsProcessorToolTargetTuple = [
|
|
6179
6319
|
"agentsmd",
|
|
6180
6320
|
"claudecode",
|
|
6321
|
+
"claudecode-legacy",
|
|
6181
6322
|
"codexcli",
|
|
6182
6323
|
"copilot",
|
|
6183
6324
|
"cursor",
|
|
6184
6325
|
"geminicli",
|
|
6185
|
-
"opencode"
|
|
6326
|
+
"opencode",
|
|
6327
|
+
"roo"
|
|
6186
6328
|
];
|
|
6187
|
-
var SkillsProcessorToolTargetSchema =
|
|
6329
|
+
var SkillsProcessorToolTargetSchema = import_mini27.z.enum(skillsProcessorToolTargetTuple);
|
|
6188
6330
|
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
6189
6331
|
[
|
|
6190
6332
|
"agentsmd",
|
|
@@ -6200,6 +6342,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6200
6342
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6201
6343
|
}
|
|
6202
6344
|
],
|
|
6345
|
+
[
|
|
6346
|
+
"claudecode-legacy",
|
|
6347
|
+
{
|
|
6348
|
+
class: ClaudecodeSkill,
|
|
6349
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6350
|
+
}
|
|
6351
|
+
],
|
|
6203
6352
|
[
|
|
6204
6353
|
"codexcli",
|
|
6205
6354
|
{
|
|
@@ -6234,6 +6383,13 @@ var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
|
6234
6383
|
class: OpenCodeSkill,
|
|
6235
6384
|
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6236
6385
|
}
|
|
6386
|
+
],
|
|
6387
|
+
[
|
|
6388
|
+
"roo",
|
|
6389
|
+
{
|
|
6390
|
+
class: RooSkill,
|
|
6391
|
+
meta: { supportsProject: true, supportsSimulated: false, supportsGlobal: true }
|
|
6392
|
+
}
|
|
6237
6393
|
]
|
|
6238
6394
|
]);
|
|
6239
6395
|
var defaultGetFactory4 = (target) => {
|
|
@@ -6403,7 +6559,7 @@ var import_node_path55 = require("path");
|
|
|
6403
6559
|
|
|
6404
6560
|
// src/features/subagents/simulated-subagent.ts
|
|
6405
6561
|
var import_node_path54 = require("path");
|
|
6406
|
-
var
|
|
6562
|
+
var import_mini28 = require("zod/mini");
|
|
6407
6563
|
|
|
6408
6564
|
// src/features/subagents/tool-subagent.ts
|
|
6409
6565
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -6446,9 +6602,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
6446
6602
|
};
|
|
6447
6603
|
|
|
6448
6604
|
// src/features/subagents/simulated-subagent.ts
|
|
6449
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
6450
|
-
name:
|
|
6451
|
-
description:
|
|
6605
|
+
var SimulatedSubagentFrontmatterSchema = import_mini28.z.object({
|
|
6606
|
+
name: import_mini28.z.string(),
|
|
6607
|
+
description: import_mini28.z.string()
|
|
6452
6608
|
});
|
|
6453
6609
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
6454
6610
|
frontmatter;
|
|
@@ -6687,19 +6843,19 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
6687
6843
|
|
|
6688
6844
|
// src/features/subagents/subagents-processor.ts
|
|
6689
6845
|
var import_node_path64 = require("path");
|
|
6690
|
-
var
|
|
6846
|
+
var import_mini33 = require("zod/mini");
|
|
6691
6847
|
|
|
6692
6848
|
// src/features/subagents/claudecode-subagent.ts
|
|
6693
6849
|
var import_node_path61 = require("path");
|
|
6694
|
-
var
|
|
6850
|
+
var import_mini30 = require("zod/mini");
|
|
6695
6851
|
|
|
6696
6852
|
// src/features/subagents/rulesync-subagent.ts
|
|
6697
6853
|
var import_node_path60 = require("path");
|
|
6698
|
-
var
|
|
6699
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
6854
|
+
var import_mini29 = require("zod/mini");
|
|
6855
|
+
var RulesyncSubagentFrontmatterSchema = import_mini29.z.looseObject({
|
|
6700
6856
|
targets: RulesyncTargetsSchema,
|
|
6701
|
-
name:
|
|
6702
|
-
description:
|
|
6857
|
+
name: import_mini29.z.string(),
|
|
6858
|
+
description: import_mini29.z.string()
|
|
6703
6859
|
});
|
|
6704
6860
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
6705
6861
|
frontmatter;
|
|
@@ -6770,13 +6926,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
6770
6926
|
};
|
|
6771
6927
|
|
|
6772
6928
|
// src/features/subagents/claudecode-subagent.ts
|
|
6773
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
6774
|
-
name:
|
|
6775
|
-
description:
|
|
6776
|
-
model:
|
|
6777
|
-
tools:
|
|
6778
|
-
permissionMode:
|
|
6779
|
-
skills:
|
|
6929
|
+
var ClaudecodeSubagentFrontmatterSchema = import_mini30.z.looseObject({
|
|
6930
|
+
name: import_mini30.z.string(),
|
|
6931
|
+
description: import_mini30.z.string(),
|
|
6932
|
+
model: import_mini30.z.optional(import_mini30.z.string()),
|
|
6933
|
+
tools: import_mini30.z.optional(import_mini30.z.union([import_mini30.z.string(), import_mini30.z.array(import_mini30.z.string())])),
|
|
6934
|
+
permissionMode: import_mini30.z.optional(import_mini30.z.string()),
|
|
6935
|
+
skills: import_mini30.z.optional(import_mini30.z.union([import_mini30.z.string(), import_mini30.z.array(import_mini30.z.string())]))
|
|
6780
6936
|
});
|
|
6781
6937
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
6782
6938
|
frontmatter;
|
|
@@ -6926,12 +7082,12 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
6926
7082
|
|
|
6927
7083
|
// src/features/subagents/copilot-subagent.ts
|
|
6928
7084
|
var import_node_path62 = require("path");
|
|
6929
|
-
var
|
|
7085
|
+
var import_mini31 = require("zod/mini");
|
|
6930
7086
|
var REQUIRED_TOOL = "agent/runSubagent";
|
|
6931
|
-
var CopilotSubagentFrontmatterSchema =
|
|
6932
|
-
name:
|
|
6933
|
-
description:
|
|
6934
|
-
tools:
|
|
7087
|
+
var CopilotSubagentFrontmatterSchema = import_mini31.z.looseObject({
|
|
7088
|
+
name: import_mini31.z.string(),
|
|
7089
|
+
description: import_mini31.z.string(),
|
|
7090
|
+
tools: import_mini31.z.optional(import_mini31.z.union([import_mini31.z.string(), import_mini31.z.array(import_mini31.z.string())]))
|
|
6935
7091
|
});
|
|
6936
7092
|
var normalizeTools = (tools) => {
|
|
6937
7093
|
if (!tools) {
|
|
@@ -7092,11 +7248,11 @@ var CopilotSubagent = class _CopilotSubagent extends ToolSubagent {
|
|
|
7092
7248
|
|
|
7093
7249
|
// src/features/subagents/opencode-subagent.ts
|
|
7094
7250
|
var import_node_path63 = require("path");
|
|
7095
|
-
var
|
|
7096
|
-
var OpenCodeSubagentFrontmatterSchema =
|
|
7097
|
-
description:
|
|
7098
|
-
mode:
|
|
7099
|
-
name:
|
|
7251
|
+
var import_mini32 = require("zod/mini");
|
|
7252
|
+
var OpenCodeSubagentFrontmatterSchema = import_mini32.z.looseObject({
|
|
7253
|
+
description: import_mini32.z.string(),
|
|
7254
|
+
mode: import_mini32.z.literal("subagent"),
|
|
7255
|
+
name: import_mini32.z.optional(import_mini32.z.string())
|
|
7100
7256
|
});
|
|
7101
7257
|
var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
7102
7258
|
frontmatter;
|
|
@@ -7242,6 +7398,7 @@ var OpenCodeSubagent = class _OpenCodeSubagent extends ToolSubagent {
|
|
|
7242
7398
|
var subagentsProcessorToolTargetTuple = [
|
|
7243
7399
|
"agentsmd",
|
|
7244
7400
|
"claudecode",
|
|
7401
|
+
"claudecode-legacy",
|
|
7245
7402
|
"codexcli",
|
|
7246
7403
|
"copilot",
|
|
7247
7404
|
"cursor",
|
|
@@ -7249,7 +7406,7 @@ var subagentsProcessorToolTargetTuple = [
|
|
|
7249
7406
|
"opencode",
|
|
7250
7407
|
"roo"
|
|
7251
7408
|
];
|
|
7252
|
-
var SubagentsProcessorToolTargetSchema =
|
|
7409
|
+
var SubagentsProcessorToolTargetSchema = import_mini33.z.enum(subagentsProcessorToolTargetTuple);
|
|
7253
7410
|
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
7254
7411
|
[
|
|
7255
7412
|
"agentsmd",
|
|
@@ -7259,6 +7416,10 @@ var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
|
7259
7416
|
"claudecode",
|
|
7260
7417
|
{ class: ClaudecodeSubagent, meta: { supportsSimulated: false, supportsGlobal: true } }
|
|
7261
7418
|
],
|
|
7419
|
+
[
|
|
7420
|
+
"claudecode-legacy",
|
|
7421
|
+
{ class: ClaudecodeSubagent, meta: { supportsSimulated: false, supportsGlobal: true } }
|
|
7422
|
+
],
|
|
7262
7423
|
[
|
|
7263
7424
|
"codexcli",
|
|
7264
7425
|
{ class: CodexCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
@@ -7461,41 +7622,41 @@ var import_node_path66 = require("path");
|
|
|
7461
7622
|
|
|
7462
7623
|
// src/features/rules/rulesync-rule.ts
|
|
7463
7624
|
var import_node_path65 = require("path");
|
|
7464
|
-
var
|
|
7465
|
-
var RulesyncRuleFrontmatterSchema =
|
|
7466
|
-
root:
|
|
7467
|
-
targets:
|
|
7468
|
-
description:
|
|
7469
|
-
globs:
|
|
7470
|
-
agentsmd:
|
|
7471
|
-
|
|
7625
|
+
var import_mini34 = require("zod/mini");
|
|
7626
|
+
var RulesyncRuleFrontmatterSchema = import_mini34.z.object({
|
|
7627
|
+
root: import_mini34.z.optional(import_mini34.z.optional(import_mini34.z.boolean())),
|
|
7628
|
+
targets: import_mini34.z.optional(RulesyncTargetsSchema),
|
|
7629
|
+
description: import_mini34.z.optional(import_mini34.z.string()),
|
|
7630
|
+
globs: import_mini34.z.optional(import_mini34.z.array(import_mini34.z.string())),
|
|
7631
|
+
agentsmd: import_mini34.z.optional(
|
|
7632
|
+
import_mini34.z.object({
|
|
7472
7633
|
// @example "path/to/subproject"
|
|
7473
|
-
subprojectPath:
|
|
7634
|
+
subprojectPath: import_mini34.z.optional(import_mini34.z.string())
|
|
7474
7635
|
})
|
|
7475
7636
|
),
|
|
7476
|
-
claudecode:
|
|
7477
|
-
|
|
7637
|
+
claudecode: import_mini34.z.optional(
|
|
7638
|
+
import_mini34.z.object({
|
|
7478
7639
|
// Glob patterns for conditional rules (takes precedence over globs)
|
|
7479
7640
|
// @example "src/**/*.ts, tests/**/*.test.ts"
|
|
7480
|
-
paths:
|
|
7641
|
+
paths: import_mini34.z.optional(import_mini34.z.string())
|
|
7481
7642
|
})
|
|
7482
7643
|
),
|
|
7483
|
-
cursor:
|
|
7484
|
-
|
|
7485
|
-
alwaysApply:
|
|
7486
|
-
description:
|
|
7487
|
-
globs:
|
|
7644
|
+
cursor: import_mini34.z.optional(
|
|
7645
|
+
import_mini34.z.object({
|
|
7646
|
+
alwaysApply: import_mini34.z.optional(import_mini34.z.boolean()),
|
|
7647
|
+
description: import_mini34.z.optional(import_mini34.z.string()),
|
|
7648
|
+
globs: import_mini34.z.optional(import_mini34.z.array(import_mini34.z.string()))
|
|
7488
7649
|
})
|
|
7489
7650
|
),
|
|
7490
|
-
copilot:
|
|
7491
|
-
|
|
7492
|
-
excludeAgent:
|
|
7651
|
+
copilot: import_mini34.z.optional(
|
|
7652
|
+
import_mini34.z.object({
|
|
7653
|
+
excludeAgent: import_mini34.z.optional(import_mini34.z.union([import_mini34.z.literal("code-review"), import_mini34.z.literal("coding-agent")]))
|
|
7493
7654
|
})
|
|
7494
7655
|
),
|
|
7495
|
-
antigravity:
|
|
7496
|
-
|
|
7497
|
-
trigger:
|
|
7498
|
-
globs:
|
|
7656
|
+
antigravity: import_mini34.z.optional(
|
|
7657
|
+
import_mini34.z.looseObject({
|
|
7658
|
+
trigger: import_mini34.z.optional(import_mini34.z.string()),
|
|
7659
|
+
globs: import_mini34.z.optional(import_mini34.z.array(import_mini34.z.string()))
|
|
7499
7660
|
})
|
|
7500
7661
|
)
|
|
7501
7662
|
});
|
|
@@ -7832,91 +7993,22 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
7832
7993
|
}
|
|
7833
7994
|
};
|
|
7834
7995
|
|
|
7835
|
-
// src/features/rules/amazonqcli-rule.ts
|
|
7836
|
-
var import_node_path68 = require("path");
|
|
7837
|
-
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
7838
|
-
static getSettablePaths() {
|
|
7839
|
-
return {
|
|
7840
|
-
nonRoot: {
|
|
7841
|
-
relativeDirPath: (0, import_node_path68.join)(".amazonq", "rules")
|
|
7842
|
-
}
|
|
7843
|
-
};
|
|
7844
|
-
}
|
|
7845
|
-
static async fromFile({
|
|
7846
|
-
baseDir = process.cwd(),
|
|
7847
|
-
relativeFilePath,
|
|
7848
|
-
validate = true
|
|
7849
|
-
}) {
|
|
7850
|
-
const fileContent = await readFileContent(
|
|
7851
|
-
(0, import_node_path68.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7852
|
-
);
|
|
7853
|
-
return new _AmazonQCliRule({
|
|
7854
|
-
baseDir,
|
|
7855
|
-
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7856
|
-
relativeFilePath,
|
|
7857
|
-
fileContent,
|
|
7858
|
-
validate,
|
|
7859
|
-
root: false
|
|
7860
|
-
});
|
|
7861
|
-
}
|
|
7862
|
-
static fromRulesyncRule({
|
|
7863
|
-
baseDir = process.cwd(),
|
|
7864
|
-
rulesyncRule,
|
|
7865
|
-
validate = true
|
|
7866
|
-
}) {
|
|
7867
|
-
return new _AmazonQCliRule(
|
|
7868
|
-
this.buildToolRuleParamsDefault({
|
|
7869
|
-
baseDir,
|
|
7870
|
-
rulesyncRule,
|
|
7871
|
-
validate,
|
|
7872
|
-
nonRootPath: this.getSettablePaths().nonRoot
|
|
7873
|
-
})
|
|
7874
|
-
);
|
|
7875
|
-
}
|
|
7876
|
-
toRulesyncRule() {
|
|
7877
|
-
return this.toRulesyncRuleDefault();
|
|
7878
|
-
}
|
|
7879
|
-
validate() {
|
|
7880
|
-
return { success: true, error: null };
|
|
7881
|
-
}
|
|
7882
|
-
static forDeletion({
|
|
7883
|
-
baseDir = process.cwd(),
|
|
7884
|
-
relativeDirPath,
|
|
7885
|
-
relativeFilePath
|
|
7886
|
-
}) {
|
|
7887
|
-
return new _AmazonQCliRule({
|
|
7888
|
-
baseDir,
|
|
7889
|
-
relativeDirPath,
|
|
7890
|
-
relativeFilePath,
|
|
7891
|
-
fileContent: "",
|
|
7892
|
-
validate: false,
|
|
7893
|
-
root: false
|
|
7894
|
-
});
|
|
7895
|
-
}
|
|
7896
|
-
static isTargetedByRulesyncRule(rulesyncRule) {
|
|
7897
|
-
return this.isTargetedByRulesyncRuleDefault({
|
|
7898
|
-
rulesyncRule,
|
|
7899
|
-
toolTarget: "amazonqcli"
|
|
7900
|
-
});
|
|
7901
|
-
}
|
|
7902
|
-
};
|
|
7903
|
-
|
|
7904
7996
|
// src/features/rules/antigravity-rule.ts
|
|
7905
|
-
var
|
|
7906
|
-
var
|
|
7907
|
-
var AntigravityRuleFrontmatterSchema =
|
|
7908
|
-
trigger:
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7997
|
+
var import_node_path68 = require("path");
|
|
7998
|
+
var import_mini35 = require("zod/mini");
|
|
7999
|
+
var AntigravityRuleFrontmatterSchema = import_mini35.z.looseObject({
|
|
8000
|
+
trigger: import_mini35.z.optional(
|
|
8001
|
+
import_mini35.z.union([
|
|
8002
|
+
import_mini35.z.literal("always_on"),
|
|
8003
|
+
import_mini35.z.literal("glob"),
|
|
8004
|
+
import_mini35.z.literal("manual"),
|
|
8005
|
+
import_mini35.z.literal("model_decision"),
|
|
8006
|
+
import_mini35.z.string()
|
|
7915
8007
|
// accepts any string for forward compatibility
|
|
7916
8008
|
])
|
|
7917
8009
|
),
|
|
7918
|
-
globs:
|
|
7919
|
-
description:
|
|
8010
|
+
globs: import_mini35.z.optional(import_mini35.z.string()),
|
|
8011
|
+
description: import_mini35.z.optional(import_mini35.z.string())
|
|
7920
8012
|
});
|
|
7921
8013
|
function parseGlobsString(globs) {
|
|
7922
8014
|
if (!globs) {
|
|
@@ -8061,7 +8153,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8061
8153
|
const result = AntigravityRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8062
8154
|
if (!result.success) {
|
|
8063
8155
|
throw new Error(
|
|
8064
|
-
`Invalid frontmatter in ${(0,
|
|
8156
|
+
`Invalid frontmatter in ${(0, import_node_path68.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8065
8157
|
);
|
|
8066
8158
|
}
|
|
8067
8159
|
}
|
|
@@ -8076,7 +8168,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8076
8168
|
static getSettablePaths() {
|
|
8077
8169
|
return {
|
|
8078
8170
|
nonRoot: {
|
|
8079
|
-
relativeDirPath: (0,
|
|
8171
|
+
relativeDirPath: (0, import_node_path68.join)(".agent", "rules")
|
|
8080
8172
|
}
|
|
8081
8173
|
};
|
|
8082
8174
|
}
|
|
@@ -8085,7 +8177,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8085
8177
|
relativeFilePath,
|
|
8086
8178
|
validate = true
|
|
8087
8179
|
}) {
|
|
8088
|
-
const filePath = (0,
|
|
8180
|
+
const filePath = (0, import_node_path68.join)(
|
|
8089
8181
|
baseDir,
|
|
8090
8182
|
this.getSettablePaths().nonRoot.relativeDirPath,
|
|
8091
8183
|
relativeFilePath
|
|
@@ -8226,7 +8318,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
8226
8318
|
};
|
|
8227
8319
|
|
|
8228
8320
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
8229
|
-
var
|
|
8321
|
+
var import_node_path69 = require("path");
|
|
8230
8322
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
8231
8323
|
toRulesyncRule() {
|
|
8232
8324
|
const rulesyncFrontmatter = {
|
|
@@ -8252,7 +8344,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8252
8344
|
relativeFilePath: ".augment-guidelines"
|
|
8253
8345
|
},
|
|
8254
8346
|
nonRoot: {
|
|
8255
|
-
relativeDirPath: (0,
|
|
8347
|
+
relativeDirPath: (0, import_node_path69.join)(".augment", "rules")
|
|
8256
8348
|
}
|
|
8257
8349
|
};
|
|
8258
8350
|
}
|
|
@@ -8287,8 +8379,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8287
8379
|
}) {
|
|
8288
8380
|
const settablePaths = this.getSettablePaths();
|
|
8289
8381
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
8290
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0,
|
|
8291
|
-
const fileContent = await readFileContent((0,
|
|
8382
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : (0, import_node_path69.join)(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8383
|
+
const fileContent = await readFileContent((0, import_node_path69.join)(baseDir, relativePath));
|
|
8292
8384
|
return new _AugmentcodeLegacyRule({
|
|
8293
8385
|
baseDir,
|
|
8294
8386
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -8317,7 +8409,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
8317
8409
|
};
|
|
8318
8410
|
|
|
8319
8411
|
// src/features/rules/augmentcode-rule.ts
|
|
8320
|
-
var
|
|
8412
|
+
var import_node_path70 = require("path");
|
|
8321
8413
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
8322
8414
|
toRulesyncRule() {
|
|
8323
8415
|
return this.toRulesyncRuleDefault();
|
|
@@ -8325,7 +8417,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8325
8417
|
static getSettablePaths() {
|
|
8326
8418
|
return {
|
|
8327
8419
|
nonRoot: {
|
|
8328
|
-
relativeDirPath: (0,
|
|
8420
|
+
relativeDirPath: (0, import_node_path70.join)(".augment", "rules")
|
|
8329
8421
|
}
|
|
8330
8422
|
};
|
|
8331
8423
|
}
|
|
@@ -8349,7 +8441,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8349
8441
|
validate = true
|
|
8350
8442
|
}) {
|
|
8351
8443
|
const fileContent = await readFileContent(
|
|
8352
|
-
(0,
|
|
8444
|
+
(0, import_node_path70.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8353
8445
|
);
|
|
8354
8446
|
const { body: content } = parseFrontmatter(fileContent);
|
|
8355
8447
|
return new _AugmentcodeRule({
|
|
@@ -8385,7 +8477,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
8385
8477
|
};
|
|
8386
8478
|
|
|
8387
8479
|
// src/features/rules/claudecode-legacy-rule.ts
|
|
8388
|
-
var
|
|
8480
|
+
var import_node_path71 = require("path");
|
|
8389
8481
|
var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
8390
8482
|
static getSettablePaths({
|
|
8391
8483
|
global
|
|
@@ -8404,7 +8496,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8404
8496
|
relativeFilePath: "CLAUDE.md"
|
|
8405
8497
|
},
|
|
8406
8498
|
nonRoot: {
|
|
8407
|
-
relativeDirPath: (0,
|
|
8499
|
+
relativeDirPath: (0, import_node_path71.join)(".claude", "memories")
|
|
8408
8500
|
}
|
|
8409
8501
|
};
|
|
8410
8502
|
}
|
|
@@ -8419,7 +8511,7 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8419
8511
|
if (isRoot) {
|
|
8420
8512
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8421
8513
|
const fileContent2 = await readFileContent(
|
|
8422
|
-
(0,
|
|
8514
|
+
(0, import_node_path71.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8423
8515
|
);
|
|
8424
8516
|
return new _ClaudecodeLegacyRule({
|
|
8425
8517
|
baseDir,
|
|
@@ -8433,8 +8525,8 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8433
8525
|
if (!paths.nonRoot) {
|
|
8434
8526
|
throw new Error("nonRoot path is not set");
|
|
8435
8527
|
}
|
|
8436
|
-
const relativePath = (0,
|
|
8437
|
-
const fileContent = await readFileContent((0,
|
|
8528
|
+
const relativePath = (0, import_node_path71.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8529
|
+
const fileContent = await readFileContent((0, import_node_path71.join)(baseDir, relativePath));
|
|
8438
8530
|
return new _ClaudecodeLegacyRule({
|
|
8439
8531
|
baseDir,
|
|
8440
8532
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8493,10 +8585,10 @@ var ClaudecodeLegacyRule = class _ClaudecodeLegacyRule extends ToolRule {
|
|
|
8493
8585
|
};
|
|
8494
8586
|
|
|
8495
8587
|
// src/features/rules/claudecode-rule.ts
|
|
8496
|
-
var
|
|
8497
|
-
var
|
|
8498
|
-
var ClaudecodeRuleFrontmatterSchema =
|
|
8499
|
-
paths:
|
|
8588
|
+
var import_node_path72 = require("path");
|
|
8589
|
+
var import_mini36 = require("zod/mini");
|
|
8590
|
+
var ClaudecodeRuleFrontmatterSchema = import_mini36.z.object({
|
|
8591
|
+
paths: import_mini36.z.optional(import_mini36.z.string())
|
|
8500
8592
|
});
|
|
8501
8593
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
8502
8594
|
frontmatter;
|
|
@@ -8518,7 +8610,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8518
8610
|
relativeFilePath: "CLAUDE.md"
|
|
8519
8611
|
},
|
|
8520
8612
|
nonRoot: {
|
|
8521
|
-
relativeDirPath: (0,
|
|
8613
|
+
relativeDirPath: (0, import_node_path72.join)(".claude", "rules")
|
|
8522
8614
|
}
|
|
8523
8615
|
};
|
|
8524
8616
|
}
|
|
@@ -8527,7 +8619,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8527
8619
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8528
8620
|
if (!result.success) {
|
|
8529
8621
|
throw new Error(
|
|
8530
|
-
`Invalid frontmatter in ${(0,
|
|
8622
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8531
8623
|
);
|
|
8532
8624
|
}
|
|
8533
8625
|
}
|
|
@@ -8555,7 +8647,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8555
8647
|
const isRoot = relativeFilePath === paths.root.relativeFilePath;
|
|
8556
8648
|
if (isRoot) {
|
|
8557
8649
|
const fileContent2 = await readFileContent(
|
|
8558
|
-
(0,
|
|
8650
|
+
(0, import_node_path72.join)(baseDir, paths.root.relativeDirPath, paths.root.relativeFilePath)
|
|
8559
8651
|
);
|
|
8560
8652
|
return new _ClaudecodeRule({
|
|
8561
8653
|
baseDir,
|
|
@@ -8570,13 +8662,13 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8570
8662
|
if (!paths.nonRoot) {
|
|
8571
8663
|
throw new Error("nonRoot path is not set");
|
|
8572
8664
|
}
|
|
8573
|
-
const relativePath = (0,
|
|
8574
|
-
const fileContent = await readFileContent((0,
|
|
8665
|
+
const relativePath = (0, import_node_path72.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8666
|
+
const fileContent = await readFileContent((0, import_node_path72.join)(baseDir, relativePath));
|
|
8575
8667
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
8576
8668
|
const result = ClaudecodeRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8577
8669
|
if (!result.success) {
|
|
8578
8670
|
throw new Error(
|
|
8579
|
-
`Invalid frontmatter in ${(0,
|
|
8671
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(baseDir, relativePath)}: ${formatError(result.error)}`
|
|
8580
8672
|
);
|
|
8581
8673
|
}
|
|
8582
8674
|
return new _ClaudecodeRule({
|
|
@@ -8683,7 +8775,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8683
8775
|
return {
|
|
8684
8776
|
success: false,
|
|
8685
8777
|
error: new Error(
|
|
8686
|
-
`Invalid frontmatter in ${(0,
|
|
8778
|
+
`Invalid frontmatter in ${(0, import_node_path72.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
8687
8779
|
)
|
|
8688
8780
|
};
|
|
8689
8781
|
}
|
|
@@ -8703,10 +8795,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
8703
8795
|
};
|
|
8704
8796
|
|
|
8705
8797
|
// src/features/rules/cline-rule.ts
|
|
8706
|
-
var
|
|
8707
|
-
var
|
|
8708
|
-
var ClineRuleFrontmatterSchema =
|
|
8709
|
-
description:
|
|
8798
|
+
var import_node_path73 = require("path");
|
|
8799
|
+
var import_mini37 = require("zod/mini");
|
|
8800
|
+
var ClineRuleFrontmatterSchema = import_mini37.z.object({
|
|
8801
|
+
description: import_mini37.z.string()
|
|
8710
8802
|
});
|
|
8711
8803
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
8712
8804
|
static getSettablePaths() {
|
|
@@ -8748,7 +8840,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8748
8840
|
validate = true
|
|
8749
8841
|
}) {
|
|
8750
8842
|
const fileContent = await readFileContent(
|
|
8751
|
-
(0,
|
|
8843
|
+
(0, import_node_path73.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
8752
8844
|
);
|
|
8753
8845
|
return new _ClineRule({
|
|
8754
8846
|
baseDir,
|
|
@@ -8774,7 +8866,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
8774
8866
|
};
|
|
8775
8867
|
|
|
8776
8868
|
// src/features/rules/codexcli-rule.ts
|
|
8777
|
-
var
|
|
8869
|
+
var import_node_path74 = require("path");
|
|
8778
8870
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
8779
8871
|
static getSettablePaths({
|
|
8780
8872
|
global
|
|
@@ -8793,7 +8885,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8793
8885
|
relativeFilePath: "AGENTS.md"
|
|
8794
8886
|
},
|
|
8795
8887
|
nonRoot: {
|
|
8796
|
-
relativeDirPath: (0,
|
|
8888
|
+
relativeDirPath: (0, import_node_path74.join)(".codex", "memories")
|
|
8797
8889
|
}
|
|
8798
8890
|
};
|
|
8799
8891
|
}
|
|
@@ -8808,7 +8900,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8808
8900
|
if (isRoot) {
|
|
8809
8901
|
const relativePath2 = paths.root.relativeFilePath;
|
|
8810
8902
|
const fileContent2 = await readFileContent(
|
|
8811
|
-
(0,
|
|
8903
|
+
(0, import_node_path74.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
8812
8904
|
);
|
|
8813
8905
|
return new _CodexcliRule({
|
|
8814
8906
|
baseDir,
|
|
@@ -8822,8 +8914,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8822
8914
|
if (!paths.nonRoot) {
|
|
8823
8915
|
throw new Error("nonRoot path is not set");
|
|
8824
8916
|
}
|
|
8825
|
-
const relativePath = (0,
|
|
8826
|
-
const fileContent = await readFileContent((0,
|
|
8917
|
+
const relativePath = (0, import_node_path74.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
8918
|
+
const fileContent = await readFileContent((0, import_node_path74.join)(baseDir, relativePath));
|
|
8827
8919
|
return new _CodexcliRule({
|
|
8828
8920
|
baseDir,
|
|
8829
8921
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -8882,12 +8974,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
8882
8974
|
};
|
|
8883
8975
|
|
|
8884
8976
|
// src/features/rules/copilot-rule.ts
|
|
8885
|
-
var
|
|
8886
|
-
var
|
|
8887
|
-
var CopilotRuleFrontmatterSchema =
|
|
8888
|
-
description:
|
|
8889
|
-
applyTo:
|
|
8890
|
-
excludeAgent:
|
|
8977
|
+
var import_node_path75 = require("path");
|
|
8978
|
+
var import_mini38 = require("zod/mini");
|
|
8979
|
+
var CopilotRuleFrontmatterSchema = import_mini38.z.object({
|
|
8980
|
+
description: import_mini38.z.optional(import_mini38.z.string()),
|
|
8981
|
+
applyTo: import_mini38.z.optional(import_mini38.z.string()),
|
|
8982
|
+
excludeAgent: import_mini38.z.optional(import_mini38.z.union([import_mini38.z.literal("code-review"), import_mini38.z.literal("coding-agent")]))
|
|
8891
8983
|
});
|
|
8892
8984
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
8893
8985
|
frontmatter;
|
|
@@ -8899,7 +8991,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8899
8991
|
relativeFilePath: "copilot-instructions.md"
|
|
8900
8992
|
},
|
|
8901
8993
|
nonRoot: {
|
|
8902
|
-
relativeDirPath: (0,
|
|
8994
|
+
relativeDirPath: (0, import_node_path75.join)(".github", "instructions")
|
|
8903
8995
|
}
|
|
8904
8996
|
};
|
|
8905
8997
|
}
|
|
@@ -8908,7 +9000,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8908
9000
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
8909
9001
|
if (!result.success) {
|
|
8910
9002
|
throw new Error(
|
|
8911
|
-
`Invalid frontmatter in ${(0,
|
|
9003
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
8912
9004
|
);
|
|
8913
9005
|
}
|
|
8914
9006
|
}
|
|
@@ -8990,11 +9082,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
8990
9082
|
validate = true
|
|
8991
9083
|
}) {
|
|
8992
9084
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
8993
|
-
const relativePath = isRoot ? (0,
|
|
9085
|
+
const relativePath = isRoot ? (0, import_node_path75.join)(
|
|
8994
9086
|
this.getSettablePaths().root.relativeDirPath,
|
|
8995
9087
|
this.getSettablePaths().root.relativeFilePath
|
|
8996
|
-
) : (0,
|
|
8997
|
-
const fileContent = await readFileContent((0,
|
|
9088
|
+
) : (0, import_node_path75.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9089
|
+
const fileContent = await readFileContent((0, import_node_path75.join)(baseDir, relativePath));
|
|
8998
9090
|
if (isRoot) {
|
|
8999
9091
|
return new _CopilotRule({
|
|
9000
9092
|
baseDir,
|
|
@@ -9010,7 +9102,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9010
9102
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9011
9103
|
if (!result.success) {
|
|
9012
9104
|
throw new Error(
|
|
9013
|
-
`Invalid frontmatter in ${(0,
|
|
9105
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9014
9106
|
);
|
|
9015
9107
|
}
|
|
9016
9108
|
return new _CopilotRule({
|
|
@@ -9050,7 +9142,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9050
9142
|
return {
|
|
9051
9143
|
success: false,
|
|
9052
9144
|
error: new Error(
|
|
9053
|
-
`Invalid frontmatter in ${(0,
|
|
9145
|
+
`Invalid frontmatter in ${(0, import_node_path75.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9054
9146
|
)
|
|
9055
9147
|
};
|
|
9056
9148
|
}
|
|
@@ -9070,12 +9162,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
9070
9162
|
};
|
|
9071
9163
|
|
|
9072
9164
|
// src/features/rules/cursor-rule.ts
|
|
9073
|
-
var
|
|
9074
|
-
var
|
|
9075
|
-
var CursorRuleFrontmatterSchema =
|
|
9076
|
-
description:
|
|
9077
|
-
globs:
|
|
9078
|
-
alwaysApply:
|
|
9165
|
+
var import_node_path76 = require("path");
|
|
9166
|
+
var import_mini39 = require("zod/mini");
|
|
9167
|
+
var CursorRuleFrontmatterSchema = import_mini39.z.object({
|
|
9168
|
+
description: import_mini39.z.optional(import_mini39.z.string()),
|
|
9169
|
+
globs: import_mini39.z.optional(import_mini39.z.string()),
|
|
9170
|
+
alwaysApply: import_mini39.z.optional(import_mini39.z.boolean())
|
|
9079
9171
|
});
|
|
9080
9172
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
9081
9173
|
frontmatter;
|
|
@@ -9083,7 +9175,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9083
9175
|
static getSettablePaths() {
|
|
9084
9176
|
return {
|
|
9085
9177
|
nonRoot: {
|
|
9086
|
-
relativeDirPath: (0,
|
|
9178
|
+
relativeDirPath: (0, import_node_path76.join)(".cursor", "rules")
|
|
9087
9179
|
}
|
|
9088
9180
|
};
|
|
9089
9181
|
}
|
|
@@ -9092,7 +9184,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9092
9184
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9093
9185
|
if (!result.success) {
|
|
9094
9186
|
throw new Error(
|
|
9095
|
-
`Invalid frontmatter in ${(0,
|
|
9187
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
9096
9188
|
);
|
|
9097
9189
|
}
|
|
9098
9190
|
}
|
|
@@ -9209,19 +9301,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9209
9301
|
validate = true
|
|
9210
9302
|
}) {
|
|
9211
9303
|
const fileContent = await readFileContent(
|
|
9212
|
-
(0,
|
|
9304
|
+
(0, import_node_path76.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9213
9305
|
);
|
|
9214
9306
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
9215
9307
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
9216
9308
|
if (!result.success) {
|
|
9217
9309
|
throw new Error(
|
|
9218
|
-
`Invalid frontmatter in ${(0,
|
|
9310
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
9219
9311
|
);
|
|
9220
9312
|
}
|
|
9221
9313
|
return new _CursorRule({
|
|
9222
9314
|
baseDir,
|
|
9223
9315
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
9224
|
-
relativeFilePath: (0,
|
|
9316
|
+
relativeFilePath: (0, import_node_path76.basename)(relativeFilePath),
|
|
9225
9317
|
frontmatter: result.data,
|
|
9226
9318
|
body: content.trim(),
|
|
9227
9319
|
validate
|
|
@@ -9252,7 +9344,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9252
9344
|
return {
|
|
9253
9345
|
success: false,
|
|
9254
9346
|
error: new Error(
|
|
9255
|
-
`Invalid frontmatter in ${(0,
|
|
9347
|
+
`Invalid frontmatter in ${(0, import_node_path76.join)(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
9256
9348
|
)
|
|
9257
9349
|
};
|
|
9258
9350
|
}
|
|
@@ -9272,7 +9364,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
9272
9364
|
};
|
|
9273
9365
|
|
|
9274
9366
|
// src/features/rules/geminicli-rule.ts
|
|
9275
|
-
var
|
|
9367
|
+
var import_node_path77 = require("path");
|
|
9276
9368
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
9277
9369
|
static getSettablePaths({
|
|
9278
9370
|
global
|
|
@@ -9291,7 +9383,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9291
9383
|
relativeFilePath: "GEMINI.md"
|
|
9292
9384
|
},
|
|
9293
9385
|
nonRoot: {
|
|
9294
|
-
relativeDirPath: (0,
|
|
9386
|
+
relativeDirPath: (0, import_node_path77.join)(".gemini", "memories")
|
|
9295
9387
|
}
|
|
9296
9388
|
};
|
|
9297
9389
|
}
|
|
@@ -9306,7 +9398,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9306
9398
|
if (isRoot) {
|
|
9307
9399
|
const relativePath2 = paths.root.relativeFilePath;
|
|
9308
9400
|
const fileContent2 = await readFileContent(
|
|
9309
|
-
(0,
|
|
9401
|
+
(0, import_node_path77.join)(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
9310
9402
|
);
|
|
9311
9403
|
return new _GeminiCliRule({
|
|
9312
9404
|
baseDir,
|
|
@@ -9320,8 +9412,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9320
9412
|
if (!paths.nonRoot) {
|
|
9321
9413
|
throw new Error("nonRoot path is not set");
|
|
9322
9414
|
}
|
|
9323
|
-
const relativePath = (0,
|
|
9324
|
-
const fileContent = await readFileContent((0,
|
|
9415
|
+
const relativePath = (0, import_node_path77.join)(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
9416
|
+
const fileContent = await readFileContent((0, import_node_path77.join)(baseDir, relativePath));
|
|
9325
9417
|
return new _GeminiCliRule({
|
|
9326
9418
|
baseDir,
|
|
9327
9419
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -9380,7 +9472,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
9380
9472
|
};
|
|
9381
9473
|
|
|
9382
9474
|
// src/features/rules/junie-rule.ts
|
|
9383
|
-
var
|
|
9475
|
+
var import_node_path78 = require("path");
|
|
9384
9476
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
9385
9477
|
static getSettablePaths() {
|
|
9386
9478
|
return {
|
|
@@ -9389,7 +9481,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9389
9481
|
relativeFilePath: "guidelines.md"
|
|
9390
9482
|
},
|
|
9391
9483
|
nonRoot: {
|
|
9392
|
-
relativeDirPath: (0,
|
|
9484
|
+
relativeDirPath: (0, import_node_path78.join)(".junie", "memories")
|
|
9393
9485
|
}
|
|
9394
9486
|
};
|
|
9395
9487
|
}
|
|
@@ -9399,8 +9491,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9399
9491
|
validate = true
|
|
9400
9492
|
}) {
|
|
9401
9493
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
9402
|
-
const relativePath = isRoot ? "guidelines.md" : (0,
|
|
9403
|
-
const fileContent = await readFileContent((0,
|
|
9494
|
+
const relativePath = isRoot ? "guidelines.md" : (0, import_node_path78.join)(".junie", "memories", relativeFilePath);
|
|
9495
|
+
const fileContent = await readFileContent((0, import_node_path78.join)(baseDir, relativePath));
|
|
9404
9496
|
return new _JunieRule({
|
|
9405
9497
|
baseDir,
|
|
9406
9498
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9455,12 +9547,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
9455
9547
|
};
|
|
9456
9548
|
|
|
9457
9549
|
// src/features/rules/kiro-rule.ts
|
|
9458
|
-
var
|
|
9550
|
+
var import_node_path79 = require("path");
|
|
9459
9551
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
9460
9552
|
static getSettablePaths() {
|
|
9461
9553
|
return {
|
|
9462
9554
|
nonRoot: {
|
|
9463
|
-
relativeDirPath: (0,
|
|
9555
|
+
relativeDirPath: (0, import_node_path79.join)(".kiro", "steering")
|
|
9464
9556
|
}
|
|
9465
9557
|
};
|
|
9466
9558
|
}
|
|
@@ -9470,7 +9562,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9470
9562
|
validate = true
|
|
9471
9563
|
}) {
|
|
9472
9564
|
const fileContent = await readFileContent(
|
|
9473
|
-
(0,
|
|
9565
|
+
(0, import_node_path79.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9474
9566
|
);
|
|
9475
9567
|
return new _KiroRule({
|
|
9476
9568
|
baseDir,
|
|
@@ -9524,7 +9616,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
9524
9616
|
};
|
|
9525
9617
|
|
|
9526
9618
|
// src/features/rules/opencode-rule.ts
|
|
9527
|
-
var
|
|
9619
|
+
var import_node_path80 = require("path");
|
|
9528
9620
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
9529
9621
|
static getSettablePaths() {
|
|
9530
9622
|
return {
|
|
@@ -9533,7 +9625,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9533
9625
|
relativeFilePath: "AGENTS.md"
|
|
9534
9626
|
},
|
|
9535
9627
|
nonRoot: {
|
|
9536
|
-
relativeDirPath: (0,
|
|
9628
|
+
relativeDirPath: (0, import_node_path80.join)(".opencode", "memories")
|
|
9537
9629
|
}
|
|
9538
9630
|
};
|
|
9539
9631
|
}
|
|
@@ -9543,8 +9635,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9543
9635
|
validate = true
|
|
9544
9636
|
}) {
|
|
9545
9637
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
9546
|
-
const relativePath = isRoot ? "AGENTS.md" : (0,
|
|
9547
|
-
const fileContent = await readFileContent((0,
|
|
9638
|
+
const relativePath = isRoot ? "AGENTS.md" : (0, import_node_path80.join)(".opencode", "memories", relativeFilePath);
|
|
9639
|
+
const fileContent = await readFileContent((0, import_node_path80.join)(baseDir, relativePath));
|
|
9548
9640
|
return new _OpenCodeRule({
|
|
9549
9641
|
baseDir,
|
|
9550
9642
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9599,7 +9691,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
9599
9691
|
};
|
|
9600
9692
|
|
|
9601
9693
|
// src/features/rules/qwencode-rule.ts
|
|
9602
|
-
var
|
|
9694
|
+
var import_node_path81 = require("path");
|
|
9603
9695
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
9604
9696
|
static getSettablePaths() {
|
|
9605
9697
|
return {
|
|
@@ -9608,7 +9700,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9608
9700
|
relativeFilePath: "QWEN.md"
|
|
9609
9701
|
},
|
|
9610
9702
|
nonRoot: {
|
|
9611
|
-
relativeDirPath: (0,
|
|
9703
|
+
relativeDirPath: (0, import_node_path81.join)(".qwen", "memories")
|
|
9612
9704
|
}
|
|
9613
9705
|
};
|
|
9614
9706
|
}
|
|
@@ -9618,8 +9710,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9618
9710
|
validate = true
|
|
9619
9711
|
}) {
|
|
9620
9712
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
9621
|
-
const relativePath = isRoot ? "QWEN.md" : (0,
|
|
9622
|
-
const fileContent = await readFileContent((0,
|
|
9713
|
+
const relativePath = isRoot ? "QWEN.md" : (0, import_node_path81.join)(".qwen", "memories", relativeFilePath);
|
|
9714
|
+
const fileContent = await readFileContent((0, import_node_path81.join)(baseDir, relativePath));
|
|
9623
9715
|
return new _QwencodeRule({
|
|
9624
9716
|
baseDir,
|
|
9625
9717
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -9671,12 +9763,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
9671
9763
|
};
|
|
9672
9764
|
|
|
9673
9765
|
// src/features/rules/roo-rule.ts
|
|
9674
|
-
var
|
|
9766
|
+
var import_node_path82 = require("path");
|
|
9675
9767
|
var RooRule = class _RooRule extends ToolRule {
|
|
9676
9768
|
static getSettablePaths() {
|
|
9677
9769
|
return {
|
|
9678
9770
|
nonRoot: {
|
|
9679
|
-
relativeDirPath: (0,
|
|
9771
|
+
relativeDirPath: (0, import_node_path82.join)(".roo", "rules")
|
|
9680
9772
|
}
|
|
9681
9773
|
};
|
|
9682
9774
|
}
|
|
@@ -9686,7 +9778,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9686
9778
|
validate = true
|
|
9687
9779
|
}) {
|
|
9688
9780
|
const fileContent = await readFileContent(
|
|
9689
|
-
(0,
|
|
9781
|
+
(0, import_node_path82.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9690
9782
|
);
|
|
9691
9783
|
return new _RooRule({
|
|
9692
9784
|
baseDir,
|
|
@@ -9755,7 +9847,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
9755
9847
|
};
|
|
9756
9848
|
|
|
9757
9849
|
// src/features/rules/warp-rule.ts
|
|
9758
|
-
var
|
|
9850
|
+
var import_node_path83 = require("path");
|
|
9759
9851
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
9760
9852
|
constructor({ fileContent, root, ...rest }) {
|
|
9761
9853
|
super({
|
|
@@ -9771,7 +9863,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9771
9863
|
relativeFilePath: "WARP.md"
|
|
9772
9864
|
},
|
|
9773
9865
|
nonRoot: {
|
|
9774
|
-
relativeDirPath: (0,
|
|
9866
|
+
relativeDirPath: (0, import_node_path83.join)(".warp", "memories")
|
|
9775
9867
|
}
|
|
9776
9868
|
};
|
|
9777
9869
|
}
|
|
@@ -9781,8 +9873,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9781
9873
|
validate = true
|
|
9782
9874
|
}) {
|
|
9783
9875
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
9784
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0,
|
|
9785
|
-
const fileContent = await readFileContent((0,
|
|
9876
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : (0, import_node_path83.join)(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
9877
|
+
const fileContent = await readFileContent((0, import_node_path83.join)(baseDir, relativePath));
|
|
9786
9878
|
return new _WarpRule({
|
|
9787
9879
|
baseDir,
|
|
9788
9880
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -9837,12 +9929,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
9837
9929
|
};
|
|
9838
9930
|
|
|
9839
9931
|
// src/features/rules/windsurf-rule.ts
|
|
9840
|
-
var
|
|
9932
|
+
var import_node_path84 = require("path");
|
|
9841
9933
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
9842
9934
|
static getSettablePaths() {
|
|
9843
9935
|
return {
|
|
9844
9936
|
nonRoot: {
|
|
9845
|
-
relativeDirPath: (0,
|
|
9937
|
+
relativeDirPath: (0, import_node_path84.join)(".windsurf", "rules")
|
|
9846
9938
|
}
|
|
9847
9939
|
};
|
|
9848
9940
|
}
|
|
@@ -9852,7 +9944,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
9852
9944
|
validate = true
|
|
9853
9945
|
}) {
|
|
9854
9946
|
const fileContent = await readFileContent(
|
|
9855
|
-
(0,
|
|
9947
|
+
(0, import_node_path84.join)(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
9856
9948
|
);
|
|
9857
9949
|
return new _WindsurfRule({
|
|
9858
9950
|
baseDir,
|
|
@@ -9906,7 +9998,6 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
9906
9998
|
// src/features/rules/rules-processor.ts
|
|
9907
9999
|
var rulesProcessorToolTargets = [
|
|
9908
10000
|
"agentsmd",
|
|
9909
|
-
"amazonqcli",
|
|
9910
10001
|
"antigravity",
|
|
9911
10002
|
"augmentcode",
|
|
9912
10003
|
"augmentcode-legacy",
|
|
@@ -9925,7 +10016,7 @@ var rulesProcessorToolTargets = [
|
|
|
9925
10016
|
"warp",
|
|
9926
10017
|
"windsurf"
|
|
9927
10018
|
];
|
|
9928
|
-
var RulesProcessorToolTargetSchema =
|
|
10019
|
+
var RulesProcessorToolTargetSchema = import_mini40.z.enum(rulesProcessorToolTargets);
|
|
9929
10020
|
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
9930
10021
|
[
|
|
9931
10022
|
"agentsmd",
|
|
@@ -9943,13 +10034,6 @@ var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
|
9943
10034
|
}
|
|
9944
10035
|
}
|
|
9945
10036
|
],
|
|
9946
|
-
[
|
|
9947
|
-
"amazonqcli",
|
|
9948
|
-
{
|
|
9949
|
-
class: AmazonQCliRule,
|
|
9950
|
-
meta: { extension: "md", supportsGlobal: false, ruleDiscoveryMode: "auto" }
|
|
9951
|
-
}
|
|
9952
|
-
],
|
|
9953
10037
|
[
|
|
9954
10038
|
"antigravity",
|
|
9955
10039
|
{
|
|
@@ -10209,7 +10293,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10209
10293
|
}).relativeDirPath;
|
|
10210
10294
|
return this.skills.filter((skill) => skillClass.isTargetedByRulesyncSkill(skill)).map((skill) => {
|
|
10211
10295
|
const frontmatter = skill.getFrontmatter();
|
|
10212
|
-
const relativePath = (0,
|
|
10296
|
+
const relativePath = (0, import_node_path85.join)(toolRelativeDirPath, skill.getDirName(), SKILL_FILE_NAME);
|
|
10213
10297
|
return {
|
|
10214
10298
|
name: frontmatter.name,
|
|
10215
10299
|
description: frontmatter.description,
|
|
@@ -10276,10 +10360,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10276
10360
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
10277
10361
|
*/
|
|
10278
10362
|
async loadRulesyncFiles() {
|
|
10279
|
-
const files = await findFilesByGlobs((0,
|
|
10363
|
+
const files = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
10280
10364
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
10281
10365
|
const rulesyncRules = await Promise.all(
|
|
10282
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0,
|
|
10366
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: (0, import_node_path85.basename)(file) }))
|
|
10283
10367
|
);
|
|
10284
10368
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
10285
10369
|
if (rootRules.length > 1) {
|
|
@@ -10297,10 +10381,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10297
10381
|
return rulesyncRules;
|
|
10298
10382
|
}
|
|
10299
10383
|
async loadRulesyncFilesLegacy() {
|
|
10300
|
-
const legacyFiles = await findFilesByGlobs((0,
|
|
10384
|
+
const legacyFiles = await findFilesByGlobs((0, import_node_path85.join)(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
10301
10385
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
10302
10386
|
return Promise.all(
|
|
10303
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0,
|
|
10387
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: (0, import_node_path85.basename)(file) }))
|
|
10304
10388
|
);
|
|
10305
10389
|
}
|
|
10306
10390
|
/**
|
|
@@ -10318,7 +10402,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10318
10402
|
return [];
|
|
10319
10403
|
}
|
|
10320
10404
|
const rootFilePaths = await findFilesByGlobs(
|
|
10321
|
-
(0,
|
|
10405
|
+
(0, import_node_path85.join)(
|
|
10322
10406
|
this.baseDir,
|
|
10323
10407
|
settablePaths.root.relativeDirPath ?? ".",
|
|
10324
10408
|
settablePaths.root.relativeFilePath
|
|
@@ -10329,7 +10413,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10329
10413
|
(filePath) => factory.class.forDeletion({
|
|
10330
10414
|
baseDir: this.baseDir,
|
|
10331
10415
|
relativeDirPath: settablePaths.root?.relativeDirPath ?? ".",
|
|
10332
|
-
relativeFilePath: (0,
|
|
10416
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
10333
10417
|
global: this.global
|
|
10334
10418
|
})
|
|
10335
10419
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10338,7 +10422,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10338
10422
|
rootFilePaths.map(
|
|
10339
10423
|
(filePath) => factory.class.fromFile({
|
|
10340
10424
|
baseDir: this.baseDir,
|
|
10341
|
-
relativeFilePath: (0,
|
|
10425
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
10342
10426
|
global: this.global
|
|
10343
10427
|
})
|
|
10344
10428
|
)
|
|
@@ -10350,14 +10434,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10350
10434
|
return [];
|
|
10351
10435
|
}
|
|
10352
10436
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
10353
|
-
(0,
|
|
10437
|
+
(0, import_node_path85.join)(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
10354
10438
|
);
|
|
10355
10439
|
if (forDeletion) {
|
|
10356
10440
|
return nonRootFilePaths.map(
|
|
10357
10441
|
(filePath) => factory.class.forDeletion({
|
|
10358
10442
|
baseDir: this.baseDir,
|
|
10359
10443
|
relativeDirPath: settablePaths.nonRoot?.relativeDirPath ?? ".",
|
|
10360
|
-
relativeFilePath: (0,
|
|
10444
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
10361
10445
|
global: this.global
|
|
10362
10446
|
})
|
|
10363
10447
|
).filter((rule) => rule.isDeletable());
|
|
@@ -10366,7 +10450,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
10366
10450
|
nonRootFilePaths.map(
|
|
10367
10451
|
(filePath) => factory.class.fromFile({
|
|
10368
10452
|
baseDir: this.baseDir,
|
|
10369
|
-
relativeFilePath: (0,
|
|
10453
|
+
relativeFilePath: (0, import_node_path85.basename)(filePath),
|
|
10370
10454
|
global: this.global
|
|
10371
10455
|
})
|
|
10372
10456
|
)
|
|
@@ -10459,14 +10543,14 @@ s/<command> [arguments]
|
|
|
10459
10543
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
10460
10544
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
10461
10545
|
|
|
10462
|
-
When users call a custom slash command, you have to look for the markdown file, \`${(0,
|
|
10546
|
+
When users call a custom slash command, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
10463
10547
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
10464
10548
|
|
|
10465
10549
|
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.
|
|
10466
10550
|
|
|
10467
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0,
|
|
10551
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
10468
10552
|
|
|
10469
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0,
|
|
10553
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${(0, import_node_path85.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
10470
10554
|
const skillsSection = skills ? this.generateSkillsSection(skills) : "";
|
|
10471
10555
|
const result = [
|
|
10472
10556
|
overview,
|
|
@@ -10748,15 +10832,13 @@ async function generateSkills(config) {
|
|
|
10748
10832
|
}
|
|
10749
10833
|
|
|
10750
10834
|
// src/cli/commands/gitignore.ts
|
|
10751
|
-
var
|
|
10835
|
+
var import_node_path86 = require("path");
|
|
10752
10836
|
var RULESYNC_HEADER = "# Generated by Rulesync";
|
|
10753
10837
|
var LEGACY_RULESYNC_HEADER = "# Generated by rulesync - AI tool configuration files";
|
|
10754
10838
|
var RULESYNC_IGNORE_ENTRIES = [
|
|
10755
10839
|
// AGENTS.md
|
|
10756
10840
|
"**/AGENTS.md",
|
|
10757
10841
|
"**/.agents/",
|
|
10758
|
-
// Amazon Q
|
|
10759
|
-
"**/.amazonq/",
|
|
10760
10842
|
// Augment
|
|
10761
10843
|
"**/.augmentignore",
|
|
10762
10844
|
"**/.augment/rules/",
|
|
@@ -10773,6 +10855,7 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
10773
10855
|
"**/.mcp.json",
|
|
10774
10856
|
// Cline
|
|
10775
10857
|
"**/.clinerules/",
|
|
10858
|
+
"**/.clinerules/workflows/",
|
|
10776
10859
|
"**/.clineignore",
|
|
10777
10860
|
"**/.cline/mcp.json",
|
|
10778
10861
|
// Codex
|
|
@@ -10806,13 +10889,14 @@ var RULESYNC_IGNORE_ENTRIES = [
|
|
|
10806
10889
|
"**/.opencode/memories/",
|
|
10807
10890
|
"**/.opencode/command/",
|
|
10808
10891
|
"**/.opencode/agent/",
|
|
10809
|
-
"**/.opencode/
|
|
10892
|
+
"**/.opencode/skill/",
|
|
10810
10893
|
"**/opencode.json",
|
|
10811
10894
|
// Qwen
|
|
10812
10895
|
"**/QWEN.md",
|
|
10813
10896
|
"**/.qwen/memories/",
|
|
10814
10897
|
// Roo
|
|
10815
10898
|
"**/.roo/rules/",
|
|
10899
|
+
"**/.roo/skills/",
|
|
10816
10900
|
"**/.rooignore",
|
|
10817
10901
|
"**/.roo/mcp.json",
|
|
10818
10902
|
"**/.roo/subagents/",
|
|
@@ -10873,7 +10957,7 @@ var removeExistingRulesyncEntries = (content) => {
|
|
|
10873
10957
|
return result;
|
|
10874
10958
|
};
|
|
10875
10959
|
var gitignoreCommand = async () => {
|
|
10876
|
-
const gitignorePath = (0,
|
|
10960
|
+
const gitignorePath = (0, import_node_path86.join)(process.cwd(), ".gitignore");
|
|
10877
10961
|
let gitignoreContent = "";
|
|
10878
10962
|
if (await fileExists(gitignorePath)) {
|
|
10879
10963
|
gitignoreContent = await readFileContent(gitignorePath);
|
|
@@ -11072,7 +11156,7 @@ async function importSkills(config, tool) {
|
|
|
11072
11156
|
}
|
|
11073
11157
|
|
|
11074
11158
|
// src/cli/commands/init.ts
|
|
11075
|
-
var
|
|
11159
|
+
var import_node_path87 = require("path");
|
|
11076
11160
|
async function initCommand() {
|
|
11077
11161
|
logger.info("Initializing rulesync...");
|
|
11078
11162
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -11235,14 +11319,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11235
11319
|
await ensureDir(commandPaths.relativeDirPath);
|
|
11236
11320
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
11237
11321
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
11238
|
-
const ruleFilepath = (0,
|
|
11322
|
+
const ruleFilepath = (0, import_node_path87.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
11239
11323
|
if (!await fileExists(ruleFilepath)) {
|
|
11240
11324
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
11241
11325
|
logger.success(`Created ${ruleFilepath}`);
|
|
11242
11326
|
} else {
|
|
11243
11327
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
11244
11328
|
}
|
|
11245
|
-
const mcpFilepath = (0,
|
|
11329
|
+
const mcpFilepath = (0, import_node_path87.join)(
|
|
11246
11330
|
mcpPaths.recommended.relativeDirPath,
|
|
11247
11331
|
mcpPaths.recommended.relativeFilePath
|
|
11248
11332
|
);
|
|
@@ -11252,21 +11336,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11252
11336
|
} else {
|
|
11253
11337
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
11254
11338
|
}
|
|
11255
|
-
const commandFilepath = (0,
|
|
11339
|
+
const commandFilepath = (0, import_node_path87.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
11256
11340
|
if (!await fileExists(commandFilepath)) {
|
|
11257
11341
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
11258
11342
|
logger.success(`Created ${commandFilepath}`);
|
|
11259
11343
|
} else {
|
|
11260
11344
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
11261
11345
|
}
|
|
11262
|
-
const subagentFilepath = (0,
|
|
11346
|
+
const subagentFilepath = (0, import_node_path87.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
11263
11347
|
if (!await fileExists(subagentFilepath)) {
|
|
11264
11348
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
11265
11349
|
logger.success(`Created ${subagentFilepath}`);
|
|
11266
11350
|
} else {
|
|
11267
11351
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
11268
11352
|
}
|
|
11269
|
-
const ignoreFilepath = (0,
|
|
11353
|
+
const ignoreFilepath = (0, import_node_path87.join)(
|
|
11270
11354
|
ignorePaths.recommended.relativeDirPath,
|
|
11271
11355
|
ignorePaths.recommended.relativeFilePath
|
|
11272
11356
|
);
|
|
@@ -11282,15 +11366,15 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
11282
11366
|
var import_fastmcp = require("fastmcp");
|
|
11283
11367
|
|
|
11284
11368
|
// src/mcp/tools.ts
|
|
11285
|
-
var
|
|
11369
|
+
var import_mini47 = require("zod/mini");
|
|
11286
11370
|
|
|
11287
11371
|
// src/mcp/commands.ts
|
|
11288
|
-
var
|
|
11289
|
-
var
|
|
11372
|
+
var import_node_path88 = require("path");
|
|
11373
|
+
var import_mini41 = require("zod/mini");
|
|
11290
11374
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
11291
11375
|
var maxCommandsCount = 1e3;
|
|
11292
11376
|
async function listCommands() {
|
|
11293
|
-
const commandsDir = (0,
|
|
11377
|
+
const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11294
11378
|
try {
|
|
11295
11379
|
const files = await listDirectoryFiles(commandsDir);
|
|
11296
11380
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11302,7 +11386,7 @@ async function listCommands() {
|
|
|
11302
11386
|
});
|
|
11303
11387
|
const frontmatter = command.getFrontmatter();
|
|
11304
11388
|
return {
|
|
11305
|
-
relativePathFromCwd: (0,
|
|
11389
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
11306
11390
|
frontmatter
|
|
11307
11391
|
};
|
|
11308
11392
|
} catch (error) {
|
|
@@ -11322,13 +11406,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
11322
11406
|
relativePath: relativePathFromCwd,
|
|
11323
11407
|
intendedRootDir: process.cwd()
|
|
11324
11408
|
});
|
|
11325
|
-
const filename = (0,
|
|
11409
|
+
const filename = (0, import_node_path88.basename)(relativePathFromCwd);
|
|
11326
11410
|
try {
|
|
11327
11411
|
const command = await RulesyncCommand.fromFile({
|
|
11328
11412
|
relativeFilePath: filename
|
|
11329
11413
|
});
|
|
11330
11414
|
return {
|
|
11331
|
-
relativePathFromCwd: (0,
|
|
11415
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11332
11416
|
frontmatter: command.getFrontmatter(),
|
|
11333
11417
|
body: command.getBody()
|
|
11334
11418
|
};
|
|
@@ -11347,7 +11431,7 @@ async function putCommand({
|
|
|
11347
11431
|
relativePath: relativePathFromCwd,
|
|
11348
11432
|
intendedRootDir: process.cwd()
|
|
11349
11433
|
});
|
|
11350
|
-
const filename = (0,
|
|
11434
|
+
const filename = (0, import_node_path88.basename)(relativePathFromCwd);
|
|
11351
11435
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11352
11436
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
11353
11437
|
throw new Error(
|
|
@@ -11357,7 +11441,7 @@ async function putCommand({
|
|
|
11357
11441
|
try {
|
|
11358
11442
|
const existingCommands = await listCommands();
|
|
11359
11443
|
const isUpdate = existingCommands.some(
|
|
11360
|
-
(command2) => command2.relativePathFromCwd === (0,
|
|
11444
|
+
(command2) => command2.relativePathFromCwd === (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11361
11445
|
);
|
|
11362
11446
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
11363
11447
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -11372,11 +11456,11 @@ async function putCommand({
|
|
|
11372
11456
|
fileContent,
|
|
11373
11457
|
validate: true
|
|
11374
11458
|
});
|
|
11375
|
-
const commandsDir = (0,
|
|
11459
|
+
const commandsDir = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
11376
11460
|
await ensureDir(commandsDir);
|
|
11377
11461
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
11378
11462
|
return {
|
|
11379
|
-
relativePathFromCwd: (0,
|
|
11463
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
11380
11464
|
frontmatter: command.getFrontmatter(),
|
|
11381
11465
|
body: command.getBody()
|
|
11382
11466
|
};
|
|
@@ -11391,12 +11475,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11391
11475
|
relativePath: relativePathFromCwd,
|
|
11392
11476
|
intendedRootDir: process.cwd()
|
|
11393
11477
|
});
|
|
11394
|
-
const filename = (0,
|
|
11395
|
-
const fullPath = (0,
|
|
11478
|
+
const filename = (0, import_node_path88.basename)(relativePathFromCwd);
|
|
11479
|
+
const fullPath = (0, import_node_path88.join)(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
11396
11480
|
try {
|
|
11397
11481
|
await removeFile(fullPath);
|
|
11398
11482
|
return {
|
|
11399
|
-
relativePathFromCwd: (0,
|
|
11483
|
+
relativePathFromCwd: (0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
11400
11484
|
};
|
|
11401
11485
|
} catch (error) {
|
|
11402
11486
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11405,23 +11489,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
11405
11489
|
}
|
|
11406
11490
|
}
|
|
11407
11491
|
var commandToolSchemas = {
|
|
11408
|
-
listCommands:
|
|
11409
|
-
getCommand:
|
|
11410
|
-
relativePathFromCwd:
|
|
11492
|
+
listCommands: import_mini41.z.object({}),
|
|
11493
|
+
getCommand: import_mini41.z.object({
|
|
11494
|
+
relativePathFromCwd: import_mini41.z.string()
|
|
11411
11495
|
}),
|
|
11412
|
-
putCommand:
|
|
11413
|
-
relativePathFromCwd:
|
|
11496
|
+
putCommand: import_mini41.z.object({
|
|
11497
|
+
relativePathFromCwd: import_mini41.z.string(),
|
|
11414
11498
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
11415
|
-
body:
|
|
11499
|
+
body: import_mini41.z.string()
|
|
11416
11500
|
}),
|
|
11417
|
-
deleteCommand:
|
|
11418
|
-
relativePathFromCwd:
|
|
11501
|
+
deleteCommand: import_mini41.z.object({
|
|
11502
|
+
relativePathFromCwd: import_mini41.z.string()
|
|
11419
11503
|
})
|
|
11420
11504
|
};
|
|
11421
11505
|
var commandTools = {
|
|
11422
11506
|
listCommands: {
|
|
11423
11507
|
name: "listCommands",
|
|
11424
|
-
description: `List all commands from ${(0,
|
|
11508
|
+
description: `List all commands from ${(0, import_node_path88.join)(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11425
11509
|
parameters: commandToolSchemas.listCommands,
|
|
11426
11510
|
execute: async () => {
|
|
11427
11511
|
const commands = await listCommands();
|
|
@@ -11463,11 +11547,11 @@ var commandTools = {
|
|
|
11463
11547
|
};
|
|
11464
11548
|
|
|
11465
11549
|
// src/mcp/ignore.ts
|
|
11466
|
-
var
|
|
11467
|
-
var
|
|
11550
|
+
var import_node_path89 = require("path");
|
|
11551
|
+
var import_mini42 = require("zod/mini");
|
|
11468
11552
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
11469
11553
|
async function getIgnoreFile() {
|
|
11470
|
-
const ignoreFilePath = (0,
|
|
11554
|
+
const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11471
11555
|
try {
|
|
11472
11556
|
const content = await readFileContent(ignoreFilePath);
|
|
11473
11557
|
return {
|
|
@@ -11481,7 +11565,7 @@ async function getIgnoreFile() {
|
|
|
11481
11565
|
}
|
|
11482
11566
|
}
|
|
11483
11567
|
async function putIgnoreFile({ content }) {
|
|
11484
|
-
const ignoreFilePath = (0,
|
|
11568
|
+
const ignoreFilePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11485
11569
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
11486
11570
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
11487
11571
|
throw new Error(
|
|
@@ -11502,8 +11586,8 @@ async function putIgnoreFile({ content }) {
|
|
|
11502
11586
|
}
|
|
11503
11587
|
}
|
|
11504
11588
|
async function deleteIgnoreFile() {
|
|
11505
|
-
const aiignorePath = (0,
|
|
11506
|
-
const legacyIgnorePath = (0,
|
|
11589
|
+
const aiignorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
11590
|
+
const legacyIgnorePath = (0, import_node_path89.join)(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
11507
11591
|
try {
|
|
11508
11592
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
11509
11593
|
return {
|
|
@@ -11521,11 +11605,11 @@ async function deleteIgnoreFile() {
|
|
|
11521
11605
|
}
|
|
11522
11606
|
}
|
|
11523
11607
|
var ignoreToolSchemas = {
|
|
11524
|
-
getIgnoreFile:
|
|
11525
|
-
putIgnoreFile:
|
|
11526
|
-
content:
|
|
11608
|
+
getIgnoreFile: import_mini42.z.object({}),
|
|
11609
|
+
putIgnoreFile: import_mini42.z.object({
|
|
11610
|
+
content: import_mini42.z.string()
|
|
11527
11611
|
}),
|
|
11528
|
-
deleteIgnoreFile:
|
|
11612
|
+
deleteIgnoreFile: import_mini42.z.object({})
|
|
11529
11613
|
};
|
|
11530
11614
|
var ignoreTools = {
|
|
11531
11615
|
getIgnoreFile: {
|
|
@@ -11558,8 +11642,8 @@ var ignoreTools = {
|
|
|
11558
11642
|
};
|
|
11559
11643
|
|
|
11560
11644
|
// src/mcp/mcp.ts
|
|
11561
|
-
var
|
|
11562
|
-
var
|
|
11645
|
+
var import_node_path90 = require("path");
|
|
11646
|
+
var import_mini43 = require("zod/mini");
|
|
11563
11647
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
11564
11648
|
async function getMcpFile() {
|
|
11565
11649
|
const config = await ConfigResolver.resolve({});
|
|
@@ -11568,7 +11652,7 @@ async function getMcpFile() {
|
|
|
11568
11652
|
validate: true,
|
|
11569
11653
|
modularMcp: config.getModularMcp()
|
|
11570
11654
|
});
|
|
11571
|
-
const relativePathFromCwd = (0,
|
|
11655
|
+
const relativePathFromCwd = (0, import_node_path90.join)(
|
|
11572
11656
|
rulesyncMcp.getRelativeDirPath(),
|
|
11573
11657
|
rulesyncMcp.getRelativeFilePath()
|
|
11574
11658
|
);
|
|
@@ -11601,7 +11685,7 @@ async function putMcpFile({ content }) {
|
|
|
11601
11685
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11602
11686
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
11603
11687
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
11604
|
-
const fullPath = (0,
|
|
11688
|
+
const fullPath = (0, import_node_path90.join)(baseDir, relativeDirPath, relativeFilePath);
|
|
11605
11689
|
const rulesyncMcp = new RulesyncMcp({
|
|
11606
11690
|
baseDir,
|
|
11607
11691
|
relativeDirPath,
|
|
@@ -11610,9 +11694,9 @@ async function putMcpFile({ content }) {
|
|
|
11610
11694
|
validate: true,
|
|
11611
11695
|
modularMcp: config.getModularMcp()
|
|
11612
11696
|
});
|
|
11613
|
-
await ensureDir((0,
|
|
11697
|
+
await ensureDir((0, import_node_path90.join)(baseDir, relativeDirPath));
|
|
11614
11698
|
await writeFileContent(fullPath, content);
|
|
11615
|
-
const relativePathFromCwd = (0,
|
|
11699
|
+
const relativePathFromCwd = (0, import_node_path90.join)(relativeDirPath, relativeFilePath);
|
|
11616
11700
|
return {
|
|
11617
11701
|
relativePathFromCwd,
|
|
11618
11702
|
content: rulesyncMcp.getFileContent()
|
|
@@ -11627,15 +11711,15 @@ async function deleteMcpFile() {
|
|
|
11627
11711
|
try {
|
|
11628
11712
|
const baseDir = process.cwd();
|
|
11629
11713
|
const paths = RulesyncMcp.getSettablePaths();
|
|
11630
|
-
const recommendedPath = (0,
|
|
11714
|
+
const recommendedPath = (0, import_node_path90.join)(
|
|
11631
11715
|
baseDir,
|
|
11632
11716
|
paths.recommended.relativeDirPath,
|
|
11633
11717
|
paths.recommended.relativeFilePath
|
|
11634
11718
|
);
|
|
11635
|
-
const legacyPath = (0,
|
|
11719
|
+
const legacyPath = (0, import_node_path90.join)(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
11636
11720
|
await removeFile(recommendedPath);
|
|
11637
11721
|
await removeFile(legacyPath);
|
|
11638
|
-
const relativePathFromCwd = (0,
|
|
11722
|
+
const relativePathFromCwd = (0, import_node_path90.join)(
|
|
11639
11723
|
paths.recommended.relativeDirPath,
|
|
11640
11724
|
paths.recommended.relativeFilePath
|
|
11641
11725
|
);
|
|
@@ -11649,11 +11733,11 @@ async function deleteMcpFile() {
|
|
|
11649
11733
|
}
|
|
11650
11734
|
}
|
|
11651
11735
|
var mcpToolSchemas = {
|
|
11652
|
-
getMcpFile:
|
|
11653
|
-
putMcpFile:
|
|
11654
|
-
content:
|
|
11736
|
+
getMcpFile: import_mini43.z.object({}),
|
|
11737
|
+
putMcpFile: import_mini43.z.object({
|
|
11738
|
+
content: import_mini43.z.string()
|
|
11655
11739
|
}),
|
|
11656
|
-
deleteMcpFile:
|
|
11740
|
+
deleteMcpFile: import_mini43.z.object({})
|
|
11657
11741
|
};
|
|
11658
11742
|
var mcpTools = {
|
|
11659
11743
|
getMcpFile: {
|
|
@@ -11686,12 +11770,12 @@ var mcpTools = {
|
|
|
11686
11770
|
};
|
|
11687
11771
|
|
|
11688
11772
|
// src/mcp/rules.ts
|
|
11689
|
-
var
|
|
11690
|
-
var
|
|
11773
|
+
var import_node_path91 = require("path");
|
|
11774
|
+
var import_mini44 = require("zod/mini");
|
|
11691
11775
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
11692
11776
|
var maxRulesCount = 1e3;
|
|
11693
11777
|
async function listRules() {
|
|
11694
|
-
const rulesDir = (0,
|
|
11778
|
+
const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11695
11779
|
try {
|
|
11696
11780
|
const files = await listDirectoryFiles(rulesDir);
|
|
11697
11781
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -11704,7 +11788,7 @@ async function listRules() {
|
|
|
11704
11788
|
});
|
|
11705
11789
|
const frontmatter = rule.getFrontmatter();
|
|
11706
11790
|
return {
|
|
11707
|
-
relativePathFromCwd: (0,
|
|
11791
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
11708
11792
|
frontmatter
|
|
11709
11793
|
};
|
|
11710
11794
|
} catch (error) {
|
|
@@ -11724,14 +11808,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
11724
11808
|
relativePath: relativePathFromCwd,
|
|
11725
11809
|
intendedRootDir: process.cwd()
|
|
11726
11810
|
});
|
|
11727
|
-
const filename = (0,
|
|
11811
|
+
const filename = (0, import_node_path91.basename)(relativePathFromCwd);
|
|
11728
11812
|
try {
|
|
11729
11813
|
const rule = await RulesyncRule.fromFile({
|
|
11730
11814
|
relativeFilePath: filename,
|
|
11731
11815
|
validate: true
|
|
11732
11816
|
});
|
|
11733
11817
|
return {
|
|
11734
|
-
relativePathFromCwd: (0,
|
|
11818
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11735
11819
|
frontmatter: rule.getFrontmatter(),
|
|
11736
11820
|
body: rule.getBody()
|
|
11737
11821
|
};
|
|
@@ -11750,7 +11834,7 @@ async function putRule({
|
|
|
11750
11834
|
relativePath: relativePathFromCwd,
|
|
11751
11835
|
intendedRootDir: process.cwd()
|
|
11752
11836
|
});
|
|
11753
|
-
const filename = (0,
|
|
11837
|
+
const filename = (0, import_node_path91.basename)(relativePathFromCwd);
|
|
11754
11838
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
11755
11839
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
11756
11840
|
throw new Error(
|
|
@@ -11760,7 +11844,7 @@ async function putRule({
|
|
|
11760
11844
|
try {
|
|
11761
11845
|
const existingRules = await listRules();
|
|
11762
11846
|
const isUpdate = existingRules.some(
|
|
11763
|
-
(rule2) => rule2.relativePathFromCwd === (0,
|
|
11847
|
+
(rule2) => rule2.relativePathFromCwd === (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11764
11848
|
);
|
|
11765
11849
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
11766
11850
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -11773,11 +11857,11 @@ async function putRule({
|
|
|
11773
11857
|
body,
|
|
11774
11858
|
validate: true
|
|
11775
11859
|
});
|
|
11776
|
-
const rulesDir = (0,
|
|
11860
|
+
const rulesDir = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
11777
11861
|
await ensureDir(rulesDir);
|
|
11778
11862
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
11779
11863
|
return {
|
|
11780
|
-
relativePathFromCwd: (0,
|
|
11864
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
11781
11865
|
frontmatter: rule.getFrontmatter(),
|
|
11782
11866
|
body: rule.getBody()
|
|
11783
11867
|
};
|
|
@@ -11792,12 +11876,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11792
11876
|
relativePath: relativePathFromCwd,
|
|
11793
11877
|
intendedRootDir: process.cwd()
|
|
11794
11878
|
});
|
|
11795
|
-
const filename = (0,
|
|
11796
|
-
const fullPath = (0,
|
|
11879
|
+
const filename = (0, import_node_path91.basename)(relativePathFromCwd);
|
|
11880
|
+
const fullPath = (0, import_node_path91.join)(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
11797
11881
|
try {
|
|
11798
11882
|
await removeFile(fullPath);
|
|
11799
11883
|
return {
|
|
11800
|
-
relativePathFromCwd: (0,
|
|
11884
|
+
relativePathFromCwd: (0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
11801
11885
|
};
|
|
11802
11886
|
} catch (error) {
|
|
11803
11887
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -11806,23 +11890,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
11806
11890
|
}
|
|
11807
11891
|
}
|
|
11808
11892
|
var ruleToolSchemas = {
|
|
11809
|
-
listRules:
|
|
11810
|
-
getRule:
|
|
11811
|
-
relativePathFromCwd:
|
|
11893
|
+
listRules: import_mini44.z.object({}),
|
|
11894
|
+
getRule: import_mini44.z.object({
|
|
11895
|
+
relativePathFromCwd: import_mini44.z.string()
|
|
11812
11896
|
}),
|
|
11813
|
-
putRule:
|
|
11814
|
-
relativePathFromCwd:
|
|
11897
|
+
putRule: import_mini44.z.object({
|
|
11898
|
+
relativePathFromCwd: import_mini44.z.string(),
|
|
11815
11899
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
11816
|
-
body:
|
|
11900
|
+
body: import_mini44.z.string()
|
|
11817
11901
|
}),
|
|
11818
|
-
deleteRule:
|
|
11819
|
-
relativePathFromCwd:
|
|
11902
|
+
deleteRule: import_mini44.z.object({
|
|
11903
|
+
relativePathFromCwd: import_mini44.z.string()
|
|
11820
11904
|
})
|
|
11821
11905
|
};
|
|
11822
11906
|
var ruleTools = {
|
|
11823
11907
|
listRules: {
|
|
11824
11908
|
name: "listRules",
|
|
11825
|
-
description: `List all rules from ${(0,
|
|
11909
|
+
description: `List all rules from ${(0, import_node_path91.join)(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
11826
11910
|
parameters: ruleToolSchemas.listRules,
|
|
11827
11911
|
execute: async () => {
|
|
11828
11912
|
const rules = await listRules();
|
|
@@ -11864,8 +11948,8 @@ var ruleTools = {
|
|
|
11864
11948
|
};
|
|
11865
11949
|
|
|
11866
11950
|
// src/mcp/skills.ts
|
|
11867
|
-
var
|
|
11868
|
-
var
|
|
11951
|
+
var import_node_path92 = require("path");
|
|
11952
|
+
var import_mini45 = require("zod/mini");
|
|
11869
11953
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
11870
11954
|
var maxSkillsCount = 1e3;
|
|
11871
11955
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -11881,19 +11965,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
11881
11965
|
};
|
|
11882
11966
|
}
|
|
11883
11967
|
function extractDirName(relativeDirPathFromCwd) {
|
|
11884
|
-
const dirName = (0,
|
|
11968
|
+
const dirName = (0, import_node_path92.basename)(relativeDirPathFromCwd);
|
|
11885
11969
|
if (!dirName) {
|
|
11886
11970
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
11887
11971
|
}
|
|
11888
11972
|
return dirName;
|
|
11889
11973
|
}
|
|
11890
11974
|
async function listSkills() {
|
|
11891
|
-
const skillsDir = (0,
|
|
11975
|
+
const skillsDir = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
11892
11976
|
try {
|
|
11893
|
-
const skillDirPaths = await findFilesByGlobs((0,
|
|
11977
|
+
const skillDirPaths = await findFilesByGlobs((0, import_node_path92.join)(skillsDir, "*"), { type: "dir" });
|
|
11894
11978
|
const skills = await Promise.all(
|
|
11895
11979
|
skillDirPaths.map(async (dirPath) => {
|
|
11896
|
-
const dirName = (0,
|
|
11980
|
+
const dirName = (0, import_node_path92.basename)(dirPath);
|
|
11897
11981
|
if (!dirName) return null;
|
|
11898
11982
|
try {
|
|
11899
11983
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -11901,7 +11985,7 @@ async function listSkills() {
|
|
|
11901
11985
|
});
|
|
11902
11986
|
const frontmatter = skill.getFrontmatter();
|
|
11903
11987
|
return {
|
|
11904
|
-
relativeDirPathFromCwd: (0,
|
|
11988
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11905
11989
|
frontmatter
|
|
11906
11990
|
};
|
|
11907
11991
|
} catch (error) {
|
|
@@ -11927,7 +12011,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
11927
12011
|
dirName
|
|
11928
12012
|
});
|
|
11929
12013
|
return {
|
|
11930
|
-
relativeDirPathFromCwd: (0,
|
|
12014
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11931
12015
|
frontmatter: skill.getFrontmatter(),
|
|
11932
12016
|
body: skill.getBody(),
|
|
11933
12017
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -11961,7 +12045,7 @@ async function putSkill({
|
|
|
11961
12045
|
try {
|
|
11962
12046
|
const existingSkills = await listSkills();
|
|
11963
12047
|
const isUpdate = existingSkills.some(
|
|
11964
|
-
(skill2) => skill2.relativeDirPathFromCwd === (0,
|
|
12048
|
+
(skill2) => skill2.relativeDirPathFromCwd === (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
11965
12049
|
);
|
|
11966
12050
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
11967
12051
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -11976,9 +12060,9 @@ async function putSkill({
|
|
|
11976
12060
|
otherFiles: aiDirFiles,
|
|
11977
12061
|
validate: true
|
|
11978
12062
|
});
|
|
11979
|
-
const skillDirPath = (0,
|
|
12063
|
+
const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
11980
12064
|
await ensureDir(skillDirPath);
|
|
11981
|
-
const skillFilePath = (0,
|
|
12065
|
+
const skillFilePath = (0, import_node_path92.join)(skillDirPath, SKILL_FILE_NAME);
|
|
11982
12066
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
11983
12067
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
11984
12068
|
for (const file of otherFiles) {
|
|
@@ -11986,15 +12070,15 @@ async function putSkill({
|
|
|
11986
12070
|
relativePath: file.name,
|
|
11987
12071
|
intendedRootDir: skillDirPath
|
|
11988
12072
|
});
|
|
11989
|
-
const filePath = (0,
|
|
11990
|
-
const fileDir = (0,
|
|
12073
|
+
const filePath = (0, import_node_path92.join)(skillDirPath, file.name);
|
|
12074
|
+
const fileDir = (0, import_node_path92.join)(skillDirPath, (0, import_node_path92.dirname)(file.name));
|
|
11991
12075
|
if (fileDir !== skillDirPath) {
|
|
11992
12076
|
await ensureDir(fileDir);
|
|
11993
12077
|
}
|
|
11994
12078
|
await writeFileContent(filePath, file.body);
|
|
11995
12079
|
}
|
|
11996
12080
|
return {
|
|
11997
|
-
relativeDirPathFromCwd: (0,
|
|
12081
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
11998
12082
|
frontmatter: skill.getFrontmatter(),
|
|
11999
12083
|
body: skill.getBody(),
|
|
12000
12084
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -12016,13 +12100,13 @@ async function deleteSkill({
|
|
|
12016
12100
|
intendedRootDir: process.cwd()
|
|
12017
12101
|
});
|
|
12018
12102
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
12019
|
-
const skillDirPath = (0,
|
|
12103
|
+
const skillDirPath = (0, import_node_path92.join)(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
12020
12104
|
try {
|
|
12021
12105
|
if (await directoryExists(skillDirPath)) {
|
|
12022
12106
|
await removeDirectory(skillDirPath);
|
|
12023
12107
|
}
|
|
12024
12108
|
return {
|
|
12025
|
-
relativeDirPathFromCwd: (0,
|
|
12109
|
+
relativeDirPathFromCwd: (0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
12026
12110
|
};
|
|
12027
12111
|
} catch (error) {
|
|
12028
12112
|
throw new Error(
|
|
@@ -12033,29 +12117,29 @@ async function deleteSkill({
|
|
|
12033
12117
|
);
|
|
12034
12118
|
}
|
|
12035
12119
|
}
|
|
12036
|
-
var McpSkillFileSchema =
|
|
12037
|
-
name:
|
|
12038
|
-
body:
|
|
12120
|
+
var McpSkillFileSchema = import_mini45.z.object({
|
|
12121
|
+
name: import_mini45.z.string(),
|
|
12122
|
+
body: import_mini45.z.string()
|
|
12039
12123
|
});
|
|
12040
12124
|
var skillToolSchemas = {
|
|
12041
|
-
listSkills:
|
|
12042
|
-
getSkill:
|
|
12043
|
-
relativeDirPathFromCwd:
|
|
12125
|
+
listSkills: import_mini45.z.object({}),
|
|
12126
|
+
getSkill: import_mini45.z.object({
|
|
12127
|
+
relativeDirPathFromCwd: import_mini45.z.string()
|
|
12044
12128
|
}),
|
|
12045
|
-
putSkill:
|
|
12046
|
-
relativeDirPathFromCwd:
|
|
12129
|
+
putSkill: import_mini45.z.object({
|
|
12130
|
+
relativeDirPathFromCwd: import_mini45.z.string(),
|
|
12047
12131
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
12048
|
-
body:
|
|
12049
|
-
otherFiles:
|
|
12132
|
+
body: import_mini45.z.string(),
|
|
12133
|
+
otherFiles: import_mini45.z.optional(import_mini45.z.array(McpSkillFileSchema))
|
|
12050
12134
|
}),
|
|
12051
|
-
deleteSkill:
|
|
12052
|
-
relativeDirPathFromCwd:
|
|
12135
|
+
deleteSkill: import_mini45.z.object({
|
|
12136
|
+
relativeDirPathFromCwd: import_mini45.z.string()
|
|
12053
12137
|
})
|
|
12054
12138
|
};
|
|
12055
12139
|
var skillTools = {
|
|
12056
12140
|
listSkills: {
|
|
12057
12141
|
name: "listSkills",
|
|
12058
|
-
description: `List all skills from ${(0,
|
|
12142
|
+
description: `List all skills from ${(0, import_node_path92.join)(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
12059
12143
|
parameters: skillToolSchemas.listSkills,
|
|
12060
12144
|
execute: async () => {
|
|
12061
12145
|
const skills = await listSkills();
|
|
@@ -12098,12 +12182,12 @@ var skillTools = {
|
|
|
12098
12182
|
};
|
|
12099
12183
|
|
|
12100
12184
|
// src/mcp/subagents.ts
|
|
12101
|
-
var
|
|
12102
|
-
var
|
|
12185
|
+
var import_node_path93 = require("path");
|
|
12186
|
+
var import_mini46 = require("zod/mini");
|
|
12103
12187
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
12104
12188
|
var maxSubagentsCount = 1e3;
|
|
12105
12189
|
async function listSubagents() {
|
|
12106
|
-
const subagentsDir = (0,
|
|
12190
|
+
const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12107
12191
|
try {
|
|
12108
12192
|
const files = await listDirectoryFiles(subagentsDir);
|
|
12109
12193
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -12116,7 +12200,7 @@ async function listSubagents() {
|
|
|
12116
12200
|
});
|
|
12117
12201
|
const frontmatter = subagent.getFrontmatter();
|
|
12118
12202
|
return {
|
|
12119
|
-
relativePathFromCwd: (0,
|
|
12203
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
12120
12204
|
frontmatter
|
|
12121
12205
|
};
|
|
12122
12206
|
} catch (error) {
|
|
@@ -12138,14 +12222,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
12138
12222
|
relativePath: relativePathFromCwd,
|
|
12139
12223
|
intendedRootDir: process.cwd()
|
|
12140
12224
|
});
|
|
12141
|
-
const filename = (0,
|
|
12225
|
+
const filename = (0, import_node_path93.basename)(relativePathFromCwd);
|
|
12142
12226
|
try {
|
|
12143
12227
|
const subagent = await RulesyncSubagent.fromFile({
|
|
12144
12228
|
relativeFilePath: filename,
|
|
12145
12229
|
validate: true
|
|
12146
12230
|
});
|
|
12147
12231
|
return {
|
|
12148
|
-
relativePathFromCwd: (0,
|
|
12232
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12149
12233
|
frontmatter: subagent.getFrontmatter(),
|
|
12150
12234
|
body: subagent.getBody()
|
|
12151
12235
|
};
|
|
@@ -12164,7 +12248,7 @@ async function putSubagent({
|
|
|
12164
12248
|
relativePath: relativePathFromCwd,
|
|
12165
12249
|
intendedRootDir: process.cwd()
|
|
12166
12250
|
});
|
|
12167
|
-
const filename = (0,
|
|
12251
|
+
const filename = (0, import_node_path93.basename)(relativePathFromCwd);
|
|
12168
12252
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
12169
12253
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
12170
12254
|
throw new Error(
|
|
@@ -12174,7 +12258,7 @@ async function putSubagent({
|
|
|
12174
12258
|
try {
|
|
12175
12259
|
const existingSubagents = await listSubagents();
|
|
12176
12260
|
const isUpdate = existingSubagents.some(
|
|
12177
|
-
(subagent2) => subagent2.relativePathFromCwd === (0,
|
|
12261
|
+
(subagent2) => subagent2.relativePathFromCwd === (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12178
12262
|
);
|
|
12179
12263
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
12180
12264
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -12187,11 +12271,11 @@ async function putSubagent({
|
|
|
12187
12271
|
body,
|
|
12188
12272
|
validate: true
|
|
12189
12273
|
});
|
|
12190
|
-
const subagentsDir = (0,
|
|
12274
|
+
const subagentsDir = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
12191
12275
|
await ensureDir(subagentsDir);
|
|
12192
12276
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
12193
12277
|
return {
|
|
12194
|
-
relativePathFromCwd: (0,
|
|
12278
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
12195
12279
|
frontmatter: subagent.getFrontmatter(),
|
|
12196
12280
|
body: subagent.getBody()
|
|
12197
12281
|
};
|
|
@@ -12206,12 +12290,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12206
12290
|
relativePath: relativePathFromCwd,
|
|
12207
12291
|
intendedRootDir: process.cwd()
|
|
12208
12292
|
});
|
|
12209
|
-
const filename = (0,
|
|
12210
|
-
const fullPath = (0,
|
|
12293
|
+
const filename = (0, import_node_path93.basename)(relativePathFromCwd);
|
|
12294
|
+
const fullPath = (0, import_node_path93.join)(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
12211
12295
|
try {
|
|
12212
12296
|
await removeFile(fullPath);
|
|
12213
12297
|
return {
|
|
12214
|
-
relativePathFromCwd: (0,
|
|
12298
|
+
relativePathFromCwd: (0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
12215
12299
|
};
|
|
12216
12300
|
} catch (error) {
|
|
12217
12301
|
throw new Error(
|
|
@@ -12223,23 +12307,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
12223
12307
|
}
|
|
12224
12308
|
}
|
|
12225
12309
|
var subagentToolSchemas = {
|
|
12226
|
-
listSubagents:
|
|
12227
|
-
getSubagent:
|
|
12228
|
-
relativePathFromCwd:
|
|
12310
|
+
listSubagents: import_mini46.z.object({}),
|
|
12311
|
+
getSubagent: import_mini46.z.object({
|
|
12312
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12229
12313
|
}),
|
|
12230
|
-
putSubagent:
|
|
12231
|
-
relativePathFromCwd:
|
|
12314
|
+
putSubagent: import_mini46.z.object({
|
|
12315
|
+
relativePathFromCwd: import_mini46.z.string(),
|
|
12232
12316
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
12233
|
-
body:
|
|
12317
|
+
body: import_mini46.z.string()
|
|
12234
12318
|
}),
|
|
12235
|
-
deleteSubagent:
|
|
12236
|
-
relativePathFromCwd:
|
|
12319
|
+
deleteSubagent: import_mini46.z.object({
|
|
12320
|
+
relativePathFromCwd: import_mini46.z.string()
|
|
12237
12321
|
})
|
|
12238
12322
|
};
|
|
12239
12323
|
var subagentTools = {
|
|
12240
12324
|
listSubagents: {
|
|
12241
12325
|
name: "listSubagents",
|
|
12242
|
-
description: `List all subagents from ${(0,
|
|
12326
|
+
description: `List all subagents from ${(0, import_node_path93.join)(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
12243
12327
|
parameters: subagentToolSchemas.listSubagents,
|
|
12244
12328
|
execute: async () => {
|
|
12245
12329
|
const subagents = await listSubagents();
|
|
@@ -12281,20 +12365,20 @@ var subagentTools = {
|
|
|
12281
12365
|
};
|
|
12282
12366
|
|
|
12283
12367
|
// src/mcp/tools.ts
|
|
12284
|
-
var rulesyncFeatureSchema =
|
|
12285
|
-
var rulesyncOperationSchema =
|
|
12286
|
-
var skillFileSchema =
|
|
12287
|
-
name:
|
|
12288
|
-
body:
|
|
12368
|
+
var rulesyncFeatureSchema = import_mini47.z.enum(["rule", "command", "subagent", "skill", "ignore", "mcp"]);
|
|
12369
|
+
var rulesyncOperationSchema = import_mini47.z.enum(["list", "get", "put", "delete"]);
|
|
12370
|
+
var skillFileSchema = import_mini47.z.object({
|
|
12371
|
+
name: import_mini47.z.string(),
|
|
12372
|
+
body: import_mini47.z.string()
|
|
12289
12373
|
});
|
|
12290
|
-
var rulesyncToolSchema =
|
|
12374
|
+
var rulesyncToolSchema = import_mini47.z.object({
|
|
12291
12375
|
feature: rulesyncFeatureSchema,
|
|
12292
12376
|
operation: rulesyncOperationSchema,
|
|
12293
|
-
targetPathFromCwd:
|
|
12294
|
-
frontmatter:
|
|
12295
|
-
body:
|
|
12296
|
-
otherFiles:
|
|
12297
|
-
content:
|
|
12377
|
+
targetPathFromCwd: import_mini47.z.optional(import_mini47.z.string()),
|
|
12378
|
+
frontmatter: import_mini47.z.optional(import_mini47.z.unknown()),
|
|
12379
|
+
body: import_mini47.z.optional(import_mini47.z.string()),
|
|
12380
|
+
otherFiles: import_mini47.z.optional(import_mini47.z.array(skillFileSchema)),
|
|
12381
|
+
content: import_mini47.z.optional(import_mini47.z.string())
|
|
12298
12382
|
});
|
|
12299
12383
|
var supportedOperationsByFeature = {
|
|
12300
12384
|
rule: ["list", "get", "put", "delete"],
|
|
@@ -12490,7 +12574,7 @@ async function mcpCommand({ version }) {
|
|
|
12490
12574
|
}
|
|
12491
12575
|
|
|
12492
12576
|
// src/cli/index.ts
|
|
12493
|
-
var getVersion = () => "
|
|
12577
|
+
var getVersion = () => "5.0.0";
|
|
12494
12578
|
var main = async () => {
|
|
12495
12579
|
const program = new import_commander.Command();
|
|
12496
12580
|
const version = getVersion();
|