@fml-inc/fml 0.8.1 → 0.8.2-rc.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fml",
3
- "version": "0.8.1",
3
+ "version": "0.8.2-rc.1",
4
4
  "description": "FML agent tools for Claude Code",
5
5
  "mcpServers": {
6
6
  "fml": {
package/README.md CHANGED
@@ -25,8 +25,9 @@ npm install --global @fml-inc/fml
25
25
  fml setup
26
26
  ```
27
27
 
28
- Run `fml update` to upgrade the global package with npm. Stable releases stay
29
- on npm's `latest` channel; prerelease versions stay on `next`.
28
+ Run `fml update` to check for and install a newer global package with npm. It
29
+ reports the version installed and refreshes FML setup automatically. Stable
30
+ releases stay on npm's `latest` channel; prerelease versions stay on `next`.
30
31
 
31
32
  Installing the package does not change agent configuration. Run `fml install`
32
33
  to register the FML Claude Code plugin, install the agent-native FML skill,
package/dist/cli.js CHANGED
@@ -124,7 +124,7 @@ var POLL_INTERVAL_MS = 50;
124
124
  var LOG_ROTATE_BYTES = 10 * 1024 * 1024;
125
125
  var LOG_ROTATE_FILES = 3;
126
126
  function expectedObserverVersion() {
127
- return true ? "0.8.1+532464ef" : "dev";
127
+ return true ? "0.8.2-rc.1+7fe2ebce" : "dev";
128
128
  }
129
129
  function delay(ms) {
130
130
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -7893,21 +7893,82 @@ async function handleUninstall(opts) {
7893
7893
  }
7894
7894
 
7895
7895
  // src/commands/update.ts
7896
- var SEMVER_PATTERN = /^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
7896
+ var SEMVER_PATTERN = /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-((?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
7897
+ var PACKAGE_NAME = "@fml-inc/fml";
7898
+ var UPDATE_TIMEOUT_MS = 12e4;
7899
+ var SETUP_TIMEOUT_MS = 3e5;
7897
7900
  function getCurrentVersion() {
7898
- return true ? "0.8.1+532464ef" : "unknown";
7901
+ return true ? "0.8.2-rc.1+7fe2ebce" : "unknown";
7902
+ }
7903
+ function parseVersion(version) {
7904
+ const match = SEMVER_PATTERN.exec(version);
7905
+ if (!match) return null;
7906
+ return {
7907
+ major: match[1],
7908
+ minor: match[2],
7909
+ patch: match[3],
7910
+ prerelease: match[4]?.split(".") ?? []
7911
+ };
7912
+ }
7913
+ function compareNumericIdentifiers(left, right) {
7914
+ if (left.length !== right.length) return left.length - right.length;
7915
+ if (left === right) return 0;
7916
+ return left < right ? -1 : 1;
7917
+ }
7918
+ function compareIdentifiers(left, right) {
7919
+ const leftIsNumeric = /^[0-9]+$/u.test(left);
7920
+ const rightIsNumeric = /^[0-9]+$/u.test(right);
7921
+ if (leftIsNumeric && rightIsNumeric) {
7922
+ return compareNumericIdentifiers(left, right);
7923
+ }
7924
+ if (leftIsNumeric) return -1;
7925
+ if (rightIsNumeric) return 1;
7926
+ if (left === right) return 0;
7927
+ return left < right ? -1 : 1;
7928
+ }
7929
+ function compareVersions(left, right) {
7930
+ const leftVersion = parseVersion(left);
7931
+ const rightVersion = parseVersion(right);
7932
+ if (!leftVersion || !rightVersion) {
7933
+ throw new Error("FML update requires valid semantic versions.");
7934
+ }
7935
+ for (const part of ["major", "minor", "patch"]) {
7936
+ const difference = compareNumericIdentifiers(
7937
+ leftVersion[part],
7938
+ rightVersion[part]
7939
+ );
7940
+ if (difference) return difference;
7941
+ }
7942
+ if (!leftVersion.prerelease.length && !rightVersion.prerelease.length) {
7943
+ return 0;
7944
+ }
7945
+ if (!leftVersion.prerelease.length) return 1;
7946
+ if (!rightVersion.prerelease.length) return -1;
7947
+ const length = Math.max(
7948
+ leftVersion.prerelease.length,
7949
+ rightVersion.prerelease.length
7950
+ );
7951
+ for (let index = 0; index < length; index += 1) {
7952
+ const leftIdentifier = leftVersion.prerelease[index];
7953
+ const rightIdentifier = rightVersion.prerelease[index];
7954
+ if (leftIdentifier === void 0) return -1;
7955
+ if (rightIdentifier === void 0) return 1;
7956
+ const difference = compareIdentifiers(leftIdentifier, rightIdentifier);
7957
+ if (difference) return difference;
7958
+ }
7959
+ return 0;
7899
7960
  }
7900
7961
  function resolveUpdateChannel(version) {
7901
7962
  const match = SEMVER_PATTERN.exec(version);
7902
7963
  if (!match) return "latest";
7903
- const prerelease = match[1];
7964
+ const prerelease = match[4];
7904
7965
  if (!prerelease) return "latest";
7905
7966
  return prerelease.split(".").every((identifier) => {
7906
7967
  return !(identifier.length > 1 && identifier.startsWith("0") && /^[0-9]+$/u.test(identifier));
7907
7968
  }) ? "next" : "latest";
7908
7969
  }
7909
7970
  function resolveUpdateTarget(version) {
7910
- return `@fml-inc/fml@${resolveUpdateChannel(version)}`;
7971
+ return `${PACKAGE_NAME}@${resolveUpdateChannel(version)}`;
7911
7972
  }
7912
7973
  function createUpdateEnvironment(env) {
7913
7974
  const updateEnv = { ...env };
@@ -7918,6 +7979,18 @@ function createUpdateEnvironment(env) {
7918
7979
  }
7919
7980
  return updateEnv;
7920
7981
  }
7982
+ function parseAvailableVersion(output) {
7983
+ let version;
7984
+ try {
7985
+ version = JSON.parse(output);
7986
+ } catch {
7987
+ throw new Error("Could not read the available FML version from npm.");
7988
+ }
7989
+ if (typeof version !== "string" || !parseVersion(version)) {
7990
+ throw new Error("Could not read the available FML version from npm.");
7991
+ }
7992
+ return version;
7993
+ }
7921
7994
  function formatUpdateError(err) {
7922
7995
  if (!(err instanceof Error)) return String(err);
7923
7996
  const stderr = err.stderr;
@@ -7940,18 +8013,52 @@ async function handleUpdate(overrides = {}) {
7940
8013
  const channel = resolveUpdateChannel(dependencies.currentVersion);
7941
8014
  const target2 = resolveUpdateTarget(dependencies.currentVersion);
7942
8015
  dependencies.log(`Current version: ${dependencies.currentVersion}`);
7943
- dependencies.log(`Updating FML from the ${channel} channel...
7944
- `);
7945
8016
  try {
7946
8017
  const npm = dependencies.resolveBin("npm");
7947
8018
  if (!npm) throw new Error("npm was not found on PATH");
7948
- dependencies.execBinSync(npm, ["install", "--global", target2], {
7949
- timeout: 12e4,
7950
- env: createUpdateEnvironment(dependencies.env)
7951
- });
7952
- dependencies.log(`
7953
- FML update complete (${channel} channel).`);
7954
- dependencies.log("Run `fml setup` to refresh integrations.");
8019
+ const updateEnv = createUpdateEnvironment(dependencies.env);
8020
+ const availableVersion = parseAvailableVersion(
8021
+ dependencies.execBinSync(npm, ["view", target2, "version", "--json"], {
8022
+ timeout: UPDATE_TIMEOUT_MS,
8023
+ env: updateEnv
8024
+ })
8025
+ );
8026
+ if (compareVersions(availableVersion, dependencies.currentVersion) <= 0) {
8027
+ dependencies.log(
8028
+ `FML is already up to date (${dependencies.currentVersion}).`
8029
+ );
8030
+ return;
8031
+ }
8032
+ dependencies.log(
8033
+ `Updating FML from ${dependencies.currentVersion} to ${availableVersion} on the ${channel} channel...
8034
+ `
8035
+ );
8036
+ dependencies.execBinSync(
8037
+ npm,
8038
+ ["install", "--global", `${PACKAGE_NAME}@${availableVersion}`],
8039
+ { timeout: UPDATE_TIMEOUT_MS, env: updateEnv }
8040
+ );
8041
+ dependencies.log(
8042
+ `
8043
+ FML updated from ${dependencies.currentVersion} to ${availableVersion}. Refreshing setup...`
8044
+ );
8045
+ try {
8046
+ const fml = dependencies.resolveBin("fml");
8047
+ if (!fml) throw new Error("Updated FML was not found on PATH");
8048
+ dependencies.execBinSync(fml, ["setup"], {
8049
+ timeout: SETUP_TIMEOUT_MS,
8050
+ stdio: "inherit"
8051
+ });
8052
+ dependencies.log("FML setup complete.");
8053
+ } catch (err) {
8054
+ dependencies.captureException(err);
8055
+ dependencies.error(
8056
+ "FML updated, but setup failed:",
8057
+ formatUpdateError(err)
8058
+ );
8059
+ dependencies.error("Run `fml setup` to finish refreshing FML.");
8060
+ dependencies.exit(1);
8061
+ }
7955
8062
  } catch (err) {
7956
8063
  dependencies.captureException(err);
7957
8064
  dependencies.error("Update failed:", formatUpdateError(err));
@@ -8929,7 +9036,7 @@ async function handleConfigDetail(opts) {
8929
9036
  // src/commands/tools.ts
8930
9037
  import { readFileSync } from "fs";
8931
9038
  import path29 from "path";
8932
- var pluginVersion = true ? "0.8.1+532464ef" : void 0;
9039
+ var pluginVersion = true ? "0.8.2-rc.1+7fe2ebce" : void 0;
8933
9040
  async function getApi() {
8934
9041
  const api = await getAuthenticatedClient();
8935
9042
  if (!api) {
@@ -9086,7 +9193,7 @@ if (process.argv.length <= 2 || process.argv.includes("--help") || process.argv.
9086
9193
  printBanner();
9087
9194
  }
9088
9195
  var program = new Command().name("fml").description("FML CLI and agent tools").version(
9089
- true ? "0.8.1+532464ef" : "dev"
9196
+ true ? "0.8.2-rc.1+7fe2ebce" : "dev"
9090
9197
  );
9091
9198
  function formatCommandInventory(cmd, prefix = "") {
9092
9199
  const name = prefix ? `${prefix} ${cmd.name()}` : cmd.name();
@@ -9120,7 +9227,7 @@ program.command("install").description("Register FML agent integrations and the
9120
9227
  program.command("uninstall").description("Remove FML agent integrations and optionally local data").option("--purge", "Also remove all data, logs, and auth tokens").option("-y, --yes", "Skip the purge confirmation prompt").action(
9121
9228
  (opts) => handleUninstall({ purge: opts.purge, assumeYes: opts.yes })
9122
9229
  );
9123
- program.command("update").description("Update fml from its release channel").action(() => handleUpdate());
9230
+ program.command("update").description("Update fml when a newer release is available and refresh setup").action(() => handleUpdate());
9124
9231
  program.command("login").description("Sign in to your FML account").option("--device", "Use device authorization flow (no browser needed)").option(
9125
9232
  "--service-token",
9126
9233
  "Sign in with an org service refresh token (prompts for fml_srt_*)"
@@ -1239,7 +1239,7 @@ var hookRejectionStatus = () => ({
1239
1239
  ...lastRejectedReason !== void 0 ? { lastRejectedReason } : {},
1240
1240
  ...lastRejectedTarget !== void 0 ? { lastRejectedTarget } : {}
1241
1241
  });
1242
- var packageVersion = true ? "0.8.1+532464ef" : "dev";
1242
+ var packageVersion = true ? "0.8.2-rc.1+7fe2ebce" : "dev";
1243
1243
  var health = () => ({
1244
1244
  status: "ok",
1245
1245
  service: OBSERVER_SERVICE_NAME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fml-inc/fml",
3
- "version": "0.8.1",
3
+ "version": "0.8.2-rc.1",
4
4
  "description": "FML CLI and agent tools",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",