@agenticmail/cli 0.9.20 → 0.9.21

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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import '@agenticmail/core';
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runHostBin
4
+ } from "./chunk-2LR3AJRX.js";
5
+
6
+ // src/bin-claudecode.ts
7
+ runHostBin("@agenticmail/claudecode", "agenticmail-claudecode");
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runHostBin
4
+ } from "./chunk-2LR3AJRX.js";
5
+
6
+ // src/bin-codex.ts
7
+ runHostBin("@agenticmail/codex", "agenticmail-codex");
@@ -0,0 +1,75 @@
1
+ // src/bin-host-shim.ts
2
+ import { spawn } from "child_process";
3
+ import { existsSync, readFileSync } from "fs";
4
+ import { dirname, isAbsolute, join, parse } from "path";
5
+ import { fileURLToPath } from "url";
6
+ function findHostPackageJson(hostPkgName) {
7
+ const startDir = dirname(fileURLToPath(import.meta.url));
8
+ const { root } = parse(startDir);
9
+ let dir = startDir;
10
+ while (true) {
11
+ const candidate = join(dir, "node_modules", hostPkgName, "package.json");
12
+ if (existsSync(candidate)) return candidate;
13
+ if (dir === root) break;
14
+ const parent = dirname(dir);
15
+ if (parent === dir) break;
16
+ dir = parent;
17
+ }
18
+ throw new Error(`${hostPkgName} is not installed (no node_modules/${hostPkgName} above ${startDir})`);
19
+ }
20
+ function resolveHostBin(hostPkgName, binName) {
21
+ const pkgJsonPath = findHostPackageJson(hostPkgName);
22
+ const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf8"));
23
+ const binField = pkg.bin;
24
+ let binRelPath;
25
+ if (typeof binField === "string") {
26
+ binRelPath = binField;
27
+ } else if (binField && typeof binField === "object") {
28
+ binRelPath = binField[binName];
29
+ }
30
+ if (!binRelPath) {
31
+ throw new Error(
32
+ `${hostPkgName} is installed but doesn't declare a "${binName}" bin entry. This is likely a packaging mismatch \u2014 try \`npm install -g ${hostPkgName}@latest\`.`
33
+ );
34
+ }
35
+ const pkgDir = dirname(pkgJsonPath);
36
+ return isAbsolute(binRelPath) ? binRelPath : join(pkgDir, binRelPath);
37
+ }
38
+ function runHostBin(hostPkgName, binName) {
39
+ let target;
40
+ try {
41
+ target = resolveHostBin(hostPkgName, binName);
42
+ } catch (err) {
43
+ const msg = err instanceof Error ? err.message : String(err);
44
+ console.error(`\u2717 ${msg}`);
45
+ console.error(` To install ${hostPkgName} directly: npm install -g ${hostPkgName}@latest`);
46
+ process.exit(127);
47
+ }
48
+ const child = spawn(process.execPath, [target, ...process.argv.slice(2)], {
49
+ stdio: "inherit"
50
+ });
51
+ child.on("exit", (code, signal) => {
52
+ if (signal) {
53
+ process.kill(process.pid, signal);
54
+ } else {
55
+ process.exit(code ?? 0);
56
+ }
57
+ });
58
+ child.on("error", (err) => {
59
+ console.error(`\u2717 Failed to launch ${target}: ${err.message}`);
60
+ process.exit(1);
61
+ });
62
+ for (const sig of ["SIGINT", "SIGTERM", "SIGHUP"]) {
63
+ process.on(sig, () => {
64
+ try {
65
+ child.kill(sig);
66
+ } catch {
67
+ }
68
+ });
69
+ }
70
+ return void 0;
71
+ }
72
+
73
+ export {
74
+ runHostBin
75
+ };
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  #!/usr/bin/env node
2
- import '@agenticmail/core';
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@agenticmail/cli",
3
- "version": "0.9.20",
3
+ "version": "0.9.21",
4
4
  "description": "Email and SMS infrastructure for AI agents — the first platform to give agents real email addresses and phone numbers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
9
- "agenticmail": "dist/cli.js"
9
+ "agenticmail": "dist/cli.js",
10
+ "agenticmail-claudecode": "dist/bin-claudecode.js",
11
+ "agenticmail-codex": "dist/bin-codex.js"
10
12
  },
11
13
  "exports": {
12
14
  ".": {
@@ -22,7 +24,7 @@
22
24
  "LICENSE"
23
25
  ],
24
26
  "scripts": {
25
- "build": "tsup src/index.ts src/cli.ts --format esm --dts --clean --external @agenticmail/claudecode && npm run copy-public",
27
+ "build": "tsup src/index.ts src/cli.ts src/bin-claudecode.ts src/bin-codex.ts --format esm --dts --clean --external @agenticmail/claudecode --external @agenticmail/codex && npm run copy-public",
26
28
  "copy-public": "mkdir -p dist/public && cp -R ../packages/api/public/. dist/public/",
27
29
  "test": "vitest run --passWithNoTests",
28
30
  "preuninstall": "node scripts/uninstall.mjs",