@dealdeploy/skl 1.5.0 → 1.6.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.
- package/index.ts +6 -2
- package/lib.ts +16 -0
- package/package.json +1 -1
- package/tui.ts +1 -1
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
|
|
|
@@ -122,7 +122,10 @@ const tui = createTui(renderer, {
|
|
|
122
122
|
new Response(proc.stdout).text(),
|
|
123
123
|
new Response(proc.stderr).text(),
|
|
124
124
|
]);
|
|
125
|
-
if (code === 0)
|
|
125
|
+
if (code === 0) {
|
|
126
|
+
if (!enable && !isGlobal) removeFromProjectLock(name, process.cwd());
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
126
129
|
if (debug) {
|
|
127
130
|
return (stderr || stdout).trim() || `exit code ${code}`;
|
|
128
131
|
}
|
|
@@ -148,6 +151,7 @@ const tui = createTui(renderer, {
|
|
|
148
151
|
for (const p of procs) await p.exited;
|
|
149
152
|
rmSync(join(CATALOG, name), { recursive: true, force: true });
|
|
150
153
|
removeFromLock(name);
|
|
154
|
+
removeFromProjectLock(name, process.cwd());
|
|
151
155
|
},
|
|
152
156
|
|
|
153
157
|
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
package/tui.ts
CHANGED
|
@@ -436,7 +436,7 @@ export function createTui(renderer: CliRenderer, deps: TuiDeps) {
|
|
|
436
436
|
statusLine.fg = color;
|
|
437
437
|
if (statusTimeout) clearTimeout(statusTimeout);
|
|
438
438
|
statusTimeout = setTimeout(() => {
|
|
439
|
-
statusLine.content = "";
|
|
439
|
+
try { statusLine.content = ""; } catch {}
|
|
440
440
|
}, 3000);
|
|
441
441
|
}
|
|
442
442
|
|