rulesync 1.2.0 → 1.2.2

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 +113 -131
  2. package/dist/index.js +113 -130
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -24,8 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  ));
25
25
 
26
26
  // src/cli/index.ts
27
- var import_node_path58 = require("path");
28
- var import_node_url = require("url");
29
27
  var import_commander = require("commander");
30
28
 
31
29
  // src/constants/announcements.ts
@@ -39,11 +37,6 @@ var FeatureSchema = import_mini.z.enum(ALL_FEATURES);
39
37
  var FeaturesSchema = import_mini.z.array(FeatureSchema);
40
38
  var RulesyncFeaturesSchema = import_mini.z.array(import_mini.z.enum(ALL_FEATURES_WITH_WILDCARD));
41
39
 
42
- // src/utils/file.ts
43
- var import_node_fs = require("fs");
44
- var import_promises = require("fs/promises");
45
- var import_node_path = require("path");
46
-
47
40
  // src/utils/logger.ts
48
41
  var import_consola = require("consola");
49
42
  var isEnvTest = process.env.NODE_ENV === "test";
@@ -88,6 +81,9 @@ var Logger = class {
88
81
  var logger = new Logger();
89
82
 
90
83
  // src/utils/file.ts
84
+ var import_node_fs = require("fs");
85
+ var import_promises = require("fs/promises");
86
+ var import_node_path = require("path");
91
87
  async function ensureDir(dirPath) {
92
88
  try {
93
89
  await (0, import_promises.stat)(dirPath);
@@ -95,18 +91,6 @@ async function ensureDir(dirPath) {
95
91
  await (0, import_promises.mkdir)(dirPath, { recursive: true });
96
92
  }
97
93
  }
98
- async function readJsonFile(filepath, defaultValue) {
99
- try {
100
- const content = await readFileContent(filepath);
101
- const parsed = JSON.parse(content);
102
- return parsed;
103
- } catch (error) {
104
- if (defaultValue !== void 0) {
105
- return defaultValue;
106
- }
107
- throw error;
108
- }
109
- }
110
94
  async function directoryExists(dirPath) {
111
95
  try {
112
96
  const stats = await (0, import_promises.stat)(dirPath);
@@ -1244,6 +1228,9 @@ var CommandsProcessor = class extends FeatureProcessor {
1244
1228
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
1245
1229
  }
1246
1230
  }
1231
+ async loadToolFilesToDelete() {
1232
+ return this.loadToolFiles();
1233
+ }
1247
1234
  async loadToolCommandDefault({
1248
1235
  toolTarget,
1249
1236
  relativeDirPath,
@@ -1470,9 +1457,15 @@ var ConfigResolver = class {
1470
1457
  }
1471
1458
  };
1472
1459
 
1473
- // src/ignore/claudecode-ignore.ts
1460
+ // src/ignore/ignore-processor.ts
1461
+ var import_mini9 = require("zod/mini");
1462
+
1463
+ // src/ignore/amazonqcli-ignore.ts
1474
1464
  var import_node_path12 = require("path");
1475
- var import_es_toolkit = require("es-toolkit");
1465
+
1466
+ // src/types/tool-file.ts
1467
+ var ToolFile = class extends AiFile {
1468
+ };
1476
1469
 
1477
1470
  // src/ignore/rulesync-ignore.ts
1478
1471
  var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
@@ -1496,10 +1489,6 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
1496
1489
  }
1497
1490
  };
1498
1491
 
1499
- // src/types/tool-file.ts
1500
- var ToolFile = class extends AiFile {
1501
- };
1502
-
1503
1492
  // src/ignore/tool-ignore.ts
1504
1493
  var ToolIgnore = class extends ToolFile {
1505
1494
  patterns;
@@ -1541,64 +1530,40 @@ var ToolIgnore = class extends ToolFile {
1541
1530
  }
1542
1531
  };
1543
1532
 
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
- }
1533
+ // src/ignore/amazonqcli-ignore.ts
1534
+ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1551
1535
  static getSettablePaths() {
1552
1536
  return {
1553
- relativeDirPath: ".claude",
1554
- relativeFilePath: "settings.local.json"
1537
+ relativeDirPath: ".",
1538
+ relativeFilePath: ".amazonqignore"
1555
1539
  };
1556
1540
  }
1541
+ /**
1542
+ * Convert to RulesyncIgnore format
1543
+ */
1557
1544
  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
- });
1545
+ return this.toRulesyncIgnoreDefault();
1571
1546
  }
