rulesync 1.0.1 → 1.2.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 -2
- package/dist/index.cjs +342 -228
- package/dist/index.js +326 -212
- package/package.json +12 -12
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli/index.ts
|
|
4
|
-
import { join as
|
|
4
|
+
import { join as join57 } from "path";
|
|
5
5
|
import { fileURLToPath } from "url";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
|
|
@@ -795,20 +795,51 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
|
795
795
|
|
|
796
796
|
// src/commands/cursor-command.ts
|
|
797
797
|
import { basename as basename7, join as join7 } from "path";
|
|
798
|
-
var CursorCommand = class _CursorCommand extends
|
|
798
|
+
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
799
799
|
static getSettablePaths() {
|
|
800
800
|
return {
|
|
801
801
|
relativeDirPath: ".cursor/commands"
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
|
+
toRulesyncCommand() {
|
|
805
|
+
const rulesyncFrontmatter = {
|
|
806
|
+
targets: ["*"],
|
|
807
|
+
description: ""
|
|
808
|
+
};
|
|
809
|
+
return new RulesyncCommand({
|
|
810
|
+
baseDir: this.baseDir,
|
|
811
|
+
frontmatter: rulesyncFrontmatter,
|
|
812
|
+
body: this.getFileContent(),
|
|
813
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
814
|
+
relativeFilePath: this.relativeFilePath,
|
|
815
|
+
fileContent: this.getFileContent(),
|
|
816
|
+
validate: true
|
|
817
|
+
});
|
|
818
|
+
}
|
|
804
819
|
static fromRulesyncCommand({
|
|
805
820
|
baseDir = ".",
|
|
806
821
|
rulesyncCommand,
|
|
807
822
|
validate = true
|
|
808
823
|
}) {
|
|
809
|
-
return new _CursorCommand(
|
|
810
|
-
|
|
811
|
-
|
|
824
|
+
return new _CursorCommand({
|
|
825
|
+
baseDir,
|
|
826
|
+
fileContent: rulesyncCommand.getBody(),
|
|
827
|
+
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
828
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
829
|
+
validate
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
validate() {
|
|
833
|
+
return { success: true, error: null };
|
|
834
|
+
}
|
|
835
|
+
getBody() {
|
|
836
|
+
return this.getFileContent();
|
|
837
|
+
}
|
|
838
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
839
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
840
|
+
rulesyncCommand,
|
|
841
|
+
toolTarget: "cursor"
|
|
842
|
+
});
|
|
812
843
|
}
|
|
813
844
|
static async fromFile({
|
|
814
845
|
baseDir = ".",
|
|
@@ -821,26 +852,15 @@ var CursorCommand = class _CursorCommand extends SimulatedCommand {
|
|
|
821
852
|
relativeFilePath
|
|
822
853
|
);
|
|
823
854
|
const fileContent = await readFileContent(filePath);
|
|
824
|
-
const {
|
|
825
|
-
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
826
|
-
if (!result.success) {
|
|
827
|
-
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
828
|
-
}
|
|
855
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
829
856
|
return new _CursorCommand({
|
|
830
857
|
baseDir,
|
|
831
858
|
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
832
859
|
relativeFilePath: basename7(relativeFilePath),
|
|
833
|
-
|
|
834
|
-
body: content.trim(),
|
|
860
|
+
fileContent: content.trim(),
|
|
835
861
|
validate
|
|
836
862
|
});
|
|
837
863
|
}
|
|
838
|
-
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
839
|
-
return this.isTargetedByRulesyncCommandDefault({
|
|
840
|
-
rulesyncCommand,
|
|
841
|
-
toolTarget: "cursor"
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
864
|
};
|
|
845
865
|
|
|
846
866
|
// src/commands/geminicli-command.ts
|
|
@@ -874,7 +894,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
874
894
|
prompt: validated.prompt
|
|
875
895
|
};
|
|
876
896
|
} catch (error) {
|
|
877
|
-
throw new Error(`Failed to parse TOML command file: ${error}
|
|
897
|
+
throw new Error(`Failed to parse TOML command file: ${error}`, { cause: error });
|
|
878
898
|
}
|
|
879
899
|
}
|
|
880
900
|
getBody() {
|
|
@@ -1082,7 +1102,7 @@ var commandsProcessorToolTargets = [
|
|
|
1082
1102
|
"codexcli"
|
|
1083
1103
|
];
|
|
1084
1104
|
var CommandsProcessorToolTargetSchema = z8.enum(commandsProcessorToolTargets);
|
|
1085
|
-
var commandsProcessorToolTargetsSimulated = ["copilot", "
|
|
1105
|
+
var commandsProcessorToolTargetsSimulated = ["copilot", "codexcli"];
|
|
1086
1106
|
var CommandsProcessor = class extends FeatureProcessor {
|
|
1087
1107
|
toolTarget;
|
|
1088
1108
|
constructor({
|
|
@@ -1427,15 +1447,9 @@ var ConfigResolver = class {
|
|
|
1427
1447
|
}
|
|
1428
1448
|
};
|
|
1429
1449
|
|
|
1430
|
-
// src/ignore/ignore
|
|
1431
|
-
import { z as z9 } from "zod/mini";
|
|
1432
|
-
|
|
1433
|
-
// src/ignore/amazonqcli-ignore.ts
|
|
1450
|
+
// src/ignore/claudecode-ignore.ts
|
|
1434
1451
|
import { join as join11 } from "path";
|
|
1435
|
-
|
|
1436
|
-
// src/types/tool-file.ts
|
|
1437
|
-
var ToolFile = class extends AiFile {
|
|
1438
|
-
};
|
|
1452
|
+
import { uniq } from "es-toolkit";
|
|
1439
1453
|
|
|
1440
1454
|
// src/ignore/rulesync-ignore.ts
|
|
1441
1455
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
@@ -1459,17 +1473,20 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1459
1473
|
}
|
|
1460
1474
|
};
|
|
1461
1475
|
|
|
1476
|
+
// src/types/tool-file.ts
|
|
1477
|
+
var ToolFile = class extends AiFile {
|
|
1478
|
+
};
|
|
1479
|
+
|
|
1462
1480
|
// src/ignore/tool-ignore.ts
|
|
1463
1481
|
var ToolIgnore = class extends ToolFile {
|
|
1464
1482
|
patterns;
|
|
1465
|
-
constructor(
|
|
1483
|
+
constructor(params) {
|
|
1466
1484
|
super({
|
|
1467
|
-
...
|
|
1485
|
+
...params,
|
|
1468
1486
|
validate: true
|
|
1469
|
-
// Skip validation during construction
|
|
1470
1487
|
});
|
|
1471
1488
|
this.patterns = this.fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
1472
|
-
if (
|
|
1489
|
+
if (params.validate) {
|
|
1473
1490
|
const result = this.validate();
|
|
1474
1491
|
if (!result.success) {
|
|
1475
1492
|
throw result.error;
|
|
@@ -1501,7 +1518,90 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1501
1518
|
}
|
|
1502
1519
|
};
|
|
1503
1520
|
|
|
1521
|
+
// src/ignore/claudecode-ignore.ts
|
|
1522
|
+
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
1523
|
+
constructor(params) {
|
|
1524
|
+
super(params);
|
|
1525
|
+
const jsonValue = JSON.parse(this.fileContent);
|
|
1526
|
+
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
1527
|
+
}
|
|
1528
|
+
static getSettablePaths() {
|
|
1529
|
+
return {
|
|
1530
|
+
relativeDirPath: ".claude",
|
|
1531
|
+
relativeFilePath: "settings.local.json"
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
toRulesyncIgnore() {
|
|
1535
|
+
const rulesyncPatterns = this.patterns.map((pattern) => {
|
|
1536
|
+
if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
|
|
1537
|
+
return pattern.slice(5, -1);
|
|
1538
|
+
}
|
|
1539
|
+
return pattern;
|
|
1540
|
+
}).filter((pattern) => pattern.length > 0);
|
|
1541
|
+
const fileContent = rulesyncPatterns.join("\n");
|
|
1542
|
+
return new RulesyncIgnore({
|
|
1543
|
+
baseDir: this.baseDir,
|
|
1544
|
+
relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
|
|
1545
|
+
relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
|
|
1546
|
+
fileContent
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1549
|
+
static async fromRulesyncIgnore({
|
|
1550
|
+
baseDir = ".",
|
|
1551
|
+
rulesyncIgnore
|
|
1552
|
+
}) {
|
|
1553
|
+
const fileContent = rulesyncIgnore.getFileContent();
|
|
1554
|
+
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
1555
|
+
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
1556
|
+
const filePath = join11(
|
|
1557
|
+
baseDir,
|
|
1558
|
+
this.getSettablePaths().relativeDirPath,
|
|
1559
|
+
this.getSettablePaths().relativeFilePath
|
|
1560
|
+
);
|
|
1561
|
+
const exists = await fileExists(filePath);
|
|
1562
|
+
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
1563
|
+
const existingJsonValue = JSON.parse(existingFileContent);
|
|
1564
|
+
const jsonValue = {
|
|
1565
|
+
...existingJsonValue,
|
|
1566
|
+
permissions: {
|
|
1567
|
+
...existingJsonValue.permissions,
|
|
1568
|
+
deny: uniq([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
return new _ClaudecodeIgnore({
|
|
1572
|
+
baseDir,
|
|
1573
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1574
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1575
|
+
fileContent: JSON.stringify(jsonValue, null, 2),
|
|
1576
|
+
validate: true
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
static async fromFile({
|
|
1580
|
+
baseDir = ".",
|
|
1581
|
+
validate = true
|
|
1582
|
+
}) {
|
|
1583
|
+
const fileContent = await readFileContent(
|
|
1584
|
+
join11(
|
|
1585
|
+
baseDir,
|
|
1586
|
+
this.getSettablePaths().relativeDirPath,
|
|
1587
|
+
this.getSettablePaths().relativeFilePath
|
|
1588
|
+
)
|
|
1589
|
+
);
|
|
1590
|
+
return new _ClaudecodeIgnore({
|
|
1591
|
+
baseDir,
|
|
1592
|
+
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1593
|
+
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1594
|
+
fileContent,
|
|
1595
|
+
validate
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
// src/ignore/ignore-processor.ts
|
|
1601
|
+
import { z as z9 } from "zod/mini";
|
|
1602
|
+
|
|
1504
1603
|
// src/ignore/amazonqcli-ignore.ts
|
|
1604
|
+
import { join as join12 } from "path";
|
|
1505
1605
|
var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
1506
1606
|
static getSettablePaths() {
|
|
1507
1607
|
return {
|
|
@@ -1540,7 +1640,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1540
1640
|
validate = true
|
|
1541
1641
|
}) {
|
|
1542
1642
|
const fileContent = await readFileContent(
|
|
1543
|
-
|
|
1643
|
+
join12(
|
|
1544
1644
|
baseDir,
|
|
1545
1645
|
this.getSettablePaths().relativeDirPath,
|
|
1546
1646
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1557,7 +1657,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1557
1657
|
};
|
|
1558
1658
|
|
|
1559
1659
|
// src/ignore/augmentcode-ignore.ts
|
|
1560
|
-
import { join as
|
|
1660
|
+
import { join as join13 } from "path";
|
|
1561
1661
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1562
1662
|
static getSettablePaths() {
|
|
1563
1663
|
return {
|
|
@@ -1595,7 +1695,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1595
1695
|
validate = true
|
|
1596
1696
|
}) {
|
|
1597
1697
|
const fileContent = await readFileContent(
|
|
1598
|
-
|
|
1698
|
+
join13(
|
|
1599
1699
|
baseDir,
|
|
1600
1700
|
this.getSettablePaths().relativeDirPath,
|
|
1601
1701
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1612,7 +1712,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1612
1712
|
};
|
|
1613
1713
|
|
|
1614
1714
|
// src/ignore/cline-ignore.ts
|
|
1615
|
-
import { join as
|
|
1715
|
+
import { join as join14 } from "path";
|
|
1616
1716
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
1617
1717
|
static getSettablePaths() {
|
|
1618
1718
|
return {
|
|
@@ -1649,7 +1749,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1649
1749
|
validate = true
|
|
1650
1750
|
}) {
|
|
1651
1751
|
const fileContent = await readFileContent(
|
|
1652
|
-
|
|
1752
|
+
join14(
|
|
1653
1753
|
baseDir,
|
|
1654
1754
|
this.getSettablePaths().relativeDirPath,
|
|
1655
1755
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1666,7 +1766,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
1666
1766
|
};
|
|
1667
1767
|
|
|
1668
1768
|
// src/ignore/codexcli-ignore.ts
|
|
1669
|
-
import { join as
|
|
1769
|
+
import { join as join15 } from "path";
|
|
1670
1770
|
var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
1671
1771
|
static getSettablePaths() {
|
|
1672
1772
|
return {
|
|
@@ -1696,7 +1796,7 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1696
1796
|
validate = true
|
|
1697
1797
|
}) {
|
|
1698
1798
|
const fileContent = await readFileContent(
|
|
1699
|
-
|
|
1799
|
+
join15(
|
|
1700
1800
|
baseDir,
|
|
1701
1801
|
this.getSettablePaths().relativeDirPath,
|
|
1702
1802
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1713,7 +1813,7 @@ var CodexcliIgnore = class _CodexcliIgnore extends ToolIgnore {
|
|
|
1713
1813
|
};
|
|
1714
1814
|
|
|
1715
1815
|
// src/ignore/cursor-ignore.ts
|
|
1716
|
-
import { join as
|
|
1816
|
+
import { join as join16 } from "path";
|
|
1717
1817
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
1718
1818
|
static getSettablePaths() {
|
|
1719
1819
|
return {
|
|
@@ -1746,7 +1846,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1746
1846
|
validate = true
|
|
1747
1847
|
}) {
|
|
1748
1848
|
const fileContent = await readFileContent(
|
|
1749
|
-
|
|
1849
|
+
join16(
|
|
1750
1850
|
baseDir,
|
|
1751
1851
|
this.getSettablePaths().relativeDirPath,
|
|
1752
1852
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1763,12 +1863,12 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
1763
1863
|
};
|
|
1764
1864
|
|
|
1765
1865
|
// src/ignore/geminicli-ignore.ts
|
|
1766
|
-
import { join as
|
|
1866
|
+
import { join as join17 } from "path";
|
|
1767
1867
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
1768
1868
|
static getSettablePaths() {
|
|
1769
1869
|
return {
|
|
1770
1870
|
relativeDirPath: ".",
|
|
1771
|
-
relativeFilePath: ".
|
|
1871
|
+
relativeFilePath: ".geminiignore"
|
|
1772
1872
|
};
|
|
1773
1873
|
}
|
|
1774
1874
|
toRulesyncIgnore() {
|
|
@@ -1790,7 +1890,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1790
1890
|
validate = true
|
|
1791
1891
|
}) {
|
|
1792
1892
|
const fileContent = await readFileContent(
|
|
1793
|
-
|
|
1893
|
+
join17(
|
|
1794
1894
|
baseDir,
|
|
1795
1895
|
this.getSettablePaths().relativeDirPath,
|
|
1796
1896
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1807,7 +1907,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1807
1907
|
};
|
|
1808
1908
|
|
|
1809
1909
|
// src/ignore/junie-ignore.ts
|
|
1810
|
-
import { join as
|
|
1910
|
+
import { join as join18 } from "path";
|
|
1811
1911
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
1812
1912
|
static getSettablePaths() {
|
|
1813
1913
|
return {
|
|
@@ -1834,7 +1934,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1834
1934
|
validate = true
|
|
1835
1935
|
}) {
|
|
1836
1936
|
const fileContent = await readFileContent(
|
|
1837
|
-
|
|
1937
|
+
join18(
|
|
1838
1938
|
baseDir,
|
|
1839
1939
|
this.getSettablePaths().relativeDirPath,
|
|
1840
1940
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1851,7 +1951,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
1851
1951
|
};
|
|
1852
1952
|
|
|
1853
1953
|
// src/ignore/kiro-ignore.ts
|
|
1854
|
-
import { join as
|
|
1954
|
+
import { join as join19 } from "path";
|
|
1855
1955
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
1856
1956
|
static getSettablePaths() {
|
|
1857
1957
|
return {
|
|
@@ -1878,7 +1978,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1878
1978
|
validate = true
|
|
1879
1979
|
}) {
|
|
1880
1980
|
const fileContent = await readFileContent(
|
|
1881
|
-
|
|
1981
|
+
join19(
|
|
1882
1982
|
baseDir,
|
|
1883
1983
|
this.getSettablePaths().relativeDirPath,
|
|
1884
1984
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1895,7 +1995,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
1895
1995
|
};
|
|
1896
1996
|
|
|
1897
1997
|
// src/ignore/qwencode-ignore.ts
|
|
1898
|
-
import { join as
|
|
1998
|
+
import { join as join20 } from "path";
|
|
1899
1999
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
1900
2000
|
static getSettablePaths() {
|
|
1901
2001
|
return {
|
|
@@ -1922,7 +2022,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1922
2022
|
validate = true
|
|
1923
2023
|
}) {
|
|
1924
2024
|
const fileContent = await readFileContent(
|
|
1925
|
-
|
|
2025
|
+
join20(
|
|
1926
2026
|
baseDir,
|
|
1927
2027
|
this.getSettablePaths().relativeDirPath,
|
|
1928
2028
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1939,7 +2039,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
1939
2039
|
};
|
|
1940
2040
|
|
|
1941
2041
|
// src/ignore/roo-ignore.ts
|
|
1942
|
-
import { join as
|
|
2042
|
+
import { join as join21 } from "path";
|
|
1943
2043
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
1944
2044
|
static getSettablePaths() {
|
|
1945
2045
|
return {
|
|
@@ -1966,7 +2066,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1966
2066
|
validate = true
|
|
1967
2067
|
}) {
|
|
1968
2068
|
const fileContent = await readFileContent(
|
|
1969
|
-
|
|
2069
|
+
join21(
|
|
1970
2070
|
baseDir,
|
|
1971
2071
|
this.getSettablePaths().relativeDirPath,
|
|
1972
2072
|
this.getSettablePaths().relativeFilePath
|
|
@@ -1983,7 +2083,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
1983
2083
|
};
|
|
1984
2084
|
|
|
1985
2085
|
// src/ignore/windsurf-ignore.ts
|
|
1986
|
-
import { join as
|
|
2086
|
+
import { join as join22 } from "path";
|
|
1987
2087
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
1988
2088
|
static getSettablePaths() {
|
|
1989
2089
|
return {
|
|
@@ -2010,7 +2110,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2010
2110
|
validate = true
|
|
2011
2111
|
}) {
|
|
2012
2112
|
const fileContent = await readFileContent(
|
|
2013
|
-
|
|
2113
|
+
join22(
|
|
2014
2114
|
baseDir,
|
|
2015
2115
|
this.getSettablePaths().relativeDirPath,
|
|
2016
2116
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2030,6 +2130,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2030
2130
|
var ignoreProcessorToolTargets = [
|
|
2031
2131
|
"amazonqcli",
|
|
2032
2132
|
"augmentcode",
|
|
2133
|
+
"claudecode",
|
|
2033
2134
|
"cline",
|
|
2034
2135
|
"codexcli",
|
|
2035
2136
|
"cursor",
|
|
@@ -2085,6 +2186,8 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2085
2186
|
return [await AmazonqcliIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2086
2187
|
case "augmentcode":
|
|
2087
2188
|
return [await AugmentcodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2189
|
+
case "claudecode":
|
|
2190
|
+
return [await ClaudecodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2088
2191
|
case "cline":
|
|
2089
2192
|
return [await ClineIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2090
2193
|
case "codexcli":
|
|
@@ -2118,67 +2221,74 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2118
2221
|
if (!rulesyncIgnore) {
|
|
2119
2222
|
throw new Error(`No .rulesyncignore found.`);
|
|
2120
2223
|
}
|
|
2121
|
-
const toolIgnores =
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2224
|
+
const toolIgnores = await Promise.all(
|
|
2225
|
+
[rulesyncIgnore].map(async (rulesyncIgnore2) => {
|
|
2226
|
+
switch (this.toolTarget) {
|
|
2227
|
+
case "amazonqcli":
|
|
2228
|
+
return AmazonqcliIgnore.fromRulesyncIgnore({
|
|
2229
|
+
baseDir: this.baseDir,
|
|
2230
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2231
|
+
});
|
|
2232
|
+
case "augmentcode":
|
|
2233
|
+
return AugmentcodeIgnore.fromRulesyncIgnore({
|
|
2234
|
+
baseDir: this.baseDir,
|
|
2235
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2236
|
+
});
|
|
2237
|
+
case "claudecode":
|
|
2238
|
+
return await ClaudecodeIgnore.fromRulesyncIgnore({
|
|
2239
|
+
baseDir: this.baseDir,
|
|
2240
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2241
|
+
});
|
|
2242
|
+
case "cline":
|
|
2243
|
+
return ClineIgnore.fromRulesyncIgnore({
|
|
2244
|
+
baseDir: this.baseDir,
|
|
2245
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2246
|
+
});
|
|
2247
|
+
case "codexcli":
|
|
2248
|
+
return CodexcliIgnore.fromRulesyncIgnore({
|
|
2249
|
+
baseDir: this.baseDir,
|
|
2250
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2251
|
+
});
|
|
2252
|
+
case "cursor":
|
|
2253
|
+
return CursorIgnore.fromRulesyncIgnore({
|
|
2254
|
+
baseDir: this.baseDir,
|
|
2255
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2256
|
+
});
|
|
2257
|
+
case "geminicli":
|
|
2258
|
+
return GeminiCliIgnore.fromRulesyncIgnore({
|
|
2259
|
+
baseDir: this.baseDir,
|
|
2260
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2261
|
+
});
|
|
2262
|
+
case "junie":
|
|
2263
|
+
return JunieIgnore.fromRulesyncIgnore({
|
|
2264
|
+
baseDir: this.baseDir,
|
|
2265
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2266
|
+
});
|
|
2267
|
+
case "kiro":
|
|
2268
|
+
return KiroIgnore.fromRulesyncIgnore({
|
|
2269
|
+
baseDir: this.baseDir,
|
|
2270
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2271
|
+
});
|
|
2272
|
+
case "qwencode":
|
|
2273
|
+
return QwencodeIgnore.fromRulesyncIgnore({
|
|
2274
|
+
baseDir: this.baseDir,
|
|
2275
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2276
|
+
});
|
|
2277
|
+
case "roo":
|
|
2278
|
+
return RooIgnore.fromRulesyncIgnore({
|
|
2279
|
+
baseDir: this.baseDir,
|
|
2280
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2281
|
+
});
|
|
2282
|
+
case "windsurf":
|
|
2283
|
+
return WindsurfIgnore.fromRulesyncIgnore({
|
|
2284
|
+
baseDir: this.baseDir,
|
|
2285
|
+
rulesyncIgnore: rulesyncIgnore2
|
|
2286
|
+
});
|
|
2287
|
+
default:
|
|
2288
|
+
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
2289
|
+
}
|
|
2290
|
+
})
|
|
2291
|
+
);
|
|
2182
2292
|
return toolIgnores;
|
|
2183
2293
|
}
|
|
2184
2294
|
/**
|
|
@@ -2205,10 +2315,10 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2205
2315
|
import { z as z11 } from "zod/mini";
|
|
2206
2316
|
|
|
2207
2317
|
// src/mcp/amazonqcli-mcp.ts
|
|
2208
|
-
import { join as
|
|
2318
|
+
import { join as join24 } from "path";
|
|
2209
2319
|
|
|
2210
2320
|
// src/mcp/rulesync-mcp.ts
|
|
2211
|
-
import { join as
|
|
2321
|
+
import { join as join23 } from "path";
|
|
2212
2322
|
import { z as z10 } from "zod/mini";
|
|
2213
2323
|
var McpTransportTypeSchema = z10.enum(["stdio", "sse", "http"]);
|
|
2214
2324
|
var McpServerBaseSchema = z10.object({
|
|
@@ -2259,7 +2369,7 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
2259
2369
|
}
|
|
2260
2370
|
static async fromFile({ validate = true }) {
|
|
2261
2371
|
const fileContent = await readFileContent(
|
|
2262
|
-
|
|
2372
|
+
join23(this.getSettablePaths().relativeDirPath, this.getSettablePaths().relativeFilePath)
|
|
2263
2373
|
);
|
|
2264
2374
|
return new _RulesyncMcp({
|
|
2265
2375
|
baseDir: ".",
|
|
@@ -2326,7 +2436,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2326
2436
|
validate = true
|
|
2327
2437
|
}) {
|
|
2328
2438
|
const fileContent = await readFileContent(
|
|
2329
|
-
|
|
2439
|
+
join24(
|
|
2330
2440
|
baseDir,
|
|
2331
2441
|
this.getSettablePaths().relativeDirPath,
|
|
2332
2442
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2362,7 +2472,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
2362
2472
|
};
|
|
2363
2473
|
|
|
2364
2474
|
// src/mcp/claudecode-mcp.ts
|
|
2365
|
-
import { join as
|
|
2475
|
+
import { join as join25 } from "path";
|
|
2366
2476
|
var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
2367
2477
|
static getSettablePaths() {
|
|
2368
2478
|
return {
|
|
@@ -2375,7 +2485,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2375
2485
|
validate = true
|
|
2376
2486
|
}) {
|
|
2377
2487
|
const fileContent = await readFileContent(
|
|
2378
|
-
|
|
2488
|
+
join25(
|
|
2379
2489
|
baseDir,
|
|
2380
2490
|
this.getSettablePaths().relativeDirPath,
|
|
2381
2491
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2411,7 +2521,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
2411
2521
|
};
|
|
2412
2522
|
|
|
2413
2523
|
// src/mcp/cline-mcp.ts
|
|
2414
|
-
import { join as
|
|
2524
|
+
import { join as join26 } from "path";
|
|
2415
2525
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
2416
2526
|
static getSettablePaths() {
|
|
2417
2527
|
return {
|
|
@@ -2424,7 +2534,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2424
2534
|
validate = true
|
|
2425
2535
|
}) {
|
|
2426
2536
|
const fileContent = await readFileContent(
|
|
2427
|
-
|
|
2537
|
+
join26(
|
|
2428
2538
|
baseDir,
|
|
2429
2539
|
this.getSettablePaths().relativeDirPath,
|
|
2430
2540
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2460,7 +2570,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
2460
2570
|
};
|
|
2461
2571
|
|
|
2462
2572
|
// src/mcp/copilot-mcp.ts
|
|
2463
|
-
import { join as
|
|
2573
|
+
import { join as join27 } from "path";
|
|
2464
2574
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
2465
2575
|
static getSettablePaths() {
|
|
2466
2576
|
return {
|
|
@@ -2473,7 +2583,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2473
2583
|
validate = true
|
|
2474
2584
|
}) {
|
|
2475
2585
|
const fileContent = await readFileContent(
|
|
2476
|
-
|
|
2586
|
+
join27(
|
|
2477
2587
|
baseDir,
|
|
2478
2588
|
this.getSettablePaths().relativeDirPath,
|
|
2479
2589
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2509,7 +2619,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
2509
2619
|
};
|
|
2510
2620
|
|
|
2511
2621
|
// src/mcp/cursor-mcp.ts
|
|
2512
|
-
import { join as
|
|
2622
|
+
import { join as join28 } from "path";
|
|
2513
2623
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
2514
2624
|
static getSettablePaths() {
|
|
2515
2625
|
return {
|
|
@@ -2522,7 +2632,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2522
2632
|
validate = true
|
|
2523
2633
|
}) {
|
|
2524
2634
|
const fileContent = await readFileContent(
|
|
2525
|
-
|
|
2635
|
+
join28(
|
|
2526
2636
|
baseDir,
|
|
2527
2637
|
this.getSettablePaths().relativeDirPath,
|
|
2528
2638
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2569,7 +2679,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
2569
2679
|
};
|
|
2570
2680
|
|
|
2571
2681
|
// src/mcp/roo-mcp.ts
|
|
2572
|
-
import { join as
|
|
2682
|
+
import { join as join29 } from "path";
|
|
2573
2683
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
2574
2684
|
static getSettablePaths() {
|
|
2575
2685
|
return {
|
|
@@ -2582,7 +2692,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
2582
2692
|
validate = true
|
|
2583
2693
|
}) {
|
|
2584
2694
|
const fileContent = await readFileContent(
|
|
2585
|
-
|
|
2695
|
+
join29(
|
|
2586
2696
|
baseDir,
|
|
2587
2697
|
this.getSettablePaths().relativeDirPath,
|
|
2588
2698
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2786,20 +2896,20 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2786
2896
|
};
|
|
2787
2897
|
|
|
2788
2898
|
// src/rules/rules-processor.ts
|
|
2789
|
-
import { basename as basename16, join as
|
|
2899
|
+
import { basename as basename16, join as join54 } from "path";
|
|
2790
2900
|
import { XMLBuilder } from "fast-xml-parser";
|
|
2791
2901
|
import { z as z20 } from "zod/mini";
|
|
2792
2902
|
|
|
2793
2903
|
// src/constants/paths.ts
|
|
2794
|
-
import { join as
|
|
2904
|
+
import { join as join30 } from "path";
|
|
2795
2905
|
var RULESYNC_DIR = ".rulesync";
|
|
2796
|
-
var RULESYNC_RULES_DIR =
|
|
2906
|
+
var RULESYNC_RULES_DIR = join30(".rulesync", "rules");
|
|
2797
2907
|
var RULESYNC_RULES_DIR_LEGACY = ".rulesync";
|
|
2798
|
-
var RULESYNC_MCP_FILE =
|
|
2799
|
-
var RULESYNC_SUBAGENTS_DIR =
|
|
2908
|
+
var RULESYNC_MCP_FILE = join30(".rulesync", ".mcp.json");
|
|
2909
|
+
var RULESYNC_SUBAGENTS_DIR = join30(".rulesync", "subagents");
|
|
2800
2910
|
|
|
2801
2911
|
// src/subagents/simulated-subagent.ts
|
|
2802
|
-
import { basename as basename11, join as
|
|
2912
|
+
import { basename as basename11, join as join31 } from "path";
|
|
2803
2913
|
import { z as z12 } from "zod/mini";
|
|
2804
2914
|
|
|
2805
2915
|
// src/subagents/tool-subagent.ts
|
|
@@ -2901,7 +3011,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
2901
3011
|
relativeFilePath,
|
|
2902
3012
|
validate = true
|
|
2903
3013
|
}) {
|
|
2904
|
-
const filePath =
|
|
3014
|
+
const filePath = join31(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
2905
3015
|
const fileContent = await readFileContent(filePath);
|
|
2906
3016
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
2907
3017
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3035,15 +3145,15 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
3035
3145
|
};
|
|
3036
3146
|
|
|
3037
3147
|
// src/subagents/subagents-processor.ts
|
|
3038
|
-
import { basename as basename13, join as
|
|
3148
|
+
import { basename as basename13, join as join34 } from "path";
|
|
3039
3149
|
import { z as z15 } from "zod/mini";
|
|
3040
3150
|
|
|
3041
3151
|
// src/subagents/claudecode-subagent.ts
|
|
3042
|
-
import { join as
|
|
3152
|
+
import { join as join33 } from "path";
|
|
3043
3153
|
import { z as z14 } from "zod/mini";
|
|
3044
3154
|
|
|
3045
3155
|
// src/subagents/rulesync-subagent.ts
|
|
3046
|
-
import { basename as basename12, join as
|
|
3156
|
+
import { basename as basename12, join as join32 } from "path";
|
|
3047
3157
|
import { z as z13 } from "zod/mini";
|
|
3048
3158
|
var RulesyncSubagentModelSchema = z13.enum(["opus", "sonnet", "haiku", "inherit"]);
|
|
3049
3159
|
var RulesyncSubagentFrontmatterSchema = z13.object({
|
|
@@ -3097,7 +3207,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
3097
3207
|
static async fromFile({
|
|
3098
3208
|
relativeFilePath
|
|
3099
3209
|
}) {
|
|
3100
|
-
const fileContent = await readFileContent(
|
|
3210
|
+
const fileContent = await readFileContent(join32(RULESYNC_SUBAGENTS_DIR, relativeFilePath));
|
|
3101
3211
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3102
3212
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3103
3213
|
if (!result.success) {
|
|
@@ -3215,7 +3325,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
3215
3325
|
relativeFilePath,
|
|
3216
3326
|
validate = true
|
|
3217
3327
|
}) {
|
|
3218
|
-
const fileContent = await readFileContent(
|
|
3328
|
+
const fileContent = await readFileContent(join33(baseDir, ".claude/agents", relativeFilePath));
|
|
3219
3329
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3220
3330
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
3221
3331
|
if (!result.success) {
|
|
@@ -3346,7 +3456,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3346
3456
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
3347
3457
|
*/
|
|
3348
3458
|
async loadRulesyncFiles() {
|
|
3349
|
-
const subagentsDir =
|
|
3459
|
+
const subagentsDir = join34(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
3350
3460
|
const dirExists = await directoryExists(subagentsDir);
|
|
3351
3461
|
if (!dirExists) {
|
|
3352
3462
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -3361,7 +3471,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3361
3471
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
3362
3472
|
const rulesyncSubagents = [];
|
|
3363
3473
|
for (const mdFile of mdFiles) {
|
|
3364
|
-
const filepath =
|
|
3474
|
+
const filepath = join34(subagentsDir, mdFile);
|
|
3365
3475
|
try {
|
|
3366
3476
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
3367
3477
|
relativeFilePath: mdFile,
|
|
@@ -3461,7 +3571,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3461
3571
|
relativeDirPath,
|
|
3462
3572
|
fromFile
|
|
3463
3573
|
}) {
|
|
3464
|
-
const paths = await findFilesByGlobs(
|
|
3574
|
+
const paths = await findFilesByGlobs(join34(this.baseDir, relativeDirPath, "*.md"));
|
|
3465
3575
|
const subagents = (await Promise.allSettled(paths.map((path2) => fromFile(basename13(path2))))).filter((r) => r.status === "fulfilled").map((r) => r.value);
|
|
3466
3576
|
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
3467
3577
|
return subagents;
|
|
@@ -3486,13 +3596,13 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3486
3596
|
};
|
|
3487
3597
|
|
|
3488
3598
|
// src/rules/agentsmd-rule.ts
|
|
3489
|
-
import { join as
|
|
3599
|
+
import { join as join37 } from "path";
|
|
3490
3600
|
|
|
3491
3601
|
// src/rules/tool-rule.ts
|
|
3492
|
-
import { join as
|
|
3602
|
+
import { join as join36 } from "path";
|
|
3493
3603
|
|
|
3494
3604
|
// src/rules/rulesync-rule.ts
|
|
3495
|
-
import { basename as basename14, join as
|
|
3605
|
+
import { basename as basename14, join as join35 } from "path";
|
|
3496
3606
|
import { z as z16 } from "zod/mini";
|
|
3497
3607
|
var RulesyncRuleFrontmatterSchema = z16.object({
|
|
3498
3608
|
root: z16.optional(z16.optional(z16.boolean())),
|
|
@@ -3558,7 +3668,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3558
3668
|
relativeFilePath,
|
|
3559
3669
|
validate = true
|
|
3560
3670
|
}) {
|
|
3561
|
-
const filePath =
|
|
3671
|
+
const filePath = join35(this.getSettablePaths().legacy.relativeDirPath, relativeFilePath);
|
|
3562
3672
|
const fileContent = await readFileContent(filePath);
|
|
3563
3673
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3564
3674
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3587,7 +3697,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
3587
3697
|
relativeFilePath,
|
|
3588
3698
|
validate = true
|
|
3589
3699
|
}) {
|
|
3590
|
-
const filePath =
|
|
3700
|
+
const filePath = join35(this.getSettablePaths().recommended.relativeDirPath, relativeFilePath);
|
|
3591
3701
|
const fileContent = await readFileContent(filePath);
|
|
3592
3702
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
3593
3703
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -3669,7 +3779,7 @@ var ToolRule = class extends ToolFile {
|
|
|
3669
3779
|
});
|
|
3670
3780
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
3671
3781
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
3672
|
-
params.relativeDirPath =
|
|
3782
|
+
params.relativeDirPath = join36(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
3673
3783
|
params.relativeFilePath = "AGENTS.md";
|
|
3674
3784
|
}
|
|
3675
3785
|
return params;
|
|
@@ -3744,8 +3854,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3744
3854
|
validate = true
|
|
3745
3855
|
}) {
|
|
3746
3856
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
3747
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
3748
|
-
const fileContent = await readFileContent(
|
|
3857
|
+
const relativePath = isRoot ? "AGENTS.md" : join37(".agents/memories", relativeFilePath);
|
|
3858
|
+
const fileContent = await readFileContent(join37(baseDir, relativePath));
|
|
3749
3859
|
return new _AgentsMdRule({
|
|
3750
3860
|
baseDir,
|
|
3751
3861
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -3785,7 +3895,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
3785
3895
|
};
|
|
3786
3896
|
|
|
3787
3897
|
// src/rules/amazonqcli-rule.ts
|
|
3788
|
-
import { join as
|
|
3898
|
+
import { join as join38 } from "path";
|
|
3789
3899
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
3790
3900
|
static getSettablePaths() {
|
|
3791
3901
|
return {
|
|
@@ -3800,7 +3910,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3800
3910
|
validate = true
|
|
3801
3911
|
}) {
|
|
3802
3912
|
const fileContent = await readFileContent(
|
|
3803
|
-
|
|
3913
|
+
join38(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3804
3914
|
);
|
|
3805
3915
|
return new _AmazonQCliRule({
|
|
3806
3916
|
baseDir,
|
|
@@ -3840,7 +3950,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
3840
3950
|
};
|
|
3841
3951
|
|
|
3842
3952
|
// src/rules/augmentcode-legacy-rule.ts
|
|
3843
|
-
import { join as
|
|
3953
|
+
import { join as join39 } from "path";
|
|
3844
3954
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
3845
3955
|
toRulesyncRule() {
|
|
3846
3956
|
const rulesyncFrontmatter = {
|
|
@@ -3900,8 +4010,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3900
4010
|
}) {
|
|
3901
4011
|
const settablePaths = this.getSettablePaths();
|
|
3902
4012
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
3903
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
3904
|
-
const fileContent = await readFileContent(
|
|
4013
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join39(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
4014
|
+
const fileContent = await readFileContent(join39(baseDir, relativePath));
|
|
3905
4015
|
return new _AugmentcodeLegacyRule({
|
|
3906
4016
|
baseDir,
|
|
3907
4017
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -3914,7 +4024,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
3914
4024
|
};
|
|
3915
4025
|
|
|
3916
4026
|
// src/rules/augmentcode-rule.ts
|
|
3917
|
-
import { join as
|
|
4027
|
+
import { join as join40 } from "path";
|
|
3918
4028
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
3919
4029
|
toRulesyncRule() {
|
|
3920
4030
|
return this.toRulesyncRuleDefault();
|
|
@@ -3946,7 +4056,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3946
4056
|
validate = true
|
|
3947
4057
|
}) {
|
|
3948
4058
|
const fileContent = await readFileContent(
|
|
3949
|
-
|
|
4059
|
+
join40(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
3950
4060
|
);
|
|
3951
4061
|
const { body: content } = parseFrontmatter(fileContent);
|
|
3952
4062
|
return new _AugmentcodeRule({
|
|
@@ -3969,7 +4079,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
3969
4079
|
};
|
|
3970
4080
|
|
|
3971
4081
|
// src/rules/claudecode-rule.ts
|
|
3972
|
-
import { join as
|
|
4082
|
+
import { join as join41 } from "path";
|
|
3973
4083
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
3974
4084
|
static getSettablePaths() {
|
|
3975
4085
|
return {
|
|
@@ -3988,8 +4098,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
3988
4098
|
validate = true
|
|
3989
4099
|
}) {
|
|
3990
4100
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
3991
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
3992
|
-
const fileContent = await readFileContent(
|
|
4101
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join41(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4102
|
+
const fileContent = await readFileContent(join41(baseDir, relativePath));
|
|
3993
4103
|
return new _ClaudecodeRule({
|
|
3994
4104
|
baseDir,
|
|
3995
4105
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4029,7 +4139,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
4029
4139
|
};
|
|
4030
4140
|
|
|
4031
4141
|
// src/rules/cline-rule.ts
|
|
4032
|
-
import { join as
|
|
4142
|
+
import { join as join42 } from "path";
|
|
4033
4143
|
import { z as z17 } from "zod/mini";
|
|
4034
4144
|
var ClineRuleFrontmatterSchema = z17.object({
|
|
4035
4145
|
description: z17.string()
|
|
@@ -4074,7 +4184,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4074
4184
|
validate = true
|
|
4075
4185
|
}) {
|
|
4076
4186
|
const fileContent = await readFileContent(
|
|
4077
|
-
|
|
4187
|
+
join42(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4078
4188
|
);
|
|
4079
4189
|
return new _ClineRule({
|
|
4080
4190
|
baseDir,
|
|
@@ -4087,7 +4197,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
4087
4197
|
};
|
|
4088
4198
|
|
|
4089
4199
|
// src/rules/codexcli-rule.ts
|
|
4090
|
-
import { join as
|
|
4200
|
+
import { join as join43 } from "path";
|
|
4091
4201
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
4092
4202
|
static getSettablePaths() {
|
|
4093
4203
|
return {
|
|
@@ -4106,8 +4216,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4106
4216
|
validate = true
|
|
4107
4217
|
}) {
|
|
4108
4218
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4109
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4110
|
-
const fileContent = await readFileContent(
|
|
4219
|
+
const relativePath = isRoot ? "AGENTS.md" : join43(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4220
|
+
const fileContent = await readFileContent(join43(baseDir, relativePath));
|
|
4111
4221
|
return new _CodexcliRule({
|
|
4112
4222
|
baseDir,
|
|
4113
4223
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4147,7 +4257,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
4147
4257
|
};
|
|
4148
4258
|
|
|
4149
4259
|
// src/rules/copilot-rule.ts
|
|
4150
|
-
import { join as
|
|
4260
|
+
import { join as join44 } from "path";
|
|
4151
4261
|
import { z as z18 } from "zod/mini";
|
|
4152
4262
|
var CopilotRuleFrontmatterSchema = z18.object({
|
|
4153
4263
|
description: z18.optional(z18.string()),
|
|
@@ -4239,11 +4349,11 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4239
4349
|
validate = true
|
|
4240
4350
|
}) {
|
|
4241
4351
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
4242
|
-
const relativePath = isRoot ?
|
|
4352
|
+
const relativePath = isRoot ? join44(
|
|
4243
4353
|
this.getSettablePaths().root.relativeDirPath,
|
|
4244
4354
|
this.getSettablePaths().root.relativeFilePath
|
|
4245
|
-
) :
|
|
4246
|
-
const fileContent = await readFileContent(
|
|
4355
|
+
) : join44(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4356
|
+
const fileContent = await readFileContent(join44(baseDir, relativePath));
|
|
4247
4357
|
if (isRoot) {
|
|
4248
4358
|
return new _CopilotRule({
|
|
4249
4359
|
baseDir,
|
|
@@ -4262,7 +4372,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4262
4372
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4263
4373
|
if (!result.success) {
|
|
4264
4374
|
throw new Error(
|
|
4265
|
-
`Invalid frontmatter in ${
|
|
4375
|
+
`Invalid frontmatter in ${join44(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4266
4376
|
);
|
|
4267
4377
|
}
|
|
4268
4378
|
return new _CopilotRule({
|
|
@@ -4301,7 +4411,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
4301
4411
|
};
|
|
4302
4412
|
|
|
4303
4413
|
// src/rules/cursor-rule.ts
|
|
4304
|
-
import { basename as basename15, join as
|
|
4414
|
+
import { basename as basename15, join as join45 } from "path";
|
|
4305
4415
|
import { z as z19 } from "zod/mini";
|
|
4306
4416
|
var CursorRuleFrontmatterSchema = z19.object({
|
|
4307
4417
|
description: z19.optional(z19.string()),
|
|
@@ -4428,13 +4538,13 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4428
4538
|
validate = true
|
|
4429
4539
|
}) {
|
|
4430
4540
|
const fileContent = await readFileContent(
|
|
4431
|
-
|
|
4541
|
+
join45(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4432
4542
|
);
|
|
4433
4543
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
4434
4544
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
4435
4545
|
if (!result.success) {
|
|
4436
4546
|
throw new Error(
|
|
4437
|
-
`Invalid frontmatter in ${
|
|
4547
|
+
`Invalid frontmatter in ${join45(baseDir, relativeFilePath)}: ${result.error.message}`
|
|
4438
4548
|
);
|
|
4439
4549
|
}
|
|
4440
4550
|
return new _CursorRule({
|
|
@@ -4472,7 +4582,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
4472
4582
|
};
|
|
4473
4583
|
|
|
4474
4584
|
// src/rules/geminicli-rule.ts
|
|
4475
|
-
import { join as
|
|
4585
|
+
import { join as join46 } from "path";
|
|
4476
4586
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
4477
4587
|
static getSettablePaths() {
|
|
4478
4588
|
return {
|
|
@@ -4491,8 +4601,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4491
4601
|
validate = true
|
|
4492
4602
|
}) {
|
|
4493
4603
|
const isRoot = relativeFilePath === "GEMINI.md";
|
|
4494
|
-
const relativePath = isRoot ? "GEMINI.md" :
|
|
4495
|
-
const fileContent = await readFileContent(
|
|
4604
|
+
const relativePath = isRoot ? "GEMINI.md" : join46(".gemini/memories", relativeFilePath);
|
|
4605
|
+
const fileContent = await readFileContent(join46(baseDir, relativePath));
|
|
4496
4606
|
return new _GeminiCliRule({
|
|
4497
4607
|
baseDir,
|
|
4498
4608
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4532,7 +4642,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
4532
4642
|
};
|
|
4533
4643
|
|
|
4534
4644
|
// src/rules/junie-rule.ts
|
|
4535
|
-
import { join as
|
|
4645
|
+
import { join as join47 } from "path";
|
|
4536
4646
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
4537
4647
|
static getSettablePaths() {
|
|
4538
4648
|
return {
|
|
@@ -4551,8 +4661,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4551
4661
|
validate = true
|
|
4552
4662
|
}) {
|
|
4553
4663
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
4554
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
4555
|
-
const fileContent = await readFileContent(
|
|
4664
|
+
const relativePath = isRoot ? "guidelines.md" : join47(".junie/memories", relativeFilePath);
|
|
4665
|
+
const fileContent = await readFileContent(join47(baseDir, relativePath));
|
|
4556
4666
|
return new _JunieRule({
|
|
4557
4667
|
baseDir,
|
|
4558
4668
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4592,7 +4702,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
4592
4702
|
};
|
|
4593
4703
|
|
|
4594
4704
|
// src/rules/kiro-rule.ts
|
|
4595
|
-
import { join as
|
|
4705
|
+
import { join as join48 } from "path";
|
|
4596
4706
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
4597
4707
|
static getSettablePaths() {
|
|
4598
4708
|
return {
|
|
@@ -4607,7 +4717,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4607
4717
|
validate = true
|
|
4608
4718
|
}) {
|
|
4609
4719
|
const fileContent = await readFileContent(
|
|
4610
|
-
|
|
4720
|
+
join48(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4611
4721
|
);
|
|
4612
4722
|
return new _KiroRule({
|
|
4613
4723
|
baseDir,
|
|
@@ -4647,7 +4757,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
4647
4757
|
};
|
|
4648
4758
|
|
|
4649
4759
|
// src/rules/opencode-rule.ts
|
|
4650
|
-
import { join as
|
|
4760
|
+
import { join as join49 } from "path";
|
|
4651
4761
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
4652
4762
|
static getSettablePaths() {
|
|
4653
4763
|
return {
|
|
@@ -4666,8 +4776,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4666
4776
|
validate = true
|
|
4667
4777
|
}) {
|
|
4668
4778
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
4669
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
4670
|
-
const fileContent = await readFileContent(
|
|
4779
|
+
const relativePath = isRoot ? "AGENTS.md" : join49(".opencode/memories", relativeFilePath);
|
|
4780
|
+
const fileContent = await readFileContent(join49(baseDir, relativePath));
|
|
4671
4781
|
return new _OpenCodeRule({
|
|
4672
4782
|
baseDir,
|
|
4673
4783
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4707,7 +4817,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
4707
4817
|
};
|
|
4708
4818
|
|
|
4709
4819
|
// src/rules/qwencode-rule.ts
|
|
4710
|
-
import { join as
|
|
4820
|
+
import { join as join50 } from "path";
|
|
4711
4821
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
4712
4822
|
static getSettablePaths() {
|
|
4713
4823
|
return {
|
|
@@ -4726,8 +4836,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4726
4836
|
validate = true
|
|
4727
4837
|
}) {
|
|
4728
4838
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
4729
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
4730
|
-
const fileContent = await readFileContent(
|
|
4839
|
+
const relativePath = isRoot ? "QWEN.md" : join50(".qwen/memories", relativeFilePath);
|
|
4840
|
+
const fileContent = await readFileContent(join50(baseDir, relativePath));
|
|
4731
4841
|
return new _QwencodeRule({
|
|
4732
4842
|
baseDir,
|
|
4733
4843
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -4764,7 +4874,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
4764
4874
|
};
|
|
4765
4875
|
|
|
4766
4876
|
// src/rules/roo-rule.ts
|
|
4767
|
-
import { join as
|
|
4877
|
+
import { join as join51 } from "path";
|
|
4768
4878
|
var RooRule = class _RooRule extends ToolRule {
|
|
4769
4879
|
static getSettablePaths() {
|
|
4770
4880
|
return {
|
|
@@ -4779,7 +4889,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4779
4889
|
validate = true
|
|
4780
4890
|
}) {
|
|
4781
4891
|
const fileContent = await readFileContent(
|
|
4782
|
-
|
|
4892
|
+
join51(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4783
4893
|
);
|
|
4784
4894
|
return new _RooRule({
|
|
4785
4895
|
baseDir,
|
|
@@ -4834,7 +4944,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
4834
4944
|
};
|
|
4835
4945
|
|
|
4836
4946
|
// src/rules/warp-rule.ts
|
|
4837
|
-
import { join as
|
|
4947
|
+
import { join as join52 } from "path";
|
|
4838
4948
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
4839
4949
|
constructor({ fileContent, root, ...rest }) {
|
|
4840
4950
|
super({
|
|
@@ -4860,8 +4970,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4860
4970
|
validate = true
|
|
4861
4971
|
}) {
|
|
4862
4972
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
4863
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
4864
|
-
const fileContent = await readFileContent(
|
|
4973
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join52(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
4974
|
+
const fileContent = await readFileContent(join52(baseDir, relativePath));
|
|
4865
4975
|
return new _WarpRule({
|
|
4866
4976
|
baseDir,
|
|
4867
4977
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -4901,7 +5011,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
4901
5011
|
};
|
|
4902
5012
|
|
|
4903
5013
|
// src/rules/windsurf-rule.ts
|
|
4904
|
-
import { join as
|
|
5014
|
+
import { join as join53 } from "path";
|
|
4905
5015
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
4906
5016
|
static getSettablePaths() {
|
|
4907
5017
|
return {
|
|
@@ -4916,7 +5026,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
4916
5026
|
validate = true
|
|
4917
5027
|
}) {
|
|
4918
5028
|
const fileContent = await readFileContent(
|
|
4919
|
-
|
|
5029
|
+
join53(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
4920
5030
|
);
|
|
4921
5031
|
return new _WindsurfRule({
|
|
4922
5032
|
baseDir,
|
|
@@ -5295,14 +5405,14 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5295
5405
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
5296
5406
|
*/
|
|
5297
5407
|
async loadRulesyncFiles() {
|
|
5298
|
-
const files = await findFilesByGlobs(
|
|
5408
|
+
const files = await findFilesByGlobs(join54(RULESYNC_RULES_DIR, "*.md"));
|
|
5299
5409
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
5300
5410
|
return Promise.all(
|
|
5301
5411
|
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename16(file) }))
|
|
5302
5412
|
);
|
|
5303
5413
|
}
|
|
5304
5414
|
async loadRulesyncFilesLegacy() {
|
|
5305
|
-
const legacyFiles = await findFilesByGlobs(
|
|
5415
|
+
const legacyFiles = await findFilesByGlobs(join54(RULESYNC_RULES_DIR_LEGACY, "*.md"));
|
|
5306
5416
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
5307
5417
|
return Promise.all(
|
|
5308
5418
|
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename16(file) }))
|
|
@@ -5366,7 +5476,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5366
5476
|
return [];
|
|
5367
5477
|
}
|
|
5368
5478
|
const rootFilePaths = await findFilesByGlobs(
|
|
5369
|
-
|
|
5479
|
+
join54(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
5370
5480
|
);
|
|
5371
5481
|
return await Promise.all(
|
|
5372
5482
|
rootFilePaths.map(
|
|
@@ -5383,7 +5493,7 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5383
5493
|
return [];
|
|
5384
5494
|
}
|
|
5385
5495
|
const nonRootFilePaths = await findFilesByGlobs(
|
|
5386
|
-
|
|
5496
|
+
join54(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
5387
5497
|
);
|
|
5388
5498
|
return await Promise.all(
|
|
5389
5499
|
nonRootFilePaths.map(
|
|
@@ -5749,14 +5859,14 @@ s/<command> [arguments]
|
|
|
5749
5859
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
5750
5860
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
5751
5861
|
|
|
5752
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
5862
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join54(commands.relativeDirPath, "{command}.md")}\`, then execute the contents of that file as the block of operations.`;
|
|
5753
5863
|
const subagentsSection = `## Simulated Subagents
|
|
5754
5864
|
|
|
5755
5865
|
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.
|
|
5756
5866
|
|
|
5757
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
5867
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join54(subagents.relativeDirPath, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
5758
5868
|
|
|
5759
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
5869
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join54(subagents.relativeDirPath, "planner.md")}\`, and execute its contents as the block of operations.`;
|
|
5760
5870
|
const result = [
|
|
5761
5871
|
overview,
|
|
5762
5872
|
...this.simulateCommands && CommandsProcessor.getToolTargetsSimulated().includes(this.toolTarget) ? [commandsSection] : [],
|
|
@@ -5880,7 +5990,10 @@ async function generateCommand(options) {
|
|
|
5880
5990
|
});
|
|
5881
5991
|
if (config.getDelete()) {
|
|
5882
5992
|
const oldToolFiles = await processor.loadToolFiles();
|
|
5883
|
-
|
|
5993
|
+
const oldToolFilesForDelete = oldToolFiles.filter(
|
|
5994
|
+
(toolFile) => !(toolFile.getRelativeDirPath() === ClaudecodeIgnore.getSettablePaths().relativeDirPath && toolFile.getRelativeFilePath() === ClaudecodeIgnore.getSettablePaths().relativeFilePath)
|
|
5995
|
+
);
|
|
5996
|
+
await processor.removeAiFiles(oldToolFilesForDelete);
|
|
5884
5997
|
}
|
|
5885
5998
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
5886
5999
|
if (rulesyncFiles.length > 0) {
|
|
@@ -5943,9 +6056,9 @@ async function generateCommand(options) {
|
|
|
5943
6056
|
}
|
|
5944
6057
|
|
|
5945
6058
|
// src/cli/commands/gitignore.ts
|
|
5946
|
-
import { join as
|
|
6059
|
+
import { join as join55 } from "path";
|
|
5947
6060
|
var gitignoreCommand = async () => {
|
|
5948
|
-
const gitignorePath =
|
|
6061
|
+
const gitignorePath = join55(process.cwd(), ".gitignore");
|
|
5949
6062
|
const rulesFilesToIgnore = [
|
|
5950
6063
|
"# Generated by rulesync - AI tool configuration files",
|
|
5951
6064
|
"**/.amazonq/",
|
|
@@ -5959,6 +6072,7 @@ var gitignoreCommand = async () => {
|
|
|
5959
6072
|
"**/.claude/memories/",
|
|
5960
6073
|
"**/.claude/commands/",
|
|
5961
6074
|
"**/.claude/agents/",
|
|
6075
|
+
"**/.claude/settings.local.json",
|
|
5962
6076
|
"**/AGENTS.md",
|
|
5963
6077
|
"**/.agents/",
|
|
5964
6078
|
"**/.roo/rules/",
|
|
@@ -6135,7 +6249,7 @@ async function importCommand(options) {
|
|
|
6135
6249
|
}
|
|
6136
6250
|
|
|
6137
6251
|
// src/cli/commands/init.ts
|
|
6138
|
-
import { join as
|
|
6252
|
+
import { join as join56 } from "path";
|
|
6139
6253
|
async function initCommand() {
|
|
6140
6254
|
logger.info("Initializing rulesync...");
|
|
6141
6255
|
await ensureDir(RULESYNC_DIR);
|
|
@@ -6181,7 +6295,7 @@ globs: ["**/*"]
|
|
|
6181
6295
|
- Follow single responsibility principle
|
|
6182
6296
|
`
|
|
6183
6297
|
};
|
|
6184
|
-
const filepath =
|
|
6298
|
+
const filepath = join56(RULESYNC_RULES_DIR, sampleFile.filename);
|
|
6185
6299
|
await ensureDir(RULESYNC_RULES_DIR);
|
|
6186
6300
|
await ensureDir(RulesyncCommand.getSettablePaths().relativeDirPath);
|
|
6187
6301
|
await ensureDir(RULESYNC_SUBAGENTS_DIR);
|
|
@@ -6199,15 +6313,15 @@ var getVersion = async () => {
|
|
|
6199
6313
|
let packageJsonPath;
|
|
6200
6314
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
6201
6315
|
const __filename = fileURLToPath(import.meta.url);
|
|
6202
|
-
const __dirname =
|
|
6203
|
-
packageJsonPath =
|
|
6316
|
+
const __dirname = join57(__filename, "..");
|
|
6317
|
+
packageJsonPath = join57(__dirname, "../../package.json");
|
|
6204
6318
|
} else {
|
|
6205
|
-
packageJsonPath =
|
|
6319
|
+
packageJsonPath = join57(process.cwd(), "package.json");
|
|
6206
6320
|
}
|
|
6207
6321
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
6208
6322
|
return packageJson.version;
|
|
6209
6323
|
} catch {
|
|
6210
|
-
return "1.0
|
|
6324
|
+
return "1.2.0";
|
|
6211
6325
|
}
|
|
6212
6326
|
};
|
|
6213
6327
|
var main = async () => {
|