@infinitedusky/indusk-mcp 0.4.0 → 0.4.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/dist/bin/commands/update.js +11 -7
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { cpSync, existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { cpSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { globSync } from "glob";
|
|
@@ -14,21 +14,25 @@ export async function update(projectRoot) {
|
|
|
14
14
|
const skillsTarget = join(projectRoot, ".claude/skills");
|
|
15
15
|
const skillFiles = globSync("*.md", { cwd: skillsSource });
|
|
16
16
|
let updated = 0;
|
|
17
|
-
let
|
|
17
|
+
let added = 0;
|
|
18
|
+
let current = 0;
|
|
18
19
|
for (const file of skillFiles) {
|
|
19
20
|
const skillName = file.replace(".md", "");
|
|
20
21
|
const sourceFile = join(skillsSource, file);
|
|
21
|
-
const
|
|
22
|
+
const targetDir = join(skillsTarget, skillName);
|
|
23
|
+
const targetFile = join(targetDir, "SKILL.md");
|
|
22
24
|
if (!existsSync(targetFile)) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
mkdirSync(targetDir, { recursive: true });
|
|
26
|
+
cpSync(sourceFile, targetFile);
|
|
27
|
+
console.info(` added: ${skillName} (new skill)`);
|
|
28
|
+
added++;
|
|
25
29
|
continue;
|
|
26
30
|
}
|
|
27
31
|
const sourceHash = fileHash(sourceFile);
|
|
28
32
|
const targetHash = fileHash(targetFile);
|
|
29
33
|
if (sourceHash === targetHash) {
|
|
30
34
|
console.info(` current: ${skillName}`);
|
|
31
|
-
|
|
35
|
+
current++;
|
|
32
36
|
}
|
|
33
37
|
else {
|
|
34
38
|
cpSync(sourceFile, targetFile);
|
|
@@ -36,5 +40,5 @@ export async function update(projectRoot) {
|
|
|
36
40
|
updated++;
|
|
37
41
|
}
|
|
38
42
|
}
|
|
39
|
-
console.info(`\n${updated} updated, ${
|
|
43
|
+
console.info(`\n${added} added, ${updated} updated, ${current} current.`);
|
|
40
44
|
}
|