nmail-cli
Nmail 对外 API 的命令行客户端(AGENT_SKILL_PLAN P2 / REDESIGN_PLAN §19)——为外部 agent 与 skill 设计:JSON envelope(stdout)、exit code 契约、发送类两阶段确认。
安装
uvx nmail-cli@latest --help # 零安装(PyPI 发布后)
# 或
pipx install nmail-cli
发布随主仓发版流程进行(nmail-cli 为独立 PyPI 包名)。
快速上手
nmail-cli auth login # 本机 Nmail(127.0.0.1:8720)自动配对建 Key(默认 read scope)
nmail-cli auth login --scopes read,write,send # 需要发送时显式扩权
nmail-cli +me # 账号列表与健康
nmail-cli emails list --limit 5
nmail-cli emails read 254 --save-attachments ./downloads
nmail-cli drafts reply --email-id 254 --body-file ./reply.md
nmail-cli drafts send 44 # 第一阶段:打印摘要,exit 8
nmail-cli drafts send 44 --confirmed # 第二阶段:用户许可后重放
nmail-cli watch # NDJSON 每行一封新邮件
远程(自建隧道):nmail-cli auth login --base-url https://nmail.example.com --key nmail_xxx
(/api/extkeys 管理面仅本机可达,远程需从 Nmail 设置-API 复制 Key 粘贴)。
契约
- stdout 只输出 JSON envelope:成功
{"ok":true,"data":…},失败{"ok":false,"error":{"code","message",…}};人话日志走 stderr。 - exit code:
0成功 ·1上游 5xx 可重试×2 ·2参数不合规不重试 ·3认证失效/未启用 走auth login·4连不上(检查 Nmail 是否运行/隧道) ·6业务永久拒绝不重试 ·7限流按Retry-After等待 ·8需两阶段确认(停下等用户,不得同轮自确认)。 - 配置:
~/.config/nmail-cli/config.json(0600);环境变量NMAIL_BASE_URL/NMAIL_API_KEY可覆盖(CI/一次性场景)。
服务端 API 与安全模型见 docs/对外API使用指南.md;面向 agent 的技能说明见 skills/SKILL.md(P3)。
Metadata
Release files for nmail-cli 0.4.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nmail_cli-0.4.7.tar.gz | 17.2 kB | Without provenance | Details for nmail_cli-0.4.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nmail_cli-0.4.7-py3-none-any.whl | Python 3 | none | any | Details for nmail_cli-0.4.7-py3-none-any.whl |
Total release size: 31.2 kB
Release files / nmail_cli-0.4.7.tar.gz
| Download URL | nmail_cli-0.4.7.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d94e5b1d859972351533637a336628ce7c02d7804762b7d6b21047e3e9d8adeb
|
|
BLAKE2b-256 checksum How to use checksums |
7953356c817bbacfb8e6f8cef68bae435f314cb2b9641ab827df151ff4de1b5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / nmail_cli-0.4.7-py3-none-any.whl
| Download URL | nmail_cli-0.4.7-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5a0c22e29ddb6167f611625a1a398398a85152d776a8f97f1b99306f519eeaa
|
|
BLAKE2b-256 checksum How to use checksums |
855daf512417bcbffdfd420ce7e66e4d92899e53f967d2cc3d497bfee3f8d75d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for nmail-cli 0.4.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.