aicm 0.17.2 → 0.17.3

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.
@@ -77,10 +77,19 @@ function cleanMcpServers(cwd, verbose) {
77
77
  }
78
78
  if (!hasChanges)
79
79
  return false;
80
- content.mcpServers = newMcpServers;
81
- fs_extra_1.default.writeJsonSync(mcpPath, content, { spaces: 2 });
82
- if (verbose)
83
- console.log(chalk_1.default.gray(` Cleaned aicm MCP servers from ${mcpPath}`));
80
+ // If no servers remain and no other properties, remove the file
81
+ if (Object.keys(newMcpServers).length === 0 &&
82
+ Object.keys(content).length === 1) {
83
+ fs_extra_1.default.removeSync(mcpPath);
84
+ if (verbose)
85
+ console.log(chalk_1.default.gray(` Removed empty ${mcpPath}`));
86
+ }
87
+ else {
88
+ content.mcpServers = newMcpServers;
89
+ fs_extra_1.default.writeJsonSync(mcpPath, content, { spaces: 2 });
90
+ if (verbose)
91
+ console.log(chalk_1.default.gray(` Cleaned aicm MCP servers from ${mcpPath}`));
92
+ }
84
93
  return true;
85
94
  }
86
95
  catch (_a) {
@@ -88,6 +97,31 @@ function cleanMcpServers(cwd, verbose) {
88
97
  return false;
89
98
  }
90
99
  }
100
+ function cleanEmptyDirectories(cwd, verbose) {
101
+ let cleanedCount = 0;
102
+ const dirsToCheck = [
103
+ node_path_1.default.join(cwd, ".cursor", "rules"),
104
+ node_path_1.default.join(cwd, ".cursor", "commands"),
105
+ node_path_1.default.join(cwd, ".cursor"),
106
+ ];
107
+ for (const dir of dirsToCheck) {
108
+ if (fs_extra_1.default.existsSync(dir)) {
109
+ try {
110
+ const contents = fs_extra_1.default.readdirSync(dir);
111
+ if (contents.length === 0) {
112
+ fs_extra_1.default.removeSync(dir);
113
+ if (verbose)
114
+ console.log(chalk_1.default.gray(` Removed empty directory ${dir}`));
115
+ cleanedCount++;
116
+ }
117
+ }
118
+ catch (_a) {
119
+ // Ignore errors when checking/removing empty directories
120
+ }
121
+ }
122
+ }
123
+ return cleanedCount;
124
+ }
91
125
  async function cleanPackage(options = {}) {
92
126
  const cwd = options.cwd || process.cwd();
93
127
  const verbose = options.verbose || false;
@@ -116,6 +150,8 @@ async function cleanPackage(options = {}) {
116
150
  // Clean MCP servers
117
151
  if (cleanMcpServers(cwd, verbose))
118
152
  cleanedCount++;
153
+ // Clean empty directories
154
+ cleanedCount += cleanEmptyDirectories(cwd, verbose);
119
155
  return {
120
156
  success: true,
121
157
  cleanedCount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicm",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "A TypeScript CLI tool for managing AI IDE rules across different projects and teams",
5
5
  "main": "dist/api.js",
6
6
  "types": "dist/api.d.ts",