@paradigma-inc/flywheel 0.1.52 → 0.1.53

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paradigma-inc/flywheel",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "description": "One-command setup for Flywheel MCP hosts",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "sourceCommit": "ca9df558c1e48e09a6eb34afb7c1abd417946e0c",
2
+ "sourceCommit": "ad9659b3de7545ce1411e819a0643cfe4c38888f",
3
3
  "files": [
4
4
  "auth/active-key-id.d.ts",
5
5
  "auth/active-key-id.js",
@@ -1,7 +1,14 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
1
5
  import { runCli as runSetupCli } from "./cli.mjs";
2
6
  import { runRuntimeCli } from "./runtime/delegate.mjs";
3
7
  import { RUNTIME_ALIASES } from "./runtime/vendor/flywheel-cli-dist/commands/aliases.js";
4
8
 
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ const PACKAGE_JSON_PATH = path.resolve(__dirname, "..", "package.json");
11
+
5
12
  const ALIAS_RESERVED_COMMANDS = new Set([
6
13
  "setup",
7
14
  "uninstall",
@@ -9,6 +16,7 @@ const ALIAS_RESERVED_COMMANDS = new Set([
9
16
  "--help",
10
17
  "-h",
11
18
  ]);
19
+ const VERSION_REQUEST_TOKENS = new Set(["--version", "-v", "version"]);
12
20
 
13
21
  const HELP_EXTRAS = [
14
22
  {
@@ -49,6 +57,30 @@ function stripFormatTokens(argv) {
49
57
  return out;
50
58
  }
51
59
 
60
+ let cachedPackageVersion = null;
61
+
62
+ async function loadPackageVersion() {
63
+ if (cachedPackageVersion !== null) {
64
+ return cachedPackageVersion;
65
+ }
66
+ try {
67
+ const raw = await readFile(PACKAGE_JSON_PATH, "utf8");
68
+ const parsed = JSON.parse(raw);
69
+ if (typeof parsed.version === "string" && parsed.version.trim()) {
70
+ cachedPackageVersion = parsed.version.trim();
71
+ return cachedPackageVersion;
72
+ }
73
+ } catch {
74
+ // Fall through to deterministic fallback.
75
+ }
76
+ cachedPackageVersion = "0.0.0";
77
+ return cachedPackageVersion;
78
+ }
79
+
80
+ function isVersionRequest(argv) {
81
+ return argv.length === 1 && VERSION_REQUEST_TOKENS.has(argv[0]);
82
+ }
83
+
52
84
  /**
53
85
  * Detect a top-level help invocation.
54
86
  *
@@ -104,6 +136,12 @@ export async function runUnifiedCli(argv = process.argv.slice(2)) {
104
136
  throw new Error("runUnifiedCli expects an argv array.");
105
137
  }
106
138
 
139
+ if (isVersionRequest(argv)) {
140
+ process.stdout.write(`${await loadPackageVersion()}\n`);
141
+ process.exitCode = 0;
142
+ return;
143
+ }
144
+
107
145
  if (isCombinedHelpRequest(argv)) {
108
146
  // Preserve any --format token verbatim so the runtime's format validator
109
147
  // runs and rejects unsupported values (e.g. `--format=badvalue`) with the