@floomhq/floom 1.0.3 → 1.0.4
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 +198 -69
- package/dist/config.js +3 -0
- package/dist/delete.js +2 -2
- package/dist/doctor.js +18 -15
- package/dist/errors.js +6 -2
- package/dist/info.js +6 -2
- package/dist/init.js +23 -4
- package/dist/install.js +43 -12
- package/dist/lib/api.js +13 -5
- package/dist/library.js +8 -8
- package/dist/list.js +4 -3
- package/dist/mcp.js +2 -8
- package/dist/publish.js +27 -16
- package/dist/scan.js +26 -0
- package/dist/search.js +2 -2
- package/dist/secrets.js +105 -0
- package/dist/setup.js +16 -8
- package/dist/share.js +2 -2
- package/dist/sync.js +2 -2
- package/dist/version.js +25 -0
- package/dist/whoami.js +9 -6
- package/package.json +1 -1
package/dist/whoami.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import ora from "ora";
|
|
2
|
-
import {
|
|
2
|
+
import { readConfig, CONFIG_PATH, resolveApiUrl } from "./config.js";
|
|
3
|
+
import { floomFetch } from "./lib/api.js";
|
|
3
4
|
import { c, symbols } from "./ui.js";
|
|
4
5
|
import { FloomError, friendlyHttp, friendlyNetwork } from "./errors.js";
|
|
5
6
|
export async function whoami() {
|
|
@@ -7,13 +8,14 @@ export async function whoami() {
|
|
|
7
8
|
if (!cfg) {
|
|
8
9
|
throw new FloomError("Not signed in.", "Run `floom login` to sign in.");
|
|
9
10
|
}
|
|
10
|
-
const apiUrl = cfg
|
|
11
|
+
const apiUrl = resolveApiUrl(cfg);
|
|
11
12
|
const spinner = ora({ text: c.dim("Checking session..."), color: "yellow" }).start();
|
|
12
13
|
let me;
|
|
13
14
|
let count = 0;
|
|
14
15
|
try {
|
|
15
|
-
const res = await
|
|
16
|
-
|
|
16
|
+
const res = await floomFetch(`${apiUrl}/api/me`, "check your account", {
|
|
17
|
+
token: cfg.accessToken,
|
|
18
|
+
checkOk: false,
|
|
17
19
|
});
|
|
18
20
|
if (!res.ok) {
|
|
19
21
|
spinner.stop();
|
|
@@ -29,8 +31,9 @@ export async function whoami() {
|
|
|
29
31
|
}
|
|
30
32
|
// Best-effort: count published skills. Don't fail whoami if it errors.
|
|
31
33
|
try {
|
|
32
|
-
const res = await
|
|
33
|
-
|
|
34
|
+
const res = await floomFetch(`${apiUrl}/api/skills/mine`, "count published skills", {
|
|
35
|
+
token: cfg.accessToken,
|
|
36
|
+
checkOk: false,
|
|
34
37
|
});
|
|
35
38
|
if (res.ok) {
|
|
36
39
|
const data = (await res.json());
|