@npeercy/skills 0.1.3 → 0.1.4
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/lib/skills.js +34 -8
- package/package.json +1 -1
package/lib/skills.js
CHANGED
|
@@ -141,23 +141,35 @@ function discoverUnmanaged(agents, st) {
|
|
|
141
141
|
return unmanaged;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
const
|
|
144
|
+
function bundledBuiltins() {
|
|
145
|
+
const out = [];
|
|
146
146
|
const builtinsRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', 'builtin-skills');
|
|
147
|
-
if (!existsSync(builtinsRoot)) return;
|
|
147
|
+
if (!existsSync(builtinsRoot)) return out;
|
|
148
148
|
|
|
149
|
-
const installed = [];
|
|
150
149
|
for (const entry of readdirSync(builtinsRoot, { withFileTypes: true })) {
|
|
151
150
|
if (!entry.isDirectory()) continue;
|
|
152
|
-
|
|
153
151
|
const srcDir = join(builtinsRoot, entry.name);
|
|
154
152
|
const skillMd = join(srcDir, 'SKILL.md');
|
|
155
153
|
if (!existsSync(skillMd)) continue;
|
|
156
|
-
|
|
157
154
|
const meta = parseFrontmatter(readFileSync(skillMd, 'utf8'));
|
|
158
155
|
if (!meta) continue;
|
|
156
|
+
out.push({
|
|
157
|
+
id: `__builtin__/local/${meta.name}`,
|
|
158
|
+
name: meta.name,
|
|
159
|
+
srcDir,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
159
165
|
|
|
160
|
-
|
|
166
|
+
async function installBuiltins(agents) {
|
|
167
|
+
const st = loadState();
|
|
168
|
+
|
|
169
|
+
const installed = [];
|
|
170
|
+
for (const b of bundledBuiltins()) {
|
|
171
|
+
const srcDir = b.srcDir;
|
|
172
|
+
const id = b.id;
|
|
161
173
|
const version = 'v1';
|
|
162
174
|
const dest = managedPath(id, version);
|
|
163
175
|
const files = collectFiles(srcDir);
|
|
@@ -195,7 +207,7 @@ async function installBuiltins(agents) {
|
|
|
195
207
|
builtin: true,
|
|
196
208
|
};
|
|
197
209
|
|
|
198
|
-
installed.push(
|
|
210
|
+
installed.push(b.name);
|
|
199
211
|
}
|
|
200
212
|
|
|
201
213
|
saveState(st);
|
|
@@ -449,6 +461,20 @@ export async function cmdList(args = {}) {
|
|
|
449
461
|
});
|
|
450
462
|
}
|
|
451
463
|
|
|
464
|
+
// Bundled built-ins (show even if not installed yet)
|
|
465
|
+
const installedIds = new Set(Object.keys(st.installed));
|
|
466
|
+
for (const b of bundledBuiltins()) {
|
|
467
|
+
if (installedIds.has(b.id)) continue;
|
|
468
|
+
rows.push({
|
|
469
|
+
id: b.id,
|
|
470
|
+
version: '-',
|
|
471
|
+
latest: 'v1',
|
|
472
|
+
agents: '-',
|
|
473
|
+
status: 'bundled',
|
|
474
|
+
managed: false,
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
|
|
452
478
|
// Unmanaged installs (present in agent dirs but not in skill-sharer state)
|
|
453
479
|
const unmanaged = discoverUnmanaged(agents, st);
|
|
454
480
|
for (const [name, info] of unmanaged.entries()) {
|