@cremini/skillpack 1.1.8-beta.1 → 1.1.9
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/README.md +5 -1
- package/dist/cli.js +177 -256
- package/package.json +2 -2
- package/templates/builtin-skills/skill-creator/LICENSE.txt +202 -0
- package/templates/builtin-skills/skill-creator/SKILL.md +171 -0
- package/templates/builtin-skills/skill-creator/agents/analyzer.md +274 -0
- package/templates/builtin-skills/skill-creator/agents/comparator.md +202 -0
- package/templates/builtin-skills/skill-creator/agents/grader.md +223 -0
- package/templates/builtin-skills/skill-creator/assets/eval_review.html +146 -0
- package/templates/builtin-skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/templates/builtin-skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/templates/builtin-skills/skill-creator/references/schemas.md +430 -0
- package/templates/builtin-skills/skill-creator/scripts/__init__.py +0 -0
- package/templates/builtin-skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/templates/builtin-skills/skill-creator/scripts/generate_report.py +326 -0
- package/templates/builtin-skills/skill-creator/scripts/improve_description.py +247 -0
- package/templates/builtin-skills/skill-creator/scripts/package_skill.py +136 -0
- package/templates/builtin-skills/skill-creator/scripts/quick_validate.py +103 -0
- package/templates/builtin-skills/skill-creator/scripts/run_eval.py +310 -0
- package/templates/builtin-skills/skill-creator/scripts/run_loop.py +328 -0
- package/templates/builtin-skills/skill-creator/scripts/utils.py +47 -0
- package/web/js/api-key-dialog.js +5 -3
- package/web/js/chat-apps-dialog.js +10 -4
- package/web/js/chat.js +8 -8
- package/web/js/settings.js +8 -3
- package/dist/runtime/registry.js +0 -244
package/dist/runtime/registry.js
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/runtime/registry.ts
|
|
4
|
-
import crypto from "crypto";
|
|
5
|
-
import fs from "fs";
|
|
6
|
-
import os from "os";
|
|
7
|
-
import path from "path";
|
|
8
|
-
var SKILLPACK_HOME = path.join(os.homedir(), ".skillpack");
|
|
9
|
-
var LEGACY_REGISTRY_FILE = path.join(SKILLPACK_HOME, "registry.json");
|
|
10
|
-
var REGISTRY_DIR = path.join(SKILLPACK_HOME, "registry.d");
|
|
11
|
-
var migrationChecked = false;
|
|
12
|
-
function getRegistryPath() {
|
|
13
|
-
ensureRegistryReady();
|
|
14
|
-
return REGISTRY_DIR;
|
|
15
|
-
}
|
|
16
|
-
function ensureHomeDir() {
|
|
17
|
-
if (!fs.existsSync(SKILLPACK_HOME)) {
|
|
18
|
-
fs.mkdirSync(SKILLPACK_HOME, { recursive: true });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function ensureRegistryDir() {
|
|
22
|
-
ensureHomeDir();
|
|
23
|
-
if (!fs.existsSync(REGISTRY_DIR)) {
|
|
24
|
-
fs.mkdirSync(REGISTRY_DIR, { recursive: true });
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function canonicalizeDir(dir) {
|
|
28
|
-
const resolved = path.resolve(dir);
|
|
29
|
-
try {
|
|
30
|
-
return fs.realpathSync(resolved);
|
|
31
|
-
} catch {
|
|
32
|
-
return resolved;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function hashDir(dir) {
|
|
36
|
-
return crypto.createHash("md5").update(canonicalizeDir(dir)).digest("hex");
|
|
37
|
-
}
|
|
38
|
-
function getEntryPathForCanonicalDir(dir) {
|
|
39
|
-
return path.join(REGISTRY_DIR, `${hashDir(dir)}.json`);
|
|
40
|
-
}
|
|
41
|
-
function getEntryPath(dir) {
|
|
42
|
-
ensureRegistryReady();
|
|
43
|
-
return getEntryPathForCanonicalDir(canonicalizeDir(dir));
|
|
44
|
-
}
|
|
45
|
-
function listEntryFiles() {
|
|
46
|
-
ensureRegistryReady();
|
|
47
|
-
return fs.readdirSync(REGISTRY_DIR).filter((file) => file.endsWith(".json")).sort().map((file) => path.join(REGISTRY_DIR, file));
|
|
48
|
-
}
|
|
49
|
-
function readEntryFile(filePath) {
|
|
50
|
-
try {
|
|
51
|
-
const raw = fs.readFileSync(filePath, "utf-8");
|
|
52
|
-
const data = JSON.parse(raw);
|
|
53
|
-
if (typeof data?.dir !== "string" || typeof data?.name !== "string" || typeof data?.version !== "string" || typeof data?.port !== "number" || typeof data?.pid !== "number" && data?.pid !== null || data?.status !== "running" && data?.status !== "stopped") {
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
dir: canonicalizeDir(data.dir),
|
|
58
|
-
name: data.name,
|
|
59
|
-
version: data.version,
|
|
60
|
-
port: data.port,
|
|
61
|
-
pid: data.pid,
|
|
62
|
-
status: data.status,
|
|
63
|
-
startedAt: data.startedAt,
|
|
64
|
-
stoppedAt: data.stoppedAt,
|
|
65
|
-
updatedAt: data.updatedAt
|
|
66
|
-
};
|
|
67
|
-
} catch {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function createTmpPath(entryPath) {
|
|
72
|
-
const suffix = `${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}`;
|
|
73
|
-
return `${entryPath}.tmp.${suffix}`;
|
|
74
|
-
}
|
|
75
|
-
function writeEntryFile(entry) {
|
|
76
|
-
ensureRegistryReady();
|
|
77
|
-
const normalized = {
|
|
78
|
-
...entry,
|
|
79
|
-
dir: canonicalizeDir(entry.dir),
|
|
80
|
-
updatedAt: entry.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
81
|
-
};
|
|
82
|
-
const entryPath = getEntryPathForCanonicalDir(normalized.dir);
|
|
83
|
-
const tmpPath = createTmpPath(entryPath);
|
|
84
|
-
fs.writeFileSync(tmpPath, JSON.stringify(normalized, null, 2), "utf-8");
|
|
85
|
-
fs.renameSync(tmpPath, entryPath);
|
|
86
|
-
}
|
|
87
|
-
function migrateLegacyRegistryIfNeeded() {
|
|
88
|
-
if (migrationChecked) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
migrationChecked = true;
|
|
92
|
-
ensureRegistryDir();
|
|
93
|
-
if (!fs.existsSync(LEGACY_REGISTRY_FILE)) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
if (listEntryFiles().length > 0) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
const raw = fs.readFileSync(LEGACY_REGISTRY_FILE, "utf-8");
|
|
101
|
-
const data = JSON.parse(raw);
|
|
102
|
-
const packs = Array.isArray(data?.packs) ? data.packs : [];
|
|
103
|
-
for (const pack of packs) {
|
|
104
|
-
try {
|
|
105
|
-
writeEntryFile({
|
|
106
|
-
...pack,
|
|
107
|
-
dir: canonicalizeDir(pack.dir),
|
|
108
|
-
updatedAt: pack.updatedAt ?? pack.stoppedAt ?? pack.startedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
109
|
-
});
|
|
110
|
-
} catch {
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
fs.renameSync(LEGACY_REGISTRY_FILE, `${LEGACY_REGISTRY_FILE}.legacy`);
|
|
114
|
-
} catch (err) {
|
|
115
|
-
console.warn(" [Registry] Failed to migrate legacy registry.json:", err);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
function ensureRegistryReady() {
|
|
119
|
-
ensureRegistryDir();
|
|
120
|
-
migrateLegacyRegistryIfNeeded();
|
|
121
|
-
}
|
|
122
|
-
function entriesEqual(a, b) {
|
|
123
|
-
return a.dir === b.dir && a.name === b.name && a.version === b.version && a.port === b.port && a.pid === b.pid && a.status === b.status && a.startedAt === b.startedAt && a.stoppedAt === b.stoppedAt;
|
|
124
|
-
}
|
|
125
|
-
function readEntry(dir) {
|
|
126
|
-
ensureRegistryReady();
|
|
127
|
-
return readEntryFile(getEntryPath(dir));
|
|
128
|
-
}
|
|
129
|
-
function writeEntry(entry) {
|
|
130
|
-
writeEntryFile(entry);
|
|
131
|
-
}
|
|
132
|
-
function deleteEntry(dir) {
|
|
133
|
-
ensureRegistryReady();
|
|
134
|
-
const entryPath = getEntryPath(dir);
|
|
135
|
-
if (fs.existsSync(entryPath)) {
|
|
136
|
-
fs.unlinkSync(entryPath);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function readRegistry() {
|
|
140
|
-
return { packs: readAll() };
|
|
141
|
-
}
|
|
142
|
-
function writeRegistry(data) {
|
|
143
|
-
ensureRegistryReady();
|
|
144
|
-
const nextPaths = /* @__PURE__ */ new Set();
|
|
145
|
-
for (const pack of data.packs) {
|
|
146
|
-
const normalized = {
|
|
147
|
-
...pack,
|
|
148
|
-
dir: canonicalizeDir(pack.dir),
|
|
149
|
-
updatedAt: pack.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
150
|
-
};
|
|
151
|
-
const entryPath = getEntryPathForCanonicalDir(normalized.dir);
|
|
152
|
-
nextPaths.add(entryPath);
|
|
153
|
-
writeEntryFile(normalized);
|
|
154
|
-
}
|
|
155
|
-
for (const existingPath of listEntryFiles()) {
|
|
156
|
-
if (!nextPaths.has(existingPath)) {
|
|
157
|
-
fs.unlinkSync(existingPath);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function register(opts) {
|
|
162
|
-
try {
|
|
163
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
164
|
-
const entry = {
|
|
165
|
-
dir: canonicalizeDir(opts.dir),
|
|
166
|
-
name: opts.name,
|
|
167
|
-
version: opts.version,
|
|
168
|
-
port: opts.port,
|
|
169
|
-
pid: process.pid,
|
|
170
|
-
status: "running",
|
|
171
|
-
startedAt: now,
|
|
172
|
-
updatedAt: now
|
|
173
|
-
};
|
|
174
|
-
writeEntryFile(entry);
|
|
175
|
-
console.log(` [Registry] Registered "${opts.name}" (pid ${process.pid})`);
|
|
176
|
-
} catch (err) {
|
|
177
|
-
console.warn(" [Registry] Failed to register:", err);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function deregister(dir, pid) {
|
|
181
|
-
try {
|
|
182
|
-
const entry = readEntry(dir);
|
|
183
|
-
if (!entry || entry.pid !== pid) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
187
|
-
writeEntryFile({
|
|
188
|
-
...entry,
|
|
189
|
-
pid: null,
|
|
190
|
-
status: "stopped",
|
|
191
|
-
stoppedAt: now,
|
|
192
|
-
updatedAt: now
|
|
193
|
-
});
|
|
194
|
-
console.log(` [Registry] Deregistered "${entry.name}"`);
|
|
195
|
-
} catch (err) {
|
|
196
|
-
console.warn(" [Registry] Failed to deregister:", err);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function readAll() {
|
|
200
|
-
return listEntryFiles().map((entryPath) => readEntryFile(entryPath)).filter((entry) => entry !== null);
|
|
201
|
-
}
|
|
202
|
-
function isPidAlive(pid) {
|
|
203
|
-
try {
|
|
204
|
-
process.kill(pid, 0);
|
|
205
|
-
return true;
|
|
206
|
-
} catch {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
function validateEntries() {
|
|
211
|
-
const entries = readAll();
|
|
212
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
213
|
-
for (const entry of entries) {
|
|
214
|
-
if (entry.status === "running" && entry.pid !== null && !isPidAlive(entry.pid)) {
|
|
215
|
-
writeEntryFile({
|
|
216
|
-
...entry,
|
|
217
|
-
pid: null,
|
|
218
|
-
status: "stopped",
|
|
219
|
-
stoppedAt: now,
|
|
220
|
-
updatedAt: now
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
const nextEntries = readAll();
|
|
225
|
-
if (entries.length === nextEntries.length && entries.every((entry, index) => entriesEqual(entry, nextEntries[index]))) {
|
|
226
|
-
return entries;
|
|
227
|
-
}
|
|
228
|
-
return nextEntries;
|
|
229
|
-
}
|
|
230
|
-
export {
|
|
231
|
-
canonicalizeDir,
|
|
232
|
-
deleteEntry,
|
|
233
|
-
deregister,
|
|
234
|
-
getEntryPath,
|
|
235
|
-
getRegistryPath,
|
|
236
|
-
isPidAlive,
|
|
237
|
-
readAll,
|
|
238
|
-
readEntry,
|
|
239
|
-
readRegistry,
|
|
240
|
-
register,
|
|
241
|
-
validateEntries,
|
|
242
|
-
writeEntry,
|
|
243
|
-
writeRegistry
|
|
244
|
-
};
|