@openmail/cli 0.6.1 → 0.7.0
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.
- package/README.md +9 -20
- package/dist/commands/update.d.ts +1 -24
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +1 -77
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +87 -381
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +0 -11
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +6 -50
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/legacy-openclaw.d.ts +8 -0
- package/dist/lib/legacy-openclaw.d.ts.map +1 -0
- package/dist/lib/legacy-openclaw.js +52 -0
- package/dist/lib/legacy-openclaw.js.map +1 -0
- package/dist/lib/output.d.ts +0 -1
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +0 -7
- package/dist/lib/output.js.map +1 -1
- package/dist/lib/state.d.ts +0 -6
- package/dist/lib/state.d.ts.map +1 -1
- package/dist/lib/state.js +0 -8
- package/dist/lib/state.js.map +1 -1
- package/package.json +3 -4
- package/skills/openmail/SKILL.md +79 -0
- package/dist/commands/openclaw.d.ts +0 -93
- package/dist/commands/openclaw.d.ts.map +0 -1
- package/dist/commands/openclaw.js +0 -1019
- package/dist/commands/openclaw.js.map +0 -1
- package/dist/commands/status.d.ts +0 -34
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -147
- package/dist/commands/status.js.map +0 -1
- package/dist/lib/doctor.d.ts +0 -8
- package/dist/lib/doctor.d.ts.map +0 -1
- package/dist/lib/doctor.js +0 -66
- package/dist/lib/doctor.js.map +0 -1
- package/dist/lib/open-browser.d.ts +0 -2
- package/dist/lib/open-browser.d.ts.map +0 -1
- package/dist/lib/open-browser.js +0 -44
- package/dist/lib/open-browser.js.map +0 -1
- package/dist/lib/openclaw-forwarder.d.ts +0 -16
- package/dist/lib/openclaw-forwarder.d.ts.map +0 -1
- package/dist/lib/openclaw-forwarder.js +0 -64
- package/dist/lib/openclaw-forwarder.js.map +0 -1
- package/dist/lib/setup-auth.d.ts +0 -8
- package/dist/lib/setup-auth.d.ts.map +0 -1
- package/dist/lib/setup-auth.js +0 -128
- package/dist/lib/setup-auth.js.map +0 -1
- package/dist/lib/ws-bridge.d.ts +0 -13
- package/dist/lib/ws-bridge.d.ts.map +0 -1
- package/dist/lib/ws-bridge.js +0 -232
- package/dist/lib/ws-bridge.js.map +0 -1
package/README.md
CHANGED
|
@@ -28,16 +28,13 @@ openmail help <command>
|
|
|
28
28
|
### Get started
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
#
|
|
32
|
-
openmail
|
|
31
|
+
# Create a new inbox and set it as the default (interactive prompts, or pass flags)
|
|
32
|
+
openmail init [--mailbox-name john] [--display-name "John Smith"]
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Core commands
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
# Create a new inbox (interactive prompts, or pass flags)
|
|
39
|
-
openmail init [--mailbox-name john] [--display-name "John Smith"]
|
|
40
|
-
|
|
41
38
|
# Manage inboxes
|
|
42
39
|
openmail inbox list [--pod-id pod_xxx] --limit 10
|
|
43
40
|
openmail inbox create [--mailbox-name <name>] [--display-name <sender name>] [--domain <domain>] [--pod-id <pod_id>]
|
|
@@ -57,7 +54,7 @@ openmail inbox webhook test --inbox-id inb_xxx
|
|
|
57
54
|
openmail inbox webhook rotate-secret --inbox-id inb_xxx
|
|
58
55
|
openmail inbox webhook clear --inbox-id inb_xxx
|
|
59
56
|
|
|
60
|
-
# Send email (uses default inbox from
|
|
57
|
+
# Send email (uses default inbox from init, or pass --inbox-id)
|
|
61
58
|
openmail send --to hello@example.com --subject "Hi" --body "Hello"
|
|
62
59
|
|
|
63
60
|
# Send to multiple recipients (--to is one address; repeat --cc for the rest)
|
|
@@ -122,21 +119,13 @@ openmail policy rules remove --rule-id rule_xxx [--pod-id | --inbox-id]
|
|
|
122
119
|
openmail policy audit [--direction inbound|outbound] [--since <iso>] [--until <iso>]
|
|
123
120
|
```
|
|
124
121
|
|
|
125
|
-
###
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
# Runtime status
|
|
129
|
-
openmail status
|
|
130
|
-
|
|
131
|
-
# WebSocket bridge (forwards events to OpenClaw hook)
|
|
132
|
-
openmail ws bridge [--hook-url <url>] [--hook-token <token>]
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Diagnostics
|
|
122
|
+
### Use with an agent
|
|
136
123
|
|
|
137
|
-
|
|
138
|
-
openmail
|
|
139
|
-
|
|
124
|
+
- **OpenClaw**: use the [`@openmail/openclaw` plugin](https://github.com/openmailsh/openclaw-plugin):
|
|
125
|
+
`openclaw plugins install clawhub:@openmail/openclaw`
|
|
126
|
+
- **Claude Code, Cursor, Codex**: copy [`skills/openmail/SKILL.md`](skills/openmail/SKILL.md)
|
|
127
|
+
into `~/.claude/skills/openmail/` (or your agent's skills directory), or run
|
|
128
|
+
`npx skills add openmailsh/cli`.
|
|
140
129
|
|
|
141
130
|
## Global flags
|
|
142
131
|
|
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
import type { CliContext } from "../lib/output";
|
|
2
|
-
export type BridgeRestart = "restarted" | "not_running" | "failed" | "manual_restart_needed" | "none";
|
|
3
2
|
export type UpdateResult = {
|
|
4
3
|
ok: boolean;
|
|
5
4
|
status: "up_to_date" | "updated";
|
|
6
5
|
from: string;
|
|
7
6
|
to: string;
|
|
8
|
-
skillRefresh: "done" | "failed" | "skipped";
|
|
9
|
-
bridge: BridgeRestart;
|
|
10
7
|
};
|
|
11
|
-
type ExecFn = (cmd: string, args: string[]) => {
|
|
12
|
-
status: number | null;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Restart the notify/channel-mode WebSocket bridge so it picks up the freshly
|
|
16
|
-
* installed code — the service definitions exec the global install path, which
|
|
17
|
-
* `npm install -g` overwrites in place, so a plain restart is enough. Covers
|
|
18
|
-
* the managed runtimes (systemd on Linux, launchd on macOS). A bridge running
|
|
19
|
-
* as a detached plain process has no tracked pid, so it is only detected and
|
|
20
|
-
* reported for a manual restart. Tool-mode installs have no bridge: "none".
|
|
21
|
-
*/
|
|
22
|
-
export declare function restartBridgeIfInstalled(deps?: {
|
|
23
|
-
homeDir?: string;
|
|
24
|
-
platform?: NodeJS.Platform;
|
|
25
|
-
exec?: ExecFn;
|
|
26
|
-
}): BridgeRestart;
|
|
27
8
|
/**
|
|
28
|
-
* Upgrade the globally installed CLI to the latest published version
|
|
29
|
-
* re-run `openmail setup` with the NEW binary so the installed skill files
|
|
30
|
-
* are refreshed in the same step (setup is idempotent and non-interactive on
|
|
31
|
-
* an already-configured install).
|
|
9
|
+
* Upgrade the globally installed CLI to the latest published version.
|
|
32
10
|
*/
|
|
33
11
|
export declare function runUpdateCommand(params: {
|
|
34
12
|
ctx: CliContext;
|
|
35
13
|
currentVersion: string;
|
|
36
14
|
}): Promise<UpdateResult>;
|
|
37
|
-
export {};
|
|
38
15
|
//# sourceMappingURL=update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAIhD,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,MAAM,EAAE;IAC7C,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,YAAY,CAAC,CAqCxB"}
|
package/dist/commands/update.js
CHANGED
|
@@ -1,63 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.restartBridgeIfInstalled = restartBridgeIfInstalled;
|
|
7
3
|
exports.runUpdateCommand = runUpdateCommand;
|
|
8
4
|
const node_child_process_1 = require("node:child_process");
|
|
9
|
-
const node_fs_1 = require("node:fs");
|
|
10
|
-
const node_os_1 = __importDefault(require("node:os"));
|
|
11
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
12
5
|
const output_1 = require("../lib/output");
|
|
13
6
|
const update_check_1 = require("../lib/update-check");
|
|
14
|
-
const defaultExec = (cmd, args) => (0, node_child_process_1.spawnSync)(cmd, args, { stdio: "ignore" });
|
|
15
7
|
/**
|
|
16
|
-
*
|
|
17
|
-
* installed code — the service definitions exec the global install path, which
|
|
18
|
-
* `npm install -g` overwrites in place, so a plain restart is enough. Covers
|
|
19
|
-
* the managed runtimes (systemd on Linux, launchd on macOS). A bridge running
|
|
20
|
-
* as a detached plain process has no tracked pid, so it is only detected and
|
|
21
|
-
* reported for a manual restart. Tool-mode installs have no bridge: "none".
|
|
22
|
-
*/
|
|
23
|
-
function restartBridgeIfInstalled(deps) {
|
|
24
|
-
const homeDir = deps?.homeDir ?? node_os_1.default.homedir();
|
|
25
|
-
const platform = deps?.platform ?? process.platform;
|
|
26
|
-
const exec = deps?.exec ?? defaultExec;
|
|
27
|
-
const systemdUnit = node_path_1.default.join(homeDir, ".config", "systemd", "user", "openmail-openclaw-bridge.service");
|
|
28
|
-
if (platform === "linux" && (0, node_fs_1.existsSync)(systemdUnit)) {
|
|
29
|
-
const active = exec("systemctl", [
|
|
30
|
-
"--user",
|
|
31
|
-
"is-active",
|
|
32
|
-
"--quiet",
|
|
33
|
-
"openmail-openclaw-bridge.service",
|
|
34
|
-
]);
|
|
35
|
-
if (active.status !== 0)
|
|
36
|
-
return "not_running";
|
|
37
|
-
const restart = exec("systemctl", [
|
|
38
|
-
"--user",
|
|
39
|
-
"restart",
|
|
40
|
-
"openmail-openclaw-bridge.service",
|
|
41
|
-
]);
|
|
42
|
-
return restart.status === 0 ? "restarted" : "failed";
|
|
43
|
-
}
|
|
44
|
-
const plist = node_path_1.default.join(homeDir, "Library", "LaunchAgents", "sh.openmail.openclaw-bridge.plist");
|
|
45
|
-
if (platform === "darwin" && (0, node_fs_1.existsSync)(plist)) {
|
|
46
|
-
exec("launchctl", ["unload", plist]);
|
|
47
|
-
const load = exec("launchctl", ["load", "-w", plist]);
|
|
48
|
-
return load.status === 0 ? "restarted" : "failed";
|
|
49
|
-
}
|
|
50
|
-
// Detached plain-process bridge (setup's last-resort mode): detect only.
|
|
51
|
-
const found = exec("pgrep", ["-f", "@openmail/cli.* ws bridge"]);
|
|
52
|
-
if (found.status === 0)
|
|
53
|
-
return "manual_restart_needed";
|
|
54
|
-
return "none";
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Upgrade the globally installed CLI to the latest published version, then
|
|
58
|
-
* re-run `openmail setup` with the NEW binary so the installed skill files
|
|
59
|
-
* are refreshed in the same step (setup is idempotent and non-interactive on
|
|
60
|
-
* an already-configured install).
|
|
8
|
+
* Upgrade the globally installed CLI to the latest published version.
|
|
61
9
|
*/
|
|
62
10
|
async function runUpdateCommand(params) {
|
|
63
11
|
const { ctx, currentVersion } = params;
|
|
@@ -71,8 +19,6 @@ async function runUpdateCommand(params) {
|
|
|
71
19
|
status: "up_to_date",
|
|
72
20
|
from: currentVersion,
|
|
73
21
|
to: currentVersion,
|
|
74
|
-
skillRefresh: "skipped",
|
|
75
|
-
bridge: "none",
|
|
76
22
|
};
|
|
77
23
|
}
|
|
78
24
|
(0, output_1.logInfo)(ctx, `Updating @openmail/cli ${currentVersion} → ${latest}...`);
|
|
@@ -80,33 +26,11 @@ async function runUpdateCommand(params) {
|
|
|
80
26
|
if (install.status !== 0) {
|
|
81
27
|
throw new Error(`npm install failed (exit ${install.status ?? "?"}); try \`npm install -g @openmail/cli@latest\` yourself (a permissions error may need a node version manager or sudo)`);
|
|
82
28
|
}
|
|
83
|
-
// Refresh the installed skill files via the freshly installed binary — the
|
|
84
|
-
// running (old) process would only rewrite its own outdated template.
|
|
85
|
-
// --refresh-skill is prompt-free and network-free: it rewrites installed
|
|
86
|
-
// SKILL.md files and touches nothing else (no inbox/mode flow, no API).
|
|
87
|
-
const refresh = (0, node_child_process_1.spawnSync)("openmail", ["setup", "--refresh-skill"], {
|
|
88
|
-
stdio: "ignore",
|
|
89
|
-
});
|
|
90
|
-
const skillRefresh = refresh.status === 0 ? "done" : "failed";
|
|
91
|
-
if (skillRefresh === "failed") {
|
|
92
|
-
(0, output_1.logInfo)(ctx, "Updated, but the skill refresh failed — run `openmail setup --refresh-skill` to refresh skill files.");
|
|
93
|
-
}
|
|
94
|
-
// The bridge (notify/channel mode) is a long-running process that keeps
|
|
95
|
-
// executing the old code until restarted.
|
|
96
|
-
const bridge = restartBridgeIfInstalled();
|
|
97
|
-
if (bridge === "failed") {
|
|
98
|
-
(0, output_1.logInfo)(ctx, "Updated, but restarting the notification bridge failed — run `openmail setup` to relaunch it.");
|
|
99
|
-
}
|
|
100
|
-
else if (bridge === "manual_restart_needed") {
|
|
101
|
-
(0, output_1.logInfo)(ctx, "Updated. The notification bridge is running as a plain process on the old version — restart it to pick up the update.");
|
|
102
|
-
}
|
|
103
29
|
return {
|
|
104
30
|
ok: true,
|
|
105
31
|
status: "updated",
|
|
106
32
|
from: currentVersion,
|
|
107
33
|
to: latest,
|
|
108
|
-
skillRefresh,
|
|
109
|
-
bridge,
|
|
110
34
|
};
|
|
111
35
|
}
|
|
112
36
|
//# sourceMappingURL=update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":";;AAeA,4CAwCC;AAvDD,2DAA+C;AAE/C,0CAAwC;AACxC,sDAAyE;AASzE;;GAEG;AACI,KAAK,UAAU,gBAAgB,CAAC,MAGtC;IACC,MAAM,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC;IAEvC,MAAM,MAAM,GAAG,MAAM,IAAA,iCAAkB,EAAC,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,wHAAwH,CACzH,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,IAAA,6BAAc,EAAC,MAAM,EAAE,cAAc,CAAC,EAAE,CAAC;QAC5C,OAAO;YACL,EAAE,EAAE,IAAI;YACR,MAAM,EAAE,YAAY;YACpB,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,cAAc;SACnB,CAAC;IACJ,CAAC;IAED,IAAA,gBAAO,EAAC,GAAG,EAAE,0BAA0B,cAAc,MAAM,MAAM,KAAK,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,IAAA,8BAAS,EACvB,KAAK,EACL,CAAC,SAAS,EAAE,IAAI,EAAE,iBAAiB,MAAM,EAAE,CAAC,EAC5C,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,CAC9C,CAAC;IACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CACb,4BAA4B,OAAO,CAAC,MAAM,IAAI,GAAG,uHAAuH,CACzK,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,IAAI;QACR,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,cAAc;QACpB,EAAE,EAAE,MAAM;KACX,CAAC;AACJ,CAAC"}
|