td-ai-tools 1.1.1 → 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 +59 -7
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -215,6 +215,17 @@ function printList() {
|
|
|
215
215
|
p.outro(pc.dim(`${skills.length} skills, ${agents.length} agent packs available.`));
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
function printSelectionControls(action) {
|
|
219
|
+
p.note(
|
|
220
|
+
[
|
|
221
|
+
`Use Up/Down to move through the ${action} list.`,
|
|
222
|
+
'Press Space to select or deselect items.',
|
|
223
|
+
'Press Enter to confirm your choices.'
|
|
224
|
+
].join('\n'),
|
|
225
|
+
'Controls'
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
218
229
|
function buildMenu() {
|
|
219
230
|
const skills = getAvailable(SKILLS_DIR).map(name => ({ type: 'skill', name }));
|
|
220
231
|
const agents = getAvailable(AGENTS_DIR).map(name => ({ type: 'agent', name }));
|
|
@@ -227,6 +238,18 @@ function buildDeleteMenu() {
|
|
|
227
238
|
return [...skills, ...agents];
|
|
228
239
|
}
|
|
229
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
|
+
|
|
230
253
|
function toGroupOptions(menu, { hintForInstalled = false } = {}) {
|
|
231
254
|
const skillItems = menu.filter(i => i.type === 'skill').map(i => {
|
|
232
255
|
const hint = hintForInstalled ? '' : getSkillHint(i.name);
|
|
@@ -264,9 +287,11 @@ function deleteItems(items) {
|
|
|
264
287
|
}
|
|
265
288
|
|
|
266
289
|
async function interactiveInstall(mode = 'install') {
|
|
267
|
-
const menu = buildMenu();
|
|
290
|
+
const menu = mode === 'update' ? buildUpdateMenu() : buildMenu();
|
|
268
291
|
if (menu.length === 0) {
|
|
269
|
-
status('info',
|
|
292
|
+
status('info', mode === 'update'
|
|
293
|
+
? 'No installed skills or agent packs match the catalog.'
|
|
294
|
+
: 'No skills or agent packs available.');
|
|
270
295
|
return;
|
|
271
296
|
}
|
|
272
297
|
if (!IS_TTY) {
|
|
@@ -275,6 +300,7 @@ async function interactiveInstall(mode = 'install') {
|
|
|
275
300
|
}
|
|
276
301
|
|
|
277
302
|
p.intro(pc.bgCyan(pc.black(' AgentToolkit ')));
|
|
303
|
+
printSelectionControls(mode);
|
|
278
304
|
|
|
279
305
|
const selection = await p.groupMultiselect({
|
|
280
306
|
message: `Select items to ${mode}`,
|
|
@@ -309,6 +335,7 @@ async function interactiveDelete() {
|
|
|
309
335
|
}
|
|
310
336
|
|
|
311
337
|
p.intro(pc.bgCyan(pc.black(' AgentToolkit ')));
|
|
338
|
+
printSelectionControls('delete');
|
|
312
339
|
|
|
313
340
|
const selection = await p.groupMultiselect({
|
|
314
341
|
message: 'Select items to delete',
|
|
@@ -356,6 +383,26 @@ function resolveNames(names) {
|
|
|
356
383
|
return items;
|
|
357
384
|
}
|
|
358
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
|
+
|
|
359
406
|
function resolveDeleteNames(names) {
|
|
360
407
|
const installedSkills = getInstalled('skills');
|
|
361
408
|
const installedAgents = getInstalled('agents');
|
|
@@ -378,9 +425,9 @@ const HELP_TEXT = `Usage:
|
|
|
378
425
|
npx td-ai-tools install Interactive install
|
|
379
426
|
npx td-ai-tools install --all Install everything
|
|
380
427
|
npx td-ai-tools install <name...> Install specific skills or agent packs
|
|
381
|
-
npx td-ai-tools update Interactive update (
|
|
382
|
-
npx td-ai-tools update --all Update
|
|
383
|
-
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
|
|
384
431
|
npx td-ai-tools delete Interactive delete
|
|
385
432
|
npx td-ai-tools delete --all Delete everything
|
|
386
433
|
npx td-ai-tools delete <name...> Delete specific skills or agent packs
|
|
@@ -437,9 +484,14 @@ async function main() {
|
|
|
437
484
|
return;
|
|
438
485
|
}
|
|
439
486
|
if (rest[0] === '--all') {
|
|
440
|
-
|
|
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 });
|
|
441
493
|
} else {
|
|
442
|
-
installItems(
|
|
494
|
+
installItems(resolveUpdateNames(rest), { replaceExisting: true });
|
|
443
495
|
}
|
|
444
496
|
return;
|
|
445
497
|
}
|