rulesync 1.1.0 → 1.2.1
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 +1 -1
- package/dist/index.cjs +149 -115
- package/dist/index.js +149 -115
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Rulesync supports both **generation** and **import** for All of the major AI cod
|
|
|
61
61
|
| Codex CLI | ✅ | ✅ | | 🎮 | 🎮 |
|
|
62
62
|
| Gemini CLI | ✅ | ✅ | | ✅ | 🎮 |
|
|
63
63
|
| GitHub Copilot | ✅ | | ✅ | 🎮 | 🎮 |
|
|
64
|
-
| Cursor | ✅ | ✅ | ✅ |
|
|
64
|
+
| Cursor | ✅ | ✅ | ✅ | ✅ | 🎮 |
|
|
65
65
|
| OpenCode | ✅ | | | | |
|
|
66
66
|
| Cline | ✅ | ✅ | ✅ | | |
|
|
67
67
|
| Roo Code | ✅ | ✅ | ✅ | ✅ | 🎮 |
|
package/dist/index.cjs
CHANGED
|
@@ -818,20 +818,51 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
|
818
818
|
|
|
819
819
|
// src/commands/cursor-command.ts
|
|
820
820
|
var import_node_path8 = require("path");
|
|
821
|
-
var CursorCommand = class _CursorCommand extends
|
|
821
|
+
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
822
822
|
static getSettablePaths() {
|
|
823
823
|
return {
|
|
824
824
|
relativeDirPath: ".cursor/commands"
|
|
825
825
|
};
|
|
826
826
|
}
|
|
827
|
+
toRulesyncCommand() {
|
|
828
|
+
const rulesyncFrontmatter = {
|
|
829
|
+
targets: ["*"],
|
|
830
|
+
description: ""
|
|
831
|
+
};
|
|
832
|
+
return new RulesyncCommand({
|
|
833
|
+
baseDir: this.baseDir,
|
|
834
|
+
frontmatter: rulesyncFrontmatter,
|
|
835
|
+
body: this.getFileContent(),
|
|
836
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
837
|
+
relativeFilePath: this.relativeFilePath,
|
|
838
|
+
fileContent: this.getFileContent(),
|
|
839
|
+
validate: true
|
|
840
|
+
});
|
|
841
|
+
}
|
|
827
842
|
static fromRulesyncCommand({
|
|
828
843
|
baseDir = ".",
|
|
829
844
|
rulesyncCommand,
|
|
830
845
|
validate = true
|
|
831
846
|
}) {
|
|
832
|
-
return new _CursorCommand(
|
|
833
|
-
|
|
834
|
-
|
|
847
|
+
return new _CursorCommand({
|
|
848
|
+
baseDir,
|
|
849
|
+
fileContent: rulesyncCommand.getBody(),
|
|
850
|
+
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
851
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
852
|
+
validate
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
validate() {
|
|
856
|
+
return { success: true, error: null };
|
|
857
|
+
}
|
|
858
|
+
getBody() {
|
|
859
|
+
return this.getFileContent();
|
|
860
|
+
}
|
|
861
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
862
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
863
|
+
rulesyncCommand,
|
|
864
|
+
toolTarget: "cursor"
|
|
865
|
+
});
|
|
835
866
|
}
|
|
836
867
|
static async fromFile({
|
|
837
868
|
baseDir = ".",
|
|
@@ -844,26 +875,15 @@ var CursorCommand = class _CursorCommand extends SimulatedCommand {
|
|
|
844
875
|
relativeFilePath
|
|
845
876
|
);
|
|
846
877
|
const fileContent = await readFileContent(filePath);
|
|
847
|
-
const {
|
|
848
|
-
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
849
|
-
if (!result.success) {
|
|
850
|
-
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
851
|
-
}
|
|
878
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
852
879
|
return new _CursorCommand({
|
|
853
880
|
baseDir,
|
|
854
881
|
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
855
882
|
relativeFilePath: (0, import_node_path8.basename)(relativeFilePath),
|
|
856
|
-
|
|
857
|
-
body: content.trim(),
|
|
883
|
+
fileContent: content.trim(),
|
|
858
884
|
validate
|
|
859
885
|
});
|
|
860
886
|
}
|
|
861
|
-
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
862
|
-
return this.isTargetedByRulesyncCommandDefault({
|
|
863
|
-
rulesyncCommand,
|
|
864
|
-
toolTarget: "cursor"
|
|
865
|
-
});
|
|
866
|
-
}
|
|
867
887
|
};
|
|
868
888
|
|
|
869
889
|
// src/commands/geminicli-command.ts
|
|
@@ -897,7 +917,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
897
917
|
prompt: validated.prompt
|
|
898
918
|
};
|
|
899
919
|
} catch (error) {
|
|
900
|
-
throw new Error(`Failed to parse TOML command file: ${error}
|
|
920
|
+
throw new Error(`Failed to parse TOML command file: ${error}`, { cause: error });
|
|
901
921
|
}
|
|
902
922
|
}
|
|
903
923
|
getBody() {
|
|
@@ -1105,7 +1125,7 @@ var commandsProcessorToolTargets = [
|
|
|
1105
1125
|
"codexcli"
|
|
1106
1126
|
];
|
|
1107
1127
|
var CommandsProcessorToolTargetSchema = import_mini8.z.enum(commandsProcessorToolTargets);
|
|
1108
|
-
var commandsProcessorToolTargetsSimulated = ["copilot", "
|
|
1128
|
+
var commandsProcessorToolTargetsSimulated = ["copilot", "codexcli"];
|
|
1109
1129
|
var CommandsProcessor = class extends FeatureProcessor {
|
|
1110
1130
|
toolTarget;
|
|
1111
1131
|
constructor({
|
|
@@ -1224,6 +1244,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1224
1244
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
1225
1245
|
}
|
|
1226
1246
|
}
|
|
1247
|
+
async loadToolFilesToDelete() {
|
|
1248
|
+
return this.loadToolFiles();
|
|
1249
|
+
}
|
|
1227
1250
|
async loadToolCommandDefault({
|
|
1228
1251
|
toolTarget,
|
|
1229
1252
|
relativeDirPath,
|
|
@@ -1450,9 +1473,15 @@ var ConfigResolver = class {
|
|
|
1450
1473
|
}
|
|
1451
1474
|
};
|
|
1452
1475
|
|
|
1453
|
-
// src/ignore/
|
|
1476
|
+
// src/ignore/ignore-processor.ts
|
|
1477
|
+
var import_mini9 = require("zod/mini");
|
|
1478
|
+
|
|
1479
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1454
1480
|
var import_node_path12 = require("path");
|
|
1455
|
-
|
|
1481
|
+
|
|
1482
|
+
// src/types/tool-file.ts
|
|
1483
|
+
var ToolFile = class extends AiFile {
|
|
1484
|
+
};
|
|
1456
1485
|
|
|
1457
1486
|
// src/ignore/rulesync-ignore.ts
|
|
1458
1487
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
@@ -1476,10 +1505,6 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1476
1505
|
}
|
|
1477
1506
|
};
|
|
1478
1507
|
|
|
1479
|
-
// src/types/tool-file.ts
|
|
1480
|
-
var ToolFile = class extends AiFile {
|
|
1481
|
-
};
|
|
1482
|
-
|
|
1483
1508
|
// src/ignore/tool-ignore.ts
|
|
1484
1509
|
var ToolIgnore = class extends ToolFile {
|
|
1485
1510
|
patterns;
|
|
@@ -1521,64 +1546,40 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1521
1546
|
}
|
|
1522
1547
|
};
|
|
1523
1548
|
|
|
1524
|
-
// src/ignore/
|
|
1525
|
-
var
|
|
1526
|
-
constructor(params) {
|
|
1527
|
-
super(params);
|
|
1528
|
-
const jsonValue = JSON.parse(this.fileContent);
|
|
1529
|
-
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
1530
|
-
}
|
|
1549
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1550
|
+
var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
1531
1551
|
static getSettablePaths() {
|
|
1532
1552
|
return {
|
|
1533
|
-
relativeDirPath: ".
|
|
1534
|
-
relativeFilePath: "
|
|
1553
|
+
relativeDirPath: ".",
|
|
1554
|
+
relativeFilePath: ".amazonqignore"
|
|
1535
1555
|
};
|
|
1536
1556
|
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Convert to RulesyncIgnore format
|
|
1559
|
+
*/
|
|
1537
1560
|
toRulesyncIgnore() {
|
|
1538
|
-
|
|
1539
|
-
if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
|
|
1540
|
-
return pattern.slice(5, -1);
|
|
1541
|
-
}
|
|
1542
|
-
return pattern;
|
|
1543
|
-
}).filter((pattern) => pattern.length > 0);
|
|
1544
|
-
const fileContent = rulesyncPatterns.join("\n");
|
|
1545
|
-
return new RulesyncIgnore({
|
|
1546
|
-
baseDir: this.baseDir,
|
|
1547
|
-
relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
|
|
1548
|
-
relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
|
|
1549
|
-
fileContent
|
|
1550
|
-
});
|
|
1561
|
+
return this.toRulesyncIgnoreDefault();
|
|
1551
1562
|
}
|
|
1552
|
-
|
|
1563
|
+
/**
|
|
1564
|
+
* Create AmazonqcliIgnore from RulesyncIgnore
|
|
1565
|
+
* Supports conversion from unified rulesync format to Amazon Q CLI specific format
|
|
1566
|
+
*/
|
|
1567
|
+
static fromRulesyncIgnore({
|
|
1553
1568
|
baseDir = ".",
|
|
1554
1569
|
rulesyncIgnore
|
|
1555
1570
|
}) {
|
|
1556
|
-
const
|
|
1557
|
-
|
|
1558
|
-
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
1559
|
-
const filePath = (0, import_node_path12.join)(
|
|
1560
|
-
baseDir,
|
|
1561
|
-
this.getSettablePaths().relativeDirPath,
|
|
1562
|
-
this.getSettablePaths().relativeFilePath
|
|
1563
|
-
);
|
|
1564
|
-
const exists = await fileExists(filePath);
|
|
1565
|
-
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
1566
|
-
const existingJsonValue = JSON.parse(existingFileContent);
|
|
1567
|
-
const jsonValue = {
|
|
1568
|
-
...existingJsonValue,
|
|
1569
|
-
permissions: {
|
|
1570
|
-
...existingJsonValue.permissions,
|
|
1571
|
-
deny: (0, import_es_toolkit.uniq)([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
|
|
1572
|
-
}
|
|
1573
|
-
};
|
|
1574
|
-
return new _ClaudecodeIgnore({
|
|
1571
|
+
const body = rulesyncIgnore.getFileContent();
|
|
1572
|
+
return new _AmazonqcliIgnore({
|
|
1575
1573
|
baseDir,
|
|
1576
1574
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1577
1575
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1578
|
-
fileContent:
|
|
1579
|
-
validate: true
|
|
1576
|
+
fileContent: body
|
|
1580
1577
|
});
|
|
1581
1578
|
}
|
|
1579
|
+
/**
|
|
1580
|
+
* Create AmazonqcliIgnore from file path
|
|
1581
|
+
* Supports both proposed .q-ignore and .amazonqignore formats
|
|
1582
|
+
*/
|
|
1582
1583
|
static async fromFile({
|
|
1583
1584
|
baseDir = ".",
|
|
1584
1585
|
validate = true
|
|
@@ -1590,7 +1591,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
1590
1591
|
this.getSettablePaths().relativeFilePath
|
|
1591
1592
|
)
|
|
1592
1593
|
);
|
|
1593
|
-
return new
|
|
1594
|
+
return new _AmazonqcliIgnore({
|
|
1594
1595
|
baseDir,
|
|
1595
1596
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1596
1597
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
@@ -1600,16 +1601,13 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
1600
1601
|
}
|
|
1601
1602
|
};
|
|
1602
1603
|
|
|
1603
|
-
// src/ignore/ignore
|
|
1604
|
-
var import_mini9 = require("zod/mini");
|
|
1605
|
-
|
|
1606
|
-
// src/ignore/amazonqcli-ignore.ts
|
|
1604
|
+
// src/ignore/augmentcode-ignore.ts
|
|
1607
1605
|
var import_node_path13 = require("path");
|
|
1608
|
-
var
|
|
1606
|
+
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1609
1607
|
static getSettablePaths() {
|
|
1610
1608
|
return {
|
|
1611
1609
|
relativeDirPath: ".",
|
|
1612
|
-
relativeFilePath: ".
|
|
1610
|
+
relativeFilePath: ".augmentignore"
|
|
1613
1611
|
};
|
|
1614
1612
|
}
|
|
1615
1613
|
/**
|
|
@@ -1619,24 +1617,23 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1619
1617
|
return this.toRulesyncIgnoreDefault();
|
|
1620
1618
|
}
|
|
1621
1619
|
/**
|
|
1622
|
-
* Create
|
|
1623
|
-
* Supports conversion from unified rulesync format to
|
|
1620
|
+
* Create AugmentcodeIgnore from RulesyncIgnore
|
|
1621
|
+
* Supports conversion from unified rulesync format to AugmentCode specific format
|
|
1624
1622
|
*/
|
|
1625
1623
|
static fromRulesyncIgnore({
|
|
1626
1624
|
baseDir = ".",
|
|
1627
1625
|
rulesyncIgnore
|
|
1628
1626
|
}) {
|
|
1629
|
-
|
|
1630
|
-
return new _AmazonqcliIgnore({
|
|
1627
|
+
return new _AugmentcodeIgnore({
|
|
1631
1628
|
baseDir,
|
|
1632
1629
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1633
1630
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1634
|
-
fileContent:
|
|
1631
|
+
fileContent: rulesyncIgnore.getFileContent()
|
|
1635
1632
|
});
|
|
1636
1633
|
}
|
|
1637
1634
|
/**
|
|
1638
|
-
* Create
|
|
1639
|
-
*
|
|
1635
|
+
* Create AugmentcodeIgnore from file path
|
|
1636
|
+
* Reads and parses .augmentignore file
|
|
1640
1637
|
*/
|
|
1641
1638
|
static async fromFile({
|
|
1642
1639
|
baseDir = ".",
|
|
@@ -1649,7 +1646,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1649
1646
|
this.getSettablePaths().relativeFilePath
|
|
1650
1647
|
)
|
|
1651
1648
|
);
|
|
1652
|
-
return new
|
|
1649
|
+
return new _AugmentcodeIgnore({
|
|
1653
1650
|
baseDir,
|
|
1654
1651
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1655
1652
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
@@ -1659,40 +1656,66 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1659
1656
|
}
|
|
1660
1657
|
};
|
|
1661
1658
|
|
|
1662
|
-
// src/ignore/
|
|
1659
|
+
// src/ignore/claudecode-ignore.ts
|
|
1663
1660
|
var import_node_path14 = require("path");
|
|
1664
|
-
var
|
|
1661
|
+
var import_es_toolkit = require("es-toolkit");
|
|
1662
|
+
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
1663
|
+
constructor(params) {
|
|
1664
|
+
super(params);
|
|
1665
|
+
const jsonValue = JSON.parse(this.fileContent);
|
|
1666
|
+
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
1667
|
+
}
|
|
1665
1668
|
static getSettablePaths() {
|
|
1666
1669
|
return {
|
|
1667
|
-
relativeDirPath: ".",
|
|
1668
|
-
relativeFilePath: ".
|
|
1670
|
+
relativeDirPath: ".claude",
|
|
1671
|
+
relativeFilePath: "settings.local.json"
|
|
1669
1672
|
};
|
|
1670
1673
|
}
|
|
1671
|
-
/**
|
|
1672
|
-
* Convert to RulesyncIgnore format
|
|
1673
|
-
*/
|
|
1674
1674
|
toRulesyncIgnore() {
|
|
1675
|
-
|
|
1675
|
+
const rulesyncPatterns = this.patterns.map((pattern) => {
|
|
1676
|
+
if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
|
|
1677
|
+
return pattern.slice(5, -1);
|
|
1678
|
+
}
|
|
1679
|
+
return pattern;
|
|
1680
|
+
}).filter((pattern) => pattern.length > 0);
|
|
1681
|
+
const fileContent = rulesyncPatterns.join("\n");
|
|
1682
|
+
return new RulesyncIgnore({
|
|
1683
|
+
baseDir: this.baseDir,
|
|
1684
|
+
relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
|
|
1685
|
+
relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
|
|
1686
|
+
fileContent
|
|
1687
|
+
});
|
|
1676
1688
|
}
|
|
1677
|
-
|
|
1678
|
-
* Create AugmentcodeIgnore from RulesyncIgnore
|
|
1679
|
-
* Supports conversion from unified rulesync format to AugmentCode specific format
|
|
1680
|
-
*/
|
|
1681
|
-
static fromRulesyncIgnore({
|
|
1689
|
+
static async fromRulesyncIgnore({
|
|
1682
1690
|
baseDir = ".",
|
|
1683
1691
|
rulesyncIgnore
|
|
1684
1692
|
}) {
|
|
1685
|
-
|
|
1693
|
+
const fileContent = rulesyncIgnore.getFileContent();
|
|
1694
|
+
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
1695
|
+
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
1696
|
+
const filePath = (0, import_node_path14.join)(
|
|
1697
|
+
baseDir,
|
|
1698
|
+
this.getSettablePaths().relativeDirPath,
|
|
1699
|
+
this.getSettablePaths().relativeFilePath
|
|
1700
|
+
);
|
|
1701
|
+
const exists = await fileExists(filePath);
|
|
1702
|
+
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
1703
|
+
const existingJsonValue = JSON.parse(existingFileContent);
|
|
1704
|
+
const jsonValue = {
|
|
1705
|
+
...existingJsonValue,
|
|
1706
|
+
permissions: {
|
|
1707
|
+
...existingJsonValue.permissions,
|
|
1708
|
+
deny: (0, import_es_toolkit.uniq)([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
return new _ClaudecodeIgnore({
|
|
1686
1712
|
baseDir,
|
|
1687
1713
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1688
1714
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1689
|
-
fileContent:
|
|
1715
|
+
fileContent: JSON.stringify(jsonValue, null, 2),
|
|
1716
|
+
validate: true
|
|
1690
1717
|
});
|
|
1691
1718
|
}
|
|
1692
|
-
/**
|
|
1693
|
-
* Create AugmentcodeIgnore from file path
|
|
1694
|
-
* Reads and parses .augmentignore file
|
|
1695
|
-
*/
|
|
1696
1719
|
static async fromFile({
|
|
1697
1720
|
baseDir = ".",
|
|
1698
1721
|
validate = true
|
|
@@ -1704,7 +1727,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1704
1727
|
this.getSettablePaths().relativeFilePath
|
|
1705
1728
|
)
|
|
1706
1729
|
);
|
|
1707
|
-
return new
|
|
1730
|
+
return new _ClaudecodeIgnore({
|
|
1708
1731
|
baseDir,
|
|
1709
1732
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1710
1733
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
@@ -1871,7 +1894,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1871
1894
|
static getSettablePaths() {
|
|
1872
1895
|
return {
|
|
1873
1896
|
relativeDirPath: ".",
|
|
1874
|
-
relativeFilePath: ".
|
|
1897
|
+
relativeFilePath: ".geminiignore"
|
|
1875
1898
|
};
|
|
1876
1899
|
}
|
|
1877
1900
|
toRulesyncIgnore() {
|
|
@@ -2213,6 +2236,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2213
2236
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
2214
2237
|
}
|
|
2215
2238
|
}
|
|
2239
|
+
async loadToolFilesToDelete() {
|
|
2240
|
+
return (await this.loadToolFiles()).filter(
|
|
2241
|
+
(toolFile) => !(toolFile instanceof ClaudecodeIgnore)
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2216
2244
|
/**
|
|
2217
2245
|
* Implementation of abstract method from FeatureProcessor
|
|
2218
2246
|
* Convert RulesyncFile[] to ToolFile[]
|
|
@@ -2762,6 +2790,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2762
2790
|
return [];
|
|
2763
2791
|
}
|
|
2764
2792
|
}
|
|
2793
|
+
async loadToolFilesToDelete() {
|
|
2794
|
+
return this.loadToolFiles();
|
|
2795
|
+
}
|
|
2765
2796
|
/**
|
|
2766
2797
|
* Implementation of abstract method from FeatureProcessor
|
|
2767
2798
|
* Load tool-specific MCP configurations and parse them into ToolMcp instances
|
|
@@ -3516,6 +3547,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3516
3547
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3517
3548
|
}
|
|
3518
3549
|
}
|
|
3550
|
+
async loadToolFilesToDelete() {
|
|
3551
|
+
return this.loadToolFiles();
|
|
3552
|
+
}
|
|
3519
3553
|
/**
|
|
3520
3554
|
* Load Claude Code subagent configurations from .claude/agents/ directory
|
|
3521
3555
|
*/
|
|
@@ -5470,6 +5504,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5470
5504
|
return [];
|
|
5471
5505
|
}
|
|
5472
5506
|
}
|
|
5507
|
+
async loadToolFilesToDelete() {
|
|
5508
|
+
return this.loadToolFiles();
|
|
5509
|
+
}
|
|
5473
5510
|
async loadToolRulesDefault({
|
|
5474
5511
|
root,
|
|
5475
5512
|
nonRoot
|
|
@@ -5901,7 +5938,7 @@ async function generateCommand(options) {
|
|
|
5901
5938
|
simulateSubagents: config.getExperimentalSimulateSubagents()
|
|
5902
5939
|
});
|
|
5903
5940
|
if (config.getDelete()) {
|
|
5904
|
-
const oldToolFiles = await processor.
|
|
5941
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
5905
5942
|
await processor.removeAiFiles(oldToolFiles);
|
|
5906
5943
|
}
|
|
5907
5944
|
let rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -5938,7 +5975,7 @@ async function generateCommand(options) {
|
|
|
5938
5975
|
toolTarget
|
|
5939
5976
|
});
|
|
5940
5977
|
if (config.getDelete()) {
|
|
5941
|
-
const oldToolFiles = await processor.
|
|
5978
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
5942
5979
|
await processor.removeAiFiles(oldToolFiles);
|
|
5943
5980
|
}
|
|
5944
5981
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -5968,7 +6005,7 @@ async function generateCommand(options) {
|
|
|
5968
6005
|
toolTarget
|
|
5969
6006
|
});
|
|
5970
6007
|
if (config.getDelete()) {
|
|
5971
|
-
const oldToolFiles = await processor.
|
|
6008
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
5972
6009
|
await processor.removeAiFiles(oldToolFiles);
|
|
5973
6010
|
}
|
|
5974
6011
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -5992,11 +6029,8 @@ async function generateCommand(options) {
|
|
|
5992
6029
|
toolTarget
|
|
5993
6030
|
});
|
|
5994
6031
|
if (config.getDelete()) {
|
|
5995
|
-
const oldToolFiles = await processor.
|
|
5996
|
-
|
|
5997
|
-
(toolFile) => !(toolFile.getRelativeDirPath() === ClaudecodeIgnore.getSettablePaths().relativeDirPath && toolFile.getRelativeFilePath() === ClaudecodeIgnore.getSettablePaths().relativeFilePath)
|
|
5998
|
-
);
|
|
5999
|
-
await processor.removeAiFiles(oldToolFilesForDelete);
|
|
6032
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
6033
|
+
await processor.removeAiFiles(oldToolFiles);
|
|
6000
6034
|
}
|
|
6001
6035
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
6002
6036
|
if (rulesyncFiles.length > 0) {
|
|
@@ -6030,7 +6064,7 @@ async function generateCommand(options) {
|
|
|
6030
6064
|
toolTarget
|
|
6031
6065
|
});
|
|
6032
6066
|
if (config.getDelete()) {
|
|
6033
|
-
const oldToolFiles = await processor.
|
|
6067
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
6034
6068
|
await processor.removeAiFiles(oldToolFiles);
|
|
6035
6069
|
}
|
|
6036
6070
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -6325,7 +6359,7 @@ var getVersion = async () => {
|
|
|
6325
6359
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
6326
6360
|
return packageJson.version;
|
|
6327
6361
|
} catch {
|
|
6328
|
-
return "1.
|
|
6362
|
+
return "1.2.0";
|
|
6329
6363
|
}
|
|
6330
6364
|
};
|
|
6331
6365
|
var main = async () => {
|
package/dist/index.js
CHANGED
|
@@ -795,20 +795,51 @@ var CopilotCommand = class _CopilotCommand extends SimulatedCommand {
|
|
|
795
795
|
|
|
796
796
|
// src/commands/cursor-command.ts
|
|
797
797
|
import { basename as basename7, join as join7 } from "path";
|
|
798
|
-
var CursorCommand = class _CursorCommand extends
|
|
798
|
+
var CursorCommand = class _CursorCommand extends ToolCommand {
|
|
799
799
|
static getSettablePaths() {
|
|
800
800
|
return {
|
|
801
801
|
relativeDirPath: ".cursor/commands"
|
|
802
802
|
};
|
|
803
803
|
}
|
|
804
|
+
toRulesyncCommand() {
|
|
805
|
+
const rulesyncFrontmatter = {
|
|
806
|
+
targets: ["*"],
|
|
807
|
+
description: ""
|
|
808
|
+
};
|
|
809
|
+
return new RulesyncCommand({
|
|
810
|
+
baseDir: this.baseDir,
|
|
811
|
+
frontmatter: rulesyncFrontmatter,
|
|
812
|
+
body: this.getFileContent(),
|
|
813
|
+
relativeDirPath: RulesyncCommand.getSettablePaths().relativeDirPath,
|
|
814
|
+
relativeFilePath: this.relativeFilePath,
|
|
815
|
+
fileContent: this.getFileContent(),
|
|
816
|
+
validate: true
|
|
817
|
+
});
|
|
818
|
+
}
|
|
804
819
|
static fromRulesyncCommand({
|
|
805
820
|
baseDir = ".",
|
|
806
821
|
rulesyncCommand,
|
|
807
822
|
validate = true
|
|
808
823
|
}) {
|
|
809
|
-
return new _CursorCommand(
|
|
810
|
-
|
|
811
|
-
|
|
824
|
+
return new _CursorCommand({
|
|
825
|
+
baseDir,
|
|
826
|
+
fileContent: rulesyncCommand.getBody(),
|
|
827
|
+
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
828
|
+
relativeFilePath: rulesyncCommand.getRelativeFilePath(),
|
|
829
|
+
validate
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
validate() {
|
|
833
|
+
return { success: true, error: null };
|
|
834
|
+
}
|
|
835
|
+
getBody() {
|
|
836
|
+
return this.getFileContent();
|
|
837
|
+
}
|
|
838
|
+
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
839
|
+
return this.isTargetedByRulesyncCommandDefault({
|
|
840
|
+
rulesyncCommand,
|
|
841
|
+
toolTarget: "cursor"
|
|
842
|
+
});
|
|
812
843
|
}
|
|
813
844
|
static async fromFile({
|
|
814
845
|
baseDir = ".",
|
|
@@ -821,26 +852,15 @@ var CursorCommand = class _CursorCommand extends SimulatedCommand {
|
|
|
821
852
|
relativeFilePath
|
|
822
853
|
);
|
|
823
854
|
const fileContent = await readFileContent(filePath);
|
|
824
|
-
const {
|
|
825
|
-
const result = SimulatedCommandFrontmatterSchema.safeParse(frontmatter);
|
|
826
|
-
if (!result.success) {
|
|
827
|
-
throw new Error(`Invalid frontmatter in ${filePath}: ${result.error.message}`);
|
|
828
|
-
}
|
|
855
|
+
const { body: content } = parseFrontmatter(fileContent);
|
|
829
856
|
return new _CursorCommand({
|
|
830
857
|
baseDir,
|
|
831
858
|
relativeDirPath: _CursorCommand.getSettablePaths().relativeDirPath,
|
|
832
859
|
relativeFilePath: basename7(relativeFilePath),
|
|
833
|
-
|
|
834
|
-
body: content.trim(),
|
|
860
|
+
fileContent: content.trim(),
|
|
835
861
|
validate
|
|
836
862
|
});
|
|
837
863
|
}
|
|
838
|
-
static isTargetedByRulesyncCommand(rulesyncCommand) {
|
|
839
|
-
return this.isTargetedByRulesyncCommandDefault({
|
|
840
|
-
rulesyncCommand,
|
|
841
|
-
toolTarget: "cursor"
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
864
|
};
|
|
845
865
|
|
|
846
866
|
// src/commands/geminicli-command.ts
|
|
@@ -874,7 +894,7 @@ var GeminiCliCommand = class _GeminiCliCommand extends ToolCommand {
|
|
|
874
894
|
prompt: validated.prompt
|
|
875
895
|
};
|
|
876
896
|
} catch (error) {
|
|
877
|
-
throw new Error(`Failed to parse TOML command file: ${error}
|
|
897
|
+
throw new Error(`Failed to parse TOML command file: ${error}`, { cause: error });
|
|
878
898
|
}
|
|
879
899
|
}
|
|
880
900
|
getBody() {
|
|
@@ -1082,7 +1102,7 @@ var commandsProcessorToolTargets = [
|
|
|
1082
1102
|
"codexcli"
|
|
1083
1103
|
];
|
|
1084
1104
|
var CommandsProcessorToolTargetSchema = z8.enum(commandsProcessorToolTargets);
|
|
1085
|
-
var commandsProcessorToolTargetsSimulated = ["copilot", "
|
|
1105
|
+
var commandsProcessorToolTargetsSimulated = ["copilot", "codexcli"];
|
|
1086
1106
|
var CommandsProcessor = class extends FeatureProcessor {
|
|
1087
1107
|
toolTarget;
|
|
1088
1108
|
constructor({
|
|
@@ -1201,6 +1221,9 @@ var CommandsProcessor = class extends FeatureProcessor {
|
|
|
1201
1221
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
1202
1222
|
}
|
|
1203
1223
|
}
|
|
1224
|
+
async loadToolFilesToDelete() {
|
|
1225
|
+
return this.loadToolFiles();
|
|
1226
|
+
}
|
|
1204
1227
|
async loadToolCommandDefault({
|
|
1205
1228
|
toolTarget,
|
|
1206
1229
|
relativeDirPath,
|
|
@@ -1427,9 +1450,15 @@ var ConfigResolver = class {
|
|
|
1427
1450
|
}
|
|
1428
1451
|
};
|
|
1429
1452
|
|
|
1430
|
-
// src/ignore/
|
|
1453
|
+
// src/ignore/ignore-processor.ts
|
|
1454
|
+
import { z as z9 } from "zod/mini";
|
|
1455
|
+
|
|
1456
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1431
1457
|
import { join as join11 } from "path";
|
|
1432
|
-
|
|
1458
|
+
|
|
1459
|
+
// src/types/tool-file.ts
|
|
1460
|
+
var ToolFile = class extends AiFile {
|
|
1461
|
+
};
|
|
1433
1462
|
|
|
1434
1463
|
// src/ignore/rulesync-ignore.ts
|
|
1435
1464
|
var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
@@ -1453,10 +1482,6 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
|
|
|
1453
1482
|
}
|
|
1454
1483
|
};
|
|
1455
1484
|
|
|
1456
|
-
// src/types/tool-file.ts
|
|
1457
|
-
var ToolFile = class extends AiFile {
|
|
1458
|
-
};
|
|
1459
|
-
|
|
1460
1485
|
// src/ignore/tool-ignore.ts
|
|
1461
1486
|
var ToolIgnore = class extends ToolFile {
|
|
1462
1487
|
patterns;
|
|
@@ -1498,64 +1523,40 @@ var ToolIgnore = class extends ToolFile {
|
|
|
1498
1523
|
}
|
|
1499
1524
|
};
|
|
1500
1525
|
|
|
1501
|
-
// src/ignore/
|
|
1502
|
-
var
|
|
1503
|
-
constructor(params) {
|
|
1504
|
-
super(params);
|
|
1505
|
-
const jsonValue = JSON.parse(this.fileContent);
|
|
1506
|
-
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
1507
|
-
}
|
|
1526
|
+
// src/ignore/amazonqcli-ignore.ts
|
|
1527
|
+
var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
1508
1528
|
static getSettablePaths() {
|
|
1509
1529
|
return {
|
|
1510
|
-
relativeDirPath: ".
|
|
1511
|
-
relativeFilePath: "
|
|
1530
|
+
relativeDirPath: ".",
|
|
1531
|
+
relativeFilePath: ".amazonqignore"
|
|
1512
1532
|
};
|
|
1513
1533
|
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Convert to RulesyncIgnore format
|
|
1536
|
+
*/
|
|
1514
1537
|
toRulesyncIgnore() {
|
|
1515
|
-
|
|
1516
|
-
if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
|
|
1517
|
-
return pattern.slice(5, -1);
|
|
1518
|
-
}
|
|
1519
|
-
return pattern;
|
|
1520
|
-
}).filter((pattern) => pattern.length > 0);
|
|
1521
|
-
const fileContent = rulesyncPatterns.join("\n");
|
|
1522
|
-
return new RulesyncIgnore({
|
|
1523
|
-
baseDir: this.baseDir,
|
|
1524
|
-
relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
|
|
1525
|
-
relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
|
|
1526
|
-
fileContent
|
|
1527
|
-
});
|
|
1538
|
+
return this.toRulesyncIgnoreDefault();
|
|
1528
1539
|
}
|
|
1529
|
-
|
|
1540
|
+
/**
|
|
1541
|
+
* Create AmazonqcliIgnore from RulesyncIgnore
|
|
1542
|
+
* Supports conversion from unified rulesync format to Amazon Q CLI specific format
|
|
1543
|
+
*/
|
|
1544
|
+
static fromRulesyncIgnore({
|
|
1530
1545
|
baseDir = ".",
|
|
1531
1546
|
rulesyncIgnore
|
|
1532
1547
|
}) {
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1535
|
-
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
1536
|
-
const filePath = join11(
|
|
1537
|
-
baseDir,
|
|
1538
|
-
this.getSettablePaths().relativeDirPath,
|
|
1539
|
-
this.getSettablePaths().relativeFilePath
|
|
1540
|
-
);
|
|
1541
|
-
const exists = await fileExists(filePath);
|
|
1542
|
-
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
1543
|
-
const existingJsonValue = JSON.parse(existingFileContent);
|
|
1544
|
-
const jsonValue = {
|
|
1545
|
-
...existingJsonValue,
|
|
1546
|
-
permissions: {
|
|
1547
|
-
...existingJsonValue.permissions,
|
|
1548
|
-
deny: uniq([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
|
|
1549
|
-
}
|
|
1550
|
-
};
|
|
1551
|
-
return new _ClaudecodeIgnore({
|
|
1548
|
+
const body = rulesyncIgnore.getFileContent();
|
|
1549
|
+
return new _AmazonqcliIgnore({
|
|
1552
1550
|
baseDir,
|
|
1553
1551
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1554
1552
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1555
|
-
fileContent:
|
|
1556
|
-
validate: true
|
|
1553
|
+
fileContent: body
|
|
1557
1554
|
});
|
|
1558
1555
|
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Create AmazonqcliIgnore from file path
|
|
1558
|
+
* Supports both proposed .q-ignore and .amazonqignore formats
|
|
1559
|
+
*/
|
|
1559
1560
|
static async fromFile({
|
|
1560
1561
|
baseDir = ".",
|
|
1561
1562
|
validate = true
|
|
@@ -1567,7 +1568,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
1567
1568
|
this.getSettablePaths().relativeFilePath
|
|
1568
1569
|
)
|
|
1569
1570
|
);
|
|
1570
|
-
return new
|
|
1571
|
+
return new _AmazonqcliIgnore({
|
|
1571
1572
|
baseDir,
|
|
1572
1573
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1573
1574
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
@@ -1577,16 +1578,13 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
|
1577
1578
|
}
|
|
1578
1579
|
};
|
|
1579
1580
|
|
|
1580
|
-
// src/ignore/ignore
|
|
1581
|
-
import { z as z9 } from "zod/mini";
|
|
1582
|
-
|
|
1583
|
-
// src/ignore/amazonqcli-ignore.ts
|
|
1581
|
+
// src/ignore/augmentcode-ignore.ts
|
|
1584
1582
|
import { join as join12 } from "path";
|
|
1585
|
-
var
|
|
1583
|
+
var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
1586
1584
|
static getSettablePaths() {
|
|
1587
1585
|
return {
|
|
1588
1586
|
relativeDirPath: ".",
|
|
1589
|
-
relativeFilePath: ".
|
|
1587
|
+
relativeFilePath: ".augmentignore"
|
|
1590
1588
|
};
|
|
1591
1589
|
}
|
|
1592
1590
|
/**
|
|
@@ -1596,24 +1594,23 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1596
1594
|
return this.toRulesyncIgnoreDefault();
|
|
1597
1595
|
}
|
|
1598
1596
|
/**
|
|
1599
|
-
* Create
|
|
1600
|
-
* Supports conversion from unified rulesync format to
|
|
1597
|
+
* Create AugmentcodeIgnore from RulesyncIgnore
|
|
1598
|
+
* Supports conversion from unified rulesync format to AugmentCode specific format
|
|
1601
1599
|
*/
|
|
1602
1600
|
static fromRulesyncIgnore({
|
|
1603
1601
|
baseDir = ".",
|
|
1604
1602
|
rulesyncIgnore
|
|
1605
1603
|
}) {
|
|
1606
|
-
|
|
1607
|
-
return new _AmazonqcliIgnore({
|
|
1604
|
+
return new _AugmentcodeIgnore({
|
|
1608
1605
|
baseDir,
|
|
1609
1606
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1610
1607
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1611
|
-
fileContent:
|
|
1608
|
+
fileContent: rulesyncIgnore.getFileContent()
|
|
1612
1609
|
});
|
|
1613
1610
|
}
|
|
1614
1611
|
/**
|
|
1615
|
-
* Create
|
|
1616
|
-
*
|
|
1612
|
+
* Create AugmentcodeIgnore from file path
|
|
1613
|
+
* Reads and parses .augmentignore file
|
|
1617
1614
|
*/
|
|
1618
1615
|
static async fromFile({
|
|
1619
1616
|
baseDir = ".",
|
|
@@ -1626,7 +1623,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1626
1623
|
this.getSettablePaths().relativeFilePath
|
|
1627
1624
|
)
|
|
1628
1625
|
);
|
|
1629
|
-
return new
|
|
1626
|
+
return new _AugmentcodeIgnore({
|
|
1630
1627
|
baseDir,
|
|
1631
1628
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1632
1629
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
@@ -1636,40 +1633,66 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
|
|
|
1636
1633
|
}
|
|
1637
1634
|
};
|
|
1638
1635
|
|
|
1639
|
-
// src/ignore/
|
|
1636
|
+
// src/ignore/claudecode-ignore.ts
|
|
1640
1637
|
import { join as join13 } from "path";
|
|
1641
|
-
|
|
1638
|
+
import { uniq } from "es-toolkit";
|
|
1639
|
+
var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
|
|
1640
|
+
constructor(params) {
|
|
1641
|
+
super(params);
|
|
1642
|
+
const jsonValue = JSON.parse(this.fileContent);
|
|
1643
|
+
this.patterns = jsonValue.permissions?.deny ?? [];
|
|
1644
|
+
}
|
|
1642
1645
|
static getSettablePaths() {
|
|
1643
1646
|
return {
|
|
1644
|
-
relativeDirPath: ".",
|
|
1645
|
-
relativeFilePath: ".
|
|
1647
|
+
relativeDirPath: ".claude",
|
|
1648
|
+
relativeFilePath: "settings.local.json"
|
|
1646
1649
|
};
|
|
1647
1650
|
}
|
|
1648
|
-
/**
|
|
1649
|
-
* Convert to RulesyncIgnore format
|
|
1650
|
-
*/
|
|
1651
1651
|
toRulesyncIgnore() {
|
|
1652
|
-
|
|
1652
|
+
const rulesyncPatterns = this.patterns.map((pattern) => {
|
|
1653
|
+
if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
|
|
1654
|
+
return pattern.slice(5, -1);
|
|
1655
|
+
}
|
|
1656
|
+
return pattern;
|
|
1657
|
+
}).filter((pattern) => pattern.length > 0);
|
|
1658
|
+
const fileContent = rulesyncPatterns.join("\n");
|
|
1659
|
+
return new RulesyncIgnore({
|
|
1660
|
+
baseDir: this.baseDir,
|
|
1661
|
+
relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
|
|
1662
|
+
relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
|
|
1663
|
+
fileContent
|
|
1664
|
+
});
|
|
1653
1665
|
}
|
|
1654
|
-
|
|
1655
|
-
* Create AugmentcodeIgnore from RulesyncIgnore
|
|
1656
|
-
* Supports conversion from unified rulesync format to AugmentCode specific format
|
|
1657
|
-
*/
|
|
1658
|
-
static fromRulesyncIgnore({
|
|
1666
|
+
static async fromRulesyncIgnore({
|
|
1659
1667
|
baseDir = ".",
|
|
1660
1668
|
rulesyncIgnore
|
|
1661
1669
|
}) {
|
|
1662
|
-
|
|
1670
|
+
const fileContent = rulesyncIgnore.getFileContent();
|
|
1671
|
+
const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
|
|
1672
|
+
const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
|
|
1673
|
+
const filePath = join13(
|
|
1674
|
+
baseDir,
|
|
1675
|
+
this.getSettablePaths().relativeDirPath,
|
|
1676
|
+
this.getSettablePaths().relativeFilePath
|
|
1677
|
+
);
|
|
1678
|
+
const exists = await fileExists(filePath);
|
|
1679
|
+
const existingFileContent = exists ? await readFileContent(filePath) : "{}";
|
|
1680
|
+
const existingJsonValue = JSON.parse(existingFileContent);
|
|
1681
|
+
const jsonValue = {
|
|
1682
|
+
...existingJsonValue,
|
|
1683
|
+
permissions: {
|
|
1684
|
+
...existingJsonValue.permissions,
|
|
1685
|
+
deny: uniq([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
return new _ClaudecodeIgnore({
|
|
1663
1689
|
baseDir,
|
|
1664
1690
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1665
1691
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
1666
|
-
fileContent:
|
|
1692
|
+
fileContent: JSON.stringify(jsonValue, null, 2),
|
|
1693
|
+
validate: true
|
|
1667
1694
|
});
|
|
1668
1695
|
}
|
|
1669
|
-
/**
|
|
1670
|
-
* Create AugmentcodeIgnore from file path
|
|
1671
|
-
* Reads and parses .augmentignore file
|
|
1672
|
-
*/
|
|
1673
1696
|
static async fromFile({
|
|
1674
1697
|
baseDir = ".",
|
|
1675
1698
|
validate = true
|
|
@@ -1681,7 +1704,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
|
|
|
1681
1704
|
this.getSettablePaths().relativeFilePath
|
|
1682
1705
|
)
|
|
1683
1706
|
);
|
|
1684
|
-
return new
|
|
1707
|
+
return new _ClaudecodeIgnore({
|
|
1685
1708
|
baseDir,
|
|
1686
1709
|
relativeDirPath: this.getSettablePaths().relativeDirPath,
|
|
1687
1710
|
relativeFilePath: this.getSettablePaths().relativeFilePath,
|
|
@@ -1848,7 +1871,7 @@ var GeminiCliIgnore = class _GeminiCliIgnore extends ToolIgnore {
|
|
|
1848
1871
|
static getSettablePaths() {
|
|
1849
1872
|
return {
|
|
1850
1873
|
relativeDirPath: ".",
|
|
1851
|
-
relativeFilePath: ".
|
|
1874
|
+
relativeFilePath: ".geminiignore"
|
|
1852
1875
|
};
|
|
1853
1876
|
}
|
|
1854
1877
|
toRulesyncIgnore() {
|
|
@@ -2190,6 +2213,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
|
|
|
2190
2213
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
2191
2214
|
}
|
|
2192
2215
|
}
|
|
2216
|
+
async loadToolFilesToDelete() {
|
|
2217
|
+
return (await this.loadToolFiles()).filter(
|
|
2218
|
+
(toolFile) => !(toolFile instanceof ClaudecodeIgnore)
|
|
2219
|
+
);
|
|
2220
|
+
}
|
|
2193
2221
|
/**
|
|
2194
2222
|
* Implementation of abstract method from FeatureProcessor
|
|
2195
2223
|
* Convert RulesyncFile[] to ToolFile[]
|
|
@@ -2739,6 +2767,9 @@ var McpProcessor = class extends FeatureProcessor {
|
|
|
2739
2767
|
return [];
|
|
2740
2768
|
}
|
|
2741
2769
|
}
|
|
2770
|
+
async loadToolFilesToDelete() {
|
|
2771
|
+
return this.loadToolFiles();
|
|
2772
|
+
}
|
|
2742
2773
|
/**
|
|
2743
2774
|
* Implementation of abstract method from FeatureProcessor
|
|
2744
2775
|
* Load tool-specific MCP configurations and parse them into ToolMcp instances
|
|
@@ -3493,6 +3524,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
|
|
|
3493
3524
|
throw new Error(`Unsupported tool target: ${this.toolTarget}`);
|
|
3494
3525
|
}
|
|
3495
3526
|
}
|
|
3527
|
+
async loadToolFilesToDelete() {
|
|
3528
|
+
return this.loadToolFiles();
|
|
3529
|
+
}
|
|
3496
3530
|
/**
|
|
3497
3531
|
* Load Claude Code subagent configurations from .claude/agents/ directory
|
|
3498
3532
|
*/
|
|
@@ -5447,6 +5481,9 @@ var RulesProcessor = class extends FeatureProcessor {
|
|
|
5447
5481
|
return [];
|
|
5448
5482
|
}
|
|
5449
5483
|
}
|
|
5484
|
+
async loadToolFilesToDelete() {
|
|
5485
|
+
return this.loadToolFiles();
|
|
5486
|
+
}
|
|
5450
5487
|
async loadToolRulesDefault({
|
|
5451
5488
|
root,
|
|
5452
5489
|
nonRoot
|
|
@@ -5878,7 +5915,7 @@ async function generateCommand(options) {
|
|
|
5878
5915
|
simulateSubagents: config.getExperimentalSimulateSubagents()
|
|
5879
5916
|
});
|
|
5880
5917
|
if (config.getDelete()) {
|
|
5881
|
-
const oldToolFiles = await processor.
|
|
5918
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
5882
5919
|
await processor.removeAiFiles(oldToolFiles);
|
|
5883
5920
|
}
|
|
5884
5921
|
let rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -5915,7 +5952,7 @@ async function generateCommand(options) {
|
|
|
5915
5952
|
toolTarget
|
|
5916
5953
|
});
|
|
5917
5954
|
if (config.getDelete()) {
|
|
5918
|
-
const oldToolFiles = await processor.
|
|
5955
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
5919
5956
|
await processor.removeAiFiles(oldToolFiles);
|
|
5920
5957
|
}
|
|
5921
5958
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -5945,7 +5982,7 @@ async function generateCommand(options) {
|
|
|
5945
5982
|
toolTarget
|
|
5946
5983
|
});
|
|
5947
5984
|
if (config.getDelete()) {
|
|
5948
|
-
const oldToolFiles = await processor.
|
|
5985
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
5949
5986
|
await processor.removeAiFiles(oldToolFiles);
|
|
5950
5987
|
}
|
|
5951
5988
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -5969,11 +6006,8 @@ async function generateCommand(options) {
|
|
|
5969
6006
|
toolTarget
|
|
5970
6007
|
});
|
|
5971
6008
|
if (config.getDelete()) {
|
|
5972
|
-
const oldToolFiles = await processor.
|
|
5973
|
-
|
|
5974
|
-
(toolFile) => !(toolFile.getRelativeDirPath() === ClaudecodeIgnore.getSettablePaths().relativeDirPath && toolFile.getRelativeFilePath() === ClaudecodeIgnore.getSettablePaths().relativeFilePath)
|
|
5975
|
-
);
|
|
5976
|
-
await processor.removeAiFiles(oldToolFilesForDelete);
|
|
6009
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
6010
|
+
await processor.removeAiFiles(oldToolFiles);
|
|
5977
6011
|
}
|
|
5978
6012
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
5979
6013
|
if (rulesyncFiles.length > 0) {
|
|
@@ -6007,7 +6041,7 @@ async function generateCommand(options) {
|
|
|
6007
6041
|
toolTarget
|
|
6008
6042
|
});
|
|
6009
6043
|
if (config.getDelete()) {
|
|
6010
|
-
const oldToolFiles = await processor.
|
|
6044
|
+
const oldToolFiles = await processor.loadToolFilesToDelete();
|
|
6011
6045
|
await processor.removeAiFiles(oldToolFiles);
|
|
6012
6046
|
}
|
|
6013
6047
|
const rulesyncFiles = await processor.loadRulesyncFiles();
|
|
@@ -6301,7 +6335,7 @@ var getVersion = async () => {
|
|
|
6301
6335
|
const packageJson = await readJsonFile(packageJsonPath);
|
|
6302
6336
|
return packageJson.version;
|
|
6303
6337
|
} catch {
|
|
6304
|
-
return "1.
|
|
6338
|
+
return "1.2.0";
|
|
6305
6339
|
}
|
|
6306
6340
|
};
|
|
6307
6341
|
var main = async () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rulesync",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Unified AI rules management CLI tool that generates configuration files for various AI development tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"pre-commit": "pnpm exec lint-staged"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"c12": "3.
|
|
39
|
+
"c12": "3.3.0",
|
|
40
40
|
"chokidar": "4.0.3",
|
|
41
|
-
"commander": "14.0.
|
|
41
|
+
"commander": "14.0.1",
|
|
42
42
|
"consola": "3.4.2",
|
|
43
43
|
"es-toolkit": "1.39.10",
|
|
44
44
|
"fast-xml-parser": "5.2.5",
|
|
@@ -46,37 +46,37 @@
|
|
|
46
46
|
"js-yaml": "4.1.0",
|
|
47
47
|
"micromatch": "4.0.8",
|
|
48
48
|
"smol-toml": "1.4.2",
|
|
49
|
-
"zod": "4.1.
|
|
49
|
+
"zod": "4.1.9"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@anthropic-ai/claude-code": "1.0.
|
|
53
|
-
"@biomejs/biome": "2.2.
|
|
52
|
+
"@anthropic-ai/claude-code": "1.0.118",
|
|
53
|
+
"@biomejs/biome": "2.2.4",
|
|
54
54
|
"@eslint/js": "9.35.0",
|
|
55
55
|
"@secretlint/secretlint-rule-preset-recommend": "11.2.4",
|
|
56
56
|
"@tsconfig/node24": "24.0.1",
|
|
57
57
|
"@types/js-yaml": "4.0.9",
|
|
58
58
|
"@types/micromatch": "4.0.9",
|
|
59
|
-
"@types/node": "24.
|
|
60
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
59
|
+
"@types/node": "24.5.2",
|
|
60
|
+
"@typescript/native-preview": "7.0.0-dev.20250918.1",
|
|
61
61
|
"@vitest/coverage-v8": "3.2.4",
|
|
62
62
|
"cspell": "9.2.1",
|
|
63
63
|
"eslint": "9.35.0",
|
|
64
64
|
"eslint-plugin-import": "2.32.0",
|
|
65
65
|
"eslint-plugin-no-type-assertion": "1.3.0",
|
|
66
|
-
"eslint-plugin-oxlint": "1.
|
|
67
|
-
"eslint-plugin-strict-dependencies": "1.3.
|
|
66
|
+
"eslint-plugin-oxlint": "1.16.0",
|
|
67
|
+
"eslint-plugin-strict-dependencies": "1.3.24",
|
|
68
68
|
"eslint-plugin-zod-import": "0.3.0",
|
|
69
69
|
"knip": "5.63.1",
|
|
70
70
|
"lint-staged": "16.1.6",
|
|
71
71
|
"o3-search-mcp": "0.0.9",
|
|
72
|
-
"oxlint": "1.
|
|
72
|
+
"oxlint": "1.16.0",
|
|
73
73
|
"secretlint": "11.2.4",
|
|
74
74
|
"simple-git-hooks": "2.13.1",
|
|
75
75
|
"sort-package-json": "3.4.0",
|
|
76
76
|
"tsup": "8.5.0",
|
|
77
77
|
"tsx": "4.20.5",
|
|
78
78
|
"typescript": "5.9.2",
|
|
79
|
-
"typescript-eslint": "8.
|
|
79
|
+
"typescript-eslint": "8.44.0",
|
|
80
80
|
"vitest": "3.2.4"
|
|
81
81
|
},
|
|
82
82
|
"engines": {
|