@ghostpaw/email 0.5.6 → 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 CHANGED
@@ -156,7 +156,7 @@ 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, add `export PATH="$HOME/.local/bin:$PATH"` to your shell profile yourself.
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
160
 
161
161
  linux-x64:
162
162
 
@@ -191,7 +191,13 @@ irm https://raw.githubusercontent.com/GhostPawJS/email/main/install.ps1 | iex
191
191
  Pinned to a release:
192
192
 
193
193
  ```sh
194
- curl -fsSL https://raw.githubusercontent.com/GhostPawJS/email/main/install.sh | sh -s -- --target linux-x64 --version 0.5.6 && export PATH="$HOME/.local/bin:$PATH"
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"
195
201
  ```
196
202
 
197
203
  To skip the persistent user PATH edit (the installer still installs and prints the folder to add):
@@ -202,7 +208,7 @@ $env:GHOSTPAW_NO_MODIFY_PATH=1; irm https://raw.githubusercontent.com/GhostPawJS
202
208
 
203
209
  ```text
204
210
  $ ghostpaw-email --version
205
- email 0.5.6 (binary, linux-x64)
211
+ email 0.5.7 (binary, linux-x64)
206
212
  ```
207
213
 
208
214
  Scripts that compare versions should use `--version --short` or `--version --json`.
@@ -476,6 +482,19 @@ email read queue --json | jq '.entities[].title'
476
482
  echo "body text" | email compose send --to bob@example.com --subject "Hi"
477
483
  ```
478
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
+
479
498
  All commands return the same `{ outcome, summary, entities, nextSteps }`
480
499
  shape as the tool layer, with consistent exit codes (0 success, 1 user error,
481
500
  2 config, 3 auth, 4 network, 5 tool error).
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import f from 'node:readline';
4
4
  import * as tty from 'node:tty';
5
5
  import { WriteStream } from 'node:tty';
6
6
  import { isSea } from 'node:sea';
7
- import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
7
+ import { mkdirSync, readFileSync, writeFileSync, statSync } from 'node:fs';
8
8
  import { homedir } from 'node:os';
9
9
  import { sep, dirname, join, basename, extname } from 'node:path';
10
10
  import { EventEmitter } from 'node:events';
@@ -808,7 +808,7 @@ var init_cli_version = __esm({
808
808
  var emailVersion;
809
809
  var init_version = __esm({
810
810
  "src/version.ts"() {
811
- emailVersion = "0.5.6";
811
+ emailVersion = "0.5.7";
812
812
  }
813
813
  });
814
814
  function getConfigDir() {
@@ -7814,6 +7814,8 @@ email compose forward --folder INBOX --uid 1921 --to bob@example.com --body "FYI
7814
7814
  # Attach files (comma-separated paths)
7815
7815
  email compose send --to a@b.com --subject "Report" --body "See attached" \\
7816
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.
7817
7819
 
7818
7820
  # Drafts
7819
7821
  email compose draft --save --to a@b.com --subject "Draft" --body "WIP" --json
@@ -10651,6 +10653,59 @@ function getEmailToolByName(name) {
10651
10653
 
10652
10654
  // src/cli/commands/compose.ts
10653
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
10654
10709
  init_errors2();
10655
10710
 
10656
10711
  // src/mailbox.ts
@@ -10842,7 +10897,10 @@ var composeCommand = defineCommand({
10842
10897
  cc: { type: "string", description: "CC recipient(s), comma-separated" },
10843
10898
  bcc: { type: "string", description: "BCC recipient(s), comma-separated" },
10844
10899
  from: { type: "string", description: "From address (overrides account identity)" },
10845
- attach: { type: "string", description: "File path(s) to attach, comma-separated" }
10900
+ attach: {
10901
+ type: "string",
10902
+ description: "Regular file path(s) to attach, comma-separated (directories and special files are rejected)"
10903
+ }
10846
10904
  },
10847
10905
  async run({ args: _args }) {
10848
10906
  const args = _args;
@@ -10879,7 +10937,10 @@ var composeCommand = defineCommand({
10879
10937
  to: { type: "string", description: "Override recipient(s)" },
10880
10938
  cc: { type: "string", description: "CC recipient(s)" },
10881
10939
  "reply-all": { type: "boolean", description: "Reply to all recipients", default: false },
10882
- attach: { type: "string", description: "File path(s) to attach, comma-separated" }
10940
+ attach: {
10941
+ type: "string",
10942
+ description: "Regular file path(s) to attach, comma-separated (directories and special files are rejected)"
10943
+ }
10883
10944
  },
10884
10945
  async run({ args: _args }) {
10885
10946
  const args = _args;
@@ -11047,36 +11108,6 @@ function parseUid(raw2) {
11047
11108
  }
11048
11109
  return n3;
11049
11110
  }
11050
- function loadAttachments(paths) {
11051
- return paths.split(",").map((p) => {
11052
- const filePath = p.trim();
11053
- const content = readFileSync(filePath);
11054
- const filename = basename(filePath);
11055
- const mimeType = extensionToMime(extname(filename).toLowerCase());
11056
- return mimeType ? { filename, content, mimeType } : { filename, content };
11057
- });
11058
- }
11059
- var MIME_MAP = {
11060
- ".pdf": "application/pdf",
11061
- ".png": "image/png",
11062
- ".jpg": "image/jpeg",
11063
- ".jpeg": "image/jpeg",
11064
- ".gif": "image/gif",
11065
- ".txt": "text/plain",
11066
- ".html": "text/html",
11067
- ".htm": "text/html",
11068
- ".csv": "text/csv",
11069
- ".json": "application/json",
11070
- ".zip": "application/zip",
11071
- ".xml": "application/xml",
11072
- ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
11073
- ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
11074
- ".mp4": "video/mp4",
11075
- ".mp3": "audio/mpeg"
11076
- };
11077
- function extensionToMime(ext) {
11078
- return MIME_MAP[ext];
11079
- }
11080
11111
 
11081
11112
  // src/cli/commands/organize.ts
11082
11113
  init_account();
@@ -316,7 +316,7 @@ var init_mcp_stdio = __esm({
316
316
  var emailVersion;
317
317
  var init_version = __esm({
318
318
  "src/version.ts"() {
319
- emailVersion = "0.5.6";
319
+ emailVersion = "0.5.7";
320
320
  }
321
321
  });
322
322
 
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.6";
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.6";
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ghostpaw/email",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
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": {
@@ -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