rulesync 3.29.0 → 3.30.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/dist/index.cjs +1122 -1824
- package/dist/index.js +1118 -1820
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -490,8 +490,8 @@ var RULESYNC_OVERVIEW_FILE_NAME = "overview.md";
|
|
|
490
490
|
var RULESYNC_SKILLS_RELATIVE_DIR_PATH = join2(RULESYNC_RELATIVE_DIR_PATH, "skills");
|
|
491
491
|
|
|
492
492
|
// src/features/commands/commands-processor.ts
|
|
493
|
-
import { basename as
|
|
494
|
-
import { z as
|
|
493
|
+
import { basename as basename13, join as join14 } from "path";
|
|
494
|
+
import { z as z12 } from "zod/mini";
|
|
495
495
|
|
|
496
496
|
// src/types/feature-processor.ts
|
|
497
497
|
var FeatureProcessor = class {
|
|
@@ -1091,7 +1091,11 @@ var AntigravityCommand = class _AntigravityCommand extends ToolCommand {
|
|
|
1091
1091
|
import { basename as basename6, join as join7 } from "path";
|
|
1092
1092
|
import { z as z7 } from "zod/mini";
|
|
1093
1093
|
var ClaudecodeCommandFrontmatterSchema = z7.looseObject({
|
|
1094
|
-
description: z7.string()
|
|
1094
|
+
description: z7.string(),
|
|
1095
|
+
"allowed-tools": z7.optional(z7.union([z7.string(), z7.array(z7.string())])),
|
|
1096
|
+
"argument-hint": z7.optional(z7.string()),
|
|
1097
|
+
model: z7.optional(z7.string()),
|
|
1098
|
+
"disable-model-invocation": z7.optional(z7.boolean())
|
|
1095
1099
|
});
|
|
1096
1100
|
var ClaudecodeCommand = class _ClaudecodeCommand extends ToolCommand {
|
|
1097
1101
|
frontmatter;
|
|
@@ -1613,19 +1617,145 @@ ${geminiFrontmatter.prompt}
|
|
|
1613
1617
|
}
|
|
1614
1618
|
};
|
|
1615
1619
|
|
|
1616
|
-
// src/features/commands/
|
|
1620
|
+
// src/features/commands/opencode-command.ts
|
|
1617
1621
|
import { basename as basename11, join as join12 } from "path";
|
|
1618
1622
|
import { optional as optional2, z as z10 } from "zod/mini";
|
|
1619
|
-
var
|
|
1623
|
+
var OpenCodeCommandFrontmatterSchema = z10.looseObject({
|
|
1620
1624
|
description: z10.string(),
|
|
1621
|
-
|
|
1625
|
+
agent: optional2(z10.string()),
|
|
1626
|
+
subtask: optional2(z10.boolean()),
|
|
1627
|
+
model: optional2(z10.string())
|
|
1628
|
+
});
|
|
1629
|
+
var OpenCodeCommand = class _OpenCodeCommand extends ToolCommand {
|
|
1630
|
+
frontmatter;
|
|
1631
|
+
body;
|
|
1632
|
+
constructor({ frontmatter, body, ...rest }) {
|
|
1633
|
+
if (rest.validate) {
|
|
1634
|
+
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1635
|
+
if (!result.success) {
|
|
1636
|
+
throw new Error(
|
|
1637
|
+
`Invalid frontmatter in ${join12(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
super({
|
|
1642
|
+
...rest,
|
|
1643
|
+
fileContent: stringifyFrontmatter(body, frontmatter)
|
|
1644
|
+
});
|
|
1645
|
+
this.frontmatter = frontmatter;
|
|
1646
|
+
this.body = body;
|
|
1647
|
+
}
|
|
1648
|
+
static getSettablePaths({ global } = {}) {
|
|
1649
|
+
return {
|
|
1650
|
+
relativeDirPath: global ? join12(".config", "opencode", "command") : join12(".opencode", "command")
|
|
1651
|
+
};
|
|
1652
|
+
}
|
|
1653
|
+
getBody() {
|
|
1654
|
+
return this.body;
|
|
1655
|
+
}
|
|
1656
|
+
getFrontmatter() {
|
|
1657
|
+
return this.frontmatter;
|
|
1658
|
+
}
|
|
1659
|
+
toRulesyncCommand() {
|
|
1660
|
+
const { description, ...restFields } = this.frontmatter;
|
|
1661
|
+
const rulesyncFrontmatter = {
|
|
1662
|
+
targets: ["*"],
|
|
1663
|
+
description,
|
|
1664
|
+
...Object.keys(restFields).length > 0 && { opencode: restFields }
|
|
1665
|
+
};
|
|
1666
|
+
const fileContent = stringifyFrontmatter(this.body, rulesyncFrontmatter);
|
|
1667
|
+
return new RulesyncCommand({
|
|
1668
|
+
baseDir: process.cwd(),
|
|
1669
|
+
frontmatter: rulesyncFrontmatter,
|
|
1670
|
+
body: this.body,
|
|
1671
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
1672
|
+
relativeFilePath: this.relativeFilePath,
|
|
1673
|
+
fileContent,
|
|
1674
|
+
validate: true
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
static fromRulesyncCommand({
|
|
1678
|
+
baseDir = process.cwd(),
|
|
1679
|
+
rulesyncCommand,
|
|
1680
|
+
validate = true,
|
|
1681
|
+
global = false
|
|
1682
|
+
}) {
|
|
1683
|
+
const rulesyncFrontmatter = rulesyncCommand.getFrontmatter();
|
|
1684
|
+
const opencodeFields = rulesyncFrontmatter.opencode ?? {};
|
|
1685
|
+
const opencodeFrontmatter = {
|
|
1686
|
+
description: rulesyncFrontmatter.description,
|
|
1687
|
+
...opencodeFields
|
|
1688
|
+
};
|
|
1689
|
+
const body = rulesyncCommand.getBody();
|
|
1690
|
+
const paths = this.getSettablePaths({ global });
|
|
1691
|
+
return new _OpenCodeCommand({
|
|
1692
|
+
baseDir,
|
|
1693
|
+
frontmatter: opencodeFrontmatter,
|
|
1694
|
+
body,
|
|
1695
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1696
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
1697
|
+
validate
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
validate() {
|
|
1701
|
+
if (!this.frontmatter) {
|
|
1702
|
+
return { success: true, error: null };
|
|
1703
|
+
}
|
|
1704
|
+
const result = OpenCodeCommandFrontmatterSchema.safeParse(this.frontmatter);
|
|
1705
|
+
if (result.success) {
|
|
1706
|
+
return { success: true, error: null };
|
|
1707
|
+
}
|
|
1708
|
+
return {
|
|
1709
|
+
success: false,
|
|
1710
|
+
error: new Error(
|
|
1711
|
+
`Invalid frontmatter in ${join12(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1712
|
+
)
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
static async fromFile({
|
|
1716
|
+
baseDir = process.cwd(),
|
|
1717
|
+
relativeFilePath,
|
|
1718
|
+
validate = true,
|
|
1719
|
+
global = false
|
|
1720
|
+
}) {
|
|
1721
|
+
const paths = this.getSettablePaths({ global });
|
|
1722
|
+
const filePath = join12(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
1723
|
+
const fileContent = await readFileContent(filePath);
|
|
1724
|
+
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1725
|
+
const result = OpenCodeCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1726
|
+
if (!result.success) {
|
|
1727
|
+
throw new Error(`Invalid frontmatter in ${filePath}: ${formatError(result.error)}`);
|
|
1728
|
+
}
|
|
1729
|
+
return new _OpenCodeCommand({
|
|
1730
|
+
baseDir,
|
|
1731
|
+
relativeDirPath: paths.relativeDirPath,
|
|
1732
|
+
relativeFilePath: basename11(relativeFilePath),
|
|
1733
|
+
frontmatter: result.data,
|
|
1734
|
+
body: content.trim(),
|
|
1735
|
+
validate
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
1739
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
1740
|
+
rulesyncCommand,
|
|
1741
|
+
toolTarget: "opencode"
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
|
|
1746
|
+
// src/features/commands/roo-command.ts
|
|
1747
|
+
import { basename as basename12, join as join13 } from "path";
|
|
1748
|
+
import { optional as optional3, z as z11 } from "zod/mini";
|
|
1749
|
+
var RooCommandFrontmatterSchema = z11.looseObject({
|
|
1750
|
+
description: z11.string(),
|
|
1751
|
+
"argument-hint": optional3(z11.string())
|
|
1622
1752
|
});
|
|
1623
1753
|
var RooCommand = class _RooCommand extends ToolCommand {
|
|
1624
1754
|
frontmatter;
|
|
1625
1755
|
body;
|
|
1626
1756
|
static getSettablePaths() {
|
|
1627
1757
|
return {
|
|
1628
|
-
relativeDirPath:
|
|
1758
|
+
relativeDirPath: join13(".roo", "commands")
|
|
1629
1759
|
};
|
|
1630
1760
|
}
|
|
1631
1761
|
constructor({ frontmatter, body, ...rest }) {
|
|
@@ -1633,7 +1763,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1633
1763
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
1634
1764
|
if (!result.success) {
|
|
1635
1765
|
throw new Error(
|
|
1636
|
-
`Invalid frontmatter in ${
|
|
1766
|
+
`Invalid frontmatter in ${join13(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
1637
1767
|
);
|
|
1638
1768
|
}
|
|
1639
1769
|
}
|
|
@@ -1704,7 +1834,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1704
1834
|
return {
|
|
1705
1835
|
success: false,
|
|
1706
1836
|
error: new Error(
|
|
1707
|
-
`Invalid frontmatter in ${
|
|
1837
|
+
`Invalid frontmatter in ${join13(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
1708
1838
|
)
|
|
1709
1839
|
};
|
|
1710
1840
|
}
|
|
@@ -1720,7 +1850,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1720
1850
|
relativeFilePath,
|
|
1721
1851
|
validate = true
|
|
1722
1852
|
}) {
|
|
1723
|
-
const filePath =
|
|
1853
|
+
const filePath = join13(baseDir, _RooCommand.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
1724
1854
|
const fileContent = await readFileContent(filePath);
|
|
1725
1855
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
1726
1856
|
const result = RooCommandFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -1730,7 +1860,7 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1730
1860
|
return new _RooCommand({
|
|
1731
1861
|
baseDir,
|
|
1732
1862
|
relativeDirPath: _RooCommand.getSettablePaths().relativeDirPath,
|
|
1733
|
-
relativeFilePath:
|
|
1863
|
+
relativeFilePath: basename12(relativeFilePath),
|
|
1734
1864
|
frontmatter: result.data,
|
|
1735
1865
|
body: content.trim(),
|
|
1736
1866
|
fileContent,
|
|
@@ -1740,33 +1870,119 @@ var RooCommand = class _RooCommand extends ToolCommand {
|
|
|
1740
1870
|
};
|
|
1741
1871
|
|
|
1742
1872
|
// src/features/commands/commands-processor.ts
|
|
1743
|
-
var
|
|
1873
|
+
var commandsProcessorToolTargetTuple = [
|
|
1744
1874
|
"agentsmd",
|
|
1745
1875
|
"antigravity",
|
|
1746
1876
|
"claudecode",
|
|
1747
|
-
"
|
|
1748
|
-
"roo",
|
|
1877
|
+
"codexcli",
|
|
1749
1878
|
"copilot",
|
|
1750
|
-
"cursor"
|
|
1751
|
-
];
|
|
1752
|
-
var CommandsProcessorToolTargetSchema = z11.enum(
|
|
1753
|
-
// codexcli is not in the list of tool targets but we add it here because it is a valid tool target for global mode generation
|
|
1754
|
-
commandsProcessorToolTargets.concat("codexcli")
|
|
1755
|
-
);
|
|
1756
|
-
var commandsProcessorToolTargetsSimulated = ["agentsmd"];
|
|
1757
|
-
var commandsProcessorToolTargetsGlobal = [
|
|
1758
|
-
"claudecode",
|
|
1759
1879
|
"cursor",
|
|
1760
1880
|
"geminicli",
|
|
1761
|
-
"
|
|
1881
|
+
"opencode",
|
|
1882
|
+
"roo"
|
|
1762
1883
|
];
|
|
1884
|
+
var CommandsProcessorToolTargetSchema = z12.enum(commandsProcessorToolTargetTuple);
|
|
1885
|
+
var toolCommandFactories = /* @__PURE__ */ new Map([
|
|
1886
|
+
[
|
|
1887
|
+
"agentsmd",
|
|
1888
|
+
{
|
|
1889
|
+
class: AgentsmdCommand,
|
|
1890
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: false, isSimulated: true }
|
|
1891
|
+
}
|
|
1892
|
+
],
|
|
1893
|
+
[
|
|
1894
|
+
"antigravity",
|
|
1895
|
+
{
|
|
1896
|
+
class: AntigravityCommand,
|
|
1897
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: false, isSimulated: false }
|
|
1898
|
+
}
|
|
1899
|
+
],
|
|
1900
|
+
[
|
|
1901
|
+
"claudecode",
|
|
1902
|
+
{
|
|
1903
|
+
class: ClaudecodeCommand,
|
|
1904
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
1905
|
+
}
|
|
1906
|
+
],
|
|
1907
|
+
[
|
|
1908
|
+
"codexcli",
|
|
1909
|
+
{
|
|
1910
|
+
class: CodexcliCommand,
|
|
1911
|
+
meta: { extension: "md", supportsProject: false, supportsGlobal: true, isSimulated: false }
|
|
1912
|
+
}
|
|
1913
|
+
],
|
|
1914
|
+
[
|
|
1915
|
+
"copilot",
|
|
1916
|
+
{
|
|
1917
|
+
class: CopilotCommand,
|
|
1918
|
+
meta: {
|
|
1919
|
+
extension: "prompt.md",
|
|
1920
|
+
supportsProject: true,
|
|
1921
|
+
supportsGlobal: false,
|
|
1922
|
+
isSimulated: false
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
],
|
|
1926
|
+
[
|
|
1927
|
+
"cursor",
|
|
1928
|
+
{
|
|
1929
|
+
class: CursorCommand,
|
|
1930
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
1931
|
+
}
|
|
1932
|
+
],
|
|
1933
|
+
[
|
|
1934
|
+
"geminicli",
|
|
1935
|
+
{
|
|
1936
|
+
class: GeminiCliCommand,
|
|
1937
|
+
meta: { extension: "toml", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
1938
|
+
}
|
|
1939
|
+
],
|
|
1940
|
+
[
|
|
1941
|
+
"opencode",
|
|
1942
|
+
{
|
|
1943
|
+
class: OpenCodeCommand,
|
|
1944
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: true, isSimulated: false }
|
|
1945
|
+
}
|
|
1946
|
+
],
|
|
1947
|
+
[
|
|
1948
|
+
"roo",
|
|
1949
|
+
{
|
|
1950
|
+
class: RooCommand,
|
|
1951
|
+
meta: { extension: "md", supportsProject: true, supportsGlobal: false, isSimulated: false }
|
|
1952
|
+
}
|
|
1953
|
+
]
|
|
1954
|
+
]);
|
|
1955
|
+
var defaultGetFactory = (target) => {
|
|
1956
|
+
const factory = toolCommandFactories.get(target);
|
|
1957
|
+
if (!factory) {
|
|
1958
|
+
throw new Error(`Unsupported tool target: ${target}`);
|
|
1959
|
+
}
|
|
1960
|
+
return factory;
|
|
1961
|
+
};
|
|
1962
|
+
var allToolTargetKeys = [...toolCommandFactories.keys()];
|
|
1963
|
+
var commandsProcessorToolTargets = allToolTargetKeys.filter((target) => {
|
|
1964
|
+
const factory = toolCommandFactories.get(target);
|
|
1965
|
+
return factory?.meta.supportsProject ?? false;
|
|
1966
|
+
});
|
|
1967
|
+
var commandsProcessorToolTargetsSimulated = allToolTargetKeys.filter((target) => {
|
|
1968
|
+
const factory = toolCommandFactories.get(target);
|
|
1969
|
+
return factory?.meta.isSimulated ?? false;
|
|
1970
|
+
});
|
|
1971
|
+
var commandsProcessorToolTargetsGlobal = allToolTargetKeys.filter(
|
|
1972
|
+
(target) => {
|
|
1973
|
+
const factory = toolCommandFactories.get(target);
|
|
1974
|
+
return factory?.meta.supportsGlobal ?? false;
|
|
1975
|
+
}
|
|
1976
|
+
);
|
|
1763
1977
|
var CommandsProcessor = class extends FeatureProcessor {
|
|
1764
1978
|
toolTarget;
|
|
1765
1979
|
global;
|
|
1980
|
+
getFactory;
|
|
1766
1981
|
constructor({
|
|
1767
1982
|
baseDir = process.cwd(),
|
|
1768
1983
|
toolTarget,
|
|
1769
|
-
global = false
|
|
1984
|
+
global = false,
|
|
1985
|
+
getFactory = defaultGetFactory
|
|
1770
1986
|
}) {
|
|
1771
1987
|
super({ baseDir });
|
|
1772
1988
|
const result = CommandsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -1777,87 +1993,23 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1777
1993
|
}
|
|
1778
1994
|
this.toolTarget = result.data;
|
|
1779
1995
|
this.global = global;
|
|
1996
|
+
this.getFactory = getFactory;
|
|
1780
1997
|
}
|
|
1781
1998
|
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
1782
1999
|
const rulesyncCommands = rulesyncFiles.filter(
|
|
1783
2000
|
(file) => file instanceof RulesyncCommand
|
|
1784
2001
|
);
|
|
2002
|
+
const factory = this.getFactory(this.toolTarget);
|
|
1785
2003
|
const toolCommands = rulesyncCommands.map((rulesyncCommand) => {
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
if (!AgentsmdCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1789
|
-
return null;
|
|
1790
|
-
}
|
|
1791
|
-
return AgentsmdCommand.fromRulesyncCommand({
|
|
1792
|
-
baseDir: this.baseDir,
|
|
1793
|
-
rulesyncCommand
|
|
1794
|
-
});
|
|
1795
|
-
case "antigravity":
|
|
1796
|
-
if (!AntigravityCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1797
|
-
return null;
|
|
1798
|
-
}
|
|
1799
|
-
return AntigravityCommand.fromRulesyncCommand({
|
|
1800
|
-
baseDir: this.baseDir,
|
|
1801
|
-
rulesyncCommand
|
|
1802
|
-
});
|
|
1803
|
-
case "claudecode":
|
|
1804
|
-
if (!ClaudecodeCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1805
|
-
return null;
|
|
1806
|
-
}
|
|
1807
|
-
return ClaudecodeCommand.fromRulesyncCommand({
|
|
1808
|
-
baseDir: this.baseDir,
|
|
1809
|
-
rulesyncCommand,
|
|
1810
|
-
global: this.global
|
|
1811
|
-
});
|
|
1812
|
-
case "geminicli":
|
|
1813
|
-
if (!GeminiCliCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1814
|
-
return null;
|
|
1815
|
-
}
|
|
1816
|
-
return GeminiCliCommand.fromRulesyncCommand({
|
|
1817
|
-
baseDir: this.baseDir,
|
|
1818
|
-
rulesyncCommand,
|
|
1819
|
-
global: this.global
|
|
1820
|
-
});
|
|
1821
|
-
case "roo":
|
|
1822
|
-
if (!RooCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1823
|
-
return null;
|
|
1824
|
-
}
|
|
1825
|
-
return RooCommand.fromRulesyncCommand({
|
|
1826
|
-
baseDir: this.baseDir,
|
|
1827
|
-
rulesyncCommand
|
|
1828
|
-
});
|
|
1829
|
-
case "copilot":
|
|
1830
|
-
if (!CopilotCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1831
|
-
return null;
|
|
1832
|
-
}
|
|
1833
|
-
return CopilotCommand.fromRulesyncCommand({
|
|
1834
|
-
baseDir: this.baseDir,
|
|
1835
|
-
rulesyncCommand
|
|
1836
|
-
});
|
|
1837
|
-
case "cursor":
|
|
1838
|
-
if (!CursorCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1839
|
-
return null;
|
|
1840
|
-
}
|
|
1841
|
-
return CursorCommand.fromRulesyncCommand({
|
|
1842
|
-
baseDir: this.baseDir,
|
|
1843
|
-
rulesyncCommand,
|
|
1844
|
-
global: this.global
|
|
1845
|
-
});
|
|
1846
|
-
case "codexcli":
|
|
1847
|
-
if (!CodexcliCommand.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
1848
|
-
return null;
|
|
1849
|
-
}
|
|
1850
|
-
return CodexcliCommand.fromRulesyncCommand({
|
|
1851
|
-
baseDir: this.baseDir,
|
|
1852
|
-
rulesyncCommand,
|
|
1853
|
-
global: this.global
|
|
1854
|
-
});
|
|
1855
|
-
default:
|
|
1856
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
2004
|
+
if (!factory.class.isTargetedByRulesyncCommand(rulesyncCommand)) {
|
|
2005
|
+
return null;
|
|
1857
2006
|
}
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
2007
|
+
return factory.class.fromRulesyncCommand({
|
|
2008
|
+
baseDir: this.baseDir,
|
|
2009
|
+
rulesyncCommand,
|
|
2010
|
+
global: this.global
|
|
2011
|
+
});
|
|
2012
|
+
}).filter((command) => command !== null);
|
|
1861
2013
|
return toolCommands;
|
|
1862
2014
|
}
|
|
1863
2015
|
async convertToolFilesToRulesyncFiles(toolFiles) {
|
|
@@ -1875,11 +2027,11 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1875
2027
|
*/
|
|
1876
2028
|
async loadRulesyncFiles() {
|
|
1877
2029
|
const rulesyncCommandPaths = await findFilesByGlobs(
|
|
1878
|
-
|
|
2030
|
+
join14(RulesyncCommand.getSettablePaths().relativeDirPath, "*.md")
|
|
1879
2031
|
);
|
|
1880
2032
|
const rulesyncCommands = await Promise.all(
|
|
1881
2033
|
rulesyncCommandPaths.map(
|
|
1882
|
-
(path3) => RulesyncCommand.fromFile({ relativeFilePath:
|
|
2034
|
+
(path3) => RulesyncCommand.fromFile({ relativeFilePath: basename13(path3) })
|
|
1883
2035
|
)
|
|
1884
2036
|
);
|
|
1885
2037
|
logger.info(`Successfully loaded ${rulesyncCommands.length} rulesync commands`);
|
|
@@ -1890,175 +2042,25 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1890
2042
|
* Load tool-specific command configurations and parse them into ToolCommand instances
|
|
1891
2043
|
*/
|
|
1892
2044
|
async loadToolFiles({
|
|
1893
|
-
forDeletion
|
|
2045
|
+
forDeletion = false
|
|
1894
2046
|
} = {}) {
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
return await this.loadAgentsmdCommands();
|
|
1898
|
-
case "antigravity":
|
|
1899
|
-
return await this.loadAntigravityCommands();
|
|
1900
|
-
case "claudecode":
|
|
1901
|
-
return await this.loadClaudecodeCommands();
|
|
1902
|
-
case "geminicli":
|
|
1903
|
-
return await this.loadGeminicliCommands();
|
|
1904
|
-
case "roo":
|
|
1905
|
-
return await this.loadRooCommands();
|
|
1906
|
-
case "copilot":
|
|
1907
|
-
return await this.loadCopilotCommands();
|
|
1908
|
-
case "cursor":
|
|
1909
|
-
return await this.loadCursorCommands();
|
|
1910
|
-
case "codexcli":
|
|
1911
|
-
return await this.loadCodexcliCommands();
|
|
1912
|
-
default:
|
|
1913
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
async loadToolCommandDefault({
|
|
1917
|
-
toolTarget,
|
|
1918
|
-
relativeDirPath,
|
|
1919
|
-
extension
|
|
1920
|
-
}) {
|
|
2047
|
+
const factory = this.getFactory(this.toolTarget);
|
|
2048
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
1921
2049
|
const commandFilePaths = await findFilesByGlobs(
|
|
1922
|
-
|
|
2050
|
+
join14(this.baseDir, paths.relativeDirPath, `*.${factory.meta.extension}`)
|
|
1923
2051
|
);
|
|
1924
2052
|
const toolCommands = await Promise.all(
|
|
1925
|
-
commandFilePaths.map(
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
case "antigravity":
|
|
1933
|
-
return AntigravityCommand.fromFile({
|
|
1934
|
-
baseDir: this.baseDir,
|
|
1935
|
-
relativeFilePath: basename12(path3)
|
|
1936
|
-
});
|
|
1937
|
-
case "claudecode":
|
|
1938
|
-
return ClaudecodeCommand.fromFile({
|
|
1939
|
-
baseDir: this.baseDir,
|
|
1940
|
-
relativeFilePath: basename12(path3),
|
|
1941
|
-
global: this.global
|
|
1942
|
-
});
|
|
1943
|
-
case "geminicli":
|
|
1944
|
-
return GeminiCliCommand.fromFile({
|
|
1945
|
-
baseDir: this.baseDir,
|
|
1946
|
-
relativeFilePath: basename12(path3),
|
|
1947
|
-
global: this.global
|
|
1948
|
-
});
|
|
1949
|
-
case "roo":
|
|
1950
|
-
return RooCommand.fromFile({
|
|
1951
|
-
baseDir: this.baseDir,
|
|
1952
|
-
relativeFilePath: basename12(path3)
|
|
1953
|
-
});
|
|
1954
|
-
case "copilot":
|
|
1955
|
-
return CopilotCommand.fromFile({
|
|
1956
|
-
baseDir: this.baseDir,
|
|
1957
|
-
relativeFilePath: basename12(path3)
|
|
1958
|
-
});
|
|
1959
|
-
case "cursor":
|
|
1960
|
-
return CursorCommand.fromFile({
|
|
1961
|
-
baseDir: this.baseDir,
|
|
1962
|
-
relativeFilePath: basename12(path3),
|
|
1963
|
-
global: this.global
|
|
1964
|
-
});
|
|
1965
|
-
case "codexcli":
|
|
1966
|
-
return CodexcliCommand.fromFile({
|
|
1967
|
-
baseDir: this.baseDir,
|
|
1968
|
-
relativeFilePath: basename12(path3),
|
|
1969
|
-
global: this.global
|
|
1970
|
-
});
|
|
1971
|
-
default:
|
|
1972
|
-
throw new Error(`Unsupported tool target: ${toolTarget}`);
|
|
1973
|
-
}
|
|
1974
|
-
})
|
|
2053
|
+
commandFilePaths.map(
|
|
2054
|
+
(path3) => factory.class.fromFile({
|
|
2055
|
+
baseDir: this.baseDir,
|
|
2056
|
+
relativeFilePath: basename13(path3),
|
|
2057
|
+
global: this.global
|
|
2058
|
+
})
|
|
2059
|
+
)
|
|
1975
2060
|
);
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
/**
|
|
1980
|
-
* Load Agents.md command configurations from .agents/commands/ directory
|
|
1981
|
-
*/
|
|
1982
|
-
async loadAgentsmdCommands() {
|
|
1983
|
-
return await this.loadToolCommandDefault({
|
|
1984
|
-
toolTarget: "agentsmd",
|
|
1985
|
-
relativeDirPath: AgentsmdCommand.getSettablePaths().relativeDirPath,
|
|
1986
|
-
extension: "md"
|
|
1987
|
-
});
|
|
1988
|
-
}
|
|
1989
|
-
/**
|
|
1990
|
-
* Load Antigravity workflow configurations from .agent/workflows/ directory
|
|
1991
|
-
*/
|
|
1992
|
-
async loadAntigravityCommands() {
|
|
1993
|
-
return await this.loadToolCommandDefault({
|
|
1994
|
-
toolTarget: "antigravity",
|
|
1995
|
-
relativeDirPath: AntigravityCommand.getSettablePaths().relativeDirPath,
|
|
1996
|
-
extension: "md"
|
|
1997
|
-
});
|
|
1998
|
-
}
|
|
1999
|
-
/**
|
|
2000
|
-
* Load Copilot command configurations from .github/prompts/ directory
|
|
2001
|
-
*/
|
|
2002
|
-
async loadCopilotCommands() {
|
|
2003
|
-
return await this.loadToolCommandDefault({
|
|
2004
|
-
toolTarget: "copilot",
|
|
2005
|
-
relativeDirPath: CopilotCommand.getSettablePaths().relativeDirPath,
|
|
2006
|
-
extension: "prompt.md"
|
|
2007
|
-
});
|
|
2008
|
-
}
|
|
2009
|
-
/**
|
|
2010
|
-
* Load Claude Code command configurations from .claude/commands/ directory
|
|
2011
|
-
*/
|
|
2012
|
-
async loadClaudecodeCommands() {
|
|
2013
|
-
const paths = ClaudecodeCommand.getSettablePaths({ global: this.global });
|
|
2014
|
-
return await this.loadToolCommandDefault({
|
|
2015
|
-
toolTarget: "claudecode",
|
|
2016
|
-
relativeDirPath: paths.relativeDirPath,
|
|
2017
|
-
extension: "md"
|
|
2018
|
-
});
|
|
2019
|
-
}
|
|
2020
|
-
/**
|
|
2021
|
-
* Load Cursor command configurations from .cursor/commands/ directory
|
|
2022
|
-
*/
|
|
2023
|
-
async loadCursorCommands() {
|
|
2024
|
-
const paths = CursorCommand.getSettablePaths({ global: this.global });
|
|
2025
|
-
return await this.loadToolCommandDefault({
|
|
2026
|
-
toolTarget: "cursor",
|
|
2027
|
-
relativeDirPath: paths.relativeDirPath,
|
|
2028
|
-
extension: "md"
|
|
2029
|
-
});
|
|
2030
|
-
}
|
|
2031
|
-
/**
|
|
2032
|
-
* Load Gemini CLI command configurations from .gemini/commands/ directory
|
|
2033
|
-
*/
|
|
2034
|
-
async loadGeminicliCommands() {
|
|
2035
|
-
const paths = GeminiCliCommand.getSettablePaths({ global: this.global });
|
|
2036
|
-
return await this.loadToolCommandDefault({
|
|
2037
|
-
toolTarget: "geminicli",
|
|
2038
|
-
relativeDirPath: paths.relativeDirPath,
|
|
2039
|
-
extension: "toml"
|
|
2040
|
-
});
|
|
2041
|
-
}
|
|
2042
|
-
/**
|
|
2043
|
-
* Load Codex CLI command configurations from .codex/prompts/ directory
|
|
2044
|
-
*/
|
|
2045
|
-
async loadCodexcliCommands() {
|
|
2046
|
-
const paths = CodexcliCommand.getSettablePaths({ global: this.global });
|
|
2047
|
-
return await this.loadToolCommandDefault({
|
|
2048
|
-
toolTarget: "codexcli",
|
|
2049
|
-
relativeDirPath: paths.relativeDirPath,
|
|
2050
|
-
extension: "md"
|
|
2051
|
-
});
|
|
2052
|
-
}
|
|
2053
|
-
/**
|
|
2054
|
-
* Load Roo Code command configurations from .roo/commands/ directory
|
|
2055
|
-
*/
|
|
2056
|
-
async loadRooCommands() {
|
|
2057
|
-
return await this.loadToolCommandDefault({
|
|
2058
|
-
toolTarget: "roo",
|
|
2059
|
-
relativeDirPath: RooCommand.getSettablePaths().relativeDirPath,
|
|
2060
|
-
extension: "md"
|
|
2061
|
-
});
|
|
2061
|
+
const result = forDeletion ? toolCommands.filter((cmd) => cmd.isDeletable()) : toolCommands;
|
|
2062
|
+
logger.info(`Successfully loaded ${result.length} ${paths.relativeDirPath} commands`);
|
|
2063
|
+
return result;
|
|
2062
2064
|
}
|
|
2063
2065
|
/**
|
|
2064
2066
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -2069,32 +2071,32 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
2069
2071
|
includeSimulated = false
|
|
2070
2072
|
} = {}) {
|
|
2071
2073
|
if (global) {
|
|
2072
|
-
return commandsProcessorToolTargetsGlobal;
|
|
2074
|
+
return [...commandsProcessorToolTargetsGlobal];
|
|
2073
2075
|
}
|
|
2074
2076
|
if (!includeSimulated) {
|
|
2075
2077
|
return commandsProcessorToolTargets.filter(
|
|
2076
2078
|
(target) => !commandsProcessorToolTargetsSimulated.includes(target)
|
|
2077
2079
|
);
|
|
2078
2080
|
}
|
|
2079
|
-
return commandsProcessorToolTargets;
|
|
2081
|
+
return [...commandsProcessorToolTargets];
|
|
2080
2082
|
}
|
|
2081
2083
|
static getToolTargetsSimulated() {
|
|
2082
|
-
return commandsProcessorToolTargetsSimulated;
|
|
2084
|
+
return [...commandsProcessorToolTargetsSimulated];
|
|
2083
2085
|
}
|
|
2084
2086
|
};
|
|
2085
2087
|
|
|
2086
2088
|
// src/features/ignore/ignore-processor.ts
|
|
2087
|
-
import { z as
|
|
2089
|
+
import { z as z13 } from "zod/mini";
|
|
2088
2090
|
|
|
2089
2091
|
// src/features/ignore/amazonqcli-ignore.ts
|
|
2090
|
-
import { join as
|
|
2092
|
+
import { join as join16 } from "path";
|
|
2091
2093
|
|
|
2092
2094
|
// src/types/tool-file.ts
|
|
2093
2095
|
var ToolFile = class extends AiFile {
|
|
2094
2096
|
};
|
|
2095
2097
|
|
|
2096
2098
|
// src/features/ignore/rulesync-ignore.ts
|
|
2097
|
-
import { join as
|
|
2099
|
+
import { join as join15 } from "path";
|
|
2098
2100
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
2099
2101
|
validate() {
|
|
2100
2102
|
return { success: true, error: null };
|
|
@@ -2114,12 +2116,12 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
2114
2116
|
static async fromFile() {
|
|
2115
2117
|
const baseDir = process.cwd();
|
|
2116
2118
|
const paths = this.getSettablePaths();
|
|
2117
|
-
const recommendedPath =
|
|
2119
|
+
const recommendedPath = join15(
|
|
2118
2120
|
baseDir,
|
|
2119
2121
|
paths.recommended.relativeDirPath,
|
|
2120
2122
|
paths.recommended.relativeFilePath
|
|
2121
2123
|
);
|
|
2122
|
-
const legacyPath =
|
|
2124
|
+
const legacyPath = join15(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
2123
2125
|
if (await fileExists(recommendedPath)) {
|
|
2124
2126
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
2125
2127
|
return new _RulesyncIgnore({
|
|
@@ -2228,7 +2230,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2228
2230
|
validate = true
|
|
2229
2231
|
}) {
|
|
2230
2232
|
const fileContent = await readFileContent(
|
|
2231
|
-
|
|
2233
|
+
join16(
|
|
2232
2234
|
baseDir,
|
|
2233
2235
|
this.getSettablePaths().relativeDirPath,
|
|
2234
2236
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2245,7 +2247,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
2245
2247
|
};
|
|
2246
2248
|
|
|
2247
2249
|
// src/features/ignore/augmentcode-ignore.ts
|
|
2248
|
-
import { join as
|
|
2250
|
+
import { join as join17 } from "path";
|
|
2249
2251
|
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
2250
2252
|
static getSettablePaths() {
|
|
2251
2253
|
return {
|
|
@@ -2283,7 +2285,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2283
2285
|
validate = true
|
|
2284
2286
|
}) {
|
|
2285
2287
|
const fileContent = await readFileContent(
|
|
2286
|
-
|
|
2288
|
+
join17(
|
|
2287
2289
|
baseDir,
|
|
2288
2290
|
this.getSettablePaths().relativeDirPath,
|
|
2289
2291
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2300,7 +2302,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
2300
2302
|
};
|
|
2301
2303
|
|
|
2302
2304
|
// src/features/ignore/claudecode-ignore.ts
|
|
2303
|
-
import { join as
|
|
2305
|
+
import { join as join18 } from "path";
|
|
2304
2306
|
import { uniq } from "es-toolkit";
|
|
2305
2307
|
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
2306
2308
|
constructor(params) {
|
|
@@ -2343,7 +2345,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2343
2345
|
const fileContent = rulesyncIgnore.getFileContent();
|
|
2344
2346
|
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
2345
2347
|
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
2346
|
-
const filePath =
|
|
2348
|
+
const filePath = join18(
|
|
2347
2349
|
baseDir,
|
|
2348
2350
|
this.getSettablePaths().relativeDirPath,
|
|
2349
2351
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2371,7 +2373,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2371
2373
|
validate = true
|
|
2372
2374
|
}) {
|
|
2373
2375
|
const fileContent = await readFileContent(
|
|
2374
|
-
|
|
2376
|
+
join18(
|
|
2375
2377
|
baseDir,
|
|
2376
2378
|
this.getSettablePaths().relativeDirPath,
|
|
2377
2379
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2388,7 +2390,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
2388
2390
|
};
|
|
2389
2391
|
|
|
2390
2392
|
// src/features/ignore/cline-ignore.ts
|
|
2391
|
-
import { join as
|
|
2393
|
+
import { join as join19 } from "path";
|
|
2392
2394
|
var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
2393
2395
|
static getSettablePaths() {
|
|
2394
2396
|
return {
|
|
@@ -2425,7 +2427,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2425
2427
|
validate = true
|
|
2426
2428
|
}) {
|
|
2427
2429
|
const fileContent = await readFileContent(
|
|
2428
|
-
|
|
2430
|
+
join19(
|
|
2429
2431
|
baseDir,
|
|
2430
2432
|
this.getSettablePaths().relativeDirPath,
|
|
2431
2433
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2442,7 +2444,7 @@ var ClineIgnore = class _ClineIgnore extends ToolIgnore {
|
|
|
2442
2444
|
};
|
|
2443
2445
|
|
|
2444
2446
|
// src/features/ignore/cursor-ignore.ts
|
|
2445
|
-
import { join as
|
|
2447
|
+
import { join as join20 } from "path";
|
|
2446
2448
|
var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
2447
2449
|
static getSettablePaths() {
|
|
2448
2450
|
return {
|
|
@@ -2475,7 +2477,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2475
2477
|
validate = true
|
|
2476
2478
|
}) {
|
|
2477
2479
|
const fileContent = await readFileContent(
|
|
2478
|
-
|
|
2480
|
+
join20(
|
|
2479
2481
|
baseDir,
|
|
2480
2482
|
this.getSettablePaths().relativeDirPath,
|
|
2481
2483
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2492,7 +2494,7 @@ var CursorIgnore = class _CursorIgnore extends ToolIgnore {
|
|
|
2492
2494
|
};
|
|
2493
2495
|
|
|
2494
2496
|
// src/features/ignore/geminicli-ignore.ts
|
|
2495
|
-
import { join as
|
|
2497
|
+
import { join as join21 } from "path";
|
|
2496
2498
|
var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
2497
2499
|
static getSettablePaths() {
|
|
2498
2500
|
return {
|
|
@@ -2519,7 +2521,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2519
2521
|
validate = true
|
|
2520
2522
|
}) {
|
|
2521
2523
|
const fileContent = await readFileContent(
|
|
2522
|
-
|
|
2524
|
+
join21(
|
|
2523
2525
|
baseDir,
|
|
2524
2526
|
this.getSettablePaths().relativeDirPath,
|
|
2525
2527
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2536,7 +2538,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
2536
2538
|
};
|
|
2537
2539
|
|
|
2538
2540
|
// src/features/ignore/junie-ignore.ts
|
|
2539
|
-
import { join as
|
|
2541
|
+
import { join as join22 } from "path";
|
|
2540
2542
|
var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
2541
2543
|
static getSettablePaths() {
|
|
2542
2544
|
return {
|
|
@@ -2563,7 +2565,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2563
2565
|
validate = true
|
|
2564
2566
|
}) {
|
|
2565
2567
|
const fileContent = await readFileContent(
|
|
2566
|
-
|
|
2568
|
+
join22(
|
|
2567
2569
|
baseDir,
|
|
2568
2570
|
this.getSettablePaths().relativeDirPath,
|
|
2569
2571
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2580,7 +2582,7 @@ var JunieIgnore = class _JunieIgnore extends ToolIgnore {
|
|
|
2580
2582
|
};
|
|
2581
2583
|
|
|
2582
2584
|
// src/features/ignore/kiro-ignore.ts
|
|
2583
|
-
import { join as
|
|
2585
|
+
import { join as join23 } from "path";
|
|
2584
2586
|
var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
2585
2587
|
static getSettablePaths() {
|
|
2586
2588
|
return {
|
|
@@ -2607,7 +2609,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2607
2609
|
validate = true
|
|
2608
2610
|
}) {
|
|
2609
2611
|
const fileContent = await readFileContent(
|
|
2610
|
-
|
|
2612
|
+
join23(
|
|
2611
2613
|
baseDir,
|
|
2612
2614
|
this.getSettablePaths().relativeDirPath,
|
|
2613
2615
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2624,7 +2626,7 @@ var KiroIgnore = class _KiroIgnore extends ToolIgnore {
|
|
|
2624
2626
|
};
|
|
2625
2627
|
|
|
2626
2628
|
// src/features/ignore/qwencode-ignore.ts
|
|
2627
|
-
import { join as
|
|
2629
|
+
import { join as join24 } from "path";
|
|
2628
2630
|
var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
2629
2631
|
static getSettablePaths() {
|
|
2630
2632
|
return {
|
|
@@ -2651,7 +2653,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2651
2653
|
validate = true
|
|
2652
2654
|
}) {
|
|
2653
2655
|
const fileContent = await readFileContent(
|
|
2654
|
-
|
|
2656
|
+
join24(
|
|
2655
2657
|
baseDir,
|
|
2656
2658
|
this.getSettablePaths().relativeDirPath,
|
|
2657
2659
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2668,7 +2670,7 @@ var QwencodeIgnore = class _QwencodeIgnore extends ToolIgnore {
|
|
|
2668
2670
|
};
|
|
2669
2671
|
|
|
2670
2672
|
// src/features/ignore/roo-ignore.ts
|
|
2671
|
-
import { join as
|
|
2673
|
+
import { join as join25 } from "path";
|
|
2672
2674
|
var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
2673
2675
|
static getSettablePaths() {
|
|
2674
2676
|
return {
|
|
@@ -2695,7 +2697,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2695
2697
|
validate = true
|
|
2696
2698
|
}) {
|
|
2697
2699
|
const fileContent = await readFileContent(
|
|
2698
|
-
|
|
2700
|
+
join25(
|
|
2699
2701
|
baseDir,
|
|
2700
2702
|
this.getSettablePaths().relativeDirPath,
|
|
2701
2703
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2712,7 +2714,7 @@ var RooIgnore = class _RooIgnore extends ToolIgnore {
|
|
|
2712
2714
|
};
|
|
2713
2715
|
|
|
2714
2716
|
// src/features/ignore/windsurf-ignore.ts
|
|
2715
|
-
import { join as
|
|
2717
|
+
import { join as join26 } from "path";
|
|
2716
2718
|
var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
2717
2719
|
static getSettablePaths() {
|
|
2718
2720
|
return {
|
|
@@ -2739,7 +2741,7 @@ var WindsurfIgnore = class _WindsurfIgnore extends ToolIgnore {
|
|
|
2739
2741
|
validate = true
|
|
2740
2742
|
}) {
|
|
2741
2743
|
const fileContent = await readFileContent(
|
|
2742
|
-
|
|
2744
|
+
join26(
|
|
2743
2745
|
baseDir,
|
|
2744
2746
|
this.getSettablePaths().relativeDirPath,
|
|
2745
2747
|
this.getSettablePaths().relativeFilePath
|
|
@@ -2769,12 +2771,34 @@ var ignoreProcessorToolTargets = [
|
|
|
2769
2771
|
"roo",
|
|
2770
2772
|
"windsurf"
|
|
2771
2773
|
];
|
|
2772
|
-
var IgnoreProcessorToolTargetSchema =
|
|
2774
|
+
var IgnoreProcessorToolTargetSchema = z13.enum(ignoreProcessorToolTargets);
|
|
2775
|
+
var toolIgnoreFactories = /* @__PURE__ */ new Map([
|
|
2776
|
+
["amazonqcli", { class: AmazonqcliIgnore }],
|
|
2777
|
+
["augmentcode", { class: AugmentcodeIgnore }],
|
|
2778
|
+
["claudecode", { class: ClaudecodeIgnore }],
|
|
2779
|
+
["cline", { class: ClineIgnore }],
|
|
2780
|
+
["cursor", { class: CursorIgnore }],
|
|
2781
|
+
["geminicli", { class: GeminiCliIgnore }],
|
|
2782
|
+
["junie", { class: JunieIgnore }],
|
|
2783
|
+
["kiro", { class: KiroIgnore }],
|
|
2784
|
+
["qwencode", { class: QwencodeIgnore }],
|
|
2785
|
+
["roo", { class: RooIgnore }],
|
|
2786
|
+
["windsurf", { class: WindsurfIgnore }]
|
|
2787
|
+
]);
|
|
2788
|
+
var defaultGetFactory2 = (target) => {
|
|
2789
|
+
const factory = toolIgnoreFactories.get(target);
|
|
2790
|
+
if (!factory) {
|
|
2791
|
+
throw new Error(`Unsupported tool target: ${target}`);
|
|
2792
|
+
}
|
|
2793
|
+
return factory;
|
|
2794
|
+
};
|
|
2773
2795
|
var IgnoreProcessor = class extends FeatureProcessor {
|
|
2774
2796
|
toolTarget;
|
|
2797
|
+
getFactory;
|
|
2775
2798
|
constructor({
|
|
2776
2799
|
baseDir = process.cwd(),
|
|
2777
|
-
toolTarget
|
|
2800
|
+
toolTarget,
|
|
2801
|
+
getFactory = defaultGetFactory2
|
|
2778
2802
|
}) {
|
|
2779
2803
|
super({ baseDir });
|
|
2780
2804
|
const result = IgnoreProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -2784,6 +2808,7 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2784
2808
|
);
|
|
2785
2809
|
}
|
|
2786
2810
|
this.toolTarget = result.data;
|
|
2811
|
+
this.getFactory = getFactory;
|
|
2787
2812
|
}
|
|
2788
2813
|
async writeToolIgnoresFromRulesyncIgnores(rulesyncIgnores) {
|
|
2789
2814
|
const toolIgnores = await this.convertRulesyncFilesToToolFiles(rulesyncIgnores);
|
|
@@ -2825,32 +2850,8 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2825
2850
|
}
|
|
2826
2851
|
}
|
|
2827
2852
|
async loadToolIgnores() {
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
return [await AmazonqcliIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2831
|
-
case "augmentcode":
|
|
2832
|
-
return [await AugmentcodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2833
|
-
case "claudecode":
|
|
2834
|
-
return [await ClaudecodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2835
|
-
case "cline":
|
|
2836
|
-
return [await ClineIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2837
|
-
case "cursor":
|
|
2838
|
-
return [await CursorIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2839
|
-
case "geminicli":
|
|
2840
|
-
return [await GeminiCliIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2841
|
-
case "junie":
|
|
2842
|
-
return [await JunieIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2843
|
-
case "kiro":
|
|
2844
|
-
return [await KiroIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2845
|
-
case "qwencode":
|
|
2846
|
-
return [await QwencodeIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2847
|
-
case "roo":
|
|
2848
|
-
return [await RooIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2849
|
-
case "windsurf":
|
|
2850
|
-
return [await WindsurfIgnore.fromFile({ baseDir: this.baseDir })];
|
|
2851
|
-
default:
|
|
2852
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
2853
|
-
}
|
|
2853
|
+
const factory = this.getFactory(this.toolTarget);
|
|
2854
|
+
return [await factory.class.fromFile({ baseDir: this.baseDir })];
|
|
2854
2855
|
}
|
|
2855
2856
|
/**
|
|
2856
2857
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -2863,70 +2864,12 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2863
2864
|
if (!rulesyncIgnore) {
|
|
2864
2865
|
throw new Error(`No ${RULESYNC_AIIGNORE_RELATIVE_FILE_PATH} found.`);
|
|
2865
2866
|
}
|
|
2866
|
-
const
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2873
|
-
});
|
|
2874
|
-
case "augmentcode":
|
|
2875
|
-
return AugmentcodeIgnore.fromRulesyncIgnore({
|
|
2876
|
-
baseDir: this.baseDir,
|
|
2877
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2878
|
-
});
|
|
2879
|
-
case "claudecode":
|
|
2880
|
-
return await ClaudecodeIgnore.fromRulesyncIgnore({
|
|
2881
|
-
baseDir: this.baseDir,
|
|
2882
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2883
|
-
});
|
|
2884
|
-
case "cline":
|
|
2885
|
-
return ClineIgnore.fromRulesyncIgnore({
|
|
2886
|
-
baseDir: this.baseDir,
|
|
2887
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2888
|
-
});
|
|
2889
|
-
case "cursor":
|
|
2890
|
-
return CursorIgnore.fromRulesyncIgnore({
|
|
2891
|
-
baseDir: this.baseDir,
|
|
2892
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2893
|
-
});
|
|
2894
|
-
case "geminicli":
|
|
2895
|
-
return GeminiCliIgnore.fromRulesyncIgnore({
|
|
2896
|
-
baseDir: this.baseDir,
|
|
2897
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2898
|
-
});
|
|
2899
|
-
case "junie":
|
|
2900
|
-
return JunieIgnore.fromRulesyncIgnore({
|
|
2901
|
-
baseDir: this.baseDir,
|
|
2902
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2903
|
-
});
|
|
2904
|
-
case "kiro":
|
|
2905
|
-
return KiroIgnore.fromRulesyncIgnore({
|
|
2906
|
-
baseDir: this.baseDir,
|
|
2907
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2908
|
-
});
|
|
2909
|
-
case "qwencode":
|
|
2910
|
-
return QwencodeIgnore.fromRulesyncIgnore({
|
|
2911
|
-
baseDir: this.baseDir,
|
|
2912
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2913
|
-
});
|
|
2914
|
-
case "roo":
|
|
2915
|
-
return RooIgnore.fromRulesyncIgnore({
|
|
2916
|
-
baseDir: this.baseDir,
|
|
2917
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2918
|
-
});
|
|
2919
|
-
case "windsurf":
|
|
2920
|
-
return WindsurfIgnore.fromRulesyncIgnore({
|
|
2921
|
-
baseDir: this.baseDir,
|
|
2922
|
-
rulesyncIgnore: rulesyncIgnore2
|
|
2923
|
-
});
|
|
2924
|
-
default:
|
|
2925
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
2926
|
-
}
|
|
2927
|
-
})
|
|
2928
|
-
);
|
|
2929
|
-
return toolIgnores;
|
|
2867
|
+
const factory = this.getFactory(this.toolTarget);
|
|
2868
|
+
const toolIgnore = await factory.class.fromRulesyncIgnore({
|
|
2869
|
+
baseDir: this.baseDir,
|
|
2870
|
+
rulesyncIgnore
|
|
2871
|
+
});
|
|
2872
|
+
return [toolIgnore];
|
|
2930
2873
|
}
|
|
2931
2874
|
/**
|
|
2932
2875
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -2952,54 +2895,54 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2952
2895
|
};
|
|
2953
2896
|
|
|
2954
2897
|
// src/features/mcp/mcp-processor.ts
|
|
2955
|
-
import { z as
|
|
2898
|
+
import { z as z18 } from "zod/mini";
|
|
2956
2899
|
|
|
2957
2900
|
// src/features/mcp/amazonqcli-mcp.ts
|
|
2958
|
-
import { join as
|
|
2901
|
+
import { join as join28 } from "path";
|
|
2959
2902
|
|
|
2960
2903
|
// src/features/mcp/rulesync-mcp.ts
|
|
2961
|
-
import { join as
|
|
2904
|
+
import { join as join27 } from "path";
|
|
2962
2905
|
import { omit } from "es-toolkit/object";
|
|
2963
|
-
import { z as
|
|
2906
|
+
import { z as z15 } from "zod/mini";
|
|
2964
2907
|
|
|
2965
2908
|
// src/types/mcp.ts
|
|
2966
|
-
import { z as
|
|
2967
|
-
var McpServerSchema =
|
|
2968
|
-
type:
|
|
2969
|
-
command:
|
|
2970
|
-
args:
|
|
2971
|
-
url:
|
|
2972
|
-
httpUrl:
|
|
2973
|
-
env:
|
|
2974
|
-
disabled:
|
|
2975
|
-
networkTimeout:
|
|
2976
|
-
timeout:
|
|
2977
|
-
trust:
|
|
2978
|
-
cwd:
|
|
2979
|
-
transport:
|
|
2980
|
-
alwaysAllow:
|
|
2981
|
-
tools:
|
|
2982
|
-
kiroAutoApprove:
|
|
2983
|
-
kiroAutoBlock:
|
|
2984
|
-
headers:
|
|
2909
|
+
import { z as z14 } from "zod/mini";
|
|
2910
|
+
var McpServerSchema = z14.object({
|
|
2911
|
+
type: z14.optional(z14.enum(["stdio", "sse", "http"])),
|
|
2912
|
+
command: z14.optional(z14.union([z14.string(), z14.array(z14.string())])),
|
|
2913
|
+
args: z14.optional(z14.array(z14.string())),
|
|
2914
|
+
url: z14.optional(z14.string()),
|
|
2915
|
+
httpUrl: z14.optional(z14.string()),
|
|
2916
|
+
env: z14.optional(z14.record(z14.string(), z14.string())),
|
|
2917
|
+
disabled: z14.optional(z14.boolean()),
|
|
2918
|
+
networkTimeout: z14.optional(z14.number()),
|
|
2919
|
+
timeout: z14.optional(z14.number()),
|
|
2920
|
+
trust: z14.optional(z14.boolean()),
|
|
2921
|
+
cwd: z14.optional(z14.string()),
|
|
2922
|
+
transport: z14.optional(z14.enum(["stdio", "sse", "http"])),
|
|
2923
|
+
alwaysAllow: z14.optional(z14.array(z14.string())),
|
|
2924
|
+
tools: z14.optional(z14.array(z14.string())),
|
|
2925
|
+
kiroAutoApprove: z14.optional(z14.array(z14.string())),
|
|
2926
|
+
kiroAutoBlock: z14.optional(z14.array(z14.string())),
|
|
2927
|
+
headers: z14.optional(z14.record(z14.string(), z14.string()))
|
|
2985
2928
|
});
|
|
2986
|
-
var McpServersSchema =
|
|
2929
|
+
var McpServersSchema = z14.record(z14.string(), McpServerSchema);
|
|
2987
2930
|
|
|
2988
2931
|
// src/features/mcp/rulesync-mcp.ts
|
|
2989
|
-
var RulesyncMcpServerSchema =
|
|
2990
|
-
|
|
2991
|
-
targets:
|
|
2992
|
-
description:
|
|
2993
|
-
exposed:
|
|
2932
|
+
var RulesyncMcpServerSchema = z15.union([
|
|
2933
|
+
z15.extend(McpServerSchema, {
|
|
2934
|
+
targets: z15.optional(RulesyncTargetsSchema),
|
|
2935
|
+
description: z15.optional(z15.string()),
|
|
2936
|
+
exposed: z15.optional(z15.literal(false))
|
|
2994
2937
|
}),
|
|
2995
|
-
|
|
2996
|
-
targets:
|
|
2997
|
-
description:
|
|
2998
|
-
exposed:
|
|
2938
|
+
z15.extend(McpServerSchema, {
|
|
2939
|
+
targets: z15.optional(RulesyncTargetsSchema),
|
|
2940
|
+
description: z15.undefined(),
|
|
2941
|
+
exposed: z15.literal(true)
|
|
2999
2942
|
})
|
|
3000
2943
|
]);
|
|
3001
|
-
var RulesyncMcpConfigSchema =
|
|
3002
|
-
mcpServers:
|
|
2944
|
+
var RulesyncMcpConfigSchema = z15.object({
|
|
2945
|
+
mcpServers: z15.record(z15.string(), RulesyncMcpServerSchema)
|
|
3003
2946
|
});
|
|
3004
2947
|
var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
3005
2948
|
json;
|
|
@@ -3040,12 +2983,12 @@ var RulesyncMcp = class _RulesyncMcp extends RulesyncFile {
|
|
|
3040
2983
|
}) {
|
|
3041
2984
|
const baseDir = process.cwd();
|
|
3042
2985
|
const paths = this.getSettablePaths();
|
|
3043
|
-
const recommendedPath =
|
|
2986
|
+
const recommendedPath = join27(
|
|
3044
2987
|
baseDir,
|
|
3045
2988
|
paths.recommended.relativeDirPath,
|
|
3046
2989
|
paths.recommended.relativeFilePath
|
|
3047
2990
|
);
|
|
3048
|
-
const legacyPath =
|
|
2991
|
+
const legacyPath = join27(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
3049
2992
|
if (await fileExists(recommendedPath)) {
|
|
3050
2993
|
const fileContent2 = await readFileContent(recommendedPath);
|
|
3051
2994
|
return new _RulesyncMcp({
|
|
@@ -3165,7 +3108,7 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
3165
3108
|
validate = true
|
|
3166
3109
|
}) {
|
|
3167
3110
|
const fileContent = await readFileContent(
|
|
3168
|
-
|
|
3111
|
+
join28(
|
|
3169
3112
|
baseDir,
|
|
3170
3113
|
this.getSettablePaths().relativeDirPath,
|
|
3171
3114
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3201,17 +3144,17 @@ var AmazonqcliMcp = class _AmazonqcliMcp extends ToolMcp {
|
|
|
3201
3144
|
};
|
|
3202
3145
|
|
|
3203
3146
|
// src/features/mcp/claudecode-mcp.ts
|
|
3204
|
-
import { join as
|
|
3147
|
+
import { join as join30 } from "path";
|
|
3205
3148
|
|
|
3206
3149
|
// src/features/mcp/modular-mcp.ts
|
|
3207
|
-
import { join as
|
|
3208
|
-
import { z as
|
|
3209
|
-
var ModularMcpServerSchema =
|
|
3210
|
-
description:
|
|
3150
|
+
import { join as join29 } from "path";
|
|
3151
|
+
import { z as z16 } from "zod/mini";
|
|
3152
|
+
var ModularMcpServerSchema = z16.extend(McpServerSchema, {
|
|
3153
|
+
description: z16.string()
|
|
3211
3154
|
// Required for modular-mcp
|
|
3212
3155
|
});
|
|
3213
|
-
var ModularMcpConfigSchema =
|
|
3214
|
-
mcpServers:
|
|
3156
|
+
var ModularMcpConfigSchema = z16.object({
|
|
3157
|
+
mcpServers: z16.record(z16.string(), ModularMcpServerSchema)
|
|
3215
3158
|
});
|
|
3216
3159
|
var ModularMcp = class _ModularMcp extends AiFile {
|
|
3217
3160
|
json;
|
|
@@ -3267,7 +3210,7 @@ var ModularMcp = class _ModularMcp extends AiFile {
|
|
|
3267
3210
|
args: [
|
|
3268
3211
|
"-y",
|
|
3269
3212
|
"@kimuson/modular-mcp",
|
|
3270
|
-
|
|
3213
|
+
join29(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3271
3214
|
],
|
|
3272
3215
|
env: {}
|
|
3273
3216
|
}
|
|
@@ -3340,7 +3283,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3340
3283
|
}) {
|
|
3341
3284
|
const paths = this.getSettablePaths({ global });
|
|
3342
3285
|
const fileContent = await readOrInitializeFileContent(
|
|
3343
|
-
|
|
3286
|
+
join30(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3344
3287
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3345
3288
|
);
|
|
3346
3289
|
const json = JSON.parse(fileContent);
|
|
@@ -3362,7 +3305,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3362
3305
|
}) {
|
|
3363
3306
|
const paths = this.getSettablePaths({ global });
|
|
3364
3307
|
const fileContent = await readOrInitializeFileContent(
|
|
3365
|
-
|
|
3308
|
+
join30(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3366
3309
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3367
3310
|
);
|
|
3368
3311
|
const json = JSON.parse(fileContent);
|
|
@@ -3397,7 +3340,7 @@ var ClaudecodeMcp = class _ClaudecodeMcp extends ToolMcp {
|
|
|
3397
3340
|
};
|
|
3398
3341
|
|
|
3399
3342
|
// src/features/mcp/cline-mcp.ts
|
|
3400
|
-
import { join as
|
|
3343
|
+
import { join as join31 } from "path";
|
|
3401
3344
|
var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
3402
3345
|
json;
|
|
3403
3346
|
constructor(params) {
|
|
@@ -3418,7 +3361,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3418
3361
|
validate = true
|
|
3419
3362
|
}) {
|
|
3420
3363
|
const fileContent = await readFileContent(
|
|
3421
|
-
|
|
3364
|
+
join31(
|
|
3422
3365
|
baseDir,
|
|
3423
3366
|
this.getSettablePaths().relativeDirPath,
|
|
3424
3367
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3454,7 +3397,7 @@ var ClineMcp = class _ClineMcp extends ToolMcp {
|
|
|
3454
3397
|
};
|
|
3455
3398
|
|
|
3456
3399
|
// src/features/mcp/codexcli-mcp.ts
|
|
3457
|
-
import { join as
|
|
3400
|
+
import { join as join32 } from "path";
|
|
3458
3401
|
import * as smolToml from "smol-toml";
|
|
3459
3402
|
var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
3460
3403
|
toml;
|
|
@@ -3490,7 +3433,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3490
3433
|
}) {
|
|
3491
3434
|
const paths = this.getSettablePaths({ global });
|
|
3492
3435
|
const fileContent = await readFileContent(
|
|
3493
|
-
|
|
3436
|
+
join32(baseDir, paths.relativeDirPath, paths.relativeFilePath)
|
|
3494
3437
|
);
|
|
3495
3438
|
return new _CodexcliMcp({
|
|
3496
3439
|
baseDir,
|
|
@@ -3507,7 +3450,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3507
3450
|
global = false
|
|
3508
3451
|
}) {
|
|
3509
3452
|
const paths = this.getSettablePaths({ global });
|
|
3510
|
-
const configTomlFilePath =
|
|
3453
|
+
const configTomlFilePath = join32(baseDir, paths.relativeDirPath, paths.relativeFilePath);
|
|
3511
3454
|
const configTomlFileContent = await readOrInitializeFileContent(
|
|
3512
3455
|
configTomlFilePath,
|
|
3513
3456
|
smolToml.stringify({})
|
|
@@ -3548,7 +3491,7 @@ var CodexcliMcp = class _CodexcliMcp extends ToolMcp {
|
|
|
3548
3491
|
};
|
|
3549
3492
|
|
|
3550
3493
|
// src/features/mcp/copilot-mcp.ts
|
|
3551
|
-
import { join as
|
|
3494
|
+
import { join as join33 } from "path";
|
|
3552
3495
|
var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
3553
3496
|
json;
|
|
3554
3497
|
constructor(params) {
|
|
@@ -3569,7 +3512,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3569
3512
|
validate = true
|
|
3570
3513
|
}) {
|
|
3571
3514
|
const fileContent = await readFileContent(
|
|
3572
|
-
|
|
3515
|
+
join33(
|
|
3573
3516
|
baseDir,
|
|
3574
3517
|
this.getSettablePaths().relativeDirPath,
|
|
3575
3518
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3605,7 +3548,7 @@ var CopilotMcp = class _CopilotMcp extends ToolMcp {
|
|
|
3605
3548
|
};
|
|
3606
3549
|
|
|
3607
3550
|
// src/features/mcp/cursor-mcp.ts
|
|
3608
|
-
import { join as
|
|
3551
|
+
import { join as join34 } from "path";
|
|
3609
3552
|
var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
3610
3553
|
json;
|
|
3611
3554
|
constructor(params) {
|
|
@@ -3626,7 +3569,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3626
3569
|
validate = true
|
|
3627
3570
|
}) {
|
|
3628
3571
|
const fileContent = await readFileContent(
|
|
3629
|
-
|
|
3572
|
+
join34(
|
|
3630
3573
|
baseDir,
|
|
3631
3574
|
this.getSettablePaths().relativeDirPath,
|
|
3632
3575
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3673,7 +3616,7 @@ var CursorMcp = class _CursorMcp extends ToolMcp {
|
|
|
3673
3616
|
};
|
|
3674
3617
|
|
|
3675
3618
|
// src/features/mcp/geminicli-mcp.ts
|
|
3676
|
-
import { join as
|
|
3619
|
+
import { join as join35 } from "path";
|
|
3677
3620
|
var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
3678
3621
|
json;
|
|
3679
3622
|
constructor(params) {
|
|
@@ -3702,7 +3645,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3702
3645
|
}) {
|
|
3703
3646
|
const paths = this.getSettablePaths({ global });
|
|
3704
3647
|
const fileContent = await readOrInitializeFileContent(
|
|
3705
|
-
|
|
3648
|
+
join35(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3706
3649
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3707
3650
|
);
|
|
3708
3651
|
const json = JSON.parse(fileContent);
|
|
@@ -3723,7 +3666,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3723
3666
|
}) {
|
|
3724
3667
|
const paths = this.getSettablePaths({ global });
|
|
3725
3668
|
const fileContent = await readOrInitializeFileContent(
|
|
3726
|
-
|
|
3669
|
+
join35(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3727
3670
|
JSON.stringify({ mcpServers: {} }, null, 2)
|
|
3728
3671
|
);
|
|
3729
3672
|
const json = JSON.parse(fileContent);
|
|
@@ -3747,7 +3690,7 @@ var GeminiCliMcp = class _GeminiCliMcp extends ToolMcp {
|
|
|
3747
3690
|
};
|
|
3748
3691
|
|
|
3749
3692
|
// src/features/mcp/junie-mcp.ts
|
|
3750
|
-
import { join as
|
|
3693
|
+
import { join as join36 } from "path";
|
|
3751
3694
|
var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
3752
3695
|
json;
|
|
3753
3696
|
constructor(params) {
|
|
@@ -3759,7 +3702,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3759
3702
|
}
|
|
3760
3703
|
static getSettablePaths() {
|
|
3761
3704
|
return {
|
|
3762
|
-
relativeDirPath:
|
|
3705
|
+
relativeDirPath: join36(".junie", "mcp"),
|
|
3763
3706
|
relativeFilePath: "mcp.json"
|
|
3764
3707
|
};
|
|
3765
3708
|
}
|
|
@@ -3768,7 +3711,7 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3768
3711
|
validate = true
|
|
3769
3712
|
}) {
|
|
3770
3713
|
const fileContent = await readFileContent(
|
|
3771
|
-
|
|
3714
|
+
join36(
|
|
3772
3715
|
baseDir,
|
|
3773
3716
|
this.getSettablePaths().relativeDirPath,
|
|
3774
3717
|
this.getSettablePaths().relativeFilePath
|
|
@@ -3804,28 +3747,28 @@ var JunieMcp = class _JunieMcp extends ToolMcp {
|
|
|
3804
3747
|
};
|
|
3805
3748
|
|
|
3806
3749
|
// src/features/mcp/opencode-mcp.ts
|
|
3807
|
-
import { join as
|
|
3808
|
-
import { z as
|
|
3809
|
-
var OpencodeMcpLocalServerSchema =
|
|
3810
|
-
type:
|
|
3811
|
-
command:
|
|
3812
|
-
environment:
|
|
3813
|
-
enabled:
|
|
3814
|
-
cwd:
|
|
3750
|
+
import { join as join37 } from "path";
|
|
3751
|
+
import { z as z17 } from "zod/mini";
|
|
3752
|
+
var OpencodeMcpLocalServerSchema = z17.object({
|
|
3753
|
+
type: z17.literal("local"),
|
|
3754
|
+
command: z17.array(z17.string()),
|
|
3755
|
+
environment: z17.optional(z17.record(z17.string(), z17.string())),
|
|
3756
|
+
enabled: z17._default(z17.boolean(), true),
|
|
3757
|
+
cwd: z17.optional(z17.string())
|
|
3815
3758
|
});
|
|
3816
|
-
var OpencodeMcpRemoteServerSchema =
|
|
3817
|
-
type:
|
|
3818
|
-
url:
|
|
3819
|
-
headers:
|
|
3820
|
-
enabled:
|
|
3759
|
+
var OpencodeMcpRemoteServerSchema = z17.object({
|
|
3760
|
+
type: z17.literal("remote"),
|
|
3761
|
+
url: z17.string(),
|
|
3762
|
+
headers: z17.optional(z17.record(z17.string(), z17.string())),
|
|
3763
|
+
enabled: z17._default(z17.boolean(), true)
|
|
3821
3764
|
});
|
|
3822
|
-
var OpencodeMcpServerSchema =
|
|
3765
|
+
var OpencodeMcpServerSchema = z17.union([
|
|
3823
3766
|
OpencodeMcpLocalServerSchema,
|
|
3824
3767
|
OpencodeMcpRemoteServerSchema
|
|
3825
3768
|
]);
|
|
3826
|
-
var OpencodeConfigSchema =
|
|
3827
|
-
$schema:
|
|
3828
|
-
mcp:
|
|
3769
|
+
var OpencodeConfigSchema = z17.looseObject({
|
|
3770
|
+
$schema: z17.optional(z17.string()),
|
|
3771
|
+
mcp: z17.optional(z17.record(z17.string(), OpencodeMcpServerSchema))
|
|
3829
3772
|
});
|
|
3830
3773
|
function convertFromOpencodeFormat(opencodeMcp) {
|
|
3831
3774
|
return Object.fromEntries(
|
|
@@ -3928,7 +3871,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3928
3871
|
}) {
|
|
3929
3872
|
const paths = this.getSettablePaths({ global });
|
|
3930
3873
|
const fileContent = await readOrInitializeFileContent(
|
|
3931
|
-
|
|
3874
|
+
join37(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3932
3875
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
3933
3876
|
);
|
|
3934
3877
|
const json = JSON.parse(fileContent);
|
|
@@ -3949,7 +3892,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3949
3892
|
}) {
|
|
3950
3893
|
const paths = this.getSettablePaths({ global });
|
|
3951
3894
|
const fileContent = await readOrInitializeFileContent(
|
|
3952
|
-
|
|
3895
|
+
join37(baseDir, paths.relativeDirPath, paths.relativeFilePath),
|
|
3953
3896
|
JSON.stringify({ mcp: {} }, null, 2)
|
|
3954
3897
|
);
|
|
3955
3898
|
const json = JSON.parse(fileContent);
|
|
@@ -3980,7 +3923,7 @@ var OpencodeMcp = class _OpencodeMcp extends ToolMcp {
|
|
|
3980
3923
|
};
|
|
3981
3924
|
|
|
3982
3925
|
// src/features/mcp/roo-mcp.ts
|
|
3983
|
-
import { join as
|
|
3926
|
+
import { join as join38 } from "path";
|
|
3984
3927
|
var RooMcp = class _RooMcp extends ToolMcp {
|
|
3985
3928
|
json;
|
|
3986
3929
|
constructor(params) {
|
|
@@ -4001,7 +3944,7 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4001
3944
|
validate = true
|
|
4002
3945
|
}) {
|
|
4003
3946
|
const fileContent = await readFileContent(
|
|
4004
|
-
|
|
3947
|
+
join38(
|
|
4005
3948
|
baseDir,
|
|
4006
3949
|
this.getSettablePaths().relativeDirPath,
|
|
4007
3950
|
this.getSettablePaths().relativeFilePath
|
|
@@ -4038,37 +3981,122 @@ var RooMcp = class _RooMcp extends ToolMcp {
|
|
|
4038
3981
|
};
|
|
4039
3982
|
|
|
4040
3983
|
// src/features/mcp/mcp-processor.ts
|
|
4041
|
-
var
|
|
3984
|
+
var mcpProcessorToolTargetTuple = [
|
|
4042
3985
|
"amazonqcli",
|
|
4043
3986
|
"claudecode",
|
|
4044
3987
|
"cline",
|
|
4045
|
-
"
|
|
3988
|
+
"codexcli",
|
|
4046
3989
|
"copilot",
|
|
4047
3990
|
"cursor",
|
|
4048
3991
|
"geminicli",
|
|
3992
|
+
"junie",
|
|
4049
3993
|
"opencode",
|
|
4050
3994
|
"roo"
|
|
4051
3995
|
];
|
|
4052
|
-
var McpProcessorToolTargetSchema =
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
3996
|
+
var McpProcessorToolTargetSchema = z18.enum(mcpProcessorToolTargetTuple);
|
|
3997
|
+
var toolMcpFactories = /* @__PURE__ */ new Map([
|
|
3998
|
+
[
|
|
3999
|
+
"amazonqcli",
|
|
4000
|
+
{
|
|
4001
|
+
class: AmazonqcliMcp,
|
|
4002
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4003
|
+
}
|
|
4004
|
+
],
|
|
4005
|
+
[
|
|
4006
|
+
"claudecode",
|
|
4007
|
+
{
|
|
4008
|
+
class: ClaudecodeMcp,
|
|
4009
|
+
meta: { supportsProject: true, supportsGlobal: true, supportsModular: true }
|
|
4010
|
+
}
|
|
4011
|
+
],
|
|
4012
|
+
[
|
|
4013
|
+
"cline",
|
|
4014
|
+
{
|
|
4015
|
+
class: ClineMcp,
|
|
4016
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4017
|
+
}
|
|
4018
|
+
],
|
|
4019
|
+
[
|
|
4020
|
+
"codexcli",
|
|
4021
|
+
{
|
|
4022
|
+
class: CodexcliMcp,
|
|
4023
|
+
meta: { supportsProject: false, supportsGlobal: true, supportsModular: false }
|
|
4024
|
+
}
|
|
4025
|
+
],
|
|
4026
|
+
[
|
|
4027
|
+
"copilot",
|
|
4028
|
+
{
|
|
4029
|
+
class: CopilotMcp,
|
|
4030
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4031
|
+
}
|
|
4032
|
+
],
|
|
4033
|
+
[
|
|
4034
|
+
"cursor",
|
|
4035
|
+
{
|
|
4036
|
+
class: CursorMcp,
|
|
4037
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4038
|
+
}
|
|
4039
|
+
],
|
|
4040
|
+
[
|
|
4041
|
+
"geminicli",
|
|
4042
|
+
{
|
|
4043
|
+
class: GeminiCliMcp,
|
|
4044
|
+
meta: { supportsProject: true, supportsGlobal: true, supportsModular: false }
|
|
4045
|
+
}
|
|
4046
|
+
],
|
|
4047
|
+
[
|
|
4048
|
+
"junie",
|
|
4049
|
+
{
|
|
4050
|
+
class: JunieMcp,
|
|
4051
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4052
|
+
}
|
|
4053
|
+
],
|
|
4054
|
+
[
|
|
4055
|
+
"opencode",
|
|
4056
|
+
{
|
|
4057
|
+
class: OpencodeMcp,
|
|
4058
|
+
meta: { supportsProject: true, supportsGlobal: true, supportsModular: false }
|
|
4059
|
+
}
|
|
4060
|
+
],
|
|
4061
|
+
[
|
|
4062
|
+
"roo",
|
|
4063
|
+
{
|
|
4064
|
+
class: RooMcp,
|
|
4065
|
+
meta: { supportsProject: true, supportsGlobal: false, supportsModular: false }
|
|
4066
|
+
}
|
|
4067
|
+
]
|
|
4068
|
+
]);
|
|
4069
|
+
var allToolTargetKeys2 = [...toolMcpFactories.keys()];
|
|
4070
|
+
var mcpProcessorToolTargets = allToolTargetKeys2.filter((target) => {
|
|
4071
|
+
const factory = toolMcpFactories.get(target);
|
|
4072
|
+
return factory?.meta.supportsProject ?? false;
|
|
4073
|
+
});
|
|
4074
|
+
var mcpProcessorToolTargetsGlobal = allToolTargetKeys2.filter((target) => {
|
|
4075
|
+
const factory = toolMcpFactories.get(target);
|
|
4076
|
+
return factory?.meta.supportsGlobal ?? false;
|
|
4077
|
+
});
|
|
4078
|
+
var mcpProcessorToolTargetsModular = allToolTargetKeys2.filter((target) => {
|
|
4079
|
+
const factory = toolMcpFactories.get(target);
|
|
4080
|
+
return factory?.meta.supportsModular ?? false;
|
|
4081
|
+
});
|
|
4082
|
+
var defaultGetFactory3 = (target) => {
|
|
4083
|
+
const factory = toolMcpFactories.get(target);
|
|
4084
|
+
if (!factory) {
|
|
4085
|
+
throw new Error(`Unsupported tool target: ${target}`);
|
|
4086
|
+
}
|
|
4087
|
+
return factory;
|
|
4088
|
+
};
|
|
4063
4089
|
var McpProcessor = class extends FeatureProcessor {
|
|
4064
4090
|
toolTarget;
|
|
4065
4091
|
global;
|
|
4066
4092
|
modularMcp;
|
|
4093
|
+
getFactory;
|
|
4067
4094
|
constructor({
|
|
4068
4095
|
baseDir = process.cwd(),
|
|
4069
4096
|
toolTarget,
|
|
4070
4097
|
global = false,
|
|
4071
|
-
modularMcp = false
|
|
4098
|
+
modularMcp = false,
|
|
4099
|
+
getFactory = defaultGetFactory3
|
|
4072
4100
|
}) {
|
|
4073
4101
|
super({ baseDir });
|
|
4074
4102
|
const result = McpProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -4080,6 +4108,7 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4080
4108
|
this.toolTarget = result.data;
|
|
4081
4109
|
this.global = global;
|
|
4082
4110
|
this.modularMcp = modularMcp;
|
|
4111
|
+
this.getFactory = getFactory;
|
|
4083
4112
|
}
|
|
4084
4113
|
/**
|
|
4085
4114
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -4097,100 +4126,18 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4097
4126
|
* Implementation of abstract method from FeatureProcessor
|
|
4098
4127
|
* Load tool-specific MCP configurations and parse them into ToolMcp instances
|
|
4099
4128
|
*/
|
|
4100
|
-
async loadToolFiles({
|
|
4101
|
-
forDeletion = false
|
|
4102
|
-
} = {}) {
|
|
4103
|
-
try {
|
|
4104
|
-
const
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
];
|
|
4113
|
-
}
|
|
4114
|
-
case "claudecode": {
|
|
4115
|
-
return [
|
|
4116
|
-
await ClaudecodeMcp.fromFile({
|
|
4117
|
-
baseDir: this.baseDir,
|
|
4118
|
-
validate: true,
|
|
4119
|
-
global: this.global
|
|
4120
|
-
})
|
|
4121
|
-
];
|
|
4122
|
-
}
|
|
4123
|
-
case "cline": {
|
|
4124
|
-
return [
|
|
4125
|
-
await ClineMcp.fromFile({
|
|
4126
|
-
baseDir: this.baseDir,
|
|
4127
|
-
validate: true
|
|
4128
|
-
})
|
|
4129
|
-
];
|
|
4130
|
-
}
|
|
4131
|
-
case "junie": {
|
|
4132
|
-
return [
|
|
4133
|
-
await JunieMcp.fromFile({
|
|
4134
|
-
baseDir: this.baseDir,
|
|
4135
|
-
validate: true
|
|
4136
|
-
})
|
|
4137
|
-
];
|
|
4138
|
-
}
|
|
4139
|
-
case "codexcli": {
|
|
4140
|
-
return [
|
|
4141
|
-
await CodexcliMcp.fromFile({
|
|
4142
|
-
baseDir: this.baseDir,
|
|
4143
|
-
validate: true,
|
|
4144
|
-
global: this.global
|
|
4145
|
-
})
|
|
4146
|
-
];
|
|
4147
|
-
}
|
|
4148
|
-
case "copilot": {
|
|
4149
|
-
return [
|
|
4150
|
-
await CopilotMcp.fromFile({
|
|
4151
|
-
baseDir: this.baseDir,
|
|
4152
|
-
validate: true
|
|
4153
|
-
})
|
|
4154
|
-
];
|
|
4155
|
-
}
|
|
4156
|
-
case "cursor": {
|
|
4157
|
-
return [
|
|
4158
|
-
await CursorMcp.fromFile({
|
|
4159
|
-
baseDir: this.baseDir,
|
|
4160
|
-
validate: true
|
|
4161
|
-
})
|
|
4162
|
-
];
|
|
4163
|
-
}
|
|
4164
|
-
case "geminicli": {
|
|
4165
|
-
return [
|
|
4166
|
-
await GeminiCliMcp.fromFile({
|
|
4167
|
-
baseDir: this.baseDir,
|
|
4168
|
-
validate: true,
|
|
4169
|
-
global: this.global
|
|
4170
|
-
})
|
|
4171
|
-
];
|
|
4172
|
-
}
|
|
4173
|
-
case "opencode": {
|
|
4174
|
-
return [
|
|
4175
|
-
await OpencodeMcp.fromFile({
|
|
4176
|
-
baseDir: this.baseDir,
|
|
4177
|
-
validate: true,
|
|
4178
|
-
global: this.global
|
|
4179
|
-
})
|
|
4180
|
-
];
|
|
4181
|
-
}
|
|
4182
|
-
case "roo": {
|
|
4183
|
-
return [
|
|
4184
|
-
await RooMcp.fromFile({
|
|
4185
|
-
baseDir: this.baseDir,
|
|
4186
|
-
validate: true
|
|
4187
|
-
})
|
|
4188
|
-
];
|
|
4189
|
-
}
|
|
4190
|
-
default:
|
|
4191
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
4192
|
-
}
|
|
4193
|
-
})();
|
|
4129
|
+
async loadToolFiles({
|
|
4130
|
+
forDeletion = false
|
|
4131
|
+
} = {}) {
|
|
4132
|
+
try {
|
|
4133
|
+
const factory = this.getFactory(this.toolTarget);
|
|
4134
|
+
const toolMcps = [
|
|
4135
|
+
await factory.class.fromFile({
|
|
4136
|
+
baseDir: this.baseDir,
|
|
4137
|
+
validate: true,
|
|
4138
|
+
global: this.global
|
|
4139
|
+
})
|
|
4140
|
+
];
|
|
4194
4141
|
logger.info(`Successfully loaded ${toolMcps.length} ${this.toolTarget} MCP files`);
|
|
4195
4142
|
if (forDeletion) {
|
|
4196
4143
|
return toolMcps.filter((toolFile) => toolFile.isDeletable());
|
|
@@ -4217,72 +4164,22 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4217
4164
|
if (!rulesyncMcp) {
|
|
4218
4165
|
throw new Error(`No ${RULESYNC_MCP_RELATIVE_FILE_PATH} found.`);
|
|
4219
4166
|
}
|
|
4167
|
+
const factory = this.getFactory(this.toolTarget);
|
|
4220
4168
|
const toolMcps = await Promise.all(
|
|
4221
4169
|
[rulesyncMcp].map(async (rulesyncMcp2) => {
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
case "claudecode":
|
|
4229
|
-
return await ClaudecodeMcp.fromRulesyncMcp({
|
|
4230
|
-
baseDir: this.baseDir,
|
|
4231
|
-
rulesyncMcp: rulesyncMcp2,
|
|
4232
|
-
global: this.global,
|
|
4233
|
-
modularMcp: this.modularMcp
|
|
4234
|
-
});
|
|
4235
|
-
case "cline":
|
|
4236
|
-
return ClineMcp.fromRulesyncMcp({
|
|
4237
|
-
baseDir: this.baseDir,
|
|
4238
|
-
rulesyncMcp: rulesyncMcp2
|
|
4239
|
-
});
|
|
4240
|
-
case "junie":
|
|
4241
|
-
return JunieMcp.fromRulesyncMcp({
|
|
4242
|
-
baseDir: this.baseDir,
|
|
4243
|
-
rulesyncMcp: rulesyncMcp2
|
|
4244
|
-
});
|
|
4245
|
-
case "copilot":
|
|
4246
|
-
return CopilotMcp.fromRulesyncMcp({
|
|
4247
|
-
baseDir: this.baseDir,
|
|
4248
|
-
rulesyncMcp: rulesyncMcp2
|
|
4249
|
-
});
|
|
4250
|
-
case "cursor":
|
|
4251
|
-
return CursorMcp.fromRulesyncMcp({
|
|
4252
|
-
baseDir: this.baseDir,
|
|
4253
|
-
rulesyncMcp: rulesyncMcp2
|
|
4254
|
-
});
|
|
4255
|
-
case "codexcli":
|
|
4256
|
-
return await CodexcliMcp.fromRulesyncMcp({
|
|
4257
|
-
baseDir: this.baseDir,
|
|
4258
|
-
rulesyncMcp: rulesyncMcp2,
|
|
4259
|
-
global: this.global
|
|
4260
|
-
});
|
|
4261
|
-
case "geminicli":
|
|
4262
|
-
return GeminiCliMcp.fromRulesyncMcp({
|
|
4263
|
-
baseDir: this.baseDir,
|
|
4264
|
-
rulesyncMcp: rulesyncMcp2,
|
|
4265
|
-
global: this.global
|
|
4266
|
-
});
|
|
4267
|
-
case "opencode":
|
|
4268
|
-
return OpencodeMcp.fromRulesyncMcp({
|
|
4269
|
-
baseDir: this.baseDir,
|
|
4270
|
-
rulesyncMcp: rulesyncMcp2,
|
|
4271
|
-
global: this.global
|
|
4272
|
-
});
|
|
4273
|
-
case "roo":
|
|
4274
|
-
return RooMcp.fromRulesyncMcp({
|
|
4275
|
-
baseDir: this.baseDir,
|
|
4276
|
-
rulesyncMcp: rulesyncMcp2
|
|
4277
|
-
});
|
|
4278
|
-
default:
|
|
4279
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
4280
|
-
}
|
|
4170
|
+
return await factory.class.fromRulesyncMcp({
|
|
4171
|
+
baseDir: this.baseDir,
|
|
4172
|
+
rulesyncMcp: rulesyncMcp2,
|
|
4173
|
+
global: this.global,
|
|
4174
|
+
modularMcp: this.modularMcp
|
|
4175
|
+
});
|
|
4281
4176
|
})
|
|
4282
4177
|
);
|
|
4283
4178
|
const toolFiles = toolMcps;
|
|
4284
4179
|
if (this.modularMcp && mcpProcessorToolTargetsModular.includes(this.toolTarget)) {
|
|
4285
|
-
const relativeDirPath =
|
|
4180
|
+
const relativeDirPath = factory.class.getSettablePaths({
|
|
4181
|
+
global: this.global
|
|
4182
|
+
}).relativeDirPath;
|
|
4286
4183
|
toolFiles.push(
|
|
4287
4184
|
ModularMcp.fromRulesyncMcp({
|
|
4288
4185
|
baseDir: this.baseDir,
|
|
@@ -4317,22 +4214,22 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
4317
4214
|
};
|
|
4318
4215
|
|
|
4319
4216
|
// src/features/rules/rules-processor.ts
|
|
4320
|
-
import { basename as
|
|
4217
|
+
import { basename as basename21, join as join80 } from "path";
|
|
4321
4218
|
import { XMLBuilder } from "fast-xml-parser";
|
|
4322
|
-
import { z as
|
|
4219
|
+
import { z as z31 } from "zod/mini";
|
|
4323
4220
|
|
|
4324
4221
|
// src/features/skills/codexcli-skill.ts
|
|
4325
|
-
import { join as
|
|
4222
|
+
import { join as join41 } from "path";
|
|
4326
4223
|
|
|
4327
4224
|
// src/features/skills/simulated-skill.ts
|
|
4328
|
-
import { join as
|
|
4329
|
-
import { z as
|
|
4225
|
+
import { join as join40 } from "path";
|
|
4226
|
+
import { z as z19 } from "zod/mini";
|
|
4330
4227
|
|
|
4331
4228
|
// src/constants/general.ts
|
|
4332
4229
|
var SKILL_FILE_NAME = "SKILL.md";
|
|
4333
4230
|
|
|
4334
4231
|
// src/types/ai-dir.ts
|
|
4335
|
-
import path2, { basename as
|
|
4232
|
+
import path2, { basename as basename14, join as join39, relative as relative3, resolve as resolve4 } from "path";
|
|
4336
4233
|
var AiDir = class {
|
|
4337
4234
|
/**
|
|
4338
4235
|
* @example "."
|
|
@@ -4426,10 +4323,10 @@ var AiDir = class {
|
|
|
4426
4323
|
* @returns Array of files with their relative paths and buffers
|
|
4427
4324
|
*/
|
|
4428
4325
|
static async collectOtherFiles(baseDir, relativeDirPath, dirName, excludeFileName) {
|
|
4429
|
-
const dirPath =
|
|
4430
|
-
const glob =
|
|
4326
|
+
const dirPath = join39(baseDir, relativeDirPath, dirName);
|
|
4327
|
+
const glob = join39(dirPath, "**", "*");
|
|
4431
4328
|
const filePaths = await findFilesByGlobs(glob, { type: "file" });
|
|
4432
|
-
const filteredPaths = filePaths.filter((filePath) =>
|
|
4329
|
+
const filteredPaths = filePaths.filter((filePath) => basename14(filePath) !== excludeFileName);
|
|
4433
4330
|
const files = await Promise.all(
|
|
4434
4331
|
filteredPaths.map(async (filePath) => {
|
|
4435
4332
|
const fileBuffer = await readFileBuffer(filePath);
|
|
@@ -4500,9 +4397,9 @@ var ToolSkill = class extends AiDir {
|
|
|
4500
4397
|
};
|
|
4501
4398
|
|
|
4502
4399
|
// src/features/skills/simulated-skill.ts
|
|
4503
|
-
var SimulatedSkillFrontmatterSchema =
|
|
4504
|
-
name:
|
|
4505
|
-
description:
|
|
4400
|
+
var SimulatedSkillFrontmatterSchema = z19.object({
|
|
4401
|
+
name: z19.string(),
|
|
4402
|
+
description: z19.string()
|
|
4506
4403
|
});
|
|
4507
4404
|
var SimulatedSkill = class extends ToolSkill {
|
|
4508
4405
|
frontmatter;
|
|
@@ -4533,7 +4430,7 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4533
4430
|
const result = SimulatedSkillFrontmatterSchema.safeParse(frontmatter);
|
|
4534
4431
|
if (!result.success) {
|
|
4535
4432
|
throw new Error(
|
|
4536
|
-
`Invalid frontmatter in ${
|
|
4433
|
+
`Invalid frontmatter in ${join40(relativeDirPath, dirName)}: ${formatError(result.error)}`
|
|
4537
4434
|
);
|
|
4538
4435
|
}
|
|
4539
4436
|
}
|
|
@@ -4591,8 +4488,8 @@ var SimulatedSkill = class extends ToolSkill {
|
|
|
4591
4488
|
}) {
|
|
4592
4489
|
const settablePaths = this.getSettablePaths();
|
|
4593
4490
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
4594
|
-
const skillDirPath =
|
|
4595
|
-
const skillFilePath =
|
|
4491
|
+
const skillDirPath = join40(baseDir, actualRelativeDirPath, dirName);
|
|
4492
|
+
const skillFilePath = join40(skillDirPath, SKILL_FILE_NAME);
|
|
4596
4493
|
if (!await fileExists(skillFilePath)) {
|
|
4597
4494
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4598
4495
|
}
|
|
@@ -4649,7 +4546,7 @@ var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
|
|
|
4649
4546
|
throw new Error("CodexCliSkill does not support global mode.");
|
|
4650
4547
|
}
|
|
4651
4548
|
return {
|
|
4652
|
-
relativeDirPath:
|
|
4549
|
+
relativeDirPath: join41(".codex", "skills")
|
|
4653
4550
|
};
|
|
4654
4551
|
}
|
|
4655
4552
|
static async fromDir(params) {
|
|
@@ -4672,14 +4569,14 @@ var CodexCliSkill = class _CodexCliSkill extends SimulatedSkill {
|
|
|
4672
4569
|
};
|
|
4673
4570
|
|
|
4674
4571
|
// src/features/skills/copilot-skill.ts
|
|
4675
|
-
import { join as
|
|
4572
|
+
import { join as join42 } from "path";
|
|
4676
4573
|
var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
4677
4574
|
static getSettablePaths(options) {
|
|
4678
4575
|
if (options?.global) {
|
|
4679
4576
|
throw new Error("CopilotSkill does not support global mode.");
|
|
4680
4577
|
}
|
|
4681
4578
|
return {
|
|
4682
|
-
relativeDirPath:
|
|
4579
|
+
relativeDirPath: join42(".github", "skills")
|
|
4683
4580
|
};
|
|
4684
4581
|
}
|
|
4685
4582
|
static async fromDir(params) {
|
|
@@ -4702,14 +4599,14 @@ var CopilotSkill = class _CopilotSkill extends SimulatedSkill {
|
|
|
4702
4599
|
};
|
|
4703
4600
|
|
|
4704
4601
|
// src/features/skills/cursor-skill.ts
|
|
4705
|
-
import { join as
|
|
4602
|
+
import { join as join43 } from "path";
|
|
4706
4603
|
var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
4707
4604
|
static getSettablePaths(options) {
|
|
4708
4605
|
if (options?.global) {
|
|
4709
4606
|
throw new Error("CursorSkill does not support global mode.");
|
|
4710
4607
|
}
|
|
4711
4608
|
return {
|
|
4712
|
-
relativeDirPath:
|
|
4609
|
+
relativeDirPath: join43(".cursor", "skills")
|
|
4713
4610
|
};
|
|
4714
4611
|
}
|
|
4715
4612
|
static async fromDir(params) {
|
|
@@ -4732,11 +4629,11 @@ var CursorSkill = class _CursorSkill extends SimulatedSkill {
|
|
|
4732
4629
|
};
|
|
4733
4630
|
|
|
4734
4631
|
// src/features/skills/skills-processor.ts
|
|
4735
|
-
import { basename as
|
|
4736
|
-
import { z as
|
|
4632
|
+
import { basename as basename15, join as join49 } from "path";
|
|
4633
|
+
import { z as z22 } from "zod/mini";
|
|
4737
4634
|
|
|
4738
4635
|
// src/types/dir-feature-processor.ts
|
|
4739
|
-
import { join as
|
|
4636
|
+
import { join as join44 } from "path";
|
|
4740
4637
|
var DirFeatureProcessor = class {
|
|
4741
4638
|
baseDir;
|
|
4742
4639
|
constructor({ baseDir = process.cwd() }) {
|
|
@@ -4758,14 +4655,14 @@ var DirFeatureProcessor = class {
|
|
|
4758
4655
|
await ensureDir(dirPath);
|
|
4759
4656
|
const mainFile = aiDir.getMainFile();
|
|
4760
4657
|
if (mainFile) {
|
|
4761
|
-
const mainFilePath =
|
|
4658
|
+
const mainFilePath = join44(dirPath, mainFile.name);
|
|
4762
4659
|
const content = stringifyFrontmatter(mainFile.body, mainFile.frontmatter);
|
|
4763
4660
|
const contentWithNewline = addTrailingNewline(content);
|
|
4764
4661
|
await writeFileContent(mainFilePath, contentWithNewline);
|
|
4765
4662
|
}
|
|
4766
4663
|
const otherFiles = aiDir.getOtherFiles();
|
|
4767
4664
|
for (const file of otherFiles) {
|
|
4768
|
-
const filePath =
|
|
4665
|
+
const filePath = join44(dirPath, file.relativeFilePathToDirPath);
|
|
4769
4666
|
const contentWithNewline = addTrailingNewline(file.fileBuffer.toString("utf-8"));
|
|
4770
4667
|
await writeFileContent(filePath, contentWithNewline);
|
|
4771
4668
|
}
|
|
@@ -4780,14 +4677,14 @@ var DirFeatureProcessor = class {
|
|
|
4780
4677
|
};
|
|
4781
4678
|
|
|
4782
4679
|
// src/features/skills/agentsmd-skill.ts
|
|
4783
|
-
import { join as
|
|
4680
|
+
import { join as join45 } from "path";
|
|
4784
4681
|
var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
4785
4682
|
static getSettablePaths(options) {
|
|
4786
4683
|
if (options?.global) {
|
|
4787
4684
|
throw new Error("AgentsmdSkill does not support global mode.");
|
|
4788
4685
|
}
|
|
4789
4686
|
return {
|
|
4790
|
-
relativeDirPath:
|
|
4687
|
+
relativeDirPath: join45(".agents", "skills")
|
|
4791
4688
|
};
|
|
4792
4689
|
}
|
|
4793
4690
|
static async fromDir(params) {
|
|
@@ -4810,19 +4707,19 @@ var AgentsmdSkill = class _AgentsmdSkill extends SimulatedSkill {
|
|
|
4810
4707
|
};
|
|
4811
4708
|
|
|
4812
4709
|
// src/features/skills/claudecode-skill.ts
|
|
4813
|
-
import { join as
|
|
4814
|
-
import { z as
|
|
4710
|
+
import { join as join47 } from "path";
|
|
4711
|
+
import { z as z21 } from "zod/mini";
|
|
4815
4712
|
|
|
4816
4713
|
// src/features/skills/rulesync-skill.ts
|
|
4817
|
-
import { join as
|
|
4818
|
-
import { z as
|
|
4819
|
-
var RulesyncSkillFrontmatterSchemaInternal =
|
|
4820
|
-
name:
|
|
4821
|
-
description:
|
|
4822
|
-
targets:
|
|
4823
|
-
claudecode:
|
|
4824
|
-
|
|
4825
|
-
"allowed-tools":
|
|
4714
|
+
import { join as join46 } from "path";
|
|
4715
|
+
import { z as z20 } from "zod/mini";
|
|
4716
|
+
var RulesyncSkillFrontmatterSchemaInternal = z20.object({
|
|
4717
|
+
name: z20.string(),
|
|
4718
|
+
description: z20.string(),
|
|
4719
|
+
targets: z20._default(RulesyncTargetsSchema, ["*"]),
|
|
4720
|
+
claudecode: z20.optional(
|
|
4721
|
+
z20.object({
|
|
4722
|
+
"allowed-tools": z20.optional(z20.array(z20.string()))
|
|
4826
4723
|
})
|
|
4827
4724
|
)
|
|
4828
4725
|
});
|
|
@@ -4890,8 +4787,8 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4890
4787
|
dirName,
|
|
4891
4788
|
global = false
|
|
4892
4789
|
}) {
|
|
4893
|
-
const skillDirPath =
|
|
4894
|
-
const skillFilePath =
|
|
4790
|
+
const skillDirPath = join46(baseDir, relativeDirPath, dirName);
|
|
4791
|
+
const skillFilePath = join46(skillDirPath, SKILL_FILE_NAME);
|
|
4895
4792
|
if (!await fileExists(skillFilePath)) {
|
|
4896
4793
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
4897
4794
|
}
|
|
@@ -4921,15 +4818,15 @@ var RulesyncSkill = class _RulesyncSkill extends AiDir {
|
|
|
4921
4818
|
};
|
|
4922
4819
|
|
|
4923
4820
|
// src/features/skills/claudecode-skill.ts
|
|
4924
|
-
var ClaudecodeSkillFrontmatterSchema =
|
|
4925
|
-
name:
|
|
4926
|
-
description:
|
|
4927
|
-
"allowed-tools":
|
|
4821
|
+
var ClaudecodeSkillFrontmatterSchema = z21.object({
|
|
4822
|
+
name: z21.string(),
|
|
4823
|
+
description: z21.string(),
|
|
4824
|
+
"allowed-tools": z21.optional(z21.array(z21.string()))
|
|
4928
4825
|
});
|
|
4929
4826
|
var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
4930
4827
|
constructor({
|
|
4931
4828
|
baseDir = process.cwd(),
|
|
4932
|
-
relativeDirPath =
|
|
4829
|
+
relativeDirPath = join47(".claude", "skills"),
|
|
4933
4830
|
dirName,
|
|
4934
4831
|
frontmatter,
|
|
4935
4832
|
body,
|
|
@@ -4960,7 +4857,7 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
4960
4857
|
global: _global = false
|
|
4961
4858
|
} = {}) {
|
|
4962
4859
|
return {
|
|
4963
|
-
relativeDirPath:
|
|
4860
|
+
relativeDirPath: join47(".claude", "skills")
|
|
4964
4861
|
};
|
|
4965
4862
|
}
|
|
4966
4863
|
getFrontmatter() {
|
|
@@ -5048,8 +4945,8 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5048
4945
|
}) {
|
|
5049
4946
|
const settablePaths = this.getSettablePaths({ global });
|
|
5050
4947
|
const actualRelativeDirPath = relativeDirPath ?? settablePaths.relativeDirPath;
|
|
5051
|
-
const skillDirPath =
|
|
5052
|
-
const skillFilePath =
|
|
4948
|
+
const skillDirPath = join47(baseDir, actualRelativeDirPath, dirName);
|
|
4949
|
+
const skillFilePath = join47(skillDirPath, SKILL_FILE_NAME);
|
|
5053
4950
|
if (!await fileExists(skillFilePath)) {
|
|
5054
4951
|
throw new Error(`${SKILL_FILE_NAME} not found in ${skillDirPath}`);
|
|
5055
4952
|
}
|
|
@@ -5079,14 +4976,14 @@ var ClaudecodeSkill = class _ClaudecodeSkill extends ToolSkill {
|
|
|
5079
4976
|
};
|
|
5080
4977
|
|
|
5081
4978
|
// src/features/skills/geminicli-skill.ts
|
|
5082
|
-
import { join as
|
|
4979
|
+
import { join as join48 } from "path";
|
|
5083
4980
|
var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
5084
4981
|
static getSettablePaths(options) {
|
|
5085
4982
|
if (options?.global) {
|
|
5086
4983
|
throw new Error("GeminiCliSkill does not support global mode.");
|
|
5087
4984
|
}
|
|
5088
4985
|
return {
|
|
5089
|
-
relativeDirPath:
|
|
4986
|
+
relativeDirPath: join48(".gemini", "skills")
|
|
5090
4987
|
};
|
|
5091
4988
|
}
|
|
5092
4989
|
static async fromDir(params) {
|
|
@@ -5109,30 +5006,57 @@ var GeminiCliSkill = class _GeminiCliSkill extends SimulatedSkill {
|
|
|
5109
5006
|
};
|
|
5110
5007
|
|
|
5111
5008
|
// src/features/skills/skills-processor.ts
|
|
5112
|
-
var
|
|
5009
|
+
var skillsProcessorToolTargetTuple = [
|
|
5010
|
+
"agentsmd",
|
|
5113
5011
|
"claudecode",
|
|
5114
|
-
"copilot",
|
|
5115
|
-
"cursor",
|
|
5116
5012
|
"codexcli",
|
|
5117
|
-
"geminicli",
|
|
5118
|
-
"agentsmd"
|
|
5119
|
-
];
|
|
5120
|
-
var skillsProcessorToolTargetsSimulated = [
|
|
5121
5013
|
"copilot",
|
|
5122
5014
|
"cursor",
|
|
5123
|
-
"
|
|
5124
|
-
"geminicli",
|
|
5125
|
-
"agentsmd"
|
|
5015
|
+
"geminicli"
|
|
5126
5016
|
];
|
|
5127
|
-
var
|
|
5128
|
-
var
|
|
5017
|
+
var SkillsProcessorToolTargetSchema = z22.enum(skillsProcessorToolTargetTuple);
|
|
5018
|
+
var toolSkillFactories = /* @__PURE__ */ new Map([
|
|
5019
|
+
["agentsmd", { class: AgentsmdSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5020
|
+
[
|
|
5021
|
+
"claudecode",
|
|
5022
|
+
{ class: ClaudecodeSkill, meta: { supportsSimulated: false, supportsGlobal: true } }
|
|
5023
|
+
],
|
|
5024
|
+
["codexcli", { class: CodexCliSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5025
|
+
["copilot", { class: CopilotSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5026
|
+
["cursor", { class: CursorSkill, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5027
|
+
[
|
|
5028
|
+
"geminicli",
|
|
5029
|
+
{ class: GeminiCliSkill, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
5030
|
+
]
|
|
5031
|
+
]);
|
|
5032
|
+
var defaultGetFactory4 = (target) => {
|
|
5033
|
+
const factory = toolSkillFactories.get(target);
|
|
5034
|
+
if (!factory) {
|
|
5035
|
+
throw new Error(`Unsupported tool target: ${target}`);
|
|
5036
|
+
}
|
|
5037
|
+
return factory;
|
|
5038
|
+
};
|
|
5039
|
+
var allToolTargetKeys3 = [...toolSkillFactories.keys()];
|
|
5040
|
+
var skillsProcessorToolTargets = allToolTargetKeys3;
|
|
5041
|
+
var skillsProcessorToolTargetsSimulated = allToolTargetKeys3.filter(
|
|
5042
|
+
(target) => {
|
|
5043
|
+
const factory = toolSkillFactories.get(target);
|
|
5044
|
+
return factory?.meta.supportsSimulated ?? false;
|
|
5045
|
+
}
|
|
5046
|
+
);
|
|
5047
|
+
var skillsProcessorToolTargetsGlobal = allToolTargetKeys3.filter((target) => {
|
|
5048
|
+
const factory = toolSkillFactories.get(target);
|
|
5049
|
+
return factory?.meta.supportsGlobal ?? false;
|
|
5050
|
+
});
|
|
5129
5051
|
var SkillsProcessor = class extends DirFeatureProcessor {
|
|
5130
5052
|
toolTarget;
|
|
5131
5053
|
global;
|
|
5054
|
+
getFactory;
|
|
5132
5055
|
constructor({
|
|
5133
5056
|
baseDir = process.cwd(),
|
|
5134
5057
|
toolTarget,
|
|
5135
|
-
global = false
|
|
5058
|
+
global = false,
|
|
5059
|
+
getFactory = defaultGetFactory4
|
|
5136
5060
|
}) {
|
|
5137
5061
|
super({ baseDir });
|
|
5138
5062
|
const result = SkillsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -5143,79 +5067,22 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5143
5067
|
}
|
|
5144
5068
|
this.toolTarget = result.data;
|
|
5145
5069
|
this.global = global;
|
|
5070
|
+
this.getFactory = getFactory;
|
|
5146
5071
|
}
|
|
5147
5072
|
async convertRulesyncDirsToToolDirs(rulesyncDirs) {
|
|
5148
5073
|
const rulesyncSkills = rulesyncDirs.filter(
|
|
5149
5074
|
(dir) => dir instanceof RulesyncSkill
|
|
5150
5075
|
);
|
|
5151
|
-
const
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
if (!ClaudecodeSkill.isTargetedByRulesyncSkill(rulesyncSkill)) {
|
|
5156
|
-
continue;
|
|
5157
|
-
}
|
|
5158
|
-
toolSkills.push(
|
|
5159
|
-
ClaudecodeSkill.fromRulesyncSkill({
|
|
5160
|
-
rulesyncSkill,
|
|
5161
|
-
global: this.global
|
|
5162
|
-
})
|
|
5163
|
-
);
|
|
5164
|
-
break;
|
|
5165
|
-
case "copilot":
|
|
5166
|
-
if (!CopilotSkill.isTargetedByRulesyncSkill(rulesyncSkill)) {
|
|
5167
|
-
continue;
|
|
5168
|
-
}
|
|
5169
|
-
toolSkills.push(
|
|
5170
|
-
CopilotSkill.fromRulesyncSkill({
|
|
5171
|
-
rulesyncSkill
|
|
5172
|
-
})
|
|
5173
|
-
);
|
|
5174
|
-
break;
|
|
5175
|
-
case "cursor":
|
|
5176
|
-
if (!CursorSkill.isTargetedByRulesyncSkill(rulesyncSkill)) {
|
|
5177
|
-
continue;
|
|
5178
|
-
}
|
|
5179
|
-
toolSkills.push(
|
|
5180
|
-
CursorSkill.fromRulesyncSkill({
|
|
5181
|
-
rulesyncSkill
|
|
5182
|
-
})
|
|
5183
|
-
);
|
|
5184
|
-
break;
|
|
5185
|
-
case "codexcli":
|
|
5186
|
-
if (!CodexCliSkill.isTargetedByRulesyncSkill(rulesyncSkill)) {
|
|
5187
|
-
continue;
|
|
5188
|
-
}
|
|
5189
|
-
toolSkills.push(
|
|
5190
|
-
CodexCliSkill.fromRulesyncSkill({
|
|
5191
|
-
rulesyncSkill
|
|
5192
|
-
})
|
|
5193
|
-
);
|
|
5194
|
-
break;
|
|
5195
|
-
case "geminicli":
|
|
5196
|
-
if (!GeminiCliSkill.isTargetedByRulesyncSkill(rulesyncSkill)) {
|
|
5197
|
-
continue;
|
|
5198
|
-
}
|
|
5199
|
-
toolSkills.push(
|
|
5200
|
-
GeminiCliSkill.fromRulesyncSkill({
|
|
5201
|
-
rulesyncSkill
|
|
5202
|
-
})
|
|
5203
|
-
);
|
|
5204
|
-
break;
|
|
5205
|
-
case "agentsmd":
|
|
5206
|
-
if (!AgentsmdSkill.isTargetedByRulesyncSkill(rulesyncSkill)) {
|
|
5207
|
-
continue;
|
|
5208
|
-
}
|
|
5209
|
-
toolSkills.push(
|
|
5210
|
-
AgentsmdSkill.fromRulesyncSkill({
|
|
5211
|
-
rulesyncSkill
|
|
5212
|
-
})
|
|
5213
|
-
);
|
|
5214
|
-
break;
|
|
5215
|
-
default:
|
|
5216
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
5076
|
+
const factory = this.getFactory(this.toolTarget);
|
|
5077
|
+
const toolSkills = rulesyncSkills.map((rulesyncSkill) => {
|
|
5078
|
+
if (!factory.class.isTargetedByRulesyncSkill(rulesyncSkill)) {
|
|
5079
|
+
return null;
|
|
5217
5080
|
}
|
|
5218
|
-
|
|
5081
|
+
return factory.class.fromRulesyncSkill({
|
|
5082
|
+
rulesyncSkill,
|
|
5083
|
+
global: this.global
|
|
5084
|
+
});
|
|
5085
|
+
}).filter((skill) => skill !== null);
|
|
5219
5086
|
return toolSkills;
|
|
5220
5087
|
}
|
|
5221
5088
|
async convertToolDirsToRulesyncDirs(toolDirs) {
|
|
@@ -5236,9 +5103,9 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5236
5103
|
*/
|
|
5237
5104
|
async loadRulesyncDirs() {
|
|
5238
5105
|
const paths = RulesyncSkill.getSettablePaths();
|
|
5239
|
-
const rulesyncSkillsDirPath =
|
|
5240
|
-
const dirPaths = await findFilesByGlobs(
|
|
5241
|
-
const dirNames = dirPaths.map((path3) =>
|
|
5106
|
+
const rulesyncSkillsDirPath = join49(this.baseDir, paths.relativeDirPath);
|
|
5107
|
+
const dirPaths = await findFilesByGlobs(join49(rulesyncSkillsDirPath, "*"), { type: "dir" });
|
|
5108
|
+
const dirNames = dirPaths.map((path3) => basename15(path3));
|
|
5242
5109
|
const rulesyncSkills = await Promise.all(
|
|
5243
5110
|
dirNames.map(
|
|
5244
5111
|
(dirName) => RulesyncSkill.fromDir({ baseDir: this.baseDir, dirName, global: this.global })
|
|
@@ -5252,37 +5119,14 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5252
5119
|
* Load tool-specific skill configurations and parse them into ToolSkill instances
|
|
5253
5120
|
*/
|
|
5254
5121
|
async loadToolDirs() {
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
case "cursor":
|
|
5261
|
-
return await this.loadSimulatedSkills(CursorSkill);
|
|
5262
|
-
case "codexcli":
|
|
5263
|
-
return await this.loadSimulatedSkills(CodexCliSkill);
|
|
5264
|
-
case "geminicli":
|
|
5265
|
-
return await this.loadSimulatedSkills(GeminiCliSkill);
|
|
5266
|
-
case "agentsmd":
|
|
5267
|
-
return await this.loadSimulatedSkills(AgentsmdSkill);
|
|
5268
|
-
default:
|
|
5269
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
5270
|
-
}
|
|
5271
|
-
}
|
|
5272
|
-
async loadToolDirsToDelete() {
|
|
5273
|
-
return this.loadToolDirs();
|
|
5274
|
-
}
|
|
5275
|
-
/**
|
|
5276
|
-
* Load Claude Code skill configurations from .claude/skills/ directory
|
|
5277
|
-
*/
|
|
5278
|
-
async loadClaudecodeSkills() {
|
|
5279
|
-
const paths = ClaudecodeSkill.getSettablePaths({ global: this.global });
|
|
5280
|
-
const skillsDirPath = join48(this.baseDir, paths.relativeDirPath);
|
|
5281
|
-
const dirPaths = await findFilesByGlobs(join48(skillsDirPath, "*"), { type: "dir" });
|
|
5282
|
-
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5122
|
+
const factory = this.getFactory(this.toolTarget);
|
|
5123
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
5124
|
+
const skillsDirPath = join49(this.baseDir, paths.relativeDirPath);
|
|
5125
|
+
const dirPaths = await findFilesByGlobs(join49(skillsDirPath, "*"), { type: "dir" });
|
|
5126
|
+
const dirNames = dirPaths.map((path3) => basename15(path3));
|
|
5283
5127
|
const toolSkills = await Promise.all(
|
|
5284
5128
|
dirNames.map(
|
|
5285
|
-
(dirName) =>
|
|
5129
|
+
(dirName) => factory.class.fromDir({
|
|
5286
5130
|
baseDir: this.baseDir,
|
|
5287
5131
|
dirName,
|
|
5288
5132
|
global: this.global
|
|
@@ -5292,24 +5136,8 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5292
5136
|
logger.info(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
5293
5137
|
return toolSkills;
|
|
5294
5138
|
}
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
*/
|
|
5298
|
-
async loadSimulatedSkills(SkillClass) {
|
|
5299
|
-
const paths = SkillClass.getSettablePaths();
|
|
5300
|
-
const skillsDirPath = join48(this.baseDir, paths.relativeDirPath);
|
|
5301
|
-
const dirPaths = await findFilesByGlobs(join48(skillsDirPath, "*"), { type: "dir" });
|
|
5302
|
-
const dirNames = dirPaths.map((path3) => basename14(path3));
|
|
5303
|
-
const toolSkills = await Promise.all(
|
|
5304
|
-
dirNames.map(
|
|
5305
|
-
(dirName) => SkillClass.fromDir({
|
|
5306
|
-
baseDir: this.baseDir,
|
|
5307
|
-
dirName
|
|
5308
|
-
})
|
|
5309
|
-
)
|
|
5310
|
-
);
|
|
5311
|
-
logger.info(`Successfully loaded ${toolSkills.length} ${paths.relativeDirPath} skills`);
|
|
5312
|
-
return toolSkills;
|
|
5139
|
+
async loadToolDirsToDelete() {
|
|
5140
|
+
return this.loadToolDirs();
|
|
5313
5141
|
}
|
|
5314
5142
|
/**
|
|
5315
5143
|
* Implementation of abstract method from DirFeatureProcessor
|
|
@@ -5344,11 +5172,11 @@ var SkillsProcessor = class extends DirFeatureProcessor {
|
|
|
5344
5172
|
};
|
|
5345
5173
|
|
|
5346
5174
|
// src/features/subagents/agentsmd-subagent.ts
|
|
5347
|
-
import { join as
|
|
5175
|
+
import { join as join51 } from "path";
|
|
5348
5176
|
|
|
5349
5177
|
// src/features/subagents/simulated-subagent.ts
|
|
5350
|
-
import { basename as
|
|
5351
|
-
import { z as
|
|
5178
|
+
import { basename as basename16, join as join50 } from "path";
|
|
5179
|
+
import { z as z23 } from "zod/mini";
|
|
5352
5180
|
|
|
5353
5181
|
// src/features/subagents/tool-subagent.ts
|
|
5354
5182
|
var ToolSubagent = class extends ToolFile {
|
|
@@ -5383,9 +5211,9 @@ var ToolSubagent = class extends ToolFile {
|
|
|
5383
5211
|
};
|
|
5384
5212
|
|
|
5385
5213
|
// src/features/subagents/simulated-subagent.ts
|
|
5386
|
-
var SimulatedSubagentFrontmatterSchema =
|
|
5387
|
-
name:
|
|
5388
|
-
description:
|
|
5214
|
+
var SimulatedSubagentFrontmatterSchema = z23.object({
|
|
5215
|
+
name: z23.string(),
|
|
5216
|
+
description: z23.string()
|
|
5389
5217
|
});
|
|
5390
5218
|
var SimulatedSubagent = class extends ToolSubagent {
|
|
5391
5219
|
frontmatter;
|
|
@@ -5395,7 +5223,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5395
5223
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5396
5224
|
if (!result.success) {
|
|
5397
5225
|
throw new Error(
|
|
5398
|
-
`Invalid frontmatter in ${
|
|
5226
|
+
`Invalid frontmatter in ${join50(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5399
5227
|
);
|
|
5400
5228
|
}
|
|
5401
5229
|
}
|
|
@@ -5446,7 +5274,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5446
5274
|
return {
|
|
5447
5275
|
success: false,
|
|
5448
5276
|
error: new Error(
|
|
5449
|
-
`Invalid frontmatter in ${
|
|
5277
|
+
`Invalid frontmatter in ${join50(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5450
5278
|
)
|
|
5451
5279
|
};
|
|
5452
5280
|
}
|
|
@@ -5456,7 +5284,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5456
5284
|
relativeFilePath,
|
|
5457
5285
|
validate = true
|
|
5458
5286
|
}) {
|
|
5459
|
-
const filePath =
|
|
5287
|
+
const filePath = join50(baseDir, this.getSettablePaths().relativeDirPath, relativeFilePath);
|
|
5460
5288
|
const fileContent = await readFileContent(filePath);
|
|
5461
5289
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5462
5290
|
const result = SimulatedSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5466,7 +5294,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5466
5294
|
return {
|
|
5467
5295
|
baseDir,
|
|
5468
5296
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
5469
|
-
relativeFilePath:
|
|
5297
|
+
relativeFilePath: basename16(relativeFilePath),
|
|
5470
5298
|
frontmatter: result.data,
|
|
5471
5299
|
body: content.trim(),
|
|
5472
5300
|
validate
|
|
@@ -5478,7 +5306,7 @@ var SimulatedSubagent = class extends ToolSubagent {
|
|
|
5478
5306
|
var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
5479
5307
|
static getSettablePaths() {
|
|
5480
5308
|
return {
|
|
5481
|
-
relativeDirPath:
|
|
5309
|
+
relativeDirPath: join51(".agents", "subagents")
|
|
5482
5310
|
};
|
|
5483
5311
|
}
|
|
5484
5312
|
static async fromFile(params) {
|
|
@@ -5498,11 +5326,11 @@ var AgentsmdSubagent = class _AgentsmdSubagent extends SimulatedSubagent {
|
|
|
5498
5326
|
};
|
|
5499
5327
|
|
|
5500
5328
|
// src/features/subagents/codexcli-subagent.ts
|
|
5501
|
-
import { join as
|
|
5329
|
+
import { join as join52 } from "path";
|
|
5502
5330
|
var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
5503
5331
|
static getSettablePaths() {
|
|
5504
5332
|
return {
|
|
5505
|
-
relativeDirPath:
|
|
5333
|
+
relativeDirPath: join52(".codex", "subagents")
|
|
5506
5334
|
};
|
|
5507
5335
|
}
|
|
5508
5336
|
static async fromFile(params) {
|
|
@@ -5522,11 +5350,11 @@ var CodexCliSubagent = class _CodexCliSubagent extends SimulatedSubagent {
|
|
|
5522
5350
|
};
|
|
5523
5351
|
|
|
5524
5352
|
// src/features/subagents/copilot-subagent.ts
|
|
5525
|
-
import { join as
|
|
5353
|
+
import { join as join53 } from "path";
|
|
5526
5354
|
var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
5527
5355
|
static getSettablePaths() {
|
|
5528
5356
|
return {
|
|
5529
|
-
relativeDirPath:
|
|
5357
|
+
relativeDirPath: join53(".github", "subagents")
|
|
5530
5358
|
};
|
|
5531
5359
|
}
|
|
5532
5360
|
static async fromFile(params) {
|
|
@@ -5546,11 +5374,11 @@ var CopilotSubagent = class _CopilotSubagent extends SimulatedSubagent {
|
|
|
5546
5374
|
};
|
|
5547
5375
|
|
|
5548
5376
|
// src/features/subagents/cursor-subagent.ts
|
|
5549
|
-
import { join as
|
|
5377
|
+
import { join as join54 } from "path";
|
|
5550
5378
|
var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
5551
5379
|
static getSettablePaths() {
|
|
5552
5380
|
return {
|
|
5553
|
-
relativeDirPath:
|
|
5381
|
+
relativeDirPath: join54(".cursor", "subagents")
|
|
5554
5382
|
};
|
|
5555
5383
|
}
|
|
5556
5384
|
static async fromFile(params) {
|
|
@@ -5570,11 +5398,11 @@ var CursorSubagent = class _CursorSubagent extends SimulatedSubagent {
|
|
|
5570
5398
|
};
|
|
5571
5399
|
|
|
5572
5400
|
// src/features/subagents/geminicli-subagent.ts
|
|
5573
|
-
import { join as
|
|
5401
|
+
import { join as join55 } from "path";
|
|
5574
5402
|
var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
5575
5403
|
static getSettablePaths() {
|
|
5576
5404
|
return {
|
|
5577
|
-
relativeDirPath:
|
|
5405
|
+
relativeDirPath: join55(".gemini", "subagents")
|
|
5578
5406
|
};
|
|
5579
5407
|
}
|
|
5580
5408
|
static async fromFile(params) {
|
|
@@ -5594,11 +5422,11 @@ var GeminiCliSubagent = class _GeminiCliSubagent extends SimulatedSubagent {
|
|
|
5594
5422
|
};
|
|
5595
5423
|
|
|
5596
5424
|
// src/features/subagents/roo-subagent.ts
|
|
5597
|
-
import { join as
|
|
5425
|
+
import { join as join56 } from "path";
|
|
5598
5426
|
var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
5599
5427
|
static getSettablePaths() {
|
|
5600
5428
|
return {
|
|
5601
|
-
relativeDirPath:
|
|
5429
|
+
relativeDirPath: join56(".roo", "subagents")
|
|
5602
5430
|
};
|
|
5603
5431
|
}
|
|
5604
5432
|
static async fromFile(params) {
|
|
@@ -5618,20 +5446,20 @@ var RooSubagent = class _RooSubagent extends SimulatedSubagent {
|
|
|
5618
5446
|
};
|
|
5619
5447
|
|
|
5620
5448
|
// src/features/subagents/subagents-processor.ts
|
|
5621
|
-
import { basename as
|
|
5622
|
-
import { z as
|
|
5449
|
+
import { basename as basename18, join as join59 } from "path";
|
|
5450
|
+
import { z as z26 } from "zod/mini";
|
|
5623
5451
|
|
|
5624
5452
|
// src/features/subagents/claudecode-subagent.ts
|
|
5625
|
-
import { join as
|
|
5626
|
-
import { z as
|
|
5453
|
+
import { join as join58 } from "path";
|
|
5454
|
+
import { z as z25 } from "zod/mini";
|
|
5627
5455
|
|
|
5628
5456
|
// src/features/subagents/rulesync-subagent.ts
|
|
5629
|
-
import { basename as
|
|
5630
|
-
import { z as
|
|
5631
|
-
var RulesyncSubagentFrontmatterSchema =
|
|
5457
|
+
import { basename as basename17, join as join57 } from "path";
|
|
5458
|
+
import { z as z24 } from "zod/mini";
|
|
5459
|
+
var RulesyncSubagentFrontmatterSchema = z24.looseObject({
|
|
5632
5460
|
targets: RulesyncTargetsSchema,
|
|
5633
|
-
name:
|
|
5634
|
-
description:
|
|
5461
|
+
name: z24.string(),
|
|
5462
|
+
description: z24.string()
|
|
5635
5463
|
});
|
|
5636
5464
|
var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
5637
5465
|
frontmatter;
|
|
@@ -5641,7 +5469,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5641
5469
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5642
5470
|
if (!result.success) {
|
|
5643
5471
|
throw new Error(
|
|
5644
|
-
`Invalid frontmatter in ${
|
|
5472
|
+
`Invalid frontmatter in ${join57(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5645
5473
|
);
|
|
5646
5474
|
}
|
|
5647
5475
|
}
|
|
@@ -5674,7 +5502,7 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5674
5502
|
return {
|
|
5675
5503
|
success: false,
|
|
5676
5504
|
error: new Error(
|
|
5677
|
-
`Invalid frontmatter in ${
|
|
5505
|
+
`Invalid frontmatter in ${join57(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5678
5506
|
)
|
|
5679
5507
|
};
|
|
5680
5508
|
}
|
|
@@ -5683,14 +5511,14 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5683
5511
|
relativeFilePath
|
|
5684
5512
|
}) {
|
|
5685
5513
|
const fileContent = await readFileContent(
|
|
5686
|
-
|
|
5514
|
+
join57(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, relativeFilePath)
|
|
5687
5515
|
);
|
|
5688
5516
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5689
5517
|
const result = RulesyncSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5690
5518
|
if (!result.success) {
|
|
5691
5519
|
throw new Error(`Invalid frontmatter in ${relativeFilePath}: ${formatError(result.error)}`);
|
|
5692
5520
|
}
|
|
5693
|
-
const filename =
|
|
5521
|
+
const filename = basename17(relativeFilePath);
|
|
5694
5522
|
return new _RulesyncSubagent({
|
|
5695
5523
|
baseDir: process.cwd(),
|
|
5696
5524
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
@@ -5702,10 +5530,13 @@ var RulesyncSubagent = class _RulesyncSubagent extends RulesyncFile {
|
|
|
5702
5530
|
};
|
|
5703
5531
|
|
|
5704
5532
|
// src/features/subagents/claudecode-subagent.ts
|
|
5705
|
-
var ClaudecodeSubagentFrontmatterSchema =
|
|
5706
|
-
name:
|
|
5707
|
-
description:
|
|
5708
|
-
model:
|
|
5533
|
+
var ClaudecodeSubagentFrontmatterSchema = z25.looseObject({
|
|
5534
|
+
name: z25.string(),
|
|
5535
|
+
description: z25.string(),
|
|
5536
|
+
model: z25.optional(z25.string()),
|
|
5537
|
+
tools: z25.optional(z25.union([z25.string(), z25.array(z25.string())])),
|
|
5538
|
+
permissionMode: z25.optional(z25.string()),
|
|
5539
|
+
skills: z25.optional(z25.union([z25.string(), z25.array(z25.string())]))
|
|
5709
5540
|
});
|
|
5710
5541
|
var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
5711
5542
|
frontmatter;
|
|
@@ -5715,7 +5546,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5715
5546
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
5716
5547
|
if (!result.success) {
|
|
5717
5548
|
throw new Error(
|
|
5718
|
-
`Invalid frontmatter in ${
|
|
5549
|
+
`Invalid frontmatter in ${join58(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
5719
5550
|
);
|
|
5720
5551
|
}
|
|
5721
5552
|
}
|
|
@@ -5727,7 +5558,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5727
5558
|
}
|
|
5728
5559
|
static getSettablePaths(_options = {}) {
|
|
5729
5560
|
return {
|
|
5730
|
-
relativeDirPath:
|
|
5561
|
+
relativeDirPath: join58(".claude", "agents")
|
|
5731
5562
|
};
|
|
5732
5563
|
}
|
|
5733
5564
|
getFrontmatter() {
|
|
@@ -5801,7 +5632,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5801
5632
|
return {
|
|
5802
5633
|
success: false,
|
|
5803
5634
|
error: new Error(
|
|
5804
|
-
`Invalid frontmatter in ${
|
|
5635
|
+
`Invalid frontmatter in ${join58(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
5805
5636
|
)
|
|
5806
5637
|
};
|
|
5807
5638
|
}
|
|
@@ -5819,7 +5650,7 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5819
5650
|
global = false
|
|
5820
5651
|
}) {
|
|
5821
5652
|
const paths = this.getSettablePaths({ global });
|
|
5822
|
-
const filePath =
|
|
5653
|
+
const filePath = join58(baseDir, paths.relativeDirPath, relativeFilePath);
|
|
5823
5654
|
const fileContent = await readFileContent(filePath);
|
|
5824
5655
|
const { frontmatter, body: content } = parseFrontmatter(fileContent);
|
|
5825
5656
|
const result = ClaudecodeSubagentFrontmatterSchema.safeParse(frontmatter);
|
|
@@ -5839,32 +5670,67 @@ var ClaudecodeSubagent = class _ClaudecodeSubagent extends ToolSubagent {
|
|
|
5839
5670
|
};
|
|
5840
5671
|
|
|
5841
5672
|
// src/features/subagents/subagents-processor.ts
|
|
5842
|
-
var
|
|
5673
|
+
var subagentsProcessorToolTargetTuple = [
|
|
5843
5674
|
"agentsmd",
|
|
5844
5675
|
"claudecode",
|
|
5845
|
-
"copilot",
|
|
5846
|
-
"cursor",
|
|
5847
5676
|
"codexcli",
|
|
5848
|
-
"geminicli",
|
|
5849
|
-
"roo"
|
|
5850
|
-
];
|
|
5851
|
-
var subagentsProcessorToolTargetsSimulated = [
|
|
5852
|
-
"agentsmd",
|
|
5853
5677
|
"copilot",
|
|
5854
5678
|
"cursor",
|
|
5855
|
-
"codexcli",
|
|
5856
5679
|
"geminicli",
|
|
5857
5680
|
"roo"
|
|
5858
5681
|
];
|
|
5859
|
-
var
|
|
5860
|
-
var
|
|
5682
|
+
var SubagentsProcessorToolTargetSchema = z26.enum(subagentsProcessorToolTargetTuple);
|
|
5683
|
+
var toolSubagentFactories = /* @__PURE__ */ new Map([
|
|
5684
|
+
[
|
|
5685
|
+
"agentsmd",
|
|
5686
|
+
{ class: AgentsmdSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
5687
|
+
],
|
|
5688
|
+
[
|
|
5689
|
+
"claudecode",
|
|
5690
|
+
{ class: ClaudecodeSubagent, meta: { supportsSimulated: false, supportsGlobal: true } }
|
|
5691
|
+
],
|
|
5692
|
+
[
|
|
5693
|
+
"codexcli",
|
|
5694
|
+
{ class: CodexCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
5695
|
+
],
|
|
5696
|
+
["copilot", { class: CopilotSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5697
|
+
["cursor", { class: CursorSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }],
|
|
5698
|
+
[
|
|
5699
|
+
"geminicli",
|
|
5700
|
+
{ class: GeminiCliSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }
|
|
5701
|
+
],
|
|
5702
|
+
["roo", { class: RooSubagent, meta: { supportsSimulated: true, supportsGlobal: false } }]
|
|
5703
|
+
]);
|
|
5704
|
+
var defaultGetFactory5 = (target) => {
|
|
5705
|
+
const factory = toolSubagentFactories.get(target);
|
|
5706
|
+
if (!factory) {
|
|
5707
|
+
throw new Error(`Unsupported tool target: ${target}`);
|
|
5708
|
+
}
|
|
5709
|
+
return factory;
|
|
5710
|
+
};
|
|
5711
|
+
var allToolTargetKeys4 = [...toolSubagentFactories.keys()];
|
|
5712
|
+
var subagentsProcessorToolTargets = allToolTargetKeys4;
|
|
5713
|
+
var subagentsProcessorToolTargetsSimulated = allToolTargetKeys4.filter(
|
|
5714
|
+
(target) => {
|
|
5715
|
+
const factory = toolSubagentFactories.get(target);
|
|
5716
|
+
return factory?.meta.supportsSimulated ?? false;
|
|
5717
|
+
}
|
|
5718
|
+
);
|
|
5719
|
+
var subagentsProcessorToolTargetsGlobal = allToolTargetKeys4.filter(
|
|
5720
|
+
(target) => {
|
|
5721
|
+
const factory = toolSubagentFactories.get(target);
|
|
5722
|
+
return factory?.meta.supportsGlobal ?? false;
|
|
5723
|
+
}
|
|
5724
|
+
);
|
|
5861
5725
|
var SubagentsProcessor = class extends FeatureProcessor {
|
|
5862
5726
|
toolTarget;
|
|
5863
5727
|
global;
|
|
5728
|
+
getFactory;
|
|
5864
5729
|
constructor({
|
|
5865
5730
|
baseDir = process.cwd(),
|
|
5866
5731
|
toolTarget,
|
|
5867
|
-
global = false
|
|
5732
|
+
global = false,
|
|
5733
|
+
getFactory = defaultGetFactory5
|
|
5868
5734
|
}) {
|
|
5869
5735
|
super({ baseDir });
|
|
5870
5736
|
const result = SubagentsProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -5875,80 +5741,23 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5875
5741
|
}
|
|
5876
5742
|
this.toolTarget = result.data;
|
|
5877
5743
|
this.global = global;
|
|
5744
|
+
this.getFactory = getFactory;
|
|
5878
5745
|
}
|
|
5879
5746
|
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
5880
5747
|
const rulesyncSubagents = rulesyncFiles.filter(
|
|
5881
5748
|
(file) => file instanceof RulesyncSubagent
|
|
5882
5749
|
);
|
|
5750
|
+
const factory = this.getFactory(this.toolTarget);
|
|
5883
5751
|
const toolSubagents = rulesyncSubagents.map((rulesyncSubagent) => {
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
if (!AgentsmdSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5887
|
-
return null;
|
|
5888
|
-
}
|
|
5889
|
-
return AgentsmdSubagent.fromRulesyncSubagent({
|
|
5890
|
-
baseDir: this.baseDir,
|
|
5891
|
-
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5892
|
-
rulesyncSubagent
|
|
5893
|
-
});
|
|
5894
|
-
case "claudecode":
|
|
5895
|
-
if (!ClaudecodeSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5896
|
-
return null;
|
|
5897
|
-
}
|
|
5898
|
-
return ClaudecodeSubagent.fromRulesyncSubagent({
|
|
5899
|
-
baseDir: this.baseDir,
|
|
5900
|
-
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5901
|
-
rulesyncSubagent,
|
|
5902
|
-
global: this.global
|
|
5903
|
-
});
|
|
5904
|
-
case "copilot":
|
|
5905
|
-
if (!CopilotSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5906
|
-
return null;
|
|
5907
|
-
}
|
|
5908
|
-
return CopilotSubagent.fromRulesyncSubagent({
|
|
5909
|
-
baseDir: this.baseDir,
|
|
5910
|
-
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5911
|
-
rulesyncSubagent
|
|
5912
|
-
});
|
|
5913
|
-
case "cursor":
|
|
5914
|
-
if (!CursorSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5915
|
-
return null;
|
|
5916
|
-
}
|
|
5917
|
-
return CursorSubagent.fromRulesyncSubagent({
|
|
5918
|
-
baseDir: this.baseDir,
|
|
5919
|
-
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5920
|
-
rulesyncSubagent
|
|
5921
|
-
});
|
|
5922
|
-
case "codexcli":
|
|
5923
|
-
if (!CodexCliSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5924
|
-
return null;
|
|
5925
|
-
}
|
|
5926
|
-
return CodexCliSubagent.fromRulesyncSubagent({
|
|
5927
|
-
baseDir: this.baseDir,
|
|
5928
|
-
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5929
|
-
rulesyncSubagent
|
|
5930
|
-
});
|
|
5931
|
-
case "geminicli":
|
|
5932
|
-
if (!GeminiCliSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5933
|
-
return null;
|
|
5934
|
-
}
|
|
5935
|
-
return GeminiCliSubagent.fromRulesyncSubagent({
|
|
5936
|
-
baseDir: this.baseDir,
|
|
5937
|
-
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5938
|
-
rulesyncSubagent
|
|
5939
|
-
});
|
|
5940
|
-
case "roo":
|
|
5941
|
-
if (!RooSubagent.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5942
|
-
return null;
|
|
5943
|
-
}
|
|
5944
|
-
return RooSubagent.fromRulesyncSubagent({
|
|
5945
|
-
baseDir: this.baseDir,
|
|
5946
|
-
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5947
|
-
rulesyncSubagent
|
|
5948
|
-
});
|
|
5949
|
-
default:
|
|
5950
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
5752
|
+
if (!factory.class.isTargetedByRulesyncSubagent(rulesyncSubagent)) {
|
|
5753
|
+
return null;
|
|
5951
5754
|
}
|
|
5755
|
+
return factory.class.fromRulesyncSubagent({
|
|
5756
|
+
baseDir: this.baseDir,
|
|
5757
|
+
relativeDirPath: RulesyncSubagent.getSettablePaths().relativeDirPath,
|
|
5758
|
+
rulesyncSubagent,
|
|
5759
|
+
global: this.global
|
|
5760
|
+
});
|
|
5952
5761
|
}).filter((subagent) => subagent !== null);
|
|
5953
5762
|
return toolSubagents;
|
|
5954
5763
|
}
|
|
@@ -5973,7 +5782,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5973
5782
|
* Load and parse rulesync subagent files from .rulesync/subagents/ directory
|
|
5974
5783
|
*/
|
|
5975
5784
|
async loadRulesyncFiles() {
|
|
5976
|
-
const subagentsDir =
|
|
5785
|
+
const subagentsDir = join59(this.baseDir, RulesyncSubagent.getSettablePaths().relativeDirPath);
|
|
5977
5786
|
const dirExists = await directoryExists(subagentsDir);
|
|
5978
5787
|
if (!dirExists) {
|
|
5979
5788
|
logger.debug(`Rulesync subagents directory not found: ${subagentsDir}`);
|
|
@@ -5988,7 +5797,7 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
5988
5797
|
logger.info(`Found ${mdFiles.length} subagent files in ${subagentsDir}`);
|
|
5989
5798
|
const rulesyncSubagents = [];
|
|
5990
5799
|
for (const mdFile of mdFiles) {
|
|
5991
|
-
const filepath =
|
|
5800
|
+
const filepath = join59(subagentsDir, mdFile);
|
|
5992
5801
|
try {
|
|
5993
5802
|
const rulesyncSubagent = await RulesyncSubagent.fromFile({
|
|
5994
5803
|
relativeFilePath: mdFile,
|
|
@@ -6013,103 +5822,25 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6013
5822
|
* Load tool-specific subagent configurations and parse them into ToolSubagent instances
|
|
6014
5823
|
*/
|
|
6015
5824
|
async loadToolFiles({
|
|
6016
|
-
forDeletion
|
|
5825
|
+
forDeletion = false
|
|
6017
5826
|
} = {}) {
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
}
|
|
6036
|
-
}
|
|
6037
|
-
/**
|
|
6038
|
-
* Load Agents.md subagent configurations from .agents/subagents/ directory
|
|
6039
|
-
*/
|
|
6040
|
-
async loadAgentsmdSubagents() {
|
|
6041
|
-
return await this.loadToolSubagentsDefault({
|
|
6042
|
-
relativeDirPath: AgentsmdSubagent.getSettablePaths().relativeDirPath,
|
|
6043
|
-
fromFile: (relativeFilePath) => AgentsmdSubagent.fromFile({ relativeFilePath })
|
|
6044
|
-
});
|
|
6045
|
-
}
|
|
6046
|
-
/**
|
|
6047
|
-
* Load Claude Code subagent configurations from .claude/agents/ directory
|
|
6048
|
-
*/
|
|
6049
|
-
async loadClaudecodeSubagents() {
|
|
6050
|
-
const paths = ClaudecodeSubagent.getSettablePaths({ global: this.global });
|
|
6051
|
-
return await this.loadToolSubagentsDefault({
|
|
6052
|
-
relativeDirPath: paths.relativeDirPath,
|
|
6053
|
-
fromFile: (relativeFilePath) => ClaudecodeSubagent.fromFile({
|
|
6054
|
-
baseDir: this.baseDir,
|
|
6055
|
-
relativeFilePath,
|
|
6056
|
-
global: this.global
|
|
6057
|
-
})
|
|
6058
|
-
});
|
|
6059
|
-
}
|
|
6060
|
-
/**
|
|
6061
|
-
* Load Copilot subagent configurations from .github/subagents/ directory
|
|
6062
|
-
*/
|
|
6063
|
-
async loadCopilotSubagents() {
|
|
6064
|
-
return await this.loadToolSubagentsDefault({
|
|
6065
|
-
relativeDirPath: CopilotSubagent.getSettablePaths().relativeDirPath,
|
|
6066
|
-
fromFile: (relativeFilePath) => CopilotSubagent.fromFile({ relativeFilePath })
|
|
6067
|
-
});
|
|
6068
|
-
}
|
|
6069
|
-
/**
|
|
6070
|
-
* Load Cursor subagent configurations from .cursor/subagents/ directory
|
|
6071
|
-
*/
|
|
6072
|
-
async loadCursorSubagents() {
|
|
6073
|
-
return await this.loadToolSubagentsDefault({
|
|
6074
|
-
relativeDirPath: CursorSubagent.getSettablePaths().relativeDirPath,
|
|
6075
|
-
fromFile: (relativeFilePath) => CursorSubagent.fromFile({ relativeFilePath })
|
|
6076
|
-
});
|
|
6077
|
-
}
|
|
6078
|
-
/**
|
|
6079
|
-
* Load CodexCli subagent configurations from .codex/subagents/ directory
|
|
6080
|
-
*/
|
|
6081
|
-
async loadCodexCliSubagents() {
|
|
6082
|
-
return await this.loadToolSubagentsDefault({
|
|
6083
|
-
relativeDirPath: CodexCliSubagent.getSettablePaths().relativeDirPath,
|
|
6084
|
-
fromFile: (relativeFilePath) => CodexCliSubagent.fromFile({ relativeFilePath })
|
|
6085
|
-
});
|
|
6086
|
-
}
|
|
6087
|
-
/**
|
|
6088
|
-
* Load GeminiCli subagent configurations from .gemini/subagents/ directory
|
|
6089
|
-
*/
|
|
6090
|
-
async loadGeminiCliSubagents() {
|
|
6091
|
-
return await this.loadToolSubagentsDefault({
|
|
6092
|
-
relativeDirPath: GeminiCliSubagent.getSettablePaths().relativeDirPath,
|
|
6093
|
-
fromFile: (relativeFilePath) => GeminiCliSubagent.fromFile({ relativeFilePath })
|
|
6094
|
-
});
|
|
6095
|
-
}
|
|
6096
|
-
/**
|
|
6097
|
-
* Load Roo subagent configurations from .roo/subagents/ directory
|
|
6098
|
-
*/
|
|
6099
|
-
async loadRooSubagents() {
|
|
6100
|
-
return await this.loadToolSubagentsDefault({
|
|
6101
|
-
relativeDirPath: RooSubagent.getSettablePaths().relativeDirPath,
|
|
6102
|
-
fromFile: (relativeFilePath) => RooSubagent.fromFile({ relativeFilePath })
|
|
6103
|
-
});
|
|
6104
|
-
}
|
|
6105
|
-
async loadToolSubagentsDefault({
|
|
6106
|
-
relativeDirPath,
|
|
6107
|
-
fromFile
|
|
6108
|
-
}) {
|
|
6109
|
-
const paths = await findFilesByGlobs(join58(this.baseDir, relativeDirPath, "*.md"));
|
|
6110
|
-
const subagents = await Promise.all(paths.map((path3) => fromFile(basename17(path3))));
|
|
6111
|
-
logger.info(`Successfully loaded ${subagents.length} ${relativeDirPath} subagents`);
|
|
6112
|
-
return subagents;
|
|
5827
|
+
const factory = this.getFactory(this.toolTarget);
|
|
5828
|
+
const paths = factory.class.getSettablePaths({ global: this.global });
|
|
5829
|
+
const subagentFilePaths = await findFilesByGlobs(
|
|
5830
|
+
join59(this.baseDir, paths.relativeDirPath, "*.md")
|
|
5831
|
+
);
|
|
5832
|
+
const toolSubagents = await Promise.all(
|
|
5833
|
+
subagentFilePaths.map(
|
|
5834
|
+
(path3) => factory.class.fromFile({
|
|
5835
|
+
baseDir: this.baseDir,
|
|
5836
|
+
relativeFilePath: basename18(path3),
|
|
5837
|
+
global: this.global
|
|
5838
|
+
})
|
|
5839
|
+
)
|
|
5840
|
+
);
|
|
5841
|
+
const result = forDeletion ? toolSubagents.filter((subagent) => subagent.isDeletable()) : toolSubagents;
|
|
5842
|
+
logger.info(`Successfully loaded ${result.length} ${paths.relativeDirPath} subagents`);
|
|
5843
|
+
return result;
|
|
6113
5844
|
}
|
|
6114
5845
|
/**
|
|
6115
5846
|
* Implementation of abstract method from FeatureProcessor
|
|
@@ -6120,45 +5851,50 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
6120
5851
|
includeSimulated = false
|
|
6121
5852
|
} = {}) {
|
|
6122
5853
|
if (global) {
|
|
6123
|
-
return subagentsProcessorToolTargetsGlobal;
|
|
5854
|
+
return [...subagentsProcessorToolTargetsGlobal];
|
|
6124
5855
|
}
|
|
6125
5856
|
if (!includeSimulated) {
|
|
6126
5857
|
return subagentsProcessorToolTargets.filter(
|
|
6127
5858
|
(target) => !subagentsProcessorToolTargetsSimulated.includes(target)
|
|
6128
5859
|
);
|
|
6129
5860
|
}
|
|
6130
|
-
return subagentsProcessorToolTargets;
|
|
5861
|
+
return [...subagentsProcessorToolTargets];
|
|
6131
5862
|
}
|
|
6132
5863
|
static getToolTargetsSimulated() {
|
|
6133
|
-
return subagentsProcessorToolTargetsSimulated;
|
|
5864
|
+
return [...subagentsProcessorToolTargetsSimulated];
|
|
6134
5865
|
}
|
|
6135
5866
|
};
|
|
6136
5867
|
|
|
6137
5868
|
// src/features/rules/agentsmd-rule.ts
|
|
6138
|
-
import { join as
|
|
5869
|
+
import { join as join62 } from "path";
|
|
6139
5870
|
|
|
6140
5871
|
// src/features/rules/tool-rule.ts
|
|
6141
|
-
import { join as
|
|
5872
|
+
import { join as join61 } from "path";
|
|
6142
5873
|
|
|
6143
5874
|
// src/features/rules/rulesync-rule.ts
|
|
6144
|
-
import { basename as
|
|
6145
|
-
import { z as
|
|
6146
|
-
var RulesyncRuleFrontmatterSchema =
|
|
6147
|
-
root:
|
|
6148
|
-
targets:
|
|
6149
|
-
description:
|
|
6150
|
-
globs:
|
|
6151
|
-
agentsmd:
|
|
6152
|
-
|
|
5875
|
+
import { basename as basename19, join as join60 } from "path";
|
|
5876
|
+
import { z as z27 } from "zod/mini";
|
|
5877
|
+
var RulesyncRuleFrontmatterSchema = z27.object({
|
|
5878
|
+
root: z27.optional(z27.optional(z27.boolean())),
|
|
5879
|
+
targets: z27.optional(RulesyncTargetsSchema),
|
|
5880
|
+
description: z27.optional(z27.string()),
|
|
5881
|
+
globs: z27.optional(z27.array(z27.string())),
|
|
5882
|
+
agentsmd: z27.optional(
|
|
5883
|
+
z27.object({
|
|
6153
5884
|
// @example "path/to/subproject"
|
|
6154
|
-
subprojectPath:
|
|
5885
|
+
subprojectPath: z27.optional(z27.string())
|
|
5886
|
+
})
|
|
5887
|
+
),
|
|
5888
|
+
cursor: z27.optional(
|
|
5889
|
+
z27.object({
|
|
5890
|
+
alwaysApply: z27.optional(z27.boolean()),
|
|
5891
|
+
description: z27.optional(z27.string()),
|
|
5892
|
+
globs: z27.optional(z27.array(z27.string()))
|
|
6155
5893
|
})
|
|
6156
5894
|
),
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
description: z26.optional(z26.string()),
|
|
6161
|
-
globs: z26.optional(z26.array(z26.string()))
|
|
5895
|
+
copilot: z27.optional(
|
|
5896
|
+
z27.object({
|
|
5897
|
+
excludeAgent: z27.optional(z27.union([z27.literal("code-review"), z27.literal("coding-agent")]))
|
|
6162
5898
|
})
|
|
6163
5899
|
)
|
|
6164
5900
|
});
|
|
@@ -6170,7 +5906,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6170
5906
|
const result = RulesyncRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6171
5907
|
if (!result.success) {
|
|
6172
5908
|
throw new Error(
|
|
6173
|
-
`Invalid frontmatter in ${
|
|
5909
|
+
`Invalid frontmatter in ${join60(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6174
5910
|
);
|
|
6175
5911
|
}
|
|
6176
5912
|
}
|
|
@@ -6205,7 +5941,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6205
5941
|
return {
|
|
6206
5942
|
success: false,
|
|
6207
5943
|
error: new Error(
|
|
6208
|
-
`Invalid frontmatter in ${
|
|
5944
|
+
`Invalid frontmatter in ${join60(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
6209
5945
|
)
|
|
6210
5946
|
};
|
|
6211
5947
|
}
|
|
@@ -6214,12 +5950,12 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6214
5950
|
relativeFilePath,
|
|
6215
5951
|
validate = true
|
|
6216
5952
|
}) {
|
|
6217
|
-
const legacyPath =
|
|
5953
|
+
const legacyPath = join60(
|
|
6218
5954
|
process.cwd(),
|
|
6219
5955
|
this.getSettablePaths().legacy.relativeDirPath,
|
|
6220
5956
|
relativeFilePath
|
|
6221
5957
|
);
|
|
6222
|
-
const recommendedPath =
|
|
5958
|
+
const recommendedPath = join60(
|
|
6223
5959
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6224
5960
|
relativeFilePath
|
|
6225
5961
|
);
|
|
@@ -6238,7 +5974,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6238
5974
|
agentsmd: result.data.agentsmd,
|
|
6239
5975
|
cursor: result.data.cursor
|
|
6240
5976
|
};
|
|
6241
|
-
const filename =
|
|
5977
|
+
const filename = basename19(legacyPath);
|
|
6242
5978
|
return new _RulesyncRule({
|
|
6243
5979
|
baseDir: process.cwd(),
|
|
6244
5980
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6252,7 +5988,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6252
5988
|
relativeFilePath,
|
|
6253
5989
|
validate = true
|
|
6254
5990
|
}) {
|
|
6255
|
-
const filePath =
|
|
5991
|
+
const filePath = join60(
|
|
6256
5992
|
process.cwd(),
|
|
6257
5993
|
this.getSettablePaths().recommended.relativeDirPath,
|
|
6258
5994
|
relativeFilePath
|
|
@@ -6271,7 +6007,7 @@ var RulesyncRule = class _RulesyncRule extends RulesyncFile {
|
|
|
6271
6007
|
agentsmd: result.data.agentsmd,
|
|
6272
6008
|
cursor: result.data.cursor
|
|
6273
6009
|
};
|
|
6274
|
-
const filename =
|
|
6010
|
+
const filename = basename19(filePath);
|
|
6275
6011
|
return new _RulesyncRule({
|
|
6276
6012
|
baseDir: process.cwd(),
|
|
6277
6013
|
relativeDirPath: this.getSettablePaths().recommended.relativeDirPath,
|
|
@@ -6346,7 +6082,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6346
6082
|
rulesyncRule,
|
|
6347
6083
|
validate = true,
|
|
6348
6084
|
rootPath = { relativeDirPath: ".", relativeFilePath: "AGENTS.md" },
|
|
6349
|
-
nonRootPath = { relativeDirPath:
|
|
6085
|
+
nonRootPath = { relativeDirPath: join61(".agents", "memories") }
|
|
6350
6086
|
}) {
|
|
6351
6087
|
const params = this.buildToolRuleParamsDefault({
|
|
6352
6088
|
baseDir,
|
|
@@ -6357,7 +6093,7 @@ var ToolRule = class extends ToolFile {
|
|
|
6357
6093
|
});
|
|
6358
6094
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
6359
6095
|
if (!rulesyncFrontmatter.root && rulesyncFrontmatter.agentsmd?.subprojectPath) {
|
|
6360
|
-
params.relativeDirPath =
|
|
6096
|
+
params.relativeDirPath = join61(rulesyncFrontmatter.agentsmd.subprojectPath);
|
|
6361
6097
|
params.relativeFilePath = "AGENTS.md";
|
|
6362
6098
|
}
|
|
6363
6099
|
return params;
|
|
@@ -6422,7 +6158,7 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6422
6158
|
relativeFilePath: "AGENTS.md"
|
|
6423
6159
|
},
|
|
6424
6160
|
nonRoot: {
|
|
6425
|
-
relativeDirPath:
|
|
6161
|
+
relativeDirPath: join62(".agents", "memories")
|
|
6426
6162
|
}
|
|
6427
6163
|
};
|
|
6428
6164
|
}
|
|
@@ -6432,8 +6168,8 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6432
6168
|
validate = true
|
|
6433
6169
|
}) {
|
|
6434
6170
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
6435
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
6436
|
-
const fileContent = await readFileContent(
|
|
6171
|
+
const relativePath = isRoot ? "AGENTS.md" : join62(".agents", "memories", relativeFilePath);
|
|
6172
|
+
const fileContent = await readFileContent(join62(baseDir, relativePath));
|
|
6437
6173
|
return new _AgentsMdRule({
|
|
6438
6174
|
baseDir,
|
|
6439
6175
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -6473,12 +6209,12 @@ var AgentsMdRule = class _AgentsMdRule extends ToolRule {
|
|
|
6473
6209
|
};
|
|
6474
6210
|
|
|
6475
6211
|
// src/features/rules/amazonqcli-rule.ts
|
|
6476
|
-
import { join as
|
|
6212
|
+
import { join as join63 } from "path";
|
|
6477
6213
|
var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
6478
6214
|
static getSettablePaths() {
|
|
6479
6215
|
return {
|
|
6480
6216
|
nonRoot: {
|
|
6481
|
-
relativeDirPath:
|
|
6217
|
+
relativeDirPath: join63(".amazonq", "rules")
|
|
6482
6218
|
}
|
|
6483
6219
|
};
|
|
6484
6220
|
}
|
|
@@ -6488,7 +6224,7 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6488
6224
|
validate = true
|
|
6489
6225
|
}) {
|
|
6490
6226
|
const fileContent = await readFileContent(
|
|
6491
|
-
|
|
6227
|
+
join63(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6492
6228
|
);
|
|
6493
6229
|
return new _AmazonQCliRule({
|
|
6494
6230
|
baseDir,
|
|
@@ -6528,12 +6264,12 @@ var AmazonQCliRule = class _AmazonQCliRule extends ToolRule {
|
|
|
6528
6264
|
};
|
|
6529
6265
|
|
|
6530
6266
|
// src/features/rules/antigravity-rule.ts
|
|
6531
|
-
import { join as
|
|
6267
|
+
import { join as join64 } from "path";
|
|
6532
6268
|
var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
6533
6269
|
static getSettablePaths() {
|
|
6534
6270
|
return {
|
|
6535
6271
|
nonRoot: {
|
|
6536
|
-
relativeDirPath:
|
|
6272
|
+
relativeDirPath: join64(".agent", "rules")
|
|
6537
6273
|
}
|
|
6538
6274
|
};
|
|
6539
6275
|
}
|
|
@@ -6543,7 +6279,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6543
6279
|
validate = true
|
|
6544
6280
|
}) {
|
|
6545
6281
|
const fileContent = await readFileContent(
|
|
6546
|
-
|
|
6282
|
+
join64(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6547
6283
|
);
|
|
6548
6284
|
return new _AntigravityRule({
|
|
6549
6285
|
baseDir,
|
|
@@ -6583,7 +6319,7 @@ var AntigravityRule = class _AntigravityRule extends ToolRule {
|
|
|
6583
6319
|
};
|
|
6584
6320
|
|
|
6585
6321
|
// src/features/rules/augmentcode-legacy-rule.ts
|
|
6586
|
-
import { join as
|
|
6322
|
+
import { join as join65 } from "path";
|
|
6587
6323
|
var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
6588
6324
|
toRulesyncRule() {
|
|
6589
6325
|
const rulesyncFrontmatter = {
|
|
@@ -6609,7 +6345,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6609
6345
|
relativeFilePath: ".augment-guidelines"
|
|
6610
6346
|
},
|
|
6611
6347
|
nonRoot: {
|
|
6612
|
-
relativeDirPath:
|
|
6348
|
+
relativeDirPath: join65(".augment", "rules")
|
|
6613
6349
|
}
|
|
6614
6350
|
};
|
|
6615
6351
|
}
|
|
@@ -6644,8 +6380,8 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6644
6380
|
}) {
|
|
6645
6381
|
const settablePaths = this.getSettablePaths();
|
|
6646
6382
|
const isRoot = relativeFilePath === settablePaths.root.relativeFilePath;
|
|
6647
|
-
const relativePath = isRoot ? settablePaths.root.relativeFilePath :
|
|
6648
|
-
const fileContent = await readFileContent(
|
|
6383
|
+
const relativePath = isRoot ? settablePaths.root.relativeFilePath : join65(settablePaths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6384
|
+
const fileContent = await readFileContent(join65(baseDir, relativePath));
|
|
6649
6385
|
return new _AugmentcodeLegacyRule({
|
|
6650
6386
|
baseDir,
|
|
6651
6387
|
relativeDirPath: isRoot ? settablePaths.root.relativeDirPath : settablePaths.nonRoot.relativeDirPath,
|
|
@@ -6658,7 +6394,7 @@ var AugmentcodeLegacyRule = class _AugmentcodeLegacyRule extends ToolRule {
|
|
|
6658
6394
|
};
|
|
6659
6395
|
|
|
6660
6396
|
// src/features/rules/augmentcode-rule.ts
|
|
6661
|
-
import { join as
|
|
6397
|
+
import { join as join66 } from "path";
|
|
6662
6398
|
var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
6663
6399
|
toRulesyncRule() {
|
|
6664
6400
|
return this.toRulesyncRuleDefault();
|
|
@@ -6666,7 +6402,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6666
6402
|
static getSettablePaths() {
|
|
6667
6403
|
return {
|
|
6668
6404
|
nonRoot: {
|
|
6669
|
-
relativeDirPath:
|
|
6405
|
+
relativeDirPath: join66(".augment", "rules")
|
|
6670
6406
|
}
|
|
6671
6407
|
};
|
|
6672
6408
|
}
|
|
@@ -6690,7 +6426,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6690
6426
|
validate = true
|
|
6691
6427
|
}) {
|
|
6692
6428
|
const fileContent = await readFileContent(
|
|
6693
|
-
|
|
6429
|
+
join66(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6694
6430
|
);
|
|
6695
6431
|
const { body: content } = parseFrontmatter(fileContent);
|
|
6696
6432
|
return new _AugmentcodeRule({
|
|
@@ -6713,7 +6449,7 @@ var AugmentcodeRule = class _AugmentcodeRule extends ToolRule {
|
|
|
6713
6449
|
};
|
|
6714
6450
|
|
|
6715
6451
|
// src/features/rules/claudecode-rule.ts
|
|
6716
|
-
import { join as
|
|
6452
|
+
import { join as join67 } from "path";
|
|
6717
6453
|
var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
6718
6454
|
static getSettablePaths({
|
|
6719
6455
|
global
|
|
@@ -6732,7 +6468,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6732
6468
|
relativeFilePath: "CLAUDE.md"
|
|
6733
6469
|
},
|
|
6734
6470
|
nonRoot: {
|
|
6735
|
-
relativeDirPath:
|
|
6471
|
+
relativeDirPath: join67(".claude", "memories")
|
|
6736
6472
|
}
|
|
6737
6473
|
};
|
|
6738
6474
|
}
|
|
@@ -6747,7 +6483,7 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6747
6483
|
if (isRoot) {
|
|
6748
6484
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6749
6485
|
const fileContent2 = await readFileContent(
|
|
6750
|
-
|
|
6486
|
+
join67(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6751
6487
|
);
|
|
6752
6488
|
return new _ClaudecodeRule({
|
|
6753
6489
|
baseDir,
|
|
@@ -6761,8 +6497,8 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6761
6497
|
if (!paths.nonRoot) {
|
|
6762
6498
|
throw new Error("nonRoot path is not set");
|
|
6763
6499
|
}
|
|
6764
|
-
const relativePath =
|
|
6765
|
-
const fileContent = await readFileContent(
|
|
6500
|
+
const relativePath = join67(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6501
|
+
const fileContent = await readFileContent(join67(baseDir, relativePath));
|
|
6766
6502
|
return new _ClaudecodeRule({
|
|
6767
6503
|
baseDir,
|
|
6768
6504
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6804,10 +6540,10 @@ var ClaudecodeRule = class _ClaudecodeRule extends ToolRule {
|
|
|
6804
6540
|
};
|
|
6805
6541
|
|
|
6806
6542
|
// src/features/rules/cline-rule.ts
|
|
6807
|
-
import { join as
|
|
6808
|
-
import { z as
|
|
6809
|
-
var ClineRuleFrontmatterSchema =
|
|
6810
|
-
description:
|
|
6543
|
+
import { join as join68 } from "path";
|
|
6544
|
+
import { z as z28 } from "zod/mini";
|
|
6545
|
+
var ClineRuleFrontmatterSchema = z28.object({
|
|
6546
|
+
description: z28.string()
|
|
6811
6547
|
});
|
|
6812
6548
|
var ClineRule = class _ClineRule extends ToolRule {
|
|
6813
6549
|
static getSettablePaths() {
|
|
@@ -6849,7 +6585,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6849
6585
|
validate = true
|
|
6850
6586
|
}) {
|
|
6851
6587
|
const fileContent = await readFileContent(
|
|
6852
|
-
|
|
6588
|
+
join68(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
6853
6589
|
);
|
|
6854
6590
|
return new _ClineRule({
|
|
6855
6591
|
baseDir,
|
|
@@ -6862,7 +6598,7 @@ var ClineRule = class _ClineRule extends ToolRule {
|
|
|
6862
6598
|
};
|
|
6863
6599
|
|
|
6864
6600
|
// src/features/rules/codexcli-rule.ts
|
|
6865
|
-
import { join as
|
|
6601
|
+
import { join as join69 } from "path";
|
|
6866
6602
|
var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
6867
6603
|
static getSettablePaths({
|
|
6868
6604
|
global
|
|
@@ -6881,7 +6617,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6881
6617
|
relativeFilePath: "AGENTS.md"
|
|
6882
6618
|
},
|
|
6883
6619
|
nonRoot: {
|
|
6884
|
-
relativeDirPath:
|
|
6620
|
+
relativeDirPath: join69(".codex", "memories")
|
|
6885
6621
|
}
|
|
6886
6622
|
};
|
|
6887
6623
|
}
|
|
@@ -6896,7 +6632,7 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6896
6632
|
if (isRoot) {
|
|
6897
6633
|
const relativePath2 = paths.root.relativeFilePath;
|
|
6898
6634
|
const fileContent2 = await readFileContent(
|
|
6899
|
-
|
|
6635
|
+
join69(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
6900
6636
|
);
|
|
6901
6637
|
return new _CodexcliRule({
|
|
6902
6638
|
baseDir,
|
|
@@ -6910,8 +6646,8 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6910
6646
|
if (!paths.nonRoot) {
|
|
6911
6647
|
throw new Error("nonRoot path is not set");
|
|
6912
6648
|
}
|
|
6913
|
-
const relativePath =
|
|
6914
|
-
const fileContent = await readFileContent(
|
|
6649
|
+
const relativePath = join69(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
6650
|
+
const fileContent = await readFileContent(join69(baseDir, relativePath));
|
|
6915
6651
|
return new _CodexcliRule({
|
|
6916
6652
|
baseDir,
|
|
6917
6653
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -6953,11 +6689,12 @@ var CodexcliRule = class _CodexcliRule extends ToolRule {
|
|
|
6953
6689
|
};
|
|
6954
6690
|
|
|
6955
6691
|
// src/features/rules/copilot-rule.ts
|
|
6956
|
-
import { join as
|
|
6957
|
-
import { z as
|
|
6958
|
-
var CopilotRuleFrontmatterSchema =
|
|
6959
|
-
description:
|
|
6960
|
-
applyTo:
|
|
6692
|
+
import { join as join70 } from "path";
|
|
6693
|
+
import { z as z29 } from "zod/mini";
|
|
6694
|
+
var CopilotRuleFrontmatterSchema = z29.object({
|
|
6695
|
+
description: z29.optional(z29.string()),
|
|
6696
|
+
applyTo: z29.optional(z29.string()),
|
|
6697
|
+
excludeAgent: z29.optional(z29.union([z29.literal("code-review"), z29.literal("coding-agent")]))
|
|
6961
6698
|
});
|
|
6962
6699
|
var CopilotRule = class _CopilotRule extends ToolRule {
|
|
6963
6700
|
frontmatter;
|
|
@@ -6969,7 +6706,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6969
6706
|
relativeFilePath: "copilot-instructions.md"
|
|
6970
6707
|
},
|
|
6971
6708
|
nonRoot: {
|
|
6972
|
-
relativeDirPath:
|
|
6709
|
+
relativeDirPath: join70(".github", "instructions")
|
|
6973
6710
|
}
|
|
6974
6711
|
};
|
|
6975
6712
|
}
|
|
@@ -6978,7 +6715,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
6978
6715
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
6979
6716
|
if (!result.success) {
|
|
6980
6717
|
throw new Error(
|
|
6981
|
-
`Invalid frontmatter in ${
|
|
6718
|
+
`Invalid frontmatter in ${join70(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
6982
6719
|
);
|
|
6983
6720
|
}
|
|
6984
6721
|
}
|
|
@@ -7001,7 +6738,10 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7001
6738
|
targets: ["*"],
|
|
7002
6739
|
root: this.isRoot(),
|
|
7003
6740
|
description: this.frontmatter.description,
|
|
7004
|
-
globs
|
|
6741
|
+
globs,
|
|
6742
|
+
...this.frontmatter.excludeAgent && {
|
|
6743
|
+
copilot: { excludeAgent: this.frontmatter.excludeAgent }
|
|
6744
|
+
}
|
|
7005
6745
|
};
|
|
7006
6746
|
const originalFilePath = this.getRelativeFilePath();
|
|
7007
6747
|
const relativeFilePath = originalFilePath.replace(/\.instructions\.md$/, ".md");
|
|
@@ -7023,7 +6763,8 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7023
6763
|
const root = rulesyncFrontmatter.root;
|
|
7024
6764
|
const copilotFrontmatter = {
|
|
7025
6765
|
description: rulesyncFrontmatter.description,
|
|
7026
|
-
applyTo: rulesyncFrontmatter.globs?.length ? rulesyncFrontmatter.globs.join(",") : void 0
|
|
6766
|
+
applyTo: rulesyncFrontmatter.globs?.length ? rulesyncFrontmatter.globs.join(",") : void 0,
|
|
6767
|
+
excludeAgent: rulesyncFrontmatter.copilot?.excludeAgent
|
|
7027
6768
|
};
|
|
7028
6769
|
const body = rulesyncRule.getBody();
|
|
7029
6770
|
if (root) {
|
|
@@ -7056,20 +6797,17 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7056
6797
|
validate = true
|
|
7057
6798
|
}) {
|
|
7058
6799
|
const isRoot = relativeFilePath === "copilot-instructions.md";
|
|
7059
|
-
const relativePath = isRoot ?
|
|
6800
|
+
const relativePath = isRoot ? join70(
|
|
7060
6801
|
this.getSettablePaths().root.relativeDirPath,
|
|
7061
6802
|
this.getSettablePaths().root.relativeFilePath
|
|
7062
|
-
) :
|
|
7063
|
-
const fileContent = await readFileContent(
|
|
6803
|
+
) : join70(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
6804
|
+
const fileContent = await readFileContent(join70(baseDir, relativePath));
|
|
7064
6805
|
if (isRoot) {
|
|
7065
6806
|
return new _CopilotRule({
|
|
7066
6807
|
baseDir,
|
|
7067
6808
|
relativeDirPath: this.getSettablePaths().root.relativeDirPath,
|
|
7068
|
-
relativeFilePath:
|
|
7069
|
-
frontmatter: {
|
|
7070
|
-
description: "",
|
|
7071
|
-
applyTo: "**"
|
|
7072
|
-
},
|
|
6809
|
+
relativeFilePath: this.getSettablePaths().root.relativeFilePath,
|
|
6810
|
+
frontmatter: {},
|
|
7073
6811
|
body: fileContent.trim(),
|
|
7074
6812
|
validate,
|
|
7075
6813
|
root: isRoot
|
|
@@ -7079,7 +6817,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7079
6817
|
const result = CopilotRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7080
6818
|
if (!result.success) {
|
|
7081
6819
|
throw new Error(
|
|
7082
|
-
`Invalid frontmatter in ${
|
|
6820
|
+
`Invalid frontmatter in ${join70(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7083
6821
|
);
|
|
7084
6822
|
}
|
|
7085
6823
|
return new _CopilotRule({
|
|
@@ -7103,7 +6841,7 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7103
6841
|
return {
|
|
7104
6842
|
success: false,
|
|
7105
6843
|
error: new Error(
|
|
7106
|
-
`Invalid frontmatter in ${
|
|
6844
|
+
`Invalid frontmatter in ${join70(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7107
6845
|
)
|
|
7108
6846
|
};
|
|
7109
6847
|
}
|
|
@@ -7123,12 +6861,12 @@ var CopilotRule = class _CopilotRule extends ToolRule {
|
|
|
7123
6861
|
};
|
|
7124
6862
|
|
|
7125
6863
|
// src/features/rules/cursor-rule.ts
|
|
7126
|
-
import { basename as
|
|
7127
|
-
import { z as
|
|
7128
|
-
var CursorRuleFrontmatterSchema =
|
|
7129
|
-
description:
|
|
7130
|
-
globs:
|
|
7131
|
-
alwaysApply:
|
|
6864
|
+
import { basename as basename20, join as join71 } from "path";
|
|
6865
|
+
import { z as z30 } from "zod/mini";
|
|
6866
|
+
var CursorRuleFrontmatterSchema = z30.object({
|
|
6867
|
+
description: z30.optional(z30.string()),
|
|
6868
|
+
globs: z30.optional(z30.string()),
|
|
6869
|
+
alwaysApply: z30.optional(z30.boolean())
|
|
7132
6870
|
});
|
|
7133
6871
|
var CursorRule = class _CursorRule extends ToolRule {
|
|
7134
6872
|
frontmatter;
|
|
@@ -7136,7 +6874,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7136
6874
|
static getSettablePaths() {
|
|
7137
6875
|
return {
|
|
7138
6876
|
nonRoot: {
|
|
7139
|
-
relativeDirPath:
|
|
6877
|
+
relativeDirPath: join71(".cursor", "rules")
|
|
7140
6878
|
}
|
|
7141
6879
|
};
|
|
7142
6880
|
}
|
|
@@ -7145,7 +6883,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7145
6883
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7146
6884
|
if (!result.success) {
|
|
7147
6885
|
throw new Error(
|
|
7148
|
-
`Invalid frontmatter in ${
|
|
6886
|
+
`Invalid frontmatter in ${join71(rest.relativeDirPath, rest.relativeFilePath)}: ${formatError(result.error)}`
|
|
7149
6887
|
);
|
|
7150
6888
|
}
|
|
7151
6889
|
}
|
|
@@ -7262,19 +7000,19 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7262
7000
|
validate = true
|
|
7263
7001
|
}) {
|
|
7264
7002
|
const fileContent = await readFileContent(
|
|
7265
|
-
|
|
7003
|
+
join71(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7266
7004
|
);
|
|
7267
7005
|
const { frontmatter, body: content } = _CursorRule.parseCursorFrontmatter(fileContent);
|
|
7268
7006
|
const result = CursorRuleFrontmatterSchema.safeParse(frontmatter);
|
|
7269
7007
|
if (!result.success) {
|
|
7270
7008
|
throw new Error(
|
|
7271
|
-
`Invalid frontmatter in ${
|
|
7009
|
+
`Invalid frontmatter in ${join71(baseDir, relativeFilePath)}: ${formatError(result.error)}`
|
|
7272
7010
|
);
|
|
7273
7011
|
}
|
|
7274
7012
|
return new _CursorRule({
|
|
7275
7013
|
baseDir,
|
|
7276
7014
|
relativeDirPath: this.getSettablePaths().nonRoot.relativeDirPath,
|
|
7277
|
-
relativeFilePath:
|
|
7015
|
+
relativeFilePath: basename20(relativeFilePath),
|
|
7278
7016
|
frontmatter: result.data,
|
|
7279
7017
|
body: content.trim(),
|
|
7280
7018
|
validate
|
|
@@ -7291,7 +7029,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7291
7029
|
return {
|
|
7292
7030
|
success: false,
|
|
7293
7031
|
error: new Error(
|
|
7294
|
-
`Invalid frontmatter in ${
|
|
7032
|
+
`Invalid frontmatter in ${join71(this.relativeDirPath, this.relativeFilePath)}: ${formatError(result.error)}`
|
|
7295
7033
|
)
|
|
7296
7034
|
};
|
|
7297
7035
|
}
|
|
@@ -7311,7 +7049,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
7311
7049
|
};
|
|
7312
7050
|
|
|
7313
7051
|
// src/features/rules/geminicli-rule.ts
|
|
7314
|
-
import { join as
|
|
7052
|
+
import { join as join72 } from "path";
|
|
7315
7053
|
var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
7316
7054
|
static getSettablePaths({
|
|
7317
7055
|
global
|
|
@@ -7330,7 +7068,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7330
7068
|
relativeFilePath: "GEMINI.md"
|
|
7331
7069
|
},
|
|
7332
7070
|
nonRoot: {
|
|
7333
|
-
relativeDirPath:
|
|
7071
|
+
relativeDirPath: join72(".gemini", "memories")
|
|
7334
7072
|
}
|
|
7335
7073
|
};
|
|
7336
7074
|
}
|
|
@@ -7345,7 +7083,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7345
7083
|
if (isRoot) {
|
|
7346
7084
|
const relativePath2 = paths.root.relativeFilePath;
|
|
7347
7085
|
const fileContent2 = await readFileContent(
|
|
7348
|
-
|
|
7086
|
+
join72(baseDir, paths.root.relativeDirPath, relativePath2)
|
|
7349
7087
|
);
|
|
7350
7088
|
return new _GeminiCliRule({
|
|
7351
7089
|
baseDir,
|
|
@@ -7359,8 +7097,8 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7359
7097
|
if (!paths.nonRoot) {
|
|
7360
7098
|
throw new Error("nonRoot path is not set");
|
|
7361
7099
|
}
|
|
7362
|
-
const relativePath =
|
|
7363
|
-
const fileContent = await readFileContent(
|
|
7100
|
+
const relativePath = join72(paths.nonRoot.relativeDirPath, relativeFilePath);
|
|
7101
|
+
const fileContent = await readFileContent(join72(baseDir, relativePath));
|
|
7364
7102
|
return new _GeminiCliRule({
|
|
7365
7103
|
baseDir,
|
|
7366
7104
|
relativeDirPath: paths.nonRoot.relativeDirPath,
|
|
@@ -7402,7 +7140,7 @@ var GeminiCliRule = class _GeminiCliRule extends ToolRule {
|
|
|
7402
7140
|
};
|
|
7403
7141
|
|
|
7404
7142
|
// src/features/rules/junie-rule.ts
|
|
7405
|
-
import { join as
|
|
7143
|
+
import { join as join73 } from "path";
|
|
7406
7144
|
var JunieRule = class _JunieRule extends ToolRule {
|
|
7407
7145
|
static getSettablePaths() {
|
|
7408
7146
|
return {
|
|
@@ -7411,7 +7149,7 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7411
7149
|
relativeFilePath: "guidelines.md"
|
|
7412
7150
|
},
|
|
7413
7151
|
nonRoot: {
|
|
7414
|
-
relativeDirPath:
|
|
7152
|
+
relativeDirPath: join73(".junie", "memories")
|
|
7415
7153
|
}
|
|
7416
7154
|
};
|
|
7417
7155
|
}
|
|
@@ -7421,8 +7159,8 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7421
7159
|
validate = true
|
|
7422
7160
|
}) {
|
|
7423
7161
|
const isRoot = relativeFilePath === "guidelines.md";
|
|
7424
|
-
const relativePath = isRoot ? "guidelines.md" :
|
|
7425
|
-
const fileContent = await readFileContent(
|
|
7162
|
+
const relativePath = isRoot ? "guidelines.md" : join73(".junie", "memories", relativeFilePath);
|
|
7163
|
+
const fileContent = await readFileContent(join73(baseDir, relativePath));
|
|
7426
7164
|
return new _JunieRule({
|
|
7427
7165
|
baseDir,
|
|
7428
7166
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7462,12 +7200,12 @@ var JunieRule = class _JunieRule extends ToolRule {
|
|
|
7462
7200
|
};
|
|
7463
7201
|
|
|
7464
7202
|
// src/features/rules/kiro-rule.ts
|
|
7465
|
-
import { join as
|
|
7203
|
+
import { join as join74 } from "path";
|
|
7466
7204
|
var KiroRule = class _KiroRule extends ToolRule {
|
|
7467
7205
|
static getSettablePaths() {
|
|
7468
7206
|
return {
|
|
7469
7207
|
nonRoot: {
|
|
7470
|
-
relativeDirPath:
|
|
7208
|
+
relativeDirPath: join74(".kiro", "steering")
|
|
7471
7209
|
}
|
|
7472
7210
|
};
|
|
7473
7211
|
}
|
|
@@ -7477,7 +7215,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7477
7215
|
validate = true
|
|
7478
7216
|
}) {
|
|
7479
7217
|
const fileContent = await readFileContent(
|
|
7480
|
-
|
|
7218
|
+
join74(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7481
7219
|
);
|
|
7482
7220
|
return new _KiroRule({
|
|
7483
7221
|
baseDir,
|
|
@@ -7517,7 +7255,7 @@ var KiroRule = class _KiroRule extends ToolRule {
|
|
|
7517
7255
|
};
|
|
7518
7256
|
|
|
7519
7257
|
// src/features/rules/opencode-rule.ts
|
|
7520
|
-
import { join as
|
|
7258
|
+
import { join as join75 } from "path";
|
|
7521
7259
|
var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
7522
7260
|
static getSettablePaths() {
|
|
7523
7261
|
return {
|
|
@@ -7526,7 +7264,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7526
7264
|
relativeFilePath: "AGENTS.md"
|
|
7527
7265
|
},
|
|
7528
7266
|
nonRoot: {
|
|
7529
|
-
relativeDirPath:
|
|
7267
|
+
relativeDirPath: join75(".opencode", "memories")
|
|
7530
7268
|
}
|
|
7531
7269
|
};
|
|
7532
7270
|
}
|
|
@@ -7536,8 +7274,8 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7536
7274
|
validate = true
|
|
7537
7275
|
}) {
|
|
7538
7276
|
const isRoot = relativeFilePath === "AGENTS.md";
|
|
7539
|
-
const relativePath = isRoot ? "AGENTS.md" :
|
|
7540
|
-
const fileContent = await readFileContent(
|
|
7277
|
+
const relativePath = isRoot ? "AGENTS.md" : join75(".opencode", "memories", relativeFilePath);
|
|
7278
|
+
const fileContent = await readFileContent(join75(baseDir, relativePath));
|
|
7541
7279
|
return new _OpenCodeRule({
|
|
7542
7280
|
baseDir,
|
|
7543
7281
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7577,7 +7315,7 @@ var OpenCodeRule = class _OpenCodeRule extends ToolRule {
|
|
|
7577
7315
|
};
|
|
7578
7316
|
|
|
7579
7317
|
// src/features/rules/qwencode-rule.ts
|
|
7580
|
-
import { join as
|
|
7318
|
+
import { join as join76 } from "path";
|
|
7581
7319
|
var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
7582
7320
|
static getSettablePaths() {
|
|
7583
7321
|
return {
|
|
@@ -7586,7 +7324,7 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7586
7324
|
relativeFilePath: "QWEN.md"
|
|
7587
7325
|
},
|
|
7588
7326
|
nonRoot: {
|
|
7589
|
-
relativeDirPath:
|
|
7327
|
+
relativeDirPath: join76(".qwen", "memories")
|
|
7590
7328
|
}
|
|
7591
7329
|
};
|
|
7592
7330
|
}
|
|
@@ -7596,8 +7334,8 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7596
7334
|
validate = true
|
|
7597
7335
|
}) {
|
|
7598
7336
|
const isRoot = relativeFilePath === "QWEN.md";
|
|
7599
|
-
const relativePath = isRoot ? "QWEN.md" :
|
|
7600
|
-
const fileContent = await readFileContent(
|
|
7337
|
+
const relativePath = isRoot ? "QWEN.md" : join76(".qwen", "memories", relativeFilePath);
|
|
7338
|
+
const fileContent = await readFileContent(join76(baseDir, relativePath));
|
|
7601
7339
|
return new _QwencodeRule({
|
|
7602
7340
|
baseDir,
|
|
7603
7341
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : this.getSettablePaths().nonRoot.relativeDirPath,
|
|
@@ -7634,12 +7372,12 @@ var QwencodeRule = class _QwencodeRule extends ToolRule {
|
|
|
7634
7372
|
};
|
|
7635
7373
|
|
|
7636
7374
|
// src/features/rules/roo-rule.ts
|
|
7637
|
-
import { join as
|
|
7375
|
+
import { join as join77 } from "path";
|
|
7638
7376
|
var RooRule = class _RooRule extends ToolRule {
|
|
7639
7377
|
static getSettablePaths() {
|
|
7640
7378
|
return {
|
|
7641
7379
|
nonRoot: {
|
|
7642
|
-
relativeDirPath:
|
|
7380
|
+
relativeDirPath: join77(".roo", "rules")
|
|
7643
7381
|
}
|
|
7644
7382
|
};
|
|
7645
7383
|
}
|
|
@@ -7649,7 +7387,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7649
7387
|
validate = true
|
|
7650
7388
|
}) {
|
|
7651
7389
|
const fileContent = await readFileContent(
|
|
7652
|
-
|
|
7390
|
+
join77(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7653
7391
|
);
|
|
7654
7392
|
return new _RooRule({
|
|
7655
7393
|
baseDir,
|
|
@@ -7704,7 +7442,7 @@ var RooRule = class _RooRule extends ToolRule {
|
|
|
7704
7442
|
};
|
|
7705
7443
|
|
|
7706
7444
|
// src/features/rules/warp-rule.ts
|
|
7707
|
-
import { join as
|
|
7445
|
+
import { join as join78 } from "path";
|
|
7708
7446
|
var WarpRule = class _WarpRule extends ToolRule {
|
|
7709
7447
|
constructor({ fileContent, root, ...rest }) {
|
|
7710
7448
|
super({
|
|
@@ -7720,7 +7458,7 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7720
7458
|
relativeFilePath: "WARP.md"
|
|
7721
7459
|
},
|
|
7722
7460
|
nonRoot: {
|
|
7723
|
-
relativeDirPath:
|
|
7461
|
+
relativeDirPath: join78(".warp", "memories")
|
|
7724
7462
|
}
|
|
7725
7463
|
};
|
|
7726
7464
|
}
|
|
@@ -7730,8 +7468,8 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7730
7468
|
validate = true
|
|
7731
7469
|
}) {
|
|
7732
7470
|
const isRoot = relativeFilePath === this.getSettablePaths().root.relativeFilePath;
|
|
7733
|
-
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath :
|
|
7734
|
-
const fileContent = await readFileContent(
|
|
7471
|
+
const relativePath = isRoot ? this.getSettablePaths().root.relativeFilePath : join78(this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath);
|
|
7472
|
+
const fileContent = await readFileContent(join78(baseDir, relativePath));
|
|
7735
7473
|
return new _WarpRule({
|
|
7736
7474
|
baseDir,
|
|
7737
7475
|
relativeDirPath: isRoot ? this.getSettablePaths().root.relativeDirPath : ".warp",
|
|
@@ -7771,12 +7509,12 @@ var WarpRule = class _WarpRule extends ToolRule {
|
|
|
7771
7509
|
};
|
|
7772
7510
|
|
|
7773
7511
|
// src/features/rules/windsurf-rule.ts
|
|
7774
|
-
import { join as
|
|
7512
|
+
import { join as join79 } from "path";
|
|
7775
7513
|
var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
7776
7514
|
static getSettablePaths() {
|
|
7777
7515
|
return {
|
|
7778
7516
|
nonRoot: {
|
|
7779
|
-
relativeDirPath:
|
|
7517
|
+
relativeDirPath: join79(".windsurf", "rules")
|
|
7780
7518
|
}
|
|
7781
7519
|
};
|
|
7782
7520
|
}
|
|
@@ -7786,7 +7524,7 @@ var WindsurfRule = class _WindsurfRule extends ToolRule {
|
|
|
7786
7524
|
validate = true
|
|
7787
7525
|
}) {
|
|
7788
7526
|
const fileContent = await readFileContent(
|
|
7789
|
-
|
|
7527
|
+
join79(baseDir, this.getSettablePaths().nonRoot.relativeDirPath, relativeFilePath)
|
|
7790
7528
|
);
|
|
7791
7529
|
return new _WindsurfRule({
|
|
7792
7530
|
baseDir,
|
|
@@ -7845,25 +7583,54 @@ var rulesProcessorToolTargets = [
|
|
|
7845
7583
|
"warp",
|
|
7846
7584
|
"windsurf"
|
|
7847
7585
|
];
|
|
7848
|
-
var RulesProcessorToolTargetSchema =
|
|
7586
|
+
var RulesProcessorToolTargetSchema = z31.enum(rulesProcessorToolTargets);
|
|
7849
7587
|
var rulesProcessorToolTargetsGlobal = [
|
|
7850
7588
|
"claudecode",
|
|
7851
7589
|
"codexcli",
|
|
7852
7590
|
"geminicli"
|
|
7853
7591
|
];
|
|
7592
|
+
var toolRuleFactories = /* @__PURE__ */ new Map([
|
|
7593
|
+
["agentsmd", { class: AgentsMdRule, meta: { extension: "md" } }],
|
|
7594
|
+
["amazonqcli", { class: AmazonQCliRule, meta: { extension: "md" } }],
|
|
7595
|
+
["antigravity", { class: AntigravityRule, meta: { extension: "md" } }],
|
|
7596
|
+
["augmentcode", { class: AugmentcodeRule, meta: { extension: "md" } }],
|
|
7597
|
+
["augmentcode-legacy", { class: AugmentcodeLegacyRule, meta: { extension: "md" } }],
|
|
7598
|
+
["claudecode", { class: ClaudecodeRule, meta: { extension: "md" } }],
|
|
7599
|
+
["cline", { class: ClineRule, meta: { extension: "md" } }],
|
|
7600
|
+
["codexcli", { class: CodexcliRule, meta: { extension: "md" } }],
|
|
7601
|
+
["copilot", { class: CopilotRule, meta: { extension: "md" } }],
|
|
7602
|
+
["cursor", { class: CursorRule, meta: { extension: "mdc" } }],
|
|
7603
|
+
["geminicli", { class: GeminiCliRule, meta: { extension: "md" } }],
|
|
7604
|
+
["junie", { class: JunieRule, meta: { extension: "md" } }],
|
|
7605
|
+
["kiro", { class: KiroRule, meta: { extension: "md" } }],
|
|
7606
|
+
["opencode", { class: OpenCodeRule, meta: { extension: "md" } }],
|
|
7607
|
+
["qwencode", { class: QwencodeRule, meta: { extension: "md" } }],
|
|
7608
|
+
["roo", { class: RooRule, meta: { extension: "md" } }],
|
|
7609
|
+
["warp", { class: WarpRule, meta: { extension: "md" } }],
|
|
7610
|
+
["windsurf", { class: WindsurfRule, meta: { extension: "md" } }]
|
|
7611
|
+
]);
|
|
7612
|
+
var defaultGetFactory6 = (target) => {
|
|
7613
|
+
const factory = toolRuleFactories.get(target);
|
|
7614
|
+
if (!factory) {
|
|
7615
|
+
throw new Error(`Unsupported tool target: ${target}`);
|
|
7616
|
+
}
|
|
7617
|
+
return factory;
|
|
7618
|
+
};
|
|
7854
7619
|
var RulesProcessor = class extends FeatureProcessor {
|
|
7855
7620
|
toolTarget;
|
|
7856
7621
|
simulateCommands;
|
|
7857
7622
|
simulateSubagents;
|
|
7858
7623
|
simulateSkills;
|
|
7859
7624
|
global;
|
|
7625
|
+
getFactory;
|
|
7860
7626
|
constructor({
|
|
7861
7627
|
baseDir = process.cwd(),
|
|
7862
7628
|
toolTarget,
|
|
7863
7629
|
simulateCommands = false,
|
|
7864
7630
|
simulateSubagents = false,
|
|
7865
7631
|
simulateSkills = false,
|
|
7866
|
-
global = false
|
|
7632
|
+
global = false,
|
|
7633
|
+
getFactory = defaultGetFactory6
|
|
7867
7634
|
}) {
|
|
7868
7635
|
super({ baseDir });
|
|
7869
7636
|
const result = RulesProcessorToolTargetSchema.safeParse(toolTarget);
|
|
@@ -7877,181 +7644,23 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
7877
7644
|
this.simulateCommands = simulateCommands;
|
|
7878
7645
|
this.simulateSubagents = simulateSubagents;
|
|
7879
7646
|
this.simulateSkills = simulateSkills;
|
|
7647
|
+
this.getFactory = getFactory;
|
|
7880
7648
|
}
|
|
7881
7649
|
async convertRulesyncFilesToToolFiles(rulesyncFiles) {
|
|
7882
7650
|
const rulesyncRules = rulesyncFiles.filter(
|
|
7883
7651
|
(file) => file instanceof RulesyncRule
|
|
7884
7652
|
);
|
|
7653
|
+
const factory = this.getFactory(this.toolTarget);
|
|
7885
7654
|
const toolRules = rulesyncRules.map((rulesyncRule) => {
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
if (!AgentsMdRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7889
|
-
return null;
|
|
7890
|
-
}
|
|
7891
|
-
return AgentsMdRule.fromRulesyncRule({
|
|
7892
|
-
baseDir: this.baseDir,
|
|
7893
|
-
rulesyncRule,
|
|
7894
|
-
validate: true
|
|
7895
|
-
});
|
|
7896
|
-
case "amazonqcli":
|
|
7897
|
-
if (!AmazonQCliRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7898
|
-
return null;
|
|
7899
|
-
}
|
|
7900
|
-
return AmazonQCliRule.fromRulesyncRule({
|
|
7901
|
-
baseDir: this.baseDir,
|
|
7902
|
-
rulesyncRule,
|
|
7903
|
-
validate: true
|
|
7904
|
-
});
|
|
7905
|
-
case "antigravity":
|
|
7906
|
-
if (!AntigravityRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7907
|
-
return null;
|
|
7908
|
-
}
|
|
7909
|
-
return AntigravityRule.fromRulesyncRule({
|
|
7910
|
-
baseDir: this.baseDir,
|
|
7911
|
-
rulesyncRule,
|
|
7912
|
-
validate: true
|
|
7913
|
-
});
|
|
7914
|
-
case "augmentcode":
|
|
7915
|
-
if (!AugmentcodeRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7916
|
-
return null;
|
|
7917
|
-
}
|
|
7918
|
-
return AugmentcodeRule.fromRulesyncRule({
|
|
7919
|
-
baseDir: this.baseDir,
|
|
7920
|
-
rulesyncRule,
|
|
7921
|
-
validate: true
|
|
7922
|
-
});
|
|
7923
|
-
case "augmentcode-legacy":
|
|
7924
|
-
if (!AugmentcodeLegacyRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7925
|
-
return null;
|
|
7926
|
-
}
|
|
7927
|
-
return AugmentcodeLegacyRule.fromRulesyncRule({
|
|
7928
|
-
baseDir: this.baseDir,
|
|
7929
|
-
rulesyncRule,
|
|
7930
|
-
validate: true
|
|
7931
|
-
});
|
|
7932
|
-
case "claudecode":
|
|
7933
|
-
if (!ClaudecodeRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7934
|
-
return null;
|
|
7935
|
-
}
|
|
7936
|
-
return ClaudecodeRule.fromRulesyncRule({
|
|
7937
|
-
baseDir: this.baseDir,
|
|
7938
|
-
rulesyncRule,
|
|
7939
|
-
validate: true,
|
|
7940
|
-
global: this.global
|
|
7941
|
-
});
|
|
7942
|
-
case "cline":
|
|
7943
|
-
if (!ClineRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7944
|
-
return null;
|
|
7945
|
-
}
|
|
7946
|
-
return ClineRule.fromRulesyncRule({
|
|
7947
|
-
baseDir: this.baseDir,
|
|
7948
|
-
rulesyncRule,
|
|
7949
|
-
validate: true
|
|
7950
|
-
});
|
|
7951
|
-
case "codexcli":
|
|
7952
|
-
if (!CodexcliRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7953
|
-
return null;
|
|
7954
|
-
}
|
|
7955
|
-
return CodexcliRule.fromRulesyncRule({
|
|
7956
|
-
baseDir: this.baseDir,
|
|
7957
|
-
rulesyncRule,
|
|
7958
|
-
validate: true,
|
|
7959
|
-
global: this.global
|
|
7960
|
-
});
|
|
7961
|
-
case "copilot":
|
|
7962
|
-
if (!CopilotRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7963
|
-
return null;
|
|
7964
|
-
}
|
|
7965
|
-
return CopilotRule.fromRulesyncRule({
|
|
7966
|
-
baseDir: this.baseDir,
|
|
7967
|
-
rulesyncRule,
|
|
7968
|
-
validate: true
|
|
7969
|
-
});
|
|
7970
|
-
case "cursor":
|
|
7971
|
-
if (!CursorRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7972
|
-
return null;
|
|
7973
|
-
}
|
|
7974
|
-
return CursorRule.fromRulesyncRule({
|
|
7975
|
-
baseDir: this.baseDir,
|
|
7976
|
-
rulesyncRule,
|
|
7977
|
-
validate: true
|
|
7978
|
-
});
|
|
7979
|
-
case "geminicli":
|
|
7980
|
-
if (!GeminiCliRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7981
|
-
return null;
|
|
7982
|
-
}
|
|
7983
|
-
return GeminiCliRule.fromRulesyncRule({
|
|
7984
|
-
baseDir: this.baseDir,
|
|
7985
|
-
rulesyncRule,
|
|
7986
|
-
validate: true,
|
|
7987
|
-
global: this.global
|
|
7988
|
-
});
|
|
7989
|
-
case "junie":
|
|
7990
|
-
if (!JunieRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7991
|
-
return null;
|
|
7992
|
-
}
|
|
7993
|
-
return JunieRule.fromRulesyncRule({
|
|
7994
|
-
baseDir: this.baseDir,
|
|
7995
|
-
rulesyncRule,
|
|
7996
|
-
validate: true
|
|
7997
|
-
});
|
|
7998
|
-
case "kiro":
|
|
7999
|
-
if (!KiroRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
8000
|
-
return null;
|
|
8001
|
-
}
|
|
8002
|
-
return KiroRule.fromRulesyncRule({
|
|
8003
|
-
baseDir: this.baseDir,
|
|
8004
|
-
rulesyncRule,
|
|
8005
|
-
validate: true
|
|
8006
|
-
});
|
|
8007
|
-
case "opencode":
|
|
8008
|
-
if (!OpenCodeRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
8009
|
-
return null;
|
|
8010
|
-
}
|
|
8011
|
-
return OpenCodeRule.fromRulesyncRule({
|
|
8012
|
-
baseDir: this.baseDir,
|
|
8013
|
-
rulesyncRule,
|
|
8014
|
-
validate: true
|
|
8015
|
-
});
|
|
8016
|
-
case "qwencode":
|
|
8017
|
-
if (!QwencodeRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
8018
|
-
return null;
|
|
8019
|
-
}
|
|
8020
|
-
return QwencodeRule.fromRulesyncRule({
|
|
8021
|
-
baseDir: this.baseDir,
|
|
8022
|
-
rulesyncRule,
|
|
8023
|
-
validate: true
|
|
8024
|
-
});
|
|
8025
|
-
case "roo":
|
|
8026
|
-
if (!RooRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
8027
|
-
return null;
|
|
8028
|
-
}
|
|
8029
|
-
return RooRule.fromRulesyncRule({
|
|
8030
|
-
baseDir: this.baseDir,
|
|
8031
|
-
rulesyncRule,
|
|
8032
|
-
validate: true
|
|
8033
|
-
});
|
|
8034
|
-
case "warp":
|
|
8035
|
-
if (!WarpRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
8036
|
-
return null;
|
|
8037
|
-
}
|
|
8038
|
-
return WarpRule.fromRulesyncRule({
|
|
8039
|
-
baseDir: this.baseDir,
|
|
8040
|
-
rulesyncRule,
|
|
8041
|
-
validate: true
|
|
8042
|
-
});
|
|
8043
|
-
case "windsurf":
|
|
8044
|
-
if (!WindsurfRule.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
8045
|
-
return null;
|
|
8046
|
-
}
|
|
8047
|
-
return WindsurfRule.fromRulesyncRule({
|
|
8048
|
-
baseDir: this.baseDir,
|
|
8049
|
-
rulesyncRule,
|
|
8050
|
-
validate: true
|
|
8051
|
-
});
|
|
8052
|
-
default:
|
|
8053
|
-
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
7655
|
+
if (!factory.class.isTargetedByRulesyncRule(rulesyncRule)) {
|
|
7656
|
+
return null;
|
|
8054
7657
|
}
|
|
7658
|
+
return factory.class.fromRulesyncRule({
|
|
7659
|
+
baseDir: this.baseDir,
|
|
7660
|
+
rulesyncRule,
|
|
7661
|
+
validate: true,
|
|
7662
|
+
global: this.global
|
|
7663
|
+
});
|
|
8055
7664
|
}).filter((rule) => rule !== null);
|
|
8056
7665
|
const isSimulated = this.simulateCommands || this.simulateSubagents || this.simulateSkills;
|
|
8057
7666
|
if (isSimulated && this.toolTarget === "cursor") {
|
|
@@ -8208,10 +7817,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8208
7817
|
* Load and parse rulesync rule files from .rulesync/rules/ directory
|
|
8209
7818
|
*/
|
|
8210
7819
|
async loadRulesyncFiles() {
|
|
8211
|
-
const files = await findFilesByGlobs(
|
|
7820
|
+
const files = await findFilesByGlobs(join80(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md"));
|
|
8212
7821
|
logger.debug(`Found ${files.length} rulesync files`);
|
|
8213
7822
|
const rulesyncRules = await Promise.all(
|
|
8214
|
-
files.map((file) => RulesyncRule.fromFile({ relativeFilePath:
|
|
7823
|
+
files.map((file) => RulesyncRule.fromFile({ relativeFilePath: basename21(file) }))
|
|
8215
7824
|
);
|
|
8216
7825
|
const rootRules = rulesyncRules.filter((rule) => rule.getFrontmatter().root);
|
|
8217
7826
|
if (rootRules.length > 1) {
|
|
@@ -8229,10 +7838,10 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8229
7838
|
return rulesyncRules;
|
|
8230
7839
|
}
|
|
8231
7840
|
async loadRulesyncFilesLegacy() {
|
|
8232
|
-
const legacyFiles = await findFilesByGlobs(
|
|
7841
|
+
const legacyFiles = await findFilesByGlobs(join80(RULESYNC_RELATIVE_DIR_PATH, "*.md"));
|
|
8233
7842
|
logger.debug(`Found ${legacyFiles.length} legacy rulesync files`);
|
|
8234
7843
|
return Promise.all(
|
|
8235
|
-
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath:
|
|
7844
|
+
legacyFiles.map((file) => RulesyncRule.fromFileLegacy({ relativeFilePath: basename21(file) }))
|
|
8236
7845
|
);
|
|
8237
7846
|
}
|
|
8238
7847
|
/**
|
|
@@ -8243,365 +7852,54 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
8243
7852
|
forDeletion: _forDeletion = false
|
|
8244
7853
|
} = {}) {
|
|
8245
7854
|
try {
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
return
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
return
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
7855
|
+
const factory = this.getFactory(this.toolTarget);
|
|
7856
|
+
const settablePaths = factory.class.getSettablePaths({ global: this.global });
|
|
7857
|
+
const rootToolRules = await (async () => {
|
|
7858
|
+
if (!settablePaths.root) {
|
|
7859
|
+
return [];
|
|
7860
|
+
}
|
|
7861
|
+
const rootFilePaths = await findFilesByGlobs(
|
|
7862
|
+
join80(
|
|
7863
|
+
this.baseDir,
|
|
7864
|
+
settablePaths.root.relativeDirPath ?? ".",
|
|
7865
|
+
settablePaths.root.relativeFilePath
|
|
7866
|
+
)
|
|
7867
|
+
);
|
|
7868
|
+
return await Promise.all(
|
|
7869
|
+
rootFilePaths.map(
|
|
7870
|
+
(filePath) => factory.class.fromFile({
|
|
7871
|
+
baseDir: this.baseDir,
|
|
7872
|
+
relativeFilePath: basename21(filePath),
|
|
7873
|
+
global: this.global
|
|
7874
|
+
})
|
|
7875
|
+
)
|
|
7876
|
+
);
|
|
7877
|
+
})();
|
|
7878
|
+
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
7879
|
+
const nonRootToolRules = await (async () => {
|
|
7880
|
+
if (!settablePaths.nonRoot) {
|
|
7881
|
+
return [];
|
|
7882
|
+
}
|
|
7883
|
+
const nonRootFilePaths = await findFilesByGlobs(
|
|
7884
|
+
join80(this.baseDir, settablePaths.nonRoot.relativeDirPath, `*.${factory.meta.extension}`)
|
|
7885
|
+
);
|
|
7886
|
+
return await Promise.all(
|
|
7887
|
+
nonRootFilePaths.map(
|
|
7888
|
+
(filePath) => factory.class.fromFile({
|
|
7889
|
+
baseDir: this.baseDir,
|
|
7890
|
+
relativeFilePath: basename21(filePath),
|
|
7891
|
+
global: this.global
|
|
7892
|
+
})
|
|
7893
|
+
)
|
|
7894
|
+
);
|
|
7895
|
+
})();
|
|
7896
|
+
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
7897
|
+
return [...rootToolRules, ...nonRootToolRules];
|
|
8284
7898
|
} catch (error) {
|
|
8285
7899
|
logger.error(`Failed to load tool files: ${formatError(error)}`);
|
|
8286
7900
|
return [];
|
|
8287
7901
|
}
|
|
8288
7902
|
}
|
|
8289
|
-
async loadToolRulesDefault({
|
|
8290
|
-
root,
|
|
8291
|
-
nonRoot
|
|
8292
|
-
}) {
|
|
8293
|
-
const rootToolRules = await (async () => {
|
|
8294
|
-
if (!root) {
|
|
8295
|
-
return [];
|
|
8296
|
-
}
|
|
8297
|
-
const rootFilePaths = await findFilesByGlobs(
|
|
8298
|
-
join79(this.baseDir, root.relativeDirPath ?? ".", root.relativeFilePath)
|
|
8299
|
-
);
|
|
8300
|
-
return await Promise.all(
|
|
8301
|
-
rootFilePaths.map(
|
|
8302
|
-
(filePath) => root.fromFile({
|
|
8303
|
-
baseDir: this.baseDir,
|
|
8304
|
-
relativeFilePath: basename20(filePath),
|
|
8305
|
-
global: this.global
|
|
8306
|
-
})
|
|
8307
|
-
)
|
|
8308
|
-
);
|
|
8309
|
-
})();
|
|
8310
|
-
logger.debug(`Found ${rootToolRules.length} root tool rule files`);
|
|
8311
|
-
const nonRootToolRules = await (async () => {
|
|
8312
|
-
if (!nonRoot) {
|
|
8313
|
-
return [];
|
|
8314
|
-
}
|
|
8315
|
-
const nonRootFilePaths = await findFilesByGlobs(
|
|
8316
|
-
join79(this.baseDir, nonRoot.relativeDirPath, `*.${nonRoot.extension}`)
|
|
8317
|
-
);
|
|
8318
|
-
return await Promise.all(
|
|
8319
|
-
nonRootFilePaths.map(
|
|
8320
|
-
(filePath) => nonRoot.fromFile({
|
|
8321
|
-
baseDir: this.baseDir,
|
|
8322
|
-
relativeFilePath: basename20(filePath),
|
|
8323
|
-
global: this.global
|
|
8324
|
-
})
|
|
8325
|
-
)
|
|
8326
|
-
);
|
|
8327
|
-
})();
|
|
8328
|
-
logger.debug(`Found ${nonRootToolRules.length} non-root tool rule files`);
|
|
8329
|
-
return [...rootToolRules, ...nonRootToolRules];
|
|
8330
|
-
}
|
|
8331
|
-
/**
|
|
8332
|
-
* Load AGENTS.md rule configuration
|
|
8333
|
-
*/
|
|
8334
|
-
async loadAgentsmdRules() {
|
|
8335
|
-
const settablePaths = AgentsMdRule.getSettablePaths();
|
|
8336
|
-
return await this.loadToolRulesDefault({
|
|
8337
|
-
root: {
|
|
8338
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8339
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8340
|
-
fromFile: (params) => AgentsMdRule.fromFile(params)
|
|
8341
|
-
},
|
|
8342
|
-
nonRoot: {
|
|
8343
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8344
|
-
fromFile: (params) => AgentsMdRule.fromFile(params),
|
|
8345
|
-
extension: "md"
|
|
8346
|
-
}
|
|
8347
|
-
});
|
|
8348
|
-
}
|
|
8349
|
-
async loadWarpRules() {
|
|
8350
|
-
const settablePaths = WarpRule.getSettablePaths();
|
|
8351
|
-
return await this.loadToolRulesDefault({
|
|
8352
|
-
root: {
|
|
8353
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8354
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8355
|
-
fromFile: (params) => WarpRule.fromFile(params)
|
|
8356
|
-
},
|
|
8357
|
-
nonRoot: {
|
|
8358
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8359
|
-
fromFile: (params) => WarpRule.fromFile(params),
|
|
8360
|
-
extension: "md"
|
|
8361
|
-
}
|
|
8362
|
-
});
|
|
8363
|
-
}
|
|
8364
|
-
/**
|
|
8365
|
-
* Load Amazon Q Developer CLI rule configurations from .amazonq/rules/ directory
|
|
8366
|
-
*/
|
|
8367
|
-
async loadAmazonqcliRules() {
|
|
8368
|
-
const settablePaths = AmazonQCliRule.getSettablePaths();
|
|
8369
|
-
return await this.loadToolRulesDefault({
|
|
8370
|
-
nonRoot: {
|
|
8371
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8372
|
-
fromFile: (params) => AmazonQCliRule.fromFile(params),
|
|
8373
|
-
extension: "md"
|
|
8374
|
-
}
|
|
8375
|
-
});
|
|
8376
|
-
}
|
|
8377
|
-
/**
|
|
8378
|
-
* Load AugmentCode rule configurations from .augment/rules/ directory
|
|
8379
|
-
*/
|
|
8380
|
-
async loadAugmentcodeRules() {
|
|
8381
|
-
const settablePaths = AugmentcodeRule.getSettablePaths();
|
|
8382
|
-
return await this.loadToolRulesDefault({
|
|
8383
|
-
nonRoot: {
|
|
8384
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8385
|
-
fromFile: (params) => AugmentcodeRule.fromFile(params),
|
|
8386
|
-
extension: "md"
|
|
8387
|
-
}
|
|
8388
|
-
});
|
|
8389
|
-
}
|
|
8390
|
-
/**
|
|
8391
|
-
* Load AugmentCode legacy rule configuration from .augment-guidelines file and .augment/rules/ directory
|
|
8392
|
-
*/
|
|
8393
|
-
async loadAugmentcodeLegacyRules() {
|
|
8394
|
-
const settablePaths = AugmentcodeLegacyRule.getSettablePaths();
|
|
8395
|
-
return await this.loadToolRulesDefault({
|
|
8396
|
-
root: {
|
|
8397
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8398
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8399
|
-
fromFile: (params) => AugmentcodeLegacyRule.fromFile(params)
|
|
8400
|
-
},
|
|
8401
|
-
nonRoot: {
|
|
8402
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8403
|
-
fromFile: (params) => AugmentcodeLegacyRule.fromFile(params),
|
|
8404
|
-
extension: "md"
|
|
8405
|
-
}
|
|
8406
|
-
});
|
|
8407
|
-
}
|
|
8408
|
-
/**
|
|
8409
|
-
* Load Claude Code rule configuration from CLAUDE.md file
|
|
8410
|
-
*/
|
|
8411
|
-
async loadClaudecodeRules() {
|
|
8412
|
-
const settablePaths = ClaudecodeRule.getSettablePaths({ global: this.global });
|
|
8413
|
-
return this.loadToolRulesDefault({
|
|
8414
|
-
root: {
|
|
8415
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8416
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8417
|
-
fromFile: (params) => ClaudecodeRule.fromFile(params)
|
|
8418
|
-
},
|
|
8419
|
-
...settablePaths.nonRoot ? {
|
|
8420
|
-
nonRoot: {
|
|
8421
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8422
|
-
fromFile: (params) => ClaudecodeRule.fromFile(params),
|
|
8423
|
-
extension: "md"
|
|
8424
|
-
}
|
|
8425
|
-
} : {}
|
|
8426
|
-
});
|
|
8427
|
-
}
|
|
8428
|
-
/**
|
|
8429
|
-
* Load Cline rule configurations from .clinerules/ directory
|
|
8430
|
-
*/
|
|
8431
|
-
async loadClineRules() {
|
|
8432
|
-
const settablePaths = ClineRule.getSettablePaths();
|
|
8433
|
-
return await this.loadToolRulesDefault({
|
|
8434
|
-
nonRoot: {
|
|
8435
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8436
|
-
fromFile: (params) => ClineRule.fromFile(params),
|
|
8437
|
-
extension: "md"
|
|
8438
|
-
}
|
|
8439
|
-
});
|
|
8440
|
-
}
|
|
8441
|
-
/**
|
|
8442
|
-
* Load OpenAI Codex CLI rule configuration from AGENTS.md and .codex/memories/*.md files
|
|
8443
|
-
*/
|
|
8444
|
-
async loadCodexcliRules() {
|
|
8445
|
-
const settablePaths = CodexcliRule.getSettablePaths({ global: this.global });
|
|
8446
|
-
return await this.loadToolRulesDefault({
|
|
8447
|
-
root: {
|
|
8448
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8449
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8450
|
-
fromFile: (params) => CodexcliRule.fromFile(params)
|
|
8451
|
-
},
|
|
8452
|
-
...settablePaths.nonRoot ? {
|
|
8453
|
-
nonRoot: {
|
|
8454
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8455
|
-
fromFile: (params) => CodexcliRule.fromFile(params),
|
|
8456
|
-
extension: "md"
|
|
8457
|
-
}
|
|
8458
|
-
} : {}
|
|
8459
|
-
});
|
|
8460
|
-
}
|
|
8461
|
-
/**
|
|
8462
|
-
* Load GitHub Copilot rule configuration from .github/copilot-instructions.md file
|
|
8463
|
-
*/
|
|
8464
|
-
async loadCopilotRules() {
|
|
8465
|
-
const settablePaths = CopilotRule.getSettablePaths();
|
|
8466
|
-
return await this.loadToolRulesDefault({
|
|
8467
|
-
root: {
|
|
8468
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8469
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8470
|
-
fromFile: (params) => CopilotRule.fromFile(params)
|
|
8471
|
-
},
|
|
8472
|
-
nonRoot: {
|
|
8473
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8474
|
-
fromFile: (params) => CopilotRule.fromFile(params),
|
|
8475
|
-
extension: "md"
|
|
8476
|
-
}
|
|
8477
|
-
});
|
|
8478
|
-
}
|
|
8479
|
-
/**
|
|
8480
|
-
* Load Cursor rule configurations from .cursor/rules/ directory
|
|
8481
|
-
*/
|
|
8482
|
-
async loadCursorRules() {
|
|
8483
|
-
const settablePaths = CursorRule.getSettablePaths();
|
|
8484
|
-
return await this.loadToolRulesDefault({
|
|
8485
|
-
nonRoot: {
|
|
8486
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8487
|
-
fromFile: (params) => CursorRule.fromFile(params),
|
|
8488
|
-
extension: "mdc"
|
|
8489
|
-
}
|
|
8490
|
-
});
|
|
8491
|
-
}
|
|
8492
|
-
/**
|
|
8493
|
-
* Load Gemini CLI rule configuration from GEMINI.md file
|
|
8494
|
-
*/
|
|
8495
|
-
async loadGeminicliRules() {
|
|
8496
|
-
const settablePaths = GeminiCliRule.getSettablePaths({ global: this.global });
|
|
8497
|
-
return await this.loadToolRulesDefault({
|
|
8498
|
-
root: {
|
|
8499
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8500
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8501
|
-
fromFile: (params) => GeminiCliRule.fromFile(params)
|
|
8502
|
-
},
|
|
8503
|
-
...settablePaths.nonRoot ? {
|
|
8504
|
-
nonRoot: {
|
|
8505
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8506
|
-
fromFile: (params) => GeminiCliRule.fromFile(params),
|
|
8507
|
-
extension: "md"
|
|
8508
|
-
}
|
|
8509
|
-
} : {}
|
|
8510
|
-
});
|
|
8511
|
-
}
|
|
8512
|
-
/**
|
|
8513
|
-
* Load JetBrains Junie rule configuration from .junie/guidelines.md file
|
|
8514
|
-
*/
|
|
8515
|
-
async loadJunieRules() {
|
|
8516
|
-
const settablePaths = JunieRule.getSettablePaths();
|
|
8517
|
-
return await this.loadToolRulesDefault({
|
|
8518
|
-
root: {
|
|
8519
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8520
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8521
|
-
fromFile: (params) => JunieRule.fromFile(params)
|
|
8522
|
-
},
|
|
8523
|
-
nonRoot: {
|
|
8524
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8525
|
-
fromFile: (params) => JunieRule.fromFile(params),
|
|
8526
|
-
extension: "md"
|
|
8527
|
-
}
|
|
8528
|
-
});
|
|
8529
|
-
}
|
|
8530
|
-
/**
|
|
8531
|
-
* Load Kiro rule configurations from .kiro/steering/ directory
|
|
8532
|
-
*/
|
|
8533
|
-
async loadKiroRules() {
|
|
8534
|
-
const settablePaths = KiroRule.getSettablePaths();
|
|
8535
|
-
return await this.loadToolRulesDefault({
|
|
8536
|
-
nonRoot: {
|
|
8537
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8538
|
-
fromFile: (params) => KiroRule.fromFile(params),
|
|
8539
|
-
extension: "md"
|
|
8540
|
-
}
|
|
8541
|
-
});
|
|
8542
|
-
}
|
|
8543
|
-
/**
|
|
8544
|
-
* Load OpenCode rule configuration from AGENTS.md file and .opencode/memories/*.md files
|
|
8545
|
-
*/
|
|
8546
|
-
async loadOpencodeRules() {
|
|
8547
|
-
const settablePaths = OpenCodeRule.getSettablePaths();
|
|
8548
|
-
return await this.loadToolRulesDefault({
|
|
8549
|
-
root: {
|
|
8550
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8551
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8552
|
-
fromFile: (params) => OpenCodeRule.fromFile(params)
|
|
8553
|
-
},
|
|
8554
|
-
nonRoot: {
|
|
8555
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8556
|
-
fromFile: (params) => OpenCodeRule.fromFile(params),
|
|
8557
|
-
extension: "md"
|
|
8558
|
-
}
|
|
8559
|
-
});
|
|
8560
|
-
}
|
|
8561
|
-
/**
|
|
8562
|
-
* Load Qwen Code rule configuration from QWEN.md file and .qwen/memories/*.md files
|
|
8563
|
-
*/
|
|
8564
|
-
async loadQwencodeRules() {
|
|
8565
|
-
const settablePaths = QwencodeRule.getSettablePaths();
|
|
8566
|
-
return await this.loadToolRulesDefault({
|
|
8567
|
-
root: {
|
|
8568
|
-
relativeDirPath: settablePaths.root.relativeDirPath,
|
|
8569
|
-
relativeFilePath: settablePaths.root.relativeFilePath,
|
|
8570
|
-
fromFile: (params) => QwencodeRule.fromFile(params)
|
|
8571
|
-
},
|
|
8572
|
-
nonRoot: {
|
|
8573
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8574
|
-
fromFile: (params) => QwencodeRule.fromFile(params),
|
|
8575
|
-
extension: "md"
|
|
8576
|
-
}
|
|
8577
|
-
});
|
|
8578
|
-
}
|
|
8579
|
-
/**
|
|
8580
|
-
* Load Roo Code rule configurations from .roo/rules/ directory
|
|
8581
|
-
*/
|
|
8582
|
-
async loadRooRules() {
|
|
8583
|
-
const settablePaths = RooRule.getSettablePaths();
|
|
8584
|
-
return await this.loadToolRulesDefault({
|
|
8585
|
-
nonRoot: {
|
|
8586
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8587
|
-
fromFile: (params) => RooRule.fromFile(params),
|
|
8588
|
-
extension: "md"
|
|
8589
|
-
}
|
|
8590
|
-
});
|
|
8591
|
-
}
|
|
8592
|
-
/**
|
|
8593
|
-
* Load Windsurf rule configurations from .windsurf/rules/ directory
|
|
8594
|
-
*/
|
|
8595
|
-
async loadWindsurfRules() {
|
|
8596
|
-
const settablePaths = WindsurfRule.getSettablePaths();
|
|
8597
|
-
return await this.loadToolRulesDefault({
|
|
8598
|
-
nonRoot: {
|
|
8599
|
-
relativeDirPath: settablePaths.nonRoot.relativeDirPath,
|
|
8600
|
-
fromFile: (params) => WindsurfRule.fromFile(params),
|
|
8601
|
-
extension: "md"
|
|
8602
|
-
}
|
|
8603
|
-
});
|
|
8604
|
-
}
|
|
8605
7903
|
/**
|
|
8606
7904
|
* Implementation of abstract method from FeatureProcessor
|
|
8607
7905
|
* Return the tool targets that this processor supports
|
|
@@ -8690,21 +7988,21 @@ s/<command> [arguments]
|
|
|
8690
7988
|
This syntax employs a double slash (\`s/\`) to prevent conflicts with built-in slash commands.
|
|
8691
7989
|
The \`s\` in \`s/\` stands for *simulate*. Because custom slash commands are not built-in, this syntax provides a pseudo way to invoke them.
|
|
8692
7990
|
|
|
8693
|
-
When users call a custom slash command, you have to look for the markdown file, \`${
|
|
7991
|
+
When users call a custom slash command, you have to look for the markdown file, \`${join80(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "{command}.md")}\`, then execute the contents of that file as the block of operations.` : "";
|
|
8694
7992
|
const subagentsSection = subagents ? `## Simulated Subagents
|
|
8695
7993
|
|
|
8696
7994
|
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.
|
|
8697
7995
|
|
|
8698
|
-
When users call a simulated subagent, it will look for the corresponding markdown file, \`${
|
|
7996
|
+
When users call a simulated subagent, it will look for the corresponding markdown file, \`${join80(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "{subagent}.md")}\`, and execute its contents as the block of operations.
|
|
8699
7997
|
|
|
8700
|
-
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${
|
|
7998
|
+
For example, if the user instructs \`Call planner subagent to plan the refactoring\`, you have to look for the markdown file, \`${join80(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "planner.md")}\`, and execute its contents as the block of operations.` : "";
|
|
8701
7999
|
const skillsSection = skills ? `## Simulated Skills
|
|
8702
8000
|
|
|
8703
8001
|
Simulated skills are specialized capabilities that can be invoked to handle specific types of tasks.
|
|
8704
8002
|
|
|
8705
|
-
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${
|
|
8003
|
+
When users invoke a simulated skill, look for the corresponding SKILL.md file in \`${join80(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "{skill}/SKILL.md")}\` and execute its contents as the block of operations.
|
|
8706
8004
|
|
|
8707
|
-
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${
|
|
8005
|
+
For example, if the user instructs \`Use the skill example-skill to achieve something\`, look for \`${join80(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "example-skill/SKILL.md")}\` and execute its contents.
|
|
8708
8006
|
|
|
8709
8007
|
Additionally, you should proactively consider using available skills when they would help accomplish a task more effectively, even if the user doesn't explicitly request them.` : "";
|
|
8710
8008
|
const result = [
|
|
@@ -8966,9 +8264,9 @@ async function generateSkills(config) {
|
|
|
8966
8264
|
}
|
|
8967
8265
|
|
|
8968
8266
|
// src/cli/commands/gitignore.ts
|
|
8969
|
-
import { join as
|
|
8267
|
+
import { join as join81 } from "path";
|
|
8970
8268
|
var gitignoreCommand = async () => {
|
|
8971
|
-
const gitignorePath =
|
|
8269
|
+
const gitignorePath = join81(process.cwd(), ".gitignore");
|
|
8972
8270
|
const rulesFilesToIgnore = [
|
|
8973
8271
|
"# Generated by rulesync - AI tool configuration files",
|
|
8974
8272
|
// AGENTS.md
|
|
@@ -9020,7 +8318,7 @@ var gitignoreCommand = async () => {
|
|
|
9020
8318
|
"**/.aiignore",
|
|
9021
8319
|
// OpenCode
|
|
9022
8320
|
"**/.opencode/memories/",
|
|
9023
|
-
"**/.opencode/
|
|
8321
|
+
"**/.opencode/command/",
|
|
9024
8322
|
"**/opencode.json",
|
|
9025
8323
|
// Qwen
|
|
9026
8324
|
"**/QWEN.md",
|
|
@@ -9241,7 +8539,7 @@ async function importSkills(config, tool) {
|
|
|
9241
8539
|
}
|
|
9242
8540
|
|
|
9243
8541
|
// src/cli/commands/init.ts
|
|
9244
|
-
import { join as
|
|
8542
|
+
import { join as join82 } from "path";
|
|
9245
8543
|
async function initCommand() {
|
|
9246
8544
|
logger.info("Initializing rulesync...");
|
|
9247
8545
|
await ensureDir(RULESYNC_RELATIVE_DIR_PATH);
|
|
@@ -9404,14 +8702,14 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9404
8702
|
await ensureDir(commandPaths.relativeDirPath);
|
|
9405
8703
|
await ensureDir(subagentPaths.relativeDirPath);
|
|
9406
8704
|
await ensureDir(ignorePaths.recommended.relativeDirPath);
|
|
9407
|
-
const ruleFilepath =
|
|
8705
|
+
const ruleFilepath = join82(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
9408
8706
|
if (!await fileExists(ruleFilepath)) {
|
|
9409
8707
|
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
9410
8708
|
logger.success(`Created ${ruleFilepath}`);
|
|
9411
8709
|
} else {
|
|
9412
8710
|
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
9413
8711
|
}
|
|
9414
|
-
const mcpFilepath =
|
|
8712
|
+
const mcpFilepath = join82(
|
|
9415
8713
|
mcpPaths.recommended.relativeDirPath,
|
|
9416
8714
|
mcpPaths.recommended.relativeFilePath
|
|
9417
8715
|
);
|
|
@@ -9421,21 +8719,21 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9421
8719
|
} else {
|
|
9422
8720
|
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
9423
8721
|
}
|
|
9424
|
-
const commandFilepath =
|
|
8722
|
+
const commandFilepath = join82(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
9425
8723
|
if (!await fileExists(commandFilepath)) {
|
|
9426
8724
|
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
9427
8725
|
logger.success(`Created ${commandFilepath}`);
|
|
9428
8726
|
} else {
|
|
9429
8727
|
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
9430
8728
|
}
|
|
9431
|
-
const subagentFilepath =
|
|
8729
|
+
const subagentFilepath = join82(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
9432
8730
|
if (!await fileExists(subagentFilepath)) {
|
|
9433
8731
|
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
9434
8732
|
logger.success(`Created ${subagentFilepath}`);
|
|
9435
8733
|
} else {
|
|
9436
8734
|
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
9437
8735
|
}
|
|
9438
|
-
const ignoreFilepath =
|
|
8736
|
+
const ignoreFilepath = join82(
|
|
9439
8737
|
ignorePaths.recommended.relativeDirPath,
|
|
9440
8738
|
ignorePaths.recommended.relativeFilePath
|
|
9441
8739
|
);
|
|
@@ -9451,12 +8749,12 @@ Attention, again, you are just the planner, so though you can read any files and
|
|
|
9451
8749
|
import { FastMCP } from "fastmcp";
|
|
9452
8750
|
|
|
9453
8751
|
// src/mcp/commands.ts
|
|
9454
|
-
import { basename as
|
|
9455
|
-
import { z as
|
|
8752
|
+
import { basename as basename22, join as join83 } from "path";
|
|
8753
|
+
import { z as z32 } from "zod/mini";
|
|
9456
8754
|
var maxCommandSizeBytes = 1024 * 1024;
|
|
9457
8755
|
var maxCommandsCount = 1e3;
|
|
9458
8756
|
async function listCommands() {
|
|
9459
|
-
const commandsDir =
|
|
8757
|
+
const commandsDir = join83(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9460
8758
|
try {
|
|
9461
8759
|
const files = await listDirectoryFiles(commandsDir);
|
|
9462
8760
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9468,7 +8766,7 @@ async function listCommands() {
|
|
|
9468
8766
|
});
|
|
9469
8767
|
const frontmatter = command.getFrontmatter();
|
|
9470
8768
|
return {
|
|
9471
|
-
relativePathFromCwd:
|
|
8769
|
+
relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, file),
|
|
9472
8770
|
frontmatter
|
|
9473
8771
|
};
|
|
9474
8772
|
} catch (error) {
|
|
@@ -9488,13 +8786,13 @@ async function getCommand({ relativePathFromCwd }) {
|
|
|
9488
8786
|
relativePath: relativePathFromCwd,
|
|
9489
8787
|
intendedRootDir: process.cwd()
|
|
9490
8788
|
});
|
|
9491
|
-
const filename =
|
|
8789
|
+
const filename = basename22(relativePathFromCwd);
|
|
9492
8790
|
try {
|
|
9493
8791
|
const command = await RulesyncCommand.fromFile({
|
|
9494
8792
|
relativeFilePath: filename
|
|
9495
8793
|
});
|
|
9496
8794
|
return {
|
|
9497
|
-
relativePathFromCwd:
|
|
8795
|
+
relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9498
8796
|
frontmatter: command.getFrontmatter(),
|
|
9499
8797
|
body: command.getBody()
|
|
9500
8798
|
};
|
|
@@ -9513,7 +8811,7 @@ async function putCommand({
|
|
|
9513
8811
|
relativePath: relativePathFromCwd,
|
|
9514
8812
|
intendedRootDir: process.cwd()
|
|
9515
8813
|
});
|
|
9516
|
-
const filename =
|
|
8814
|
+
const filename = basename22(relativePathFromCwd);
|
|
9517
8815
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9518
8816
|
if (estimatedSize > maxCommandSizeBytes) {
|
|
9519
8817
|
throw new Error(
|
|
@@ -9523,7 +8821,7 @@ async function putCommand({
|
|
|
9523
8821
|
try {
|
|
9524
8822
|
const existingCommands = await listCommands();
|
|
9525
8823
|
const isUpdate = existingCommands.some(
|
|
9526
|
-
(command2) => command2.relativePathFromCwd ===
|
|
8824
|
+
(command2) => command2.relativePathFromCwd === join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9527
8825
|
);
|
|
9528
8826
|
if (!isUpdate && existingCommands.length >= maxCommandsCount) {
|
|
9529
8827
|
throw new Error(`Maximum number of commands (${maxCommandsCount}) reached`);
|
|
@@ -9538,11 +8836,11 @@ async function putCommand({
|
|
|
9538
8836
|
fileContent,
|
|
9539
8837
|
validate: true
|
|
9540
8838
|
});
|
|
9541
|
-
const commandsDir =
|
|
8839
|
+
const commandsDir = join83(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH);
|
|
9542
8840
|
await ensureDir(commandsDir);
|
|
9543
8841
|
await writeFileContent(command.getFilePath(), command.getFileContent());
|
|
9544
8842
|
return {
|
|
9545
|
-
relativePathFromCwd:
|
|
8843
|
+
relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename),
|
|
9546
8844
|
frontmatter: command.getFrontmatter(),
|
|
9547
8845
|
body: command.getBody()
|
|
9548
8846
|
};
|
|
@@ -9557,12 +8855,12 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9557
8855
|
relativePath: relativePathFromCwd,
|
|
9558
8856
|
intendedRootDir: process.cwd()
|
|
9559
8857
|
});
|
|
9560
|
-
const filename =
|
|
9561
|
-
const fullPath =
|
|
8858
|
+
const filename = basename22(relativePathFromCwd);
|
|
8859
|
+
const fullPath = join83(process.cwd(), RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename);
|
|
9562
8860
|
try {
|
|
9563
8861
|
await removeFile(fullPath);
|
|
9564
8862
|
return {
|
|
9565
|
-
relativePathFromCwd:
|
|
8863
|
+
relativePathFromCwd: join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, filename)
|
|
9566
8864
|
};
|
|
9567
8865
|
} catch (error) {
|
|
9568
8866
|
throw new Error(`Failed to delete command file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9571,23 +8869,23 @@ async function deleteCommand({ relativePathFromCwd }) {
|
|
|
9571
8869
|
}
|
|
9572
8870
|
}
|
|
9573
8871
|
var commandToolSchemas = {
|
|
9574
|
-
listCommands:
|
|
9575
|
-
getCommand:
|
|
9576
|
-
relativePathFromCwd:
|
|
8872
|
+
listCommands: z32.object({}),
|
|
8873
|
+
getCommand: z32.object({
|
|
8874
|
+
relativePathFromCwd: z32.string()
|
|
9577
8875
|
}),
|
|
9578
|
-
putCommand:
|
|
9579
|
-
relativePathFromCwd:
|
|
8876
|
+
putCommand: z32.object({
|
|
8877
|
+
relativePathFromCwd: z32.string(),
|
|
9580
8878
|
frontmatter: RulesyncCommandFrontmatterSchema,
|
|
9581
|
-
body:
|
|
8879
|
+
body: z32.string()
|
|
9582
8880
|
}),
|
|
9583
|
-
deleteCommand:
|
|
9584
|
-
relativePathFromCwd:
|
|
8881
|
+
deleteCommand: z32.object({
|
|
8882
|
+
relativePathFromCwd: z32.string()
|
|
9585
8883
|
})
|
|
9586
8884
|
};
|
|
9587
8885
|
var commandTools = {
|
|
9588
8886
|
listCommands: {
|
|
9589
8887
|
name: "listCommands",
|
|
9590
|
-
description: `List all commands from ${
|
|
8888
|
+
description: `List all commands from ${join83(RULESYNC_COMMANDS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9591
8889
|
parameters: commandToolSchemas.listCommands,
|
|
9592
8890
|
execute: async () => {
|
|
9593
8891
|
const commands = await listCommands();
|
|
@@ -9629,11 +8927,11 @@ var commandTools = {
|
|
|
9629
8927
|
};
|
|
9630
8928
|
|
|
9631
8929
|
// src/mcp/ignore.ts
|
|
9632
|
-
import { join as
|
|
9633
|
-
import { z as
|
|
8930
|
+
import { join as join84 } from "path";
|
|
8931
|
+
import { z as z33 } from "zod/mini";
|
|
9634
8932
|
var maxIgnoreFileSizeBytes = 100 * 1024;
|
|
9635
8933
|
async function getIgnoreFile() {
|
|
9636
|
-
const ignoreFilePath =
|
|
8934
|
+
const ignoreFilePath = join84(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9637
8935
|
try {
|
|
9638
8936
|
const content = await readFileContent(ignoreFilePath);
|
|
9639
8937
|
return {
|
|
@@ -9647,7 +8945,7 @@ async function getIgnoreFile() {
|
|
|
9647
8945
|
}
|
|
9648
8946
|
}
|
|
9649
8947
|
async function putIgnoreFile({ content }) {
|
|
9650
|
-
const ignoreFilePath =
|
|
8948
|
+
const ignoreFilePath = join84(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
9651
8949
|
const contentSizeBytes = Buffer.byteLength(content, "utf8");
|
|
9652
8950
|
if (contentSizeBytes > maxIgnoreFileSizeBytes) {
|
|
9653
8951
|
throw new Error(
|
|
@@ -9668,8 +8966,8 @@ async function putIgnoreFile({ content }) {
|
|
|
9668
8966
|
}
|
|
9669
8967
|
}
|
|
9670
8968
|
async function deleteIgnoreFile() {
|
|
9671
|
-
const aiignorePath =
|
|
9672
|
-
const legacyIgnorePath =
|
|
8969
|
+
const aiignorePath = join84(process.cwd(), RULESYNC_AIIGNORE_RELATIVE_FILE_PATH);
|
|
8970
|
+
const legacyIgnorePath = join84(process.cwd(), RULESYNC_IGNORE_RELATIVE_FILE_PATH);
|
|
9673
8971
|
try {
|
|
9674
8972
|
await Promise.all([removeFile(aiignorePath), removeFile(legacyIgnorePath)]);
|
|
9675
8973
|
return {
|
|
@@ -9687,11 +8985,11 @@ async function deleteIgnoreFile() {
|
|
|
9687
8985
|
}
|
|
9688
8986
|
}
|
|
9689
8987
|
var ignoreToolSchemas = {
|
|
9690
|
-
getIgnoreFile:
|
|
9691
|
-
putIgnoreFile:
|
|
9692
|
-
content:
|
|
8988
|
+
getIgnoreFile: z33.object({}),
|
|
8989
|
+
putIgnoreFile: z33.object({
|
|
8990
|
+
content: z33.string()
|
|
9693
8991
|
}),
|
|
9694
|
-
deleteIgnoreFile:
|
|
8992
|
+
deleteIgnoreFile: z33.object({})
|
|
9695
8993
|
};
|
|
9696
8994
|
var ignoreTools = {
|
|
9697
8995
|
getIgnoreFile: {
|
|
@@ -9724,8 +9022,8 @@ var ignoreTools = {
|
|
|
9724
9022
|
};
|
|
9725
9023
|
|
|
9726
9024
|
// src/mcp/mcp.ts
|
|
9727
|
-
import { join as
|
|
9728
|
-
import { z as
|
|
9025
|
+
import { join as join85 } from "path";
|
|
9026
|
+
import { z as z34 } from "zod/mini";
|
|
9729
9027
|
var maxMcpSizeBytes = 1024 * 1024;
|
|
9730
9028
|
async function getMcpFile() {
|
|
9731
9029
|
const config = await ConfigResolver.resolve({});
|
|
@@ -9734,7 +9032,7 @@ async function getMcpFile() {
|
|
|
9734
9032
|
validate: true,
|
|
9735
9033
|
modularMcp: config.getModularMcp()
|
|
9736
9034
|
});
|
|
9737
|
-
const relativePathFromCwd =
|
|
9035
|
+
const relativePathFromCwd = join85(
|
|
9738
9036
|
rulesyncMcp.getRelativeDirPath(),
|
|
9739
9037
|
rulesyncMcp.getRelativeFilePath()
|
|
9740
9038
|
);
|
|
@@ -9767,7 +9065,7 @@ async function putMcpFile({ content }) {
|
|
|
9767
9065
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9768
9066
|
const relativeDirPath = paths.recommended.relativeDirPath;
|
|
9769
9067
|
const relativeFilePath = paths.recommended.relativeFilePath;
|
|
9770
|
-
const fullPath =
|
|
9068
|
+
const fullPath = join85(baseDir, relativeDirPath, relativeFilePath);
|
|
9771
9069
|
const rulesyncMcp = new RulesyncMcp({
|
|
9772
9070
|
baseDir,
|
|
9773
9071
|
relativeDirPath,
|
|
@@ -9776,9 +9074,9 @@ async function putMcpFile({ content }) {
|
|
|
9776
9074
|
validate: true,
|
|
9777
9075
|
modularMcp: config.getModularMcp()
|
|
9778
9076
|
});
|
|
9779
|
-
await ensureDir(
|
|
9077
|
+
await ensureDir(join85(baseDir, relativeDirPath));
|
|
9780
9078
|
await writeFileContent(fullPath, content);
|
|
9781
|
-
const relativePathFromCwd =
|
|
9079
|
+
const relativePathFromCwd = join85(relativeDirPath, relativeFilePath);
|
|
9782
9080
|
return {
|
|
9783
9081
|
relativePathFromCwd,
|
|
9784
9082
|
content: rulesyncMcp.getFileContent()
|
|
@@ -9793,15 +9091,15 @@ async function deleteMcpFile() {
|
|
|
9793
9091
|
try {
|
|
9794
9092
|
const baseDir = process.cwd();
|
|
9795
9093
|
const paths = RulesyncMcp.getSettablePaths();
|
|
9796
|
-
const recommendedPath =
|
|
9094
|
+
const recommendedPath = join85(
|
|
9797
9095
|
baseDir,
|
|
9798
9096
|
paths.recommended.relativeDirPath,
|
|
9799
9097
|
paths.recommended.relativeFilePath
|
|
9800
9098
|
);
|
|
9801
|
-
const legacyPath =
|
|
9099
|
+
const legacyPath = join85(baseDir, paths.legacy.relativeDirPath, paths.legacy.relativeFilePath);
|
|
9802
9100
|
await removeFile(recommendedPath);
|
|
9803
9101
|
await removeFile(legacyPath);
|
|
9804
|
-
const relativePathFromCwd =
|
|
9102
|
+
const relativePathFromCwd = join85(
|
|
9805
9103
|
paths.recommended.relativeDirPath,
|
|
9806
9104
|
paths.recommended.relativeFilePath
|
|
9807
9105
|
);
|
|
@@ -9815,11 +9113,11 @@ async function deleteMcpFile() {
|
|
|
9815
9113
|
}
|
|
9816
9114
|
}
|
|
9817
9115
|
var mcpToolSchemas = {
|
|
9818
|
-
getMcpFile:
|
|
9819
|
-
putMcpFile:
|
|
9820
|
-
content:
|
|
9116
|
+
getMcpFile: z34.object({}),
|
|
9117
|
+
putMcpFile: z34.object({
|
|
9118
|
+
content: z34.string()
|
|
9821
9119
|
}),
|
|
9822
|
-
deleteMcpFile:
|
|
9120
|
+
deleteMcpFile: z34.object({})
|
|
9823
9121
|
};
|
|
9824
9122
|
var mcpTools = {
|
|
9825
9123
|
getMcpFile: {
|
|
@@ -9852,12 +9150,12 @@ var mcpTools = {
|
|
|
9852
9150
|
};
|
|
9853
9151
|
|
|
9854
9152
|
// src/mcp/rules.ts
|
|
9855
|
-
import { basename as
|
|
9856
|
-
import { z as
|
|
9153
|
+
import { basename as basename23, join as join86 } from "path";
|
|
9154
|
+
import { z as z35 } from "zod/mini";
|
|
9857
9155
|
var maxRuleSizeBytes = 1024 * 1024;
|
|
9858
9156
|
var maxRulesCount = 1e3;
|
|
9859
9157
|
async function listRules() {
|
|
9860
|
-
const rulesDir =
|
|
9158
|
+
const rulesDir = join86(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9861
9159
|
try {
|
|
9862
9160
|
const files = await listDirectoryFiles(rulesDir);
|
|
9863
9161
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -9870,7 +9168,7 @@ async function listRules() {
|
|
|
9870
9168
|
});
|
|
9871
9169
|
const frontmatter = rule.getFrontmatter();
|
|
9872
9170
|
return {
|
|
9873
|
-
relativePathFromCwd:
|
|
9171
|
+
relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, file),
|
|
9874
9172
|
frontmatter
|
|
9875
9173
|
};
|
|
9876
9174
|
} catch (error) {
|
|
@@ -9890,14 +9188,14 @@ async function getRule({ relativePathFromCwd }) {
|
|
|
9890
9188
|
relativePath: relativePathFromCwd,
|
|
9891
9189
|
intendedRootDir: process.cwd()
|
|
9892
9190
|
});
|
|
9893
|
-
const filename =
|
|
9191
|
+
const filename = basename23(relativePathFromCwd);
|
|
9894
9192
|
try {
|
|
9895
9193
|
const rule = await RulesyncRule.fromFile({
|
|
9896
9194
|
relativeFilePath: filename,
|
|
9897
9195
|
validate: true
|
|
9898
9196
|
});
|
|
9899
9197
|
return {
|
|
9900
|
-
relativePathFromCwd:
|
|
9198
|
+
relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9901
9199
|
frontmatter: rule.getFrontmatter(),
|
|
9902
9200
|
body: rule.getBody()
|
|
9903
9201
|
};
|
|
@@ -9916,7 +9214,7 @@ async function putRule({
|
|
|
9916
9214
|
relativePath: relativePathFromCwd,
|
|
9917
9215
|
intendedRootDir: process.cwd()
|
|
9918
9216
|
});
|
|
9919
|
-
const filename =
|
|
9217
|
+
const filename = basename23(relativePathFromCwd);
|
|
9920
9218
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
9921
9219
|
if (estimatedSize > maxRuleSizeBytes) {
|
|
9922
9220
|
throw new Error(
|
|
@@ -9926,7 +9224,7 @@ async function putRule({
|
|
|
9926
9224
|
try {
|
|
9927
9225
|
const existingRules = await listRules();
|
|
9928
9226
|
const isUpdate = existingRules.some(
|
|
9929
|
-
(rule2) => rule2.relativePathFromCwd ===
|
|
9227
|
+
(rule2) => rule2.relativePathFromCwd === join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9930
9228
|
);
|
|
9931
9229
|
if (!isUpdate && existingRules.length >= maxRulesCount) {
|
|
9932
9230
|
throw new Error(`Maximum number of rules (${maxRulesCount}) reached`);
|
|
@@ -9939,11 +9237,11 @@ async function putRule({
|
|
|
9939
9237
|
body,
|
|
9940
9238
|
validate: true
|
|
9941
9239
|
});
|
|
9942
|
-
const rulesDir =
|
|
9240
|
+
const rulesDir = join86(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH);
|
|
9943
9241
|
await ensureDir(rulesDir);
|
|
9944
9242
|
await writeFileContent(rule.getFilePath(), rule.getFileContent());
|
|
9945
9243
|
return {
|
|
9946
|
-
relativePathFromCwd:
|
|
9244
|
+
relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename),
|
|
9947
9245
|
frontmatter: rule.getFrontmatter(),
|
|
9948
9246
|
body: rule.getBody()
|
|
9949
9247
|
};
|
|
@@ -9958,12 +9256,12 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9958
9256
|
relativePath: relativePathFromCwd,
|
|
9959
9257
|
intendedRootDir: process.cwd()
|
|
9960
9258
|
});
|
|
9961
|
-
const filename =
|
|
9962
|
-
const fullPath =
|
|
9259
|
+
const filename = basename23(relativePathFromCwd);
|
|
9260
|
+
const fullPath = join86(process.cwd(), RULESYNC_RULES_RELATIVE_DIR_PATH, filename);
|
|
9963
9261
|
try {
|
|
9964
9262
|
await removeFile(fullPath);
|
|
9965
9263
|
return {
|
|
9966
|
-
relativePathFromCwd:
|
|
9264
|
+
relativePathFromCwd: join86(RULESYNC_RULES_RELATIVE_DIR_PATH, filename)
|
|
9967
9265
|
};
|
|
9968
9266
|
} catch (error) {
|
|
9969
9267
|
throw new Error(`Failed to delete rule file ${relativePathFromCwd}: ${formatError(error)}`, {
|
|
@@ -9972,23 +9270,23 @@ async function deleteRule({ relativePathFromCwd }) {
|
|
|
9972
9270
|
}
|
|
9973
9271
|
}
|
|
9974
9272
|
var ruleToolSchemas = {
|
|
9975
|
-
listRules:
|
|
9976
|
-
getRule:
|
|
9977
|
-
relativePathFromCwd:
|
|
9273
|
+
listRules: z35.object({}),
|
|
9274
|
+
getRule: z35.object({
|
|
9275
|
+
relativePathFromCwd: z35.string()
|
|
9978
9276
|
}),
|
|
9979
|
-
putRule:
|
|
9980
|
-
relativePathFromCwd:
|
|
9277
|
+
putRule: z35.object({
|
|
9278
|
+
relativePathFromCwd: z35.string(),
|
|
9981
9279
|
frontmatter: RulesyncRuleFrontmatterSchema,
|
|
9982
|
-
body:
|
|
9280
|
+
body: z35.string()
|
|
9983
9281
|
}),
|
|
9984
|
-
deleteRule:
|
|
9985
|
-
relativePathFromCwd:
|
|
9282
|
+
deleteRule: z35.object({
|
|
9283
|
+
relativePathFromCwd: z35.string()
|
|
9986
9284
|
})
|
|
9987
9285
|
};
|
|
9988
9286
|
var ruleTools = {
|
|
9989
9287
|
listRules: {
|
|
9990
9288
|
name: "listRules",
|
|
9991
|
-
description: `List all rules from ${
|
|
9289
|
+
description: `List all rules from ${join86(RULESYNC_RULES_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
9992
9290
|
parameters: ruleToolSchemas.listRules,
|
|
9993
9291
|
execute: async () => {
|
|
9994
9292
|
const rules = await listRules();
|
|
@@ -10030,8 +9328,8 @@ var ruleTools = {
|
|
|
10030
9328
|
};
|
|
10031
9329
|
|
|
10032
9330
|
// src/mcp/skills.ts
|
|
10033
|
-
import { basename as
|
|
10034
|
-
import { z as
|
|
9331
|
+
import { basename as basename24, dirname as dirname2, join as join87 } from "path";
|
|
9332
|
+
import { z as z36 } from "zod/mini";
|
|
10035
9333
|
var maxSkillSizeBytes = 1024 * 1024;
|
|
10036
9334
|
var maxSkillsCount = 1e3;
|
|
10037
9335
|
function aiDirFileToMcpSkillFile(file) {
|
|
@@ -10047,19 +9345,19 @@ function mcpSkillFileToAiDirFile(file) {
|
|
|
10047
9345
|
};
|
|
10048
9346
|
}
|
|
10049
9347
|
function extractDirName(relativeDirPathFromCwd) {
|
|
10050
|
-
const dirName =
|
|
9348
|
+
const dirName = basename24(relativeDirPathFromCwd);
|
|
10051
9349
|
if (!dirName) {
|
|
10052
9350
|
throw new Error(`Invalid path: ${relativeDirPathFromCwd}`);
|
|
10053
9351
|
}
|
|
10054
9352
|
return dirName;
|
|
10055
9353
|
}
|
|
10056
9354
|
async function listSkills() {
|
|
10057
|
-
const skillsDir =
|
|
9355
|
+
const skillsDir = join87(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH);
|
|
10058
9356
|
try {
|
|
10059
|
-
const skillDirPaths = await findFilesByGlobs(
|
|
9357
|
+
const skillDirPaths = await findFilesByGlobs(join87(skillsDir, "*"), { type: "dir" });
|
|
10060
9358
|
const skills = await Promise.all(
|
|
10061
9359
|
skillDirPaths.map(async (dirPath) => {
|
|
10062
|
-
const dirName =
|
|
9360
|
+
const dirName = basename24(dirPath);
|
|
10063
9361
|
if (!dirName) return null;
|
|
10064
9362
|
try {
|
|
10065
9363
|
const skill = await RulesyncSkill.fromDir({
|
|
@@ -10067,7 +9365,7 @@ async function listSkills() {
|
|
|
10067
9365
|
});
|
|
10068
9366
|
const frontmatter = skill.getFrontmatter();
|
|
10069
9367
|
return {
|
|
10070
|
-
relativeDirPathFromCwd:
|
|
9368
|
+
relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10071
9369
|
frontmatter
|
|
10072
9370
|
};
|
|
10073
9371
|
} catch (error) {
|
|
@@ -10093,7 +9391,7 @@ async function getSkill({ relativeDirPathFromCwd }) {
|
|
|
10093
9391
|
dirName
|
|
10094
9392
|
});
|
|
10095
9393
|
return {
|
|
10096
|
-
relativeDirPathFromCwd:
|
|
9394
|
+
relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10097
9395
|
frontmatter: skill.getFrontmatter(),
|
|
10098
9396
|
body: skill.getBody(),
|
|
10099
9397
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -10127,7 +9425,7 @@ async function putSkill({
|
|
|
10127
9425
|
try {
|
|
10128
9426
|
const existingSkills = await listSkills();
|
|
10129
9427
|
const isUpdate = existingSkills.some(
|
|
10130
|
-
(skill2) => skill2.relativeDirPathFromCwd ===
|
|
9428
|
+
(skill2) => skill2.relativeDirPathFromCwd === join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
10131
9429
|
);
|
|
10132
9430
|
if (!isUpdate && existingSkills.length >= maxSkillsCount) {
|
|
10133
9431
|
throw new Error(`Maximum number of skills (${maxSkillsCount}) reached`);
|
|
@@ -10142,9 +9440,9 @@ async function putSkill({
|
|
|
10142
9440
|
otherFiles: aiDirFiles,
|
|
10143
9441
|
validate: true
|
|
10144
9442
|
});
|
|
10145
|
-
const skillDirPath =
|
|
9443
|
+
const skillDirPath = join87(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
10146
9444
|
await ensureDir(skillDirPath);
|
|
10147
|
-
const skillFilePath =
|
|
9445
|
+
const skillFilePath = join87(skillDirPath, SKILL_FILE_NAME);
|
|
10148
9446
|
const skillFileContent = stringifyFrontmatter(body, frontmatter);
|
|
10149
9447
|
await writeFileContent(skillFilePath, skillFileContent);
|
|
10150
9448
|
for (const file of otherFiles) {
|
|
@@ -10152,15 +9450,15 @@ async function putSkill({
|
|
|
10152
9450
|
relativePath: file.name,
|
|
10153
9451
|
intendedRootDir: skillDirPath
|
|
10154
9452
|
});
|
|
10155
|
-
const filePath =
|
|
10156
|
-
const fileDir =
|
|
9453
|
+
const filePath = join87(skillDirPath, file.name);
|
|
9454
|
+
const fileDir = join87(skillDirPath, dirname2(file.name));
|
|
10157
9455
|
if (fileDir !== skillDirPath) {
|
|
10158
9456
|
await ensureDir(fileDir);
|
|
10159
9457
|
}
|
|
10160
9458
|
await writeFileContent(filePath, file.body);
|
|
10161
9459
|
}
|
|
10162
9460
|
return {
|
|
10163
|
-
relativeDirPathFromCwd:
|
|
9461
|
+
relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName),
|
|
10164
9462
|
frontmatter: skill.getFrontmatter(),
|
|
10165
9463
|
body: skill.getBody(),
|
|
10166
9464
|
otherFiles: skill.getOtherFiles().map(aiDirFileToMcpSkillFile)
|
|
@@ -10182,13 +9480,13 @@ async function deleteSkill({
|
|
|
10182
9480
|
intendedRootDir: process.cwd()
|
|
10183
9481
|
});
|
|
10184
9482
|
const dirName = extractDirName(relativeDirPathFromCwd);
|
|
10185
|
-
const skillDirPath =
|
|
9483
|
+
const skillDirPath = join87(process.cwd(), RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName);
|
|
10186
9484
|
try {
|
|
10187
9485
|
if (await directoryExists(skillDirPath)) {
|
|
10188
9486
|
await removeDirectory(skillDirPath);
|
|
10189
9487
|
}
|
|
10190
9488
|
return {
|
|
10191
|
-
relativeDirPathFromCwd:
|
|
9489
|
+
relativeDirPathFromCwd: join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, dirName)
|
|
10192
9490
|
};
|
|
10193
9491
|
} catch (error) {
|
|
10194
9492
|
throw new Error(
|
|
@@ -10199,29 +9497,29 @@ async function deleteSkill({
|
|
|
10199
9497
|
);
|
|
10200
9498
|
}
|
|
10201
9499
|
}
|
|
10202
|
-
var McpSkillFileSchema =
|
|
10203
|
-
name:
|
|
10204
|
-
body:
|
|
9500
|
+
var McpSkillFileSchema = z36.object({
|
|
9501
|
+
name: z36.string(),
|
|
9502
|
+
body: z36.string()
|
|
10205
9503
|
});
|
|
10206
9504
|
var skillToolSchemas = {
|
|
10207
|
-
listSkills:
|
|
10208
|
-
getSkill:
|
|
10209
|
-
relativeDirPathFromCwd:
|
|
9505
|
+
listSkills: z36.object({}),
|
|
9506
|
+
getSkill: z36.object({
|
|
9507
|
+
relativeDirPathFromCwd: z36.string()
|
|
10210
9508
|
}),
|
|
10211
|
-
putSkill:
|
|
10212
|
-
relativeDirPathFromCwd:
|
|
9509
|
+
putSkill: z36.object({
|
|
9510
|
+
relativeDirPathFromCwd: z36.string(),
|
|
10213
9511
|
frontmatter: RulesyncSkillFrontmatterSchema,
|
|
10214
|
-
body:
|
|
10215
|
-
otherFiles:
|
|
9512
|
+
body: z36.string(),
|
|
9513
|
+
otherFiles: z36.optional(z36.array(McpSkillFileSchema))
|
|
10216
9514
|
}),
|
|
10217
|
-
deleteSkill:
|
|
10218
|
-
relativeDirPathFromCwd:
|
|
9515
|
+
deleteSkill: z36.object({
|
|
9516
|
+
relativeDirPathFromCwd: z36.string()
|
|
10219
9517
|
})
|
|
10220
9518
|
};
|
|
10221
9519
|
var skillTools = {
|
|
10222
9520
|
listSkills: {
|
|
10223
9521
|
name: "listSkills",
|
|
10224
|
-
description: `List all skills from ${
|
|
9522
|
+
description: `List all skills from ${join87(RULESYNC_SKILLS_RELATIVE_DIR_PATH, "*", SKILL_FILE_NAME)} with their frontmatter.`,
|
|
10225
9523
|
parameters: skillToolSchemas.listSkills,
|
|
10226
9524
|
execute: async () => {
|
|
10227
9525
|
const skills = await listSkills();
|
|
@@ -10264,12 +9562,12 @@ var skillTools = {
|
|
|
10264
9562
|
};
|
|
10265
9563
|
|
|
10266
9564
|
// src/mcp/subagents.ts
|
|
10267
|
-
import { basename as
|
|
10268
|
-
import { z as
|
|
9565
|
+
import { basename as basename25, join as join88 } from "path";
|
|
9566
|
+
import { z as z37 } from "zod/mini";
|
|
10269
9567
|
var maxSubagentSizeBytes = 1024 * 1024;
|
|
10270
9568
|
var maxSubagentsCount = 1e3;
|
|
10271
9569
|
async function listSubagents() {
|
|
10272
|
-
const subagentsDir =
|
|
9570
|
+
const subagentsDir = join88(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
10273
9571
|
try {
|
|
10274
9572
|
const files = await listDirectoryFiles(subagentsDir);
|
|
10275
9573
|
const mdFiles = files.filter((file) => file.endsWith(".md"));
|
|
@@ -10282,7 +9580,7 @@ async function listSubagents() {
|
|
|
10282
9580
|
});
|
|
10283
9581
|
const frontmatter = subagent.getFrontmatter();
|
|
10284
9582
|
return {
|
|
10285
|
-
relativePathFromCwd:
|
|
9583
|
+
relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, file),
|
|
10286
9584
|
frontmatter
|
|
10287
9585
|
};
|
|
10288
9586
|
} catch (error) {
|
|
@@ -10304,14 +9602,14 @@ async function getSubagent({ relativePathFromCwd }) {
|
|
|
10304
9602
|
relativePath: relativePathFromCwd,
|
|
10305
9603
|
intendedRootDir: process.cwd()
|
|
10306
9604
|
});
|
|
10307
|
-
const filename =
|
|
9605
|
+
const filename = basename25(relativePathFromCwd);
|
|
10308
9606
|
try {
|
|
10309
9607
|
const subagent = await RulesyncSubagent.fromFile({
|
|
10310
9608
|
relativeFilePath: filename,
|
|
10311
9609
|
validate: true
|
|
10312
9610
|
});
|
|
10313
9611
|
return {
|
|
10314
|
-
relativePathFromCwd:
|
|
9612
|
+
relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
10315
9613
|
frontmatter: subagent.getFrontmatter(),
|
|
10316
9614
|
body: subagent.getBody()
|
|
10317
9615
|
};
|
|
@@ -10330,7 +9628,7 @@ async function putSubagent({
|
|
|
10330
9628
|
relativePath: relativePathFromCwd,
|
|
10331
9629
|
intendedRootDir: process.cwd()
|
|
10332
9630
|
});
|
|
10333
|
-
const filename =
|
|
9631
|
+
const filename = basename25(relativePathFromCwd);
|
|
10334
9632
|
const estimatedSize = JSON.stringify(frontmatter).length + body.length;
|
|
10335
9633
|
if (estimatedSize > maxSubagentSizeBytes) {
|
|
10336
9634
|
throw new Error(
|
|
@@ -10340,7 +9638,7 @@ async function putSubagent({
|
|
|
10340
9638
|
try {
|
|
10341
9639
|
const existingSubagents = await listSubagents();
|
|
10342
9640
|
const isUpdate = existingSubagents.some(
|
|
10343
|
-
(subagent2) => subagent2.relativePathFromCwd ===
|
|
9641
|
+
(subagent2) => subagent2.relativePathFromCwd === join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
10344
9642
|
);
|
|
10345
9643
|
if (!isUpdate && existingSubagents.length >= maxSubagentsCount) {
|
|
10346
9644
|
throw new Error(`Maximum number of subagents (${maxSubagentsCount}) reached`);
|
|
@@ -10353,11 +9651,11 @@ async function putSubagent({
|
|
|
10353
9651
|
body,
|
|
10354
9652
|
validate: true
|
|
10355
9653
|
});
|
|
10356
|
-
const subagentsDir =
|
|
9654
|
+
const subagentsDir = join88(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH);
|
|
10357
9655
|
await ensureDir(subagentsDir);
|
|
10358
9656
|
await writeFileContent(subagent.getFilePath(), subagent.getFileContent());
|
|
10359
9657
|
return {
|
|
10360
|
-
relativePathFromCwd:
|
|
9658
|
+
relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename),
|
|
10361
9659
|
frontmatter: subagent.getFrontmatter(),
|
|
10362
9660
|
body: subagent.getBody()
|
|
10363
9661
|
};
|
|
@@ -10372,12 +9670,12 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
10372
9670
|
relativePath: relativePathFromCwd,
|
|
10373
9671
|
intendedRootDir: process.cwd()
|
|
10374
9672
|
});
|
|
10375
|
-
const filename =
|
|
10376
|
-
const fullPath =
|
|
9673
|
+
const filename = basename25(relativePathFromCwd);
|
|
9674
|
+
const fullPath = join88(process.cwd(), RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename);
|
|
10377
9675
|
try {
|
|
10378
9676
|
await removeFile(fullPath);
|
|
10379
9677
|
return {
|
|
10380
|
-
relativePathFromCwd:
|
|
9678
|
+
relativePathFromCwd: join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, filename)
|
|
10381
9679
|
};
|
|
10382
9680
|
} catch (error) {
|
|
10383
9681
|
throw new Error(
|
|
@@ -10389,23 +9687,23 @@ async function deleteSubagent({ relativePathFromCwd }) {
|
|
|
10389
9687
|
}
|
|
10390
9688
|
}
|
|
10391
9689
|
var subagentToolSchemas = {
|
|
10392
|
-
listSubagents:
|
|
10393
|
-
getSubagent:
|
|
10394
|
-
relativePathFromCwd:
|
|
9690
|
+
listSubagents: z37.object({}),
|
|
9691
|
+
getSubagent: z37.object({
|
|
9692
|
+
relativePathFromCwd: z37.string()
|
|
10395
9693
|
}),
|
|
10396
|
-
putSubagent:
|
|
10397
|
-
relativePathFromCwd:
|
|
9694
|
+
putSubagent: z37.object({
|
|
9695
|
+
relativePathFromCwd: z37.string(),
|
|
10398
9696
|
frontmatter: RulesyncSubagentFrontmatterSchema,
|
|
10399
|
-
body:
|
|
9697
|
+
body: z37.string()
|
|
10400
9698
|
}),
|
|
10401
|
-
deleteSubagent:
|
|
10402
|
-
relativePathFromCwd:
|
|
9699
|
+
deleteSubagent: z37.object({
|
|
9700
|
+
relativePathFromCwd: z37.string()
|
|
10403
9701
|
})
|
|
10404
9702
|
};
|
|
10405
9703
|
var subagentTools = {
|
|
10406
9704
|
listSubagents: {
|
|
10407
9705
|
name: "listSubagents",
|
|
10408
|
-
description: `List all subagents from ${
|
|
9706
|
+
description: `List all subagents from ${join88(RULESYNC_SUBAGENTS_RELATIVE_DIR_PATH, "*.md")} with their frontmatter.`,
|
|
10409
9707
|
parameters: subagentToolSchemas.listSubagents,
|
|
10410
9708
|
execute: async () => {
|
|
10411
9709
|
const subagents = await listSubagents();
|
|
@@ -10483,7 +9781,7 @@ async function mcpCommand({ version }) {
|
|
|
10483
9781
|
}
|
|
10484
9782
|
|
|
10485
9783
|
// src/cli/index.ts
|
|
10486
|
-
var getVersion = () => "3.
|
|
9784
|
+
var getVersion = () => "3.30.0";
|
|
10487
9785
|
var main = async () => {
|
|
10488
9786
|
const program = new Command();
|
|
10489
9787
|
const version = getVersion();
|