@dealdeploy/skl 1.5.0 → 1.7.0

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 (4) hide show
  1. package/index.ts +13 -4
  2. package/lib.ts +16 -0
  3. package/package.json +1 -1
  4. package/tui.ts +5 -0
package/index.ts CHANGED
@@ -4,7 +4,7 @@ import { createCliRenderer } from "@opentui/core";
4
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, readLock, detectProjectAgents } from "./lib.ts";
7
+ import { getCatalogSkills, removeFromLock, removeFromProjectLock, catalogDir, buildAddArgs, readLock, detectProjectAgents } from "./lib.ts";
8
8
  import { createTui, type ColId } from "./tui.ts";
9
9
  import { checkForUpdate } from "./update-check.ts";
10
10
 
@@ -91,7 +91,12 @@ const projectAgents = [...new Set(["universal", ...detectProjectAgents(process.c
91
91
 
92
92
  // ── Create TUI ──────────────────────────────────────────────────────
93
93
 
94
- const renderer = await createCliRenderer({ exitOnCtrlC: true });
94
+ let tui: ReturnType<typeof createTui> | null = null;
95
+
96
+ const renderer = await createCliRenderer({
97
+ exitOnCtrlC: true,
98
+ onDestroy: () => tui?.destroy(),
99
+ });
95
100
 
96
101
  const allSkills = getCatalogSkills();
97
102
  const lock = readLock();
@@ -100,7 +105,7 @@ for (const name of allSkills) {
100
105
  skillRepos.set(name, lock.skills[name]?.source || null);
101
106
  }
102
107
 
103
- const tui = createTui(renderer, {
108
+ tui = createTui(renderer, {
104
109
  allSkills,
105
110
  skillRepos,
106
111
  globalInstalled,
@@ -122,7 +127,10 @@ const tui = createTui(renderer, {
122
127
  new Response(proc.stdout).text(),
123
128
  new Response(proc.stderr).text(),
124
129
  ]);
125
- if (code === 0) return true;
130
+ if (code === 0) {
131
+ if (!enable && !isGlobal) removeFromProjectLock(name, process.cwd());
132
+ return true;
133
+ }
126
134
  if (debug) {
127
135
  return (stderr || stdout).trim() || `exit code ${code}`;
128
136
  }
@@ -148,6 +156,7 @@ const tui = createTui(renderer, {
148
156
  for (const p of procs) await p.exited;
149
157
  rmSync(join(CATALOG, name), { recursive: true, force: true });
150
158
  removeFromLock(name);
159
+ removeFromProjectLock(name, process.cwd());
151
160
  },
152
161
 
153
162
  async onEdit(name: string) {
package/lib.ts CHANGED
@@ -52,6 +52,22 @@ export function removeFromLock(name: string): void {
52
52
  writeLock(lock);
53
53
  }
54
54
 
55
+ export function removeFromProjectLock(name: string, cwd: string): void {
56
+ const lockFile = join(cwd, "skills-lock.json");
57
+ try {
58
+ const data = JSON.parse(readFileSync(lockFile, "utf-8"));
59
+ if (data?.skills?.[name]) {
60
+ delete data.skills[name];
61
+ const sorted: Record<string, unknown> = {};
62
+ for (const key of Object.keys(data.skills).sort()) {
63
+ sorted[key] = data.skills[key];
64
+ }
65
+ data.skills = sorted;
66
+ writeFileSync(lockFile, JSON.stringify(data, null, 2) + "\n");
67
+ }
68
+ } catch {}
69
+ }
70
+
55
71
  export function getLockEntry(name: string): LockEntry | null {
56
72
  const lock = readLock();
57
73
  return lock.skills[name] ?? null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dealdeploy/skl",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "TUI skill manager for Claude Code agents",
5
5
  "module": "index.ts",
6
6
  "bin": {
package/tui.ts CHANGED
@@ -723,9 +723,14 @@ export function createTui(renderer: CliRenderer, deps: TuiDeps) {
723
723
  ensureVisible();
724
724
  });
725
725
 
726
+ function destroy() {
727
+ if (statusTimeout) clearTimeout(statusTimeout);
728
+ }
729
+
726
730
  return {
727
731
  refreshAll,
728
732
  relayout,
733
+ destroy,
729
734
  get state() {
730
735
  return {
731
736
  cursor,