1572
- static async fromRulesyncIgnore({
1547
+ /**
1548
+ * Create AmazonqcliIgnore from RulesyncIgnore
1549
+ * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1550
+ */
1551
+ static fromRulesyncIgnore({
1573
1552
  baseDir = ".",
1574
1553
  rulesyncIgnore
1575
1554
  }) {
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({
1555
+ const body = rulesyncIgnore.getFileContent();
1556
+ return new _AmazonqcliIgnore({
1595
1557
  baseDir,
1596
1558
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1597
1559
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1598
- fileContent: JSON.stringify(jsonValue, null, 2),
1599
- validate: true
1560
+ fileContent: body
1600
1561
  });
1601
1562
  }
1563
+ /**
1564
+ * Create AmazonqcliIgnore from file path
1565
+ * Supports both proposed .q-ignore and .amazonqignore formats
1566
+ */
1602
1567
  static async fromFile({
1603
1568
  baseDir = ".",
1604
1569
  validate = true
@@ -1610,7 +1575,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1610
1575
  this.getSettablePaths().relativeFilePath
1611
1576
  )
1612
1577
  );
1613
- return new _ClaudecodeIgnore({
1578
+ return new _AmazonqcliIgnore({
1614
1579
  baseDir,
1615
1580
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1616
1581
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1620,16 +1585,13 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1620
1585
  }
1621
1586
  };
1622
1587
 
1623
- // src/ignore/ignore-processor.ts
1624
- var import_mini9 = require("zod/mini");
1625
-
1626
- // src/ignore/amazonqcli-ignore.ts
1588
+ // src/ignore/augmentcode-ignore.ts
1627
1589
  var import_node_path13 = require("path");
1628
- var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1590
+ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1629
1591
  static getSettablePaths() {
1630
1592
  return {
1631
1593
  relativeDirPath: ".",
1632
- relativeFilePath: ".amazonqignore"
1594
+ relativeFilePath: ".augmentignore"
1633
1595
  };
1634
1596
  }
1635
1597
  /**
@@ -1639,24 +1601,23 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1639
1601
  return this.toRulesyncIgnoreDefault();
1640
1602
  }
1641
1603
  /**
1642
- * Create AmazonqcliIgnore from RulesyncIgnore
1643
- * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1604
+ * Create AugmentcodeIgnore from RulesyncIgnore
1605
+ * Supports conversion from unified rulesync format to AugmentCode specific format
1644
1606
  */
1645
1607
  static fromRulesyncIgnore({
1646
1608
  baseDir = ".",
1647
1609
  rulesyncIgnore
1648
1610
  }) {
1649
- const body = rulesyncIgnore.getFileContent();
1650
- return new _AmazonqcliIgnore({
1611
+ return new _AugmentcodeIgnore({
1651
1612
  baseDir,
1652
1613
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1653
1614
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1654
- fileContent: body
1615
+ fileContent: rulesyncIgnore.getFileContent()
1655
1616
  });
1656
1617
  }
1657
1618
  /**
1658
- * Create AmazonqcliIgnore from file path
1659
- * Supports both proposed .q-ignore and .amazonqignore formats
1619
+ * Create AugmentcodeIgnore from file path
1620
+ * Reads and parses .augmentignore file
1660
1621
  */
1661
1622
  static async fromFile({
1662
1623
  baseDir = ".",
@@ -1669,7 +1630,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1669
1630
  this.getSettablePaths().relativeFilePath
1670
1631
  )
1671
1632
  );
1672
- return new _AmazonqcliIgnore({
1633
+ return new _AugmentcodeIgnore({
1673
1634
  baseDir,
1674
1635
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1675
1636
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1679,40 +1640,66 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1679
1640
  }
1680
1641
  };
1681
1642
 
1682
- // src/ignore/augmentcode-ignore.ts
1643
+ // src/ignore/claudecode-ignore.ts
1683
1644
  var import_node_path14 = require("path");
1684
- var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1645
+ var import_es_toolkit = require("es-toolkit");
1646
+ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1647
+ constructor(params) {
1648
+ super(params);
1649
+ const jsonValue = JSON.parse(this.fileContent);
1650
+ this.patterns = jsonValue.permissions?.deny ?? [];
1651
+ }
1685
1652
  static getSettablePaths() {
1686
1653
  return {
1687
- relativeDirPath: ".",
1688
- relativeFilePath: ".augmentignore"
1654
+ relativeDirPath: ".claude",
1655
+ relativeFilePath: "settings.local.json"
1689
1656
  };
1690
1657
  }
1691
- /**
1692
- * Convert to RulesyncIgnore format
1693
- */
1694
1658
  toRulesyncIgnore() {
1695
- return this.toRulesyncIgnoreDefault();
1659
+ const rulesyncPatterns = this.patterns.map((pattern) => {
1660
+ if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
1661
+ return pattern.slice(5, -1);
1662
+ }
1663
+ return pattern;
1664
+ }).filter((pattern) => pattern.length > 0);
1665
+ const fileContent = rulesyncPatterns.join("\n");
1666
+ return new RulesyncIgnore({
1667
+ baseDir: this.baseDir,
1668
+ relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
1669
+ relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
1670
+ fileContent
1671
+ });
1696
1672
  }
1697
- /**
1698
- * Create AugmentcodeIgnore from RulesyncIgnore
1699
- * Supports conversion from unified rulesync format to AugmentCode specific format
1700
- */
1701
- static fromRulesyncIgnore({
1673
+ static async fromRulesyncIgnore({
1702
1674
  baseDir = ".",
1703
1675
  rulesyncIgnore
1704
1676
  }) {
1705
- return new _AugmentcodeIgnore({
1677
+ const fileContent = rulesyncIgnore.getFileContent();
1678
+ const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
1679
+ const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
1680
+ const filePath = (0, import_node_path14.join)(
1681
+ baseDir,
1682
+ this.getSettablePaths().relativeDirPath,
1683
+ this.getSettablePaths().relativeFilePath
1684
+ );
1685
+ const exists = await fileExists(filePath);
1686
+ const existingFileContent = exists ? await readFileContent(filePath) : "{}";
1687
+ const existingJsonValue = JSON.parse(existingFileContent);
1688
+ const jsonValue = {
1689
+ ...existingJsonValue,
1690
+ permissions: {
1691
+ ...existingJsonValue.permissions,
1692
+ deny: (0, import_es_toolkit.uniq)([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
1693
+ }
1694
+ };
1695
+ return new _ClaudecodeIgnore({
1706
1696
  baseDir,
1707
1697
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1708
1698
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1709
- fileContent: rulesyncIgnore.getFileContent()
1699
+ fileContent: JSON.stringify(jsonValue, null, 2),
1700
+ validate: true
1710
1701
  });
1711
1702
  }
1712
- /**
1713
- * Create AugmentcodeIgnore from file path
1714
- * Reads and parses .augmentignore file
1715
- */
1716
1703
  static async fromFile({
1717
1704
  baseDir = ".",
1718
1705
  validate = true
@@ -1724,7 +1711,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1724
1711
  this.getSettablePaths().relativeFilePath
1725
1712
  )
1726
1713
  );
1727
- return new _AugmentcodeIgnore({
1714
+ return new _ClaudecodeIgnore({
1728
1715
  baseDir,
1729
1716
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1730
1717
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -2233,6 +2220,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
2233
2220
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
2234
2221
  }
2235
2222
  }
2223
+ async loadToolFilesToDelete() {
2224
+ return (await this.loadToolFiles()).filter(
2225
+ (toolFile) => !(toolFile instanceof ClaudecodeIgnore)
2226
+ );
2227
+ }
2236
2228
  /**
2237
2229
  * Implementation of abstract method from FeatureProcessor
2238
2230
  * Convert RulesyncFile[] to ToolFile[]
@@ -2782,6 +2774,9 @@ var McpProcessor = class extends FeatureProcessor {
2782
2774
  return [];
2783
2775
  }
2784
2776
  }
2777
+ async loadToolFilesToDelete() {
2778
+ return this.loadToolFiles();
2779
+ }
2785
2780
  /**
2786
2781
  * Implementation of abstract method from FeatureProcessor
2787
2782
  * Load tool-specific MCP configurations and parse them into ToolMcp instances
@@ -3536,6 +3531,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
3536
3531
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3537
3532
  }
3538
3533
  }
3534
+ async loadToolFilesToDelete() {
3535
+ return this.loadToolFiles();
3536
+ }
3539
3537
  /**
3540
3538
  * Load Claude Code subagent configurations from .claude/agents/ directory
3541
3539
  */
@@ -5490,6 +5488,9 @@ var RulesProcessor = class extends FeatureProcessor {
5490
5488
  return [];
5491
5489
  }
5492
5490
  }
5491
+ async loadToolFilesToDelete() {
5492
+ return this.loadToolFiles();
5493
+ }
5493
5494
  async loadToolRulesDefault({
5494
5495
  root,
5495
5496
  nonRoot
@@ -5921,7 +5922,7 @@ async function generateCommand(options) {
5921
5922
  simulateSubagents: config.getExperimentalSimulateSubagents()
5922
5923
  });
5923
5924
  if (config.getDelete()) {
5924
- const oldToolFiles = await processor.loadToolFiles();
5925
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5925
5926
  await processor.removeAiFiles(oldToolFiles);
5926
5927
  }
5927
5928
  let rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5958,7 +5959,7 @@ async function generateCommand(options) {
5958
5959
  toolTarget
5959
5960
  });
5960
5961
  if (config.getDelete()) {
5961
- const oldToolFiles = await processor.loadToolFiles();
5962
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5962
5963
  await processor.removeAiFiles(oldToolFiles);
5963
5964
  }
5964
5965
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5988,7 +5989,7 @@ async function generateCommand(options) {
5988
5989
  toolTarget
5989
5990
  });
5990
5991
  if (config.getDelete()) {
5991
- const oldToolFiles = await processor.loadToolFiles();
5992
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5992
5993
  await processor.removeAiFiles(oldToolFiles);
5993
5994
  }
5994
5995
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -6012,11 +6013,8 @@ async function generateCommand(options) {
6012
6013
  toolTarget
6013
6014
  });
6014
6015
  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);
6016
+ const oldToolFiles = await processor.loadToolFilesToDelete();
6017
+ await processor.removeAiFiles(oldToolFiles);
6020
6018
  }
6021
6019
  const rulesyncFiles = await processor.loadRulesyncFiles();
6022
6020
  if (rulesyncFiles.length > 0) {
@@ -6050,7 +6048,7 @@ async function generateCommand(options) {
6050
6048
  toolTarget
6051
6049
  });
6052
6050
  if (config.getDelete()) {
6053
- const oldToolFiles = await processor.loadToolFiles();
6051
+ const oldToolFiles = await processor.loadToolFilesToDelete();
6054
6052
  await processor.removeAiFiles(oldToolFiles);
6055
6053
  }
6056
6054
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -6331,26 +6329,10 @@ globs: ["**/*"]
6331
6329
  }
6332
6330
 
6333
6331
  // src/cli/index.ts
6334
- var import_meta = {};
6335
- var getVersion = async () => {
6336
- try {
6337
- let packageJsonPath;
6338
- if (typeof import_meta !== "undefined" && import_meta.url) {
6339
- const __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
6340
- const __dirname = (0, import_node_path58.join)(__filename, "..");
6341
- packageJsonPath = (0, import_node_path58.join)(__dirname, "../../package.json");
6342
- } else {
6343
- packageJsonPath = (0, import_node_path58.join)(process.cwd(), "package.json");
6344
- }
6345
- const packageJson = await readJsonFile(packageJsonPath);
6346
- return packageJson.version;
6347
- } catch {
6348
- return "1.2.0";
6349
- }
6350
- };
6332
+ var getVersion = () => "1.2.2";
6351
6333
  var main = async () => {
6352
6334
  const program = new import_commander.Command();
6353
- const version = await getVersion();
6335
+ const version = getVersion();
6354
6336
  program.hook("postAction", () => {
6355
6337
  if (ANNOUNCEMENT.length > 0) {
6356
6338
  logger.info(ANNOUNCEMENT);
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli/index.ts
4
- import { join as join57 } from "path";
5
- import { fileURLToPath } from "url";
6
4
  import { Command } from "commander";
7
5
 
8
6
  // src/constants/announcements.ts
@@ -16,11 +14,6 @@ var FeatureSchema = z.enum(ALL_FEATURES);
16
14
  var FeaturesSchema = z.array(FeatureSchema);
17
15
  var RulesyncFeaturesSchema = z.array(z.enum(ALL_FEATURES_WITH_WILDCARD));
18
16
 
19
- // src/utils/file.ts
20
- import { globSync } from "fs";
21
- import { mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "fs/promises";
22
- import { basename, dirname, join, relative, resolve } from "path";
23
-
24
17
  // src/utils/logger.ts
25
18
  import { consola } from "consola";
26
19
  var isEnvTest = process.env.NODE_ENV === "test";
@@ -65,6 +58,9 @@ var Logger = class {
65
58
  var logger = new Logger();
66
59
 
67
60
  // src/utils/file.ts
61
+ import { globSync } from "fs";
62
+ import { mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "fs/promises";
63
+ import { basename, dirname, join, relative, resolve } from "path";
68
64
  async function ensureDir(dirPath) {
69
65
  try {
70
66
  await stat(dirPath);
@@ -72,18 +68,6 @@ async function ensureDir(dirPath) {
72
68
  await mkdir(dirPath, { recursive: true });
73
69
  }
74
70
  }
75
- async function readJsonFile(filepath, defaultValue) {
76
- try {
77
- const content = await readFileContent(filepath);
78
- const parsed = JSON.parse(content);
79
- return parsed;
80
- } catch (error) {
81
- if (defaultValue !== void 0) {
82
- return defaultValue;
83
- }
84
- throw error;
85
- }
86
- }
87
71
  async function directoryExists(dirPath) {
88
72
  try {
89
73
  const stats = await stat(dirPath);
@@ -1221,6 +1205,9 @@ var CommandsProcessor = class extends FeatureProcessor {
1221
1205
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
1222
1206
  }
1223
1207
  }
1208
+ async loadToolFilesToDelete() {
1209
+ return this.loadToolFiles();
1210
+ }
1224
1211
  async loadToolCommandDefault({
1225
1212
  toolTarget,
1226
1213
  relativeDirPath,
@@ -1447,9 +1434,15 @@ var ConfigResolver = class {
1447
1434
  }
1448
1435
  };
1449
1436
 
1450
- // src/ignore/claudecode-ignore.ts
1437
+ // src/ignore/ignore-processor.ts
1438
+ import { z as z9 } from "zod/mini";
1439
+
1440
+ // src/ignore/amazonqcli-ignore.ts
1451
1441
  import { join as join11 } from "path";
1452
- import { uniq } from "es-toolkit";
1442
+
1443
+ // src/types/tool-file.ts
1444
+ var ToolFile = class extends AiFile {
1445
+ };
1453
1446
 
1454
1447
  // src/ignore/rulesync-ignore.ts
1455
1448
  var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
@@ -1473,10 +1466,6 @@ var RulesyncIgnore = class _RulesyncIgnore extends RulesyncFile {
1473
1466
  }
1474
1467
  };
1475
1468
 
1476
- // src/types/tool-file.ts
1477
- var ToolFile = class extends AiFile {
1478
- };
1479
-
1480
1469
  // src/ignore/tool-ignore.ts
1481
1470
  var ToolIgnore = class extends ToolFile {
1482
1471
  patterns;
@@ -1518,64 +1507,40 @@ var ToolIgnore = class extends ToolFile {
1518
1507
  }
1519
1508
  };
1520
1509
 
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
- }
1510
+ // src/ignore/amazonqcli-ignore.ts
1511
+ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1528
1512
  static getSettablePaths() {
1529
1513
  return {
1530
- relativeDirPath: ".claude",
1531
- relativeFilePath: "settings.local.json"
1514
+ relativeDirPath: ".",
1515
+ relativeFilePath: ".amazonqignore"
1532
1516
  };
1533
1517
  }
1518
+ /**
1519
+ * Convert to RulesyncIgnore format
1520
+ */
1534
1521
  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
- });
1522
+ return this.toRulesyncIgnoreDefault();
1548
1523
  }
1549
- static async fromRulesyncIgnore({
1524
+ /**
1525
+ * Create AmazonqcliIgnore from RulesyncIgnore
1526
+ * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1527
+ */
1528
+ static fromRulesyncIgnore({
1550
1529
  baseDir = ".",
1551
1530
  rulesyncIgnore
1552
1531
  }) {
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({
1532
+ const body = rulesyncIgnore.getFileContent();
1533
+ return new _AmazonqcliIgnore({
1572
1534
  baseDir,
1573
1535
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1574
1536
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1575
- fileContent: JSON.stringify(jsonValue, null, 2),
1576
- validate: true
1537
+ fileContent: body
1577
1538
  });
1578
1539
  }
1540
+ /**
1541
+ * Create AmazonqcliIgnore from file path
1542
+ * Supports both proposed .q-ignore and .amazonqignore formats
1543
+ */
1579
1544
  static async fromFile({
1580
1545
  baseDir = ".",
1581
1546
  validate = true
@@ -1587,7 +1552,7 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1587
1552
  this.getSettablePaths().relativeFilePath
1588
1553
  )
1589
1554
  );
1590
- return new _ClaudecodeIgnore({
1555
+ return new _AmazonqcliIgnore({
1591
1556
  baseDir,
1592
1557
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1593
1558
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1597,16 +1562,13 @@ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1597
1562
  }
1598
1563
  };
1599
1564
 
1600
- // src/ignore/ignore-processor.ts
1601
- import { z as z9 } from "zod/mini";
1602
-
1603
- // src/ignore/amazonqcli-ignore.ts
1565
+ // src/ignore/augmentcode-ignore.ts
1604
1566
  import { join as join12 } from "path";
1605
- var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1567
+ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1606
1568
  static getSettablePaths() {
1607
1569
  return {
1608
1570
  relativeDirPath: ".",
1609
- relativeFilePath: ".amazonqignore"
1571
+ relativeFilePath: ".augmentignore"
1610
1572
  };
1611
1573
  }
1612
1574
  /**
@@ -1616,24 +1578,23 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1616
1578
  return this.toRulesyncIgnoreDefault();
1617
1579
  }
1618
1580
  /**
1619
- * Create AmazonqcliIgnore from RulesyncIgnore
1620
- * Supports conversion from unified rulesync format to Amazon Q CLI specific format
1581
+ * Create AugmentcodeIgnore from RulesyncIgnore
1582
+ * Supports conversion from unified rulesync format to AugmentCode specific format
1621
1583
  */
1622
1584
  static fromRulesyncIgnore({
1623
1585
  baseDir = ".",
1624
1586
  rulesyncIgnore
1625
1587
  }) {
1626
- const body = rulesyncIgnore.getFileContent();
1627
- return new _AmazonqcliIgnore({
1588
+ return new _AugmentcodeIgnore({
1628
1589
  baseDir,
1629
1590
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1630
1591
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1631
- fileContent: body
1592
+ fileContent: rulesyncIgnore.getFileContent()
1632
1593
  });
1633
1594
  }
1634
1595
  /**
1635
- * Create AmazonqcliIgnore from file path
1636
- * Supports both proposed .q-ignore and .amazonqignore formats
1596
+ * Create AugmentcodeIgnore from file path
1597
+ * Reads and parses .augmentignore file
1637
1598
  */
1638
1599
  static async fromFile({
1639
1600
  baseDir = ".",
@@ -1646,7 +1607,7 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1646
1607
  this.getSettablePaths().relativeFilePath
1647
1608
  )
1648
1609
  );
1649
- return new _AmazonqcliIgnore({
1610
+ return new _AugmentcodeIgnore({
1650
1611
  baseDir,
1651
1612
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1652
1613
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -1656,40 +1617,66 @@ var AmazonqcliIgnore = class _AmazonqcliIgnore extends ToolIgnore {
1656
1617
  }
1657
1618
  };
1658
1619
 
1659
- // src/ignore/augmentcode-ignore.ts
1620
+ // src/ignore/claudecode-ignore.ts
1660
1621
  import { join as join13 } from "path";
1661
- var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1622
+ import { uniq } from "es-toolkit";
1623
+ var ClaudecodeIgnore = class _ClaudecodeIgnore extends ToolIgnore {
1624
+ constructor(params) {
1625
+ super(params);
1626
+ const jsonValue = JSON.parse(this.fileContent);
1627
+ this.patterns = jsonValue.permissions?.deny ?? [];
1628
+ }
1662
1629
  static getSettablePaths() {
1663
1630
  return {
1664
- relativeDirPath: ".",
1665
- relativeFilePath: ".augmentignore"
1631
+ relativeDirPath: ".claude",
1632
+ relativeFilePath: "settings.local.json"
1666
1633
  };
1667
1634
  }
1668
- /**
1669
- * Convert to RulesyncIgnore format
1670
- */
1671
1635
  toRulesyncIgnore() {
1672
- return this.toRulesyncIgnoreDefault();
1636
+ const rulesyncPatterns = this.patterns.map((pattern) => {
1637
+ if (pattern.startsWith("Read(") && pattern.endsWith(")")) {
1638
+ return pattern.slice(5, -1);
1639
+ }
1640
+ return pattern;
1641
+ }).filter((pattern) => pattern.length > 0);
1642
+ const fileContent = rulesyncPatterns.join("\n");
1643
+ return new RulesyncIgnore({
1644
+ baseDir: this.baseDir,
1645
+ relativeDirPath: RulesyncIgnore.getSettablePaths().relativeDirPath,
1646
+ relativeFilePath: RulesyncIgnore.getSettablePaths().relativeFilePath,
1647
+ fileContent
1648
+ });
1673
1649
  }
1674
- /**
1675
- * Create AugmentcodeIgnore from RulesyncIgnore
1676
- * Supports conversion from unified rulesync format to AugmentCode specific format
1677
- */
1678
- static fromRulesyncIgnore({
1650
+ static async fromRulesyncIgnore({
1679
1651
  baseDir = ".",
1680
1652
  rulesyncIgnore
1681
1653
  }) {
1682
- return new _AugmentcodeIgnore({
1654
+ const fileContent = rulesyncIgnore.getFileContent();
1655
+ const patterns = fileContent.split(/\r?\n|\r/).map((line) => line.trim()).filter((line) => line.length > 0 && !line.startsWith("#"));
1656
+ const deniedValues = patterns.map((pattern) => `Read(${pattern})`);
1657
+ const filePath = join13(
1658
+ baseDir,
1659
+ this.getSettablePaths().relativeDirPath,
1660
+ this.getSettablePaths().relativeFilePath
1661
+ );
1662
+ const exists = await fileExists(filePath);
1663
+ const existingFileContent = exists ? await readFileContent(filePath) : "{}";
1664
+ const existingJsonValue = JSON.parse(existingFileContent);
1665
+ const jsonValue = {
1666
+ ...existingJsonValue,
1667
+ permissions: {
1668
+ ...existingJsonValue.permissions,
1669
+ deny: uniq([...existingJsonValue.permissions?.deny ?? [], ...deniedValues].sort())
1670
+ }
1671
+ };
1672
+ return new _ClaudecodeIgnore({
1683
1673
  baseDir,
1684
1674
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1685
1675
  relativeFilePath: this.getSettablePaths().relativeFilePath,
1686
- fileContent: rulesyncIgnore.getFileContent()
1676
+ fileContent: JSON.stringify(jsonValue, null, 2),
1677
+ validate: true
1687
1678
  });
1688
1679
  }
1689
- /**
1690
- * Create AugmentcodeIgnore from file path
1691
- * Reads and parses .augmentignore file
1692
- */
1693
1680
  static async fromFile({
1694
1681
  baseDir = ".",
1695
1682
  validate = true
@@ -1701,7 +1688,7 @@ var AugmentcodeIgnore = class _AugmentcodeIgnore extends ToolIgnore {
1701
1688
  this.getSettablePaths().relativeFilePath
1702
1689
  )
1703
1690
  );
1704
- return new _AugmentcodeIgnore({
1691
+ return new _ClaudecodeIgnore({
1705
1692
  baseDir,
1706
1693
  relativeDirPath: this.getSettablePaths().relativeDirPath,
1707
1694
  relativeFilePath: this.getSettablePaths().relativeFilePath,
@@ -2210,6 +2197,11 @@ var IgnoreProcessor = class extends FeatureProcessor {
2210
2197
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
2211
2198
  }
2212
2199
  }
2200
+ async loadToolFilesToDelete() {
2201
+ return (await this.loadToolFiles()).filter(
2202
+ (toolFile) => !(toolFile instanceof ClaudecodeIgnore)
2203
+ );
2204
+ }
2213
2205
  /**
2214
2206
  * Implementation of abstract method from FeatureProcessor
2215
2207
  * Convert RulesyncFile[] to ToolFile[]
@@ -2759,6 +2751,9 @@ var McpProcessor = class extends FeatureProcessor {
2759
2751
  return [];
2760
2752
  }
2761
2753
  }
2754
+ async loadToolFilesToDelete() {
2755
+ return this.loadToolFiles();
2756
+ }
2762
2757
  /**
2763
2758
  * Implementation of abstract method from FeatureProcessor
2764
2759
  * Load tool-specific MCP configurations and parse them into ToolMcp instances
@@ -3513,6 +3508,9 @@ var SubagentsProcessor = class extends FeatureProcessor {
3513
3508
  throw new Error(`Unsupported tool target: ${this.toolTarget}`);
3514
3509
  }
3515
3510
  }
3511
+ async loadToolFilesToDelete() {
3512
+ return this.loadToolFiles();
3513
+ }
3516
3514
  /**
3517
3515
  * Load Claude Code subagent configurations from .claude/agents/ directory
3518
3516
  */
@@ -5467,6 +5465,9 @@ var RulesProcessor = class extends FeatureProcessor {
5467
5465
  return [];
5468
5466
  }
5469
5467
  }
5468
+ async loadToolFilesToDelete() {
5469
+ return this.loadToolFiles();
5470
+ }
5470
5471
  async loadToolRulesDefault({
5471
5472
  root,
5472
5473
  nonRoot
@@ -5898,7 +5899,7 @@ async function generateCommand(options) {
5898
5899
  simulateSubagents: config.getExperimentalSimulateSubagents()
5899
5900
  });
5900
5901
  if (config.getDelete()) {
5901
- const oldToolFiles = await processor.loadToolFiles();
5902
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5902
5903
  await processor.removeAiFiles(oldToolFiles);
5903
5904
  }
5904
5905
  let rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5935,7 +5936,7 @@ async function generateCommand(options) {
5935
5936
  toolTarget
5936
5937
  });
5937
5938
  if (config.getDelete()) {
5938
- const oldToolFiles = await processor.loadToolFiles();
5939
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5939
5940
  await processor.removeAiFiles(oldToolFiles);
5940
5941
  }
5941
5942
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5965,7 +5966,7 @@ async function generateCommand(options) {
5965
5966
  toolTarget
5966
5967
  });
5967
5968
  if (config.getDelete()) {
5968
- const oldToolFiles = await processor.loadToolFiles();
5969
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5969
5970
  await processor.removeAiFiles(oldToolFiles);
5970
5971
  }
5971
5972
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -5989,11 +5990,8 @@ async function generateCommand(options) {
5989
5990
  toolTarget
5990
5991
  });
5991
5992
  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);
5993
+ const oldToolFiles = await processor.loadToolFilesToDelete();
5994
+ await processor.removeAiFiles(oldToolFiles);
5997
5995
  }
5998
5996
  const rulesyncFiles = await processor.loadRulesyncFiles();
5999
5997
  if (rulesyncFiles.length > 0) {
@@ -6027,7 +6025,7 @@ async function generateCommand(options) {
6027
6025
  toolTarget
6028
6026
  });
6029
6027
  if (config.getDelete()) {
6030
- const oldToolFiles = await processor.loadToolFiles();
6028
+ const oldToolFiles = await processor.loadToolFilesToDelete();
6031
6029
  await processor.removeAiFiles(oldToolFiles);
6032
6030
  }
6033
6031
  const rulesyncFiles = await processor.loadRulesyncFiles();
@@ -6308,25 +6306,10 @@ globs: ["**/*"]
6308
6306
  }
6309
6307
 
6310
6308
  // src/cli/index.ts
6311
- var getVersion = async () => {
6312
- try {
6313
- let packageJsonPath;
6314
- if (typeof import.meta !== "undefined" && import.meta.url) {
6315
- const __filename = fileURLToPath(import.meta.url);
6316
- const __dirname = join57(__filename, "..");
6317
- packageJsonPath = join57(__dirname, "../../package.json");
6318
- } else {
6319
- packageJsonPath = join57(process.cwd(), "package.json");
6320
- }
6321
- const packageJson = await readJsonFile(packageJsonPath);
6322
- return packageJson.version;
6323
- } catch {
6324
- return "1.2.0";
6325
- }
6326
- };
6309
+ var getVersion = () => "1.2.2";
6327
6310
  var main = async () => {
6328
6311
  const program = new Command();
6329
- const version = await getVersion();
6312
+ const version = getVersion();
6330
6313
  program.hook("postAction", () => {
6331
6314
  if (ANNOUNCEMENT.length > 0) {
6332
6315
  logger.info(ANNOUNCEMENT);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rulesync",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Unified AI rules management CLI tool that generates configuration files for various AI development tools",
5
5
  "keywords": [
6
6
  "ai",