mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-05 23:50:48 +00:00
fix: Show identifier keys in agents/clouds output and fix prompt flag conflict (#110)
- `spawn agents` now shows the key users need to type (e.g., `claude`) alongside the display name and cloud count - `spawn clouds` now shows the key (e.g., `sprite`) alongside the display name and description - Both commands show a usage hint at the bottom - Error when both --prompt and --prompt-file are provided (was silently overwriting) - Remove duplicate agent validation in handleDefaultCommand (was loading manifest twice without spinner, showing different error format) Agent: ux-engineer Co-authored-by: A <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1511b8617f
commit
bd9d8a2acd
2 changed files with 15 additions and 17 deletions
|
|
@ -388,9 +388,12 @@ export async function cmdAgents(): Promise<void> {
|
|||
console.log();
|
||||
for (const key of agentKeys(manifest)) {
|
||||
const a = manifest.agents[key];
|
||||
console.log(` ${pc.green(a.name.padEnd(NAME_COLUMN_WIDTH))} ${pc.dim(a.description)}`);
|
||||
const implCount = getImplementedClouds(manifest, key).length;
|
||||
console.log(` ${pc.green(key.padEnd(NAME_COLUMN_WIDTH))} ${a.name.padEnd(NAME_COLUMN_WIDTH)} ${pc.dim(`${implCount} clouds`)}`);
|
||||
}
|
||||
console.log();
|
||||
console.log(pc.dim(` Usage: spawn <agent> <cloud>`));
|
||||
console.log();
|
||||
}
|
||||
|
||||
// ── Clouds ─────────────────────────────────────────────────────────────────────
|
||||
|
|
@ -403,9 +406,11 @@ export async function cmdClouds(): Promise<void> {
|
|||
console.log();
|
||||
for (const key of cloudKeys(manifest)) {
|
||||
const c = manifest.clouds[key];
|
||||
console.log(` ${pc.green(c.name.padEnd(NAME_COLUMN_WIDTH))} ${pc.dim(c.description)}`);
|
||||
console.log(` ${pc.green(key.padEnd(NAME_COLUMN_WIDTH))} ${c.name.padEnd(NAME_COLUMN_WIDTH)} ${pc.dim(c.description)}`);
|
||||
}
|
||||
console.log();
|
||||
console.log(pc.dim(` Usage: spawn <agent> <cloud>`));
|
||||
console.log();
|
||||
}
|
||||
|
||||
// ── Agent Info ─────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
cmdUpdate,
|
||||
cmdHelp,
|
||||
} from "./commands.js";
|
||||
import { loadManifest } from "./manifest.js";
|
||||
import { VERSION } from "./version.js";
|
||||
|
||||
function isInteractiveTTY(): boolean {
|
||||
|
|
@ -51,20 +50,6 @@ function extractFlagValue(
|
|||
}
|
||||
|
||||
async function handleDefaultCommand(agent: string, cloud: string | undefined, prompt?: string): Promise<void> {
|
||||
const manifest = await loadManifest();
|
||||
if (!manifest.agents[agent]) {
|
||||
console.error(`Error: Unknown agent "${agent}"`);
|
||||
console.error(`\nAvailable agents:`);
|
||||
const agentEntries = Object.entries(manifest.agents).slice(0, 5);
|
||||
agentEntries.forEach(([key, a]) => console.error(` - ${key.padEnd(16)} ${a.name}`));
|
||||
if (Object.keys(manifest.agents).length > 5) {
|
||||
console.error(` ... and ${Object.keys(manifest.agents).length - 5} more`);
|
||||
}
|
||||
console.error(`\nRun 'spawn agents' to see all agents.`);
|
||||
console.error(`Run 'spawn help' for complete usage.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (cloud) {
|
||||
await cmdRun(agent, cloud, prompt);
|
||||
} else {
|
||||
|
|
@ -92,6 +77,14 @@ async function main(): Promise<void> {
|
|||
);
|
||||
filteredArgs = finalArgs;
|
||||
|
||||
if (prompt && promptFile) {
|
||||
console.error("Error: --prompt and --prompt-file cannot be used together");
|
||||
console.error(`\nUse one or the other:`);
|
||||
console.error(` spawn <agent> <cloud> --prompt "your prompt here"`);
|
||||
console.error(` spawn <agent> <cloud> --prompt-file instructions.txt`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (promptFile) {
|
||||
const { readFileSync } = await import("fs");
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue