@ghostpaw/email 0.5.5 → 0.5.7
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 +37 -2
- package/dist/cli.js +100 -57
- package/dist/mcp-server.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.js +1 -1
- package/package.json +1 -1
- package/skills/email/references/cli.md +2 -0
package/README.md
CHANGED
|
@@ -156,6 +156,8 @@ and print one with `ghostpaw-email skill compose-and-send`.
|
|
|
156
156
|
|
|
157
157
|
Each line downloads the latest release asset, checks it against the release's SHA256SUMS and installs it on the PATH (~/.local/bin on Linux/macOS; the Windows script adds its folder to the user PATH).
|
|
158
158
|
|
|
159
|
+
These lines never edit ~/.profile or other shell startup files: `export PATH` applies to the current shell only. To keep it in new shells, use the `~/.profile` line below.
|
|
160
|
+
|
|
159
161
|
linux-x64:
|
|
160
162
|
|
|
161
163
|
```sh
|
|
@@ -180,17 +182,37 @@ darwin-x64:
|
|
|
180
182
|
curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh -s -- --target darwin-x64 && export PATH="$HOME/.local/bin:$PATH"
|
|
181
183
|
```
|
|
182
184
|
|
|
183
|
-
windows-x64 (PowerShell):
|
|
185
|
+
windows-x64 (PowerShell; persistently adds its folder to the user PATH by default):
|
|
184
186
|
|
|
185
187
|
```powershell
|
|
186
188
|
irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
|
|
187
189
|
```
|
|
188
190
|
|
|
191
|
+
Pinned to a release:
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh -s -- --target linux-x64 --version 0.5.7 && export PATH="$HOME/.local/bin:$PATH"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Also adding ~/.local/bin to ~/.profile (edits ~/.profile once; skipped if it already mentions ~/.local/bin; zsh login shells read ~/.zprofile instead, so use that file name there):
|
|
198
|
+
|
|
199
|
+
```sh
|
|
200
|
+
curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh -s -- --target linux-x64 && { grep -qs '.local/bin' ~/.profile || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.profile; } && export PATH="$HOME/.local/bin:$PATH"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
To skip the persistent user PATH edit (the installer still installs and prints the folder to add):
|
|
204
|
+
|
|
205
|
+
```powershell
|
|
206
|
+
$env:GHOSTPAW_NO_MODIFY_PATH=1; irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
|
|
207
|
+
```
|
|
208
|
+
|
|
189
209
|
```text
|
|
190
210
|
$ ghostpaw-email --version
|
|
191
|
-
email 0.5.
|
|
211
|
+
email 0.5.7 (binary, linux-x64)
|
|
192
212
|
```
|
|
193
213
|
|
|
214
|
+
Scripts that compare versions should use `--version --short` or `--version --json`.
|
|
215
|
+
|
|
194
216
|
A session with the 0.5.1 linux-x64 binary against a local GreenMail test server on 127.0.0.1 (throwaway user, no real account) and a fresh database (output piped through `jq` to keep it short):
|
|
195
217
|
|
|
196
218
|

|
|
@@ -460,6 +482,19 @@ email read queue --json | jq '.entities[].title'
|
|
|
460
482
|
echo "body text" | email compose send --to bob@example.com --subject "Hi"
|
|
461
483
|
```
|
|
462
484
|
|
|
485
|
+
`--attach` (on `compose send` and `compose reply`) takes one or more file
|
|
486
|
+
paths, comma-separated:
|
|
487
|
+
|
|
488
|
+
```bash
|
|
489
|
+
email compose send --to bob@example.com --subject "Report" --body "Attached" \
|
|
490
|
+
--attach ./report.pdf,./data.csv
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Each path must be a regular file. Symlinks are followed to their target;
|
|
494
|
+
directories, devices, FIFOs and sockets are rejected with exit code 1
|
|
495
|
+
(`invalid_flag_value`) before anything is sent. The MIME type comes from the
|
|
496
|
+
file extension (unknown extensions are sent without an explicit type).
|
|
497
|
+
|
|
463
498
|
All commands return the same `{ outcome, summary, entities, nextSteps }`
|
|
464
499
|
shape as the tool layer, with consistent exit codes (0 success, 1 user error,
|
|
465
500
|
2 config, 3 auth, 4 network, 5 tool error).
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,8 @@ import g, { stdin, stdout } from 'node:process';
|
|
|
3
3
|
import f from 'node:readline';
|
|
4
4
|
import * as tty from 'node:tty';
|
|
5
5
|
import { WriteStream } from 'node:tty';
|
|
6
|
-
import {
|
|
6
|
+
import { isSea } from 'node:sea';
|
|
7
|
+
import { mkdirSync, readFileSync, writeFileSync, statSync } from 'node:fs';
|
|
7
8
|
import { homedir } from 'node:os';
|
|
8
9
|
import { sep, dirname, join, basename, extname } from 'node:path';
|
|
9
10
|
import { EventEmitter } from 'node:events';
|
|
@@ -11,7 +12,6 @@ import * as net from 'node:net';
|
|
|
11
12
|
import * as tls from 'node:tls';
|
|
12
13
|
import * as zlib from 'node:zlib';
|
|
13
14
|
import { randomUUID } from 'node:crypto';
|
|
14
|
-
import { isSea } from 'node:sea';
|
|
15
15
|
import { formatWithOptions } from 'node:util';
|
|
16
16
|
|
|
17
17
|
var __defProp = Object.defineProperty;
|
|
@@ -780,12 +780,35 @@ ${e.cyan(d)}
|
|
|
780
780
|
kCancel = /* @__PURE__ */ Symbol.for("cancel");
|
|
781
781
|
}
|
|
782
782
|
});
|
|
783
|
+
function markNpmEntry() {
|
|
784
|
+
npmEntry = true;
|
|
785
|
+
}
|
|
786
|
+
function cliVersion(version, options = {}) {
|
|
787
|
+
let binary = false;
|
|
788
|
+
try {
|
|
789
|
+
binary = (options.isSea ?? isSea)();
|
|
790
|
+
} catch {
|
|
791
|
+
}
|
|
792
|
+
const platform2 = options.platform ?? process.platform;
|
|
793
|
+
const target = `${platform2 === "win32" ? "windows" : platform2}-${options.arch ?? process.arch}`;
|
|
794
|
+
const variant = binary ? "binary" : options.npm ?? npmEntry ? "npm" : "library";
|
|
795
|
+
if (options.args?.includes("--json"))
|
|
796
|
+
return JSON.stringify({ name: "email", version, variant, target });
|
|
797
|
+
if (options.args?.includes("--short")) return version;
|
|
798
|
+
return `email ${version} (${binary ? `binary, ${target}` : options.npm ?? npmEntry ? "npm" : "library"})`;
|
|
799
|
+
}
|
|
800
|
+
var npmEntry;
|
|
801
|
+
var init_cli_version = __esm({
|
|
802
|
+
"src/cli_version.ts"() {
|
|
803
|
+
npmEntry = false;
|
|
804
|
+
}
|
|
805
|
+
});
|
|
783
806
|
|
|
784
807
|
// src/version.ts
|
|
785
808
|
var emailVersion;
|
|
786
809
|
var init_version = __esm({
|
|
787
810
|
"src/version.ts"() {
|
|
788
|
-
emailVersion = "0.5.
|
|
811
|
+
emailVersion = "0.5.7";
|
|
789
812
|
}
|
|
790
813
|
});
|
|
791
814
|
function getConfigDir() {
|
|
@@ -7091,25 +7114,6 @@ var init_write = __esm({
|
|
|
7091
7114
|
init_store();
|
|
7092
7115
|
}
|
|
7093
7116
|
});
|
|
7094
|
-
function markNpmEntry() {
|
|
7095
|
-
npmEntry = true;
|
|
7096
|
-
}
|
|
7097
|
-
function cliVersion(version, options = {}) {
|
|
7098
|
-
let binary = false;
|
|
7099
|
-
try {
|
|
7100
|
-
binary = (options.isSea ?? isSea)();
|
|
7101
|
-
} catch {
|
|
7102
|
-
}
|
|
7103
|
-
const platform2 = options.platform ?? process.platform;
|
|
7104
|
-
const target = `${platform2 === "win32" ? "windows" : platform2}-${options.arch ?? process.arch}`;
|
|
7105
|
-
return `email ${version} (${binary ? `binary, ${target}` : options.npm ?? npmEntry ? "npm" : "library"})`;
|
|
7106
|
-
}
|
|
7107
|
-
var npmEntry;
|
|
7108
|
-
var init_cli_version = __esm({
|
|
7109
|
-
"src/cli_version.ts"() {
|
|
7110
|
-
npmEntry = false;
|
|
7111
|
-
}
|
|
7112
|
-
});
|
|
7113
7117
|
function parseCliArgs(argv2, spec) {
|
|
7114
7118
|
const values = {};
|
|
7115
7119
|
const positions = [];
|
|
@@ -7281,14 +7285,14 @@ async function runCliCommand(argv2, options) {
|
|
|
7281
7285
|
else if (flag === "--compact") compact = true;
|
|
7282
7286
|
else if (flag === "--help" || flag === "-h") help = true;
|
|
7283
7287
|
else if (["--version", "-V", "-v"].includes(flag ?? "")) {
|
|
7284
|
-
if (!quiet) stdout2.write(`${cliVersion(options.version)}
|
|
7288
|
+
if (!quiet) stdout2.write(`${cliVersion(options.version, { args: argv2 })}
|
|
7285
7289
|
`);
|
|
7286
7290
|
return 0;
|
|
7287
7291
|
} else if (flag !== "--no-color") continue;
|
|
7288
7292
|
args.splice(i2--, 1);
|
|
7289
7293
|
}
|
|
7290
7294
|
if (args[0] === "version") {
|
|
7291
|
-
if (!quiet) stdout2.write(`${cliVersion(options.version)}
|
|
7295
|
+
if (!quiet) stdout2.write(`${cliVersion(options.version, { args: argv2 })}
|
|
7292
7296
|
`);
|
|
7293
7297
|
return 0;
|
|
7294
7298
|
}
|
|
@@ -7340,6 +7344,7 @@ ${options.description}
|
|
|
7340
7344
|
Commands:
|
|
7341
7345
|
${matches.map((command) => ` ${command.path}`).join("\n")}
|
|
7342
7346
|
mcp, skill, tools [--json], describe <tool>, call <tool> [JSON|-], completions <bash|zsh|fish>, version
|
|
7347
|
+
Version output: --version --short or --version --json
|
|
7343
7348
|
Global flags: --db <path>, --json, --quiet, --compact, --help/-h, --version/-V/-v, --no-color
|
|
7344
7349
|
`
|
|
7345
7350
|
);
|
|
@@ -7809,6 +7814,8 @@ email compose forward --folder INBOX --uid 1921 --to bob@example.com --body "FYI
|
|
|
7809
7814
|
# Attach files (comma-separated paths)
|
|
7810
7815
|
email compose send --to a@b.com --subject "Report" --body "See attached" \\
|
|
7811
7816
|
--attach /path/to/report.pdf,/path/to/data.csv --json
|
|
7817
|
+
# --attach paths must be regular files (symlinks are followed); directories,
|
|
7818
|
+
# devices, FIFOs and sockets fail with invalid_flag_value before sending.
|
|
7812
7819
|
|
|
7813
7820
|
# Drafts
|
|
7814
7821
|
email compose draft --save --to a@b.com --subject "Draft" --body "WIP" --json
|
|
@@ -10425,6 +10432,7 @@ async function runMain(cmd, opts = {}) {
|
|
|
10425
10432
|
}
|
|
10426
10433
|
|
|
10427
10434
|
// src/cli/index.ts
|
|
10435
|
+
init_cli_version();
|
|
10428
10436
|
init_version();
|
|
10429
10437
|
|
|
10430
10438
|
// src/cli/commands/account.ts
|
|
@@ -10645,6 +10653,59 @@ function getEmailToolByName(name) {
|
|
|
10645
10653
|
|
|
10646
10654
|
// src/cli/commands/compose.ts
|
|
10647
10655
|
init_account();
|
|
10656
|
+
|
|
10657
|
+
// src/cli/attachments.ts
|
|
10658
|
+
init_errors2();
|
|
10659
|
+
function loadAttachments(paths) {
|
|
10660
|
+
const list = paths.split(",").map((p) => p.trim()).filter((p) => p.length > 0);
|
|
10661
|
+
if (list.length === 0) {
|
|
10662
|
+
throw new CliError("invalid_flag_value", "--attach needs at least one file path.");
|
|
10663
|
+
}
|
|
10664
|
+
return list.map((filePath) => {
|
|
10665
|
+
let stat;
|
|
10666
|
+
try {
|
|
10667
|
+
stat = statSync(filePath);
|
|
10668
|
+
} catch {
|
|
10669
|
+
throw new CliError("invalid_flag_value", `--attach: file not found: "${filePath}"`);
|
|
10670
|
+
}
|
|
10671
|
+
if (stat.isDirectory()) {
|
|
10672
|
+
throw new CliError(
|
|
10673
|
+
"invalid_flag_value",
|
|
10674
|
+
`--attach: "${filePath}" is a directory; attach individual files instead.`
|
|
10675
|
+
);
|
|
10676
|
+
}
|
|
10677
|
+
if (!stat.isFile()) {
|
|
10678
|
+
throw new CliError(
|
|
10679
|
+
"invalid_flag_value",
|
|
10680
|
+
`--attach: "${filePath}" is not a regular file (device, FIFO or socket).`
|
|
10681
|
+
);
|
|
10682
|
+
}
|
|
10683
|
+
const content = readFileSync(filePath);
|
|
10684
|
+
const filename = basename(filePath);
|
|
10685
|
+
const mimeType = MIME_MAP[extname(filename).toLowerCase()];
|
|
10686
|
+
return mimeType ? { filename, content, mimeType } : { filename, content };
|
|
10687
|
+
});
|
|
10688
|
+
}
|
|
10689
|
+
var MIME_MAP = {
|
|
10690
|
+
".pdf": "application/pdf",
|
|
10691
|
+
".png": "image/png",
|
|
10692
|
+
".jpg": "image/jpeg",
|
|
10693
|
+
".jpeg": "image/jpeg",
|
|
10694
|
+
".gif": "image/gif",
|
|
10695
|
+
".txt": "text/plain",
|
|
10696
|
+
".html": "text/html",
|
|
10697
|
+
".htm": "text/html",
|
|
10698
|
+
".csv": "text/csv",
|
|
10699
|
+
".json": "application/json",
|
|
10700
|
+
".zip": "application/zip",
|
|
10701
|
+
".xml": "application/xml",
|
|
10702
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
10703
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
10704
|
+
".mp4": "video/mp4",
|
|
10705
|
+
".mp3": "audio/mpeg"
|
|
10706
|
+
};
|
|
10707
|
+
|
|
10708
|
+
// src/cli/commands/compose.ts
|
|
10648
10709
|
init_errors2();
|
|
10649
10710
|
|
|
10650
10711
|
// src/mailbox.ts
|
|
@@ -10836,7 +10897,10 @@ var composeCommand = defineCommand({
|
|
|
10836
10897
|
cc: { type: "string", description: "CC recipient(s), comma-separated" },
|
|
10837
10898
|
bcc: { type: "string", description: "BCC recipient(s), comma-separated" },
|
|
10838
10899
|
from: { type: "string", description: "From address (overrides account identity)" },
|
|
10839
|
-
attach: {
|
|
10900
|
+
attach: {
|
|
10901
|
+
type: "string",
|
|
10902
|
+
description: "Regular file path(s) to attach, comma-separated (directories and special files are rejected)"
|
|
10903
|
+
}
|
|
10840
10904
|
},
|
|
10841
10905
|
async run({ args: _args }) {
|
|
10842
10906
|
const args = _args;
|
|
@@ -10873,7 +10937,10 @@ var composeCommand = defineCommand({
|
|
|
10873
10937
|
to: { type: "string", description: "Override recipient(s)" },
|
|
10874
10938
|
cc: { type: "string", description: "CC recipient(s)" },
|
|
10875
10939
|
"reply-all": { type: "boolean", description: "Reply to all recipients", default: false },
|
|
10876
|
-
attach: {
|
|
10940
|
+
attach: {
|
|
10941
|
+
type: "string",
|
|
10942
|
+
description: "Regular file path(s) to attach, comma-separated (directories and special files are rejected)"
|
|
10943
|
+
}
|
|
10877
10944
|
},
|
|
10878
10945
|
async run({ args: _args }) {
|
|
10879
10946
|
const args = _args;
|
|
@@ -11041,36 +11108,6 @@ function parseUid(raw2) {
|
|
|
11041
11108
|
}
|
|
11042
11109
|
return n3;
|
|
11043
11110
|
}
|
|
11044
|
-
function loadAttachments(paths) {
|
|
11045
|
-
return paths.split(",").map((p) => {
|
|
11046
|
-
const filePath = p.trim();
|
|
11047
|
-
const content = readFileSync(filePath);
|
|
11048
|
-
const filename = basename(filePath);
|
|
11049
|
-
const mimeType = extensionToMime(extname(filename).toLowerCase());
|
|
11050
|
-
return mimeType ? { filename, content, mimeType } : { filename, content };
|
|
11051
|
-
});
|
|
11052
|
-
}
|
|
11053
|
-
var MIME_MAP = {
|
|
11054
|
-
".pdf": "application/pdf",
|
|
11055
|
-
".png": "image/png",
|
|
11056
|
-
".jpg": "image/jpeg",
|
|
11057
|
-
".jpeg": "image/jpeg",
|
|
11058
|
-
".gif": "image/gif",
|
|
11059
|
-
".txt": "text/plain",
|
|
11060
|
-
".html": "text/html",
|
|
11061
|
-
".htm": "text/html",
|
|
11062
|
-
".csv": "text/csv",
|
|
11063
|
-
".json": "application/json",
|
|
11064
|
-
".zip": "application/zip",
|
|
11065
|
-
".xml": "application/xml",
|
|
11066
|
-
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
11067
|
-
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
11068
|
-
".mp4": "video/mp4",
|
|
11069
|
-
".mp3": "audio/mpeg"
|
|
11070
|
-
};
|
|
11071
|
-
function extensionToMime(ext) {
|
|
11072
|
-
return MIME_MAP[ext];
|
|
11073
|
-
}
|
|
11074
11111
|
|
|
11075
11112
|
// src/cli/commands/organize.ts
|
|
11076
11113
|
init_account();
|
|
@@ -11605,7 +11642,7 @@ var main = defineCommand({
|
|
|
11605
11642
|
meta: {
|
|
11606
11643
|
name: "ghostpaw-email",
|
|
11607
11644
|
version: emailVersion,
|
|
11608
|
-
description: "Local-first email CLI powered by @ghostpaw/email
|
|
11645
|
+
description: "Local-first email CLI powered by @ghostpaw/email.\nVersion output: --version --short or --version --json"
|
|
11609
11646
|
},
|
|
11610
11647
|
subCommands: {
|
|
11611
11648
|
mcp: defineCommand({
|
|
@@ -11635,6 +11672,12 @@ async function runEmailCli(args = process.argv.slice(2)) {
|
|
|
11635
11672
|
throw error;
|
|
11636
11673
|
});
|
|
11637
11674
|
}
|
|
11675
|
+
if (args.some((arg) => ["--version", "-V", "-v"].includes(arg))) {
|
|
11676
|
+
process.stdout.write(`${cliVersion(emailVersion, { args })}
|
|
11677
|
+
`);
|
|
11678
|
+
process.exitCode = 0;
|
|
11679
|
+
return;
|
|
11680
|
+
}
|
|
11638
11681
|
let index = 0;
|
|
11639
11682
|
while (index < args.length) {
|
|
11640
11683
|
const token = args[index];
|
package/dist/mcp-server.js
CHANGED
package/dist/mcp.cjs
CHANGED
|
@@ -5007,7 +5007,7 @@ var init_network = __esm({
|
|
|
5007
5007
|
});
|
|
5008
5008
|
|
|
5009
5009
|
// src/version.ts
|
|
5010
|
-
var emailVersion = "0.5.
|
|
5010
|
+
var emailVersion = "0.5.7";
|
|
5011
5011
|
|
|
5012
5012
|
// src/surface/email_mcp_instructions.ts
|
|
5013
5013
|
var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
|
package/dist/mcp.js
CHANGED
|
@@ -4983,7 +4983,7 @@ var init_network = __esm({
|
|
|
4983
4983
|
});
|
|
4984
4984
|
|
|
4985
4985
|
// src/version.ts
|
|
4986
|
-
var emailVersion = "0.5.
|
|
4986
|
+
var emailVersion = "0.5.7";
|
|
4987
4987
|
|
|
4988
4988
|
// src/surface/email_mcp_instructions.ts
|
|
4989
4989
|
var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
|
package/package.json
CHANGED
|
@@ -154,6 +154,8 @@ email compose forward --folder INBOX --uid 1921 --to bob@example.com --body "FYI
|
|
|
154
154
|
# Attach files (comma-separated paths)
|
|
155
155
|
email compose send --to a@b.com --subject "Report" --body "See attached" \
|
|
156
156
|
--attach /path/to/report.pdf,/path/to/data.csv --json
|
|
157
|
+
# --attach paths must be regular files (symlinks are followed); directories,
|
|
158
|
+
# devices, FIFOs and sockets fail with invalid_flag_value before sending.
|
|
157
159
|
|
|
158
160
|
# Drafts
|
|
159
161
|
email compose draft --save --to a@b.com --subject "Draft" --body "WIP" --json
|