openhome-cli 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3 -7
- package/package.json +1 -1
- package/src/commands/login.ts +7 -7
package/dist/cli.js
CHANGED
|
@@ -317,17 +317,13 @@ async function loginCommand() {
|
|
|
317
317
|
let agents;
|
|
318
318
|
try {
|
|
319
319
|
const client = new ApiClient(apiKey);
|
|
320
|
-
const verification = await client.verifyApiKey(apiKey);
|
|
321
|
-
if (!verification.valid) {
|
|
322
|
-
s.stop("Verification failed.");
|
|
323
|
-
error(verification.message ?? "Invalid API key.");
|
|
324
|
-
process.exit(1);
|
|
325
|
-
}
|
|
326
320
|
agents = await client.getPersonalities();
|
|
327
321
|
s.stop("API key verified.");
|
|
328
322
|
} catch (err) {
|
|
329
323
|
s.stop("Verification failed.");
|
|
330
|
-
error(
|
|
324
|
+
error(
|
|
325
|
+
err instanceof Error && err.message.includes("401") ? "Invalid API key \u2014 check the value and try again." : err instanceof Error ? err.message : String(err)
|
|
326
|
+
);
|
|
331
327
|
process.exit(1);
|
|
332
328
|
}
|
|
333
329
|
saveApiKey(apiKey);
|
package/package.json
CHANGED
package/src/commands/login.ts
CHANGED
|
@@ -53,17 +53,17 @@ export async function loginCommand(): Promise<void> {
|
|
|
53
53
|
let agents: Personality[];
|
|
54
54
|
try {
|
|
55
55
|
const client = new ApiClient(apiKey as string);
|
|
56
|
-
const verification = await client.verifyApiKey(apiKey as string);
|
|
57
|
-
if (!verification.valid) {
|
|
58
|
-
s.stop("Verification failed.");
|
|
59
|
-
error(verification.message ?? "Invalid API key.");
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
56
|
agents = await client.getPersonalities();
|
|
63
57
|
s.stop("API key verified.");
|
|
64
58
|
} catch (err) {
|
|
65
59
|
s.stop("Verification failed.");
|
|
66
|
-
error(
|
|
60
|
+
error(
|
|
61
|
+
err instanceof Error && err.message.includes("401")
|
|
62
|
+
? "Invalid API key — check the value and try again."
|
|
63
|
+
: err instanceof Error
|
|
64
|
+
? err.message
|
|
65
|
+
: String(err),
|
|
66
|
+
);
|
|
67
67
|
process.exit(1);
|
|
68
68
|
}
|
|
69
69
|
|