关于 himalaya
Himalaya Email Workflows 是用于操作 Himalaya 命令行邮件客户端的技能,涵盖邮件、文件夹、标记、附件和模板,并提供脚本处理的 JSON 输出指引。
主要功能
- 01列出并筛选邮件摘要
- 02阅读、撰写、回复和转发邮件
- 03管理文件夹和邮件标记
- 04下载附件并使用模板
- 05生成供脚本处理的 JSON 输出
适用场景
- 01按查询条件筛选未读邮件
- 02通过 JSON 输出自动处理邮件
- 03撰写并发送模板回复
- 04在文件夹间移动或复制邮件
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ factorial-io/ skills --skill himalaya安装后在 Claude Code 中输入/himalaya确认已加载。
详细介绍
Himalaya 邮件工作流
适用于 IMAP/Maildir/Notmuch 后端的命令行邮件客户端。
命令结构
所有命令都遵循以下格式:himalaya <resource> <action>
| 资源 | 操作 |
|---|---|
envelope | list、thread |
message | read、write、reply、forward、copy、move、delete |
folder | list、add、delete、purge、expunge |
flag | add、set、remove |
attachment | download |
template | write、reply、forward、save、send |
快速参考
收件箱分类
重要: 标记必须放在查询筛选条件(如果有)之前。
# List unread/new messages (use --output json for cleaner parsing)
himalaya envelope list --output json 'not flag Seen'
# List all envelopes (default: INBOX)
himalaya envelope list --output json
# List with specific folder and page
himalaya envelope list -f Archive -p 2
# Read message by ID
himalaya message read 123
# Mark as seen
himalaya flag add 123 seen
# Move to folder (TARGET first, then ID)
himalaya message move Archive 123
搜索(查询 DSL)
Himalaya 使用自己的查询 DSL,而非 IMAP SEARCH 语法:
# Filter by date
himalaya envelope list after 2025-01-01
himalaya envelope list before 2025-01-15
himalaya envelope list date 2025-01-10
# Filter by sender/recipient
himalaya envelope list from [email protected]
himalaya envelope list to [email protected]
# Filter by content
himalaya envelope list subject urgent
himalaya envelope list body "project update"
# Filter by flag (use 'not flag Seen' for unread)
himalaya envelope list 'not flag Seen'
himalaya envelope list flag flagged
# Combine with operators
himalaya envelope list from [email protected] and subject urgent
himalaya envelope list "from alice or from bob"
himalaya envelope list not flag seen
# Sort results
himalaya envelope list order by date desc
himalaya envelope list subject report order by from asc
撰写邮件
# New message (opens $EDITOR)
himalaya message write
# Reply / Reply-all
himalaya message reply 123
himalaya message reply 123 --all
# Forward
himalaya message forward 456
附件(MML 语法)
附件应使用邮件正文中的 MML,而非命令行标记:
To: [email protected]
Subject: Files attached
Here is the document.
<#part filename=/path/to/file.pdf><#/part>
Inline image:
<#part disposition=inline filename=/path/to/image.png><#/part>
整理邮件
# List folders
himalaya folder list
# Move message(s) - TARGET folder comes first, then IDs
himalaya message move Archive 123 456
# Copy message(s) - TARGET folder comes first, then IDs
himalaya message copy Backup 123
# Delete (marks as deleted)
himalaya message delete 123
# Expunge (permanent delete)
himalaya folder expunge INBOX
编写脚本
# JSON output for parsing
himalaya envelope list --output json
himalaya envelope list --output json | jq '.[].id'
# Specific account
himalaya envelope list -a work
# Combine for automation
himalaya envelope list --output json 'not flag Seen' | jq -r '.[].id' | while read id
himalaya message read $id
end
常用标记
| 标记 | 说明 |
|---|---|
-a, --account <NAME> | 使用指定账户 |
-f, --folder <NAME> | 目标文件夹(默认:INBOX) |
-o, --output <FORMAT> | plain 或 json(编写脚本/供 AI 解析时优先使用 json) |
-p, --page <N> | 页码(从 1 开始) |
-s, --page-size <N> | 每页结果数 |
注意: 以编程方式解析输出时,始终使用 --output json。纯文本输出包含 WARN 日志消息,会干扰解析。标记必须放在任何查询筛选条件之前。
模板(非交互式)
生成邮件时无需打开 $EDITOR:
# Generate template (stdout)
himalaya template write
himalaya template reply 123
himalaya template forward 456
# Pipe and send
echo "To: [email protected]\nSubject: Hi\n\nHello" | himalaya template send
常见错误
| 错误写法 | 正确写法 | 原因 |
|---|---|---|
himalaya list | himalaya envelope list | 需要资源前缀 |
himalaya read 123 | himalaya message read 123 | 需要资源前缀 |
himalaya write -a file.pdf | 正文中使用 MML <#part> | 不存在 -a 标记 |
--query "FROM x" | from x | 使用 Himalaya DSL,而非 IMAP |
himalaya search ... | himalaya envelope list ... | 没有 search 命令 |
himalaya envelope list 'query' -o json | himalaya envelope list --output json 'query' | 标记必须放在查询之前 |
himalaya message move 123 Folder | himalaya message move Folder 123 | 目标文件夹应放在前面 |
评论
支持 Markdown