@ghostpaw/email 0.5.0 → 0.5.3
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 +17 -1
- package/dist/cli.js +48 -34
- package/dist/index.cjs +14 -17
- package/dist/index.js +14 -17
- package/dist/mcp-server.js +20 -23
- package/dist/mcp.cjs +20 -23
- package/dist/mcp.js +20 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -169,6 +169,12 @@ curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh |
|
|
|
169
169
|
irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
+
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):
|
|
173
|
+
|
|
174
|
+

|
|
175
|
+
|
|
176
|
+
The same session as an [animated GIF](https://raw.githubusercontent.com/GhostPawJS/email/main/docs/assets/cli.gif).
|
|
177
|
+
|
|
172
178
|
Other release installers:
|
|
173
179
|
|
|
174
180
|
```sh
|
|
@@ -222,7 +228,17 @@ download on macOS, remove quarantine with
|
|
|
222
228
|
Linux binaries require glibc 2.28+; use npx on Alpine.
|
|
223
229
|
See the [binary build workflow](.github/workflows/release-binaries.yml).
|
|
224
230
|
|
|
225
|
-
|
|
231
|
+
Sizes for 0.5.1 (Node 26.12.1 inside each binary):
|
|
232
|
+
|
|
233
|
+
| Target | Archive | Binary |
|
|
234
|
+
|---|---|---|
|
|
235
|
+
| linux-x64 | 41.7 MB tar.gz | 117.7 MB |
|
|
236
|
+
| linux-arm64 | 41.2 MB tar.gz | 115.4 MB |
|
|
237
|
+
| darwin-arm64 | 44.9 MB tar.gz | 146.9 MB |
|
|
238
|
+
| darwin-x64 | 46.4 MB tar.gz | 149.8 MB |
|
|
239
|
+
| windows-x64 | 38.5 MB zip | 105.8 MB |
|
|
240
|
+
|
|
241
|
+
The npm package is 1711 KB unpacked and needs Node 24+.
|
|
226
242
|
|
|
227
243
|
Release installation is checked on ubuntu-24.04, macos-15 and windows-2025.
|
|
228
244
|
|
package/dist/cli.js
CHANGED
|
@@ -784,7 +784,7 @@ ${e.cyan(d)}
|
|
|
784
784
|
var emailVersion;
|
|
785
785
|
var init_version = __esm({
|
|
786
786
|
"src/version.ts"() {
|
|
787
|
-
emailVersion = "0.5.
|
|
787
|
+
emailVersion = "0.5.3";
|
|
788
788
|
}
|
|
789
789
|
});
|
|
790
790
|
function getConfigDir() {
|
|
@@ -1132,7 +1132,7 @@ function handleCliError(err) {
|
|
|
1132
1132
|
return {
|
|
1133
1133
|
exitCode: 3,
|
|
1134
1134
|
message: `Authentication failed: ${err.message}`,
|
|
1135
|
-
hint: "Check your credentials with `email account show`."
|
|
1135
|
+
hint: "Check your credentials with `ghostpaw-email account show`."
|
|
1136
1136
|
};
|
|
1137
1137
|
}
|
|
1138
1138
|
if (err instanceof EmailConnectionError || err instanceof EmailTimeoutError) {
|
|
@@ -2008,13 +2008,13 @@ function resolveAccount(name) {
|
|
|
2008
2008
|
"No accounts configured yet.",
|
|
2009
2009
|
"",
|
|
2010
2010
|
"To get started:",
|
|
2011
|
-
" email account add --name work \\",
|
|
2011
|
+
" ghostpaw-email account add --name work \\",
|
|
2012
2012
|
" --imap-host imap.example.com --imap-port 993 \\",
|
|
2013
2013
|
" --smtp-host smtp.example.com --smtp-port 587 \\",
|
|
2014
2014
|
" --user you@example.com --pass yourpassword",
|
|
2015
2015
|
"",
|
|
2016
2016
|
"Or set environment variables for one-off use:",
|
|
2017
|
-
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... email sync connect"
|
|
2017
|
+
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... ghostpaw-email sync connect"
|
|
2018
2018
|
].join("\n")
|
|
2019
2019
|
);
|
|
2020
2020
|
}
|
|
@@ -2022,14 +2022,14 @@ function resolveAccount(name) {
|
|
|
2022
2022
|
if (!targetSlug) {
|
|
2023
2023
|
throw new CliError(
|
|
2024
2024
|
"no_default_account",
|
|
2025
|
-
"No default account set. Use --account <name> or run `email account set-default --name <name>`."
|
|
2025
|
+
"No default account set. Use --account <name> or run `ghostpaw-email account set-default --name <name>`."
|
|
2026
2026
|
);
|
|
2027
2027
|
}
|
|
2028
2028
|
const account = file.accounts.find((a2) => a2.name === targetSlug);
|
|
2029
2029
|
if (!account) {
|
|
2030
2030
|
throw new CliError(
|
|
2031
2031
|
"account_not_found",
|
|
2032
|
-
`Account "${targetSlug}" not found. Use \`email account list\` to see configured accounts.`
|
|
2032
|
+
`Account "${targetSlug}" not found. Use \`ghostpaw-email account list\` to see configured accounts.`
|
|
2033
2033
|
);
|
|
2034
2034
|
}
|
|
2035
2035
|
return applyEnvOverrides(account);
|
|
@@ -5639,6 +5639,15 @@ function createNetworkSurface(db, options) {
|
|
|
5639
5639
|
}
|
|
5640
5640
|
return session;
|
|
5641
5641
|
}
|
|
5642
|
+
async function pullFolders(s4) {
|
|
5643
|
+
const result = [];
|
|
5644
|
+
for (const f3 of await s4.listFolders()) {
|
|
5645
|
+
result.push(
|
|
5646
|
+
upsertFolder(db, { accountId, path: f3.path, delimiter: f3.delimiter, role: f3.role })
|
|
5647
|
+
);
|
|
5648
|
+
}
|
|
5649
|
+
return result;
|
|
5650
|
+
}
|
|
5642
5651
|
return {
|
|
5643
5652
|
connect: async () => {
|
|
5644
5653
|
await requireSession().connect();
|
|
@@ -5670,7 +5679,8 @@ function createNetworkSurface(db, options) {
|
|
|
5670
5679
|
},
|
|
5671
5680
|
sync: async (syncOptions) => {
|
|
5672
5681
|
const s4 = requireSession();
|
|
5673
|
-
|
|
5682
|
+
let folders = listFolders2(db, accountId);
|
|
5683
|
+
if (!folders.length) folders = await pullFolders(s4);
|
|
5674
5684
|
const results = [];
|
|
5675
5685
|
let totalNew = 0;
|
|
5676
5686
|
let totalExpunged = 0;
|
|
@@ -5709,21 +5719,7 @@ function createNetworkSurface(db, options) {
|
|
|
5709
5719
|
}
|
|
5710
5720
|
}
|
|
5711
5721
|
},
|
|
5712
|
-
refreshFolders: async () =>
|
|
5713
|
-
const s4 = requireSession();
|
|
5714
|
-
const imapFolders = await s4.listFolders();
|
|
5715
|
-
const result = [];
|
|
5716
|
-
for (const f3 of imapFolders) {
|
|
5717
|
-
const upserted = upsertFolder(db, {
|
|
5718
|
-
accountId,
|
|
5719
|
-
path: f3.path,
|
|
5720
|
-
delimiter: f3.delimiter,
|
|
5721
|
-
role: f3.role
|
|
5722
|
-
});
|
|
5723
|
-
result.push(upserted);
|
|
5724
|
-
}
|
|
5725
|
-
return result;
|
|
5726
|
-
},
|
|
5722
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
5727
5723
|
searchRemote: async (folder, query) => {
|
|
5728
5724
|
const s4 = requireSession();
|
|
5729
5725
|
if (s4.selectedFolder !== folder) {
|
|
@@ -6682,7 +6678,8 @@ function createWriteSurface(db, options) {
|
|
|
6682
6678
|
async function sendComposed(composed) {
|
|
6683
6679
|
const raw2 = composed.toString("utf8");
|
|
6684
6680
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
6685
|
-
const
|
|
6681
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
6682
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
6686
6683
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
6687
6684
|
const toAddrs = toMatch.flatMap(
|
|
6688
6685
|
(m2) => (m2[1] ?? "").split(",").map((a2) => (a2.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a2).trim())
|
|
@@ -6939,7 +6936,7 @@ function parseCliArgs(argv2, spec) {
|
|
|
6939
6936
|
if (arg.type === "boolean" && raw2 === void 0) raw2 = negative ? "false" : "true";
|
|
6940
6937
|
if (raw2 === void 0) {
|
|
6941
6938
|
const next = argv2[i2 + 1];
|
|
6942
|
-
if (next === void 0 ||
|
|
6939
|
+
if (next === void 0 || /^--[a-z]/i.test(next))
|
|
6943
6940
|
throw new CliUsageError(`Missing value: --${arg.name}`);
|
|
6944
6941
|
raw2 = next;
|
|
6945
6942
|
i2++;
|
|
@@ -7496,7 +7493,7 @@ var init_email_surface_tools = __esm({
|
|
|
7496
7493
|
next: [
|
|
7497
7494
|
{
|
|
7498
7495
|
kind: "use_tool",
|
|
7499
|
-
message: "Configure an account with email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
7496
|
+
message: "Configure an account with ghostpaw-email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
7500
7497
|
}
|
|
7501
7498
|
],
|
|
7502
7499
|
data: { entities: [] }
|
|
@@ -8311,7 +8308,15 @@ var init_email_cli_options = __esm({
|
|
|
8311
8308
|
openContext: async (options) => {
|
|
8312
8309
|
const { openEmailDb: openEmailDb2 } = await Promise.resolve().then(() => (init_open_email_db(), open_email_db_exports));
|
|
8313
8310
|
const { resolveEmailDbPath: resolveEmailDbPath2 } = await Promise.resolve().then(() => (init_resolve_email_db_path(), resolve_email_db_path_exports));
|
|
8314
|
-
|
|
8311
|
+
let path = options.db ?? process.env.GHOSTPAW_EMAIL_DB;
|
|
8312
|
+
if (path === void 0) {
|
|
8313
|
+
const { resolveAccount: resolveAccount2, buildEmailConfig: buildEmailConfig2 } = await Promise.resolve().then(() => (init_account(), account_exports));
|
|
8314
|
+
try {
|
|
8315
|
+
path = buildEmailConfig2(resolveAccount2()).storage;
|
|
8316
|
+
} catch {
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8319
|
+
return openEmailDb2(resolveEmailDbPath2(path === void 0 ? {} : { flag: path }));
|
|
8315
8320
|
},
|
|
8316
8321
|
closeContext: (db) => db.close(),
|
|
8317
8322
|
commands: {
|
|
@@ -9878,7 +9883,7 @@ var accountCommand = defineCommand({
|
|
|
9878
9883
|
await safeRun({}, async () => {
|
|
9879
9884
|
const file = loadAccounts();
|
|
9880
9885
|
if (!file || file.accounts.length === 0) {
|
|
9881
|
-
print("No accounts configured. Run `email account add` to get started.");
|
|
9886
|
+
print("No accounts configured. Run `ghostpaw-email account add` to get started.");
|
|
9882
9887
|
return;
|
|
9883
9888
|
}
|
|
9884
9889
|
print("");
|
|
@@ -9907,14 +9912,14 @@ var accountCommand = defineCommand({
|
|
|
9907
9912
|
"imap-port": { type: "string", description: "IMAP port (default: 993)", default: "993" },
|
|
9908
9913
|
"imap-tls": {
|
|
9909
9914
|
type: "boolean",
|
|
9910
|
-
description: "
|
|
9915
|
+
description: "Disable TLS for IMAP (TLS is on by default)",
|
|
9911
9916
|
default: true
|
|
9912
9917
|
},
|
|
9913
9918
|
"smtp-host": { type: "string", description: "SMTP hostname", required: true },
|
|
9914
9919
|
"smtp-port": { type: "string", description: "SMTP port (default: 587)", default: "587" },
|
|
9915
9920
|
"smtp-tls": {
|
|
9916
9921
|
type: "boolean",
|
|
9917
|
-
description: "
|
|
9922
|
+
description: "Disable TLS for SMTP (TLS is on by default)",
|
|
9918
9923
|
default: true
|
|
9919
9924
|
},
|
|
9920
9925
|
user: { type: "string", description: "Auth username / email address", required: true },
|
|
@@ -9971,7 +9976,7 @@ var accountCommand = defineCommand({
|
|
|
9971
9976
|
if (existing?.accounts.some((a2) => a2.name === name)) {
|
|
9972
9977
|
throw new CliError(
|
|
9973
9978
|
"account_invalid",
|
|
9974
|
-
`Account "${name}" already exists. Use \`email account remove --name ${name}\` first.`
|
|
9979
|
+
`Account "${name}" already exists. Use \`ghostpaw-email account remove --name ${name}\` first.`
|
|
9975
9980
|
);
|
|
9976
9981
|
}
|
|
9977
9982
|
const file = existing ?? { version: 1, default: null, accounts: [] };
|
|
@@ -10866,7 +10871,10 @@ var readCommand = defineCommand({
|
|
|
10866
10871
|
`Unknown view: "${view}". Valid views: folders, queue, thread, message, attachment, eml`
|
|
10867
10872
|
);
|
|
10868
10873
|
}
|
|
10869
|
-
const result = await withMailbox(account, (ctx) =>
|
|
10874
|
+
const result = await withMailbox(account, async (ctx) => {
|
|
10875
|
+
const result2 = await readTool.handler(ctx, toolInput);
|
|
10876
|
+
return opts.json && toolInput.view === "message" && result2.outcome === "success" ? { ...result2, data: await ctx.read.getMessage(toolInput.folder, toolInput.uid) } : result2;
|
|
10877
|
+
});
|
|
10870
10878
|
renderResult(result, opts);
|
|
10871
10879
|
});
|
|
10872
10880
|
}
|
|
@@ -10876,7 +10884,7 @@ function requireFlag(value, flag, view) {
|
|
|
10876
10884
|
throw new CliError(
|
|
10877
10885
|
"missing_required_flag",
|
|
10878
10886
|
`${flag} is required for view: ${view}
|
|
10879
|
-
Usage: email read ${view} ${flag} <value>`
|
|
10887
|
+
Usage: ghostpaw-email read ${view} ${flag} <value>`
|
|
10880
10888
|
);
|
|
10881
10889
|
}
|
|
10882
10890
|
}
|
|
@@ -10931,7 +10939,7 @@ var searchCommand = defineCommand({
|
|
|
10931
10939
|
if (!query)
|
|
10932
10940
|
throw new CliError(
|
|
10933
10941
|
"missing_required_flag",
|
|
10934
|
-
"<query> is required.\nUsage: email search <query>"
|
|
10942
|
+
"<query> is required.\nUsage: ghostpaw-email search <query>"
|
|
10935
10943
|
);
|
|
10936
10944
|
const mode = args.mode ?? "local";
|
|
10937
10945
|
if (mode !== "local" && mode !== "remote") {
|
|
@@ -11035,7 +11043,7 @@ var syncCommand = defineCommand({
|
|
|
11035
11043
|
// src/cli/index.ts
|
|
11036
11044
|
var main = defineCommand({
|
|
11037
11045
|
meta: {
|
|
11038
|
-
name: "email",
|
|
11046
|
+
name: "ghostpaw-email",
|
|
11039
11047
|
version: emailVersion,
|
|
11040
11048
|
description: "Local-first email CLI powered by @ghostpaw/email."
|
|
11041
11049
|
},
|
|
@@ -11061,6 +11069,12 @@ var main = defineCommand({
|
|
|
11061
11069
|
}
|
|
11062
11070
|
});
|
|
11063
11071
|
async function runEmailCli(args = process.argv.slice(2)) {
|
|
11072
|
+
for (const stream of [process.stdout, process.stderr]) {
|
|
11073
|
+
stream.on("error", (error) => {
|
|
11074
|
+
if (error.code === "EPIPE") process.exit(0);
|
|
11075
|
+
throw error;
|
|
11076
|
+
});
|
|
11077
|
+
}
|
|
11064
11078
|
let index = 0;
|
|
11065
11079
|
while (index < args.length) {
|
|
11066
11080
|
const token = args[index];
|
package/dist/index.cjs
CHANGED
|
@@ -3514,6 +3514,15 @@ function createNetworkSurface(db, options) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
return session;
|
|
3516
3516
|
}
|
|
3517
|
+
async function pullFolders(s3) {
|
|
3518
|
+
const result = [];
|
|
3519
|
+
for (const f of await s3.listFolders()) {
|
|
3520
|
+
result.push(
|
|
3521
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
3522
|
+
);
|
|
3523
|
+
}
|
|
3524
|
+
return result;
|
|
3525
|
+
}
|
|
3517
3526
|
return {
|
|
3518
3527
|
connect: async () => {
|
|
3519
3528
|
await requireSession().connect();
|
|
@@ -3545,7 +3554,8 @@ function createNetworkSurface(db, options) {
|
|
|
3545
3554
|
},
|
|
3546
3555
|
sync: async (syncOptions) => {
|
|
3547
3556
|
const s3 = requireSession();
|
|
3548
|
-
|
|
3557
|
+
let folders = listFolders2(db, accountId);
|
|
3558
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
3549
3559
|
const results = [];
|
|
3550
3560
|
let totalNew = 0;
|
|
3551
3561
|
let totalExpunged = 0;
|
|
@@ -3584,21 +3594,7 @@ function createNetworkSurface(db, options) {
|
|
|
3584
3594
|
}
|
|
3585
3595
|
}
|
|
3586
3596
|
},
|
|
3587
|
-
refreshFolders: async () =>
|
|
3588
|
-
const s3 = requireSession();
|
|
3589
|
-
const imapFolders = await s3.listFolders();
|
|
3590
|
-
const result = [];
|
|
3591
|
-
for (const f of imapFolders) {
|
|
3592
|
-
const upserted = upsertFolder(db, {
|
|
3593
|
-
accountId,
|
|
3594
|
-
path: f.path,
|
|
3595
|
-
delimiter: f.delimiter,
|
|
3596
|
-
role: f.role
|
|
3597
|
-
});
|
|
3598
|
-
result.push(upserted);
|
|
3599
|
-
}
|
|
3600
|
-
return result;
|
|
3601
|
-
},
|
|
3597
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
3602
3598
|
searchRemote: async (folder, query) => {
|
|
3603
3599
|
const s3 = requireSession();
|
|
3604
3600
|
if (s3.selectedFolder !== folder) {
|
|
@@ -4474,7 +4470,8 @@ function createWriteSurface(db, options) {
|
|
|
4474
4470
|
async function sendComposed(composed) {
|
|
4475
4471
|
const raw2 = composed.toString("utf8");
|
|
4476
4472
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
4477
|
-
const
|
|
4473
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
4474
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
4478
4475
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
4479
4476
|
const toAddrs = toMatch.flatMap(
|
|
4480
4477
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
package/dist/index.js
CHANGED
|
@@ -3490,6 +3490,15 @@ function createNetworkSurface(db, options) {
|
|
|
3490
3490
|
}
|
|
3491
3491
|
return session;
|
|
3492
3492
|
}
|
|
3493
|
+
async function pullFolders(s3) {
|
|
3494
|
+
const result = [];
|
|
3495
|
+
for (const f of await s3.listFolders()) {
|
|
3496
|
+
result.push(
|
|
3497
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
3498
|
+
);
|
|
3499
|
+
}
|
|
3500
|
+
return result;
|
|
3501
|
+
}
|
|
3493
3502
|
return {
|
|
3494
3503
|
connect: async () => {
|
|
3495
3504
|
await requireSession().connect();
|
|
@@ -3521,7 +3530,8 @@ function createNetworkSurface(db, options) {
|
|
|
3521
3530
|
},
|
|
3522
3531
|
sync: async (syncOptions) => {
|
|
3523
3532
|
const s3 = requireSession();
|
|
3524
|
-
|
|
3533
|
+
let folders = listFolders2(db, accountId);
|
|
3534
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
3525
3535
|
const results = [];
|
|
3526
3536
|
let totalNew = 0;
|
|
3527
3537
|
let totalExpunged = 0;
|
|
@@ -3560,21 +3570,7 @@ function createNetworkSurface(db, options) {
|
|
|
3560
3570
|
}
|
|
3561
3571
|
}
|
|
3562
3572
|
},
|
|
3563
|
-
refreshFolders: async () =>
|
|
3564
|
-
const s3 = requireSession();
|
|
3565
|
-
const imapFolders = await s3.listFolders();
|
|
3566
|
-
const result = [];
|
|
3567
|
-
for (const f of imapFolders) {
|
|
3568
|
-
const upserted = upsertFolder(db, {
|
|
3569
|
-
accountId,
|
|
3570
|
-
path: f.path,
|
|
3571
|
-
delimiter: f.delimiter,
|
|
3572
|
-
role: f.role
|
|
3573
|
-
});
|
|
3574
|
-
result.push(upserted);
|
|
3575
|
-
}
|
|
3576
|
-
return result;
|
|
3577
|
-
},
|
|
3573
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
3578
3574
|
searchRemote: async (folder, query) => {
|
|
3579
3575
|
const s3 = requireSession();
|
|
3580
3576
|
if (s3.selectedFolder !== folder) {
|
|
@@ -4450,7 +4446,8 @@ function createWriteSurface(db, options) {
|
|
|
4450
4446
|
async function sendComposed(composed) {
|
|
4451
4447
|
const raw2 = composed.toString("utf8");
|
|
4452
4448
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
4453
|
-
const
|
|
4449
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
4450
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
4454
4451
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
4455
4452
|
const toAddrs = toMatch.flatMap(
|
|
4456
4453
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
package/dist/mcp-server.js
CHANGED
|
@@ -256,7 +256,7 @@ var init_mcp_stdio = __esm({
|
|
|
256
256
|
var emailVersion;
|
|
257
257
|
var init_version = __esm({
|
|
258
258
|
"src/version.ts"() {
|
|
259
|
-
emailVersion = "0.5.
|
|
259
|
+
emailVersion = "0.5.3";
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
|
|
@@ -2148,13 +2148,13 @@ function resolveAccount(name) {
|
|
|
2148
2148
|
"No accounts configured yet.",
|
|
2149
2149
|
"",
|
|
2150
2150
|
"To get started:",
|
|
2151
|
-
" email account add --name work \\",
|
|
2151
|
+
" ghostpaw-email account add --name work \\",
|
|
2152
2152
|
" --imap-host imap.example.com --imap-port 993 \\",
|
|
2153
2153
|
" --smtp-host smtp.example.com --smtp-port 587 \\",
|
|
2154
2154
|
" --user you@example.com --pass yourpassword",
|
|
2155
2155
|
"",
|
|
2156
2156
|
"Or set environment variables for one-off use:",
|
|
2157
|
-
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... email sync connect"
|
|
2157
|
+
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... ghostpaw-email sync connect"
|
|
2158
2158
|
].join("\n")
|
|
2159
2159
|
);
|
|
2160
2160
|
}
|
|
@@ -2162,14 +2162,14 @@ function resolveAccount(name) {
|
|
|
2162
2162
|
if (!targetSlug) {
|
|
2163
2163
|
throw new CliError(
|
|
2164
2164
|
"no_default_account",
|
|
2165
|
-
"No default account set. Use --account <name> or run `email account set-default --name <name>`."
|
|
2165
|
+
"No default account set. Use --account <name> or run `ghostpaw-email account set-default --name <name>`."
|
|
2166
2166
|
);
|
|
2167
2167
|
}
|
|
2168
2168
|
const account = file.accounts.find((a) => a.name === targetSlug);
|
|
2169
2169
|
if (!account) {
|
|
2170
2170
|
throw new CliError(
|
|
2171
2171
|
"account_not_found",
|
|
2172
|
-
`Account "${targetSlug}" not found. Use \`email account list\` to see configured accounts.`
|
|
2172
|
+
`Account "${targetSlug}" not found. Use \`ghostpaw-email account list\` to see configured accounts.`
|
|
2173
2173
|
);
|
|
2174
2174
|
}
|
|
2175
2175
|
return applyEnvOverrides(account);
|
|
@@ -4616,7 +4616,8 @@ function createWriteSurface(db, options) {
|
|
|
4616
4616
|
async function sendComposed(composed) {
|
|
4617
4617
|
const raw2 = composed.toString("utf8");
|
|
4618
4618
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
4619
|
-
const
|
|
4619
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
4620
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
4620
4621
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
4621
4622
|
const toAddrs = toMatch.flatMap(
|
|
4622
4623
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
|
@@ -5942,6 +5943,15 @@ function createNetworkSurface(db, options) {
|
|
|
5942
5943
|
}
|
|
5943
5944
|
return session;
|
|
5944
5945
|
}
|
|
5946
|
+
async function pullFolders(s3) {
|
|
5947
|
+
const result = [];
|
|
5948
|
+
for (const f of await s3.listFolders()) {
|
|
5949
|
+
result.push(
|
|
5950
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
5951
|
+
);
|
|
5952
|
+
}
|
|
5953
|
+
return result;
|
|
5954
|
+
}
|
|
5945
5955
|
return {
|
|
5946
5956
|
connect: async () => {
|
|
5947
5957
|
await requireSession().connect();
|
|
@@ -5973,7 +5983,8 @@ function createNetworkSurface(db, options) {
|
|
|
5973
5983
|
},
|
|
5974
5984
|
sync: async (syncOptions) => {
|
|
5975
5985
|
const s3 = requireSession();
|
|
5976
|
-
|
|
5986
|
+
let folders = listFolders(db, accountId);
|
|
5987
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
5977
5988
|
const results = [];
|
|
5978
5989
|
let totalNew = 0;
|
|
5979
5990
|
let totalExpunged = 0;
|
|
@@ -6012,21 +6023,7 @@ function createNetworkSurface(db, options) {
|
|
|
6012
6023
|
}
|
|
6013
6024
|
}
|
|
6014
6025
|
},
|
|
6015
|
-
refreshFolders: async () =>
|
|
6016
|
-
const s3 = requireSession();
|
|
6017
|
-
const imapFolders = await s3.listFolders();
|
|
6018
|
-
const result = [];
|
|
6019
|
-
for (const f of imapFolders) {
|
|
6020
|
-
const upserted = upsertFolder(db, {
|
|
6021
|
-
accountId,
|
|
6022
|
-
path: f.path,
|
|
6023
|
-
delimiter: f.delimiter,
|
|
6024
|
-
role: f.role
|
|
6025
|
-
});
|
|
6026
|
-
result.push(upserted);
|
|
6027
|
-
}
|
|
6028
|
-
return result;
|
|
6029
|
-
},
|
|
6026
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
6030
6027
|
searchRemote: async (folder, query) => {
|
|
6031
6028
|
const s3 = requireSession();
|
|
6032
6029
|
if (s3.selectedFolder !== folder) {
|
|
@@ -6139,7 +6136,7 @@ var init_email_surface_tools = __esm({
|
|
|
6139
6136
|
next: [
|
|
6140
6137
|
{
|
|
6141
6138
|
kind: "use_tool",
|
|
6142
|
-
message: "Configure an account with email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
6139
|
+
message: "Configure an account with ghostpaw-email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
6143
6140
|
}
|
|
6144
6141
|
],
|
|
6145
6142
|
data: { entities: [] }
|
package/dist/mcp.cjs
CHANGED
|
@@ -1073,13 +1073,13 @@ function resolveAccount(name) {
|
|
|
1073
1073
|
"No accounts configured yet.",
|
|
1074
1074
|
"",
|
|
1075
1075
|
"To get started:",
|
|
1076
|
-
" email account add --name work \\",
|
|
1076
|
+
" ghostpaw-email account add --name work \\",
|
|
1077
1077
|
" --imap-host imap.example.com --imap-port 993 \\",
|
|
1078
1078
|
" --smtp-host smtp.example.com --smtp-port 587 \\",
|
|
1079
1079
|
" --user you@example.com --pass yourpassword",
|
|
1080
1080
|
"",
|
|
1081
1081
|
"Or set environment variables for one-off use:",
|
|
1082
|
-
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... email sync connect"
|
|
1082
|
+
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... ghostpaw-email sync connect"
|
|
1083
1083
|
].join("\n")
|
|
1084
1084
|
);
|
|
1085
1085
|
}
|
|
@@ -1087,14 +1087,14 @@ function resolveAccount(name) {
|
|
|
1087
1087
|
if (!targetSlug) {
|
|
1088
1088
|
throw new CliError(
|
|
1089
1089
|
"no_default_account",
|
|
1090
|
-
"No default account set. Use --account <name> or run `email account set-default --name <name>`."
|
|
1090
|
+
"No default account set. Use --account <name> or run `ghostpaw-email account set-default --name <name>`."
|
|
1091
1091
|
);
|
|
1092
1092
|
}
|
|
1093
1093
|
const account = file.accounts.find((a) => a.name === targetSlug);
|
|
1094
1094
|
if (!account) {
|
|
1095
1095
|
throw new CliError(
|
|
1096
1096
|
"account_not_found",
|
|
1097
|
-
`Account "${targetSlug}" not found. Use \`email account list\` to see configured accounts.`
|
|
1097
|
+
`Account "${targetSlug}" not found. Use \`ghostpaw-email account list\` to see configured accounts.`
|
|
1098
1098
|
);
|
|
1099
1099
|
}
|
|
1100
1100
|
return applyEnvOverrides(account);
|
|
@@ -3541,7 +3541,8 @@ function createWriteSurface(db, options) {
|
|
|
3541
3541
|
async function sendComposed(composed) {
|
|
3542
3542
|
const raw2 = composed.toString("utf8");
|
|
3543
3543
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
3544
|
-
const
|
|
3544
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
3545
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
3545
3546
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
3546
3547
|
const toAddrs = toMatch.flatMap(
|
|
3547
3548
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
|
@@ -4867,6 +4868,15 @@ function createNetworkSurface(db, options) {
|
|
|
4867
4868
|
}
|
|
4868
4869
|
return session;
|
|
4869
4870
|
}
|
|
4871
|
+
async function pullFolders(s3) {
|
|
4872
|
+
const result = [];
|
|
4873
|
+
for (const f of await s3.listFolders()) {
|
|
4874
|
+
result.push(
|
|
4875
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
4876
|
+
);
|
|
4877
|
+
}
|
|
4878
|
+
return result;
|
|
4879
|
+
}
|
|
4870
4880
|
return {
|
|
4871
4881
|
connect: async () => {
|
|
4872
4882
|
await requireSession().connect();
|
|
@@ -4898,7 +4908,8 @@ function createNetworkSurface(db, options) {
|
|
|
4898
4908
|
},
|
|
4899
4909
|
sync: async (syncOptions) => {
|
|
4900
4910
|
const s3 = requireSession();
|
|
4901
|
-
|
|
4911
|
+
let folders = listFolders(db, accountId);
|
|
4912
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
4902
4913
|
const results = [];
|
|
4903
4914
|
let totalNew = 0;
|
|
4904
4915
|
let totalExpunged = 0;
|
|
@@ -4937,21 +4948,7 @@ function createNetworkSurface(db, options) {
|
|
|
4937
4948
|
}
|
|
4938
4949
|
}
|
|
4939
4950
|
},
|
|
4940
|
-
refreshFolders: async () =>
|
|
4941
|
-
const s3 = requireSession();
|
|
4942
|
-
const imapFolders = await s3.listFolders();
|
|
4943
|
-
const result = [];
|
|
4944
|
-
for (const f of imapFolders) {
|
|
4945
|
-
const upserted = upsertFolder(db, {
|
|
4946
|
-
accountId,
|
|
4947
|
-
path: f.path,
|
|
4948
|
-
delimiter: f.delimiter,
|
|
4949
|
-
role: f.role
|
|
4950
|
-
});
|
|
4951
|
-
result.push(upserted);
|
|
4952
|
-
}
|
|
4953
|
-
return result;
|
|
4954
|
-
},
|
|
4951
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
4955
4952
|
searchRemote: async (folder, query) => {
|
|
4956
4953
|
const s3 = requireSession();
|
|
4957
4954
|
if (s3.selectedFolder !== folder) {
|
|
@@ -5010,7 +5007,7 @@ var init_network = __esm({
|
|
|
5010
5007
|
});
|
|
5011
5008
|
|
|
5012
5009
|
// src/version.ts
|
|
5013
|
-
var emailVersion = "0.5.
|
|
5010
|
+
var emailVersion = "0.5.3";
|
|
5014
5011
|
|
|
5015
5012
|
// src/surface/email_mcp_instructions.ts
|
|
5016
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.";
|
|
@@ -5905,7 +5902,7 @@ var emailMcpTools = emailTools2.map((tool) => ({
|
|
|
5905
5902
|
next: [
|
|
5906
5903
|
{
|
|
5907
5904
|
kind: "use_tool",
|
|
5908
|
-
message: "Configure an account with email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
5905
|
+
message: "Configure an account with ghostpaw-email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
5909
5906
|
}
|
|
5910
5907
|
],
|
|
5911
5908
|
data: { entities: [] }
|
package/dist/mcp.js
CHANGED
|
@@ -1049,13 +1049,13 @@ function resolveAccount(name) {
|
|
|
1049
1049
|
"No accounts configured yet.",
|
|
1050
1050
|
"",
|
|
1051
1051
|
"To get started:",
|
|
1052
|
-
" email account add --name work \\",
|
|
1052
|
+
" ghostpaw-email account add --name work \\",
|
|
1053
1053
|
" --imap-host imap.example.com --imap-port 993 \\",
|
|
1054
1054
|
" --smtp-host smtp.example.com --smtp-port 587 \\",
|
|
1055
1055
|
" --user you@example.com --pass yourpassword",
|
|
1056
1056
|
"",
|
|
1057
1057
|
"Or set environment variables for one-off use:",
|
|
1058
|
-
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... email sync connect"
|
|
1058
|
+
" EMAIL_IMAP_HOST=... EMAIL_SMTP_HOST=... EMAIL_USER=... EMAIL_PASS=... ghostpaw-email sync connect"
|
|
1059
1059
|
].join("\n")
|
|
1060
1060
|
);
|
|
1061
1061
|
}
|
|
@@ -1063,14 +1063,14 @@ function resolveAccount(name) {
|
|
|
1063
1063
|
if (!targetSlug) {
|
|
1064
1064
|
throw new CliError(
|
|
1065
1065
|
"no_default_account",
|
|
1066
|
-
"No default account set. Use --account <name> or run `email account set-default --name <name>`."
|
|
1066
|
+
"No default account set. Use --account <name> or run `ghostpaw-email account set-default --name <name>`."
|
|
1067
1067
|
);
|
|
1068
1068
|
}
|
|
1069
1069
|
const account = file.accounts.find((a) => a.name === targetSlug);
|
|
1070
1070
|
if (!account) {
|
|
1071
1071
|
throw new CliError(
|
|
1072
1072
|
"account_not_found",
|
|
1073
|
-
`Account "${targetSlug}" not found. Use \`email account list\` to see configured accounts.`
|
|
1073
|
+
`Account "${targetSlug}" not found. Use \`ghostpaw-email account list\` to see configured accounts.`
|
|
1074
1074
|
);
|
|
1075
1075
|
}
|
|
1076
1076
|
return applyEnvOverrides(account);
|
|
@@ -3517,7 +3517,8 @@ function createWriteSurface(db, options) {
|
|
|
3517
3517
|
async function sendComposed(composed) {
|
|
3518
3518
|
const raw2 = composed.toString("utf8");
|
|
3519
3519
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
3520
|
-
const
|
|
3520
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
3521
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
3521
3522
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
3522
3523
|
const toAddrs = toMatch.flatMap(
|
|
3523
3524
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
|
@@ -4843,6 +4844,15 @@ function createNetworkSurface(db, options) {
|
|
|
4843
4844
|
}
|
|
4844
4845
|
return session;
|
|
4845
4846
|
}
|
|
4847
|
+
async function pullFolders(s3) {
|
|
4848
|
+
const result = [];
|
|
4849
|
+
for (const f of await s3.listFolders()) {
|
|
4850
|
+
result.push(
|
|
4851
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
4852
|
+
);
|
|
4853
|
+
}
|
|
4854
|
+
return result;
|
|
4855
|
+
}
|
|
4846
4856
|
return {
|
|
4847
4857
|
connect: async () => {
|
|
4848
4858
|
await requireSession().connect();
|
|
@@ -4874,7 +4884,8 @@ function createNetworkSurface(db, options) {
|
|
|
4874
4884
|
},
|
|
4875
4885
|
sync: async (syncOptions) => {
|
|
4876
4886
|
const s3 = requireSession();
|
|
4877
|
-
|
|
4887
|
+
let folders = listFolders(db, accountId);
|
|
4888
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
4878
4889
|
const results = [];
|
|
4879
4890
|
let totalNew = 0;
|
|
4880
4891
|
let totalExpunged = 0;
|
|
@@ -4913,21 +4924,7 @@ function createNetworkSurface(db, options) {
|
|
|
4913
4924
|
}
|
|
4914
4925
|
}
|
|
4915
4926
|
},
|
|
4916
|
-
refreshFolders: async () =>
|
|
4917
|
-
const s3 = requireSession();
|
|
4918
|
-
const imapFolders = await s3.listFolders();
|
|
4919
|
-
const result = [];
|
|
4920
|
-
for (const f of imapFolders) {
|
|
4921
|
-
const upserted = upsertFolder(db, {
|
|
4922
|
-
accountId,
|
|
4923
|
-
path: f.path,
|
|
4924
|
-
delimiter: f.delimiter,
|
|
4925
|
-
role: f.role
|
|
4926
|
-
});
|
|
4927
|
-
result.push(upserted);
|
|
4928
|
-
}
|
|
4929
|
-
return result;
|
|
4930
|
-
},
|
|
4927
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
4931
4928
|
searchRemote: async (folder, query) => {
|
|
4932
4929
|
const s3 = requireSession();
|
|
4933
4930
|
if (s3.selectedFolder !== folder) {
|
|
@@ -4986,7 +4983,7 @@ var init_network = __esm({
|
|
|
4986
4983
|
});
|
|
4987
4984
|
|
|
4988
4985
|
// src/version.ts
|
|
4989
|
-
var emailVersion = "0.5.
|
|
4986
|
+
var emailVersion = "0.5.3";
|
|
4990
4987
|
|
|
4991
4988
|
// src/surface/email_mcp_instructions.ts
|
|
4992
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.";
|
|
@@ -5881,7 +5878,7 @@ var emailMcpTools = emailTools2.map((tool) => ({
|
|
|
5881
5878
|
next: [
|
|
5882
5879
|
{
|
|
5883
5880
|
kind: "use_tool",
|
|
5884
|
-
message: "Configure an account with email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
5881
|
+
message: "Configure an account with ghostpaw-email account add --name work --imap-host imap.example.com --smtp-host smtp.example.com --user you@example.com --pass yourpassword."
|
|
5885
5882
|
}
|
|
5886
5883
|
],
|
|
5887
5884
|
data: { entities: [] }
|
package/package.json
CHANGED