@floomhq/skills 0.2.2 → 0.2.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/index.js CHANGED
@@ -2360,8 +2360,8 @@ import { join as join3 } from "node:path";
2360
2360
  import { mkdir as mkdir2, readFile as readFile3, writeFile, chmod } from "node:fs/promises";
2361
2361
  var CONFIG_DIR = join3(homedir2(), ".floom");
2362
2362
  var AUTH_FILE = join3(CONFIG_DIR, "auth.json");
2363
- var DEFAULT_APP_URL = "https://floom.dev";
2364
- var DEFAULT_API_URL = "https://floom-v0.vercel.app/api/v1";
2363
+ var DEFAULT_APP_URL = "https://skills.floom.dev";
2364
+ var DEFAULT_API_URL = "https://skills.floom.dev/api/v1";
2365
2365
  async function ensureDir() {
2366
2366
  await mkdir2(CONFIG_DIR, { recursive: true, mode: 448 });
2367
2367
  }
@@ -2407,7 +2407,7 @@ function getApiBaseUrls(preferred) {
2407
2407
  }
2408
2408
 
2409
2409
  // src/version.ts
2410
- var VERSION = "0.2.2";
2410
+ var VERSION = "0.2.4";
2411
2411
 
2412
2412
  // src/api-client.ts
2413
2413
  var DEFAULT_TIMEOUT_MS = 2e4;
@@ -2431,7 +2431,8 @@ async function fetchWithTimeout(url, init = {}) {
2431
2431
  }
2432
2432
  async function api(path, opts = {}) {
2433
2433
  const auth = await readAuth();
2434
- if (opts.authRequired && !auth) {
2434
+ const token = process.env.FLOOM_API_TOKEN?.trim() || auth?.token;
2435
+ if (opts.authRequired && !token) {
2435
2436
  throw new FloomError("AUTH_REQUIRED", "Not logged in. Run: floom login");
2436
2437
  }
2437
2438
  let lastError = null;
@@ -2448,7 +2449,7 @@ async function api(path, opts = {}) {
2448
2449
  "User-Agent": `floom-cli/${VERSION}`,
2449
2450
  "x-floom-cli-version": VERSION
2450
2451
  };
2451
- if (auth) headers.Authorization = `Bearer ${auth.token}`;
2452
+ if (token) headers.Authorization = `Bearer ${token}`;
2452
2453
  let res;
2453
2454
  try {
2454
2455
  res = await fetchWithTimeout(url.toString(), {
@@ -2594,22 +2595,25 @@ async function logoutCommand() {
2594
2595
  // src/commands/whoami.ts
2595
2596
  async function whoamiCommand() {
2596
2597
  const auth = await readAuth();
2597
- if (!auth) {
2598
+ const envToken = process.env.FLOOM_API_TOKEN?.trim();
2599
+ if (!auth && !envToken) {
2598
2600
  log.info("Not logged in. Run: floom login");
2599
2601
  return;
2600
2602
  }
2603
+ let me;
2601
2604
  try {
2602
- await api("/me", { authRequired: true });
2605
+ me = await api("/me", { authRequired: true });
2603
2606
  } catch (e) {
2604
- log.err(`Stored login is not accepted by the Floom API: ${e.message}`);
2607
+ log.err(`Login is not accepted by the Floom API: ${e.message}`);
2605
2608
  log.info("Run: floom login");
2606
2609
  process.exitCode = 1;
2607
2610
  return;
2608
2611
  }
2609
2612
  log.heading("Logged in as:");
2610
- log.kv("handle", `@${auth.handle}`);
2611
- log.kv("email", auth.email);
2612
- log.kv("api url", auth.apiUrl);
2613
+ log.kv("handle", `@${me.user.handle}`);
2614
+ log.kv("email", me.user.email);
2615
+ log.kv("api url", process.env.FLOOM_API_URL ?? auth?.apiUrl ?? "default");
2616
+ if (envToken) log.kv("auth", "FLOOM_API_TOKEN");
2613
2617
  }
2614
2618
 
2615
2619
  // src/commands/init.ts
@@ -3519,6 +3523,9 @@ function textOf(result) {
3519
3523
  function pass(name, detail) {
3520
3524
  return { name, ok: true, detail };
3521
3525
  }
3526
+ function warn(name, detail) {
3527
+ return { name, ok: true, detail, status: "warn" };
3528
+ }
3522
3529
  function fail(name, detail) {
3523
3530
  return { name, ok: false, detail };
3524
3531
  }
@@ -3534,9 +3541,7 @@ async function doctorCommand(opts = {}) {
3534
3541
  const auth = await readAuth();
3535
3542
  const token = process.env.FLOOM_API_TOKEN?.trim() || auth?.token;
3536
3543
  if (!token) {
3537
- checks.push(fail("fresh_agent_token", "missing FLOOM_API_TOKEN and ~/.floom/auth.json"));
3538
- emitDoctor(checks, opts.json);
3539
- process.exit(1);
3544
+ checks.push(warn("fresh_agent_auth", "missing token; API-backed tool calls skipped"));
3540
3545
  }
3541
3546
  const cliPath = process.argv[1];
3542
3547
  if (!cliPath) {
@@ -3554,8 +3559,8 @@ async function doctorCommand(opts = {}) {
3554
3559
  env: {
3555
3560
  ...process.env,
3556
3561
  HOME: tmpHome,
3557
- FLOOM_API_TOKEN: token,
3558
3562
  FLOOM_SKILLS_DIR: tmpSkills,
3563
+ ...token ? { FLOOM_API_TOKEN: token } : {},
3559
3564
  ...auth?.apiUrl ? { FLOOM_API_URL: auth.apiUrl } : {}
3560
3565
  },
3561
3566
  stderr: "pipe"
@@ -3568,6 +3573,11 @@ async function doctorCommand(opts = {}) {
3568
3573
  const expected = ["get_skill", "install_skill", "list_workspaces", "search_skills"];
3569
3574
  const missing = expected.filter((name) => !toolNames.includes(name));
3570
3575
  checks.push(missing.length === 0 ? pass("mcp_tools", toolNames.join(", ")) : fail("mcp_tools", `missing ${missing.join(", ")}`));
3576
+ if (!token) {
3577
+ checks.push(warn("mcp_api_calls", "skipped because no FLOOM_API_TOKEN or ~/.floom/auth.json was available"));
3578
+ emitDoctor(checks, opts.json);
3579
+ return;
3580
+ }
3571
3581
  const workspaces = await client.callTool({ name: "list_workspaces", arguments: {} });
3572
3582
  checks.push(textOf(workspaces).length > 0 ? pass("mcp_list_workspaces", `${textOf(workspaces).length} chars`) : fail("mcp_list_workspaces", "empty response"));
3573
3583
  const search = await client.callTool({ name: "search_skills", arguments: { query: opts.query ?? "pdf" } });
@@ -3599,7 +3609,8 @@ function emitDoctor(checks, json) {
3599
3609
  log.heading("Floom doctor");
3600
3610
  for (const check of checks) {
3601
3611
  const detail = check.detail ? ` ${check.detail}` : "";
3602
- if (check.ok) log.ok(`${check.name}${detail}`);
3612
+ if (check.status === "warn") log.warn(`${check.name}${detail}`);
3613
+ else if (check.ok) log.ok(`${check.name}${detail}`);
3603
3614
  else log.err(`${check.name}${detail}`);
3604
3615
  }
3605
3616
  }