mirror of
https://github.com/beilunyang/moemail.git
synced 2026-06-25 17:35:24 +08:00
docs: add CLI section to READMEs and restore @moemail/cli package name
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
52
README.md
52
README.md
@@ -30,6 +30,7 @@
|
||||
<a href="#sending-emails">Sending Emails</a> •
|
||||
<a href="#webhook-integration">Webhook Integration</a> •
|
||||
<a href="#openapi">OpenAPI</a> •
|
||||
<a href="#cli-tool">CLI Tool</a> •
|
||||
<a href="#environment-variables">Environment Variables</a> •
|
||||
<a href="#github-oauth-app-configuration">Github OAuth Config</a> •
|
||||
<a href="#google-oauth-app-configuration">Google OAuth Config</a> •
|
||||
@@ -68,6 +69,7 @@ The documentation site contains detailed usage guides, API documentation, deploy
|
||||
- 🔔 **Webhook Notification**: Support receiving new email notifications via webhook
|
||||
- 🛡️ **Permission System**: Role-based access control system
|
||||
- 🔑 **OpenAPI**: Support accessing OpenAPI via API Key
|
||||
- 🤖 **Agent-first CLI**: CLI tool designed for AI agents to automate email workflows
|
||||
- 🌍 **Multi-language Support**: Supports Chinese and English interfaces, freely switchable
|
||||
|
||||
## Tech Stack
|
||||
@@ -533,6 +535,56 @@ GET /api/emails/{emailId}/messages/{messageId}/share
|
||||
DELETE /api/emails/{emailId}/messages/{messageId}/share/{shareId}
|
||||
```
|
||||
|
||||
## CLI Tool
|
||||
|
||||
MoeMail provides an agent-first CLI tool for AI agents and automation workflows.
|
||||
|
||||
### Install
|
||||
|
||||
```bash
|
||||
npm i -g @moemail/cli
|
||||
```
|
||||
|
||||
### Quick Start
|
||||
|
||||
```bash
|
||||
# Configure API endpoint and key
|
||||
moemail config set api-url https://moemail.app
|
||||
moemail config set api-key YOUR_API_KEY
|
||||
|
||||
# Create temporary email
|
||||
moemail create --domain moemail.app --expiry 1h --json
|
||||
|
||||
# Wait for new messages (polling)
|
||||
moemail wait --email-id <id> --timeout 120 --json
|
||||
|
||||
# Read message content
|
||||
moemail read --email-id <id> --message-id <id> --json
|
||||
|
||||
# Delete email
|
||||
moemail delete --email-id <id>
|
||||
```
|
||||
|
||||
### Agent Workflow
|
||||
|
||||
A typical AI agent verification flow in 3 tool calls:
|
||||
|
||||
```bash
|
||||
# 1. Create mailbox
|
||||
EMAIL=$(moemail create --domain moemail.app --expiry 1h --json)
|
||||
EMAIL_ID=$(echo $EMAIL | jq -r '.id')
|
||||
ADDRESS=$(echo $EMAIL | jq -r '.address')
|
||||
|
||||
# 2. Wait for verification email
|
||||
MSG=$(moemail wait --email-id $EMAIL_ID --timeout 120 --json)
|
||||
MSG_ID=$(echo $MSG | jq -r '.messageId')
|
||||
|
||||
# 3. Read content, extract verification code
|
||||
CONTENT=$(moemail read --email-id $EMAIL_ID --message-id $MSG_ID --json)
|
||||
```
|
||||
|
||||
For full documentation, see [packages/cli/README.md](packages/cli/README.md).
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### Authentication
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<a href="#发件功能">发件功能</a> •
|
||||
<a href="#Webhook 集成">Webhook 集成</a> •
|
||||
<a href="#OpenAPI">OpenAPI</a> •
|
||||
<a href="#cli-工具">CLI 工具</a> •
|
||||
<a href="#环境变量">环境变量</a> •
|
||||
<a href="#Github OAuth App 配置">Github OAuth App 配置</a> •
|
||||
<a href="#Google OAuth App 配置">Google OAuth App 配置</a> •
|
||||
@@ -68,6 +69,7 @@
|
||||
- 🔔 **Webhook 通知**:支持通过 webhook 接收新邮件通知
|
||||
- 🛡️ **权限系统**:支持基于角色的权限控制系统
|
||||
- 🔑 **OpenAPI**:支持通过 API Key 访问 OpenAPI
|
||||
- 🤖 **Agent CLI**:专为 AI Agent 设计的命令行工具,自动化邮箱工作流
|
||||
- 🌍 **多语言支持**:支持中文和英文界面,可自由切换
|
||||
|
||||
## 技术栈
|
||||
@@ -785,6 +787,56 @@ const data = await res.json();
|
||||
console.log('分享链接:', `https://your-domain.com/shared/message/${data.token}`);
|
||||
```
|
||||
|
||||
## CLI 工具
|
||||
|
||||
MoeMail 提供了专为 AI Agent 设计的命令行工具,用于自动化邮箱工作流。
|
||||
|
||||
### 安装
|
||||
|
||||
```bash
|
||||
npm i -g @moemail/cli
|
||||
```
|
||||
|
||||
### 快速上手
|
||||
|
||||
```bash
|
||||
# 配置 API 地址和密钥
|
||||
moemail config set api-url https://moemail.app
|
||||
moemail config set api-key YOUR_API_KEY
|
||||
|
||||
# 创建临时邮箱
|
||||
moemail create --domain moemail.app --expiry 1h --json
|
||||
|
||||
# 等待新邮件(轮询)
|
||||
moemail wait --email-id <id> --timeout 120 --json
|
||||
|
||||
# 读取邮件内容
|
||||
moemail read --email-id <id> --message-id <id> --json
|
||||
|
||||
# 删除邮箱
|
||||
moemail delete --email-id <id>
|
||||
```
|
||||
|
||||
### Agent 工作流
|
||||
|
||||
AI Agent 仅需 3 次调用即可完成验证流程:
|
||||
|
||||
```bash
|
||||
# 1. 创建邮箱
|
||||
EMAIL=$(moemail create --domain moemail.app --expiry 1h --json)
|
||||
EMAIL_ID=$(echo $EMAIL | jq -r '.id')
|
||||
ADDRESS=$(echo $EMAIL | jq -r '.address')
|
||||
|
||||
# 2. 等待验证邮件
|
||||
MSG=$(moemail wait --email-id $EMAIL_ID --timeout 120 --json)
|
||||
MSG_ID=$(echo $MSG | jq -r '.messageId')
|
||||
|
||||
# 3. 读取内容,提取验证码
|
||||
CONTENT=$(moemail read --email-id $EMAIL_ID --message-id $MSG_ID --json)
|
||||
```
|
||||
|
||||
详细文档见 [packages/cli/README.md](packages/cli/README.md)。
|
||||
|
||||
## 环境变量
|
||||
|
||||
本项目使用以下环境变量:
|
||||
|
||||
@@ -5,7 +5,7 @@ Agent-first CLI for MoeMail temporary email service
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm i -g moemail-cli
|
||||
npm i -g @moemail/cli
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -6,7 +6,7 @@ MoeMail provides disposable email addresses. Install the CLI for programmatic ac
|
||||
|
||||
## CLI Tool
|
||||
|
||||
Install: npm i -g moemail-cli
|
||||
Install: npm i -g @moemail/cli
|
||||
|
||||
Setup: moemail config set api-url https://moemail.app && moemail config set api-key YOUR_KEY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user