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.js
CHANGED
|
@@ -1625,15 +1625,18 @@ var Config = class {
|
|
|
1625
1625
|
features;
|
|
1626
1626
|
verbose;
|
|
1627
1627
|
delete;
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1628
|
+
global;
|
|
1629
|
+
simulatedCommands;
|
|
1630
|
+
simulatedSubagents;
|
|
1631
1631
|
constructor({
|
|
1632
1632
|
baseDirs,
|
|
1633
1633
|
targets,
|
|
1634
1634
|
features,
|
|
1635
1635
|
verbose,
|
|
1636
1636
|
delete: isDelete,
|
|
1637
|
+
global,
|
|
1638
|
+
simulatedCommands,
|
|
1639
|
+
simulatedSubagents,
|
|
1637
1640
|
experimentalGlobal,
|
|
1638
1641
|
experimentalSimulateCommands,
|
|
1639
1642
|
experimentalSimulateSubagents
|
|
@@ -1643,9 +1646,9 @@ var Config = class {
|
|
|
1643
1646
|
this.features = features;
|
|
1644
1647
|
this.verbose = verbose;
|
|
1645
1648
|
this.delete = isDelete;
|
|
1646
|
-
this.
|
|
1647
|
-
this.
|
|
1648
|
-
this.
|
|
1649
|
+
this.global = global ?? experimentalGlobal ?? false;
|
|
1650
|
+
this.simulatedCommands = simulatedCommands ?? experimentalSimulateCommands ?? false;
|
|
1651
|
+
this.simulatedSubagents = simulatedSubagents ?? experimentalSimulateSubagents ?? false;
|
|
1649
1652
|
}
|
|
1650
1653
|
getBaseDirs() {
|
|
1651
1654
|
return this.baseDirs;
|
|
@@ -1668,14 +1671,27 @@ var Config = class {
|
|
|
1668
1671
|
getDelete() {
|
|
1669
1672
|
return this.delete;
|
|
1670
1673
|
}
|
|
1674
|
+
getGlobal() {
|
|
1675
|
+
return this.global;
|
|
1676
|
+
}
|
|
1677
|
+
getSimulatedCommands() {
|
|
1678
|
+
return this.simulatedCommands;
|
|
1679
|
+
}
|
|
1680
|
+
getSimulatedSubagents() {
|
|
1681
|
+
return this.simulatedSubagents;
|
|
1682
|
+
}
|
|
1683
|
+
// Deprecated getters for backward compatibility
|
|
1684
|
+
/** @deprecated Use getGlobal() instead */
|
|
1671
1685
|
getExperimentalGlobal() {
|
|
1672
|
-
return this.
|
|
1686
|
+
return this.global;
|
|
1673
1687
|
}
|
|
1688
|
+
/** @deprecated Use getSimulatedCommands() instead */
|
|
1674
1689
|
getExperimentalSimulateCommands() {
|
|
1675
|
-
return this.
|
|
1690
|
+
return this.simulatedCommands;
|
|
1676
1691
|
}
|
|
1692
|
+
/** @deprecated Use getSimulatedSubagents() instead */
|
|
1677
1693
|
getExperimentalSimulateSubagents() {
|
|
1678
|
-
return this.
|
|
1694
|
+
return this.simulatedSubagents;
|
|
1679
1695
|
}
|
|
1680
1696
|
};
|
|
1681
1697
|
|
|
@@ -1687,6 +1703,9 @@ var defaults = {
|
|
|
1687
1703
|
delete: false,
|
|
1688
1704
|
baseDirs: ["."],
|
|
1689
1705
|
configPath: "rulesync.jsonc",
|
|
1706
|
+
global: false,
|
|
1707
|
+
simulatedCommands: false,
|
|
1708
|
+
simulatedSubagents: false,
|
|
1690
1709
|
experimentalGlobal: false,
|
|
1691
1710
|
experimentalSimulateCommands: false,
|
|
1692
1711
|
experimentalSimulateSubagents: false
|
|
@@ -1699,11 +1718,26 @@ var ConfigResolver = class {
|
|
|
1699
1718
|
delete: isDelete,
|
|
1700
1719
|
baseDirs,
|
|
1701
1720
|
configPath = defaults.configPath,
|
|
1721
|
+
global,
|
|
1722
|
+
simulatedCommands,
|
|
1723
|
+
simulatedSubagents,
|
|
1702
1724
|
experimentalGlobal,
|
|
1703
1725
|
experimentalSimulateCommands,
|
|
1704
1726
|
experimentalSimulateSubagents
|
|
1705
1727
|
}) {
|
|
1706
1728
|
if (!await fileExists(configPath)) {
|
|
1729
|
+
if (experimentalGlobal !== void 0) {
|
|
1730
|
+
warnDeprecatedOptions({ experimentalGlobal });
|
|
1731
|
+
}
|
|
1732
|
+
if (experimentalSimulateCommands !== void 0) {
|
|
1733
|
+
warnDeprecatedOptions({ experimentalSimulateCommands });
|
|
1734
|
+
}
|
|
1735
|
+
if (experimentalSimulateSubagents !== void 0) {
|
|
1736
|
+
warnDeprecatedOptions({ experimentalSimulateSubagents });
|
|
1737
|
+
}
|
|
1738
|
+
const resolvedGlobal2 = global ?? experimentalGlobal ?? defaults.global;
|
|
1739
|
+
const resolvedSimulatedCommands2 = simulatedCommands ?? experimentalSimulateCommands ?? defaults.simulatedCommands;
|
|
1740
|
+
const resolvedSimulatedSubagents2 = simulatedSubagents ?? experimentalSimulateSubagents ?? defaults.simulatedSubagents;
|
|
1707
1741
|
return new Config({
|
|
1708
1742
|
targets: targets ?? defaults.targets,
|
|
1709
1743
|
features: features ?? defaults.features,
|
|
@@ -1711,11 +1745,11 @@ var ConfigResolver = class {
|
|
|
1711
1745
|
delete: isDelete ?? defaults.delete,
|
|
1712
1746
|
baseDirs: getBaseDirsInLightOfGlobal({
|
|
1713
1747
|
baseDirs: baseDirs ?? defaults.baseDirs,
|
|
1714
|
-
global:
|
|
1748
|
+
global: resolvedGlobal2
|
|
1715
1749
|
}),
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1750
|
+
global: resolvedGlobal2,
|
|
1751
|
+
simulatedCommands: resolvedSimulatedCommands2,
|
|
1752
|
+
simulatedSubagents: resolvedSimulatedSubagents2
|
|
1719
1753
|
});
|
|
1720
1754
|
}
|
|
1721
1755
|
const loadOptions = {
|
|
@@ -1730,6 +1764,21 @@ var ConfigResolver = class {
|
|
|
1730
1764
|
loadOptions.configFile = configPath;
|
|
1731
1765
|
}
|
|
1732
1766
|
const { config: configByFile } = await loadConfig(loadOptions);
|
|
1767
|
+
const deprecatedGlobal = experimentalGlobal ?? configByFile.experimentalGlobal;
|
|
1768
|
+
const deprecatedCommands = experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands;
|
|
1769
|
+
const deprecatedSubagents = experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents;
|
|
1770
|
+
if (deprecatedGlobal !== void 0) {
|
|
1771
|
+
warnDeprecatedOptions({ experimentalGlobal: deprecatedGlobal });
|
|
1772
|
+
}
|
|
1773
|
+
if (deprecatedCommands !== void 0) {
|
|
1774
|
+
warnDeprecatedOptions({ experimentalSimulateCommands: deprecatedCommands });
|
|
1775
|
+
}
|
|
1776
|
+
if (deprecatedSubagents !== void 0) {
|
|
1777
|
+
warnDeprecatedOptions({ experimentalSimulateSubagents: deprecatedSubagents });
|
|
1778
|
+
}
|
|
1779
|
+
const resolvedGlobal = global ?? configByFile.global ?? experimentalGlobal ?? configByFile.experimentalGlobal ?? defaults.global;
|
|
1780
|
+
const resolvedSimulatedCommands = simulatedCommands ?? configByFile.simulatedCommands ?? experimentalSimulateCommands ?? configByFile.experimentalSimulateCommands ?? defaults.simulatedCommands;
|
|
1781
|
+
const resolvedSimulatedSubagents = simulatedSubagents ?? configByFile.simulatedSubagents ?? experimentalSimulateSubagents ?? configByFile.experimentalSimulateSubagents ?? defaults.simulatedSubagents;
|
|
1733
1782
|
const configParams = {
|
|
1734
1783
|
targets: targets ?? configByFile.targets ?? defaults.targets,
|
|
1735
1784
|
features: features ?? configByFile.features ?? defaults.features,
|
|
@@ -1737,15 +1786,34 @@ var ConfigResolver = class {
|
|
|
1737
1786
|
delete: isDelete ?? configByFile.delete ?? defaults.delete,
|
|
1738
1787
|
baseDirs: getBaseDirsInLightOfGlobal({
|
|
1739
1788
|
baseDirs: baseDirs ?? configByFile.baseDirs ?? defaults.baseDirs,
|
|
1740
|
-
global:
|
|
1789
|
+
global: resolvedGlobal
|
|
1741
1790
|
}),
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1791
|
+
global: resolvedGlobal,
|
|
1792
|
+
simulatedCommands: resolvedSimulatedCommands,
|
|
1793
|
+
simulatedSubagents: resolvedSimulatedSubagents
|
|
1745
1794
|
};
|
|
1746
1795
|
return new Config(configParams);
|
|
1747
1796
|
}
|
|
1748
1797
|
};
|
|
1798
|
+
function warnDeprecatedOptions({
|
|
1799
|
+
experimentalGlobal,
|
|
1800
|
+
experimentalSimulateCommands,
|
|
1801
|
+
experimentalSimulateSubagents
|
|
1802
|
+
}) {
|
|
1803
|
+
if (experimentalGlobal !== void 0) {
|
|
1804
|
+
logger.warn("'experimentalGlobal' option is deprecated. Please use 'global' instead.");
|
|
1805
|
+
}
|
|
1806
|
+
if (experimentalSimulateCommands !== void 0) {
|
|
1807
|
+
logger.warn(
|
|
1808
|
+
"'experimentalSimulateCommands' option is deprecated. Please use 'simulatedCommands' instead."
|
|
1809
|
+
);
|
|
1810
|
+
}
|
|
1811
|
+
if (experimentalSimulateSubagents !== void 0) {
|
|
1812
|
+
logger.warn(
|
|
1813
|
+
"'experimentalSimulateSubagents' option is deprecated. Please use 'simulatedSubagents' instead."
|
|
1814
|
+
);
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1749
1817
|
function getBaseDirsInLightOfGlobal({
|
|
1750
1818
|
baseDirs,
|
|
1751
1819
|
global
|
|
@@ -5259,6 +5327,16 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5259
5327
|
validate: true
|
|
5260
5328
|
});
|
|
5261
5329
|
}
|
|
5330
|
+
/**
|
|
5331
|
+
* Resolve cursor globs with priority: cursor-specific > parent
|
|
5332
|
+
* Returns comma-separated string for Cursor format, or undefined if no globs
|
|
5333
|
+
* @param cursorSpecificGlobs - Cursor-specific globs (takes priority if defined)
|
|
5334
|
+
* @param parentGlobs - Parent globs (used if cursorSpecificGlobs is undefined)
|
|
5335
|
+
*/
|
|
5336
|
+
static resolveCursorGlobs(cursorSpecificGlobs, parentGlobs) {
|
|
5337
|
+
const targetGlobs = cursorSpecificGlobs !== void 0 ? cursorSpecificGlobs : parentGlobs;
|
|
5338
|
+
return targetGlobs && targetGlobs.length > 0 ? targetGlobs.join(",") : void 0;
|
|
5339
|
+
}
|
|
5262
5340
|
static fromRulesyncRule({
|
|
5263
5341
|
baseDir = ".",
|
|
5264
5342
|
rulesyncRule,
|
|
@@ -5267,7 +5345,7 @@ var CursorRule = class _CursorRule extends ToolRule {
|
|
|
5267
5345
|
const rulesyncFrontmatter = rulesyncRule.getFrontmatter();
|
|
5268
5346
|
const cursorFrontmatter = {
|
|
5269
5347
|
description: rulesyncFrontmatter.description,
|
|
5270
|
-
globs: rulesyncFrontmatter.globs
|
|
5348
|
+
globs: this.resolveCursorGlobs(rulesyncFrontmatter.cursor?.globs, rulesyncFrontmatter.globs),
|
|
5271
5349
|
alwaysApply: rulesyncFrontmatter.cursor?.alwaysApply ?? void 0
|
|
5272
5350
|
};
|
|
5273
5351
|
const body = rulesyncRule.getBody();
|
|
@@ -6750,15 +6828,15 @@ async function generateRules(config) {
|
|
|
6750
6828
|
}
|
|
6751
6829
|
let totalRulesOutputs = 0;
|
|
6752
6830
|
logger.info("Generating rule files...");
|
|
6753
|
-
const toolTargets = config.
|
|
6831
|
+
const toolTargets = config.getGlobal() ? intersection(config.getTargets(), RulesProcessor.getToolTargetsGlobal()) : intersection(config.getTargets(), RulesProcessor.getToolTargets());
|
|
6754
6832
|
for (const baseDir of config.getBaseDirs()) {
|
|
6755
6833
|
for (const toolTarget of toolTargets) {
|
|
6756
6834
|
const processor = new RulesProcessor({
|
|
6757
6835
|
baseDir,
|
|
6758
6836
|
toolTarget,
|
|
6759
|
-
global: config.
|
|
6760
|
-
simulateCommands: config.
|
|
6761
|
-
simulateSubagents: config.
|
|
6837
|
+
global: config.getGlobal(),
|
|
6838
|
+
simulateCommands: config.getSimulatedCommands(),
|
|
6839
|
+
simulateSubagents: config.getSimulatedSubagents()
|
|
6762
6840
|
});
|
|
6763
6841
|
if (config.getDelete()) {
|
|
6764
6842
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6781,7 +6859,7 @@ async function generateIgnore(config) {
|
|
|
6781
6859
|
logger.debug("Skipping ignore file generation (not in --features)");
|
|
6782
6860
|
return 0;
|
|
6783
6861
|
}
|
|
6784
|
-
if (config.
|
|
6862
|
+
if (config.getGlobal()) {
|
|
6785
6863
|
logger.debug("Skipping ignore file generation (not supported in global mode)");
|
|
6786
6864
|
return 0;
|
|
6787
6865
|
}
|
|
@@ -6823,13 +6901,13 @@ async function generateMcp(config) {
|
|
|
6823
6901
|
}
|
|
6824
6902
|
let totalMcpOutputs = 0;
|
|
6825
6903
|
logger.info("Generating MCP files...");
|
|
6826
|
-
const toolTargets = config.
|
|
6904
|
+
const toolTargets = config.getGlobal() ? intersection(config.getTargets(), McpProcessor.getToolTargetsGlobal()) : intersection(config.getTargets(), McpProcessor.getToolTargets());
|
|
6827
6905
|
for (const baseDir of config.getBaseDirs()) {
|
|
6828
6906
|
for (const toolTarget of toolTargets) {
|
|
6829
6907
|
const processor = new McpProcessor({
|
|
6830
6908
|
baseDir,
|
|
6831
6909
|
toolTarget,
|
|
6832
|
-
global: config.
|
|
6910
|
+
global: config.getGlobal()
|
|
6833
6911
|
});
|
|
6834
6912
|
if (config.getDelete()) {
|
|
6835
6913
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6851,10 +6929,10 @@ async function generateCommands(config) {
|
|
|
6851
6929
|
}
|
|
6852
6930
|
let totalCommandOutputs = 0;
|
|
6853
6931
|
logger.info("Generating command files...");
|
|
6854
|
-
const toolTargets = config.
|
|
6932
|
+
const toolTargets = config.getGlobal() ? intersection(config.getTargets(), CommandsProcessor.getToolTargetsGlobal()) : intersection(
|
|
6855
6933
|
config.getTargets(),
|
|
6856
6934
|
CommandsProcessor.getToolTargets({
|
|
6857
|
-
includeSimulated: config.
|
|
6935
|
+
includeSimulated: config.getSimulatedCommands()
|
|
6858
6936
|
})
|
|
6859
6937
|
);
|
|
6860
6938
|
for (const baseDir of config.getBaseDirs()) {
|
|
@@ -6862,7 +6940,7 @@ async function generateCommands(config) {
|
|
|
6862
6940
|
const processor = new CommandsProcessor({
|
|
6863
6941
|
baseDir,
|
|
6864
6942
|
toolTarget,
|
|
6865
|
-
global: config.
|
|
6943
|
+
global: config.getGlobal()
|
|
6866
6944
|
});
|
|
6867
6945
|
if (config.getDelete()) {
|
|
6868
6946
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6884,10 +6962,10 @@ async function generateSubagents(config) {
|
|
|
6884
6962
|
}
|
|
6885
6963
|
let totalSubagentOutputs = 0;
|
|
6886
6964
|
logger.info("Generating subagent files...");
|
|
6887
|
-
const toolTargets = config.
|
|
6965
|
+
const toolTargets = config.getGlobal() ? intersection(config.getTargets(), SubagentsProcessor.getToolTargetsGlobal()) : intersection(
|
|
6888
6966
|
config.getTargets(),
|
|
6889
6967
|
SubagentsProcessor.getToolTargets({
|
|
6890
|
-
includeSimulated: config.
|
|
6968
|
+
includeSimulated: config.getSimulatedSubagents()
|
|
6891
6969
|
})
|
|
6892
6970
|
);
|
|
6893
6971
|
for (const baseDir of config.getBaseDirs()) {
|
|
@@ -6895,7 +6973,7 @@ async function generateSubagents(config) {
|
|
|
6895
6973
|
const processor = new SubagentsProcessor({
|
|
6896
6974
|
baseDir,
|
|
6897
6975
|
toolTarget,
|
|
6898
|
-
global: config.
|
|
6976
|
+
global: config.getGlobal()
|
|
6899
6977
|
});
|
|
6900
6978
|
if (config.getDelete()) {
|
|
6901
6979
|
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
@@ -6917,53 +6995,64 @@ var gitignoreCommand = async () => {
|
|
|
6917
6995
|
const gitignorePath = join57(process.cwd(), ".gitignore");
|
|
6918
6996
|
const rulesFilesToIgnore = [
|
|
6919
6997
|
"# Generated by rulesync - AI tool configuration files",
|
|
6998
|
+
// AGENTS.md
|
|
6999
|
+
"**/AGENTS.md",
|
|
7000
|
+
"**/.agents/",
|
|
7001
|
+
// Amazon Q
|
|
6920
7002
|
"**/.amazonq/",
|
|
6921
|
-
|
|
6922
|
-
"**/.
|
|
6923
|
-
"**/.
|
|
6924
|
-
"**/.
|
|
6925
|
-
|
|
6926
|
-
"**/.clinerules/",
|
|
6927
|
-
"**/.clineignore",
|
|
7003
|
+
// Augment
|
|
7004
|
+
"**/.augmentignore",
|
|
7005
|
+
"**/.augment/rules/",
|
|
7006
|
+
"**/.augment-guidelines",
|
|
7007
|
+
// Claude Code
|
|
6928
7008
|
"**/CLAUDE.md",
|
|
6929
7009
|
"**/.claude/memories/",
|
|
6930
7010
|
"**/.claude/commands/",
|
|
6931
7011
|
"**/.claude/agents/",
|
|
6932
7012
|
"**/.claude/settings.local.json",
|
|
6933
|
-
"
|
|
6934
|
-
|
|
6935
|
-
"**/.
|
|
6936
|
-
"**/.
|
|
6937
|
-
"**/.
|
|
7013
|
+
"**/.mcp.json",
|
|
7014
|
+
// Cline
|
|
7015
|
+
"**/.clinerules/",
|
|
7016
|
+
"**/.clineignore",
|
|
7017
|
+
"**/.cline/mcp.json",
|
|
7018
|
+
// Codex
|
|
7019
|
+
"**/.codexignore",
|
|
7020
|
+
"**/.codex/",
|
|
7021
|
+
// Cursor
|
|
7022
|
+
"**/.cursor/",
|
|
7023
|
+
"**/.cursorignore",
|
|
7024
|
+
"**/.cursor/mcp.json",
|
|
7025
|
+
// Gemini
|
|
6938
7026
|
"**/GEMINI.md",
|
|
6939
7027
|
"**/.gemini/memories/",
|
|
6940
7028
|
"**/.gemini/commands/",
|
|
6941
7029
|
"**/.gemini/subagents/",
|
|
6942
|
-
|
|
6943
|
-
"**/.
|
|
6944
|
-
"**/.
|
|
6945
|
-
"**/.
|
|
6946
|
-
"**/.
|
|
6947
|
-
"**/.
|
|
6948
|
-
|
|
6949
|
-
"**/.augment-guidelines",
|
|
7030
|
+
// GitHub Copilot
|
|
7031
|
+
"**/.github/copilot-instructions.md",
|
|
7032
|
+
"**/.github/instructions/",
|
|
7033
|
+
"**/.github/prompts/",
|
|
7034
|
+
"**/.github/subagents/",
|
|
7035
|
+
"**/.vscode/mcp.json",
|
|
7036
|
+
// Junie
|
|
6950
7037
|
"**/.junie/guidelines.md",
|
|
6951
|
-
|
|
7038
|
+
// Kiro
|
|
7039
|
+
"**/.kiro/steering/",
|
|
7040
|
+
"**/.aiignore",
|
|
7041
|
+
// OpenCode
|
|
6952
7042
|
"**/.opencode/memories/",
|
|
6953
7043
|
"**/.opencode/commands/",
|
|
6954
7044
|
"**/opencode.json",
|
|
6955
|
-
|
|
6956
|
-
"
|
|
6957
|
-
"**/.
|
|
7045
|
+
// Qwen
|
|
7046
|
+
"**/QWEN.md",
|
|
7047
|
+
"**/.qwen/memories/",
|
|
7048
|
+
// Roo
|
|
7049
|
+
"**/.roo/rules/",
|
|
7050
|
+
"**/.rooignore",
|
|
6958
7051
|
"**/.roo/mcp.json",
|
|
6959
7052
|
"**/.roo/subagents/",
|
|
6960
|
-
|
|
6961
|
-
"**/.github/commands/",
|
|
6962
|
-
"**/.github/subagents/",
|
|
7053
|
+
// Warp
|
|
6963
7054
|
"**/.warp/",
|
|
6964
|
-
"**/WARP.md"
|
|
6965
|
-
"**/.codexignore",
|
|
6966
|
-
"**/.codex/"
|
|
7055
|
+
"**/WARP.md"
|
|
6967
7056
|
];
|
|
6968
7057
|
let gitignoreContent = "";
|
|
6969
7058
|
if (await fileExists(gitignorePath)) {
|
|
@@ -7016,7 +7105,7 @@ async function importRules(config, tool) {
|
|
|
7016
7105
|
if (!config.getFeatures().includes("rules")) {
|
|
7017
7106
|
return 0;
|
|
7018
7107
|
}
|
|
7019
|
-
const global = config.
|
|
7108
|
+
const global = config.getGlobal();
|
|
7020
7109
|
const supportedTargets = global ? RulesProcessor.getToolTargetsGlobal() : RulesProcessor.getToolTargets();
|
|
7021
7110
|
if (!supportedTargets.includes(tool)) {
|
|
7022
7111
|
return 0;
|
|
@@ -7041,7 +7130,7 @@ async function importIgnore(config, tool) {
|
|
|
7041
7130
|
if (!config.getFeatures().includes("ignore")) {
|
|
7042
7131
|
return 0;
|
|
7043
7132
|
}
|
|
7044
|
-
if (config.
|
|
7133
|
+
if (config.getGlobal()) {
|
|
7045
7134
|
logger.debug("Skipping ignore file import (not supported in global mode)");
|
|
7046
7135
|
return 0;
|
|
7047
7136
|
}
|
|
@@ -7070,7 +7159,7 @@ async function importMcp(config, tool) {
|
|
|
7070
7159
|
if (!config.getFeatures().includes("mcp")) {
|
|
7071
7160
|
return 0;
|
|
7072
7161
|
}
|
|
7073
|
-
const global = config.
|
|
7162
|
+
const global = config.getGlobal();
|
|
7074
7163
|
const supportedTargets = global ? McpProcessor.getToolTargetsGlobal() : McpProcessor.getToolTargets();
|
|
7075
7164
|
if (!supportedTargets.includes(tool)) {
|
|
7076
7165
|
return 0;
|
|
@@ -7095,7 +7184,7 @@ async function importCommands(config, tool) {
|
|
|
7095
7184
|
if (!config.getFeatures().includes("commands")) {
|
|
7096
7185
|
return 0;
|
|
7097
7186
|
}
|
|
7098
|
-
const global = config.
|
|
7187
|
+
const global = config.getGlobal();
|
|
7099
7188
|
const supportedTargets = global ? CommandsProcessor.getToolTargetsGlobal() : CommandsProcessor.getToolTargets({ includeSimulated: false });
|
|
7100
7189
|
if (!supportedTargets.includes(tool)) {
|
|
7101
7190
|
return 0;
|
|
@@ -7127,7 +7216,7 @@ async function importSubagents(config, tool) {
|
|
|
7127
7216
|
const subagentsProcessor = new SubagentsProcessor({
|
|
7128
7217
|
baseDir: config.getBaseDirs()[0] ?? ".",
|
|
7129
7218
|
toolTarget: tool,
|
|
7130
|
-
global: config.
|
|
7219
|
+
global: config.getGlobal()
|
|
7131
7220
|
});
|
|
7132
7221
|
const toolFiles = await subagentsProcessor.loadToolFiles();
|
|
7133
7222
|
if (toolFiles.length === 0) {
|
|
@@ -7150,7 +7239,7 @@ async function initCommand() {
|
|
|
7150
7239
|
await createConfigFile();
|
|
7151
7240
|
logger.success("rulesync initialized successfully!");
|
|
7152
7241
|
logger.info("Next steps:");
|
|
7153
|
-
logger.info(`1. Edit
|
|
7242
|
+
logger.info(`1. Edit .rulesync/**/*.md, .rulesync/.mcp.json and .rulesyncignore`);
|
|
7154
7243
|
logger.info("2. Run 'rulesync generate' to create configuration files");
|
|
7155
7244
|
}
|
|
7156
7245
|
async function createConfigFile() {
|
|
@@ -7167,9 +7256,9 @@ async function createConfigFile() {
|
|
|
7167
7256
|
baseDirs: ["."],
|
|
7168
7257
|
delete: true,
|
|
7169
7258
|
verbose: false,
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7259
|
+
global: false,
|
|
7260
|
+
simulatedCommands: false,
|
|
7261
|
+
simulatedSubagents: false
|
|
7173
7262
|
},
|
|
7174
7263
|
null,
|
|
7175
7264
|
2
|
|
@@ -7178,7 +7267,7 @@ async function createConfigFile() {
|
|
|
7178
7267
|
logger.success("Created rulesync.jsonc");
|
|
7179
7268
|
}
|
|
7180
7269
|
async function createSampleFiles() {
|
|
7181
|
-
const
|
|
7270
|
+
const sampleRuleFile = {
|
|
7182
7271
|
filename: "overview.md",
|
|
7183
7272
|
content: `---
|
|
7184
7273
|
root: true
|
|
@@ -7213,20 +7302,134 @@ globs: ["**/*"]
|
|
|
7213
7302
|
- Follow single responsibility principle
|
|
7214
7303
|
`
|
|
7215
7304
|
};
|
|
7216
|
-
const
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7305
|
+
const sampleMcpFile = {
|
|
7306
|
+
filename: ".mcp.json",
|
|
7307
|
+
content: `{
|
|
7308
|
+
"mcpServers": {
|
|
7309
|
+
"serena": {
|
|
7310
|
+
"type": "stdio",
|
|
7311
|
+
"command": "uvx",
|
|
7312
|
+
"args": [
|
|
7313
|
+
"--from",
|
|
7314
|
+
"git+https://github.com/oraios/serena",
|
|
7315
|
+
"serena",
|
|
7316
|
+
"start-mcp-server",
|
|
7317
|
+
"--context",
|
|
7318
|
+
"ide-assistant",
|
|
7319
|
+
"--enable-web-dashboard",
|
|
7320
|
+
"false",
|
|
7321
|
+
"--project",
|
|
7322
|
+
"."
|
|
7323
|
+
],
|
|
7324
|
+
"env": {}
|
|
7325
|
+
},
|
|
7326
|
+
"context7": {
|
|
7327
|
+
"type": "stdio",
|
|
7328
|
+
"command": "npx",
|
|
7329
|
+
"args": [
|
|
7330
|
+
"-y",
|
|
7331
|
+
"@upstash/context7-mcp"
|
|
7332
|
+
],
|
|
7333
|
+
"env": {}
|
|
7334
|
+
}
|
|
7335
|
+
}
|
|
7336
|
+
}
|
|
7337
|
+
`
|
|
7338
|
+
};
|
|
7339
|
+
const sampleCommandFile = {
|
|
7340
|
+
filename: "review-pr.md",
|
|
7341
|
+
content: `---
|
|
7342
|
+
description: 'Review a pull request'
|
|
7343
|
+
targets: ["*"]
|
|
7344
|
+
---
|
|
7345
|
+
|
|
7346
|
+
target_pr = $ARGUMENTS
|
|
7347
|
+
|
|
7348
|
+
If target_pr is not provided, use the PR of the current branch.
|
|
7349
|
+
|
|
7350
|
+
Execute the following in parallel:
|
|
7351
|
+
|
|
7352
|
+
1. Check code quality and style consistency
|
|
7353
|
+
2. Review test coverage
|
|
7354
|
+
3. Verify documentation updates
|
|
7355
|
+
4. Check for potential bugs or security issues
|
|
7356
|
+
|
|
7357
|
+
Then provide a summary of findings and suggestions for improvement.
|
|
7358
|
+
`
|
|
7359
|
+
};
|
|
7360
|
+
const sampleSubagentFile = {
|
|
7361
|
+
filename: "planner.md",
|
|
7362
|
+
content: `---
|
|
7363
|
+
name: planner
|
|
7364
|
+
targets: ["*"]
|
|
7365
|
+
description: >-
|
|
7366
|
+
This is the general-purpose planner. The user asks the agent to plan to
|
|
7367
|
+
suggest a specification, implement a new feature, refactor the codebase, or
|
|
7368
|
+
fix a bug. This agent can be called by the user explicitly only.
|
|
7369
|
+
claudecode:
|
|
7370
|
+
model: inherit
|
|
7371
|
+
---
|
|
7372
|
+
|
|
7373
|
+
You are the planner for any tasks.
|
|
7374
|
+
|
|
7375
|
+
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.
|
|
7376
|
+
|
|
7377
|
+
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.
|
|
7378
|
+
`
|
|
7379
|
+
};
|
|
7380
|
+
const sampleIgnoreFile = {
|
|
7381
|
+
content: `credentials/
|
|
7382
|
+
`
|
|
7383
|
+
};
|
|
7384
|
+
const rulePaths = RulesyncRule.getSettablePaths();
|
|
7385
|
+
const mcpPaths = RulesyncMcp.getSettablePaths();
|
|
7386
|
+
const commandPaths = RulesyncCommand.getSettablePaths();
|
|
7387
|
+
const subagentPaths = RulesyncSubagent.getSettablePaths();
|
|
7388
|
+
const ignorePaths = RulesyncIgnore.getSettablePaths();
|
|
7389
|
+
await ensureDir(rulePaths.recommended.relativeDirPath);
|
|
7390
|
+
await ensureDir(mcpPaths.relativeDirPath);
|
|
7391
|
+
await ensureDir(commandPaths.relativeDirPath);
|
|
7392
|
+
await ensureDir(subagentPaths.relativeDirPath);
|
|
7393
|
+
await ensureDir(ignorePaths.relativeDirPath);
|
|
7394
|
+
const ruleFilepath = join58(rulePaths.recommended.relativeDirPath, sampleRuleFile.filename);
|
|
7395
|
+
if (!await fileExists(ruleFilepath)) {
|
|
7396
|
+
await writeFileContent(ruleFilepath, sampleRuleFile.content);
|
|
7397
|
+
logger.success(`Created ${ruleFilepath}`);
|
|
7398
|
+
} else {
|
|
7399
|
+
logger.info(`Skipped ${ruleFilepath} (already exists)`);
|
|
7400
|
+
}
|
|
7401
|
+
const mcpFilepath = join58(mcpPaths.relativeDirPath, mcpPaths.relativeFilePath);
|
|
7402
|
+
if (!await fileExists(mcpFilepath)) {
|
|
7403
|
+
await writeFileContent(mcpFilepath, sampleMcpFile.content);
|
|
7404
|
+
logger.success(`Created ${mcpFilepath}`);
|
|
7405
|
+
} else {
|
|
7406
|
+
logger.info(`Skipped ${mcpFilepath} (already exists)`);
|
|
7407
|
+
}
|
|
7408
|
+
const commandFilepath = join58(commandPaths.relativeDirPath, sampleCommandFile.filename);
|
|
7409
|
+
if (!await fileExists(commandFilepath)) {
|
|
7410
|
+
await writeFileContent(commandFilepath, sampleCommandFile.content);
|
|
7411
|
+
logger.success(`Created ${commandFilepath}`);
|
|
7412
|
+
} else {
|
|
7413
|
+
logger.info(`Skipped ${commandFilepath} (already exists)`);
|
|
7414
|
+
}
|
|
7415
|
+
const subagentFilepath = join58(subagentPaths.relativeDirPath, sampleSubagentFile.filename);
|
|
7416
|
+
if (!await fileExists(subagentFilepath)) {
|
|
7417
|
+
await writeFileContent(subagentFilepath, sampleSubagentFile.content);
|
|
7418
|
+
logger.success(`Created ${subagentFilepath}`);
|
|
7223
7419
|
} else {
|
|
7224
|
-
logger.info(`Skipped ${
|
|
7420
|
+
logger.info(`Skipped ${subagentFilepath} (already exists)`);
|
|
7421
|
+
}
|
|
7422
|
+
const ignoreFilepath = join58(ignorePaths.relativeDirPath, ignorePaths.relativeFilePath);
|
|
7423
|
+
if (!await fileExists(ignoreFilepath)) {
|
|
7424
|
+
await writeFileContent(ignoreFilepath, sampleIgnoreFile.content);
|
|
7425
|
+
logger.success(`Created ${ignoreFilepath}`);
|
|
7426
|
+
} else {
|
|
7427
|
+
logger.info(`Skipped ${ignoreFilepath} (already exists)`);
|
|
7225
7428
|
}
|
|
7226
7429
|
}
|
|
7227
7430
|
|
|
7228
7431
|
// src/cli/index.ts
|
|
7229
|
-
var getVersion = () => "3.
|
|
7432
|
+
var getVersion = () => "3.8.0";
|
|
7230
7433
|
var main = async () => {
|
|
7231
7434
|
const program = new Command();
|
|
7232
7435
|
const version = getVersion();
|
|
@@ -7250,13 +7453,17 @@ var main = async () => {
|
|
|
7250
7453
|
(value) => {
|
|
7251
7454
|
return value.split(",").map((f) => f.trim());
|
|
7252
7455
|
}
|
|
7253
|
-
).option("-V, --verbose", "Verbose output").option("-g, --
|
|
7456
|
+
).option("-V, --verbose", "Verbose output").option("-g, --global", "Import for global(user scope) configuration files").option(
|
|
7457
|
+
"--experimental-global",
|
|
7458
|
+
"Import for global(user scope) configuration files (deprecated: use --global instead)"
|
|
7459
|
+
).action(async (options) => {
|
|
7254
7460
|
try {
|
|
7255
7461
|
await importCommand({
|
|
7256
7462
|
targets: options.targets,
|
|
7257
7463
|
features: options.features,
|
|
7258
7464
|
verbose: options.verbose,
|
|
7259
7465
|
configPath: options.config,
|
|
7466
|
+
global: options.global,
|
|
7260
7467
|
experimentalGlobal: options.experimentalGlobal
|
|
7261
7468
|
});
|
|
7262
7469
|
} catch (error) {
|
|
@@ -7279,12 +7486,21 @@ var main = async () => {
|
|
|
7279
7486
|
).option("--delete", "Delete all existing files in output directories before generating").option(
|
|
7280
7487
|
"-b, --base-dir <paths>",
|
|
7281
7488
|
"Base directories to generate files (comma-separated for multiple paths)"
|
|
7282
|
-
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option("-g, --
|
|
7489
|
+
).option("-V, --verbose", "Verbose output").option("-c, --config <path>", "Path to configuration file").option("-g, --global", "Generate for global(user scope) configuration files").option(
|
|
7490
|
+
"--simulated-commands",
|
|
7491
|
+
"Generate simulated commands. This feature is only available for copilot, cursor and codexcli."
|
|
7492
|
+
).option(
|
|
7493
|
+
"--simulated-subagents",
|
|
7494
|
+
"Generate simulated subagents. This feature is only available for copilot, cursor and codexcli."
|
|
7495
|
+
).option(
|
|
7496
|
+
"--experimental-global",
|
|
7497
|
+
"Generate for global(user scope) configuration files (deprecated: use --global instead)"
|
|
7498
|
+
).option(
|
|
7283
7499
|
"--experimental-simulate-commands",
|
|
7284
|
-
"Generate simulated commands (
|
|
7500
|
+
"Generate simulated commands (deprecated: use --simulated-commands instead)"
|
|
7285
7501
|
).option(
|
|
7286
7502
|
"--experimental-simulate-subagents",
|
|
7287
|
-
"Generate simulated subagents (
|
|
7503
|
+
"Generate simulated subagents (deprecated: use --simulated-subagents instead)"
|
|
7288
7504
|
).action(async (options) => {
|
|
7289
7505
|
try {
|
|
7290
7506
|
await generateCommand({
|
|
@@ -7294,6 +7510,9 @@ var main = async () => {
|
|
|
7294
7510
|
delete: options.delete,
|
|
7295
7511
|
baseDirs: options.baseDirs,
|
|
7296
7512
|
configPath: options.config,
|
|
7513
|
+
global: options.global,
|
|
7514
|
+
simulatedCommands: options.simulatedCommands,
|
|
7515
|
+
simulatedSubagents: options.simulatedSubagents,
|
|
7297
7516
|
experimentalGlobal: options.experimentalGlobal,
|
|
7298
7517
|
experimentalSimulateCommands: options.experimentalSimulateCommands,
|
|
7299
7518
|
experimentalSimulateSubagents: options.experimentalSimulateSubagents
|