@pleri/olam-cli 0.1.116 → 0.1.118

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.
@@ -6,7 +6,18 @@
6
6
  * Consumes the publish-time bundle at `packages/cli/dist/mcp-server.js` (Decision 27
7
7
  * in `docs/plans/olam-continuous-distribution/`). The bundle's top-level
8
8
  * `main().catch(...)` invocation auto-runs the stdio loop on import.
9
+ *
10
+ * Path resolution accounts for both runtime layouts:
11
+ * 1. Dev / tsc-only: this file is at `dist/commands/mcp/serve.js`, so the
12
+ * bundle sibling lives two levels up: `dist/mcp-server.js`.
13
+ * 2. Published / `bundle-cli.mjs` output: the CLI is bundled into a single
14
+ * `dist/index.js`, so this code is inlined and `import.meta.url` points
15
+ * to `dist/index.js`. The bundle is then a direct sibling.
16
+ * We probe both candidates so the same binary works in dev AND from a
17
+ * published tarball.
9
18
  */
10
19
  import type { Command } from 'commander';
20
+ export declare const BUNDLE_PATH_CANDIDATES: readonly string[];
21
+ export declare function resolveBundlePath(candidates?: readonly string[], exists?: (p: string) => boolean): string | null;
11
22
  export declare function registerMcpServe(cmd: Command): void;
12
23
  //# sourceMappingURL=serve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/mcp/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAiBnD"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/mcp/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,eAAO,MAAM,sBAAsB,EAAE,SAAS,MAAM,EAKnD,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,UAAU,GAAE,SAAS,MAAM,EAA2B,EACtD,MAAM,GAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAoB,GAC1C,MAAM,GAAG,IAAI,CAEf;AASD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAkBnD"}
@@ -6,23 +6,42 @@
6
6
  * Consumes the publish-time bundle at `packages/cli/dist/mcp-server.js` (Decision 27
7
7
  * in `docs/plans/olam-continuous-distribution/`). The bundle's top-level
8
8
  * `main().catch(...)` invocation auto-runs the stdio loop on import.
9
+ *
10
+ * Path resolution accounts for both runtime layouts:
11
+ * 1. Dev / tsc-only: this file is at `dist/commands/mcp/serve.js`, so the
12
+ * bundle sibling lives two levels up: `dist/mcp-server.js`.
13
+ * 2. Published / `bundle-cli.mjs` output: the CLI is bundled into a single
14
+ * `dist/index.js`, so this code is inlined and `import.meta.url` points
15
+ * to `dist/index.js`. The bundle is then a direct sibling.
16
+ * We probe both candidates so the same binary works in dev AND from a
17
+ * published tarball.
9
18
  */
10
19
  import { existsSync } from 'node:fs';
11
20
  import { dirname, resolve } from 'node:path';
12
21
  import { fileURLToPath } from 'node:url';
13
22
  import { printError } from '../../output.js';
14
23
  const here = dirname(fileURLToPath(import.meta.url));
