rulesync 1.2.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.
Files changed (3) hide show
  1. package/dist/index.cjs +108 -94
  2. package/dist/index.js +108 -94
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1244,6 +1244,9 @@ var CommandsProcessor = class extends FeatureProcessor {
1244
1244
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
1245
1245
  }
1246
1246
  }
1247
+ async loadToolFilesToDelete() {
1248
+ return this.loadToolFiles();
1249
+ }
1247
1250
  async loadToolCommandDefault({
1248
1251
  toolTarget,
1249
1252
  relativeDirPath,
@@ -1470,9 +1473,15 @@ var ConfigResolver = class {
1470
1473
  }
1471
1474
  };
1472
1475
 
1473
- // src/ignore/claudecode-ignore.ts
1476
+ // src/ignore/ignore-processor.ts
1477
+ var import_mini9 = require("zod/mini");
1478
+
1479
+ // src/ignore/amazonqcli-ignore.ts
1474
1480
  var import_node_path12 = require("path");
1475
- var import_es_toolkit = require("es-toolkit");
1481
+
1482
+ // src/types/tool-file.ts
1483
+ var ToolFile = class extends AiFile {
1484
+ };
1476
1485
 
1477
1486
  // src/ignore/rulesync-ignore.ts
1478
1487
  var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
@@ -1496,10 +1505,6 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
1496
1505
  }
1497
1506
  };
1498
1507
 
1499
- // src/types/tool-file.ts
1500
- var ToolFile = class extends AiFile {
1501
- };
1502
-
1503
1508
  // src/ignore/tool-ignore.ts
1504
1509
  var ToolIgnore = class extends ToolFile {
1505
1510
  patterns;
@@ -1541,64 +1546,40 @@ var ToolIgnore = class extends ToolFile {
1541
1546
  }
1542
1547
  };
1543
1548
 
1544
- // src/ignore/claudecode-ignore.ts
1545
- var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1546
- constructor(params) {
1547
- super(params);
1548
- const jsonValue = JSON.parse(this.fileContent);
1549
- this.patterns = jsonValue.permissions?.deny ?? [];
1550
- }
1549
+ // src/ignore/amazonqcli-ignore.ts
1550
+ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1551
1551
  static getSettablePaths() {
1552
1552
  return {
1553
- relativeDirPath: ".claude",
1554
- relativeFilePath: "settings.local.json"
1553
+ relativeDirPath: ".",
1554
+ relativeFilePath: ".amazonqignore"
1555
1555
  };
1556
1556
  }
1557
+ /**
1558
+ * Convert to RulesyncIgnore format
1559
+ */
1557
1560
  toRulesyncIgnore() {
1558
- const rulesyncPatterns = this.patterns.map((pattern) => {
1559
- if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
1560
- return pattern.slice(5, -1);
1561
- }
1562
- return pattern;
1563
- }).filter((pattern) => pattern.length > 0);
1564
- const fileContent = rulesyncPatterns.join("\n");
1565
- return new RulesyncIgnore({
1566
- baseDir: this.baseDir,
1567
- relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
1568
- relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
1569
- fileContent
1570
- });
1561
+ return this.toRulesyncIgnoreDefault();
1571
1562
  }
