know-thy-build 0.3.0 → 0.3.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/bin/cli.js +19 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
writeFileSync,
|
|
8
8
|
readdirSync,
|
|
9
9
|
statSync,
|
|
10
|
+
unlinkSync,
|
|
10
11
|
} from "fs";
|
|
11
12
|
import { dirname, join } from "path";
|
|
12
13
|
import { fileURLToPath } from "url";
|
|
@@ -87,14 +88,32 @@ function installDir(srcDir, destDir, lang) {
|
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
const LEGACY_FILES = ["know-thy-build.md", "know-thy-build-evolve.md"];
|
|
92
|
+
|
|
93
|
+
function cleanLegacy(commandsDir) {
|
|
94
|
+
let cleaned = [];
|
|
95
|
+
for (const file of LEGACY_FILES) {
|
|
96
|
+
const filePath = join(commandsDir, file);
|
|
97
|
+
if (existsSync(filePath)) {
|
|
98
|
+
unlinkSync(filePath);
|
|
99
|
+
cleaned.push(file);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return cleaned;
|
|
103
|
+
}
|
|
104
|
+
|
|
90
105
|
function install(lang, global) {
|
|
91
106
|
const commandsDir = global
|
|
92
107
|
? join(homedir(), ".claude", "commands")
|
|
93
108
|
: join(process.cwd(), ".claude", "commands");
|
|
94
109
|
|
|
110
|
+
const cleaned = cleanLegacy(commandsDir);
|
|
95
111
|
installDir(templatesDir, commandsDir, lang);
|
|
96
112
|
|
|
97
113
|
const scope = global ? "globally (~/.claude/commands/)" : "in this project";
|
|
114
|
+
if (cleaned.length > 0) {
|
|
115
|
+
console.log(`\n Cleaned up legacy commands: ${cleaned.join(", ")}`);
|
|
116
|
+
}
|
|
98
117
|
console.log(`
|
|
99
118
|
Done! Installed ${scope} (${lang})
|
|
100
119
|
|