@floomhq/floom 1.0.3 → 1.0.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/README.md +2 -0
- package/dist/cli.js +248 -70
- 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/share.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ora from "ora";
|
|
2
|
-
import {
|
|
2
|
+
import { readConfig, resolveApiUrl } from "./config.js";
|
|
3
3
|
import { friendlyHttp, friendlyNetwork, FloomError } from "./errors.js";
|
|
4
4
|
import { c, symbols } from "./ui.js";
|
|
5
5
|
function slugFromInput(input) {
|
|
@@ -25,7 +25,7 @@ export async function share(opts) {
|
|
|
25
25
|
if (!slug) {
|
|
26
26
|
throw new FloomError("Missing skill slug.", "Try: `floom share <slug> --list`");
|
|
27
27
|
}
|
|
28
|
-
const apiUrl = cfg
|
|
28
|
+
const apiUrl = resolveApiUrl(cfg);
|
|
29
29
|
const endpoint = `${apiUrl}/api/skills/${encodeURIComponent(slug)}/share`;
|
|
30
30
|
const spinner = ora({ text: c.dim("Updating sharing..."), color: "yellow" }).start();
|
|
31
31
|
let res;
|
package/dist/sync.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createHash } from "node:crypto";
|
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
6
6
|
import ora from "ora";
|
|
7
|
-
import {
|
|
7
|
+
import { readConfig, resolveApiUrl } from "./config.js";
|
|
8
8
|
import { getJson } from "./lib/api.js";
|
|
9
9
|
import { c, symbols } from "./ui.js";
|
|
10
10
|
import { FloomError } from "./errors.js";
|
|
@@ -207,7 +207,7 @@ export async function sync(opts = {}) {
|
|
|
207
207
|
if (!cfg)
|
|
208
208
|
throw new FloomError("Not signed in.", "Run `floom login` first.");
|
|
209
209
|
await ensureSyncManifestDir();
|
|
210
|
-
const apiUrl = cfg
|
|
210
|
+
const apiUrl = resolveApiUrl(cfg);
|
|
211
211
|
const spinner = opts.spinner === false ? null : ora({ text: c.dim("Syncing skills..."), color: "yellow" }).start();
|
|
212
212
|
let payload;
|
|
213
213
|
try {
|
package/dist/version.js
ADDED
|
@@ -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 {
|
|
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());
|