15
- // dist/commands/mcp/serve.js dist/mcp-server.js
16
- const BUNDLE_PATH = resolve(here, '..', '..', 'mcp-server.js');
17
- const MISSING_BUNDLE_REMEDY = 'olam mcp server bundle missing at dist/mcp-server.js. ' +
18
- 'For local dev, run: node packages/cli/scripts/bundle-mcp-server.mjs. ' +
19
- 'Published @pleri/olam-cli tarballs always include this bundle (per prepublishOnly).';
24
+ export const BUNDLE_PATH_CANDIDATES = [
25
+ // bundled (`dist/index.js` after bundle-cli.mjs) — sibling
26
+ resolve(here, 'mcp-server.js'),
27
+ // dev / tsc-only (`dist/commands/mcp/serve.js`) up two levels
28
+ resolve(here, '..', '..', 'mcp-server.js'),
29
+ ];
30
+ export function resolveBundlePath(candidates = BUNDLE_PATH_CANDIDATES, exists = existsSync) {
31
+ return candidates.find(exists) ?? null;
32
+ }
33
+ const MISSING_BUNDLE_REMEDY = 'olam mcp server bundle missing. Searched: ' +
34
+ BUNDLE_PATH_CANDIDATES.join(', ') +
35
+ '. For local dev, run: node packages/cli/scripts/bundle-mcp-server.mjs. ' +
36
+ 'A fresh `npm install -g @pleri/olam-cli@latest` should always include the bundle ' +
37
+ '(see prepublishOnly in packages/cli/package.json); file an issue if it does not.';
20
38
  export function registerMcpServe(cmd) {
21
39
  cmd
22
40
  .command('serve')
23
41
  .description('Run the olam MCP server (stdio transport). Claude Code wires this via `claude mcp add olam --scope user -- npx -y @pleri/olam-cli mcp serve`.')
24
42
  .action(async () => {
25
- if (!existsSync(BUNDLE_PATH)) {
43
+ const bundlePath = resolveBundlePath();
44
+ if (bundlePath === null) {
26
45
  printError(MISSING_BUNDLE_REMEDY);
27
46
  process.exitCode = 1;
28
47
  return;
@@ -30,7 +49,7 @@ export function registerMcpServe(cmd) {
30
49
  // The bundle's top-level `main().catch(...)` auto-runs the stdio loop on import.
31
50
  // Awaiting the dynamic import resolves once the module is loaded; the StdioServerTransport
32
51
  // keeps the event loop alive until the client closes stdin.
33
- await import(BUNDLE_PATH);
52
+ await import(bundlePath);
34
53
  });
35
54
  }
36
55
  //# sourceMappingURL=serve.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/commands/mcp/serve.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CA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AU,iBAAiB,CAC/B,aAAgC,sBAAsB,EACtD,SAAiC,UAAU;IAE3C,OAAO,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;AACzC,CAAC;AAED,MAAM,qBAAqB,GACzB,4CAA4C;IAC5C,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;IACjC,yEAAyE;IACzE,mFAAmF;IACnF,kFAAkF,CAAC;AAErF,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,GAAG;SACA,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CACV,+IAA+I,CAChJ;SACA,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;QACvC,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YACxB,UAAU,CAAC,qBAAqB,CAAC,CAAC;YAClC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QACD,iFAAiF;QACjF,2FAA2F;QAC3F,4DAA4D;QAC5D,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "auth": "sha256:c8ebf817e09719289c7d7e37056b24adacb9d9fbc555e2540fbe88dfd400f2d9",
3
- "devbox": "sha256:e08235bedcb6c8fe431c2518176b1134f9473ba9f851cb8e61661d548d07aadb",
4
- "devbox-base": "sha256:a0ddfbcf46227bdedcf1752dd203817154c0a15e3382056e3fa055005ff4d8e4",
3
+ "devbox": "sha256:4f1ef6f62864e3dfde0deb1dc5ccaaf00033bce06f3b46f7776f880603c97321",
4
+ "devbox-base": "sha256:5955ca1f43086dfed4e5f66037038ec906c8fcda3a706dadfef2743bc2150f3a",
5
5
  "host-cp": "sha256:13a26950fea2917ebb268f7bda04fd54267ffe8e5ba4a550db89f28eb309553f",
6
6
  "mcp-auth": "sha256:c82fcfca7ed1b139cbea252697487889b96b45a6575cfba076de7f57eaa943ac",
7
7
  "$schema_version": 1,
8
- "$published_version": "0.1.116",
8
+ "$published_version": "0.1.118",
9
9
  "$registry": "ghcr.io/pleri"
10
10
  }
package/dist/index.js CHANGED
@@ -26792,18 +26792,27 @@ import { existsSync as existsSync51 } from "node:fs";
26792
26792
  import { dirname as dirname25, resolve as resolve11 } from "node:path";
26793
26793
  import { fileURLToPath as fileURLToPath6 } from "node:url";
26794
26794
  var here = dirname25(fileURLToPath6(import.meta.url));
26795
- var BUNDLE_PATH = resolve11(here, "..", "..", "mcp-server.js");
26796
- var MISSING_BUNDLE_REMEDY = "olam mcp server bundle missing at dist/mcp-server.js. For local dev, run: node packages/cli/scripts/bundle-mcp-server.mjs. Published @pleri/olam-cli tarballs always include this bundle (per prepublishOnly).";
26795
+ var BUNDLE_PATH_CANDIDATES = [
26796
+ // bundled (`dist/index.js` after bundle-cli.mjs) sibling
26797
+ resolve11(here, "mcp-server.js"),
26798
+ // dev / tsc-only (`dist/commands/mcp/serve.js`) — up two levels
26799
+ resolve11(here, "..", "..", "mcp-server.js")
26800
+ ];
26801
+ function resolveBundlePath(candidates = BUNDLE_PATH_CANDIDATES, exists = existsSync51) {
26802
+ return candidates.find(exists) ?? null;
26803
+ }
26804
+ var MISSING_BUNDLE_REMEDY = "olam mcp server bundle missing. Searched: " + BUNDLE_PATH_CANDIDATES.join(", ") + ". For local dev, run: node packages/cli/scripts/bundle-mcp-server.mjs. A fresh `npm install -g @pleri/olam-cli@latest` should always include the bundle (see prepublishOnly in packages/cli/package.json); file an issue if it does not.";
26797
26805
  function registerMcpServe(cmd) {
26798
26806
  cmd.command("serve").description(
26799
26807
  "Run the olam MCP server (stdio transport). Claude Code wires this via `claude mcp add olam --scope user -- npx -y @pleri/olam-cli mcp serve`."
26800
26808
  ).action(async () => {
26801
- if (!existsSync51(BUNDLE_PATH)) {
26809
+ const bundlePath = resolveBundlePath();
26810
+ if (bundlePath === null) {
26802
26811
  printError(MISSING_BUNDLE_REMEDY);
26803
26812
  process.exitCode = 1;
26804
26813
  return;
26805
26814
  }
26806
- await import(BUNDLE_PATH);
26815
+ await import(bundlePath);
26807
26816
  });
26808
26817
  }
26809
26818
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pleri/olam-cli",
3
- "version": "0.1.116",
3
+ "version": "0.1.118",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "olam": "./bin/olam.cjs"