agentic-workflow-manager 4.0.1 → 4.1.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/dist/src/index.js +84 -22
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -477,18 +477,43 @@ program.command('list [package]')
|
|
|
477
477
|
console.log(picocolors_1.default.dim(` awm list <pkg> · awm list --all`));
|
|
478
478
|
(0, prompts_1.outro)(`Run ${picocolors_1.default.green('awm add')} to install artifacts.`);
|
|
479
479
|
});
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
// Simetrico con `add`: si se puede instalar scripteado, se tiene que poder desinstalar
|
|
481
|
+
// scripteado. `remove` era interactivo puro — sin nombre posicional, sin `--scope`, sin
|
|
482
|
+
// `--yes` — asi que cualquier limpieza automatizada quedaba bloqueada, y el playbook de
|
|
483
|
+
// aceptacion (CORE-17) scripteaba `awm remove dev --yes`, una invocacion que nunca
|
|
484
|
+
// existio. Tercera vez en esta sesion que un playbook se escribio contra lo que la doc
|
|
485
|
+
// prometia y no contra el comportamiento. Ver docs/decisions.md, D-006.
|
|
486
|
+
//
|
|
487
|
+
// El nombre es de BUNDLE, igual que en `add` (D-001).
|
|
488
|
+
program.command('remove [name]')
|
|
489
|
+
.description('Remove an installed bundle interactively, or non-interactively with flags')
|
|
482
490
|
.option('-a, --agent <agent>', `Target agent(s), comma-separated: ${providers_1.AGENT_TARGETS.join(', ')} (defaults to every enabled agent)`)
|
|
483
|
-
.
|
|
491
|
+
.option('-s, --scope <scope>', 'Scope: local or global (skips the prompt)')
|
|
492
|
+
.option('-y, --yes', 'Skip the confirmation prompt (requires a name)')
|
|
493
|
+
.action(async (name, options) => {
|
|
484
494
|
(0, prompts_1.intro)(picocolors_1.default.bgCyan(picocolors_1.default.black(' AWM - Remove Artifact ')));
|
|
485
495
|
const prefs = (0, config_1.getPreferences)();
|
|
496
|
+
// `--yes` sin nombre borraria lo que el usuario nunca eligio: un `rm -rf` silencioso
|
|
497
|
+
// sobre todo lo instalado. Se rechaza antes de tocar nada.
|
|
498
|
+
if (options.yes && !name) {
|
|
499
|
+
console.error(picocolors_1.default.red('--yes requires a bundle name: `awm remove <bundle> --yes`.'));
|
|
500
|
+
console.error(picocolors_1.default.dim('Without a name, removal stays interactive so you see what you are deleting.'));
|
|
501
|
+
process.exit(1);
|
|
502
|
+
}
|
|
486
503
|
// Multi-agent selection (matching the add command flow). --agent skips
|
|
487
504
|
// the interactive prompt and resolves the same way as add/sync/update/doctor (R12/R13).
|
|
488
505
|
let targetAgents;
|
|
489
506
|
if (options.agent) {
|
|
490
507
|
targetAgents = resolveTargetsOrExit(prefs, options.agent);
|
|
491
508
|
}
|
|
509
|
+
else if (options.yes) {
|
|
510
|
+
// `--yes` significa CERO prompts, no "cero confirmaciones". Sin esto, un
|
|
511
|
+
// `awm remove dev --yes` sin `--agent` seguia abriendo el multiselect de
|
|
512
|
+
// agentes y colgaba cualquier script — el flag prometia no-interactivo y no lo
|
|
513
|
+
// era. Sin `--agent`, el default son los agentes habilitados, igual que en
|
|
514
|
+
// `add`, `sync`, `update` y `doctor`.
|
|
515
|
+
targetAgents = [...prefs.enabledAgents];
|
|
516
|
+
}
|
|
492
517
|
else {
|
|
493
518
|
const agentChoice = await (0, prompts_1.multiselect)({
|
|
494
519
|
message: 'From which agent(s)?',
|
|
@@ -502,16 +527,26 @@ program.command('remove')
|
|
|
502
527
|
handleCancel(agentChoice);
|
|
503
528
|
targetAgents = agentChoice;
|
|
504
529
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
options
|
|
508
|
-
{
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
530
|
+
let scopeVal;
|
|
531
|
+
if (options.scope) {
|
|
532
|
+
if (options.scope !== 'local' && options.scope !== 'global') {
|
|
533
|
+
console.error(picocolors_1.default.red(`Invalid scope "${options.scope}". Use: local or global.`));
|
|
534
|
+
process.exit(1);
|
|
535
|
+
}
|
|
536
|
+
scopeVal = options.scope;
|
|
537
|
+
}
|
|
538
|
+
else {
|
|
539
|
+
const scopeChoice = await (0, prompts_1.select)({
|
|
540
|
+
message: 'Scope?',
|
|
541
|
+
options: [
|
|
542
|
+
{ value: 'local', label: 'Project (Local)' },
|
|
543
|
+
{ value: 'global', label: 'Global' }
|
|
544
|
+
],
|
|
545
|
+
initialValue: prefs.defaultScope
|
|
546
|
+
});
|
|
547
|
+
handleCancel(scopeChoice);
|
|
548
|
+
scopeVal = scopeChoice;
|
|
549
|
+
}
|
|
515
550
|
// projectRoot explicito: `config.local` es relativo, y resolverlo contra
|
|
516
551
|
// `process.cwd()` hacia que `awm remove` no encontrara nada desde un
|
|
517
552
|
// subdirectorio — y que le pasara rutas RELATIVAS a fs.rmSync cuando si.
|
|
@@ -532,16 +567,43 @@ program.command('remove')
|
|
|
532
567
|
}
|
|
533
568
|
return `${icons} ${c.baseName} ${picocolors_1.default.dim(`(in: ${Array.from(locations).join(', ')})`)}`;
|
|
534
569
|
});
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
570
|
+
let resolved;
|
|
571
|
+
if (name) {
|
|
572
|
+
// Los artefactos del bundle pedido que estan REALMENTE instalados en este
|
|
573
|
+
// scope. Se cruza contra `installed`: lo que no esta instalado no se puede
|
|
574
|
+
// remover, y decirlo es mejor que borrar un subconjunto en silencio.
|
|
575
|
+
const bundle = (0, bundles_1.discoverAllBundles)().find((b) => b.name === name);
|
|
576
|
+
if (!bundle) {
|
|
577
|
+
console.error(picocolors_1.default.red(`Bundle "${name}" not found in registry.`));
|
|
578
|
+
console.error(picocolors_1.default.dim('Run `awm list` to see available packages.'));
|
|
579
|
+
process.exit(1);
|
|
580
|
+
}
|
|
581
|
+
const owned = new Set([
|
|
582
|
+
...bundle.skills.map((sk) => sk.name),
|
|
583
|
+
...bundle.workflows,
|
|
584
|
+
...bundle.agents,
|
|
585
|
+
]);
|
|
586
|
+
resolved = installed.filter((a) => owned.has(a.name));
|
|
587
|
+
if (resolved.length === 0) {
|
|
588
|
+
(0, prompts_1.outro)(picocolors_1.default.yellow(`Nothing from "${name}" is installed at ${scopeVal} scope for the selected agent(s).`));
|
|
589
|
+
process.exit(0);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
else {
|
|
593
|
+
const toRemove = await (0, prompts_1.multiselect)({
|
|
594
|
+
message: 'Select artifact(s) to remove',
|
|
595
|
+
options: groupedOpts,
|
|
596
|
+
required: true
|
|
597
|
+
});
|
|
598
|
+
handleCancel(toRemove);
|
|
599
|
+
resolved = resolveSelectedArtifacts(toRemove);
|
|
600
|
+
}
|
|
542
601
|
const names = resolved.map(a => picocolors_1.default.red(a.name)).join(', ');
|
|
543
|
-
|
|
544
|
-
|
|
602
|
+
// `--yes` salta la confirmacion, nunca la seleccion: lo que se borra siempre sale
|
|
603
|
+
// de un nombre que el usuario escribio.
|
|
604
|
+
const confirmRemove = options.yes ? true : await (0, prompts_1.confirm)({ message: `Remove ${names}?` });
|
|
605
|
+
if (!options.yes)
|
|
606
|
+
handleCancel(confirmRemove);
|
|
545
607
|
if (confirmRemove) {
|
|
546
608
|
try {
|
|
547
609
|
for (const artifact of resolved) {
|