@pleri/olam-cli 0.1.115 → 0.1.117

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"}
@@ -5,6 +5,6 @@
5
5
  "host-cp": "sha256:13a26950fea2917ebb268f7bda04fd54267ffe8e5ba4a550db89f28eb309553f",
6
6
  "mcp-auth": "sha256:c82fcfca7ed1b139cbea252697487889b96b45a6575cfba076de7f57eaa943ac",
7
7
  "$schema_version": 1,
8
- "$published_version": "0.1.115",
8
+ "$published_version": "0.1.117",
9
9
  "$registry": "ghcr.io/pleri"
10
10
  }