Skip to content

Commit f66c3e8

Browse files
beilunyangclaude
andcommitted
docs: add CLI section to READMEs and restore @moemail/cli package name
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cb266a0 commit f66c3e8

File tree

4 files changed

+106
-2
lines changed

4 files changed

+106
-2
lines changed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<a href="#sending-emails">Sending Emails</a> •
3131
<a href="#webhook-integration">Webhook Integration</a> •
3232
<a href="#openapi">OpenAPI</a> •
33+
<a href="#cli-tool">CLI Tool</a> •
3334
<a href="#environment-variables">Environment Variables</a> •
3435
<a href="#github-oauth-app-configuration">Github OAuth Config</a> •
3536
<a href="#google-oauth-app-configuration">Google OAuth Config</a> •
@@ -68,6 +69,7 @@ The documentation site contains detailed usage guides, API documentation, deploy
6869
- 🔔 **Webhook Notification**: Support receiving new email notifications via webhook
6970
- 🛡️ **Permission System**: Role-based access control system
7071
- 🔑 **OpenAPI**: Support accessing OpenAPI via API Key
72+
- 🤖 **Agent-first CLI**: CLI tool designed for AI agents to automate email workflows
7173
- 🌍 **Multi-language Support**: Supports Chinese and English interfaces, freely switchable
7274

7375
## Tech Stack
@@ -533,6 +535,56 @@ GET /api/emails/{emailId}/messages/{messageId}/share
533535
DELETE /api/emails/{emailId}/messages/{messageId}/share/{shareId}
534536
```
535537

538+
## CLI Tool
539+
540+
MoeMail provides an agent-first CLI tool for AI agents and automation workflows.
541+
542+
### Install
543+
544+
```bash
545+
npm i -g @moemail/cli
546+
```
547+
548+
### Quick Start
549+
550+
```bash
551+
# Configure API endpoint and key
552+
moemail config set api-url https://moemail.app
553+
moemail config set api-key YOUR_API_KEY
554+
555+
# Create temporary email
556+
moemail create --domain moemail.app --expiry 1h --json
557+
558+
# Wait for new messages (polling)
559+
moemail wait --email-id <id> --timeout 120 --json
560+
561+
# Read message content
562+
moemail read --email-id <id> --message-id <id> --json
563+
564+
# Delete email
565+
moemail delete --email-id <id>
566+
```
567+
568+
### Agent Workflow
569+
570+
A typical AI agent verification flow in 3 tool calls:
571+
572+
```bash
573+
# 1. Create mailbox
574+
EMAIL=$(moemail create --domain moemail.app --expiry 1h --json)
575+
EMAIL_ID=$(echo $EMAIL | jq -r '.id')
576+
ADDRESS=$(echo $EMAIL | jq -r '.address')
577+
578+
# 2. Wait for verification email
579+
MSG=$(moemail wait --email-id $EMAIL_ID --timeout 120 --json)
580+
MSG_ID=$(echo $MSG | jq -r '.messageId')
581+
582+
# 3. Read content, extract verification code
583+
CONTENT=$(moemail read --email-id $EMAIL_ID --message-id $MSG_ID --json)
584+
```
585+
586+
For full documentation, see [packages/cli/README.md](packages/cli/README.md).
587+
536588
## Environment Variables
537589

538590
### Authentication

README.zh-CN.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<a href="#发件功能">发件功能</a> •
3030
<a href="#Webhook 集成">Webhook 集成</a> •
3131
<a href="#OpenAPI">OpenAPI</a> •
32+
<a href="#cli-工具">CLI 工具</a> •
3233
<a href="#环境变量">环境变量</a> •
3334
<a href="#Github OAuth App 配置">Github OAuth App 配置</a> •
3435
<a href="#Google OAuth App 配置">Google OAuth App 配置</a> •
@@ -68,6 +69,7 @@
6869
- 🔔 **Webhook 通知**:支持通过 webhook 接收新邮件通知
6970
- 🛡️ **权限系统**:支持基于角色的权限控制系统
7071
- 🔑 **OpenAPI**:支持通过 API Key 访问 OpenAPI
72+
- 🤖 **Agent CLI**:专为 AI Agent 设计的命令行工具,自动化邮箱工作流
7173
- 🌍 **多语言支持**:支持中文和英文界面,可自由切换
7274

7375
## 技术栈
@@ -785,6 +787,56 @@ const data = await res.json();
785787
console.log('分享链接:', `https://your-domain.com/shared/message/${data.token}`);
786788
```
787789

790+
## CLI 工具
791+
792+
MoeMail 提供了专为 AI Agent 设计的命令行工具,用于自动化邮箱工作流。
793+
794+
### 安装
795+
796+
```bash
797+
npm i -g @moemail/cli
798+
```
799+
800+
### 快速上手
801+
802+
```bash
803+
# 配置 API 地址和密钥
804+
moemail config set api-url https://moemail.app
805+
moemail config set api-key YOUR_API_KEY
806+
807+
# 创建临时邮箱
808+
moemail create --domain moemail.app --expiry 1h --json
809+
810+
# 等待新邮件(轮询)
811+
moemail wait --email-id <id> --timeout 120 --json
812+
813+
# 读取邮件内容
814+
moemail read --email-id <id> --message-id <id> --json
815+
816+
# 删除邮箱
817+
moemail delete --email-id <id>
818+
```
819+
820+
### Agent 工作流
821+
822+
AI Agent 仅需 3 次调用即可完成验证流程:
823+
824+
```bash
825+
# 1. 创建邮箱
826+
EMAIL=$(moemail create --domain moemail.app --expiry 1h --json)
827+
EMAIL_ID=$(echo $EMAIL | jq -r '.id')
828+
ADDRESS=$(echo $EMAIL | jq -r '.address')
829+
830+
# 2. 等待验证邮件
831+
MSG=$(moemail wait --email-id $EMAIL_ID --timeout 120 --json)
832+
MSG_ID=$(echo $MSG | jq -r '.messageId')
833+
834+
# 3. 读取内容,提取验证码
835+
CONTENT=$(moemail read --email-id $EMAIL_ID --message-id $MSG_ID --json)
836+
```
837+
838+
详细文档见 [packages/cli/README.md](packages/cli/README.md)
839+
788840
## 环境变量
789841

790842
本项目使用以下环境变量:

packages/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Agent-first CLI for MoeMail temporary email service
55
## Install
66

77
```bash
8-
npm i -g moemail-cli
8+
npm i -g @moemail/cli
99
```
1010

1111
## Quick Start

public/llms.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MoeMail provides disposable email addresses. Install the CLI for programmatic ac
66

77
## CLI Tool
88

9-
Install: npm i -g moemail-cli
9+
Install: npm i -g @moemail/cli
1010

1111
Setup: moemail config set api-url https://moemail.app && moemail config set api-key YOUR_KEY
1212

0 commit comments

Comments
 (0)