fix: improve credential guidance in error messages and quick-start hints (#426)

- Add OPENROUTER_API_KEY as first item in script failure error (most common cause)
- Replace external GitHub README link with actionable `spawn <cloud>` command in error output
- Fix help text: auth section now correctly says `spawn <cloud>` instead of `spawn <agent> <cloud>`
- Add inline URL hint next to OPENROUTER_API_KEY in quick-start sections
- Add cloud name label next to cloud auth vars in agent info quick-start

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:
A 2026-02-11 03:21:15 -08:00 committed by GitHub
parent ba5cdd8c3c
commit bb4f0c29df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{
"name": "@openrouter/spawn",
"version": "0.2.33",
"version": "0.2.34",
"type": "module",
"bin": {
"spawn": "cli.js"

View file

@ -435,11 +435,11 @@ async function execScript(cloud: string, agent: string, prompt?: string): Promis
p.log.error("Spawn script failed");
console.error("\nError:", errMsg);
console.error("\nCommon causes:");
console.error(" - Missing OPENROUTER_API_KEY (get one at https://openrouter.ai/settings/keys)");
console.error(" - Missing cloud provider credentials (API key, token, etc.)");
console.error(" - Cloud provider API rate limit or quota exceeded");
console.error(" - Missing local dependencies (SSH, curl, etc.)");
console.error(`\nCheck the cloud provider README for setup instructions:`);
console.error(` ${pc.cyan(`https://github.com/${REPO}/tree/main/${cloud}`)}`);
console.error(`\nRun ${pc.cyan(`spawn ${cloud}`)} to see setup instructions for this provider.`);
process.exit(1);
}
}
@ -708,11 +708,12 @@ export async function cmdAgentInfo(agent: string): Promise<void> {
if (implClouds.length > 0) {
const exampleCloud = implClouds[0];
const authVars = parseAuthEnvVars(manifest.clouds[exampleCloud].auth);
const cloudName = manifest.clouds[exampleCloud].name;
console.log();
console.log(pc.bold("Quick start:"));
console.log(` ${pc.cyan("export OPENROUTER_API_KEY=sk-or-v1-...")}`);
console.log(` ${pc.cyan("export OPENROUTER_API_KEY=sk-or-v1-...")} ${pc.dim("# https://openrouter.ai/settings/keys")}`);
if (authVars.length > 0) {
console.log(` ${pc.cyan(`export ${authVars[0]}=...`)}`);
console.log(` ${pc.cyan(`export ${authVars[0]}=...`)} ${pc.dim(`# ${cloudName} credential`)}`);
}
console.log(` ${pc.cyan(`spawn ${agentKey} ${exampleCloud}`)}`);
}
@ -763,7 +764,7 @@ function printCloudQuickStart(
): void {
console.log();
console.log(pc.bold("Quick start:"));
console.log(` ${pc.cyan("export OPENROUTER_API_KEY=sk-or-v1-...")}`);
console.log(` ${pc.cyan("export OPENROUTER_API_KEY=sk-or-v1-...")} ${pc.dim("# https://openrouter.ai/settings/keys")}`);
if (authVars.length > 0) {
for (const v of authVars) {
console.log(` ${pc.cyan(`export ${v}=your-${v.toLowerCase().replace(/_/g, "-")}-here`)}`);
@ -913,7 +914,7 @@ ${pc.bold("AUTHENTICATION")}
${pc.dim("OPENROUTER_API_KEY")}=sk-or-v1-... spawn claude sprite
Each cloud provider has its own auth requirements.
Run ${pc.cyan("spawn <agent> <cloud>")} to see specific instructions.
Run ${pc.cyan("spawn <cloud>")} to see setup instructions for a specific provider.
${pc.bold("INSTALL")}
curl -fsSL ${RAW_BASE}/cli/install.sh | bash