palabre 0.2.0 → 0.3.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/index.js +36 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,6 +43,10 @@ async function main() {
|
|
|
43
43
|
await runAgentsCommand(parsed.flags);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
+
if (parsed.command === "presets" || parsed.command === "preset") {
|
|
47
|
+
runPresetsCommand(parsed.flags);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
46
50
|
if (parsed.command === "update") {
|
|
47
51
|
const info = await getUpdateInfo(await getPackageVersion());
|
|
48
52
|
if (parsed.flags.apply) {
|
|
@@ -332,6 +336,33 @@ function createRendererFromFlags(flags, plainOutputFallback) {
|
|
|
332
336
|
}
|
|
333
337
|
return createConsoleRenderer(plainOutputFallback);
|
|
334
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* Exécute la commande `palabre presets`.
|
|
341
|
+
*
|
|
342
|
+
* Sortie humaine par défaut (liste alignée), ou JSON avec `--json` pour les
|
|
343
|
+
* intégrations (extension VS Code, scripts shell). Le schéma JSON est versionné
|
|
344
|
+
* via le champ `v` au cas où on enrichirait plus tard (ex : description par
|
|
345
|
+
* preset, tags premium/local).
|
|
346
|
+
*
|
|
347
|
+
* @param flags - Flags parsés depuis la ligne de commande.
|
|
348
|
+
*/
|
|
349
|
+
function runPresetsCommand(flags) {
|
|
350
|
+
const presets = listPresetNames().map((name) => {
|
|
351
|
+
const pair = resolvePreset(name);
|
|
352
|
+
return { name, agentA: pair.agentA, agentB: pair.agentB };
|
|
353
|
+
});
|
|
354
|
+
if (flags.json) {
|
|
355
|
+
process.stdout.write(JSON.stringify({ v: 1, presets }) + "\n");
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
console.log("Presets disponibles:");
|
|
359
|
+
console.log("");
|
|
360
|
+
for (const preset of presets) {
|
|
361
|
+
console.log(` ${preset.name.padEnd(20)} ${preset.agentA} <-> ${preset.agentB}`);
|
|
362
|
+
}
|
|
363
|
+
console.log("");
|
|
364
|
+
console.log(`Total : ${presets.length} preset(s). Utilise --json pour une sortie machine-readable.`);
|
|
365
|
+
}
|
|
335
366
|
/**
|
|
336
367
|
* Parse `process.argv` en une structure typée `ParsedArgs`.
|
|
337
368
|
* Gère les flags courts (-h, -v, -s, -t, -a), les flags longs (--topic, --agent-a…),
|
|
@@ -344,7 +375,7 @@ function parseArgs(args) {
|
|
|
344
375
|
let command = "run";
|
|
345
376
|
let commandExplicit = false;
|
|
346
377
|
const positionals = [];
|
|
347
|
-
const commands = new Set(["run", "new", "init", "setup", "help", "version", "update", "doctor", "config", "agent", "agents"]);
|
|
378
|
+
const commands = new Set(["run", "new", "init", "setup", "help", "version", "update", "doctor", "config", "agent", "agents", "preset", "presets"]);
|
|
348
379
|
const presets = new Set(listPresetNames());
|
|
349
380
|
for (let index = 0; index < args.length; index += 1) {
|
|
350
381
|
const value = args[index];
|
|
@@ -759,6 +790,10 @@ Commandes:
|
|
|
759
790
|
palabre agents [--config <path>]
|
|
760
791
|
Liste les agents déclarés dans la config et leur détection locale.
|
|
761
792
|
|
|
793
|
+
palabre presets [--json]
|
|
794
|
+
Liste les presets de paires d'agents. \`--json\` émet la liste structurée
|
|
795
|
+
pour les intégrations (extension VS Code, scripts).
|
|
796
|
+
|
|
762
797
|
palabre config
|
|
763
798
|
Assistant pour définir ou supprimer les paramètres par défaut.
|
|
764
799
|
|