@dealdeploy/skl 1.1.0 → 1.1.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/index.ts +14 -36
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
import { createCliRenderer } from "@opentui/core";
|
|
4
|
-
import { existsSync, rmSync,
|
|
4
|
+
import { existsSync, rmSync, mkdirSync, readdirSync, statSync } from "fs";
|
|
5
5
|
import { join } from "path";
|
|
6
6
|
import { homedir } from "os";
|
|
7
|
-
import { getCatalogSkills, removeFromLock, catalogDir, buildAddArgs
|
|
7
|
+
import { getCatalogSkills, removeFromLock, catalogDir, buildAddArgs } from "./lib.ts";
|
|
8
8
|
import { createTui, type ColId } from "./tui.ts";
|
|
9
9
|
|
|
10
10
|
// @ts-ignore - bun supports JSON imports
|
|
@@ -44,47 +44,25 @@ if (arg === "update") {
|
|
|
44
44
|
|
|
45
45
|
try {
|
|
46
46
|
|
|
47
|
-
// ── Migration: ~/dotfiles/skills → ~/.skl/catalog ───────────────────
|
|
48
|
-
const OLD_LIBRARY = join(homedir(), "dotfiles/skills");
|
|
49
47
|
const CATALOG = catalogDir();
|
|
50
|
-
|
|
51
|
-
if (!existsSync(CATALOG) && existsSync(OLD_LIBRARY)) {
|
|
52
|
-
console.log("Migrating skills from ~/dotfiles/skills to ~/.skl/catalog...");
|
|
53
|
-
mkdirSync(CATALOG, { recursive: true });
|
|
54
|
-
for (const name of readdirSync(OLD_LIBRARY)) {
|
|
55
|
-
const src = join(OLD_LIBRARY, name);
|
|
56
|
-
const dest = join(CATALOG, name);
|
|
57
|
-
try {
|
|
58
|
-
cpSync(src, dest, { recursive: true });
|
|
59
|
-
console.log(` ${name}`);
|
|
60
|
-
} catch {}
|
|
61
|
-
}
|
|
62
|
-
console.log("Done. You can remove ~/dotfiles/skills when ready.\n");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
48
|
mkdirSync(CATALOG, { recursive: true });
|
|
66
49
|
|
|
67
|
-
// ──
|
|
50
|
+
// ── Read installed skills directly from filesystem ──────────────────
|
|
68
51
|
|
|
69
|
-
|
|
70
|
-
const args = ["npx", "-y", "skills", "list", "--json"];
|
|
71
|
-
if (global) args.push("-g");
|
|
52
|
+
function readInstalledSkills(dir: string): Set<string> {
|
|
72
53
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} catch {
|
|
79
|
-
|
|
54
|
+
return new Set(
|
|
55
|
+
readdirSync(dir).filter((name) => {
|
|
56
|
+
try { return statSync(join(dir, name)).isDirectory(); } catch { return false; }
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
} catch {
|
|
60
|
+
return new Set();
|
|
61
|
+
}
|
|
80
62
|
}
|
|
81
63
|
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
listInstalled(true),
|
|
85
|
-
listInstalled(false),
|
|
86
|
-
]);
|
|
87
|
-
console.log(" done");
|
|
64
|
+
const globalInstalled = readInstalledSkills(join(homedir(), ".claude/skills"));
|
|
65
|
+
const localInstalled = readInstalledSkills(join(process.cwd(), ".claude/skills"));
|
|
88
66
|
|
|
89
67
|
// ── Create TUI ──────────────────────────────────────────────────────
|
|
90
68
|
|