1572
- static async fromRulesyncIgnore({
1563
+ /**
1564
+ * Create AmazonqcliIgnore from RulesyncIgnore
1565
+ * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1566
+ */
1567
+ static fromRulesyncIgnore({
1573
1568
  baseDir = ".",
1574
1569
  rulesyncIgnore
1575
1570
  }) {
1576
- const fileContent = rulesyncIgnore.getFileContent();
1577
- const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
1578
- const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
1579
- const filePath = (0, import_node_path12.join)(
1580
- baseDir,
1581
- this.getSettablePaths().relativeDirPath,
1582
- this.getSettablePaths().relativeFilePath
1583
- );
1584
- const exists = await fileExists(filePath);
1585
- const existingFileContent = exists ? await readFileContent(filePath) : "{}";
1586
- const existingJsonValue = JSON.parse(existingFileContent);
1587
- const jsonValue = {
1588
- ...existingJsonValue,
1589
- permissions: {
1590
- ...existingJsonValue.permissions,
1591
- deny: (0, import_es_toolkit.uniq)([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
1592
- }
1593
- };
1594
- return new _ClaudecodeIgnore({
1571
+ const body = rulesyncIgnore.getFileContent();
1572
+ return new _AmazonqcliIgnore({
1595
1573
  baseDir,
1596
1574
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1597
1575
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1598
- fileContent: JSON.stringify(jsonValue, null, 2),
1599
- validate: true
1576
+ fileContent: body
1600
1577
  });
1601
1578
  }
1579
+ /**
1580
+ * Create AmazonqcliIgnore from file path
1581
+ * Supports both proposed .q-ignore and .amazonqignore formats
1582
+ */
1602
1583
  static async fromFile({
1603
1584
  baseDir = ".",
1604
1585
  validate = true
@@ -1610,7 +1591,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1610
1591
  this.getSettablePaths().relativeFilePath
1611
1592
  )
1612
1593
  );
1613
- return new _ClaudecodeIgnore({
1594
+ return new _AmazonqcliIgnore({
1614
1595
  baseDir,
1615
1596
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1616
1597
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1620,16 +1601,13 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1620
1601
  }
1621
1602
  };
1622
1603
 
1623
- // src/ignore/ignore-processor.ts
1624
- var import_mini9 = require("zod/mini");
1625
-
1626
- // src/ignore/amazonqcli-ignore.ts
1604
+ // src/ignore/augmentcode-ignore.ts
1627
1605
  var import_node_path13 = require("path");
1628
- var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1606
+ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1629
1607
  static getSettablePaths() {
1630
1608
  return {
1631
1609
  relativeDirPath: ".",
1632
- relativeFilePath: ".amazonqignore"
1610
+ relativeFilePath: ".augmentignore"
1633
1611
  };
1634
1612
  }
1635
1613
  /**
@@ -1639,24 +1617,23 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1639
1617
  return this.toRulesyncIgnoreDefault();
1640
1618
  }
1641
1619
  /**
1642
- * Create AmazonqcliIgnore from RulesyncIgnore
1643
- * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1620
+ * Create AugmentcodeIgnore from RulesyncIgnore
1621
+ * Supports conversion from unified rulesync format to AugmentCode specific format
1644
1622
  */
1645
1623
  static fromRulesyncIgnore({
1646
1624
  baseDir = ".",
1647
1625
  rulesyncIgnore
1648
1626
  }) {
1649
- const body = rulesyncIgnore.getFileContent();
1650
- return new _AmazonqcliIgnore({
1627
+ return new _AugmentcodeIgnore({
1651
1628
  baseDir,
1652
1629
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1653
1630
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1654
- fileContent: body
1631
+ fileContent: rulesyncIgnore.getFileContent()
1655
1632
  });
1656
1633
  }
1657
1634
  /**
1658
- * Create AmazonqcliIgnore from file path
1659
- * Supports both proposed .q-ignore and .amazonqignore formats
1635
+ * Create AugmentcodeIgnore from file path
1636
+ * Reads and parses .augmentignore file
1660
1637
  */
1661
1638
  static async fromFile({
1662
1639
  baseDir = ".",
@@ -1669,7 +1646,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1669
1646
  this.getSettablePaths().relativeFilePath
1670
1647
  )
1671
1648
  );
1672
- return new _AmazonqcliIgnore({
1649
+ return new _AugmentcodeIgnore({
1673
1650
  baseDir,
1674
1651
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1675
1652
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1679,40 +1656,66 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1679
1656
  }
1680
1657
  };
1681
1658
 
1682
- // src/ignore/augmentcode-ignore.ts
1659
+ // src/ignore/claudecode-ignore.ts
1683
1660
  var import_node_path14 = require("path");
1684
- var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
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
+ }
1685
1668
  static getSettablePaths() {
1686
1669
  return {
1687
- relativeDirPath: ".",
1688
- relativeFilePath: ".augmentignore"
1670
+ relativeDirPath: ".claude",
1671
+ relativeFilePath: "settings.local.json"
1689
1672
  };
1690
1673
  }
1691
- /**
1692
- * Convert to RulesyncIgnore format
1693
- */
1694
1674
  toRulesyncIgnore() {
1695
- return this.toRulesyncIgnoreDefault();
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
+ });
1696
1688
  }
1697
- /**
1698
- * Create AugmentcodeIgnore from RulesyncIgnore
1699
- * Supports conversion from unified rulesync format to AugmentCode specific format
1700
- */
1701
- static fromRulesyncIgnore({
1689
+ static async fromRulesyncIgnore({
1702
1690
  baseDir = ".",
1703
1691
  rulesyncIgnore
1704
1692
  }) {
1705
- return new _AugmentcodeIgnore({
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({
1706
1712
  baseDir,
1707
1713
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1708
1714
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1709
- fileContent: rulesyncIgnore.getFileContent()
1715
+ fileContent: JSON.stringify(jsonValue, null, 2),
1716
+ validate: true
1710
1717
  });
1711
1718
  }
1712
- /**
1713
- * Create AugmentcodeIgnore from file path
1714
- * Reads and parses .augmentignore file
1715
- */
1716
1719
  static async fromFile({
1717
1720
  baseDir = ".",
1718
1721
  validate = true
@@ -1724,7 +1727,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1724
1727
  this.getSettablePaths().relativeFilePath
1725
1728
  )
1726
1729
  );
1727
- return new _AugmentcodeIgnore({
1730
+ return new _ClaudecodeIgnore({
1728
1731
  baseDir,
1729
1732
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1730
1733
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -2233,6 +2236,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
2233
2236
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
2234
2237
  }
2235
2238
  }
2239
+ async loadToolFilesToDelete() {
2240
+ return (await this.loadToolFiles()).filter(
2241
+ (toolFile) => !(toolFile instanceof ClaudecodeIgnore)
2242
+ );
2243
+ }
2236
2244
  /**
2237
2245
  * Implementation of abstract method from FeatureProcessor
2238
2246
  * Convert RulesyncFile[] to ToolFile[]
@@ -2782,6 +2790,9 @@ var McpProcessor = class extends FeatureProcessor {
2782
2790
  return [];
2783
2791
  }
2784
2792
  }
2793
+ async loadToolFilesToDelete() {
2794
+ return this.loadToolFiles();
2795
+ }
2785
2796
  /**
2786
2797
  * Implementation of abstract method from FeatureProcessor
2787
2798
  * Load tool-specific MCP configurations and parse them into ToolMcp instances
@@ -3536,6 +3547,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
3536
3547
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3537
3548
  }
3538
3549
  }
3550
+ async loadToolFilesToDelete() {
3551
+ return this.loadToolFiles();
3552
+ }
3539
3553
  /**
3540
3554
  * Load Claude Code subagent configurations from .claude/agents/ directory
3541
3555
  */
@@ -5490,6 +5504,9 @@ var RulesProcessor = class extends FeatureProcessor {
5490
5504
  return [];
5491
5505
  }
5492
5506
  }
5507
+ async loadToolFilesToDelete() {
5508
+ return this.loadToolFiles();
5509
+ }
5493
5510
  async loadToolRulesDefault({
5494
5511
  root,
5495
5512
  nonRoot
@@ -5921,7 +5938,7 @@ async function generateCommand(options) {
5921
5938
  simulateSubagents: config.getExperimentalSimulateSubagents()
5922
5939
  });
5923
5940
  if (config.getDelete()) {
5924
- const oldToolFiles = await processor.loadToolFiles();
5941
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5925
5942
  await processor.removeAiFiles(oldToolFiles);
5926
5943
  }
5927
5944
  let rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5958,7 +5975,7 @@ async function generateCommand(options) {
5958
5975
  toolTarget
5959
5976
  });
5960
5977
  if (config.getDelete()) {
5961
- const oldToolFiles = await processor.loadToolFiles();
5978
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5962
5979
  await processor.removeAiFiles(oldToolFiles);
5963
5980
  }
5964
5981
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5988,7 +6005,7 @@ async function generateCommand(options) {
5988
6005
  toolTarget
5989
6006
  });
5990
6007
  if (config.getDelete()) {
5991
- const oldToolFiles = await processor.loadToolFiles();
6008
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5992
6009
  await processor.removeAiFiles(oldToolFiles);
5993
6010
  }
5994
6011
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -6012,11 +6029,8 @@ async function generateCommand(options) {
6012
6029
  toolTarget
6013
6030
  });
6014
6031
  if (config.getDelete()) {
6015
- const oldToolFiles = await processor.loadToolFiles();
6016
- const oldToolFilesForDelete = oldToolFiles.filter(
6017
- (toolFile) => !(toolFile.getRelativeDirPath() === ClaudecodeIgnore.getSettablePaths().relativeDirPath && toolFile.getRelativeFilePath() === ClaudecodeIgnore.getSettablePaths().relativeFilePath)
6018
- );
6019
- await processor.removeAiFiles(oldToolFilesForDelete);
6032
+ const oldToolFiles = await processor.loadToolFilesToDelete();
6033
+ await processor.removeAiFiles(oldToolFiles);
6020
6034
  }
6021
6035
  const rulesyncFiles = await processor.loadRulesyncFiles();
6022
6036
  if (rulesyncFiles.length > 0) {
@@ -6050,7 +6064,7 @@ async function generateCommand(options) {
6050
6064
  toolTarget
6051
6065
  });
6052
6066
  if (config.getDelete()) {
6053
- const oldToolFiles = await processor.loadToolFiles();
6067
+ const oldToolFiles = await processor.loadToolFilesToDelete();
6054
6068
  await processor.removeAiFiles(oldToolFiles);
6055
6069
  }
6056
6070
  const rulesyncFiles = await processor.loadRulesyncFiles();
package/dist/index.js CHANGED
@@ -1221,6 +1221,9 @@ var CommandsProcessor = class extends FeatureProcessor {
1221
1221
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
1222
1222
  }
1223
1223
  }
1224
+ async loadToolFilesToDelete() {
1225
+ return this.loadToolFiles();
1226
+ }
1224
1227
  async loadToolCommandDefault({
1225
1228
  toolTarget,
1226
1229
  relativeDirPath,
@@ -1447,9 +1450,15 @@ var ConfigResolver = class {
1447
1450
  }
1448
1451
  };
1449
1452
 
1450
- // src/ignore/claudecode-ignore.ts
1453
+ // src/ignore/ignore-processor.ts
1454
+ import { z as z9 } from "zod/mini";
1455
+
1456
+ // src/ignore/amazonqcli-ignore.ts
1451
1457
  import { join as join11 } from "path";
1452
- import { uniq } from "es-toolkit";
1458
+
1459
+ // src/types/tool-file.ts
1460
+ var ToolFile = class extends AiFile {
1461
+ };
1453
1462
 
1454
1463
  // src/ignore/rulesync-ignore.ts
1455
1464
  var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
@@ -1473,10 +1482,6 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
1473
1482
  }
1474
1483
  };
1475
1484
 
1476
- // src/types/tool-file.ts
1477
- var ToolFile = class extends AiFile {
1478
- };
1479
-
1480
1485
  // src/ignore/tool-ignore.ts
1481
1486
  var ToolIgnore = class extends ToolFile {
1482
1487
  patterns;
@@ -1518,64 +1523,40 @@ var ToolIgnore = class extends ToolFile {
1518
1523
  }
1519
1524
  };
1520
1525
 
1521
- // src/ignore/claudecode-ignore.ts
1522
- var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1523
- constructor(params) {
1524
- super(params);
1525
- const jsonValue = JSON.parse(this.fileContent);
1526
- this.patterns = jsonValue.permissions?.deny ?? [];
1527
- }
1526
+ // src/ignore/amazonqcli-ignore.ts
1527
+ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1528
1528
  static getSettablePaths() {
1529
1529
  return {
1530
- relativeDirPath: ".claude",
1531
- relativeFilePath: "settings.local.json"
1530
+ relativeDirPath: ".",
1531
+ relativeFilePath: ".amazonqignore"
1532
1532
  };
1533
1533
  }
1534
+ /**
1535
+ * Convert to RulesyncIgnore format
1536
+ */
1534
1537
  toRulesyncIgnore() {
1535
- const rulesyncPatterns = this.patterns.map((pattern) => {
1536
- if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
1537
- return pattern.slice(5, -1);
1538
- }
1539
- return pattern;
1540
- }).filter((pattern) => pattern.length > 0);
1541
- const fileContent = rulesyncPatterns.join("\n");
1542
- return new RulesyncIgnore({
1543
- baseDir: this.baseDir,
1544
- relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
1545
- relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
1546
- fileContent
1547
- });
1538
+ return this.toRulesyncIgnoreDefault();
1548
1539
  }
1549
- static async fromRulesyncIgnore({
1540
+ /**
1541
+ * Create AmazonqcliIgnore from RulesyncIgnore
1542
+ * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1543
+ */
1544
+ static fromRulesyncIgnore({
1550
1545
  baseDir = ".",
1551
1546
  rulesyncIgnore
1552
1547
  }) {
1553
- const fileContent = rulesyncIgnore.getFileContent();
1554
- const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
1555
- const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
1556
- const filePath = join11(
1557
- baseDir,
1558
- this.getSettablePaths().relativeDirPath,
1559
- this.getSettablePaths().relativeFilePath
1560
- );
1561
- const exists = await fileExists(filePath);
1562
- const existingFileContent = exists ? await readFileContent(filePath) : "{}";
1563
- const existingJsonValue = JSON.parse(existingFileContent);
1564
- const jsonValue = {
1565
- ...existingJsonValue,
1566
- permissions: {
1567
- ...existingJsonValue.permissions,
1568
- deny: uniq([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
1569
- }
1570
- };
1571
- return new _ClaudecodeIgnore({
1548
+ const body = rulesyncIgnore.getFileContent();
1549
+ return new _AmazonqcliIgnore({
1572
1550
  baseDir,
1573
1551
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1574
1552
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1575
- fileContent: JSON.stringify(jsonValue, null, 2),
1576
- validate: true
1553
+ fileContent: body
1577
1554
  });
1578
1555
  }
1556
+ /**
1557
+ * Create AmazonqcliIgnore from file path
1558
+ * Supports both proposed .q-ignore and .amazonqignore formats
1559
+ */
1579
1560
  static async fromFile({
1580
1561
  baseDir = ".",
1581
1562
  validate = true
@@ -1587,7 +1568,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1587
1568
  this.getSettablePaths().relativeFilePath
1588
1569
  )
1589
1570
  );
1590
- return new _ClaudecodeIgnore({
1571
+ return new _AmazonqcliIgnore({
1591
1572
  baseDir,
1592
1573
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1593
1574
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1597,16 +1578,13 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1597
1578
  }
1598
1579
  };
1599
1580
 
1600
- // src/ignore/ignore-processor.ts
1601
- import { z as z9 } from "zod/mini";
1602
-
1603
- // src/ignore/amazonqcli-ignore.ts
1581
+ // src/ignore/augmentcode-ignore.ts
1604
1582
  import { join as join12 } from "path";
1605
- var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1583
+ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1606
1584
  static getSettablePaths() {
1607
1585
  return {
1608
1586
  relativeDirPath: ".",
1609
- relativeFilePath: ".amazonqignore"
1587
+ relativeFilePath: ".augmentignore"
1610
1588
  };
1611
1589
  }
1612
1590
  /**
@@ -1616,24 +1594,23 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1616
1594
  return this.toRulesyncIgnoreDefault();
1617
1595
  }
1618
1596
  /**
1619
- * Create AmazonqcliIgnore from RulesyncIgnore
1620
- * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1597
+ * Create AugmentcodeIgnore from RulesyncIgnore
1598
+ * Supports conversion from unified rulesync format to AugmentCode specific format
1621
1599
  */
1622
1600
  static fromRulesyncIgnore({
1623
1601
  baseDir = ".",
1624
1602
  rulesyncIgnore
1625
1603
  }) {
1626
- const body = rulesyncIgnore.getFileContent();
1627
- return new _AmazonqcliIgnore({
1604
+ return new _AugmentcodeIgnore({
1628
1605
  baseDir,
1629
1606
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1630
1607
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1631
- fileContent: body
1608
+ fileContent: rulesyncIgnore.getFileContent()
1632
1609
  });
1633
1610
  }
1634
1611
  /**
1635
- * Create AmazonqcliIgnore from file path
1636
- * Supports both proposed .q-ignore and .amazonqignore formats
1612
+ * Create AugmentcodeIgnore from file path
1613
+ * Reads and parses .augmentignore file
1637
1614
  */
1638
1615
  static async fromFile({
1639
1616
  baseDir = ".",
@@ -1646,7 +1623,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1646
1623
  this.getSettablePaths().relativeFilePath
1647
1624
  )
1648
1625
  );
1649
- return new _AmazonqcliIgnore({
1626
+ return new _AugmentcodeIgnore({
1650
1627
  baseDir,
1651
1628
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1652
1629
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1656,40 +1633,66 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1656
1633
  }
1657
1634
  };
1658
1635
 
1659
- // src/ignore/augmentcode-ignore.ts
1636
+ // src/ignore/claudecode-ignore.ts
1660
1637
  import { join as join13 } from "path";
1661
- var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
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
+ }
1662
1645
  static getSettablePaths() {
1663
1646
  return {
1664
- relativeDirPath: ".",
1665
- relativeFilePath: ".augmentignore"
1647
+ relativeDirPath: ".claude",
1648
+ relativeFilePath: "settings.local.json"
1666
1649
  };
1667
1650
  }
1668
- /**
1669
- * Convert to RulesyncIgnore format
1670
- */
1671
1651
  toRulesyncIgnore() {
1672
- return this.toRulesyncIgnoreDefault();
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
+ });
1673
1665
  }
1674
- /**
1675
- * Create AugmentcodeIgnore from RulesyncIgnore
1676
- * Supports conversion from unified rulesync format to AugmentCode specific format
1677
- */
1678
- static fromRulesyncIgnore({
1666
+ static async fromRulesyncIgnore({
1679
1667
  baseDir = ".",
1680
1668
  rulesyncIgnore
1681
1669
  }) {
1682
- return new _AugmentcodeIgnore({
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({
1683
1689
  baseDir,
1684
1690
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1685
1691
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1686
- fileContent: rulesyncIgnore.getFileContent()
1692
+ fileContent: JSON.stringify(jsonValue, null, 2),
1693
+ validate: true
1687
1694
  });
1688
1695
  }
1689
- /**
1690
- * Create AugmentcodeIgnore from file path
1691
- * Reads and parses .augmentignore file
1692
- */
1693
1696
  static async fromFile({
1694
1697
  baseDir = ".",
1695
1698
  validate = true
@@ -1701,7 +1704,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1701
1704
  this.getSettablePaths().relativeFilePath
1702
1705
  )
1703
1706
  );
1704
- return new _AugmentcodeIgnore({
1707
+ return new _ClaudecodeIgnore({
1705
1708
  baseDir,
1706
1709
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1707
1710
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -2210,6 +2213,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
2210
2213
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
2211
2214
  }
2212
2215
  }
2216
+ async loadToolFilesToDelete() {
2217
+ return (await this.loadToolFiles()).filter(
2218
+ (toolFile) => !(toolFile instanceof ClaudecodeIgnore)
2219
+ );
2220
+ }
2213
2221
  /**
2214
2222
  * Implementation of abstract method from FeatureProcessor
2215
2223
  * Convert RulesyncFile[] to ToolFile[]
@@ -2759,6 +2767,9 @@ var McpProcessor = class extends FeatureProcessor {
2759
2767
  return [];
2760
2768
  }
2761
2769
  }
2770
+ async loadToolFilesToDelete() {
2771
+ return this.loadToolFiles();
2772
+ }
2762
2773
  /**
2763
2774
  * Implementation of abstract method from FeatureProcessor
2764
2775
  * Load tool-specific MCP configurations and parse them into ToolMcp instances
@@ -3513,6 +3524,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
3513
3524
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3514
3525
  }
3515
3526
  }
3527
+ async loadToolFilesToDelete() {
3528
+ return this.loadToolFiles();
3529
+ }
3516
3530
  /**
3517
3531
  * Load Claude Code subagent configurations from .claude/agents/ directory
3518
3532
  */
@@ -5467,6 +5481,9 @@ var RulesProcessor = class extends FeatureProcessor {
5467
5481
  return [];
5468
5482
  }
5469
5483
  }
5484
+ async loadToolFilesToDelete() {
5485
+ return this.loadToolFiles();
5486
+ }
5470
5487
  async loadToolRulesDefault({
5471
5488
  root,
5472
5489
  nonRoot
@@ -5898,7 +5915,7 @@ async function generateCommand(options) {
5898
5915
  simulateSubagents: config.getExperimentalSimulateSubagents()
5899
5916
  });
5900
5917
  if (config.getDelete()) {
5901
- const oldToolFiles = await processor.loadToolFiles();
5918
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5902
5919
  await processor.removeAiFiles(oldToolFiles);
5903
5920
  }
5904
5921
  let rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5935,7 +5952,7 @@ async function generateCommand(options) {
5935
5952
  toolTarget
5936
5953
  });
5937
5954
  if (config.getDelete()) {
5938
- const oldToolFiles = await processor.loadToolFiles();
5955
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5939
5956
  await processor.removeAiFiles(oldToolFiles);
5940
5957
  }
5941
5958
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5965,7 +5982,7 @@ async function generateCommand(options) {
5965
5982
  toolTarget
5966
5983
  });
5967
5984
  if (config.getDelete()) {
5968
- const oldToolFiles = await processor.loadToolFiles();
5985
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5969
5986
  await processor.removeAiFiles(oldToolFiles);
5970
5987
  }
5971
5988
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5989,11 +6006,8 @@ async function generateCommand(options) {
5989
6006
  toolTarget
5990
6007
  });
5991
6008
  if (config.getDelete()) {
5992
- const oldToolFiles = await processor.loadToolFiles();
5993
- const oldToolFilesForDelete = oldToolFiles.filter(
5994
- (toolFile) => !(toolFile.getRelativeDirPath() === ClaudecodeIgnore.getSettablePaths().relativeDirPath && toolFile.getRelativeFilePath() === ClaudecodeIgnore.getSettablePaths().relativeFilePath)
5995
- );
5996
- await processor.removeAiFiles(oldToolFilesForDelete);
6009
+ const oldToolFiles = await processor.loadToolFilesToDelete();
6010
+ await processor.removeAiFiles(oldToolFiles);
5997
6011
  }
5998
6012
  const rulesyncFiles = await processor.loadRulesyncFiles();
5999
6013
  if (rulesyncFiles.length > 0) {
@@ -6027,7 +6041,7 @@ async function generateCommand(options) {
6027
6041
  toolTarget
6028
6042
  });
6029
6043
  if (config.getDelete()) {
6030
- const oldToolFiles = await processor.loadToolFiles();
6044
+ const oldToolFiles = await processor.loadToolFilesToDelete();
6031
6045
  await processor.removeAiFiles(oldToolFiles);
6032
6046
  }
6033
6047
  const rulesyncFiles = await processor.loadRulesyncFiles();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulesync",
3
- "version": "1.2.0",
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",