@ghostpaw/email 0.5.1 → 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 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
+ ![ghostpaw-email 0.5.1 against a local test server: version, account add and show, compose send, sync, read queue, search, organize star and the raw message](https://raw.githubusercontent.com/GhostPawJS/email/main/docs/assets/cli.png)
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,7 @@ 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
- Sizes for 0.5.0 (Node 26.12.1 inside each binary):
231
+ Sizes for 0.5.1 (Node 26.12.1 inside each binary):
226
232
 
227
233
  | Target | Archive | Binary |
228
234
  |---|---|---|
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.1";
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);
@@ -6936,7 +6936,7 @@ function parseCliArgs(argv2, spec) {
6936
6936
  if (arg.type === "boolean" && raw2 === void 0) raw2 = negative ? "false" : "true";
6937
6937
  if (raw2 === void 0) {
6938
6938
  const next = argv2[i2 + 1];
6939
- if (next === void 0 || next.startsWith("--"))
6939
+ if (next === void 0 || /^--[a-z]/i.test(next))
6940
6940
  throw new CliUsageError(`Missing value: --${arg.name}`);
6941
6941
  raw2 = next;
6942
6942
  i2++;
@@ -7493,7 +7493,7 @@ var init_email_surface_tools = __esm({
7493
7493
  next: [
7494
7494
  {
7495
7495
  kind: "use_tool",
7496
- 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."
7497
7497
  }
7498
7498
  ],
7499
7499
  data: { entities: [] }
@@ -8308,7 +8308,15 @@ var init_email_cli_options = __esm({
8308
8308
  openContext: async (options) => {
8309
8309
  const { openEmailDb: openEmailDb2 } = await Promise.resolve().then(() => (init_open_email_db(), open_email_db_exports));
8310
8310
  const { resolveEmailDbPath: resolveEmailDbPath2 } = await Promise.resolve().then(() => (init_resolve_email_db_path(), resolve_email_db_path_exports));
8311
- return openEmailDb2(resolveEmailDbPath2(options.db === void 0 ? {} : { flag: options.db }));
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 }));
8312
8320
  },
8313
8321
  closeContext: (db) => db.close(),
8314
8322
  commands: {
@@ -9875,7 +9883,7 @@ var accountCommand = defineCommand({
9875
9883
  await safeRun({}, async () => {
9876
9884
  const file = loadAccounts();
9877
9885
  if (!file || file.accounts.length === 0) {
9878
- print("No accounts configured. Run `email account add` to get started.");
9886
+ print("No accounts configured. Run `ghostpaw-email account add` to get started.");
9879
9887
  return;
9880
9888
  }
9881
9889
  print("");
@@ -9904,14 +9912,14 @@ var accountCommand = defineCommand({
9904
9912
  "imap-port": { type: "string", description: "IMAP port (default: 993)", default: "993" },
9905
9913
  "imap-tls": {
9906
9914
  type: "boolean",
9907
- description: "Use TLS for IMAP (default: true)",
9915
+ description: "Disable TLS for IMAP (TLS is on by default)",
9908
9916
  default: true
9909
9917
  },
9910
9918
  "smtp-host": { type: "string", description: "SMTP hostname", required: true },
9911
9919
  "smtp-port": { type: "string", description: "SMTP port (default: 587)", default: "587" },
9912
9920
  "smtp-tls": {
9913
9921
  type: "boolean",
9914
- description: "Use TLS for SMTP (default: true)",
9922
+ description: "Disable TLS for SMTP (TLS is on by default)",
9915
9923
  default: true
9916
9924
  },
9917
9925
  user: { type: "string", description: "Auth username / email address", required: true },
@@ -9968,7 +9976,7 @@ var accountCommand = defineCommand({
9968
9976
  if (existing?.accounts.some((a2) => a2.name === name)) {
9969
9977
  throw new CliError(
9970
9978
  "account_invalid",
9971
- `Account "${name}" already exists. Use \`email account remove --name ${name}\` first.`
9979
+ `Account "${name}" already exists. Use \`ghostpaw-email account remove --name ${name}\` first.`
9972
9980
  );
9973
9981
  }
9974
9982
  const file = existing ?? { version: 1, default: null, accounts: [] };
@@ -10863,7 +10871,10 @@ var readCommand = defineCommand({
10863
10871
  `Unknown view: "${view}". Valid views: folders, queue, thread, message, attachment, eml`
10864
10872
  );
10865
10873
  }
10866
- const result = await withMailbox(account, (ctx) => readTool.handler(ctx, toolInput));
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
+ });
10867
10878
  renderResult(result, opts);
10868
10879
  });
10869
10880
  }
@@ -10873,7 +10884,7 @@ function requireFlag(value, flag, view) {
10873
10884
  throw new CliError(
10874
10885
  "missing_required_flag",
10875
10886
  `${flag} is required for view: ${view}
10876
- Usage: email read ${view} ${flag} <value>`
10887
+ Usage: ghostpaw-email read ${view} ${flag} <value>`
10877
10888
  );
10878
10889
  }
10879
10890
  }
@@ -10928,7 +10939,7 @@ var searchCommand = defineCommand({
10928
10939
  if (!query)
10929
10940
  throw new CliError(
10930
10941
  "missing_required_flag",
10931
- "<query> is required.\nUsage: email search <query>"
10942
+ "<query> is required.\nUsage: ghostpaw-email search <query>"
10932
10943
  );
10933
10944
  const mode = args.mode ?? "local";
10934
10945
  if (mode !== "local" && mode !== "remote") {
@@ -11032,7 +11043,7 @@ var syncCommand = defineCommand({
11032
11043
  // src/cli/index.ts
11033
11044
  var main = defineCommand({
11034
11045
  meta: {
11035
- name: "email",
11046
+ name: "ghostpaw-email",
11036
11047
  version: emailVersion,
11037
11048
  description: "Local-first email CLI powered by @ghostpaw/email."
11038
11049
  },
@@ -11058,6 +11069,12 @@ var main = defineCommand({
11058
11069
  }
11059
11070
  });
11060
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
+ }
11061
11078
  let index = 0;
11062
11079
  while (index < args.length) {
11063
11080
  const token = args[index];
@@ -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.1";
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);
@@ -6136,7 +6136,7 @@ var init_email_surface_tools = __esm({
6136
6136
  next: [
6137
6137
  {
6138
6138
  kind: "use_tool",
6139
- 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."
6140
6140
  }
6141
6141
  ],
6142
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);
@@ -5007,7 +5007,7 @@ var init_network = __esm({
5007
5007
  });
5008
5008
 
5009
5009
  // src/version.ts
5010
- var emailVersion = "0.5.1";
5010
+ var emailVersion = "0.5.3";
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.";
@@ -5902,7 +5902,7 @@ var emailMcpTools = emailTools2.map((tool) => ({
5902
5902
  next: [
5903
5903
  {
5904
5904
  kind: "use_tool",
5905
- 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."
5906
5906
  }
5907
5907
  ],
5908
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);
@@ -4983,7 +4983,7 @@ var init_network = __esm({
4983
4983
  });
4984
4984
 
4985
4985
  // src/version.ts
4986
- var emailVersion = "0.5.1";
4986
+ var emailVersion = "0.5.3";
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.";
@@ -5878,7 +5878,7 @@ var emailMcpTools = emailTools2.map((tool) => ({
5878
5878
  next: [
5879
5879
  {
5880
5880
  kind: "use_tool",
5881
- 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."
5882
5882
  }
5883
5883
  ],
5884
5884
  data: { entities: [] }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostpaw/email",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Standalone IMAP/SMTP email engine for Node.js — SQLite local cache, threading, sync, zero dependencies, with a built-in LLM tool facade",
5
5
  "type": "module",
6
6
  "exports": {