@floomhq/floom 1.0.2 → 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.
@@ -0,0 +1,25 @@
1
+ import pkg from "../package.json" with { type: "json" };
2
+ export const CLI_VERSION = pkg.version;
3
+ function numericParts(value) {
4
+ const normalized = value.trim().replace(/^v/i, "");
5
+ const numeric = normalized.match(/^\d+(?:\.\d+)*/)?.[0] ?? "0";
6
+ return numeric.split(".").map((part) => Number.parseInt(part, 10));
7
+ }
8
+ export function compareSemverish(a, b) {
9
+ const left = numericParts(a);
10
+ const right = numericParts(b);
11
+ const max = Math.max(left.length, right.length);
12
+ for (let i = 0; i < max; i++) {
13
+ const l = left[i] ?? 0;
14
+ const r = right[i] ?? 0;
15
+ if (l > r)
16
+ return 1;
17
+ if (l < r)
18
+ return -1;
19
+ }
20
+ return 0;
21
+ }
22
+ export function formatVersionLabel(value) {
23
+ const trimmed = value.trim();
24
+ return trimmed.match(/^v/i) ? trimmed.replace(/^v/i, "v") : `v${trimmed}`;
25
+ }
package/dist/whoami.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import ora from "ora";
2
- import { getApiUrl, readConfig, CONFIG_PATH } from "./config.js";
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.apiUrl ?? getApiUrl();
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 fetch(`${apiUrl}/api/me`, {
16
- headers: { authorization: `Bearer ${cfg.accessToken}` },
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 fetch(`${apiUrl}/api/skills/mine`, {
33
- headers: { authorization: `Bearer ${cfg.accessToken}` },
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());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floomhq/floom",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Publish AI skills from your terminal. Share with a link.",
5
5
  "license": "MIT",
6
6
  "type": "module",