mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-03 06:10:21 +00:00
fix: improve CLI error messages for retry commands and unknown names (#777)
- buildRetryCommand: suggest --prompt-file for long prompts instead of truncating into a non-functional command (threshold raised to 80 chars) - showUnknownCommandError: change "Unknown command" to "Unknown agent or cloud" since users are passing agent/cloud names, not commands - Bump CLI version to 0.2.66 Agent: ux-engineer Co-authored-by: A <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
cb1005ab31
commit
0fe83fe311
7 changed files with 31 additions and 22 deletions
|
|
@ -623,9 +623,12 @@ export function getScriptFailureGuidance(exitCode: number | null, cloud: string,
|
|||
|
||||
export function buildRetryCommand(agent: string, cloud: string, prompt?: string): string {
|
||||
if (!prompt) return `spawn ${agent} ${cloud}`;
|
||||
const short = prompt.length > 60 ? prompt.slice(0, 60) + "..." : prompt;
|
||||
const safe = short.replace(/"/g, '\\"');
|
||||
return `spawn ${agent} ${cloud} --prompt "${safe}"`;
|
||||
if (prompt.length <= 80) {
|
||||
const safe = prompt.replace(/"/g, '\\"');
|
||||
return `spawn ${agent} ${cloud} --prompt "${safe}"`;
|
||||
}
|
||||
// Long prompts: suggest --prompt-file instead of truncating into a broken command
|
||||
return `spawn ${agent} ${cloud} --prompt-file <your-prompt-file>`;
|
||||
}
|
||||
|
||||
function reportScriptFailure(errMsg: string, cloud: string, agent: string, authHint?: string, prompt?: string): never {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue