@devopsagent/cli
Advanced tools
+1
-1
| { | ||
| "name": "@devopsagent/cli", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "CLI for DevOps Agent - AI-powered infrastructure management from your terminal", | ||
@@ -5,0 +5,0 @@ "homepage": "https://devopsagent.io", |
@@ -43,4 +43,5 @@ import { createInterface } from 'node:readline'; | ||
| const user = result.user; | ||
| success(`Logged in as ${user.username || user.email}`); | ||
| const user = result.user || {}; | ||
| const label = user.username || user.email || 'DevOps Agent'; | ||
| success(`Logged in as ${label}`); | ||
| dim(`Config saved to ${getConfigPath()}`); | ||
@@ -47,0 +48,0 @@ } catch (err) { |
@@ -46,3 +46,5 @@ import { getApiKey, getServerUrl } from './config-manager.js'; | ||
| export async function validateKey(apiKey, serverUrl) { | ||
| const url = `${serverUrl.replace(/\/+$/, '')}/api-gateway/v1/auth/validate`; | ||
| // Uses /v1/conversations to validate — works before /v1/auth/validate is deployed. | ||
| // Once the new backend is live, this can switch to /api-gateway/v1/auth/validate. | ||
| const url = `${serverUrl.replace(/\/+$/, '')}/api-gateway/v1/conversations?limit=1`; | ||
| const res = await fetch(url, { | ||
@@ -54,3 +56,8 @@ headers: { | ||
| }); | ||
| return handleResponse(res); | ||
| if (!res.ok) { | ||
| let body; | ||
| try { body = await res.json(); } catch { body = { error: res.statusText }; } | ||
| throw new APIError(body.message || body.error || `HTTP ${res.status}`, res.status, body); | ||
| } | ||
| return { valid: true, user: { username: 'DevOps Agent', email: '' } }; | ||
| } | ||
@@ -57,0 +64,0 @@ |
37923
1.31%895
0.9%