@floomhq/skills 0.2.6 → 0.2.8

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
@@ -2024,6 +2024,23 @@ var COMPATIBLE_AGENTS = {
2024
2024
  opencode: ["OpenCode", "Claude Code", "Codex CLI", "Kimi CLI"],
2025
2025
  kimi: ["Kimi CLI", "Claude Code", "OpenCode"]
2026
2026
  };
2027
+ var TARGET_ENV_DIRS = {
2028
+ generic: ["FLOOM_SKILLS_DIR", "AGENTS_SKILLS_DIR"],
2029
+ all: ["FLOOM_SKILLS_DIR", "AGENTS_SKILLS_DIR"],
2030
+ claude: ["FLOOM_SKILLS_DIR", "CLAUDE_SKILLS_DIR"],
2031
+ codex: ["FLOOM_SKILLS_DIR", "CODEX_SKILLS_DIR", "AGENTS_SKILLS_DIR"],
2032
+ cursor: ["FLOOM_SKILLS_DIR", "CURSOR_SKILLS_DIR", "AGENTS_SKILLS_DIR"],
2033
+ gemini: ["FLOOM_SKILLS_DIR", "GEMINI_SKILLS_DIR", "AGENTS_SKILLS_DIR"],
2034
+ opencode: ["FLOOM_SKILLS_DIR", "OPENCODE_SKILLS_DIR", "AGENTS_SKILLS_DIR"],
2035
+ kimi: ["FLOOM_SKILLS_DIR", "KIMI_SKILLS_DIR", "AGENTS_SKILLS_DIR"]
2036
+ };
2037
+ function envDirForTarget(target) {
2038
+ for (const key of TARGET_ENV_DIRS[target]) {
2039
+ const value = process.env[key]?.trim();
2040
+ if (value) return value;
2041
+ }
2042
+ return null;
2043
+ }
2027
2044
  function presetDir(target, opts) {
2028
2045
  const cwd = opts.cwd ?? process.cwd();
2029
2046
  const root = opts.global ? homedir() : cwd;
@@ -2051,10 +2068,11 @@ function resolveInstallDir(args) {
2051
2068
  compatibleAgents: COMPATIBLE_AGENTS[args.target ?? "generic"]
2052
2069
  };
2053
2070
  }
2054
- if (process.env.FLOOM_SKILLS_DIR) {
2071
+ const targetEnvDir = envDirForTarget(args.target ?? "generic");
2072
+ if (targetEnvDir) {
2055
2073
  return {
2056
2074
  target: args.target ?? "generic",
2057
- dir: process.env.FLOOM_SKILLS_DIR,
2075
+ dir: targetEnvDir,
2058
2076
  origin: "env",
2059
2077
  compatibleAgents: COMPATIBLE_AGENTS[args.target ?? "generic"]
2060
2078
  };
@@ -2430,7 +2448,7 @@ function isLegacyApiUrl(apiUrl) {
2430
2448
  }
2431
2449
 
2432
2450
  // src/version.ts
2433
- var VERSION = "0.2.6";
2451
+ var VERSION = "0.2.8";
2434
2452
 
2435
2453
  // src/api-client.ts
2436
2454
  var DEFAULT_TIMEOUT_MS = 2e4;
@@ -2621,6 +2639,7 @@ async function whoamiCommand() {
2621
2639
  const envToken = process.env.FLOOM_API_TOKEN?.trim();
2622
2640
  if (!auth && !envToken) {
2623
2641
  log.info("Not logged in. Run: floom login");
2642
+ process.exitCode = 1;
2624
2643
  return;
2625
2644
  }
2626
2645
  let me;
@@ -2857,7 +2876,8 @@ import { readFile as readFile6 } from "node:fs/promises";
2857
2876
  import { join as join6 } from "node:path";
2858
2877
  async function publishCommand(opts = {}) {
2859
2878
  const auth = await readAuth();
2860
- if (!auth && !opts.dryRun) {
2879
+ const envToken = process.env.FLOOM_API_TOKEN?.trim();
2880
+ if (!auth && !envToken && !opts.dryRun) {
2861
2881
  log.err("Not logged in. Run: floom login");
2862
2882
  process.exit(1);
2863
2883
  }
@@ -2877,7 +2897,9 @@ async function publishCommand(opts = {}) {
2877
2897
  const manifest = m.manifest;
2878
2898
  const skillMd = await readFile6(join6(dir, "SKILL.md"), "utf8");
2879
2899
  const { meta } = parseSkillFrontmatter(skillMd);
2880
- const refRoot = opts.workspace ?? opts.library ?? auth?.handle ?? "<your-handle>";
2900
+ const me = !opts.dryRun && !auth && envToken ? await api("/me", { authRequired: true }) : null;
2901
+ const handle = auth?.handle ?? me?.user.handle;
2902
+ const refRoot = opts.workspace ?? opts.library ?? handle ?? "<your-handle>";
2881
2903
  log.heading(`${opts.dryRun ? "Dry-running" : "Publishing"} ${refRoot}/${manifest.name}@${manifest.version}`);
2882
2904
  log.step("Packing bundle...");
2883
2905
  const bundle = await collectBundle(dir);
@@ -2890,8 +2912,7 @@ async function publishCommand(opts = {}) {
2890
2912
  log.ok("Dry run passed. No upload was requested.");
2891
2913
  return;
2892
2914
  }
2893
- const activeAuth = auth;
2894
- if (!activeAuth) {
2915
+ if (!handle) {
2895
2916
  log.err("Not logged in. Run: floom login");
2896
2917
  process.exit(1);
2897
2918
  }
@@ -2918,7 +2939,7 @@ async function publishCommand(opts = {}) {
2918
2939
  });
2919
2940
  } catch (e) {
2920
2941
  if (e instanceof FloomError && e.code === "VERSION_ALREADY_EXISTS") {
2921
- log.err(`Version ${manifest.version} already exists for @${activeAuth.handle}/${manifest.name}.`);
2942
+ log.err(`Version ${manifest.version} already exists for @${handle}/${manifest.name}.`);
2922
2943
  log.info("Bump the version in skill.json (e.g. 0.1.1) and try again.");
2923
2944
  process.exit(1);
2924
2945
  }
@@ -2936,7 +2957,7 @@ async function publishCommand(opts = {}) {
2936
2957
  log.ok(`Published ${complete.ref}`);
2937
2958
  log.blank();
2938
2959
  log.info("View:");
2939
- log.kv("", `${activeAuth.apiUrl.replace("/api/v1", "")}/@${activeAuth.handle}/${manifest.name}`);
2960
+ log.kv("", `${(auth?.apiUrl ?? process.env.FLOOM_API_URL ?? "https://skills.floom.dev/api/v1").replace("/api/v1", "")}/@${handle}/${manifest.name}`);
2940
2961
  log.info("Install:");
2941
2962
  log.kv("", complete.install_command);
2942
2963
  }
@@ -3339,7 +3360,7 @@ async function shareCommand(refStr, email, opts = {}) {
3339
3360
  body: { email, role }
3340
3361
  });
3341
3362
  log.ok(`Shared ${refStr} with ${r.grant.email} as ${r.grant.role}.`);
3342
- log.info("No email is sent in V0. They will see the skill under 'Shared with Me' on next login.");
3363
+ if (r.email_status) log.kv("email", r.email_status);
3343
3364
  }
3344
3365
  async function unshareCommand(refStr, email) {
3345
3366
  const ref = parseSkillRef(refStr);