@ghostpaw/email 0.4.1 → 0.5.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 CHANGED
@@ -1,11 +1,14 @@
1
+ <a href="https://email.ghostpaw.dev/"><img src="https://raw.githubusercontent.com/GhostPawJS/email/main/.github/social-preview.png" alt="GhostPaw email: Your agent can read the inbox. Sending is a separate tool." width="100%"></a>
2
+
1
3
  # @ghostpaw/email
2
4
 
3
- [![npm](https://img.shields.io/npm/v/@ghostpaw/email)](https://www.npmjs.com/package/@ghostpaw/email)
4
- [![node](https://img.shields.io/node/v/@ghostpaw/email)](https://nodejs.org)
5
- [![license](https://img.shields.io/npm/l/@ghostpaw/email)](LICENSE)
6
- [![dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](package.json)
7
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org)
8
- [![MCP Registry](https://img.shields.io/badge/MCP_Registry-io.github.GhostPawJS%2Femail-06d6a0)](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.GhostPawJS%2Femail/versions/latest)
5
+ [![npm](https://img.shields.io/npm/v/@ghostpaw/email?style=flat-square&labelColor=0a1119&color=62e6f2&label=npm)](https://www.npmjs.com/package/@ghostpaw/email) [![CI](https://img.shields.io/github/actions/workflow/status/GhostPawJS/email/ci.yml?branch=main&style=flat-square&labelColor=0a1119&label=CI)](https://github.com/GhostPawJS/email/actions/workflows/ci.yml) [![site](https://img.shields.io/badge/site-email.ghostpaw.dev-62e6f2?style=flat-square&labelColor=0a1119)](https://email.ghostpaw.dev/) [![runtime deps](https://img.shields.io/badge/runtime_deps-0-7af0b4?style=flat-square&labelColor=0a1119)](package.json) [![MCP Registry](https://img.shields.io/badge/MCP_Registry-io.github.GhostPawJS%2Femail-b39dff?style=flat-square&labelColor=0a1119)](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.GhostPawJS%2Femail/versions/latest) [![node](https://img.shields.io/badge/node-%E2%89%A524-93a5b9?style=flat-square&labelColor=0a1119)](https://nodejs.org) [![license](https://img.shields.io/npm/l/@ghostpaw/email?style=flat-square&labelColor=0a1119&color=93a5b9)](LICENSE)
6
+
7
+ **Agent email: IMAP and SMTP in-process, cached in SQLite, with reading and sending as separate tools.**
8
+
9
+ ```bash
10
+ npm install @ghostpaw/email
11
+ ```
9
12
 
10
13
  A standalone email engine for Node.js, built on SQLite.
11
14
 
@@ -73,6 +76,63 @@ The surface database defaults to `~/.ghostpaw/email.db`; point `--db` at an
73
76
  existing account cache to read it. Each network call opens and closes its IMAP
74
77
  session. Connection commands do not retain a session between calls.
75
78
 
79
+ ## Noun-verb CLI
80
+
81
+ Both `email` and `ghostpaw-email` accept this additive command tree. Existing
82
+ `account`, `read`, `search`, `compose`, `organize` and `sync` commands retain
83
+ their flags, output and exit codes. Use `mail --help` for the new tree and
84
+ `mail <verb> --help` for parameters.
85
+
86
+ ```text
87
+ mail read | search
88
+ mail send | reply | forward | draft | update-draft | send-draft
89
+ mail mark-read | mark-unread | star | unstar | mark-answered
90
+ mail copy | move | archive | trash | junk | not-junk
91
+ mail set-labels | add-labels | remove-labels
92
+ mail create-folder | rename-folder | delete-folder | subscribe-folder | unsubscribe-folder
93
+ mail connect | disconnect | reconnect | sync | refresh-folders | watch
94
+ ```
95
+
96
+ These 33 paths map to the 5 aligned tools. Action verbs set the tool's action;
97
+ `draft` sets `save_draft`. Search accepts its query as a positional argument.
98
+ Other fields use kebab-case flags, such as `--folder INBOX --uids 1 --uids 2`
99
+ and `--input @message.json` for a compose payload. Arrays accept repeated
100
+ flags or JSON; objects accept JSON or `@file`. A single `-` reads stdin JSON;
101
+ explicit flags override stdin fields. `--` ends option parsing.
102
+
103
+ Global flags for the new commands: `--db <path>`, `--json`, `--quiet`,
104
+ `--compact`, `--help`/`-h`, `--version`/`-V`/`-v`, `--no-color`.
105
+ Output is JSON when piped or when `--json` is set. `--quiet` suppresses stdout.
106
+ `completions bash|zsh|fish` prints shell completion setup; `version` prints
107
+ the package version. The existing `tools [--json]`, `describe <tool>`,
108
+ `call <tool> [JSON|-]`, flat `mail_<tool> --parameter value`, `mcp` and `skill`
109
+ forms remain available.
110
+
111
+ | New command exit code | Meaning |
112
+ |---|---|
113
+ | 0 | Success or no-op |
114
+ | 1 | Tool error |
115
+ | 2 | Usage or schema error |
116
+ | 3 | Clarification needed or not found |
117
+ | 4 | Conflict or version mismatch |
118
+ | 70 | Unexpected internal error |
119
+
120
+ Offline examples, run against an empty cache:
121
+
122
+ ```sh
123
+ ghostpaw-email mail search invoice --db /tmp/email-port-example.db --json
124
+ ghostpaw-email mail read --view folders --db /tmp/email-port-example.db --json
125
+ ghostpaw-email mail --help
126
+ ```
127
+
128
+ Search returns 0 matches and folder reads return 0 folders in an empty cache.
129
+ `GHOSTPAW_EMAIL_DB` sets the default cache path, otherwise
130
+ `~/.ghostpaw/email.db` is used. Local search and cached reads need no
131
+ credentials. Network operations use `email account add` configuration or
132
+ `EMAIL_IMAP_HOST`, `EMAIL_SMTP_HOST`, `EMAIL_USER` and `EMAIL_PASS` (or
133
+ `EMAIL_ACCESS_TOKEN`). Each invocation closes its network session;
134
+ `mail connect` does not retain a session for later commands.
135
+
76
136
  ## Tool CLI
77
137
 
78
138
  ```bash
@@ -98,6 +158,74 @@ npx @ghostpaw/email --help # one-off, no install needed
98
158
 
99
159
  Requires **Node.js 24+** (uses the built-in `node:sqlite` module).
100
160
 
161
+ Standalone binaries are available from [GitHub Releases](https://github.com/GhostPawJS/email/releases)
162
+ for linux-x64, linux-arm64, darwin-arm64, darwin-x64 and windows-x64.
163
+
164
+ ```sh
165
+ curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh
166
+ ```
167
+
168
+ ```powershell
169
+ irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
170
+ ```
171
+
172
+ Other release installers:
173
+
174
+ ```sh
175
+ mise use -g github:GhostPawJS/email
176
+ ubi --project GhostPawJS/email --exe ghostpaw-email --in ~/.local/bin
177
+ eget GhostPawJS/email
178
+ ```
179
+
180
+ For [aqua](https://aquaproj.github.io/docs/reference/registry-config/), define a
181
+ `github_release` package in `aqua.yaml`:
182
+
183
+ ```yaml
184
+ registries:
185
+ - name: email
186
+ type: local
187
+ path: email-registry.yaml
188
+ packages:
189
+ - name: GhostPawJS/email@v<VERSION>
190
+ registry: email
191
+ ```
192
+
193
+ `email-registry.yaml`:
194
+
195
+ ```yaml
196
+ packages:
197
+ - type: github_release
198
+ repo_owner: GhostPawJS
199
+ repo_name: email
200
+ asset: ghostpaw-email-{{trimV .Version}}-{{.OS}}-{{.Arch}}.tar.gz
201
+ format: tar.gz
202
+ replacements: { amd64: x64 }
203
+ overrides:
204
+ - goos: windows
205
+ asset: ghostpaw-email-{{trimV .Version}}-windows-{{.Arch}}.zip
206
+ format: zip
207
+ files:
208
+ - name: ghostpaw-email
209
+ ```
210
+
211
+ Install scripts verify SHA256SUMS. To verify a downloaded archive's
212
+ [build attestation](https://cli.github.com/manual/gh_attestation_verify):
213
+
214
+ ```sh
215
+ gh attestation verify <archive> -R GhostPawJS/email
216
+ ```
217
+
218
+ Set `GHOSTPAW_VERIFY=attestation` for attestation verification in `install.sh`.
219
+ Binaries are unsigned; macOS binaries carry an ad-hoc signature. For a browser
220
+ download on macOS, remove quarantine with
221
+ `xattr -d com.apple.quarantine /path/to/ghostpaw-email`.
222
+ Linux binaries require glibc 2.28+; use npx on Alpine.
223
+ See the [binary build workflow](.github/workflows/release-binaries.yml).
224
+
225
+ <!-- sizes -->
226
+
227
+ Release installation is checked on ubuntu-24.04, macos-15 and windows-2025.
228
+
101
229
  ## Quick Start
102
230
 
103
231
  ```ts
@@ -128,6 +256,31 @@ await mailbox.disconnect();
128
256
  `connect()` opens the SQLite database, initialises the schema, upserts the
129
257
  account, and authenticates the IMAP session — one call does everything.
130
258
 
259
+ ## Docs
260
+
261
+ Read the manual for usage guides and the stored email model.
262
+
263
+ - [Overview](https://email.ghostpaw.dev/docs/): what the manual covers and where to start
264
+ - [Human usage](https://email.ghostpaw.dev/docs/human/): using the library directly in code
265
+ - [LLM building blocks](https://email.ghostpaw.dev/docs/llm/): tools, skills and the soul prompt for agents
266
+ - [Accounts](https://email.ghostpaw.dev/docs/entities/accounts/): one email identity and its connection
267
+ - [Folders](https://email.ghostpaw.dev/docs/entities/folders/): cached IMAP mailboxes
268
+ - [Messages](https://email.ghostpaw.dev/docs/entities/messages/): header records per folder and UID
269
+ - [Bodies](https://email.ghostpaw.dev/docs/entities/bodies/): decoded message content
270
+ - [Threads](https://email.ghostpaw.dev/docs/entities/threads/): JWZ conversation trees
271
+ - [Attachments](https://email.ghostpaw.dev/docs/entities/attachments/): cached MIME parts
272
+ - [Sync](https://email.ghostpaw.dev/docs/entities/sync/): the log of each sync pass
273
+
274
+ Repository references:
275
+
276
+ | Document | Audience |
277
+ |---|---|
278
+ | [SKILL.md](SKILL.md) | Agent operators and Claude Code users running `email` as a bash tool |
279
+ | [HUMAN.md](docs/HUMAN.md) | Human developers using the `Mailbox` API with `read` / `write` / `network` |
280
+ | [LLM.md](docs/LLM.md) | Agent builders wiring `soul`, `tools`, and `skills` into LLM systems |
281
+ | [docs/README.md](docs/README.md) | Architecture overview: model, invariants, protocol boundaries, source layout |
282
+ | [docs/entities/](docs/entities/) | Per-entity manuals with schema, operations, and invariants |
283
+
131
284
  ## The Model
132
285
 
133
286
  Seven stored concepts and three derived ones:
@@ -333,16 +486,6 @@ import type {
333
486
  } from '@ghostpaw/email';
334
487
  ```
335
488
 
336
- ## Documentation
337
-
338
- | Document | Audience |
339
- |---|---|
340
- | [SKILL.md](SKILL.md) | Agent operators and Claude Code users running `email` as a bash tool |
341
- | [HUMAN.md](docs/HUMAN.md) | Human developers using the `Mailbox` API with `read` / `write` / `network` |
342
- | [LLM.md](docs/LLM.md) | Agent builders wiring `soul`, `tools`, and `skills` into LLM systems |
343
- | [docs/README.md](docs/README.md) | Architecture overview: model, invariants, protocol boundaries, source layout |
344
- | [docs/entities/](docs/entities/) | Per-entity manuals with schema, operations, and invariants |
345
-
346
489
  ## Development
347
490
 
348
491
  ```bash