td-ai-tools 1.1.2 → 1.1.3
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/bin/cli.js +46 -7
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -238,6 +238,18 @@ function buildDeleteMenu() {
|
|
|
238
238
|
return [...skills, ...agents];
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
function buildUpdateMenu() {
|
|
242
|
+
const availableSkills = new Set(getAvailable(SKILLS_DIR));
|
|
243
|
+
const availableAgents = new Set(getAvailable(AGENTS_DIR));
|
|
244
|
+
const skills = getInstalled('skills')
|
|
245
|
+
.filter(name => availableSkills.has(name))
|
|
246
|
+
.map(name => ({ type: 'skill', name }));
|
|
247
|
+
const agents = getInstalled('agents')
|
|
248
|
+
.filter(name => availableAgents.has(name))
|
|
249
|
+
.map(name => ({ type: 'agent', name }));
|
|
250
|
+
return [...skills, ...agents];
|
|
251
|
+
}
|
|
252
|
+
|
|
241
253
|
function toGroupOptions(menu, { hintForInstalled = false } = {}) {
|
|
242
254
|
const skillItems = menu.filter(i => i.type === 'skill').map(i => {
|
|
243
255
|
const hint = hintForInstalled ? '' : getSkillHint(i.name);
|
|
@@ -275,9 +287,11 @@ function deleteItems(items) {
|
|
|
275
287
|
}
|
|
276
288
|
|
|
277
289
|
async function interactiveInstall(mode = 'install') {
|
|
278
|
-
const menu = buildMenu();
|
|
290
|
+
const menu = mode === 'update' ? buildUpdateMenu() : buildMenu();
|
|
279
291
|
if (menu.length === 0) {
|
|
280
|
-
status('info',
|
|
292
|
+
status('info', mode === 'update'
|
|
293
|
+
? 'No installed skills or agent packs match the catalog.'
|
|
294
|
+
: 'No skills or agent packs available.');
|
|
281
295
|
return;
|
|
282
296
|
}
|
|
283
297
|
if (!IS_TTY) {
|
|
@@ -369,6 +383,26 @@ function resolveNames(names) {
|
|
|
369
383
|
return items;
|
|
370
384
|
}
|
|
371
385
|
|
|
386
|
+
function resolveUpdateNames(names) {
|
|
387
|
+
const availableSkills = new Set(getAvailable(SKILLS_DIR));
|
|
388
|
+
const availableAgents = new Set(getAvailable(AGENTS_DIR));
|
|
389
|
+
const installedSkills = getInstalled('skills');
|
|
390
|
+
const installedAgents = getInstalled('agents');
|
|
391
|
+
const items = [];
|
|
392
|
+
for (const name of names) {
|
|
393
|
+
if (installedSkills.includes(name) && availableSkills.has(name)) {
|
|
394
|
+
items.push({ type: 'skill', name });
|
|
395
|
+
} else if (installedAgents.includes(name) && availableAgents.has(name)) {
|
|
396
|
+
items.push({ type: 'agent', name });
|
|
397
|
+
} else if (!installedSkills.includes(name) && !installedAgents.includes(name)) {
|
|
398
|
+
status('error', `"${name}" is not installed.`);
|
|
399
|
+
} else {
|
|
400
|
+
status('error', `"${name}" is installed but not in the catalog.`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return items;
|
|
404
|
+
}
|
|
405
|
+
|
|
372
406
|
function resolveDeleteNames(names) {
|
|
373
407
|
const installedSkills = getInstalled('skills');
|
|
374
408
|
const installedAgents = getInstalled('agents');
|
|
@@ -391,9 +425,9 @@ const HELP_TEXT = `Usage:
|
|
|
391
425
|
npx td-ai-tools install Interactive install
|
|
392
426
|
npx td-ai-tools install --all Install everything
|
|
393
427
|
npx td-ai-tools install <name...> Install specific skills or agent packs
|
|
394
|
-
npx td-ai-tools update Interactive update (
|
|
395
|
-
npx td-ai-tools update --all Update
|
|
396
|
-
npx td-ai-tools update <name...> Update specific skills or agent packs
|
|
428
|
+
npx td-ai-tools update Interactive update (installed items in the catalog)
|
|
429
|
+
npx td-ai-tools update --all Update all installed items found in the catalog
|
|
430
|
+
npx td-ai-tools update <name...> Update specific installed skills or agent packs
|
|
397
431
|
npx td-ai-tools delete Interactive delete
|
|
398
432
|
npx td-ai-tools delete --all Delete everything
|
|
399
433
|
npx td-ai-tools delete <name...> Delete specific skills or agent packs
|
|
@@ -450,9 +484,14 @@ async function main() {
|
|
|
450
484
|
return;
|
|
451
485
|
}
|
|
452
486
|
if (rest[0] === '--all') {
|
|
453
|
-
|
|
487
|
+
const menu = buildUpdateMenu();
|
|
488
|
+
if (menu.length === 0) {
|
|
489
|
+
status('info', 'No installed skills or agent packs match the catalog.');
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
installItems(menu, { replaceExisting: true });
|
|
454
493
|
} else {
|
|
455
|
-
installItems(
|
|
494
|
+
installItems(resolveUpdateNames(rest), { replaceExisting: true });
|
|
456
495
|
}
|
|
457
496
|
return;
|
|
458
497
|
}
|