@leeguoo/mailbox-cli 2.0.1

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.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/bin/mailbox.js +54 -0
  3. package/package.json +37 -0
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # mailbox-cli
2
+
3
+ Install:
4
+
5
+ ```bash
6
+ npm i -g @leeguoo/mailbox-cli
7
+ mailbox --help
8
+ ```
9
+
10
+ Config:
11
+
12
+ - Credentials: `~/.config/mailbox/auth.json`
13
+ - Other settings: `~/.config/mailbox/config.toml`
package/bin/mailbox.js ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("child_process");
4
+ const path = require("path");
5
+
6
+ function _die(msg) {
7
+ process.stderr.write(msg + "\n");
8
+ process.exit(1);
9
+ }
10
+
11
+ function _platformPackageName() {
12
+ const platform = process.platform;
13
+ const arch = process.arch;
14
+
15
+ if (platform === "darwin" && arch === "arm64") return "@leeguoo/mailbox-cli-darwin-arm64";
16
+ if (platform === "darwin" && arch === "x64") return "@leeguoo/mailbox-cli-darwin-x64";
17
+ if (platform === "linux" && arch === "x64") return "@leeguoo/mailbox-cli-linux-x64-gnu";
18
+
19
+ return "";
20
+ }
21
+
22
+ function _requirePlatformPackage(name) {
23
+ try {
24
+ // eslint-disable-next-line import/no-dynamic-require, global-require
25
+ return require(name);
26
+ } catch {
27
+ // In a source checkout, allow running without publishing by using a
28
+ // relative require from mailbox-cli/packages/.
29
+ const unscoped = name.includes("/") ? name.split("/")[1] : name;
30
+ const rel = path.join(__dirname, "..", "..", unscoped);
31
+ // eslint-disable-next-line import/no-dynamic-require, global-require
32
+ return require(rel);
33
+ }
34
+ }
35
+
36
+ function main() {
37
+ const pkg = _platformPackageName();
38
+ if (!pkg) {
39
+ _die(`Unsupported platform: ${process.platform} ${process.arch}`);
40
+ }
41
+
42
+ const mod = _requirePlatformPackage(pkg);
43
+ const binaryPath = mod && mod.binaryPath;
44
+ if (!binaryPath) {
45
+ _die(`Failed to resolve mailbox binary from ${pkg}`);
46
+ }
47
+
48
+ const args = process.argv.slice(2);
49
+ const r = spawnSync(binaryPath, args, { stdio: "inherit" });
50
+ if (typeof r.status === "number") process.exit(r.status);
51
+ process.exit(1);
52
+ }
53
+
54
+ main();
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@leeguoo/mailbox-cli",
3
+ "version": "2.0.1",
4
+ "description": "Mailbox CLI (binary distribution)",
5
+ "keywords": [
6
+ "mailbox",
7
+ "email",
8
+ "imap",
9
+ "smtp",
10
+ "cli",
11
+ "automation",
12
+ "agent",
13
+ "ai",
14
+ "openclaw",
15
+ "inbox",
16
+ "sync",
17
+ "search",
18
+ "attachments",
19
+ "digest",
20
+ "monitor"
21
+ ],
22
+ "license": "MIT",
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "bin": {
27
+ "mailbox": "bin/mailbox.js"
28
+ },
29
+ "files": [
30
+ "bin/"
31
+ ],
32
+ "optionalDependencies": {
33
+ "@leeguoo/mailbox-cli-darwin-arm64": "2.0.1",
34
+ "@leeguoo/mailbox-cli-darwin-x64": "2.0.1",
35
+ "@leeguoo/mailbox-cli-linux-x64-gnu": "2.0.1"
36
+ }
37
+ }