rulesync 3.6.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -17
- package/dist/index.cjs +303 -84
- package/dist/index.js +303 -84
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1648,15 +1648,18 @@ var Config = class {
|
|
|
1648
1648
|
features;
|
|
1649
1649
|
verbose;
|
|
1650
1650
|
delete;
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1651
|
+
global;
|
|
1652
|
+
simulatedCommands;
|
|
1653
|
+
simulatedSubagents;
|
|
1654
1654
|
constructor({
|
|
1655
1655
|
baseDirs,
|
|
1656
1656
|
targets,
|
|
1657
1657
|
features,
|
|
1658
1658
|
verbose,
|
|
1659
1659
|
delete: isDelete,
|
|
1660
|
+
global,
|
|
1661
|
+
simulatedCommands,
|
|
1662
|
+
simulatedSubagents,
|
|
1660
1663
|
experimentalGlobal,
|
|
1661
1664
|
experimentalSimulateCommands,
|
|
1662
1665
|
experimentalSimulateSubagents
|
|
@@ -1666,9 +1669,9 @@ var Config = class {
|
|
|
1666
1669
|
this.features = features;
|
|
1667
1670
|
this.verbose = verbose;
|
|
1668
1671
|
this.delete = isDelete;
|
|
1669
|
-
this.
|
|
1670
|
-
this.
|
|
1671
|
-
this.
|
|
1672
|
+
this.global = global ?? experimentalGlobal ?? false;
|
|
1673
|
+
this.simulatedCommands = simulatedCommands ?? experimentalSimulateCommands ?? false;
|
|
1674
|
+
this.simulatedSubagents = simulatedSubagents ?? experimentalSimulateSubagents ?? false;
|
|
1672
1675
|
}
|
|
1673
1676
|
getBaseDirs() {
|
|
1674
1677
|
return this.baseDirs;
|
|
@@ -1691,14 +1694,27 @@ var Config = class {
|
|
|
1691
1694
|
getDelete() {
|
|
1692
1695
|
return this.delete;
|
|
1693
1696
|
}
|
|
1697
|
+
getGlobal() {
|
|
1698
|
+
return this.global;
|
|
1699
|
+
}
|
|
1700
|
+
getSimulatedCommands() {
|
|
1701
|
+
return this.simulatedCommands;
|
|
1702
|
+
}
|
|
1703
|
+
getSimulatedSubagents() {
|
|
1704
|
+
return this.simulatedSubagents;
|
|
1705
|
+
}
|
|
1706
|
+
// Deprecated getters for backward compatibility
|
|
1707
|
+
/** @deprecated Use getGlobal() instead */
|
|
1694
1708
|
getExperimentalGlobal() {
|
|
1695
|
-
return this.
|
|
1709
|
+
return this.global;
|
|
1696
1710
|
}
|
|
1711
|
+
/** @deprecated Use getSimulatedCommands() instead */
|
|
1697
1712
|
getExperimentalSimulateCommands() {
|
|
1698
|
-
return this.
|
|
1713
|
+
return this.simulatedCommands;
|
|
1699
1714
|
}
|
|
1715
|
+
/** @deprecated Use getSimulatedSubagents() instead */
|
|
1700
1716
|
getExperimentalSimulateSubagents() {
|
|
1701
|
-
return this.
|
|
1717
|
+
return this.simulatedSubagents;
|
|
1702
1718
|
}
|
|
1703
1719
|
};
|
|
1704
1720
|
|
|
@@ -1710,6 +1726,9 @@ var defaults = {
|
|
|
1710
1726
|
delete: false,
|
|
1711
1727
|
baseDirs: ["."],
|
|
1712
1728
|
configPath: "rulesync.jsonc",
|
|
1729
|
+
global: false,
|
|
1730
|
+
simulatedCommands: false,
|
|
1731
|
+
simulatedSubagents: false,
|
|
1713
1732
|
experimentalGlobal: false,
|
|
1714
1733
|
experimentalSimulateCommands: false,
|
|
1715
1734
|
experimentalSimulateSubagents: false
|
|
@@ -1722,11 +1741,26 @@ var ConfigResolver = class {
|
|
|
1722
1741
|
delete: isDelete,
|
|
1723
1742
|
baseDirs,
|
|
1724
1743
|
configPath = defaults.configPath,
|
|
1744
|
+
global,
|
|
1745
|
+
simulatedCommands,
|
|
1746
|
+
simulatedSubagents,
|
|
1725
1747
|
experimentalGlobal,
|
|
1726
1748
|
experimentalSimulateCommands,
|
|
1727
1749
|
experimentalSimulateSubagents
|
|
1728
1750
|
}) {
|
|
1729
1751
|
if (!await fileExists(configPath)) {
|
|
1752
|
+
if (experimentalGlobal !== void 0) {
|
|
1753
|
+
warnDeprecatedOptions({ experimentalGlobal });
|
|
1754
|
+
}
|
|
1755
|
+
if (experimentalSimulateCommands !== void 0) {
|
|
1756
|
+
warnDeprecatedOptions({ experimentalSimulateCommands });
|
|
1757
|
+
}
|
|
1758
|
+
if (experimentalSimulateSubagents !== void 0) {
|
|
1759
|
+
warnDeprecatedOptions({ experimentalSimulateSubagents });
|
|
1760
|
+
}
|
|
1761
|
+
const resolvedGlobal2 = global ?? experimentalGlobal ?? defaults.global;
|
|
1762
|
+
const resolvedSimulatedCommands2 = simulatedCommands ?? experimentalSimulateCommands ?? defaults.simulatedCommands;
|
|
1763
|
+
const resolvedSimulatedSubagents2 = simulatedSubagents ?? experimentalSimulateSubagents ?? defaults.simulatedSubagents;
|
|
1730
1764
|
return new Config({
|
|
1731
1765
|
targets: targets ?? defaults.targets,
|
|
1732
1766
|
features: features ?? defaults.features,
|
|
@@ -1734,11 +1768,11 @@ var ConfigResolver = class {
|
|
|
1734
1768
|
delete: isDelete ?? defaults.delete,
|
|
1735
1769
|
baseDirs: getBaseDirsInLightOfGlobal({
|
|
1736
1770
|
baseDirs: baseDirs ?? defaults.baseDirs,
|
|
1737
|
-
global:
|
|
1771
|
+
global: resolvedGlobal2
|
|
1738
1772
|
}),
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1773
|
+
global: resolvedGlobal2,
|
|
1774
|
+
simulatedCommands: resolvedSimulatedCommands2,
|
|
1775
|
+
simulatedSubagents: resolvedSimulatedSubagents2
|
|
1742
1776
|
});
|
|
1743
1777
|
}
|
|
1744
1778
|
const loadOptions = {
|
|
@@ -1753,6 +1787,21 @@ var ConfigResolver = class {
|
|
|
1753
1787
|
loadOptions.configFile = configPath;
|
|
1754
1788
|
}
|
|
1755
1789
|
const { config: configByFile } = await (0, import_c12.loadConfig)(loadOptions);
|
|
1790
|
+
const deprecatedGlobal = experimentalGlobal ?? configByFile.experimentalGlobal;
|
|
1791
|
+
const deprecatedCommands = experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands;
|
|
1792
|
+
const deprecatedSubagents = experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents;
|
|
1793
|
+
if (deprecatedGlobal !== void 0) {
|
|
1794
|
+
warnDeprecatedOptions({ experimentalGlobal: deprecatedGlobal });
|
|
1795
|
+
}
|
|
1796
|
+
if (deprecatedCommands !== void 0) {
|
|
1797
|
+
warnDeprecatedOptions({ experimentalSimulateCommands: deprecatedCommands });
|
|
1798
|
+
}
|
|
1799
|
+
if (deprecatedSubagents !== void 0) {
|
|
1800
|
+
warnDeprecatedOptions({ experimentalSimulateSubagents: deprecatedSubagents });
|
|
1801
|
+
}
|
|
1802
|
+
const resolvedGlobal = global ?? configByFile.global ?? experimentalGlobal ?? configByFile.experimentalGlobal ?? defaults.global;
|
|
1803
|
+
const resolvedSimulatedCommands = simulatedCommands ?? configByFile.simulatedCommands ?? experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands ?? defaults.simulatedCommands;
|
|
1804
|
+
const resolvedSimulatedSubagents = simulatedSubagents ?? configByFile.simulatedSubagents ?? experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents ?? defaults.simulatedSubagents;
|
|
1756
1805
|
const configParams = {
|
|
1757
1806
|
targets: targets ?? configByFile.targets ?? defaults.targets,
|
|
1758
1807
|
features: features ?? configByFile.features ?? defaults.features,
|
|
@@ -1760,15 +1809,34 @@ var ConfigResolver = class {
|
|
|
1760
1809
|
delete: isDelete ?? configByFile.delete ?? defaults.delete,
|
|
1761
1810
|
baseDirs: getBaseDirsInLightOfGlobal({
|
|
1762
1811
|
baseDirs: baseDirs ?? configByFile.baseDirs ?? defaults.baseDirs,
|
|
1763
|
-
global:
|
|
1812
|
+
global: resolvedGlobal
|
|
1764
1813
|
}),
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1814
|
+
global: resolvedGlobal,
|
|
1815
|
+
simulatedCommands: resolvedSimulatedCommands,
|
|
1816
|
+
simulatedSubagents: resolvedSimulatedSubagents
|
|
1768
1817
|
};
|
|
1769
1818
|
return new Config(configParams);
|
|
1770
1819
|
}
|
|
1771
1820
|
};
|
|
1821
|
+
function warnDeprecatedOptions({
|
|
1822
|
+
experimentalGlobal,
|
|
1823
|
+
experimentalSimulateCommands,
|
|
1824
|
+
experimentalSimulateSubagents
|
|
1825
|
+
}) {
|
|
1826
|
+
if (experimentalGlobal !== void 0) {
|
|
1827
|
+
logger.warn("'experimentalGlobal' option is deprecated. Please use 'global' instead.");
|
|
1828
|
+
}
|
|
1829
|
+
if (experimentalSimulateCommands !== void 0) {
|
|
1830
|
+
logger.warn(
|
|
1831
|
+
"'experimentalSimulateCommands' option is deprecated. Please use 'simulatedCommands' instead."
|
|
1832
|
+
);
|
|
1833
|
+
}
|
|
1834
|
+
if (experimentalSimulateSubagents !== void 0) {
|
|
1835
|
+
logger.warn(
|
|
1836
|
+
"'experimentalSimulateSubagents' option is deprecated. Please use 'simulatedSubagents' instead."
|
|
1837
|
+
);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1772
1840
|
function getBaseDirsInLightOfGlobal({
|
|
1773
1841
|
baseDirs,
|
|
1774
1842
|
global
|
|
@@ -5282,6 +5350,16 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5282
5350
|
validate: true
|
|
5283
5351
|
});
|
|
5284
5352
|
}
|
|
5353
|
+
/**
|
|
5354
|
+
* Resolve cursor globs with priority: cursor-specific > parent
|
|
5355
|
+
* Returns comma-separated string for Cursor format, or undefined if no globs
|
|
5356
|
+
* @param cursorSpecificGlobs - Cursor-specific globs (takes priority if defined)
|
|
5357
|
+
* @param parentGlobs - Parent globs (used if cursorSpecificGlobs is undefined)
|
|
5358
|
+
*/
|
|
5359
|
+
static resolveCursorGlobs(cursorSpecificGlobs, parentGlobs) {
|
|
5360
|
+
const targetGlobs = cursorSpecificGlobs !== void 0 ? cursorSpecificGlobs : parentGlobs;
|
|
5361
|
+
return targetGlobs && targetGlobs.length > 0 ? targetGlobs.join(",") : void 0;
|
|
5362
|
+
}
|
|
5285
5363
|
static fromRulesyncRule({
|
|
5286
5364
|
baseDir = ".",
|
|
5287
5365
|
rulesyncRule,
|
|
@@ -5290,7 +5368,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5290
5368
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
5291
5369
|
const cursorFrontmatter = {
|
|
5292
5370
|
description: rulesyncFrontmatter.description,
|
|
5293
|
-
globs: rulesyncFrontmatter.globs
|
|
5371
|
+
globs: this.resolveCursorGlobs(rulesyncFrontmatter.cursor?.globs, rulesyncFrontmatter.globs),
|
|
5294
5372
|
alwaysApply: rulesyncFrontmatter.cursor?.alwaysApply ?? void 0
|
|
5295
5373
|
};
|
|
5296
5374
|
const body = rulesyncRule.getBody();
|
|
@@ -6773,15 +6851,15 @@ async function generateRules(config) {
|
|
|
6773
6851
|
}
|
|
6774
6852
|
let totalRulesOutputs = 0;
|
|
6775
6853
|
logger.info("Generating rule files...");
|
|
6776
|
-
const toolTargets = config.
|
|
6854
|
+
const toolTargets = config.getGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), RulesProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(config.getTargets(), RulesProcessor.getToolTargets());
|
|
6777
6855
|
for (const baseDir of config.getBaseDirs()) {
|
|
6778
6856
|
for (const toolTarget of toolTargets) {
|
|
6779
6857
|
const processor = new RulesProcessor({
|
|
6780
6858
|
baseDir,
|
|
6781
6859
|
toolTarget,
|
|
6782
|
-
global: config.
|
|
6783
|
-
simulateCommands: config.
|
|
6784
|
-
simulateSubagents: config.
|
|
6860
|
+
global: config.getGlobal(),
|
|
6861
|
+
simulateCommands: config.getSimulatedCommands(),
|
|
6862
|
+
simulateSubagents: config.getSimulatedSubagents()
|
|
6785
6863
|
});
|
|
6786
6864
|
if (config.getDelete()) {
|
|
6787
6865
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6804,7 +6882,7 @@ async function generateIgnore(config) {
|
|
|
6804
6882
|
logger.debug("Skipping ignore file generation (not in --features)");
|
|
6805
6883
|
return 0;
|
|
6806
6884
|
}
|
|
6807
|
-
if (config.
|
|
6885
|
+
if (config.getGlobal()) {
|
|
6808
6886
|
logger.debug("Skipping ignore file generation (not supported in global mode)");
|
|
6809
6887
|
return 0;
|
|
6810
6888
|
}
|
|
@@ -6846,13 +6924,13 @@ async function generateMcp(config) {
|
|
|
6846
6924
|
}
|
|
6847
6925
|
let totalMcpOutputs = 0;
|
|
6848
6926
|
logger.info("Generating MCP files...");
|
|
6849
|
-
const toolTargets = config.
|
|
6927
|
+
const toolTargets = config.getGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(config.getTargets(), McpProcessor.getToolTargets());
|
|
6850
6928
|
for (const baseDir of config.getBaseDirs()) {
|
|
6851
6929
|
for (const toolTarget of toolTargets) {
|
|
6852
6930
|
const processor = new McpProcessor({
|
|
6853
6931
|
baseDir,
|
|
6854
6932
|
toolTarget,
|
|
6855
|
-
global: config.
|
|
6933
|
+
global: config.getGlobal()
|
|
6856
6934
|
});
|
|
6857
6935
|
if (config.getDelete()) {
|
|
6858
6936
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6874,10 +6952,10 @@ async function generateCommands(config) {
|
|
|
6874
6952
|
}
|
|
6875
6953
|
let totalCommandOutputs = 0;
|
|
6876
6954
|
logger.info("Generating command files...");
|
|
6877
|
-
const toolTargets = config.
|
|
6955
|
+
const toolTargets = config.getGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), CommandsProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(
|
|
6878
6956
|
config.getTargets(),
|
|
6879
6957
|
CommandsProcessor.getToolTargets({
|
|
6880
|
-
includeSimulated: config.
|
|
6958
|
+
includeSimulated: config.getSimulatedCommands()
|
|
6881
6959
|
})
|
|
6882
6960
|
);
|
|
6883
6961
|
for (const baseDir of config.getBaseDirs()) {
|
|
@@ -6885,7 +6963,7 @@ async function generateCommands(config) {
|
|
|
6885
6963
|
const processor = new CommandsProcessor({
|
|
6886
6964
|
baseDir,
|
|
6887
6965
|
toolTarget,
|
|
6888
|
-
global: config.
|
|
6966
|
+
global: config.getGlobal()
|
|
6889
6967
|
});
|
|
6890
6968
|
if (config.getDelete()) {
|
|
6891
6969
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6907,10 +6985,10 @@ async function generateSubagents(config) {
|
|
|
6907
6985
|
}
|
|
6908
6986
|
let totalSubagentOutputs = 0;
|
|
6909
6987
|
logger.info("Generating subagent files...");
|
|
6910
|
-
const toolTargets = config.
|
|
6988
|
+
const toolTargets = config.getGlobal() ? (0, import_es_toolkit2.intersection)(config.getTargets(), SubagentsProcessor.getToolTargetsGlobal()) : (0, import_es_toolkit2.intersection)(
|
|
6911
6989
|
config.getTargets(),
|
|
6912
6990
|
SubagentsProcessor.getToolTargets({
|
|
6913
|
-
includeSimulated: config.
|
|
6991
|
+
includeSimulated: config.getSimulatedSubagents()
|
|
6914
6992
|
})
|
|
6915
6993
|
);
|
|
6916
6994
|
for (const baseDir of config.getBaseDirs()) {
|
|
@@ -6918,7 +6996,7 @@ async function generateSubagents(config) {
|
|
|
6918
6996
|
const processor = new SubagentsProcessor({
|
|
6919
6997
|
baseDir,
|
|
6920
6998
|
toolTarget,
|
|
6921
|
-
global: config.
|
|
6999
|
+
global: config.getGlobal()
|
|
6922
7000
|
});
|
|
6923
7001
|
if (config.getDelete()) {
|
|
6924
7002
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6940,53 +7018,64 @@ var gitignoreCommand = async () => {
|
|
|
6940
7018
|
const gitignorePath = (0, import_node_path58.join)(process.cwd(), ".gitignore");
|
|
6941
7019
|
const rulesFilesToIgnore = [
|
|
6942
7020
|
"# Generated by rulesync - AI tool configuration files",
|
|
7021
|
+
// AGENTS.md
|
|
7022
|
+
"**/AGENTS.md",
|
|
7023
|
+
"**/.agents/",
|
|
7024
|
+
// Amazon Q
|
|
6943
7025
|
"**/.amazonq/",
|
|
6944
|
-
|
|
6945
|
-
"**/.
|
|
6946
|
-
"**/.
|
|
6947
|
-
"**/.
|
|
6948
|
-
|
|
6949
|
-
"**/.clinerules/",
|
|
6950
|
-
"**/.clineignore",
|
|
7026
|
+
// Augment
|
|
7027
|
+
"**/.augmentignore",
|
|
7028
|
+
"**/.augment/rules/",
|
|
7029
|
+
"**/.augment-guidelines",
|
|
7030
|
+
// Claude Code
|
|
6951
7031
|
"**/CLAUDE.md",
|
|
6952
7032
|
"**/.claude/memories/",
|
|
6953
7033
|
"**/.claude/commands/",
|
|
6954
7034
|
"**/.claude/agents/",
|
|
6955
7035
|
"**/.claude/settings.local.json",
|
|
6956
|
-
"
|
|
6957
|
-
|
|
6958
|
-
"**/.
|
|
6959
|
-
"**/.
|
|
6960
|
-
"**/.
|
|
7036
|
+
"**/.mcp.json",
|
|
7037
|
+
// Cline
|
|
7038
|
+
"**/.clinerules/",
|
|
7039
|
+
"**/.clineignore",
|
|
7040
|
+
"**/.cline/mcp.json",
|
|
7041
|
+
// Codex
|
|
7042
|
+
"**/.codexignore",
|
|
7043
|
+
"**/.codex/",
|
|
7044
|
+
// Cursor
|
|
7045
|
+
"**/.cursor/",
|
|
7046
|
+
"**/.cursorignore",
|
|
7047
|
+
"**/.cursor/mcp.json",
|
|
7048
|
+
// Gemini
|
|
6961
7049
|
"**/GEMINI.md",
|
|
6962
7050
|
"**/.gemini/memories/",
|
|
6963
7051
|
"**/.gemini/commands/",
|
|
6964
7052
|
"**/.gemini/subagents/",
|
|
6965
|
-
|
|
6966
|
-
"**/.
|
|
6967
|
-
"**/.
|
|
6968
|
-
"**/.
|
|
6969
|
-
"**/.
|
|
6970
|
-
"**/.
|
|
6971
|
-
|
|
6972
|
-
"**/.augment-guidelines",
|
|
7053
|
+
// GitHub Copilot
|
|
7054
|
+
"**/.github/copilot-instructions.md",
|
|
7055
|
+
"**/.github/instructions/",
|
|
7056
|
+
"**/.github/prompts/",
|
|
7057
|
+
"**/.github/subagents/",
|
|
7058
|
+
"**/.vscode/mcp.json",
|
|
7059
|
+
// Junie
|
|
6973
7060
|
"**/.junie/guidelines.md",
|
|
6974
|
-
|
|
7061
|
+
// Kiro
|
|
7062
|
+
"**/.kiro/steering/",
|
|
7063
|
+
"**/.aiignore",
|
|
7064
|
+
// OpenCode
|
|
6975
7065
|
"**/.opencode/memories/",
|
|
6976
7066
|
"**/.opencode/commands/",
|
|
6977
7067
|
"**/opencode.json",
|
|
6978
|
-
|
|
6979
|
-
"
|
|
6980
|
-
"**/.
|
|
7068
|
+
// Qwen
|
|
7069
|
+
"**/QWEN.md",
|
|
7070
|
+
"**/.qwen/memories/",
|
|
7071
|
+
// Roo
|
|
7072
|
+
"**/.roo/rules/",
|
|
7073
|
+
"**/.rooignore",
|
|
6981
7074
|
"**/.roo/mcp.json",
|
|
6982
7075
|
"**/.roo/subagents/",
|
|
6983
|
-
|
|
6984
|
-
"**/.github/commands/",
|
|
6985
|
-
"**/.github/subagents/",
|
|
7076
|
+
// Warp
|
|
6986
7077
|
"**/.warp/",
|
|
6987
|
-
"**/WARP.md"
|
|
6988
|
-
"**/.codexignore",
|
|
6989
|
-
"**/.codex/"
|
|
7078
|
+
"**/WARP.md"
|
|
6990
7079
|
];
|
|
6991
7080
|
let gitignoreContent = "";
|
|
6992
7081
|
if (await fileExists(gitignorePath)) {
|
|
@@ -7039,7 +7128,7 @@ async function importRules(config, tool) {
|
|
|
7039
7128
|
if (!config.getFeatures().includes("rules")) {
|
|
7040
7129
|
return 0;
|
|
7041
7130
|
}
|
|
7042
|
-
const global = config.
|
|
7131
|
+
const global = config.getGlobal();
|
|
7043
7132
|
const supportedTargets = global ? RulesProcessor.getToolTargetsGlobal() : RulesProcessor.getToolTargets();
|
|
7044
7133
|
if (!supportedTargets.includes(tool)) {
|
|
7045
7134
|
return 0;
|
|
@@ -7064,7 +7153,7 @@ async function importIgnore(config, tool) {
|
|
|
7064
7153
|
if (!config.getFeatures().includes("ignore")) {
|
|
7065
7154
|
return 0;
|
|
7066
7155
|
}
|
|
7067
|
-
if (config.
|
|
7156
|
+
if (config.getGlobal()) {
|
|
7068
7157
|
logger.debug("Skipping ignore file import (not supported in global mode)");
|
|
7069
7158
|
return 0;
|
|
7070
7159
|
}
|
|
@@ -7093,7 +7182,7 @@ async function importMcp(config, tool) {
|
|
|
7093
7182
|
if (!config.getFeatures().includes("mcp")) {
|
|
7094
7183
|
return 0;
|
|
7095
7184
|
}
|
|
7096
|
-
const global = config.
|
|
7185
|
+
const global = config.getGlobal();
|
|
7097
7186
|
const supportedTargets = global ? McpProcessor.getToolTargetsGlobal() : McpProcessor.getToolTargets();
|
|
7098
7187
|
if (!supportedTargets.includes(tool)) {
|
|
7099
7188
|
return 0;
|
|
@@ -7118,7 +7207,7 @@ async function importCommands(config, tool) {
|
|
|
7118
7207
|
if (!config.getFeatures().includes("commands")) {
|
|
7119
7208
|
return 0;
|
|
7120
7209
|
}
|
|
7121
|
-
const global = config.
|
|
7210
|
+
const global = config.getGlobal();
|
|
7122
7211
|
const supportedTargets = global ? CommandsProcessor.getToolTargetsGlobal() : CommandsProcessor.getToolTargets({ includeSimulated: false });
|
|
7123
7212
|
if (!supportedTargets.includes(tool)) {
|
|
7124
7213
|
return 0;
|
|
@@ -7150,7 +7239,7 @@ async function importSubagents(config, tool) {
|
|
|
7150
7239
|
const subagentsProcessor = new SubagentsProcessor({
|
|
7151
7240
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
7152
7241
|
toolTarget: tool,
|
|
7153
|
-
global: config.
|
|
7242
|
+
global: config.getGlobal()
|
|
7154
7243
|
});
|
|
7155
7244
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
7156
7245
|
if (toolFiles.length === 0) {
|
|
@@ -7173,7 +7262,7 @@ async function initCommand() {
|
|
|
7173
7262
|
await createConfigFile();
|
|
7174
7263
|
logger.success("rulesync initialized successfully!");
|
|
7175
7264
|
logger.info("Next steps:");
|
|
7176
|
-
logger.info(`1. Edit
|
|
7265
|
+
logger.info(`1. Edit .rulesync/**/*.md, .rulesync/.mcp.json and .rulesyncignore`);
|
|
7177
7266
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
7178
7267
|
}
|
|
7179
7268
|
async function createConfigFile() {
|
|
@@ -7190,9 +7279,9 @@ async function createConfigFile() {
|
|
|
7190
7279
|
baseDirs: ["."],
|
|
7191
7280
|
delete: true,
|
|
7192
7281
|
verbose: false,
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7282
|
+
global: false,
|
|
7283
|
+
simulatedCommands: false,
|
|
7284
|
+
simulatedSubagents: false
|
|
7196
7285
|
},
|
|
7197
7286
|
null,
|
|
7198
7287
|
2
|
|
@@ -7201,7 +7290,7 @@ async function createConfigFile() {
|
|
|
7201
7290
|
logger.success("Created rulesync.jsonc");
|
|
7202
7291
|
}
|
|
7203
7292
|
async function createSampleFiles() {
|
|
7204
|
-
const
|
|
7293
|
+
const sampleRuleFile = {
|
|
7205
7294
|
filename: "overview.md",
|
|
7206
7295
|
content: `---
|
|
7207
7296
|
root: true
|
|
@@ -7236,20 +7325,134 @@ globs: ["**/*"]
|
|
|
7236
7325
|
- Follow single responsibility principle
|
|
7237
7326
|
`
|
|
7238
7327
|
};
|
|
7239
|
-
const
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7328
|
+
const sampleMcpFile = {
|
|
7329
|
+
filename: ".mcp.json",
|
|
7330
|
+
content: `{
|
|
7331
|
+
"mcpServers": {
|
|
7332
|
+
"serena": {
|
|
7333
|
+
"type": "stdio",
|
|
7334
|
+
"command": "uvx",
|
|
7335
|
+
"args": [
|
|
7336
|
+
"--from",
|
|
7337
|
+
"git+https://github.com/oraios/serena",
|
|
7338
|
+
"serena",
|
|
7339
|
+
"start-mcp-server",
|
|
7340
|
+
"--context",
|
|
7341
|
+
"ide-assistant",
|
|
7342
|
+
"--enable-web-dashboard",
|
|
7343
|
+
"false",
|
|
7344
|
+
"--project",
|
|
7345
|
+
"."
|
|
7346
|
+
],
|
|
7347
|
+
"env": {}
|
|
7348
|
+
},
|
|
7349
|
+
"context7": {
|
|
7350
|
+
"type": "stdio",
|
|
7351
|
+
"command": "npx",
|
|
7352
|
+
"args": [
|
|
7353
|
+
"-y",
|
|
7354
|
+
"@upstash/context7-mcp"
|
|
7355
|
+
],
|
|
7356
|
+
"env": {}
|
|
7357
|
+
}
|
|
7358
|
+
}
|
|
7359
|
+
}
|
|
7360
|
+
`
|
|
7361
|
+
};
|
|
7362
|
+
const sampleCommandFile = {
|
|
7363
|
+
filename: "review-pr.md",
|
|
7364
|
+
content: `---
|
|
7365
|
+
description: 'Review a pull request'
|
|
7366
|
+
targets: ["*"]
|
|
7367
|
+
---
|
|
7368
|
+
|
|
7369
|
+
target_pr = $ARGUMENTS
|
|
7370
|
+
|
|
7371
|
+
If target_pr is not provided, use the PR of the current branch.
|
|
7372
|
+
|
|
7373
|
+
Execute the following in parallel:
|
|
7374
|
+
|
|
7375
|
+
1. Check code quality and style consistency
|
|
7376
|
+
2. Review test coverage
|
|
7377
|
+
3. Verify documentation updates
|
|
7378
|
+
4. Check for potential bugs or security issues
|
|
7379
|
+
|
|
7380
|
+
Then provide a summary of findings and suggestions for improvement.
|
|
7381
|
+
`
|
|
7382
|
+
};
|
|
7383
|
+
const sampleSubagentFile = {
|
|
7384
|
+
filename: "planner.md",
|
|
7385
|
+
content: `---
|
|
7386
|
+
name: planner
|
|
7387
|
+
targets: ["*"]
|
|
7388
|
+
description: >-
|
|
7389
|
+
This is the general-purpose planner. The user asks the agent to plan to
|
|
7390
|
+
suggest a specification, implement a new feature, refactor the codebase, or
|
|
7391
|
+
fix a bug. This agent can be called by the user explicitly only.
|
|
7392
|
+
claudecode:
|
|
7393
|
+
model: inherit
|
|
7394
|
+
---
|
|
7395
|
+
|
|
7396
|
+
You are the planner for any tasks.
|
|
7397
|
+
|
|
7398
|
+
Based on the user's instruction, create a plan while analyzing the related files. Then, report the plan in detail. You can output files to @tmp/ if needed.
|
|
7399
|
+
|
|
7400
|
+
Attention, again, you are just the planner, so though you can read any files and run any commands for analysis, please don't write any code.
|
|
7401
|
+
`
|
|
7402
|
+
};
|
|
7403
|
+
const sampleIgnoreFile = {
|
|
7404
|
+
content: `credentials/
|
|
7405
|
+
`
|
|
7406
|
+
};
|
|
7407
|
+
const rulePaths = RulesyncRule.getSettablePaths();
|
|
7408
|
+
const mcpPaths = RulesyncMcp.getSettablePaths();
|
|
7409
|
+
const commandPaths = RulesyncCommand.getSettablePaths();
|
|
7410
|
+
const subagentPaths = RulesyncSubagent.getSettablePaths();
|
|
7411
|
+
const ignorePaths = RulesyncIgnore.getSettablePaths();
|
|
7412
|
+
await ensureDir(rulePaths.recommended.relativeDirPath);
|
|
7413
|
+
await ensureDir(mcpPaths.relativeDirPath);
|
|
7414
|
+
await ensureDir(commandPaths.relativeDirPath);
|
|
7415
|
+
await ensureDir(subagentPaths.relativeDirPath);
|
|
7416
|
+
await ensureDir(ignorePaths.relativeDirPath);
|
|
7417
|
+
const ruleFilepath = (0, import_node_path59.join)(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
7418
|
+
if (!await fileExists(ruleFilepath)) {
|
|
7419
|
+
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
7420
|
+
logger.success(`Created ${ruleFilepath}`);
|
|
7421
|
+
} else {
|
|
7422
|
+
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
7423
|
+
}
|
|
7424
|
+
const mcpFilepath = (0, import_node_path59.join)(mcpPaths.relativeDirPath, mcpPaths.relativeFilePath);
|
|
7425
|
+
if (!await fileExists(mcpFilepath)) {
|
|
7426
|
+
await writeFileContent(mcpFilepath, sampleMcpFile.content);
|
|
7427
|
+
logger.success(`Created ${mcpFilepath}`);
|
|
7428
|
+
} else {
|
|
7429
|
+
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
7430
|
+
}
|
|
7431
|
+
const commandFilepath = (0, import_node_path59.join)(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
7432
|
+
if (!await fileExists(commandFilepath)) {
|
|
7433
|
+
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
7434
|
+
logger.success(`Created ${commandFilepath}`);
|
|
7435
|
+
} else {
|
|
7436
|
+
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
7437
|
+
}
|
|
7438
|
+
const subagentFilepath = (0, import_node_path59.join)(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
7439
|
+
if (!await fileExists(subagentFilepath)) {
|
|
7440
|
+
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
7441
|
+
logger.success(`Created ${subagentFilepath}`);
|
|
7246
7442
|
} else {
|
|
7247
|
-
logger.info(`Skipped ${
|
|
7443
|
+
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
7444
|
+
}
|
|
7445
|
+
const ignoreFilepath = (0, import_node_path59.join)(ignorePaths.relativeDirPath, ignorePaths.relativeFilePath);
|
|
7446
|
+
if (!await fileExists(ignoreFilepath)) {
|
|
7447
|
+
await writeFileContent(ignoreFilepath, sampleIgnoreFile.content);
|
|
7448
|
+
logger.success(`Created ${ignoreFilepath}`);
|
|
7449
|
+
} else {
|
|
7450
|
+
logger.info(`Skipped ${ignoreFilepath} (already exists)`);
|
|
7248
7451
|
}
|
|
7249
7452
|
}
|
|
7250
7453
|
|
|
7251
7454
|
// src/cli/index.ts
|
|
7252
|
-
var getVersion = () => "3.
|
|
7455
|
+
var getVersion = () => "3.8.0";
|
|
7253
7456
|
var main = async () => {
|
|
7254
7457
|
const program = new import_commander.Command();
|
|
7255
7458
|
const version = getVersion();
|
|
@@ -7273,13 +7476,17 @@ var main = async () => {
|
|
|
7273
7476
|
(value) => {
|
|
7274
7477
|
return value.split(",").map((f) => f.trim());
|
|
7275
7478
|
}
|
|
7276
|
-
).option("-V, --verbose", "Verbose output").option("-g, --
|
|
7479
|
+
).option("-V, --verbose", "Verbose output").option("-g, --global", "Import for global(user scope) configuration files").option(
|
|
7480
|
+
"--experimental-global",
|
|
7481
|
+
"Import for global(user scope) configuration files (deprecated: use --global instead)"
|
|
7482
|
+
).action(async (options) => {
|
|
7277
7483
|
try {
|
|
7278
7484
|
await importCommand({
|
|
7279
7485
|
targets: options.targets,
|
|
7280
7486
|
features: options.features,
|
|
7281
7487
|
verbose: options.verbose,
|
|
7282
7488
|
configPath: options.config,
|
|
7489
|
+
global: options.global,
|
|
7283
7490
|
experimentalGlobal: options.experimentalGlobal
|
|
7284
7491
|
});
|
|
7285
7492
|
} catch (error) {
|
|
@@ -7302,12 +7509,21 @@ var main = async () => {
|
|
|
7302
7509
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
7303
7510
|
"-b, --base-dir <paths>",
|
|
7304
7511
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
7305
|
-
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option("-g, --
|
|
7512
|
+
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
|
|
7513
|
+
"--simulated-commands",
|
|
7514
|
+
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
7515
|
+
).option(
|
|
7516
|
+
"--simulated-subagents",
|
|
7517
|
+
"Generate simulated subagents. This feature is only available for copilot, cursor and codexcli."
|
|
7518
|
+
).option(
|
|
7519
|
+
"--experimental-global",
|
|
7520
|
+
"Generate for global(user scope) configuration files (deprecated: use --global instead)"
|
|
7521
|
+
).option(
|
|
7306
7522
|
"--experimental-simulate-commands",
|
|
7307
|
-
"Generate simulated commands (
|
|
7523
|
+
"Generate simulated commands (deprecated: use --simulated-commands instead)"
|
|
7308
7524
|
).option(
|
|
7309
7525
|
"--experimental-simulate-subagents",
|
|
7310
|
-
"Generate simulated subagents (
|
|
7526
|
+
"Generate simulated subagents (deprecated: use --simulated-subagents instead)"
|
|
7311
7527
|
).action(async (options) => {
|
|
7312
7528
|
try {
|
|
7313
7529
|
await generateCommand({
|
|
@@ -7317,6 +7533,9 @@ var main = async () => {
|
|
|
7317
7533
|
delete: options.delete,
|
|
7318
7534
|
baseDirs: options.baseDirs,
|
|
7319
7535
|
configPath: options.config,
|
|
7536
|
+
global: options.global,
|
|
7537
|
+
simulatedCommands: options.simulatedCommands,
|
|
7538
|
+
simulatedSubagents: options.simulatedSubagents,
|
|
7320
7539
|
experimentalGlobal: options.experimentalGlobal,
|
|
7321
7540
|
experimentalSimulateCommands: options.experimentalSimulateCommands,
|
|
7322
7541
|
experimentalSimulateSubagents: options.experimentalSimulateSubagents
|