@pleri/olam-cli 0.1.69 → 0.1.70

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.
@@ -85,6 +85,12 @@ services:
85
85
  # which surfaces in the dashboard as a failed Connect Claude flow.
86
86
  OLAM_AUTH_SERVICE_URL: "http://host.docker.internal:9999"
87
87
  OLAM_AUTH_SECRET: "${OLAM_AUTH_SECRET:-}"
88
+ # Operator's CLI version, propagated by `olam host-cp start` via
89
+ # buildComposeEnv. Surfaces in /api/version/status so the
90
+ # dashboard's TopNav can render "the version we're working on."
91
+ # Empty when older CLI versions render this compose; the server
92
+ # falls back to host-cp's own package.json.
93
+ OLAM_CLI_VERSION: "${OLAM_CLI_VERSION:-}"
88
94
  # Upgrade-trigger feature: host-cp uses these to construct bind
89
95
  # mounts on the spawned upgrader container. The upgrader runs
90
96
  # `olam upgrade -y` and needs (a) the operator's ~/.olam state,
@@ -24,6 +24,7 @@ import path from 'node:path';
24
24
  * @property {ComponentVersion} devbox
25
25
  * @property {string} operatorHead - resolved HEAD or 'unknown'
26
26
  * @property {string} checkedAt - ISO timestamp
27
+ * @property {string} cliVersion - operator's CLI semver (e.g. "0.1.69") or 'unknown'
27
28
  */
28
29
 
29
30
  /**
@@ -187,6 +188,14 @@ export async function buildVersionSnapshot({ authServiceUrl, dockerApiBase }) {
187
188
 
188
189
  const hostCpRunning = process.env.OLAM_BUILD_SHA ?? 'unknown';
189
190
 
191
+ // CLI version is propagated by `olam host-cp start` via the
192
+ // OLAM_CLI_VERSION env (see packages/cli/src/commands/host-cp.ts
193
+ // buildComposeEnv). Falls back to host-cp's own package.json when
194
+ // an older CLI started this container without setting the env.
195
+ const cliVersion = process.env.OLAM_CLI_VERSION
196
+ || readHostCpPackageVersion()
197
+ || 'unknown';
198
+
190
199
  return {
191
200
  hostCp: {
192
201
  running: hostCpRunning,
@@ -205,5 +214,32 @@ export async function buildVersionSnapshot({ authServiceUrl, dockerApiBase }) {
205
214
  },
206
215
  operatorHead,
207
216
  checkedAt: new Date().toISOString(),
217
+ cliVersion,
208
218
  };
209
219
  }
220
+
221
+ /**
222
+ * Read host-cp's bundled package.json version as the CLI-version
223
+ * fallback when OLAM_CLI_VERSION isn't propagated. The container
224
+ * Dockerfile copies the manifest into /app, so the lookup walks up
225
+ * from this module's location.
226
+ *
227
+ * @returns {string | null}
228
+ */
229
+ function readHostCpPackageVersion() {
230
+ try {
231
+ const here = path.dirname(new URL(import.meta.url).pathname);
232
+ for (const candidate of [
233
+ path.join(here, '..', 'package.json'),
234
+ path.join(here, '..', '..', 'package.json'),
235
+ ]) {
236
+ if (fs.existsSync(candidate)) {
237
+ const pkg = JSON.parse(fs.readFileSync(candidate, 'utf-8'));
238
+ if (typeof pkg.version === 'string' && pkg.version.length > 0) return pkg.version;
239
+ }
240
+ }
241
+ } catch {
242
+ // best-effort
243
+ }
244
+ return null;
245
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pleri/olam-cli",
3
- "version": "0.1.69",
3
+ "version": "0.1.70",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "olam": "./bin/olam.cjs"