@edena-solutions/cli 0.1.0-beta.0 → 0.1.0
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/src/commands/auth.js +3 -3
- package/dist/src/errors.js +3 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hostname } from "node:os";
|
|
2
2
|
import { flag, hasFlag } from "../args.js";
|
|
3
3
|
import { DEFAULT_API_URL, readConfig, removeProfile, resolveSession, saveProfile, useProfile } from "../config.js";
|
|
4
|
-
import { ApiError, EXIT, UsageError } from "../errors.js";
|
|
4
|
+
import { ApiError, EXIT, NotSignedInError, UsageError } from "../errors.js";
|
|
5
5
|
import { apiRequest } from "../http.js";
|
|
6
6
|
import { bold, dim, printHuman, printJson, wantsJson } from "../output.js";
|
|
7
7
|
import { VERSION } from "../version.js";
|
|
@@ -55,7 +55,7 @@ export async function login(args) {
|
|
|
55
55
|
export async function logout(args) {
|
|
56
56
|
const session = await resolveSession(flag(args, "profile"));
|
|
57
57
|
if (!session.profileName || !session.apiKey)
|
|
58
|
-
throw new
|
|
58
|
+
throw new NotSignedInError("Run edena login.");
|
|
59
59
|
try {
|
|
60
60
|
await apiRequest({ apiUrl: session.apiUrl, apiKey: session.apiKey, method: "POST", path: "/cli/logout" });
|
|
61
61
|
}
|
|
@@ -72,7 +72,7 @@ export async function logout(args) {
|
|
|
72
72
|
export async function whoami(args) {
|
|
73
73
|
const session = await resolveSession(flag(args, "profile"));
|
|
74
74
|
if (!session.apiKey)
|
|
75
|
-
throw new
|
|
75
|
+
throw new NotSignedInError();
|
|
76
76
|
const response = await apiRequest({ apiUrl: session.apiUrl, apiKey: session.apiKey, method: "GET", path: "/cli/whoami" });
|
|
77
77
|
const data = response.kind === "json" ? response.data : null;
|
|
78
78
|
if (wantsJson(hasFlag(args, "json")))
|
package/dist/src/errors.js
CHANGED
|
@@ -19,10 +19,11 @@ export class UsageError extends Error {
|
|
|
19
19
|
}
|
|
20
20
|
/** No key to call the API with: nobody signed in, and no `EDENA_API_KEY`. */
|
|
21
21
|
export class NotSignedInError extends Error {
|
|
22
|
+
hint;
|
|
22
23
|
exitCode = EXIT.auth;
|
|
23
|
-
hint = "Run edena login, or set EDENA_API_KEY."
|
|
24
|
-
constructor() {
|
|
24
|
+
constructor(hint = "Run edena login, or set EDENA_API_KEY.") {
|
|
25
25
|
super("Not signed in.");
|
|
26
|
+
this.hint = hint;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
/** An error the API answered, with its stable `key` and the `requestId` to quote when asking for help. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edena-solutions/cli",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Edena's command line: every operation of the Edena API as a command, for people and for coding agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/Edena-Solutions/edena-cli#readme",
|