diff --git a/cli/src/__tests__/cloud-agent-quickstart.test.ts b/cli/src/__tests__/cloud-agent-quickstart.test.ts index 2de2dd2e..00788005 100644 --- a/cli/src/__tests__/cloud-agent-quickstart.test.ts +++ b/cli/src/__tests__/cloud-agent-quickstart.test.ts @@ -578,6 +578,35 @@ describe("cmdAgentInfo - Quick start auth patterns", () => { const output = getOutput(); expect(output).toContain("upcloud.com"); }); + + it("should show ALL auth env vars for multi-credential clouds", async () => { + await setupManifest(multiAuthManifest); + await cmdAgentInfo("claude"); + const output = getOutput(); + // Both vars from "UPCLOUD_USERNAME + UPCLOUD_PASSWORD" should appear + expect(output).toContain("UPCLOUD_USERNAME"); + expect(output).toContain("UPCLOUD_PASSWORD"); + }); + + it("should show URL hint only on first auth var, not repeated", async () => { + await setupManifest(multiAuthManifest); + await cmdAgentInfo("claude"); + const lines = consoleSpy.mock.calls.map((c: any[]) => c.join(" ")); + const quickStartIdx = lines.findIndex((l: string) => l.includes("Quick start")); + const afterQuickStart = lines.slice(quickStartIdx + 1); + const usernameLine = afterQuickStart.find( + (l: string) => l.includes("UPCLOUD_USERNAME") + ); + const passwordLine = afterQuickStart.find( + (l: string) => l.includes("UPCLOUD_PASSWORD") + ); + expect(usernameLine).toBeDefined(); + expect(passwordLine).toBeDefined(); + // URL hint should appear on the first auth var line + expect(usernameLine).toContain("upcloud.com"); + // URL hint should NOT be repeated on the second auth var line + expect(passwordLine).not.toContain("upcloud.com"); + }); }); describe("agent where first cloud has 'none' auth", () => { diff --git a/cli/src/commands.ts b/cli/src/commands.ts index 426dd200..dcdd3a5e 100644 --- a/cli/src/commands.ts +++ b/cli/src/commands.ts @@ -1380,8 +1380,10 @@ export async function cmdAgentInfo(agent: string): Promise { console.log(pc.bold("Quick start:")); console.log(formatAuthVarLine("OPENROUTER_API_KEY", "https://openrouter.ai/settings/keys")); if (authVars.length > 0) { - const hint = cloudDef.url ?? `${cloudDef.name} credential`; - console.log(formatAuthVarLine(authVars[0], hint)); + for (let i = 0; i < authVars.length; i++) { + // Only show the URL hint on the first auth var to avoid repetition + console.log(formatAuthVarLine(authVars[i], i === 0 ? cloudDef.url : undefined)); + } } console.log(` ${pc.cyan(`spawn ${agentKey} ${exampleCloud}`)}`); }